001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.system.server;
023:
024: import java.io.File;
025: import java.net.URL;
026:
027: /**
028: * The interface of the basic <em>typed</em> JBoss server configuration.
029: *
030: * <p>Clients should use {@link ServerConfigLocator} to get an instance of
031: * {@link ServerConfig} and then use it to get the server's configuration bits.
032: *
033: * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
034: * @author Scott.Stark@jboss.org
035: * @version $Revision: 57205 $
036: */
037: public interface ServerConfig {
038:
039: /** The default partition name */
040: String DEFAULT_PARITION_NAME = "DefaultPartition";
041:
042: /** The partition name property */
043: String PARTITION_NAME_PROPERTY = "jboss.partition.name";
044:
045: /** The udp address property */
046: String PARTITION_UDP_PROPERTY = "jboss.partition.udpGroup";
047:
048: /** Whether to load native libraries */
049: String NATIVE_LOAD_PROPERTY = "jboss.native.load";
050:
051: /** The location of native libraries property */
052: String NATIVE_DIR_PROPERTY = "jboss.native.dir";
053:
054: /////////////////////////////////////////////////////////////////////////
055: // Bootstrap Specific Config //
056: /////////////////////////////////////////////////////////////////////////
057:
058: /**
059: * Constant that holds the name of the environment property
060: * for specifying a comma seperated list of the basenames of
061: * to the boot libraries required load the core system.
062: *
063: * <p>These libraries will be loaded from <tt>LIBRARY_URL</tt>.
064: */
065: String BOOT_LIBRARY_LIST = "jboss.boot.library.list";
066:
067: /**
068: * Constant that holds the name of the environment property
069: * for specifying the class type of the server to create.
070: */
071: String SERVER_TYPE = "jboss.server.type";
072:
073: /**
074: * Constant that holds the name of the environment property
075: * for specifying the root deployment filename (relative to the server
076: * config URL that will be deployed to finalize the boot strap process.
077: *
078: * <p>If not set then the server will default to {@link #DEFAULT_ROOT_DEPLOYMENT_FILENAME}.
079: */
080: String ROOT_DEPLOYMENT_FILENAME = "jboss.server.root.deployment.filename";
081:
082: /////////////////////////////////////////////////////////////////////////
083: // Configuration Value Identifiers //
084: /////////////////////////////////////////////////////////////////////////
085:
086: /**
087: * Constant that holds the name of the environment property
088: * for specifying the home directory for JBoss.
089: */
090: String HOME_DIR = "jboss.home.dir";
091:
092: /**
093: * Constant that holds the name of the environment property
094: * for specifying the home URL for JBoss.
095: *
096: * <p>If not set then the value of HOME_DIR will converted into a URL.
097: */
098: String HOME_URL = "jboss.home.url";
099:
100: /**
101: * Constant that holds the name of the environment property
102: * for specifying the URL where JBoss will read library files
103: * from.
104: *
105: * <p>Defaults to <tt><em>HOME_URL</em>/lib</tt>/
106: */
107: String LIBRARY_URL = "jboss.lib.url";
108:
109: /**
110: * Constant that holds the name of the environment property
111: * for specifying the URL where JBoss will read patch library files
112: * from.
113: *
114: * <p>If this value is a <tt>file</tt> URL, then all .zip and .jar files
115: * inside will be prepended to the classpath. Otherwise the URL will be
116: * added to the classpath. If not set then the no patch files will be
117: * loaded.
118: */
119: String PATCH_URL = "jboss.patch.url";
120:
121: /**
122: * Constant that holds the name of the environment property
123: * for specifying the name of the server which will be used to
124: * calculate the servers home directory and url.
125: *
126: * <p>Defaults to <tt>default</tt>.
127: */
128: String SERVER_NAME = "jboss.server.name";
129:
130: /**
131: * Constant that holds the name of the environment property
132: * for specifying the base directory for calculating server
133: * home directories.
134: *
135: * <p>Defaults to <tt><em>HOME_DIR</em>/server</tt>.
136: */
137: String SERVER_BASE_DIR = "jboss.server.base.dir";
138:
139: /**
140: * Constant that holds the name of the environment property
141: * for specifying the server home directory for JBoss.
142: *
143: * <p>Defaults to <tt><em>SERVER_BASE_DIR</em>/<em>SERVER_NAME</em></tt>.
144: */
145: String SERVER_HOME_DIR = "jboss.server.home.dir";
146:
147: /**
148: * Constant that holds the name of the environment property
149: * for specifying the server log directory for JBoss.
150: *
151: * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/<em>log</em></tt>.
152: */
153: String SERVER_LOG_DIR = "jboss.server.log.dir";
154:
155: /**
156: * Constant that holds the name of the environment property
157: * for specifying the directory which JBoss will use for
158: * temporary file storage.
159: *
160: * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/tmp</tt> .
161: */
162: String SERVER_TEMP_DIR = "jboss.server.temp.dir";
163:
164: /**
165: * Constant that holds the name of the environment property
166: * for specifying the directory which JBoss will use for
167: * persistent data file storage.
168: *
169: * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/data</tt>.
170: */
171: String SERVER_DATA_DIR = "jboss.server.data.dir";
172:
173: /**
174: * Constant that holds the name of the environment property
175: * for specifying the base URL for calculating server
176: * home URLs.
177: *
178: * <p>Defaults to <tt><em>HOME_URL</em>/server</tt>.
179: */
180: String SERVER_BASE_URL = "jboss.server.base.url";
181:
182: /**
183: * Constant that holds the name of the environment property
184: * for specifying the server home URL for JBoss.
185: *
186: * <p>Defaults to <tt><em>SERVER_BASE_URL</em>/<em>SERVER_NAME</em></tt>.
187: */
188: String SERVER_HOME_URL = "jboss.server.home.url";
189:
190: /**
191: * Constant that holds the name of the environment property
192: * for specifying the server configuration URL.
193: *
194: * <p>Defaults to <tt><em>SERVER_HOME_UTL</em>/conf</tt> .
195: */
196: String SERVER_CONFIG_URL = "jboss.server.config.url";
197:
198: /**
199: * Constant that holds the name of the environment property
200: * for specifying the URL where JBoss will read server specific
201: * library files from.
202: *
203: * <p>Defaults to <tt><em>SERVER_HOME_URL</em>/lib</tt>/
204: */
205: String SERVER_LIBRARY_URL = "jboss.server.lib.url";
206:
207: /**
208: * Constant that holds the name of the environment property
209: * for specifying the bind address for all jboss services
210: *
211: */
212: String SERVER_BIND_ADDRESS = "jboss.bind.address";
213:
214: /**
215: * Constant that holds the name of the environment property
216: * for specifying whether or not the server should exit the
217: * JVM on shutdown.
218: *
219: * <p>If not set then the server will default to exiting on shutdown.
220: */
221: String EXIT_ON_SHUTDOWN = "jboss.server.exitonshutdown";
222:
223: /**
224: * Constant that holds the name of the environment property for
225: * specifying whether or not the server should shutdown
226: * synchronously (true) or asynchronously (false).
227: *
228: * <p>If not set then the server will default to asynchronous shutdown.
229: */
230: String BLOCKING_SHUTDOWN = "jboss.server.blockingshutdown";
231:
232: /**
233: * Constant that holds the name of the environment property for
234: * specifying whether or not the server should log and ignore
235: * exceptions when setting the URLStreamHandlerFactory.
236: *
237: * <p>If not set then the server will default to asynchronous shutdown.
238: */
239: String REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY = "jboss.server.requirejbossurlstreamhandlerfactory";
240:
241: /**
242: * Constant that holds the name of the environment property for specifying
243: * whether or not to use as the main jboss server the MBeanServer returned
244: * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
245: *
246: * <p>If not set then jboss will instantiate its own MBeanServer
247: */
248: String PLATFORM_MBEANSERVER = "jboss.platform.mbeanserver";
249:
250: /////////////////////////////////////////////////////////////////////////
251: // Path Suffixes //
252: /////////////////////////////////////////////////////////////////////////
253:
254: /**
255: * The suffix used when generating the default value for {@link #LIBRARY_URL}
256: * and {@link #SERVER_LIBRARY_URL}.
257: */
258: String LIBRARY_URL_SUFFIX = "lib/";
259:
260: /**
261: * The suffix used when generating the default value for {@link #SERVER_CONFIG_URL}.
262: */
263: String SERVER_CONFIG_URL_SUFFIX = "conf/";
264:
265: /**
266: * The suffix used when generating the default value for {@link #SERVER_BASE_DIR}.
267: */
268: String SERVER_BASE_DIR_SUFFIX = "server";
269:
270: /**
271: * The suffix used when generating the default value for {@link #SERVER_BASE_URL}.
272: */
273: String SERVER_BASE_URL_SUFFIX = "server/";
274:
275: /**
276: * The suffix used when generating the default value for {@link #SERVER_DATA_DIR}.
277: */
278: String SERVER_DATA_DIR_SUFFIX = "data";
279:
280: /**
281: * The suffix used when generating the default value for {@link #SERVER_LOG_DIR}.
282: */
283: String SERVER_LOG_DIR_SUFFIX = "log";
284:
285: /**
286: * The suffix used when generating the default value for {@link #SERVER_TEMP_DIR}.
287: */
288: String SERVER_TEMP_DIR_SUFFIX = "tmp";
289:
290: /////////////////////////////////////////////////////////////////////////
291: // Defaults //
292: /////////////////////////////////////////////////////////////////////////
293:
294: /** The default value for {@link #SERVER_NAME}. */
295: String DEFAULT_SERVER_NAME = "default";
296:
297: /** The default value for {@link #EXIT_ON_SHUTDOWN}. */
298: boolean DEFAULT_EXIT_ON_SHUTDOWN = true;
299:
300: /** The default value for {@link #BLOCKING_SHUTDOWN}. */
301: boolean DEFAULT_BLOCKING_SHUTDOWN = false;
302:
303: /** The default value for {@link #REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY}. */
304: boolean DEFAULT_REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY = true;
305:
306: /** The default value for {@link #PLATFORM_MBEANSERVER}. */
307: boolean DEFAULT_PLATFORM_MBEANSERVER = false;
308:
309: /** The default value for {@link ROOT_DEPLOYMENT_FILENAME}. */
310: String DEFAULT_ROOT_DEPLOYMENT_FILENAME = "jboss-service.xml";
311:
312: /////////////////////////////////////////////////////////////////////////
313: // Typed Access Methods //
314: /////////////////////////////////////////////////////////////////////////
315:
316: /**
317: * Get the local home directory which the server is running from.
318: *
319: * @return The local server home directory.
320: */
321: File getHomeDir();
322:
323: /**
324: * Get the home URL which the server is running from.
325: *
326: * @return The home URL which the server is running from.
327: */
328: URL getHomeURL();
329:
330: /**
331: * Get the library URL for the server.
332: *
333: * @return The library URL for the server.
334: */
335: URL getLibraryURL();
336:
337: /**
338: * Get the patch URL for the server.
339: *
340: * @return The patch URL for the server.
341: */
342: URL getPatchURL();
343:
344: /**
345: * Get the name of the server.
346: *
347: * @return The name of the server.
348: */
349: String getServerName();
350:
351: /**
352: * Get the base directory for calculating server home directories.
353: *
354: * @return Base server home directory.
355: */
356: File getServerBaseDir();
357:
358: /**
359: * Get the server home directory.
360: *
361: * @return Server home directory.
362: */
363: File getServerHomeDir();
364:
365: /**
366: * Get the directory where log files will be stored.
367: *
368: * @return The directory where the server writes log files.
369: */
370: File getServerLogDir();
371:
372: /**
373: * Get the directory where temporary files will be stored.
374: *
375: * @return The directory where the server stores temporary files.
376: */
377: File getServerTempDir();
378:
379: /**
380: * Get the directory where local data will be stored.
381: *
382: * @return The directory where the server stores local data.
383: */
384: File getServerDataDir();
385:
386: /**
387: * Get the base directory for calculating server home URLs.
388: *
389: * @return Base server home URL.
390: */
391: URL getServerBaseURL();
392:
393: /**
394: * Get the server home URL.
395: *
396: * @return Server home URL.
397: */
398: URL getServerHomeURL();
399:
400: /**
401: * Get the server library URL.
402: *
403: * @return Server library URL.
404: */
405: URL getServerLibraryURL();
406:
407: /**
408: * Get the server configuration URL.
409: *
410: * @return Server configuration URL.
411: */
412: URL getServerConfigURL();
413:
414: /**
415: * Get the native dir for unpacking
416: *
417: * @return the directory
418: */
419: public File getServerNativeDir();
420:
421: /**
422: * Get the temporary deployment dir for unpacking
423: *
424: * @return the directory
425: */
426: public File getServerTempDeployDir();
427:
428: /**
429: * Get the current value of the flag that indicates if we are
430: * using the platform MBeanServer as the main jboss server.
431: * Both the {@link ServerConfig.PLATFORM_MBEANSERVER}
432: * property must be set, and the jvm must be jdk1.5+
433: *
434: * @return true if jboss runs on the jvm platfrom MBeanServer
435: */
436: boolean getPlatformMBeanServer();
437:
438: /**
439: * Enable or disable exiting the JVM when {@link Server#shutdown} is called.
440: * If enabled, then shutdown calls {@link Server#exit}. If disabled, then
441: * only the shutdown hook will be run.
442: *
443: * @param flag True to enable calling exit on shutdown.
444: */
445: void setExitOnShutdown(boolean flag);
446:
447: /**
448: * Get the current value of the exit on shutdown flag.
449: *
450: * @return The current value of the exit on shutdown flag.
451: */
452: boolean getExitOnShutdown();
453:
454: /**
455: * Get the BlockingShutdown value.
456: * @return the BlockingShutdown value.
457: */
458: boolean getBlockingShutdown();
459:
460: /**
461: * Set the BlockingShutdown value.
462: * @param blockingShutdown The new BlockingShutdown value.
463: */
464: void setBlockingShutdown(boolean blockingShutdown);
465:
466: /**
467: * Get the RequireJBossURLStreamHandlerFactory value.
468: * @return the RequireJBossURLStreamHandlerFactory value.
469: */
470: boolean getRequireJBossURLStreamHandlerFactory();
471:
472: /**
473: * Set the RequireJBossURLStreamHandlerFactory value.
474: * @param requireJBossURLStreamHandlerFactory The new RequireJBossURLStreamHandlerFactory value.
475: */
476: void setRequireJBossURLStreamHandlerFactory(
477: boolean requireJBossURLStreamHandlerFactory);
478:
479: /**
480: * Set the filename of the root deployable that will be used to finalize
481: * the bootstrap process.
482: *
483: * @param filename The filename of the root deployable.
484: */
485: void setRootDeploymentFilename(String filename);
486:
487: /**
488: * Get the filename of the root deployable that will be used to finalize
489: * the bootstrap process.
490: *
491: * @return The filename of the root deployable.
492: */
493: String getRootDeploymentFilename();
494: }
|