org.opencms.module
Class TestModuleActionImpl

java.lang.Object
  extended by org.opencms.module.A_CmsModuleAction
      extended by org.opencms.module.TestModuleActionImpl
All Implemented Interfaces:
I_CmsEventListener, I_CmsModuleAction

public class TestModuleActionImpl
extends A_CmsModuleAction

Simple test implementation of the module action interface.


Field Summary
static int m_cmsEvent
          Indicates the last event type caught.
static boolean m_initialize
          Indicates if the initialize() method was called.
static boolean m_moduleUninstall
          Indicates if the moduleUninstall() method was called.
static boolean m_moduleUpdate
          Indicates if the moduleUpdate() method was called.
static boolean m_publishProject
          Indicates if the publishProject() method was called.
static boolean m_shutDown
          Indicates if the shutDown() method was called.
 
Fields inherited from interface org.opencms.main.I_CmsEventListener
EVENT_BEFORE_PUBLISH_PROJECT, EVENT_CLEAR_CACHES, EVENT_CLEAR_OFFLINE_CACHES, EVENT_CLEAR_ONLINE_CACHES, EVENT_CLEAR_PRINCIPAL_CACHES, EVENT_FLEX_CACHE_CLEAR, EVENT_FLEX_PURGE_JSP_REPOSITORY, EVENT_FULLSTATIC_EXPORT, EVENT_GROUP_MODIFIED, EVENT_LOGIN_USER, EVENT_OU_MODIFIED, EVENT_PROJECT_MODIFIED, EVENT_PROPERTY_DEFINITION_CREATED, EVENT_PROPERTY_DEFINITION_MODIFIED, EVENT_PROPERTY_MODIFIED, EVENT_PUBLISH_PROJECT, EVENT_REBUILD_SEARCHINDEXES, EVENT_RESOURCE_AND_PROPERTIES_MODIFIED, EVENT_RESOURCE_COPIED, EVENT_RESOURCE_CREATED, EVENT_RESOURCE_DELETED, EVENT_RESOURCE_MODIFIED, EVENT_RESOURCE_MOVED, EVENT_RESOURCES_AND_PROPERTIES_MODIFIED, EVENT_RESOURCES_MODIFIED, EVENT_SITEMAP_CHANGED, EVENT_UPDATE_EXPORTS, EVENT_USER_MODIFIED, KEY_CHANGE, KEY_DBCONTEXT, KEY_GROUP_ID, KEY_GROUP_NAME, KEY_INDEX_NAMES, KEY_OU_ID, KEY_OU_NAME, KEY_PROJECTID, KEY_PUBLISHID, KEY_PUBLISHLIST, KEY_REPORT, KEY_RESOURCE, KEY_RESOURCES, KEY_USER_ACTION, KEY_USER_ID, KEY_USER_NAME, LISTENERS_FOR_ALL_EVENTS, VALUE_GROUP_MODIFIED_ACTION_CREATE, VALUE_GROUP_MODIFIED_ACTION_DELETE, VALUE_GROUP_MODIFIED_ACTION_WRITE, VALUE_OU_MODIFIED_ACTION_CREATE, VALUE_OU_MODIFIED_ACTION_DELETE, VALUE_USER_MODIFIED_ACTION_ADD_USER_TO_GROUP, VALUE_USER_MODIFIED_ACTION_CREATE_USER, VALUE_USER_MODIFIED_ACTION_DELETE_USER, VALUE_USER_MODIFIED_ACTION_REMOVE_USER_FROM_GROUP, VALUE_USER_MODIFIED_ACTION_RESET_PASSWORD, VALUE_USER_MODIFIED_ACTION_SET_OU, VALUE_USER_MODIFIED_ACTION_WRITE_USER
 
Constructor Summary
TestModuleActionImpl()
          Default constructor.
 
Method Summary
 void cmsEvent(CmsEvent event)
          Acknowledge the occurrence of the specified event, implement this method to check for CmsEvents in your class.
 void initialize(CmsObject adminCms, CmsConfigurationManager configurationManager, CmsModule module)
          Will be called by the OpenCms system during server startup.
 void moduleUninstall(CmsModule module)
          Will be called if a module is uninstalled from an OpenCms system.
 void moduleUpdate(CmsModule module)
          Will be called if the module this action instance belongs to is updated.
 void publishProject(CmsObject cms, CmsPublishList publishList, int publishTag, I_CmsReport report)
          Will be called during a the publish process after the resources have been published, but before the publish event is fired.
 void shutDown(CmsModule module)
          Will be called by the OpenCms system during server shutdown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_cmsEvent

