com.filenet.wcm.toolkit.server.base
Class WcmModule

java.lang.Object
  extended bycom.filenet.wcm.toolkit.server.base.WcmDpContainer
      extended bycom.filenet.wcm.toolkit.server.base.WcmModule
All Implemented Interfaces:
WcmModuleInterface
Direct Known Subclasses:
EProcessGranteeUtil, GlobalEventModule, WcmAuthoringUtil, WcmDpModule, WcmEProcessUtil, WcmWorkflowUtil

public class WcmModule
extends WcmDpContainer
implements WcmModuleInterface

WcmModule is the default base class for all UI and data provider modules. It defines behavior and functionality that is common to all modules.


Field Summary
protected  java.util.Locale locale
           
static java.lang.String NAME_DELIMITER
          The delimiter used between qualifiers in the qualified (parented) module name (getName).
 
Constructor Summary
WcmModule()
           
 
Method Summary
 WcmModuleInterface addChild(java.lang.Class moduleClass, java.lang.String moduleName)
          Creates a new instance of a module, sets it's name, and adds it as a child to this module.
 void addChild(WcmModuleInterface m)
          Add the specified module as a child to this module.
 void addChild(WcmModuleInterface m, java.lang.String moduleName)
          Add the specified module as a child to this module.
 void cleanup()
          Called by WcmController after persist(), when it's about to go to another JSP page.
 void debugTrace(java.lang.Object output)
          Prints out a debug message to the java console
 java.lang.Object getClassProperty(java.lang.String key)
          Get a key-value in the data store.
 java.lang.Object getClassProperty(java.lang.String key, java.lang.Object defaultValue, boolean setIfNotFound, boolean constructClass)
          Get a key-value in the data store.
protected  java.util.List getClassPropertyKeys()
          Deprecated.  
 WcmConfigurationInterface getConfiguration()
          Returns WcmConfigurationInterface
 WcmController getController()
          Get the reference to the controller.
 WcmDataStore getDataStore()
          Get the data store object.
 java.lang.Object getModuleProperty(java.lang.String key)
          Get a key-value from the data store.
 java.lang.Object getModuleProperty(java.lang.String key, java.lang.Object defaultValue)
          Get a key-value from the data store.
 java.lang.Object getModuleProperty(java.lang.String key, java.lang.Object defaultValue, boolean setIfNotFound)
          Get a key-value from the data store.
 java.lang.Object getModuleProperty(java.lang.String key, java.lang.Object defaultValue, boolean setIfNotFound, boolean constructClass)
          Get a key-value from the data store.
protected  java.util.List getModulePropertyKeys()
          Deprecated.  
 java.lang.String getName()
          Get the unique name for this module.
 WcmModuleInterface getParent()
          Get the module's parent if this is a contained module.
 java.lang.Object getWindowProperty(java.lang.String key)
          Get a key-value in the data store.
 java.lang.Object getWindowProperty(java.lang.String key, java.lang.Object defaultValue, boolean setIfNotFound, boolean constructClass)
          Get a key-value in the data store.
 void initialize()
          Called by WcmController when the module is registered, and has access to the data store.
 void persist()
          Called by WcmController before cleanup(), when it's about to go to another Java™Server Pages (JSP) page.
 WcmDpModuleInterface queryDataProvider(java.lang.String type)
          Query for an associated data provider (added with addDataProvider) of the specified type.
 void setClassProperty(java.lang.String key, java.lang.Object value)
           
 void setClassProperty(java.lang.String key, java.lang.Object value, boolean bForCache)
          Set a key-value in the data store.
 void setController(WcmController c)
          Called by WcmController as part of module registration/un-registration.
 void setModuleProperty(java.lang.String key, java.lang.Object value)
          Set a module-scoped property in the data store.
 void setModuleProperty(java.lang.String key, java.lang.Object value, boolean bForCache)
          Set a key-value in the data store.
 void setName(java.lang.String value)
          Set the unique name for this module.
 void setParent(WcmModuleInterface m)
          Set the specified module as the parent of this module.
protected  void setPortletParent(WcmModuleInterface m)
          We're in a portlet environment where multiple controllers are being created for a single request.
 void setWindowProperty(java.lang.String key, java.lang.Object value, boolean bForCache)
          Set a key-value in the data store.
 
Methods inherited from class com.filenet.wcm.toolkit.server.base.WcmDpContainer
addDataProvider, addDataProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.filenet.wcm.toolkit.server.base.WcmModuleInterface
addDataProvider
 

