Class ProcessEnvironment
- java.lang.Object
-
- org.jboss.as.controller.operations.common.ProcessEnvironment
-
public abstract class ProcessEnvironment extends Object
Base class for objects that store environment information for a process.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ProcessEnvironment.ProcessNameWriteAttributeHandler
-
Field Summary
Fields Modifier and Type Field Description static String
JBOSS_DOMAIN_UUID
The special process name value that triggers calculation of a UUIDprotected static String
KERNEL_DIR
The name of the directory used to store WildFly kernel specific filesstatic AttributeDefinition
NAME
AttributeDefinition
for thename
attribute for a processes root resourceprotected static String
UUID_FILE
The name of the file used to store the process UUID
-
Constructor Summary
Constructors Constructor Description ProcessEnvironment()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
getHostControllerName()
Get the name of this server's host controller.abstract String
getHostName()
Get the local host name detected at server startup.abstract UUID
getInstanceUuid()
Get the UUID of this process.protected abstract String
getProcessName()
Gets the resolved name of this process; a value previously passed tosetProcessName(String)
or a value derived from the environment.OperationStepHandler
getProcessNameReadHandler()
Gets anOperationStepHandler
that can read thename
attribute for a processes root resourceOperationStepHandler
getProcessNameWriteHandler()
Gets anOperationStepHandler
that can write thename
attribute for a processes root resourceabstract String
getQualifiedHostName()
Get the fully-qualified host name detected at server startup.abstract RunningModeControl
getRunningModeControl()
Get theRunningModeControl
containing the current running mode of the serverprotected abstract boolean
isRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime)
Gets whether updating the runtime system properties with the given property is allowed.protected UUID
obtainProcessUUID(Path filePath, String assignedValue)
Obtain the unique management id for this process and persist it for reuse if the process is restarted.protected static String
resolveGUID(String unresolvedName)
protected abstract void
setProcessName(String processName)
Sets the process name.protected abstract void
systemPropertyUpdated(String propertyName, String propertyValue)
Notifies thisProcessEnvironment
that the runtime value of the given system property has been updated, allowing it to update any state that was originally set via the system property during primordial process boot.
-
-
-
Field Detail
-
UUID_FILE
protected static final String UUID_FILE
The name of the file used to store the process UUID- See Also:
- Constant Field Values
-
KERNEL_DIR
protected static final String KERNEL_DIR
The name of the directory used to store WildFly kernel specific files- See Also:
- Constant Field Values
-
JBOSS_DOMAIN_UUID
public static final String JBOSS_DOMAIN_UUID
The special process name value that triggers calculation of a UUID- See Also:
- Constant Field Values
-
NAME
public static final AttributeDefinition NAME
AttributeDefinition
for thename
attribute for a processes root resource
-
-
Method Detail
-
getProcessNameReadHandler
public OperationStepHandler getProcessNameReadHandler()
Gets anOperationStepHandler
that can read thename
attribute for a processes root resource- Returns:
- the handler
-
getProcessNameWriteHandler
public OperationStepHandler getProcessNameWriteHandler()
Gets anOperationStepHandler
that can write thename
attribute for a processes root resource- Returns:
- the handler
-
getProcessName
protected abstract String getProcessName()
Gets the resolved name of this process; a value previously passed tosetProcessName(String)
or a value derived from the environment.- Returns:
- the process name. Cannot be
null
-
setProcessName
protected abstract void setProcessName(String processName)
Sets the process name. This method can only be called by the handler returned bygetProcessNameWriteHandler()
; its visibility is protected only because subclasses need to implement it.- Parameters:
processName
- the process name. May benull
in which case a default process name should be used.
-
isRuntimeSystemPropertyUpdateAllowed
protected abstract boolean isRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime) throws OperationFailedException
Gets whether updating the runtime system properties with the given property is allowed.- Parameters:
propertyName
- the name of the property. Cannot benull
propertyValue
- the value of the property. May benull
bootTime
-true
if the process is currently booting- Returns:
true
if the update can be applied to the runtime system properties; false if it should just be stored in the persistent configuration and the process should be put intoreload-required state
.- Throws:
OperationFailedException
- if a change to the given property is not allowed at all; e.g. changingjboss.server.base.dir
after primordial boot is not allowed; the property can only be set from the command line
-
systemPropertyUpdated
protected abstract void systemPropertyUpdated(String propertyName, String propertyValue)
Notifies thisProcessEnvironment
that the runtime value of the given system property has been updated, allowing it to update any state that was originally set via the system property during primordial process boot. This method should only be invoked after a call toisRuntimeSystemPropertyUpdateAllowed(String, String, boolean)
has returnedtrue
.- Parameters:
propertyName
- the name of the property. Cannot benull
propertyValue
- the value of the property. May benull
-
getInstanceUuid
public abstract UUID getInstanceUuid()
Get the UUID of this process.- Returns:
- the UUID of this process.
-
getQualifiedHostName
public abstract String getQualifiedHostName()
Get the fully-qualified host name detected at server startup.- Returns:
- the qualified host name
-
getHostName
public abstract String getHostName()
Get the local host name detected at server startup. Note that this is not the same as thehost controller name
. Defaults to the portion ofthe qualified host name
following the first '.'.- Returns:
- the local host name
-
getRunningModeControl
public abstract RunningModeControl getRunningModeControl()
Get theRunningModeControl
containing the current running mode of the server- Returns:
- the running mode control
-
getHostControllerName
public abstract 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
.- Returns:
- server's host controller name if the instance is running in domain mode, or
null
if running in standalone mode
-
obtainProcessUUID
protected final UUID obtainProcessUUID(Path filePath, String assignedValue) throws IOException
Obtain the unique management id for this process and persist it for reuse if the process is restarted. The uuid will be obtained in the following manner:- If the
assignedValue
is notnull
, it will be used. - Else if a uuid has been persisted to
filePath
, the persisted value will be used - Else a random uuid will be generated
- Parameters:
filePath
- filesystem location where the uuid is to be persisted and may have already been persisted. Cannot benull
assignedValue
- value to use for the uuid. May benull
- Returns:
- the uuid. Will not return
null
- Throws:
IOException
- if there is a problem reading from or writing tofilePath
- If the
-
-