com.boylesoftware.cb2.presentation.servlet
Class CB2PlugIn

java.lang.Object
  extended bycom.boylesoftware.cb2.presentation.servlet.CB2PlugIn
All Implemented Interfaces:
org.apache.struts.action.PlugIn

public final class CB2PlugIn
extends java.lang.Object
implements org.apache.struts.action.PlugIn

Struts plugin to enable CB2 presentation level for a Struts module. This plugin should be set up for each module that uses CB2. Regardless of how any instances of the plugin you install for different modules they all will share the same application context, business logic level and other basic application-wide subsystems, however each module will have its own presentation level subsystems such as CB2 pages.

The plugin expects the following init parameters:

Below is a sample fragment of a struts config file:

 ...
 <plug-in className="com.boylesoftware.cb2.presentation.servlet.CB2PlugIn">
   <set-property
     property="pages-config"
     value="/WEB-INF/pages-config-mymodule.xml"/>
   <set-property
     property="uistate"
     value="my.package.MyUIState"/>
 </plug-in>
 ...
 

Note that this plugin installs its own implementation of the RequestProcessor for the module and therefore it is not compatible with other plugins that do the same, for example with TilesPlugin.

This implementation supports persistent sessions provided that you set com.boylesoftware.cb2.keepBLSessions application property to true so the BLManager does not destroy BLO containers when the application goes down. Note that if you turn on persistent sessions in your servlet container implementation and forget to set the com.boylesoftware.cb2.keepBLSessions property you will get errors when using restored sessions.

Version:
$Id: CB2PlugIn.java,v 1.8 2004/04/28 15:12:08 levahim Exp $
Author:
Lev Himmelfarb

Constructor Summary
CB2PlugIn()
           
 
Method Summary
 void destroy()
          Destroys the plugin when the application goes down.
static CB2Application getApplication(javax.servlet.ServletContext servletCtx)
          Finds the CB2Application instance for the web-application.
 void init(org.apache.struts.action.ActionServlet servlet, org.apache.struts.config.ModuleConfig config)
          Initialize the plugin for a module.
 void setController(java.lang.String controllerClassName)
          Sets the controller class name init parameter.
 void setLockedUrl(java.lang.String lockedUrl)
          Sets the URL of the "application is locked" page.
 void setPagesConfig(java.lang.String pagesConfig)
          Sets the pages config file URL init parameter.
 void setRequestCharEncoding(java.lang.String requestCharEncoding)
          Sets optional request character encoding.
 void setResponseContentType(java.lang.String responseContentType)
          Sets optional response content type.
 void setUistate(java.lang.String uiStateClassName)
          Sets the UI state bean class name init parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CB2PlugIn

public CB2PlugIn()
Method Detail

setPagesConfig

public void setPagesConfig(java.lang.String pagesConfig)
Sets the pages config file URL init parameter.

Parameters:
pagesConfig - pages config file servlet context relative URL.

setController

public void setController(java.lang.String controllerClassName)
Sets the controller class name init parameter.

Parameters:
controllerClassName - the controller class name.

setUistate

public void setUistate(java.lang.String uiStateClassName)
Sets the UI state bean class name init parameter.

Parameters:
uiStateClassName - the UI state bean class name.

setLockedUrl

public void setLockedUrl(java.lang.String lockedUrl)
Sets the URL of the "application is locked" page.

Parameters:
lockedUrl - the page's URL.

setRequestCharEncoding

public void setRequestCharEncoding(java.lang.String requestCharEncoding)
Sets optional request character encoding.

Parameters:
requestCharEncoding - the request character encoding.

setResponseContentType

public void setResponseContentType(java.lang.String responseContentType)
Sets optional response content type.

Parameters:
responseContentType - the reponse content type string.

init

public void init(org.apache.struts.action.ActionServlet servlet,
                 org.apache.struts.config.ModuleConfig config)
          throws javax.servlet.ServletException
Initialize the plugin for a module. If this is the first, or the only module, then this method also creates and initializes such shared subsystems as the application context and business logic level manager.

Specified by:
init in interface org.apache.struts.action.PlugIn
Parameters:
servlet - reference to the Struts action servlet.
config - the module configuration.
Throws:
javax.servlet.ServletException - if the plugin cannot be initialized.

destroy

public void destroy()
Destroys the plugin when the application goes down. If this is the last, or the only module, then this method also destroys application context and business logic level manager.

Specified by:
destroy in interface org.apache.struts.action.PlugIn

getApplication

public static CB2Application getApplication(javax.servlet.ServletContext servletCtx)
Finds the CB2Application instance for the web-application.

Parameters:
servletCtx - the web-application's servlet context.
Returns:
reference to the CB2Application instance.


Copyright © 2002,2003,2004 - Boyle Software, Inc.