NextApp Echo3
v3.0.rc1

nextapp.echo.webcontainer
Class UserInstance

java.lang.Object
  extended by nextapp.echo.webcontainer.UserInstance
All Implemented Interfaces:
java.io.Serializable

public class UserInstance
extends java.lang.Object
implements java.io.Serializable

Object representing a single user-instance of an application hosted in the web application container. This object is stored in the HttpSession.

See Also:
Serialized Form

Field Summary
static java.lang.String PROPERTY_CLIENT_CONFIGURATION
          Client configuration data property name.
 
Constructor Summary
UserInstance(UserInstanceContainer container, java.lang.String id, java.lang.String clientWindowId, java.util.Map initialRequestParameterMap)
          Creates a new UserInstance.
 
Method Summary
 void clearRenderStates()
          Clears all RenderState information.
 void dispose()
          Disposes of the UserInstance.
 nextapp.echo.app.ApplicationInstance getApplicationInstance()
          Returns the corresponding ApplicationInstance for this user instance.
 int getCallbackInterval()
          Determines the application-specified asynchronous monitoring service callback interval.
 java.lang.String getCharacterEncoding()
          Returns the default character encoding in which responses should be rendered.
 ClientConfiguration getClientConfiguration()
          The ServerDelayMessage displayed during client/server-interactions.
 ClientProperties getClientProperties()
          Retrieves the ClientProperties object providing information about the client of this instance.
 java.lang.String getClientRenderId(nextapp.echo.app.Component component)
          Returns the client-side render id that should be used when rendering the specified Component.
 java.lang.String getClientWindowId()
          Returns the client-side generated unique browser window id displaying this UserInstance.
 nextapp.echo.app.Component getComponentByClientRenderId(java.lang.String clientRenderId)
          Retrieves the Component with the specified client-side render id.
 int getCurrentTransactionId()
          Returns the current transaction id.
 java.lang.String getId()
          Returns the UserInstance unique identifier.
 IdTable getIdTable()
          Retrieves the IdTable used by this ContainerInstance to assign weakly-referenced unique identifiers to arbitrary objects.
 java.util.Map getInitialRequestParameterMap()
          Returns an immutable Map containing the HTTP form parameters sent on the initial request to the application.
 int getNextTransactionId()
          Increments the current transaction id and returns it.
 RenderState getRenderState(nextapp.echo.app.Component component)
          Retrieves the RenderState of the specified Component.
 java.lang.String getRootHtmlElementId()
          Returns the id of the HTML element that will serve as the Root component.
 java.lang.String getServiceUri(Service service)
          Determines the URI to invoke the specified Service.
 java.lang.String getServiceUri(Service service, java.lang.String[] parameterNames, java.lang.String[] parameterValues)
          Determines the URI to invoke the specified Service with additional request parameters.
 java.lang.String getServletUri()
          Returns the URI of the servlet managing this UserInstance.
 javax.servlet.http.HttpSession getSession()
          Returns the HttpSession containing this UserInstance.
 nextapp.echo.app.update.UpdateManager getUpdateManager()
          Convenience method to retrieve the application's UpdateManager, which is used to synchronize client and server states.
 void init(Connection conn)
          Initializes the UserInstance, creating an instance of the target ApplicationInstance.
 boolean isInitialized()
          Determines if the UserInstance has been initialized, i.e., whether its init() method has been invoked.
 void purgeRenderStates()
          Removes all RenderStates whose components are not registered.
 void removeRenderState(nextapp.echo.app.Component component)
          Removes the RenderState of the specified Component.
 void setClientConfiguration(ClientConfiguration clientConfiguration)
          Sets the ClientConfiguration information containing application-specific client behavior settings.
 void setRenderState(nextapp.echo.app.Component component, RenderState renderState)
          Sets the RenderState of the specified Component.
 void setTaskQueueCallbackInterval(nextapp.echo.app.TaskQueueHandle taskQueue, int ms)
          Sets the interval between asynchronous callbacks from the client to check for queued tasks for a given TaskQueue.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_CLIENT_CONFIGURATION

public static final java.lang.String PROPERTY_CLIENT_CONFIGURATION
Client configuration data property name.

See Also:
Constant Field Values
Constructor Detail

UserInstance

public UserInstance(UserInstanceContainer container,
                    java.lang.String id,
                    java.lang.String clientWindowId,
                    java.util.Map initialRequestParameterMap)
Creates a new UserInstance.

Parameters:
container - the UserInstanceContainer
id - the unique user instance identifier, generated by the UserInstanceContainer
clientWindowId - the client-side generated unique browser window id displaying this UserInstance
initialRequestParameterMap - map containing parameters of the initial HTTP request
Method Detail

clearRenderStates

public void clearRenderStates()
Clears all RenderState information.


getApplicationInstance

public nextapp.echo.app.ApplicationInstance getApplicationInstance()
Returns the corresponding ApplicationInstance for this user instance.

Returns:
the relevant ApplicationInstance

getCallbackInterval

public int getCallbackInterval()
Determines the application-specified asynchronous monitoring service callback interval.

Returns:
the callback interval, in milliseconds

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Returns the default character encoding in which responses should be rendered.

Returns:
the default character encoding in which responses should be rendered

getClientConfiguration