Field Detail

NAME_DELIMITER

public static final java.lang.String NAME_DELIMITER
The delimiter used between qualifiers in the qualified (parented) module name (getName).

See Also:
Constant Field Values

locale

protected java.util.Locale locale
Constructor Detail

WcmModule

public WcmModule()
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Called by WcmController when the module is registered, and has access to the data store. Do "constructor" types of things here.

Specified by:
initialize in interface WcmModuleInterface
Throws:
java.lang.Exception

persist

public void persist()
             throws java.lang.Exception
Called by WcmController before cleanup(), when it's about to go to another Java™Server Pages (JSP) page. This is intended for future use.

Specified by:
persist in interface WcmModuleInterface
Throws:
java.lang.Exception

cleanup

public void cleanup()
             throws java.lang.Exception
Called by WcmController after persist(), when it's about to go to another JSP page. The module should null out any module properties that it can re-construct later to minimize memory consumption.

Specified by:
cleanup in interface WcmModuleInterface
Throws:
java.lang.Exception

setName

public void setName(java.lang.String value)
             throws java.lang.Exception
Set the unique name for this module.

Specified by:
setName in interface WcmModuleInterface
Parameters:
value - The name value.
Throws:
WcmException - toolkit.WcmModule.nameInvalid, if the name contains the illegal characters NAME_DELIMITER or ( . ).
java.lang.Exception

getName

public java.lang.String getName()
Get the unique name for this module. This will be different from the value that you pass to setName, if the module is being parented by another module. The name returned here will be fully qualified with any parent names.

Specified by:
getName in interface WcmModuleInterface
Returns:
The fully qualified name value.

queryDataProvider

public WcmDpModuleInterface queryDataProvider(java.lang.String type)
Query for an associated data provider (added with addDataProvider) of the specified type. If not found in this module, queryDataProvider is recursively called up the parents until it finds one. Alternatively, call WcmController.queryDataProvider.

Specified by:
queryDataProvider in interface WcmModuleInterface
Overrides:
queryDataProvider in class WcmDpContainer
Parameters:
type - The type name for the data provider. All data providers should follow the convention of providing a public static final TYPE that can be passed here.
Returns:
An instance of the data provider if found, otherwise null.

setModuleProperty

public void setModuleProperty(java.lang.String key,
                              java.lang.Object value)
                       throws java.lang.Exception
Description copied from interface: WcmModuleInterface
Set a module-scoped property in the data store.

Specified by:
setModuleProperty in interface WcmModuleInterface
Parameters:
key - The key name to use.
value - The value to set. null is valid, and clears the key.
Throws:
java.lang.Exception
See Also:
Calls setModuleProperty(key, value, false)

setModuleProperty

public void setModuleProperty(java.lang.String key,
                              java.lang.Object value,
                              boolean bForCache)
                       throws java.lang.Exception
Set a key-value in the data store. The key that you pass here is internally scoped to the window/page/module instance.

Parameters:
key - The key name to use.
value - The value to set. null is valid, and clears the key.
bForCache - Adds the value as a SoftReference, which means that when the system is low on memory, the value will automatically be removed.
Throws:
WcmException - (toolkit.WcmModule.setModulePropertyNullKey)
java.lang.Exception

getModuleProperty

public java.lang.Object getModuleProperty(java.lang.String key)
                                   throws java.lang.Exception
Get a key-value from the data store. The key that you pass here is internally scoped to the window/page/module instance.

Specified by:
getModuleProperty in interface WcmModuleInterface
Parameters:
key - The key name to use.
Returns:
The value associated with the key, or null.
Throws:
WcmException - (toolkit.WcmModule.getModulePropertyNullKey)
WcmException - (toolkit.WcmModule.dataStoreUndefined)
java.lang.Exception

getModulePropertyKeys

protected java.util.List getModulePropertyKeys()
                                        throws java.lang.Exception
Deprecated.  

The keys returned are no longer fully scoped into the dataStore. The keys returned exist in the windowMap for the current window ID.

Throws:
java.lang.Exception

getClassPropertyKeys

protected java.util.List getClassPropertyKeys()
                                       throws java.lang.Exception
Deprecated.  

This method returns valid qualified dataStore keys, but cannot be relied upon in future releases.

Throws:
java.lang.Exception

setClassProperty

public void setClassProperty(java.lang.String key,
                             java.lang.Object value)
                      throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
Calls setClassProperty(key, value, false)

