KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > module > TestModuleActionImpl


1 /*
2  * File : $Source: /usr/local/cvs/opencms/test/org/opencms/module/TestModuleActionImpl.java,v $
3  * Date : $Date: 2005/06/23 11:11:24 $
4  * Version: $Revision: 1.6 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31  
32 package org.opencms.module;
33
34 import org.opencms.configuration.CmsConfigurationManager;
35 import org.opencms.db.CmsPublishList;
36 import org.opencms.file.CmsObject;
37 import org.opencms.main.CmsEvent;
38 import org.opencms.main.I_CmsEventListener;
39 import org.opencms.main.OpenCms;
40 import org.opencms.report.I_CmsReport;
41
42 /**
43  * Simple test implementation of the module action interface.<p>
44  */

45 public class TestModuleActionImpl extends A_CmsModuleAction {
46     
47     /** Indicates the last event type catched. */
48     public static int m_cmsEvent = -1;
49
50     /** Indicates if the initialize() method was called. */
51     public static boolean m_initialize = false;
52     
53     /** Indicates if the moduleUninstall() method was called. */
54     public static boolean m_moduleUninstall = false;
55     
56     /** Indicates if the moduleUpdate() method was called. */
57     public static boolean m_moduleUpdate = false;
58
59     /** Indicates if the publishProject() method was called. */
60     public static boolean m_publishProject = false;
61
62     /** Indicates if the shutDown() method was called. */
63     public static boolean m_shutDown = false;
64     
65     /**
66      * Default constructor.<p>
67      */

68     public TestModuleActionImpl() {
69     
70         // noop
71
}
72
73     /**
74      * @see org.opencms.main.I_CmsEventListener#cmsEvent(org.opencms.main.CmsEvent)
75      */

76     public void cmsEvent(CmsEvent event) {
77
78         super.cmsEvent(event);
79         m_cmsEvent = event.getType();
80     }
81     
82     /**
83      * @see org.opencms.module.I_CmsModuleAction#initialize(org.opencms.file.CmsObject, CmsConfigurationManager, CmsModule)
84      */

85     public void initialize(CmsObject adminCms, CmsConfigurationManager configurationManager, CmsModule module) {
86
87         super.initialize(adminCms, configurationManager, module);
88         m_initialize = true;
89         m_shutDown = false;
90         
91         // register as event listener for publish events
92
OpenCms.addCmsEventListener(this, new int[]{I_CmsEventListener.EVENT_PUBLISH_PROJECT});
93     }
94
95     /**
96      * @see org.opencms.module.I_CmsModuleAction#moduleUninstall(CmsModule)
97      */

98     public void moduleUninstall(CmsModule module) {
99     
100         super.moduleUninstall(module);
101         m_moduleUninstall = true;
102         
103         // remove event listener
104
OpenCms.removeCmsEventListener(this);
105     }
106
107     /**
108      * @see org.opencms.module.I_CmsModuleAction#moduleUpdate(org.opencms.module.CmsModule)
109      */

110     public void moduleUpdate(CmsModule module) {
111
112         super.moduleUpdate(module);
113         m_moduleUpdate = true;
114     }
115
116     /**
117      * @see org.opencms.module.I_CmsModuleAction#publishProject(org.opencms.file.CmsObject, org.opencms.db.CmsPublishList, int, org.opencms.report.I_CmsReport)
118      */

119     public void publishProject(CmsObject cms, CmsPublishList publishList, int backupTagId, I_CmsReport report) {
120
121         super.publishProject(cms, publishList, backupTagId, report);
122         m_publishProject = true;
123     }
124
125     /**
126      * @see org.opencms.module.I_CmsModuleAction#shutDown(CmsModule)
127      */

128     public void shutDown(CmsModule module) {
129
130         super.shutDown(module);
131         m_shutDown = true;
132     }
133
134 }
135
Popular Tags