Class 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.
    • Constructor Detail

      • ProcessEnvironment

        public ProcessEnvironment()
    • Method Detail

      • getProcessNameWriteHandler

        public OperationStepHandler getProcessNameWriteHandler()
        Gets an OperationStepHandler that can write the name 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 to setProcessName(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 by getProcessNameWriteHandler(); its visibility is protected only because subclasses need to implement it.
        Parameters:
        processName - the process name. May be null 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 be null
        propertyValue - the value of the property. May be null
        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 into reload-required state.
        Throws:
        OperationFailedException - if a change to the given property is not allowed at all; e.g. changing jboss.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 this ProcessEnvironment 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 to isRuntimeSystemPropertyUpdateAllowed(String, String, boolean) has returned true.
        Parameters:
        propertyName - the name of the property. Cannot be null
        propertyValue - the value of the property. May be null
      • 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 the host controller name. Defaults to the portion of the qualified host name following the first '.'.
        Returns:
        the local host name
      • getRunningModeControl

        public abstract RunningModeControl getRunningModeControl()
        Get the RunningModeControl 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 be null.
        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:
        1. If the assignedValue is not null, it will be used.
        2. Else if a uuid has been persisted to filePath, the persisted value will be used
        3. 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 be null
        assignedValue - value to use for the uuid. May be null
        Returns:
        the uuid. Will not return null
        Throws:
        IOException - if there is a problem reading from or writing to filePath
      • resolveGUID

        protected static String resolveGUID​(String unresolvedName)