public static int m_cmsEvent
Indicates the last event type caught.


m_initialize

public static boolean m_initialize
Indicates if the initialize() method was called.


m_moduleUninstall

public static boolean m_moduleUninstall
Indicates if the moduleUninstall() method was called.


m_moduleUpdate

public static boolean m_moduleUpdate
Indicates if the moduleUpdate() method was called.


m_publishProject

public static boolean m_publishProject
Indicates if the publishProject() method was called.


m_shutDown

public static boolean m_shutDown
Indicates if the shutDown() method was called.

Constructor Detail

TestModuleActionImpl

public TestModuleActionImpl()
Default constructor.

Method Detail

cmsEvent

public void cmsEvent(CmsEvent event)
Description copied from interface: I_CmsEventListener
Acknowledge the occurrence of the specified event, implement this method to check for CmsEvents in your class.

Specified by:
cmsEvent in interface I_CmsEventListener
Overrides:
cmsEvent in class A_CmsModuleAction
Parameters:
event - CmsEvent that has occurred
See Also:
I_CmsEventListener.cmsEvent(org.opencms.main.CmsEvent)

initialize

public void initialize(CmsObject adminCms,
                       CmsConfigurationManager configurationManager,
                       CmsModule module)
Description copied from interface: I_CmsModuleAction
Will be called by the OpenCms system during server startup.

If a module requires special initialization code, this is a good place to to implement this functions.

Moreover, if the module requires special "one time" setup code, this should also be implemented here. For example if the module requires special DB tables to be created, you should implement a check if theses tables exist in this method, and if they don't exist create them as needed.

Specified by:
initialize in interface I_CmsModuleAction
Overrides:
initialize in class A_CmsModuleAction
Parameters:
adminCms - an initialized CmsObject with "Admin" permissions
configurationManager - the initialized OpenCms configuration manager
module - the module of this action instance
See Also:
I_CmsModuleAction.initialize(org.opencms.file.CmsObject, CmsConfigurationManager, CmsModule)

moduleUninstall

public void moduleUninstall(CmsModule module)
Description copied from interface: I_CmsModuleAction
Will be called if a module is uninstalled from an OpenCms system.

If you require special code to be executed if a module is uninstalled, implement it in this function.

Please note that there is no install() method. This is because the class loader will not have the module class instance available after module installation/upload. If you need to execute setup/install code, do this in the I_CmsModuleAction.initialize(CmsObject, CmsConfigurationManager, CmsModule) method during the next server startup.

This method is not called if the module this action instance belongs to is "replaced". In this case I_CmsModuleAction.moduleUpdate(CmsModule) is called after the new version of the module is installed.

Specified by:
moduleUninstall in interface I_CmsModuleAction
Overrides:
moduleUninstall in class A_CmsModuleAction
Parameters:
module - the module of this action instance
See Also:
I_CmsModuleAction.moduleUninstall(CmsModule)

moduleUpdate

public void moduleUpdate(CmsModule module)
Description copied from interface: I_CmsModuleAction
Will be called if the module this action instance belongs to is updated.

Specified by:
moduleUpdate in interface I_CmsModuleAction
Overrides:
moduleUpdate in class A_CmsModuleAction
Parameters:
module - the module of this action instance with the updated values
See Also:
I_CmsModuleAction.moduleUpdate(org.opencms.module.CmsModule)

publishProject

public void publishProject(CmsObject cms,
                           CmsPublishList publishList,
                           int publishTag,
                           I_CmsReport report)
Description copied from interface: I_CmsModuleAction
Will be called during a the publish process after the resources have been published, but before the publish event is fired.

If you require special code to be executed after a resource is published, implement it in this function any analyze the publish list for "interesting" resources.

Specified by:
publishProject in interface I_CmsModuleAction
Overrides:
publishProject in class A_CmsModuleAction
Parameters:
cms - the user context the publish was executed with
publishList - the list of published resources
publishTag - the publish tag
report - the report to write messages to
See Also:
I_CmsModuleAction.publishProject(org.opencms.file.CmsObject, org.opencms.db.CmsPublishList, int, org.opencms.report.I_CmsReport)

shutDown

public void shutDown(CmsModule module)
Description copied from interface: I_CmsModuleAction
Will be called by the OpenCms system during server shutdown.

If a module requires special "clean up" functions, for example removing temporary files, this is a good place to implement this functions.

Specified by:
shutDown in interface I_CmsModuleAction
Overrides:
shutDown in class A_CmsModuleAction
Parameters:
module - the module of this action instance
See Also:
I_CmsModuleAction.shutDown(CmsModule)