KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > system > server > Server


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.system.server;
23
24 import java.util.Date JavaDoc;
25 import java.util.Properties JavaDoc;
26
27 /**
28  * The interface of the server loaded by the ServerLoader
29  * @see ServerLoader
30  *
31  * @author Jason Dillon
32  * @author Scott.Stark@jboss.org
33  * @version $Revision: 57108 $
34  */

35 public interface Server
36 {
37    /** The JMX notification event type sent on end of server startup */
38    public final String JavaDoc START_NOTIFICATION_TYPE = "org.jboss.system.server.started";
39    /** The JMX notification event type sent on begin of the server shutdown */
40    public final String JavaDoc STOP_NOTIFICATION_TYPE = "org.jboss.system.server.stopped";
41
42    /** The server start date */
43    Date JavaDoc getStartDate();
44    
45    /** The server version */
46    String JavaDoc getVersion();
47
48    /** The server version code name */
49    String JavaDoc getVersionName();
50
51    /** The date the server was build (compiled) */
52    String JavaDoc getBuildNumber();
53
54    /** The JVM used to build the server */
55    String JavaDoc getBuildJVM();
56
57    /** The Operating System used to build the server */
58    String JavaDoc getBuildOS();
59
60    /** The build id */
61    String JavaDoc getBuildID();
62
63    /** The date the server was build */
64    String JavaDoc getBuildDate();
65    
66    /** A flag indicating if shutdown has been called */
67    boolean isInShutdown();
68
69    // Operations ----------------------------------------------------
70

71
72    /**
73     * Initialize the Server instance.
74     *
75     * @param props The configuration properties for the server.
76     * @return Typed server configuration object.
77     *
78     * @throws IllegalStateException Already initialized.
79     * @throws Exception Failed to initialize.
80     */

81    void init(Properties JavaDoc props) throws IllegalStateException JavaDoc, Exception JavaDoc;
82
83    /**
84     * Get the typed server configuration object which the
85     * server has been initalized to use.
86     *
87     * @return Typed server configuration object.
88     *
89     * @throws IllegalStateException Not initialized.
90     */

91    ServerConfig getConfig() throws IllegalStateException JavaDoc;
92
93    /**
94     * Start the Server instance.
95     *
96     * @throws IllegalStateException Already started or not initialized.
97     * @throws Exception Failed to start.
98     */

99    void start() throws IllegalStateException JavaDoc, Exception JavaDoc;
100
101    /**
102     * Check if the server is started.
103     *
104     * @return True if the server is started, else false.
105     */

106    boolean isStarted();
107
108    /**
109     * Shutdown the Server instance and run shutdown hooks.
110     *
111     * <p>If the exit on shutdown flag is true, then {@link #exit}
112     * is called, else only the shutdown hook is run.
113     *
114     * @throws IllegalStateException No started.
115     */

116    void shutdown() throws IllegalStateException JavaDoc;
117
118    /**
119     * Shutdown the server, the JVM and run shutdown hooks.
120     *
121     * @param exitcode The exit code returned to the operating system.
122     */

123    void exit(int exitcode);
124    /**
125     * Shutdown the server, the JVM and run shutdown hooks. Exits with code 1.
126     */

127    void exit();
128
129    /**
130     * Forcibly terminates the currently running Java virtual machine.
131     *
132     * @param exitcode The exit code returned to the operating system.
133     */

134    void halt(int exitcode);
135    /**
136     * Forcibly terminates the currently running Java virtual machine. Exits with code 1.
137     */

138    void halt();
139 }
140
Popular Tags