public ClientConfiguration getClientConfiguration()
The ServerDelayMessage displayed during client/server-interactions. Retrieves the ClientConfiguration information containing application-specific client behavior settings.

Returns:
the relevant ClientProperties

getClientProperties

public ClientProperties getClientProperties()
Retrieves the ClientProperties object providing information about the client of this instance.

Returns:
the relevant ClientProperties

getClientRenderId

public java.lang.String getClientRenderId(nextapp.echo.app.Component component)
Returns the client-side render id that should be used when rendering the specified Component.

Parameters:
component - the component
Returns:
the client-side render id

getComponentByClientRenderId

public nextapp.echo.app.Component getComponentByClientRenderId(java.lang.String clientRenderId)
Retrieves the Component with the specified client-side render id.

Parameters:
clientRenderId - client-side element render id, e.g., "C.42323"
Returns:
the component (e.g., the component whose id is "42323")

getCurrentTransactionId

public int getCurrentTransactionId()
Returns the current transaction id.

Returns:
the current transaction id

getId

public java.lang.String getId()
Returns the UserInstance unique identifier.

Returns:
the identifier value

getClientWindowId

public java.lang.String getClientWindowId()
Returns the client-side generated unique browser window id displaying this UserInstance.

Returns:
the client-side window id

getIdTable

public IdTable getIdTable()
Retrieves the IdTable used by this ContainerInstance to assign weakly-referenced unique identifiers to arbitrary objects.

Returns:
the IdTable

getInitialRequestParameterMap

public java.util.Map getInitialRequestParameterMap()
Returns an immutable Map containing the HTTP form parameters sent on the initial request to the application.

Returns:
the initial request parameter map

getNextTransactionId

public int getNextTransactionId()
Increments the current transaction id and returns it.

Returns:
the current transaction id, after an increment

getRenderState

public RenderState getRenderState(nextapp.echo.app.Component component)
Retrieves the RenderState of the specified Component.

Parameters:
component - the component
Returns:
the rendering state

getRootHtmlElementId

public java.lang.String getRootHtmlElementId()
Returns the id of the HTML element that will serve as the Root component. This element must already be present in the DOM when the application is first rendered.

Returns:
the element id

getServiceUri

public java.lang.String getServiceUri(Service service)
Determines the URI to invoke the specified Service.

Parameters:
service - the Service
Returns:
the URI

getServiceUri

public java.lang.String getServiceUri(Service service,
                                      java.lang.String[] parameterNames,
                                      java.lang.String[] parameterValues)
Determines the URI to invoke the specified Service with additional request parameters. The additional parameters are provided by way of the parameterNames and parameterValues arrays. The value of a parameter at a specific index in the parameterNames array is provided in the parameterValues array at the same index. The arrays must thus be of equal length. Null values are allowed in the parameterValues array, and in such cases only the parameter name will be rendered in the returned URI.

Parameters:
service - the Service
parameterNames - the names of the additional URI parameters
parameterValues - the values of the additional URI parameters
Returns:
the URI

getServletUri

public java.lang.String getServletUri()
Returns the URI of the servlet managing this UserInstance.

Returns:
the URI

getSession

public javax.servlet.http.HttpSession getSession()
Returns the HttpSession containing this UserInstance.

Returns:
the HttpSession

getUpdateManager

public nextapp.echo.app.update.UpdateManager getUpdateManager()
Convenience method to retrieve the application's UpdateManager, which is used to synchronize client and server states. This method is equivalent to invoking getApplicationInstance().getUpdateManager().

Returns:
the UpdateManager

dispose

public void dispose()
Disposes of the UserInstance.


init

public void init(Connection conn)
Initializes the UserInstance, creating an instance of the target ApplicationInstance. The ApplicationInstance will not be initialized until getApplicationInstance() is invoked for the first time.

Parameters:
conn - the relevant Connection

isInitialized

public boolean isInitialized()
Determines if the UserInstance has been initialized, i.e., whether its init() method has been invoked.

Returns:
true if the UserInstance is initialized

purgeRenderStates

public void purgeRenderStates()
Removes all RenderStates whose components are not registered.


removeRenderState

public void removeRenderState(nextapp.echo.app.Component component)
Removes the RenderState of the specified Component.

Parameters:
component - the component

setClientConfiguration

public void setClientConfiguration(ClientConfiguration clientConfiguration)
Sets the ClientConfiguration information containing application-specific client behavior settings.

Parameters:
clientConfiguration - the new ClientConfiguration

setRenderState

public void setRenderState(nextapp.echo.app.Component component,
                           RenderState renderState)
Sets the RenderState of the specified Component.

Parameters:
component - the component
renderState - the render state

setTaskQueueCallbackInterval

public void setTaskQueueCallbackInterval(nextapp.echo.app.TaskQueueHandle taskQueue,
                                         int ms)
Sets the interval between asynchronous callbacks from the client to check for queued tasks for a given TaskQueue. If multiple TaskQueues are active, the smallest specified interval should be used. The default interval is 500ms. Application access to this method should be accessed via the ContainerContext.

Parameters:
taskQueue - the TaskQueue
ms - the number of milliseconds between asynchronous client callbacks
See Also:
ContainerContext.setTaskQueueCallbackInterval(nextapp.echo.app.TaskQueueHandle, int)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

NextApp Echo3
v3.0.rc1