Package org.refcodes.runtime
Enum SystemContext
- java.lang.Object
-
- java.lang.Enum<SystemContext>
-
- org.refcodes.runtime.SystemContext
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<SystemContext>
public enum SystemContext extends java.lang.Enum<SystemContext>
Describes the context within a system's environment regarding host, user and application contexts as well as the currently invoked Java runtime session.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description APPLICATION
Specifies an application specific granularity.APPLICATION_SESSION
Specifies a Java runtime invokcation's session and an application specific granularity.HOST
Specifies a host specific granularity.HOST_APPLICATION
Specifies an application on a host specific granularity.HOST_APPLICATION_SESSION
Specifies a Java runtime invokcation's session for an application on a host specific granularity.HOST_SESSION
Specifies a Java runtime invokcation's session for a host specific granularity.HOST_USER
Specifies a user on a host specific granularity.HOST_USER_APPLICATION
Specifies an application for a user on a host specific granularity.HOST_USER_APPLICATION_SESSION
Specifies a Java runtime invokcation's session for an application for a user on a host specific granularity.HOST_USER_SESSION
Specifies a Java runtime invokcation's session for a user on a host specific granularity.SESSION
Specifies a Java runtime invokcation's session specific granularity, valid just for the current invocation of the Java runtime.USER
Specifies a user specific granularity.USER_APPLICATION
Specifies a user specific granularity.USER_APPLICATION_SESSION
Specifies a Java runtime invokcation's session and a user specific granularity.USER_SESSION
Specifies a Java runtime invokcation's session for a user specific granularity.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isApplicationLevel()
Determines whether the granularity is on an application level.boolean
isHostLevel()
Determines whether the granularity is on a host level.boolean
isSessionLevel()
Determines whether the granularity is on a session level, e.g. valid just for the lifetime of the current runtime Java's invocation.boolean
isUserLevel()
Determines whether the granularity is on a user level.int
toContextId()
Creates an ID most probably unique as specified by the enumeration instance this method is invoked on.int
toContextId(java.lang.String aSeed)
Creates an ID most probably unique as specified by the enumeration instance this method is invoked on.int[]
toContextIds(int aIdLength)
Creates an array of IDs most probably unique as specified by the provided argument this method is invoked on.int[]
toContextIds(int aIdLength, java.lang.String aSeed)
Creates an array of IDs most probably unique as specified by the provided argument this method is invoked on.java.lang.String
toContextSequence()
Creates aString
most probably unique as specified by the enumeration instance this method is invoked on.java.lang.String
toContextSequence(java.lang.String aSeed)
Creates aString
most probably unique as specified by the enumeration instance this method is invoked on.static SystemContext
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static SystemContext[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
APPLICATION
public static final SystemContext APPLICATION
Specifies an application specific granularity.
-
USER_APPLICATION
public static final SystemContext USER_APPLICATION
Specifies a user specific granularity.
-
HOST_USER_APPLICATION
public static final SystemContext HOST_USER_APPLICATION
Specifies an application for a user on a host specific granularity.
-
HOST_APPLICATION
public static final SystemContext HOST_APPLICATION
Specifies an application on a host specific granularity.
-
USER
public static final SystemContext USER
Specifies a user specific granularity.
-
HOST_USER
public static final SystemContext HOST_USER
Specifies a user on a host specific granularity.
-
HOST
public static final SystemContext HOST
Specifies a host specific granularity.
-
SESSION
public static final SystemContext SESSION
Specifies a Java runtime invokcation's session specific granularity, valid just for the current invocation of the Java runtime.
-
APPLICATION_SESSION
public static final SystemContext APPLICATION_SESSION
Specifies a Java runtime invokcation's session and an application specific granularity.
-
USER_APPLICATION_SESSION
public static final SystemContext USER_APPLICATION_SESSION
Specifies a Java runtime invokcation's session and a user specific granularity.
-
HOST_USER_APPLICATION_SESSION
public static final SystemContext HOST_USER_APPLICATION_SESSION
Specifies a Java runtime invokcation's session for an application for a user on a host specific granularity.
-
HOST_APPLICATION_SESSION
public static final SystemContext HOST_APPLICATION_SESSION
Specifies a Java runtime invokcation's session for an application on a host specific granularity.
-
USER_SESSION
public static final SystemContext USER_SESSION
Specifies a Java runtime invokcation's session for a user specific granularity.
-
HOST_USER_SESSION
public static final SystemContext HOST_USER_SESSION
Specifies a Java runtime invokcation's session for a user on a host specific granularity.
-
HOST_SESSION
public static final SystemContext HOST_SESSION
Specifies a Java runtime invokcation's session for a host specific granularity.
-
-
Method Detail
-
values
public static SystemContext[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SystemContext c : SystemContext.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SystemContext valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
isHostLevel
public boolean isHostLevel()
Determines whether the granularity is on a host level.- Returns:
- True in case of being on a host level, else false.
-
isUserLevel
public boolean isUserLevel()
Determines whether the granularity is on a user level.- Returns:
- True in case of being on a user level, else false.
-
isApplicationLevel
public boolean isApplicationLevel()
Determines whether the granularity is on an application level.- Returns:
- True in case of being on an application level, else false.
-
isSessionLevel
public boolean isSessionLevel()
Determines whether the granularity is on a session level, e.g. valid just for the lifetime of the current runtime Java's invocation.- Returns:
- True in case of being on a session level, else false.
-
toContextSequence
public java.lang.String toContextSequence()
Creates aString
most probably unique as specified by the enumeration instance this method is invoked on. Attention: The result my vary depending on the user under which the application is being executed! Supports the environment variableEnvironmentVariable.HOST_SEED
as well as the system propertySystemProperty.HOST_SEED
. The enumeration value specifies the context for the created ID, e.g. which system properties to take into account.- Returns:
- The calculated system's
String
.
-
toContextSequence
public java.lang.String toContextSequence(java.lang.String aSeed)
Creates aString
most probably unique as specified by the enumeration instance this method is invoked on. Attention: The result my vary depending on the user under which the application is being executed! Supports the environment variableEnvironmentVariable.HOST_SEED
as well as the system propertySystemProperty.HOST_SEED
. The enumeration value specifies the context for the created ID, e.g. which system properties to take into account.- Parameters:
aSeed
- A seed to alter the ID individually.- Returns:
- The calculated system's
String
.
-
toContextId
public int toContextId()
Creates an ID most probably unique as specified by the enumeration instance this method is invoked on. Succeeding calls of this method on the same machine returns the same value. Attention: The result my vary depending on the user under which the application is being executed! Supports the environment variableEnvironmentVariable.HOST_SEED
as well as the system propertySystemProperty.HOST_SEED
. The enumeration value specifies the context for the created ID, e.g. which system properties to take into account.- Returns:
- The calculated system's ID.
-
toContextId
public int toContextId(java.lang.String aSeed)
Creates an ID most probably unique as specified by the enumeration instance this method is invoked on. Succeeding calls of this method on the same machine with the same arguments returns the same value. Attention: The result my vary depending on the user under which the application is being executed! Supports the environment variableEnvironmentVariable.HOST_SEED
as well as the system propertySystemProperty.HOST_SEED
. System.out.println(System.getenv("PROCESSOR_ARCHITECTURE")); System.out.println(System.getenv("PROCESSOR_ARCHITEW6432")); System.getProperty("os.arch"); The enumeration value specifies the context for the created ID, e.g. which system properties to take into account.- Parameters:
aSeed
- A seed to alter the ID individually.- Returns:
- The calculated system's ID.
-
toContextIds
public int[] toContextIds(int aIdLength)
Creates an array of IDs most probably unique as specified by the provided argument this method is invoked on. Succeeding calls of this method on the same machine with the same arguments returns the same values. Attention: The result my vary depending on the user under which the application is being executed! Supports the environment variableEnvironmentVariable.HOST_SEED
as well as the system propertySystemProperty.HOST_SEED
. The enumeration value specifies the context for the created ID, e.g. which system properties to take into account.- Parameters:
aIdLength
- The number of IDs to be generated.- Returns:
- The calculated system's ID.
-
toContextIds
public int[] toContextIds(int aIdLength, java.lang.String aSeed)
Creates an array of IDs most probably unique as specified by the provided argument this method is invoked on. Succeeding calls of this method on the same machine with the same arguments returns the same values. Attention: The result my vary depending on the user under which the application is being executed! Supports the environment variableEnvironmentVariable.HOST_SEED
as well as the system propertySystemProperty.HOST_SEED
. The enumeration value specifies the context for the created ID, e.g. which system properties to take into account.- Parameters:
aIdLength
- The number of IDs to be generated.aSeed
- A seed to alter the ID individually.- Returns:
- The calculated system's ID.
-
-