Business Components

oracle.jbo.html.jsp
Class JSPApplicationRegistry

java.lang.Object
  |
  +--oracle.jdeveloper.html.WebBeanImpl
        |
        +--oracle.jbo.html.jsp.JSPApplicationRegistry

public class JSPApplicationRegistry
extends WebBeanImpl

This class provides the main interface for DataWebBeans to use the Application Module Pool. View implementation of JSPApplicationRegistry

Version:
PUBLIC

Field Summary
static java.lang.String RESERVED
           
static java.lang.String STATEFUL
           
static java.lang.String STATELESS
           
 
Fields inherited from class oracle.jdeveloper.html.WebBeanImpl
application, ctx, out, page, request, response, session
 
Constructor Summary
JSPApplicationRegistry()
          Constructor, this should not be called directly
 
Method Summary
static ApplicationModule getApplication(java.lang.String appName)
          Deprecated. As of BC4J 3.2, replaced by getAppModuleInstance(String, HttpServletRequest, HttpSession)
 ApplicationModule getAppModuleFromContexts(java.lang.String appName, javax.servlet.http.HttpSession session, javax.servlet.jsp.PageContext pageContext)
          Check the relevant http contexts for the named application module instance.
 ApplicationModule getAppModuleInstance(java.lang.String appName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session)
          Get an application module instance for the specified application pool.
 ApplicationModule getAppModuleInstance(java.lang.String appName, javax.servlet.jsp.PageContext pageContext)
          Get an application module instance for the specified application pool.
static java.util.Hashtable getAppSettings(java.lang.String appName)
          Returns the user data associated with the named pool.
static oracle.jbo.http.HttpContainer getHttpContainer(javax.servlet.http.HttpSession session)
           
static JSPApplicationRegistry getInstance()
          Returns the singleton instance of the registry class.
 java.lang.String getReleaseMode(java.lang.String appName)
          Helper method to obtain the specified application's release mode.
protected  java.lang.String readSessionId(javax.servlet.http.HttpServletRequest request, java.lang.String applicationName)
          Read the session id from the HttpServletRequest.
static void registerApplicationFromPropertyFile(javax.servlet.http.HttpSession session, java.lang.String sPropFileName)
          Convenience method for defining a new application pool from a property file.
static void registerApplicationFromPropertyFile(java.lang.String sPropFileName)
          Creates a new application pool from the contents of a property file.
 void releaseAppModuleInstance(ApplicationModule appModule, ApplicationPool pool, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, java.lang.String releaseMode)
          Release the specified application module instance.
 void releaseAppModuleInstance(ApplicationModule appModule, ApplicationPool pool, javax.servlet.jsp.PageContext pageContext, java.lang.String releaseMode)
          Release the specified application module instance.
 void releaseAppModuleInstance(java.lang.String poolName, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, java.lang.String releaseMode)
          Release the application module instance that was generated by the specified pool from the BC4J session context.
static void returnAppModuleInstance(java.lang.String appName, ApplicationModule appModule)
          Deprecated. As of BC4J 3.2, replaced by releaseAppModuleInstance(String, HttpSession, HttpServletResponse, String)
protected  void writeSessionId(javax.servlet.http.HttpServletResponse response, java.lang.String applicationName, java.lang.String sessionId)
          Write the session id to the HttpServletResponse.
 
Methods inherited from class oracle.jdeveloper.html.WebBeanImpl
generateScriptSrc, getCookie, getOut, getRenderingContext, getRequest, getRequestVariable, getUniqueName, initBeanForJS, initialize, initialize, initialize, internalInitialize, render, render, setRequestVariable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESERVED

public static final java.lang.String RESERVED

STATEFUL

public static final java.lang.String STATEFUL

STATELESS

public static final java.lang.String STATELESS
Constructor Detail

JSPApplicationRegistry

public JSPApplicationRegistry()
Constructor, this should not be called directly
Method Detail

getInstance

public static JSPApplicationRegistry getInstance()
Returns the singleton instance of the registry class.

getAppSettings

public static java.util.Hashtable getAppSettings(java.lang.String appName)
Returns the user data associated with the named pool. The user data is a convenient palce for storing and retrieving application-specific information shared by all application instances that are part of the named pool.

returnAppModuleInstance

public static void returnAppModuleInstance(java.lang.String appName,
                                           ApplicationModule appModule)
Deprecated. As of BC4J 3.2, replaced by releaseAppModuleInstance(String, HttpSession, HttpServletResponse, String)

This is a convenience method for returning an Application Module back to the pool. This method will find the ApplicationInstance associated with the Application Module and check it in to the pool.

releaseAppModuleInstance

public void releaseAppModuleInstance(ApplicationModule appModule,
                                     ApplicationPool pool,
                                     javax.servlet.http.HttpSession session,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.lang.String releaseMode)
Release the specified application module instance. This method is intended for use by servlet clients in order to release an application module resource to the application module pool.

The specified release mode will determine how the application module is returned to the pool. The following release modes are currently supported:

RESERVED: Do not allow the application module instance to be shared with other client requests. The reserved lock will be released when the application module is checked in by a latter request in the application life cycle or when the http session times out.

STATEFUL: Only available if a HttpServletResponse has been specified. The implementation will check the application module instance into the pool in a stateful manner which will allow the pool to maintain the application module state between session requests. This may involve passivating the session's application module state so that the application may be reused by other session requests. Using this option will cause a servlet cookie to be generated and written to the HttpServletResponse.

