KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > module > Module


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.module;
14
15 import info.magnolia.cms.core.Content;
16
17
18 /**
19  * All external module must implement this interface in order to be initialised by magnolia and have access to module
20  * specific / shared repositories
21  * @author philipp
22  * @version $Revision: 6341 $ ($Author: philipp $)
23  */

24
25 public interface Module {
26
27     /**
28      * No registration needed. Same version is already registered
29      */

30     int REGISTER_STATE_NONE = 0;
31
32     /**
33      * First installation. Node didn't exist in the repository
34      */

35     int REGISTER_STATE_INSTALLATION = 1;
36
37     /**
38      * New version of a already registered module
39      */

40     int REGISTER_STATE_NEW_VERSION = 2;
41
42     /**
43      * Initialise module based on the configuration. once repositories are initialised and tickets are created its a
44      * responsibility of the module itself to keep this data. magnolia server will release all handles
45      * @throws InvalidConfigException not a valid configuration
46      * @throws InitializationException
47      */

48     void init(Content configNode) throws InvalidConfigException, InitializationException;
49
50     /**
51      * This method is always called during the registration phase.
52      * @param def the module definition built by the modules xml file
53      * @param moduleNode the node in the config repository
54      * @param registerState one of the REGISTER_STATE constants
55      * @throws RegisterException no update
56      */

57     void register(ModuleDefinition def, Content moduleNode, int registerState) throws RegisterException;
58
59     /**
60      * Unregister a module. A module is responsible to undo all the steps done during the registration.
61      * @param def the definition of this module
62      * @param moduleNode the node in the config repository
63      */

64     void unregister(ModuleDefinition def, Content moduleNode);
65
66     /**
67      * At this point module is responsible to release all resources
68      */

69     void destroy();
70
71     /**
72      * True if this module is already initialized
73      * @return
74      */

75     boolean isInitialized();
76
77     /**
78      * Return true if the module need a system restart after a registration or initialization
79      * @return
80      */

81     boolean isRestartNeeded();
82
83     /**
84      * Returns the name of this module
85      * @return
86      */

87     String JavaDoc getName();
88
89     /**
90      * Get the description of this module
91      */

92     ModuleDefinition getModuleDefinition();
93
94 }
Popular Tags