org.jboss.bootstrap
Class BaseServerConfig

java.lang.Object
  extended by org.jboss.bootstrap.BaseServerConfig
All Implemented Interfaces:
ServerConfig

public class BaseServerConfig
extends Object
implements ServerConfig

A container for the basic configuration elements required to create a Server instance.

MalformedURLException are rethrown as NestedRuntimeExceptions, so that code that needs to access these values does not have to directly worry about problems with lazy construction of final URL values.

Most values are determined durring first call to getter. All values when determined will have equivilent system properties set.

Version:
$Revision: 41281 $
Author:
Jason Dillon, Dimitris Andreadis, Scott.Stark@jboss.org

Nested Class Summary
static class BaseServerConfig.FileMetaMapper
          TODO: move to managed project, JBMAN-49
 
Field Summary
 
Fields inherited from interface org.jboss.bootstrap.spi.ServerConfig
BLOCKING_SHUTDOWN, BOOT_LIBRARY_LIST, BOOTSTRAP_URL, COMMON_BASE_URL, COMMON_BASE_URL_SUFFIX, COMMON_LIBRARY_URL, DEFAULT_BLOCKING_SHUTDOWN, DEFAULT_EXIT_ON_SHUTDOWN, DEFAULT_INSTALL_LIFE_THREAD, DEFAULT_PARITION_NAME, DEFAULT_PLATFORM_MBEANSERVER, DEFAULT_REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY, DEFAULT_ROOT_DEPLOYMENT_FILENAME, DEFAULT_SERVER_NAME, EXIT_ON_SHUTDOWN, HOME_DIR, HOME_URL, INSTALL_LIFE_THREAD, LIBRARY_URL, LIBRARY_URL_SUFFIX, NATIVE_DIR_PROPERTY, NATIVE_LOAD_PROPERTY, PARTITION_NAME_PROPERTY, PARTITION_UDP_PORT_PROPERTY, PARTITION_UDP_PROPERTY, PATCH_URL, PLATFORM_MBEANSERVER, REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY, ROOT_DEPLOYMENT_FILENAME, SERVER_BASE_DIR, SERVER_BASE_DIR_SUFFIX, SERVER_BASE_URL, SERVER_BASE_URL_SUFFIX, SERVER_BIND_ADDRESS, SERVER_CONFIG_URL, SERVER_CONFIG_URL_SUFFIX, SERVER_DATA_DIR, SERVER_DATA_DIR_SUFFIX, SERVER_HOME_DIR, SERVER_HOME_URL, SERVER_LIBRARY_URL, SERVER_LOG_DIR, SERVER_LOG_DIR_SUFFIX, SERVER_NAME, SERVER_TEMP_DIR, SERVER_TEMP_DIR_SUFFIX, SERVER_TYPE
 
Constructor Summary
BaseServerConfig(Properties props)
          Construct a new ServerConfigImpl instance.
 
Method Summary
 boolean getBlockingShutdown()
          Get the current value of the blocking shutdown flag.
 URL getBootstrapURL()
          Get the bootstrap url
 URL getCommonBaseURL()
          Get the common base URL.
 URL getCommonLibraryURL()
          Get the common library URL.
 boolean getExitOnShutdown()
          Get the current value of the exit on shutdown flag.
 File getHomeDir()
          Get the local home directory which the server is running from.
 URL getHomeURL()
          Get the home URL which the server is running from.
 URL getLibraryURL()
          Get the library URL for the server.
 URL getPatchURL()
          Get the patch URL for the server.
 boolean getPlatformMBeanServer()
          Get the current value of the flag that indicates if we are using the platform MBeanServer as the main jboss server.
 boolean getRequireJBossURLStreamHandlerFactory()
          Get the current value of the requireJBossURLStreamHandlerFactory flag.
 String getRootDeploymentFilename()
          Get the filename of the root deployable that will be used to finalize the bootstrap process.
 File getServerBaseDir()
          Get the base directory for calculating server home directories.
 URL getServerBaseURL()
          Get the base directory for calculating server home URLs.
 URL getServerConfigURL()
          Get the server configuration URL.
 File getServerDataDir()
          Get the directory where local data will be stored.
 File getServerHomeDir()
          Get the server home directory.
 URL getServerHomeURL()
          Get the server home URL.
 URL getServerLibraryURL()
          Get the server library URL.
 File getServerLogDir()
          Get the directory where temporary files will be stored.
 String getServerName()
          Get the name of the server.
 File getServerNativeDir()
          Get the native dir for unpacking
 File getServerTempDeployDir()
          Get the temporary deployment dir for unpacking
 File getServerTempDir()
          Get the directory where temporary files will be stored.
 String getSpecificationVersion()
          Get the server Specification-Version
 void initURLs()
          Breakout the initialization of URLs from the constructor as we need the ServerConfig.HOME_DIR set for log setup, but we cannot create any file URLs prior to the
 boolean isInstallLifeThread()
          Whether to install the lifethread
 void setBlockingShutdown(boolean flag)
          Enable or disable blocking when Server.shutdown() is called.
 void setExitOnShutdown(boolean flag)
          Enable or disable exiting the JVM when Server.shutdown() is called.
 void setInstallLifeThread(boolean flag)
           
 void setRequireJBossURLStreamHandlerFactory(boolean flag)
          Set the RequireJBossURLStreamHandlerFactory flag.
 void setRootDeploymentFilename(String filename)
          Set the filename of the root deployable that will be used to finalize the bootstrap process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseServerConfig

