001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.module; 029 030import org.opencms.configuration.CmsConfigurationManager; 031import org.opencms.db.CmsPublishList; 032import org.opencms.file.CmsObject; 033import org.opencms.main.I_CmsEventListener; 034import org.opencms.report.I_CmsReport; 035 036/** 037 * Module action classes in OpenCms must implement this interface.<p> 038 * 039 * A module action class allows to perform special functions on certain 040 * OpenCms lifecycle system events, like {@link #initialize(CmsObject, CmsConfigurationManager, CmsModule)} or 041 * {@link #shutDown(CmsModule)}.<p> 042 * 043 * @since 6.0.0 044 * 045 * @see org.opencms.module.A_CmsModuleAction 046 */ 047public interface I_CmsModuleAction extends I_CmsEventListener { 048 049 /** 050 * Will be called by the OpenCms system during server startup.<p> 051 * 052 * If a module requires special initialization code, this 053 * is a good place to to implement this functions.<p> 054 * 055 * Moreover, if the module requires special "one time" setup code, 056 * this should also be implemented here. For example if the module 057 * requires special DB tables to be created, you should implement 058 * a check if theses tables exist in this method, and if they don't 059 * exist create them as needed.<p> 060 * 061 * @param adminCms an initialized CmsObject with "Admin" permissions 062 * @param configurationManager the initialized OpenCms configuration manager 063 * @param module the module of this action instance 064 */ 065 void initialize(CmsObject adminCms, CmsConfigurationManager configurationManager, CmsModule module); 066 067 /** 068 * Will be called if a module is uninstalled from an OpenCms system.<p> 069 * 070 * If you require special code to be executed if a module is uninstalled, 071 * implement it in this function.<p> 072 * 073 * Please note that there is no <code>install()</code> method. 074 * This is because the class loader will not have the module class 075 * instance available after module installation/upload. If you 076 * need to execute setup/install code, do this in the {@link #initialize(CmsObject, CmsConfigurationManager, CmsModule)} 077 * method during the next server startup.<p> 078 * 079 * This method is <i>not</i> called if the module this action instance belongs to 080 * is "replaced". In this case {@link #moduleUpdate(CmsModule)} is called after the 081 * new version of the module is installed.<p> 082 * 083 * @param module the module of this action instance 084 * 085 * @see #initialize(CmsObject, CmsConfigurationManager, CmsModule) 086 */ 087 void moduleUninstall(CmsModule module); 088 089 /** 090 * Will be called if the module this action instance belongs to is updated.<p> 091 * 092 * @param module the module of this action instance with the updated values 093 */ 094 void moduleUpdate(CmsModule module); 095 096 /** 097 * Will be called during a the publish process after the resources have been published, 098 * but before the publish event is fired.<p> 099 * 100 * If you require special code to be executed after a resource is published, 101 * implement it in this function any analyze the publish list for "interesting" resources.<p> 102 * 103 * @param cms the user context the publish was executed with 104 * @param publishList the list of published resources 105 * @param publishTag the publish tag 106 * @param report the report to write messages to 107 */ 108 void publishProject(CmsObject cms, CmsPublishList publishList, int publishTag, I_CmsReport report); 109 110 /** 111 * Will be called by the OpenCms system during server shutdown.<p> 112 * 113 * If a module requires special "clean up" functions, 114 * for example removing temporary files, this is a good place 115 * to implement this functions.<p> 116 * 117 * @param module the module of this action instance 118 */ 119 void shutDown(CmsModule module); 120}