setWindowProperty

public void setWindowProperty(java.lang.String key,
                              java.lang.Object value,
                              boolean bForCache)
                       throws java.lang.Exception
Set a key-value in the data store. The key that you pass here is internally scoped to the class/windowId. These are shared between all instances of a module class in a given window.

Parameters:
key - The key name to use.
value - The value to set. null is valid, and clears the key.
bForCache - Adds the value as a SoftReference, which means that when the system is low on memory, the value will automatically be removed.
Throws:
WcmException - (toolkit.WcmModule.setModulePropertyNullKey)
java.lang.Exception

setClassProperty

public void setClassProperty(java.lang.String key,
                             java.lang.Object value,
                             boolean bForCache)
                      throws java.lang.Exception
Set a key-value in the data store. The key that you pass here is internally scoped to the class. These are shared between all instances of a module class.

Parameters:
key - The key name to use.
value - The value to set. null is valid, and clears the key.
Throws:
WcmException - (toolkit.WcmModule.setModulePropertyNullKey)
java.lang.Exception

getWindowProperty

public java.lang.Object getWindowProperty(java.lang.String key)
                                   throws java.lang.Exception
Get a key-value in the data store. The key that you pass here is internally scoped to the class/windowId. These are shared between all instances of a module class in a given window.

Parameters:
key - The key name to use.
Returns:
The value associated with the key, or null.
Throws:
WcmException - (toolkit.WcmModule.getModulePropertyNullKey)
java.lang.Exception

getWindowProperty

public java.lang.Object getWindowProperty(java.lang.String key,
                                          java.lang.Object defaultValue,
                                          boolean setIfNotFound,
                                          boolean constructClass)
                                   throws java.lang.Exception
Get a key-value in the data store. The key that you pass here is internally scoped to the class/windowId. These are shared between all instances of a module class.

Parameters:
key - The key name to use.
defaultValue - If no value is found for the key, this object is returned.
setIfNotFound - If no value is found for the key, set the newly returned value.
constructClass - If the defaultValue is instanceof Class, construct an instance using the default constructor and return if not found.
Returns:
The value associated with the key, or null.
Throws:
WcmException - (toolkit.WcmModule.getModulePropertyNullKey)
java.lang.Exception

getClassProperty

public java.lang.Object getClassProperty(java.lang.String key)
                                  throws java.lang.Exception
Get a key-value in the data store. The key that you pass here is internally scoped to the class. These are shared between all instances of a module class.

Parameters:
key - The key name to use.
Returns:
The value associated with the key, or null.
Throws:
WcmException - (toolkit.WcmModule.getModulePropertyNullKey)
java.lang.Exception

getClassProperty

public java.lang.Object getClassProperty(java.lang.String key,
                                         java.lang.Object defaultValue,
                                         boolean setIfNotFound,
                                         boolean constructClass)
                                  throws java.lang.Exception
Get a key-value in the data store. The key that you pass here is internally scoped to the class. These are shared between all instances of a module class.

Parameters:
key - The key name to use.
defaultValue - If no value is found for the key, this object is returned.
setIfNotFound - If no value is found for the key, set the newly returned value.
constructClass - If the defaultValue is instanceof Class, construct an instance using the default constructor and return if not found.
Returns:
The value associated with the key, or null.
Throws:
WcmException - (toolkit.WcmModule.getModulePropertyNullKey)
java.lang.Exception

getModuleProperty

public java.lang.Object getModuleProperty(java.lang.String key,
                                          java.lang.Object defaultValue)
                                   throws java.lang.Exception
Get a key-value from the data store. The key that you pass here is internally scoped to the window/page/module instance.

Parameters:
key - The key name to use.
defaultValue - Value to return if the key-value is undefined in the data store.
Returns:
The value associated with the key, or null.
Throws:
WcmException - (toolkit.WcmModule.getModulePropertyNullKey)
java.lang.Exception

getModuleProperty

public java.lang.Object getModuleProperty(java.lang.String key,
                                          java.lang.Object defaultValue,
                                          boolean setIfNotFound)
                                   throws java.lang.Exception
Get a key-value from the data store. The key that you pass here is internally scoped to the window/page/module instance.

Parameters:
key - The key name to use.
defaultValue - Value to return if the key-value is undefined in the data store.
setIfNotFound - If true, and the key-value is not defined in the data store, set the defaultValue in the data store for this key.
Returns:
The value associated with the key, or null.
Throws:
WcmException - (toolkit.WcmModule.getModulePropertyNullKey)
java.lang.Exception

