C# / .Net API Library Reference  4.3.2-74-ge1d4cca
Public Functions | Properties
ResourceManager Class Reference

The ResourceManager class provides methods for publishing and managing resources (binary objects) that are addressable by path. The data, which is stored on the service machine, can be anything that the service can copy as a byte array. This feature is commonly used in collaborative sessions, when multiple users are connected to the same PureWeb session. ResourceManager is primarily intended to facilitate the transfer of service-side data to the client. Data storage and retrieval is based on the unique identifier (GUID) key, which the store function automatically assigns to each resource.

Public Functions

void Clear ()
 
bool Contains (Guid key)
 
List< ResponseInfo > GetNextResponses (Guid sessionId)
 
void Initialize (StateManager stateManager)
 
bool Remove (Guid key)
 
ContentInfo Retrieve (Guid key)
 
void SessionConnected (Guid sessionId, XElement command)
 
void SessionDisconnected (Guid sessionId, XElement command)
 
Guid Store (ContentInfo resource)
 
void Store (Guid key, ContentInfo resource)
 
bool TryRetrieve (Guid key, out ContentInfo content)
 
void Uninitialize ()
 
Constructors and Destructors
 ResourceManager ()
 

Properties

int Count [get]
 

Usage Description

void Clear ( )
inline

Clears all stored resources.

Implements IResourceManager.

bool Contains ( Guid  key)
inline

Indicates whether an item with the specifed key already exists. Returns true if it does, or false otherwise.

Implements IResourceManager.

List<ResponseInfo> GetNextResponses ( Guid  sessionId)
inherited

Gets the next responses for the specified session.

Parameters
sessionIdThe unique identifier of the session.
void Initialize ( StateManager  stateManager)
inherited

Initializes the plugin with the specified StateManager.

Parameters
stateManagerThe StateManager.

Implemented in ViewManager.

bool Remove ( Guid  key)
inline

Attempts to remove the specified key. If the key exists, will return true and remove the resource. Otherwise, returns false.

Implements IResourceManager.

ContentInfo Retrieve ( Guid  key)
inline

Retrieves the resource currently stored at the specified key. If there are no resource at that key, will return an empty ContentInfo object.

Implements IResourceManager.

void SessionConnected ( Guid  sessionId,
XElement  command 
)
inherited

Indicates that the specified session is connected.

Parameters
sessionIdThe session's unique identifier.
commandThe command that caused the connection.
void SessionDisconnected ( Guid  sessionId,
XElement  command 
)
inherited

Indicates that the specified session is disconnected.

Parameters
sessionIdThe session's unique identifer.
commandThe command that caused the disconnection.
Guid Store ( ContentInfo  resource)
inline

Adds the specified resource, returning a key that can be used later to retrieve it. Before you can use this method, the resource must have already been saved as a ContentInfo object.

You can use the store function to save the same data in several different formats. This would be useful, for instance, to handle operating system differences. Consider for example the case of a collaborative text editing application. Let's say that you need to save a Windows-targeted .docx file, and a .pages file for iOS-based clients. Using ResourceManager, you would call the store method twice, once for each format, and this way each format of the file would be assigned its own GUID key.

Implements IResourceManager.

void Store ( Guid  key,
ContentInfo  resource 
)
inline

Stores the specified resource using the specified key. Any existing resource at that key will be replaced.

Parameters
keyThe key.
resourceThe resource. >

Implements IResourceManager.

bool TryRetrieve ( Guid  key,
out ContentInfo  content 
)
inline

Attempts to retrieve the specified resource. If the resource exists, will return true and retrieve the resource. Otherwise, returns false.

Implements IResourceManager.

void Uninitialize ( )
inherited

Uninitializes the plugin.

Implemented in ViewManager.

Property Documentation

int Count
get

Returns the number of items currently stored in ResourceManager.