KickJava   Java API By Example, From Geeks To Geeks.

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


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.io.File JavaDoc;
25 import java.net.URL JavaDoc;
26
27 /**
28  * The interface of the basic <em>typed</em> JBoss server configuration.
29  *
30  * <p>Clients should use {@link ServerConfigLocator} to get an instance of
31  * {@link ServerConfig} and then use it to get the server's configuration bits.
32  *
33  * @author <a HREF="mailto:jason@planet57.com">Jason Dillon</a>
34  * @author Scott.Stark@jboss.org
35  * @version $Revision: 41281 $
36  */

37  public interface ServerConfig
38 {
39    
40    /** The default partition name */
41    String JavaDoc DEFAULT_PARITION_NAME = "DefaultPartition";
42    
43    /** The partition name property */
44    String JavaDoc PARTITION_NAME_PROPERTY = "jboss.partition.name";
45
46    /** The udp address property */
47    String JavaDoc PARTITION_UDP_PROPERTY = "jboss.partition.udpGroup";
48    
49    /** Whether to load native libraries */
50    String JavaDoc NATIVE_LOAD_PROPERTY = "jboss.native.load";
51    
52    /** The location of native libraries property */
53    String JavaDoc NATIVE_DIR_PROPERTY = "jboss.native.dir";
54
55    /////////////////////////////////////////////////////////////////////////
56
// Bootstrap Specific Config //
57
/////////////////////////////////////////////////////////////////////////
58

59    /**
60     * Constant that holds the name of the environment property
61     * for specifying a comma seperated list of the basenames of
62     * to the boot libraries required load the core system.
63     *
64     * <p>These libraries will be loaded from <tt>LIBRARY_URL</tt>.
65     */

66    String JavaDoc BOOT_LIBRARY_LIST = "jboss.boot.library.list";
67
68    /**
69     * Constant that holds the name of the environment property
70     * for specifying the class type of the server to create.
71     */

72    String JavaDoc SERVER_TYPE = "jboss.server.type";
73
74    /**
75     * Constant that holds the name of the environment property
76     * for specifying the root deployment filename (relative to the server
77     * config URL that will be deployed to finalize the boot strap process.
78     *
79     * <p>If not set then the server will default to {@link #DEFAULT_ROOT_DEPLOYMENT_FILENAME}.
80     */

81    String JavaDoc ROOT_DEPLOYMENT_FILENAME = "jboss.server.root.deployment.filename";
82
83
84    /////////////////////////////////////////////////////////////////////////
85
// Configuration Value Identifiers //
86
/////////////////////////////////////////////////////////////////////////
87

88    /**
89     * Constant that holds the name of the environment property
90     * for specifying the home directory for JBoss.
91     */

92    String JavaDoc HOME_DIR = "jboss.home.dir";
93
94    /**
95     * Constant that holds the name of the environment property
96     * for specifying the home URL for JBoss.
97     *
98     * <p>If not set then the value of HOME_DIR will converted into a URL.
99     */

100    String JavaDoc HOME_URL = "jboss.home.url";
101
102    /**
103     * Constant that holds the name of the environment property
104     * for specifying the URL where JBoss will read library files
105     * from.
106     *
107     * <p>Defaults to <tt><em>HOME_URL</em>/lib</tt>/
108     */

109    String JavaDoc LIBRARY_URL = "jboss.lib.url";
110
111    /**
112     * Constant that holds the name of the environment property
113     * for specifying the URL where JBoss will read patch library files
114     * from.
115     *
116     * <p>If this value is a <tt>file</tt> URL, then all .zip and .jar files
117     * inside will be prepended to the classpath. Otherwise the URL will be
118     * added to the classpath. If not set then the no patch files will be
119     * loaded.
120     */

121    String JavaDoc PATCH_URL = "jboss.patch.url";
122
123    /**
124     * Constant that holds the name of the environment property
125     * for specifying the name of the server which will be used to
126     * calculate the servers home directory and url.
127     *
128     * <p>Defaults to <tt>default</tt>.
129     */

130    String JavaDoc SERVER_NAME = "jboss.server.name";
131
132    /**
133     * Constant that holds the name of the environment property
134     * for specifying the base directory for calculating server
135     * home directories.
136     *
137     * <p>Defaults to <tt><em>HOME_DIR</em>/server</tt>.
138     */

139    String JavaDoc SERVER_BASE_DIR = "jboss.server.base.dir";
140
141    /**
142     * Constant that holds the name of the environment property
143     * for specifying the server home directory for JBoss.
144     *
145     * <p>Defaults to <tt><em>SERVER_BASE_DIR</em>/<em>SERVER_NAME</em></tt>.
146     */

147    String JavaDoc SERVER_HOME_DIR = "jboss.server.home.dir";
148
149    /**
150     * Constant that holds the name of the environment property
151     * for specifying the server log directory for JBoss.
152     *
153     * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/<em>log</em></tt>.
154     */

155    String JavaDoc SERVER_LOG_DIR = "jboss.server.log.dir";
156
157    /**
158     * Constant that holds the name of the environment property
159     * for specifying the directory which JBoss will use for
160     * temporary file storage.
161     *
162     * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/tmp</tt> .
163     */

164    String JavaDoc SERVER_TEMP_DIR = "jboss.server.temp.dir";
165
166    /**
167     * Constant that holds the name of the environment property
168     * for specifying the directory which JBoss will use for
169     * persistent data file storage.
170     *
171     * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/data</tt>.
172     */

173    String JavaDoc SERVER_DATA_DIR = "jboss.server.data.dir";
174
175    /**
176     * Constant that holds the name of the environment property
177     * for specifying the base URL for calculating server
178     * home URLs.
179     *
180     * <p>Defaults to <tt><em>HOME_URL</em>/server</tt>.
181     */

182    String JavaDoc SERVER_BASE_URL = "jboss.server.base.url";
183
184    /**
185     * Constant that holds the name of the environment property
186     * for specifying the server home URL for JBoss.
187     *
188     * <p>Defaults to <tt><em>SERVER_BASE_URL</em>/<em>SERVER_NAME</em></tt>.
189     */

190    String JavaDoc SERVER_HOME_URL = "jboss.server.home.url";
191
192    /**
193     * Constant that holds the name of the environment property
194     * for specifying the server configuration URL.
195     *
196     * <p>Defaults to <tt><em>SERVER_HOME_UTL</em>/conf</tt> .
197     */

198    String JavaDoc SERVER_CONFIG_URL = "jboss.server.config.url";
199
200    /**
201     * Constant that holds the name of the environment property
202     * for specifying the URL where JBoss will read server specific
203     * library files from.
204     *
205     * <p>Defaults to <tt><em>SERVER_HOME_URL</em>/lib</tt>/
206     */

207    String JavaDoc SERVER_LIBRARY_URL = "jboss.server.lib.url";
208
209    /**
210     * Constant that holds the name of the environment property
211     * for specifying the bind address for all jboss services
212     *
213     */

214    String JavaDoc SERVER_BIND_ADDRESS = "jboss.bind.address";
215
216    /**
217     * Constant that holds the name of the environment property
218     * for specifying whether or not the server should exit the
219     * JVM on shutdown.
220     *
221     * <p>If not set then the server will default to exiting on shutdown.
222     */

223    String JavaDoc EXIT_ON_SHUTDOWN = "jboss.server.exitonshutdown";
224
225    /**
226     * Constant that holds the name of the environment property for
227     * specifying whether or not the server should shutdown
228     * synchronously (true) or asynchronously (false).
229     *
230     * <p>If not set then the server will default to asynchronous shutdown.
231     */

232    String JavaDoc BLOCKING_SHUTDOWN = "jboss.server.blockingshutdown";
233
234    /**
235     * Constant that holds the name of the environment property for
236     * specifying whether or not the server should log and ignore
237     * exceptions when setting the URLStreamHandlerFactory.
238     *
239     * <p>If not set then the server will default to asynchronous shutdown.
240     */

241    String JavaDoc REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY = "jboss.server.requirejbossurlstreamhandlerfactory";
242    
243    /**
244     * Constant that holds the name of the environment property for specifying
245     * whether or not to use as the main jboss server the MBeanServer returned
246     * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
247     *
248     * <p>If not set then jboss will instantiate its own MBeanServer
249     */

250    String JavaDoc PLATFORM_MBEANSERVER = "jboss.platform.mbeanserver";
251
252    /////////////////////////////////////////////////////////////////////////
253
// Path Suffixes //
254
/////////////////////////////////////////////////////////////////////////
255

256    /**
257     * The suffix used when generating the default value for {@link #LIBRARY_URL}
258     * and {@link #SERVER_LIBRARY_URL}.
259     */

260    String JavaDoc LIBRARY_URL_SUFFIX = "lib/";
261
262    /**
263     * The suffix used when generating the default value for {@link #SERVER_CONFIG_URL}.
264     */

265    String JavaDoc SERVER_CONFIG_URL_SUFFIX = "conf/";
266
267    /**
268     * The suffix used when generating the default value for {@link #SERVER_BASE_DIR}.
269     */

270    String JavaDoc SERVER_BASE_DIR_SUFFIX = "server";
271
272    /**
273     * The suffix used when generating the default value for {@link #SERVER_BASE_URL}.
274     */

275    String JavaDoc SERVER_BASE_URL_SUFFIX = "server/";
276
277    /**
278     * The suffix used when generating the default value for {@link #SERVER_DATA_DIR}.
279     */

280    String JavaDoc SERVER_DATA_DIR_SUFFIX = "data";
281
282    /**
283     * The suffix used when generating the default value for {@link #SERVER_LOG_DIR}.
284     */

285    String JavaDoc SERVER_LOG_DIR_SUFFIX = "log";
286
287    /**
288     * The suffix used when generating the default value for {@link #SERVER_TEMP_DIR}.
289     */

290    String JavaDoc SERVER_TEMP_DIR_SUFFIX = "tmp";
291
292
293    /////////////////////////////////////////////////////////////////////////
294
// Defaults //
295
/////////////////////////////////////////////////////////////////////////
296

297    /** The default value for {@link #SERVER_NAME}. */
298    String JavaDoc DEFAULT_SERVER_NAME = "default";
299
300    /** The default value for {@link #EXIT_ON_SHUTDOWN}. */
301    boolean DEFAULT_EXIT_ON_SHUTDOWN = true;
302
303    /** The default value for {@link #BLOCKING_SHUTDOWN}. */
304    boolean DEFAULT_BLOCKING_SHUTDOWN = false;
305
306    /** The default value for {@link #REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY}. */
307    boolean DEFAULT_REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY = true;
308    
309    /** The default value for {@link #PLATFORM_MBEANSERVER}. */
310    boolean DEFAULT_PLATFORM_MBEANSERVER = false;
311
312    /** The default value for {@link ROOT_DEPLOYMENT_FILENAME}. */
313    String JavaDoc DEFAULT_ROOT_DEPLOYMENT_FILENAME = "jboss-service.xml";
314
315
316    /////////////////////////////////////////////////////////////////////////
317
// Typed Access Methods //
318
/////////////////////////////////////////////////////////////////////////
319

320    /**
321     * Get the local home directory which the server is running from.
322     *
323     * @return The local server home directory.
324     */

325    File JavaDoc getHomeDir();
326
327    /**
328     * Get the home URL which the server is running from.
329     *
330     * @return The home URL which the server is running from.
331     */

332    URL JavaDoc getHomeURL();
333
334    /**
335     * Get the library URL for the server.
336     *
337     * @return The library URL for the server.
338     */

339    URL JavaDoc getLibraryURL();
340
341    /**
342     * Get the patch URL for the server.
343     *
344     * @return The patch URL for the server.
345     */

346    URL JavaDoc getPatchURL();
347
348    /**
349     * Get the name of the server.
350     *
351     * @return The name of the server.
352     */

353    String JavaDoc getServerName();
354
355    /**
356     * Get the base directory for calculating server home directories.
357     *
358     * @return Base server home directory.
359     */

360    File JavaDoc getServerBaseDir();
361
362    /**
363     * Get the server home directory.
364     *
365     * @return Server home directory.
366     */

367    File JavaDoc getServerHomeDir();
368
369    /**
370     * Get the directory where log files will be stored.
371     *
372     * @return The directory where the server writes log files.
373     */

374    File JavaDoc getServerLogDir();
375
376    /**
377     * Get the directory where temporary files will be stored.
378     *
379     * @return The directory where the server stores temporary files.
380     */

381    File JavaDoc getServerTempDir();
382
383    /**
384     * Get the directory where local data will be stored.
385     *
386     * @return The directory where the server stores local data.
387     */

388    File JavaDoc getServerDataDir();
389
390    /**
391     * Get the base directory for calculating server home URLs.
392     *
393     * @return Base server home URL.
394     */

395    URL JavaDoc getServerBaseURL();
396
397    /**
398     * Get the server home URL.
399     *
400     * @return Server home URL.
401     */

402    URL JavaDoc getServerHomeURL();
403
404    /**
405     * Get the server library URL.
406     *
407     * @return Server library URL.
408     */

409    URL JavaDoc getServerLibraryURL();
410
411    /**
412     * Get the server configuration URL.
413     *
414     * @return Server configuration URL.
415     */

416    URL JavaDoc getServerConfigURL();
417
418    /**
419     * Get the current value of the flag that indicates if we are
420     * using the platform MBeanServer as the main jboss server.
421     * Both the {@link ServerConfig.PLATFORM_MBEANSERVER}
422     * property must be set, and the jvm must be jdk1.5+
423     *
424     * @return true if jboss runs on the jvm platfrom MBeanServer
425     */

426    boolean getPlatformMBeanServer();
427     
428    /**
429     * Enable or disable exiting the JVM when {@link Server#shutdown} is called.
430     * If enabled, then shutdown calls {@link Server#exit}. If disabled, then
431     * only the shutdown hook will be run.
432     *
433     * @param flag True to enable calling exit on shutdown.
434     */

435    void setExitOnShutdown(boolean flag);
436
437    /**
438     * Get the current value of the exit on shutdown flag.
439     *
440     * @return The current value of the exit on shutdown flag.
441     */

442    boolean getExitOnShutdown();
443
444
445    /**
446     * Get the BlockingShutdown value.
447     * @return the BlockingShutdown value.
448     */

449    boolean getBlockingShutdown();
450
451    /**
452     * Set the BlockingShutdown value.
453     * @param blockingShutdown The new BlockingShutdown value.
454     */

455    void setBlockingShutdown(boolean blockingShutdown);
456
457    /**
458     * Get the RequireJBossURLStreamHandlerFactory value.
459     * @return the RequireJBossURLStreamHandlerFactory value.
460     */

461    boolean getRequireJBossURLStreamHandlerFactory();
462
463    /**
464     * Set the RequireJBossURLStreamHandlerFactory value.
465     * @param requireJBossURLStreamHandlerFactory The new RequireJBossURLStreamHandlerFactory value.
466     */

467    void setRequireJBossURLStreamHandlerFactory(boolean requireJBossURLStreamHandlerFactory);
468
469    /**
470     * Set the filename of the root deployable that will be used to finalize
471     * the bootstrap process.
472     *
473     * @param filename The filename of the root deployable.
474     */

475    void setRootDeploymentFilename(String JavaDoc filename);
476
477    /**
478     * Get the filename of the root deployable that will be used to finalize
479     * the bootstrap process.
480     *
481     * @return The filename of the root deployable.
482     */

483    String JavaDoc getRootDeploymentFilename();
484
485    /**
486     * Get the native dir for unpacking
487     *
488     * @return the directory
489     */

490    public File JavaDoc getServerNativeDir();
491
492    /**
493     * Get the temporary deployment dir for unpacking
494     *
495     * @return the directory
496     */

497    public File JavaDoc getServerTempDeployDir();
498 }
499
Popular Tags