Package org.jboss.as.server
Class ServerEnvironment
- java.lang.Object
-
- org.jboss.as.controller.operations.common.ProcessEnvironment
-
- org.jboss.as.server.ServerEnvironment
-
- All Implemented Interfaces:
Serializable,FeatureFilter,FeatureRegistry
public class ServerEnvironment extends ProcessEnvironment implements Serializable
Encapsulates the runtime environment for a server. This is parsed when the server is initially started, a process reload reuses the server environment.- Author:
- Brian Stansberry, Mike M. Clark
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classServerEnvironment.LaunchTypeThe manner in which a server can be launched-
Nested classes/interfaces inherited from class org.jboss.as.controller.operations.common.ProcessEnvironment
ProcessEnvironment.ProcessNameWriteAttributeHandler
-
-
Field Summary
Fields Modifier and Type Field Description static StringBOOTSTRAP_MAX_THREADSConstant that holds the name of the system property for specifying the max threads used by the bootstrap ServiceContainer.static StringCONTROLLER_TEMP_DIRCommon alias between domain and standalone mode.static StringDOMAIN_BASE_DIRstatic StringDOMAIN_CONFIG_DIRstatic StringHOME_DIRConstant that holds the name of the system property for specifyingthe JBoss home directory.static StringHOST_NAMEConstant that holds the name of the system property for specifying the local part of the name of the host machine that this server is running on.static StringJAVA_EXT_DIRSConstant that holds the name of the system property for specifying the JDK extension directory paths.static StringJBOSS_BIND_ADDRESSThe default system property used to store bind address information from the command-line (-b).static StringJBOSS_BIND_ADDRESS_PREFIXPrefix for the system property used to store qualified bind address information from the command-line (-bxxx).static StringJBOSS_DEFAULT_MULTICAST_ADDRESSThe default system property used to store bind address information from the command-line (-b).static StringJBOSS_PERSIST_SERVER_CONFIGDeprecated.for internal us only, may change or be removed at any time without noticestatic StringJBOSS_SERVER_DEFAULT_CONFIGThe system property used to store the name of the default server configuration file.static StringJBOSS_SERVER_MANAGEMENT_UUIDThe system property used to set the unique identifier for this server exposed via theuuidattribute of the server's root management resource.static StringNODE_NAMEConstant that holds the name of the system property for specifying the node name within a cluster.static StringQUALIFIED_HOST_NAMEConstant that holds the name of the system property for specifying the fully-qualified name of the host machine that this server is running on.static StringSERVER_BASE_DIRConstant that holds the name of the system property for specifyingthe server base directory.static StringSERVER_CONFIG_DIRConstant that holds the name of the system property for specifyingthe server configuration directory.static StringSERVER_CONTENT_DIRConstant that holds the name of the system property for specifyingthe server managed content repository directory.static StringSERVER_DATA_DIRConstant that holds the name of the system property for specifyinggetServerDataDir()() the server data directory}.static StringSERVER_LOG_DIRConstant that holds the name of the system property for specifyingthe server log directory.static StringSERVER_NAMEConstant that holds the name of the system property for specifying the name of this server instance.static StringSERVER_TEMP_DIRConstant that holds the name of the system property for specifying tthe server temp directory.static org.wildfly.service.descriptor.NullaryServiceDescriptor<ServerEnvironment>SERVICE_DESCRIPTORstatic StringVFS_MODULE_IDENTIFIERVFS module identifier.-
Fields inherited from class org.jboss.as.controller.operations.common.ProcessEnvironment
JBOSS_DOMAIN_UUID, KERNEL_DIR, NAME, STABILITY, UUID_FILE
-
-
Constructor Summary
Constructors Constructor Description ServerEnvironment(String hostControllerName, Properties props, Map<String,String> env, String serverConfig, ConfigurationFile.InteractionPolicy configInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, boolean startSuspended)ServerEnvironment(String hostControllerName, Properties props, Map<String,String> env, String serverConfig, ConfigurationFile.InteractionPolicy configurationInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, long startTime, boolean startSuspended, boolean startGracefully, String gitRepository, String gitBranch, String gitAuthConfiguration, String supplementalConfiguration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckStabilityIsValidForInstallation(Stability stability)static intgetBootstrapMaxThreads()Determine the number of threads to use for the bootstrap service container.ConfigurationExtensiongetConfigurationExtension()FilegetDomainBaseDir()Gets the base directory in which managed domain files are stored.FilegetDomainConfigurationDir()Gets the directory in which managed domain configuration files are stored.GitRepositorygetGitRepository()FilegetHomeDir()Gets the root directory for this JBoss installation.StringgetHostControllerName()Get the name of this server's host controller.StringgetHostName()Get the local host name detected at server startup.RunningModegetInitialRunningMode()Gets theRunningModethat was in effect when this server was launched.UUIDgetInstanceUuid()File[]getJavaExtDirs()Gets any Java extension directories.ServerEnvironment.LaunchTypegetLaunchType()Gets the manner in which this server was launchedStringgetNodeName()Get the node name used for clustering purposes.protected StringgetProcessName()ProductConfiggetProductConfig()Gets theProductConfigdetected at startup.StringgetQualifiedHostName()Get the fully-qualified host name detected at server startup.RunningModeControlgetRunningModeControl()Get theRunningModeControlcontaining the current running mode of the serverFilegetServerBaseDir()Gets the based directory for this server.FilegetServerConfigurationDir()Gets the directory in which server configuration files are stored.ConfigurationFilegetServerConfigurationFile()Gets theConfigurationFilethat manages the server's configuration file.FilegetServerContentDir()Gets the directory in which the server will store server-managed user content (e.g.FilegetServerDataDir()Gets the directory in which the server can store private internal state that should survive a process restart.FilegetServerLogDir()Gets the directory in which the server can write log files.StringgetServerName()Get the name of this server instance.FilegetServerTempDir()Gets the directory in which athe server can store private internal state that does not need to survive a process restart.Set<Stability>getStabilities()StabilitygetStability()longgetStartTime()Gets the time when this process was started.protected booleanisRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime)booleanisSelfContained()Gets whether this server is a self-contained (no filesystem layout) or not.booleanisStandalone()Gets whether this server is an independently managed server, not managed as part of a managed domain.booleanisStartGracefully()If this is true then the server will start with graceful startup disabledbooleanisStartSuspended()If this is true then the server will start in suspended modeprotected voidsetProcessName(String processName)protected voidsystemPropertyUpdated(String propertyName, String propertyValue)static StringtranslateFileAlias(String alias, Stability stability)booleanuseGit()-
Methods inherited from class org.jboss.as.controller.operations.common.ProcessEnvironment
getProcessNameReadHandler, getProcessNameWriteHandler, obtainProcessUUID, resolveGUID
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.as.controller.FeatureRegistry
enables
-
-
-
-
Field Detail
-
SERVICE_DESCRIPTOR
public static final org.wildfly.service.descriptor.NullaryServiceDescriptor<ServerEnvironment> SERVICE_DESCRIPTOR
-
JAVA_EXT_DIRS
public static final String JAVA_EXT_DIRS
Constant that holds the name of the system property for specifying the JDK extension directory paths.- See Also:
- Constant Field Values
-
HOME_DIR
public static final String HOME_DIR
Constant that holds the name of the system property for specifyingthe JBoss home directory.- See Also:
- Constant Field Values
-
VFS_MODULE_IDENTIFIER
public static final String VFS_MODULE_IDENTIFIER
VFS module identifier.- See Also:
- Constant Field Values
-
SERVER_BASE_DIR
public static final String SERVER_BASE_DIR
Constant that holds the name of the system property for specifyingthe server base directory.Defaults to HOME_DIR/standalone.
- See Also:
- Constant Field Values
-
SERVER_CONFIG_DIR
public static final String SERVER_CONFIG_DIR
Constant that holds the name of the system property for specifyingthe server configuration directory.Defaults to SERVER_BASE_DIR/configuration .
- See Also:
- Constant Field Values
-
SERVER_DATA_DIR
public static final String SERVER_DATA_DIR
Constant that holds the name of the system property for specifyinggetServerDataDir()() the server data directory}.Defaults to SERVER_BASE_DIR/data.
- See Also:
- Constant Field Values
-
SERVER_CONTENT_DIR
public static final String SERVER_CONTENT_DIR
Constant that holds the name of the system property for specifyingthe server managed content repository directory.Defaults to SERVER_DATA_DIR/content.
- See Also:
- Constant Field Values
-
SERVER_LOG_DIR
public static final String SERVER_LOG_DIR
Constant that holds the name of the system property for specifyingthe server log directory.Defaults to SERVER_BASE_DIR/log.
- See Also:
- Constant Field Values
-
SERVER_TEMP_DIR
public static final String SERVER_TEMP_DIR
Constant that holds the name of the system property for specifying tthe server temp directory.Defaults to SERVER_BASE_DIR/tmp .
- See Also:
- Constant Field Values
-
CONTROLLER_TEMP_DIR
public static final String CONTROLLER_TEMP_DIR
Common alias between domain and standalone mode. Equivalent to jboss.domain.temp.dir in a managed domain, and jboss.server.temp.dir on a standalone server.- See Also:
- Constant Field Values
-
NODE_NAME
public static final String NODE_NAME
Constant that holds the name of the system property for specifying the node name within a cluster.- See Also:
- Constant Field Values
-
SERVER_NAME
public static final String SERVER_NAME
Constant that holds the name of the system property for specifying the name of this server instance.- See Also:
- Constant Field Values
-
HOST_NAME
public static final String HOST_NAME
Constant that holds the name of the system property for specifying the local part of the name of the host machine that this server is running on.- See Also:
- Constant Field Values
-
QUALIFIED_HOST_NAME
public static final String QUALIFIED_HOST_NAME
Constant that holds the name of the system property for specifying the fully-qualified name of the host machine that this server is running on.- See Also:
- Constant Field Values
-
BOOTSTRAP_MAX_THREADS
public static final String BOOTSTRAP_MAX_THREADS
Constant that holds the name of the system property for specifying the max threads used by the bootstrap ServiceContainer.- See Also:
- Constant Field Values
-
JBOSS_BIND_ADDRESS
public static final String JBOSS_BIND_ADDRESS
The default system property used to store bind address information from the command-line (-b).- See Also:
- Constant Field Values
-
JBOSS_BIND_ADDRESS_PREFIX
public static final String JBOSS_BIND_ADDRESS_PREFIX
Prefix for the system property used to store qualified bind address information from the command-line (-bxxx).- See Also:
- Constant Field Values
-
JBOSS_DEFAULT_MULTICAST_ADDRESS
public static final String JBOSS_DEFAULT_MULTICAST_ADDRESS
The default system property used to store bind address information from the command-line (-b).- See Also:
- Constant Field Values
-
JBOSS_SERVER_DEFAULT_CONFIG
public static final String JBOSS_SERVER_DEFAULT_CONFIG
The system property used to store the name of the default server configuration file. If not set, the default domain configuration file is "standalone.xml". The default domain configuration file is only relevant if the user does not use the-cor--server-configcommand line switches to explicitly set the server configuration file.- See Also:
- Constant Field Values
-
JBOSS_SERVER_MANAGEMENT_UUID
public static final String JBOSS_SERVER_MANAGEMENT_UUID
The system property used to set the unique identifier for this server exposed via theuuidattribute of the server's root management resource. If the property is not set any previously persisted UUID will be used; otherwise a random UUID will be generated.- See Also:
- Constant Field Values
-
JBOSS_PERSIST_SERVER_CONFIG
@Deprecated public static final String JBOSS_PERSIST_SERVER_CONFIG
Deprecated.for internal us only, may change or be removed at any time without noticeThe system property used to indicate whether the server was configured to persist changes to the configuration files.- See Also:
- Constant Field Values
-
DOMAIN_BASE_DIR
public static final String DOMAIN_BASE_DIR
- See Also:
- Constant Field Values
-
DOMAIN_CONFIG_DIR
public static final String DOMAIN_CONFIG_DIR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServerEnvironment
public ServerEnvironment(String hostControllerName, Properties props, Map<String,String> env, String serverConfig, ConfigurationFile.InteractionPolicy configInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, boolean startSuspended)
-
ServerEnvironment
public ServerEnvironment(String hostControllerName, Properties props, Map<String,String> env, String serverConfig, ConfigurationFile.InteractionPolicy configurationInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, long startTime, boolean startSuspended, boolean startGracefully, String gitRepository, String gitBranch, String gitAuthConfiguration, String supplementalConfiguration)
-
-
Method Detail
-
getHostControllerName
public String getHostControllerName()
Get the name of this server's host controller. For domain-mode servers, this is the name given in the domain configuration. For standalone servers, which do not utilize a host controller, the value should benull.- Specified by:
getHostControllerNamein classProcessEnvironment- Returns:
- server's host controller name if the instance is running in domain mode, or
nullif running in standalone mode
-
getServerName
public String getServerName()
Get the name of this server instance. For domain-mode servers, this is the name given in the domain configuration. For standalone servers, this is the name either provided in the server configuration, or, if not given, the name specified viasystem property, or auto-detected based onhost name.- Returns:
- the server name
-
getQualifiedHostName
public String getQualifiedHostName()
Get the fully-qualified host name detected at server startup.- Specified by:
getQualifiedHostNamein classProcessEnvironment- Returns:
- the qualified host name
-
getHostName
public String getHostName()
Get the local host name detected at server startup.- Specified by:
getHostNamein classProcessEnvironment- Returns:
- the local host name
-
getNodeName
public String getNodeName()
Get the node name used for clustering purposes.- Returns:
- the node name
-
getJavaExtDirs
public File[] getJavaExtDirs()
Gets any Java extension directories.- Returns:
- the java extension directories. Will not return
null, but may be an empty array
-
getHomeDir
public File getHomeDir()
Gets the root directory for this JBoss installation.- Returns:
- the root directory
-
getServerBaseDir
public File getServerBaseDir()
Gets the based directory for this server.Defaults to
homeDir/standalone for a standalone server or domain/servers/for a managed domain server. - Returns:
- the base directory for the server
-
getServerConfigurationDir
public File getServerConfigurationDir()
Gets the directory in which server configuration files are stored.Defaults to
getServerBaseDir()serverBaseDir}/configuration- Returns:
- the server configuration directory.
-
getServerConfigurationFile
public ConfigurationFile getServerConfigurationFile()
Gets theConfigurationFilethat manages the server's configuration file.- Returns:
- the configuration file
-
getServerDataDir
public File getServerDataDir()
Gets the directory in which the server can store private internal state that should survive a process restart.Defaults to
getServerBaseDir()serverBaseDir}/data- Returns:
- the internal state persistent storage directory
-
getServerContentDir
public File getServerContentDir()
Gets the directory in which the server will store server-managed user content (e.g. deployments.)Defaults to
getServerDataDir()serverDataDir}/content- Returns:
- the domain managed content storage directory
-
getServerLogDir
public File getServerLogDir()
Gets the directory in which the server can write log files.Defaults to
getServerBaseDir()serverBaseDir}/log- Returns:
- the log file directory for the server.
-
getServerTempDir
public File getServerTempDir()
Gets the directory in which athe server can store private internal state that does not need to survive a process restart.Defaults to
getServerBaseDir()serverBaseDir}/tmp- Returns:
- the internal state temporary storage directory for the server.
-
isStartSuspended
public boolean isStartSuspended()
If this is true then the server will start in suspended mode- Returns:
trueif the server should start in suspended mode
-
isStartGracefully
public boolean isStartGracefully()
If this is true then the server will start with graceful startup disabled- Returns:
trueif the server should start with graceful startup disabled
-
getDomainBaseDir
public File getDomainBaseDir()
Gets the base directory in which managed domain files are stored.Defaults to
JBOSS_HOME/domain- Returns:
- the domain base directory, or
nullif this server is not running in a managed domain.
-
getDomainConfigurationDir
public File getDomainConfigurationDir()
Gets the directory in which managed domain configuration files are stored.Defaults to
getDomainBaseDir()domainBaseDir}/configuration- Returns:
- the domain configuration directory, or
nullif this server is not running in a managed domain.
-
getLaunchType
public ServerEnvironment.LaunchType getLaunchType()
Gets the manner in which this server was launched- Returns:
- the launch type
-
getStability
public Stability getStability()
- Specified by:
getStabilityin interfaceFeatureRegistry
-
getStabilities
public Set<Stability> getStabilities()
- Specified by:
getStabilitiesin classProcessEnvironment
-
isStandalone
public boolean isStandalone()
Gets whether this server is an independently managed server, not managed as part of a managed domain.- Returns:
trueif this server is an independently managed server
-
isSelfContained
public boolean isSelfContained()
Gets whether this server is a self-contained (no filesystem layout) or not.- Returns:
trueif this server is self-contained
-
getInitialRunningMode
public RunningMode getInitialRunningMode()
Gets theRunningModethat was in effect when this server was launched.- Returns:
- the initial running mode
-
getRunningModeControl
public RunningModeControl getRunningModeControl()
Get theRunningModeControlcontaining the current running mode of the server- Specified by:
getRunningModeControlin classProcessEnvironment- Returns:
- the running mode control
-
getProductConfig
public ProductConfig getProductConfig()
Gets theProductConfigdetected at startup.- Returns:
- the product config. Will not be
null
-
getInstanceUuid
public UUID getInstanceUuid()
- Specified by:
getInstanceUuidin classProcessEnvironment
-
getStartTime
public long getStartTime()
Gets the time when this process was started. Note that a process reload does not change this value.- Returns:
- the time, in ms since the epoch
-
useGit
public boolean useGit()
-
getGitRepository
public GitRepository getGitRepository()
-
getConfigurationExtension
public ConfigurationExtension getConfigurationExtension()
-
getBootstrapMaxThreads
public static int getBootstrapMaxThreads()
Determine the number of threads to use for the bootstrap service container. This reads theBOOTSTRAP_MAX_THREADSsystem property and if not set, defaults to 2*cpus.- Returns:
- the maximum number of threads to use for the bootstrap service container.
- See Also:
Runtime.availableProcessors()
-
getProcessName
protected String getProcessName()
- Specified by:
getProcessNamein classProcessEnvironment
-
setProcessName
protected void setProcessName(String processName)
- Specified by:
setProcessNamein classProcessEnvironment
-
isRuntimeSystemPropertyUpdateAllowed
protected boolean isRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime) throws OperationFailedException
- Specified by:
isRuntimeSystemPropertyUpdateAllowedin classProcessEnvironment- Throws:
OperationFailedException
-
systemPropertyUpdated
protected void systemPropertyUpdated(String propertyName, String propertyValue)
- Specified by:
systemPropertyUpdatedin classProcessEnvironment
-
checkStabilityIsValidForInstallation
public void checkStabilityIsValidForInstallation(Stability stability)
-
-