KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > messenger > container > BasicModule


1 /**
2  * $RCSfile: BasicModule.java,v $
3  * $Revision: 1.6 $
4  * $Date: 2004/12/05 15:14:39 $
5  *
6  * Copyright (C) 2004 Jive Software. All rights reserved.
7  *
8  * This software is published under the terms of the GNU Public License (GPL),
9  * a copy of which is included in this distribution.
10  */

11
12 package org.jivesoftware.messenger.container;
13
14 import org.jivesoftware.messenger.XMPPServer;
15
16 /**
17  * A default Module implementation that basically avoids subclasses having to implement the whole
18  * Module interface.</p>
19  *
20  * @author Gaston Dombiak
21  */

22 public class BasicModule implements Module {
23
24     /**
25      * The name of the module
26      */

27     private String JavaDoc name;
28
29     /**
30      * <p>Create a basic module with the given name.</p>
31      *
32      * @param moduleName The name for the module or null to use the default
33      */

34     public BasicModule(String JavaDoc moduleName) {
35         if (moduleName == null) {
36             this.name = "No name assigned";
37         }
38         else {
39             this.name = moduleName;
40         }
41     }
42
43     /**
44      * <p>Obtain the name of the module.</p>
45      *
46      * @return The name of the module
47      */

48     public String JavaDoc getName() {
49         return name;
50     }
51
52     /**
53      * <p>Initializes the basic module.</p>
54      * <p/>
55      * <p>Inheriting classes that choose to override this method MUST
56      * call this initialize() method before accessing BasicModule resources.</p>
57      *
58      * @param server the server hosting this module.
59      */

60     public void initialize(XMPPServer server) {
61     }
62
63     /**
64      * <p>Starts the basic module.</p>
65      * <p/>
66      * <p>Inheriting classes that choose to override this method MUST
67      * call this start() method before accessing BasicModule resources.</p>
68      *
69      * @throws IllegalStateException If start is called before initialize
70      * successfully returns
71      */

72     public void start() throws IllegalStateException JavaDoc {
73     }
74
75     /**
76      * <p>Stops the basic module.</p>
77      * <p/>
78      * <p>Inheriting classes that choose to override this method MUST
79      * call this stop() method before accessing BasicModule resources.</p>
80      */

81     public void stop() {
82     }
83
84     /**
85      * <p>Destroys the module.</p>
86      * <p/>
87      * <p>Does nothing in the basic module.</p>
88      */

89     public void destroy() {
90     }
91 }
Popular Tags