NextApp Echo3
v3.0.b4

nextapp.echo.webcontainer
Class UserInstance

java.lang.Object
  extended by nextapp.echo.webcontainer.UserInstance
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.servlet.http.HttpSessionActivationListener, javax.servlet.http.HttpSessionBindingListener

public class UserInstance
extends java.lang.Object
implements javax.servlet.http.HttpSessionActivationListener, javax.servlet.http.HttpSessionBindingListener, 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(Connection conn)
          Creates a new UserInstance.
 
Method Summary
 void clearRenderStates()
          Clears all RenderState information.
 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.
 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.
 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.
 UserInstanceUpdateManager getUserInstanceUpdateManager()
          Returns the UserInstanceUpdateManager providing information about updated UserInstance properties.
 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.
static void newInstance(Connection conn)
          Creates a new Web Application Container instance using the provided client Connection.
 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 sessionDidActivate(javax.servlet.http.HttpSessionEvent e)
           
 void sessionWillPassivate(javax.servlet.http.HttpSessionEvent e)
           
 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.
 void valueBound(javax.servlet.http.HttpSessionBindingEvent e)
          Listener implementation of HttpSessionBindingListener.
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent e)
          Listener implementation of HttpSessionBindingListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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(Connection conn)
Creates a new UserInstance.

Parameters:
conn - the client/server Connection for which the instance is being instantiated
Method Detail

newInstance

public static void newInstance(Connection conn)
Creates a new Web Application Container instance using the provided client Connection. The instance will automatically be stored in the relevant HttpSession

Parameters:
conn - the client/server Connection for which the instance is being instantiated

clearRenderStates

public void clearRenderStates()
Clears all RenderState information.


getApplicationInstance

public nextapp.echo.app.ApplicationInstance getApplicationInstance()
Returns the corresponding ApplicationInstance for this user instance. Initializes the ApplicationInstance if it has not already been done.

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

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

getUserInstanceUpdateManager

public UserInstanceUpdateManager getUserInstanceUpdateManager()
Returns the UserInstanceUpdateManager providing information about updated UserInstance properties.

Returns:
the UserInstanceUpdateManager

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

sessionDidActivate

public void sessionDidActivate(javax.servlet.http.HttpSessionEvent e)
Specified by:
sessionDidActivate in interface javax.servlet.http.HttpSessionActivationListener
See Also:
Recreates reference to session. Notifies ApplicationInstance of activation.

sessionWillPassivate

public void sessionWillPassivate(javax.servlet.http.HttpSessionEvent e)
Specified by:
sessionWillPassivate in interface javax.servlet.http.HttpSessionActivationListener
See Also:
Notifies ApplicationInstance of passivation. Discards reference to session.

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)

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent e)
Listener implementation of HttpSessionBindingListener. Stores reference to session when invoked.

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener
See Also:
HttpSessionBindingListener.valueBound(HttpSessionBindingEvent)

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent e)
Listener implementation of HttpSessionBindingListener. Disposes ApplicationInstance. Removes reference to session when invoked.

Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener
See Also:
HttpSessionBindingListener.valueUnbound(HttpSessionBindingEvent)

NextApp Echo3
v3.0.b4