public BaseServerConfig(Properties props)
                 throws Exception
Construct a new ServerConfigImpl instance.

Parameters:
props - Configuration properties.
Throws:
Exception - Missing or invalid configuration.
Method Detail

initURLs

public void initURLs()
              throws MalformedURLException
Breakout the initialization of URLs from the constructor as we need the ServerConfig.HOME_DIR set for log setup, but we cannot create any file URLs prior to the

Throws:
MalformedURLException - for a bad home url

getBootstrapURL

public URL getBootstrapURL()
Description copied from interface: ServerConfig
Get the bootstrap url

Specified by:
getBootstrapURL in interface ServerConfig
Returns:
the bootstrap url

getHomeDir

public File getHomeDir()
Description copied from interface: ServerConfig
Get the local home directory which the server is running from.

Specified by:
getHomeDir in interface ServerConfig
Returns:
The local server home directory.

getHomeURL

public URL getHomeURL()
Description copied from interface: ServerConfig
Get the home URL which the server is running from.

Specified by:
getHomeURL in interface ServerConfig
Returns:
The home URL which the server is running from.

getLibraryURL

public URL getLibraryURL()
Description copied from interface: ServerConfig
Get the library URL for the server.

Specified by:
getLibraryURL in interface ServerConfig
Returns:
The library URL for the server.

getPatchURL

public URL getPatchURL()
Description copied from interface: ServerConfig
Get the patch URL for the server.

Specified by:
getPatchURL in interface ServerConfig
Returns:
The patch URL for the server.

getServerName

public String getServerName()
Description copied from interface: ServerConfig
Get the name of the server.

Specified by:
getServerName in interface ServerConfig
Returns:
The name of the server.

getServerBaseDir

public File getServerBaseDir()
Description copied from interface: ServerConfig
Get the base directory for calculating server home directories.

Specified by:
getServerBaseDir in interface ServerConfig
Returns:
Base server home directory.

getServerHomeDir

public File getServerHomeDir()
Description copied from interface: ServerConfig
Get the server home directory.

Specified by:
getServerHomeDir in interface ServerConfig
Returns:
Server home directory.

getServerLogDir

public File getServerLogDir()
Get the directory where temporary files will be stored. The associated ServerConfig.SERVER_LOG_DIR system property needs to be set before the logging framework is used.

Specified by:
getServerLogDir in interface ServerConfig
Returns:
the writable temp directory
See Also:
ServerConfig.SERVER_LOG_DIR

getServerTempDir

public File getServerTempDir()
Get the directory where temporary files will be stored.

Specified by:
getServerTempDir in interface ServerConfig
Returns:
the writable temp directory

getServerDataDir

public File getServerDataDir()
Get the directory where local data will be stored.

Specified by:
getServerDataDir in interface ServerConfig
Returns:
the data directory

getServerNativeDir

public File getServerNativeDir()
Get the native dir for unpacking

Specified by:
getServerNativeDir in interface ServerConfig
Returns:
the directory

getServerTempDeployDir

public File getServerTempDeployDir()
Get the temporary deployment dir for unpacking

Specified by:
getServerTempDeployDir in interface ServerConfig
Returns:
the directory

getServerBaseURL

public URL getServerBaseURL()
Description copied from interface: ServerConfig
Get the base directory for calculating server home URLs.

Specified by:
getServerBaseURL in interface ServerConfig
Returns:
Base server home URL.