STATELESS: Check the application module instance into the pool without retaining application module state.

See Also:
ApplicationPool

releaseAppModuleInstance

public void releaseAppModuleInstance(ApplicationModule appModule,
                                     ApplicationPool pool,
                                     javax.servlet.jsp.PageContext pageContext,
                                     java.lang.String releaseMode)
Release the specified application module instance. This method is intended for use by JSP clients in order to release an application module resource to the application module pool.

The specified release mode will determine how the application module is returned to the pool. The following release modes are currently supported:

RESERVED: Do not allow the application module instance to be shared with other client requests. The reserved lock will be released when the application module is checked in by a latter request in the application life cycle or when the http session times out.

STATEFUL: Only available if a HttpServletResponse has been specified. The implementation will check the application module instance into the pool in a stateful manner which will allow the pool to maintain the application module state between session requests. This may involve passivating the session's application module state so that the application may be reused by other session requests. Using this option will cause a servlet cookie to be generated and written to the HttpServletResponse.

STATELESS: Check the application module instance into the pool without retaining application module state.

See Also:
ApplicationPool

releaseAppModuleInstance

public void releaseAppModuleInstance(java.lang.String poolName,
                                     javax.servlet.http.HttpSession session,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.lang.String releaseMode)
Release the application module instance that was generated by the specified pool from the BC4J session context.

getAppModuleInstance

public ApplicationModule getAppModuleInstance(java.lang.String appName,
                                              javax.servlet.http.HttpServletRequest request,
                                              javax.servlet.http.HttpSession session)
Get an application module instance for the specified application pool. This method is intended for servlet clients that require an application module.

The implementation will attempt to locate an application module in the session context before asking the application pool for an application module.

If an application module is not found in the session or page contexts the implementation will check the http request for a session cookie id. If a session cookie id exists the implementation will invoke, getInstanceWithSessionId, in order to return an application module with the same state as the application module that had been checked in by the session.

If a session cookie id does not exist the implementation will invoke, checkout in order to return a fresh application module (no existing state) to the invokee.

The returned application module is always checked out of the specified application pool.

See Also:
DataWebBeanImpl.internalInitialize()

getAppModuleInstance

public ApplicationModule getAppModuleInstance(java.lang.String appName,
                                              javax.servlet.jsp.PageContext pageContext)
Get an application module instance for the specified application pool. This method is intended for JSP clients that require an application module.

The implementation will attempt to locate an application module in the page and session contexts before asking the application pool for an application module.

If an application module is not found in the session or page contexts the implementation will check the http request for a session cookie id. If a session cookie id exists the implementation will invoke, getInstanceWithSessionId, in order to return an application module with the same state as the application module that had been checked in by the session.

If a session cookie id does not exist the implementation will invoke, checkout in order to return a fresh application module (no existing state) to the invokee.

The returned application module is always checked out of the specified application pool.

See Also:
oracle.jbo.html.jsp.datatags.ApplicationModuleTag#doEndTag

getAppModuleFromContexts

public ApplicationModule getAppModuleFromContexts(java.lang.String appName,
                                                  javax.servlet.http.HttpSession session,
                                                  javax.servlet.jsp.PageContext pageContext)
Check the relevant http contexts for the named application module instance.

If the page context is not null then first check the page context for a Bc4jPageContext container. If one is found then check for the specified application module instance. Otherwise check if the specified application module instance has been placed in the session context.

Parameters:
appModuleName - the name of the appModule instance that should be retrieved
session - the HttpSession context that should be checked for the named application module instance
pageContext - if a JSP client the name of the pageContext that should be checked for the named application module instance. Null otherwise.

getApplication

public static ApplicationModule getApplication(java.lang.String appName)
                                        throws java.lang.Exception
Deprecated. As of BC4J 3.2, replaced by getAppModuleInstance(String, HttpServletRequest, HttpSession)

Locates the application pool and check out a new application module. You can use the releaseAppModuleInstance(String, HttpSession, HttpServletResponse, String) method to return the Application Module back to the pool.

registerApplicationFromPropertyFile

public static void registerApplicationFromPropertyFile(javax.servlet.http.HttpSession session,
                                                       java.lang.String sPropFileName)
Convenience method for defining a new application pool from a property file. This also transfers some system specific variables to the JSP Session object.

registerApplicationFromPropertyFile

public static void registerApplicationFromPropertyFile(java.lang.String sPropFileName)
Creates a new application pool from the contents of a property file. Please look at the ConnectionInfo class for documentation of what should be contained in the property file.

getReleaseMode

public java.lang.String getReleaseMode(java.lang.String appName)
Helper method to obtain the specified application's release mode.

readSessionId

protected java.lang.String readSessionId(javax.servlet.http.HttpServletRequest request,
                                         java.lang.String applicationName)
Read the session id from the HttpServletRequest. By default this method uses Http cookies to store the unique session identifier for a stateful application module.
Parameters:
applicationName - the name of the application that has session state

writeSessionId

protected void writeSessionId(javax.servlet.http.HttpServletResponse response,
                              java.lang.String applicationName,
                              java.lang.String sessionId)
Write the session id to the HttpServletResponse. By default this method uses Http cookies to store a unique session identifier for a stateful application module.
Parameters:
applicationName - the name of the application that has session state

getHttpContainer

public static oracle.jbo.http.HttpContainer getHttpContainer(javax.servlet.http.HttpSession session)

Business Components