Class ProcessEnvironment
java.lang.Object
org.jboss.as.controller.operations.common.ProcessEnvironment
- All Implemented Interfaces:
FeatureFilter,FeatureRegistry
Base class for objects that store environment information for a process.
- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe special process name value that triggers calculation of a UUIDprotected static final StringThe name of the directory used to store WildFly kernel specific filesstatic final AttributeDefinitionAttributeDefinitionfor thenameattribute for a processes root resourcestatic final Stringprotected static final StringThe name of the file used to store the process UUID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StringGet the name of this server's host controller.abstract StringGet the local host name detected at server startup.abstract UUIDGet the UUID of this process.protected abstract StringGets the resolved name of this process; a value previously passed tosetProcessName(String)or a value derived from the environment.Gets anOperationStepHandlerthat can read thenameattribute for a processes root resourceGets anOperationStepHandlerthat can write thenameattribute for a processes root resourceabstract StringGet the fully-qualified host name detected at server startup.abstract RunningModeControlGet theRunningModeControlcontaining the current running mode of the serverReturns an unmodifiable set of all the permissible stability levels.protected abstract booleanisRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime) Gets whether updating the runtime system properties with the given property is allowed.protected final UUIDobtainProcessUUID(Path filePath, String assignedValue) Obtain the unique management id for this process and persist it for reuse if the process is restarted.protected static StringresolveGUID(String unresolvedName) protected abstract voidsetProcessName(String processName) Sets the process name.protected abstract voidsystemPropertyUpdated(String propertyName, String propertyValue) Notifies thisProcessEnvironmentthat 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.as.controller.FeatureRegistry
enables, getStability
-
Field Details
-
UUID_FILE
The name of the file used to store the process UUID- See Also:
-
KERNEL_DIR
The name of the directory used to store WildFly kernel specific files- See Also:
-
JBOSS_DOMAIN_UUID
The special process name value that triggers calculation of a UUID- See Also:
-
NAME
AttributeDefinitionfor thenameattribute for a processes root resource -
STABILITY
- See Also:
-
-
Constructor Details
-
ProcessEnvironment
public ProcessEnvironment()
-
-
Method Details
-
getStabilities
Returns an unmodifiable set of all the permissible stability levels.- Returns:
- a set of stability levels
-
getProcessNameReadHandler
Gets anOperationStepHandlerthat can read thenameattribute for a processes root resource- Returns:
- the handler
-
getProcessNameWriteHandler
Gets anOperationStepHandlerthat can write thenameattribute for a processes root resource- Returns:
- the handler
-
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
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 benullin 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 benullpropertyValue- the value of the property. May benullbootTime-trueif the process is currently booting- Returns:
trueif 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.dirafter primordial boot is not allowed; the property can only be set from the command line
-
systemPropertyUpdated
Notifies thisProcessEnvironmentthat 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 benullpropertyValue- the value of the property. May benull
-
getInstanceUuid
Get the UUID of this process.- Returns:
- the UUID of this process.
-
getQualifiedHostName
Get the fully-qualified host name detected at server startup.- Returns:
- the qualified host name
-
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 namefollowing the first '.'.- Returns:
- the local host name
-
getRunningModeControl
Get theRunningModeControlcontaining the current running mode of the server- Returns:
- the running mode control
-
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
nullif running in standalone mode
-
obtainProcessUUID
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
assignedValueis 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 benullassignedValue- 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
-
resolveGUID
-