getServerHomeURL

public URL getServerHomeURL()
Description copied from interface: ServerConfig
Get the server home URL.

Specified by:
getServerHomeURL in interface ServerConfig
Returns:
Server home URL.

getServerLibraryURL

public URL getServerLibraryURL()
Description copied from interface: ServerConfig
Get the server library URL.

Specified by:
getServerLibraryURL in interface ServerConfig
Returns:
Server library URL.

getCommonBaseURL

public URL getCommonBaseURL()
Description copied from interface: ServerConfig
Get the common base URL.

Specified by:
getCommonBaseURL in interface ServerConfig
Returns:
Common base URL.

getCommonLibraryURL

public URL getCommonLibraryURL()
Description copied from interface: ServerConfig
Get the common library URL.

Specified by:
getCommonLibraryURL in interface ServerConfig
Returns:
Common library URL.

getServerConfigURL

public URL getServerConfigURL()
Description copied from interface: ServerConfig
Get the server configuration URL.

Specified by:
getServerConfigURL in interface ServerConfig
Returns:
Server configuration URL.

getPlatformMBeanServer

public boolean getPlatformMBeanServer()
Get the current value of the flag that indicates if we are using the platform MBeanServer as the main jboss server. Both the ServerConfig.PLATFORM_MBEANSERVER property must be set, and the jvm must be jdk1.5+

Specified by:
getPlatformMBeanServer in interface ServerConfig
Returns:
true if jboss runs on the jvm platfrom MBeanServer

setExitOnShutdown

public void setExitOnShutdown(boolean flag)
Enable or disable exiting the JVM when Server.shutdown() is called. If enabled, then shutdown calls Server#exit(). If disabled, then only the shutdown hook will be run.

Specified by:
setExitOnShutdown in interface ServerConfig
Parameters:
flag - True to enable calling exit on shutdown.

getExitOnShutdown

public boolean getExitOnShutdown()
Get the current value of the exit on shutdown flag.

Specified by:
getExitOnShutdown in interface ServerConfig
Returns:
The current value of the exit on shutdown flag.

setInstallLifeThread

public void setInstallLifeThread(boolean flag)

isInstallLifeThread

public boolean isInstallLifeThread()
Description copied from interface: ServerConfig
Whether to install the lifethread

Specified by:
isInstallLifeThread in interface ServerConfig
Returns:
true to install the life thread

setBlockingShutdown

public void setBlockingShutdown(boolean flag)
Enable or disable blocking when Server.shutdown() is called. If enabled, then shutdown will be called in the current thread. If disabled, then the shutdown hook will be run ansynchronously in a separate thread.

Specified by:
setBlockingShutdown in interface ServerConfig
Parameters:
flag - True to enable blocking shutdown.

getBlockingShutdown

public boolean getBlockingShutdown()
Get the current value of the blocking shutdown flag.

Specified by:
getBlockingShutdown in interface ServerConfig
Returns:
The current value of the blocking shutdown flag.

setRequireJBossURLStreamHandlerFactory

public void setRequireJBossURLStreamHandlerFactory(boolean flag)
Set the RequireJBossURLStreamHandlerFactory flag. if false, exceptions when setting the URLStreamHandlerFactory will be logged and ignored.

Specified by:
setRequireJBossURLStreamHandlerFactory in interface ServerConfig
Parameters:
flag - True to enable blocking shutdown.

getRequireJBossURLStreamHandlerFactory

public boolean getRequireJBossURLStreamHandlerFactory()
Get the current value of the requireJBossURLStreamHandlerFactory flag.

Specified by:
getRequireJBossURLStreamHandlerFactory in interface ServerConfig
Returns:
The current value of the requireJBossURLStreamHandlerFactory flag.

setRootDeploymentFilename

public void setRootDeploymentFilename(String filename)
Set the filename of the root deployable that will be used to finalize the bootstrap process.

Specified by:
setRootDeploymentFilename in interface ServerConfig
Parameters:
filename - The filename of the root deployable.

getRootDeploymentFilename

public String getRootDeploymentFilename()
Get the filename of the root deployable that will be used to finalize the bootstrap process.

Specified by:
getRootDeploymentFilename in interface ServerConfig
Returns:
The filename of the root deployable.

getSpecificationVersion

public String getSpecificationVersion()
Description copied from interface: ServerConfig
Get the server Specification-Version

Specified by:
getSpecificationVersion in interface ServerConfig
Returns:
the spec version


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.