C# / .Net API Library Reference  4.3.2-74-ge1d4cca
Data Structures | Public Functions | Properties | Events
StateManagerServer Class Reference

The StateManagerServer is the singleton class used to communicate with the PureWeb server. It provides methods to start and stop the application, and to implement an input and output thread between the service and its client(s).

Public Functions

void InjectRequest (RequestInfo request)
 
void Start (IStateManagerController stateManager)
 
void Start (IStateManagerController stateManager, IPAddress address, int port)
 
bool Stop (TimeSpan timeout)
 

Properties

IInputStreamLogger InputStreamLogger [get, set]
 
IOutputStreamLogger OutputStreamLogger [get, set]
 
Dictionary< string, string > StartupParameters [get]
 

Events

EventHandler ShutdownRequested
 
EventHandler Stopped
 

Usage Description

void InjectRequest ( RequestInfo  request)
inline

Simulates a client-side request. This method is typically used for testing purposes.

The request is made to StateManager on the calling thread. Does not catch any exceptions thrown by any request handlers. There is no interlocking with the input thread, so requests may be handled concurrently with requests made via the input thread.

void Start ( IStateManagerController  stateManager)
inline

Initiates the process of starting StateManagerServer on the server specified by the PUREWEB_APPSERVER environment variable if set otherwise starts on localhost. The port to connect on is specified by the PUREWEB_PORT environment variable if set, defaulting to 8082 if not set.

void Start ( IStateManagerController  stateManager,
IPAddress  address,
int  port 
)
inline

Initiates the process of starting StateManagerServer at the specified IP address and port, and returns immediately.

Parameters
stateManagerThe StateManager to start.
addressThe IP address of the PureWeb server.
portThe port to connect on.
bool Stop ( TimeSpan  timeout)
inline

Initiates the process of stopping StateManagerServer, and returns after the specified timeout interval.

Returns true if all server threads have been succesfully stopped before the timeout period elapses.

Property Documentation

IInputStreamLogger InputStreamLogger
getset

Gets or sets the logger used for input stream logging. Will throw an InvalidOperationException if StateManagerServer is already started. Any errors that occur while writing to the input stream log may cause the input thread to behave in an undefined fashion.

IOutputStreamLogger OutputStreamLogger
getset

Gets or sets the logger used for output stream logging. Will throw an InvalidOperationException if StateManagerServer is already started. Any errors that occur while writing to the output stream log may cause the output thread to behave in an undefined fashion.

Dictionary<string, string> StartupParameters
get

Gets the list of the key-value pairs passed as query strings in the startup URL. This is for information purposes only, and may be useful when testing or troubleshooting.

Event Documentation

EventHandler ShutdownRequested

This event is fired when the StateManagerServer disconnects from the PureWeb server. It may be fired from the caller thread, and there may be in-progress responses and/or requests when this event is fired.

EventHandler Stopped

This event is fired when StateManager::Stop has been invoked (but not necessarily completed). At this point, no more requests will be dispatched, and no more responses will be sent. This event may be fired from the caller thread.