getModuleProperty

public java.lang.Object getModuleProperty(java.lang.String key,
                                          java.lang.Object defaultValue,
                                          boolean setIfNotFound,
                                          boolean constructClass)
                                   throws java.lang.Exception
Get a key-value from the data store. The key that you pass here is internally scoped to the window/page/module instance.

Parameters:
key - The key name to use.
defaultValue - Value to return if the key-value is undefined in the data store.
setIfNotFound - If true, and the key-value is not defined in the data store, set the defaultValue in the data store for this key.
constructClass - If the defaultValue is instanceof Class, construct an instance using the default constructor and return if not found.
Returns:
The value associated with the key, or null.
Throws:
WcmException - (toolkit.WcmModule.getModulePropertyNullKey)
java.lang.Exception

getDataStore

public final WcmDataStore getDataStore()
                                throws java.lang.Exception
Get the data store object.

Specified by:
getDataStore in interface WcmModuleInterface
Returns:
The reference to the data store.
Throws:
WcmException - (toolkit.WcmModule.moduleNotRegistered)
WcmException - (toolkit.WcmModule.dataStoreUndefined)
java.lang.Exception

addChild

public final void addChild(WcmModuleInterface m)
                    throws java.lang.Exception
Add the specified module as a child to this module. This registers the module.

Parameters:
m - A reference to the module that is to become this module's child.
Throws:
WcmException - (toolkit.WcmModule.setParentAlreadyRegistered)
java.lang.Exception

addChild

public final void addChild(WcmModuleInterface m,
                           java.lang.String moduleName)
                    throws java.lang.Exception
Add the specified module as a child to this module. This registers the module.

Parameters:
m - A reference to the module that is to become this module's child.
moduleName - The passed module has its name set to this value.
Throws:
WcmException - (toolkit.WcmModule.setParentAlreadyRegistered)
java.lang.Exception

addChild

public final WcmModuleInterface addChild(java.lang.Class moduleClass,
                                         java.lang.String moduleName)
                                  throws java.lang.Exception
Creates a new instance of a module, sets it's name, and adds it as a child to this module. This registers the module.

Parameters:
moduleClass - The module class to create an instance of.
moduleName - The name to give the new created child.
Returns:
reference to the new child module
Throws:
WcmException - (toolkit.WcmModule.setParentAlreadyRegistered)
java.lang.Exception

setParent

public final void setParent(WcmModuleInterface m)
                     throws java.lang.Exception
Set the specified module as the parent of this module. This registers the module.

Specified by:
setParent in interface WcmModuleInterface
Parameters:
m - The module that is to be this module's parent.
Throws:
WcmException - (toolkit.WcmModule.setParentAlreadyRegistered)
java.lang.Exception

setPortletParent

protected final void setPortletParent(WcmModuleInterface m)
                               throws java.lang.Exception
We're in a portlet environment where multiple controllers are being created for a single request. Don't call this method!

Parameters:
m - The module that is to be this module's parent.
Throws:
WcmException - (toolkit.WcmModule.setParentAlreadyRegistered)
java.lang.Exception

debugTrace

public void debugTrace(java.lang.Object output)
Prints out a debug message to the java console

Parameters:
output - value to print out.

getConfiguration

public WcmConfigurationInterface getConfiguration()
                                           throws java.lang.Exception
Returns WcmConfigurationInterface

Returns:
WcmConfigurationInterface
Throws:
java.lang.Exception

setController

public final void setController(WcmController c)
                         throws java.lang.Exception
Called by WcmController as part of module registration/un-registration.

Specified by:
setController in interface WcmModuleInterface
Parameters:
c - A valid reference to the controller when registering. null when un-registering.
Returns:
A valid reference to the controller when registering. null when un-registering.
Throws:
WcmException - (toolkit.wcmModule.setControllerOnUnregisteredModule)
WcmException - (toolkit.wcmModule.setControllerRegisteredModule)
java.lang.Exception

getController

public final WcmController getController()
Get the reference to the controller. This should always return a valid reference. If it returns null, the module is not registered.

Returns:
A reference to the current instance of WcmController.

getParent

public WcmModuleInterface getParent()
Get the module's parent if this is a contained module.

Specified by:
getParent in interface WcmModuleInterface
Returns:
A reference to the parent module or null if this is module is not contained.


© Copyright IBM Corp. 2002, 2007. All Rights Reserved.