org.productivity.java.habitat4j
Class ServerIdentityManager

java.lang.Object
  extended by org.productivity.java.habitat4j.common.AbstractServerIdentityManager
      extended by org.productivity.java.habitat4j.ServerIdentityManager
All Implemented Interfaces:
Habitat4JConstants

public class ServerIdentityManager
extends AbstractServerIdentityManager

ServerIdentityManager provides access to a server-wide XML file called an "identity" file. This class manages the system-wide instance of ServerIdentity, which provides the PropertyListManager with information used to load properties based on the appropriate context.

## LICENSE INFORMATION ##

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Version:
$Id: ServerIdentityManager.html,v 1.2 2008/11/24 15:15:21 cvs Exp $
Author:
Justin Yunke <habitat4j@productivity.org>

Field Summary
 
Fields inherited from class org.productivity.java.habitat4j.common.AbstractServerIdentityManager
logger
 
Fields inherited from interface org.productivity.java.habitat4j.common.Habitat4JConstants
EOL_SEQUENCE, HABITAT4J_APPNAME_ATTRIBUTE_NAME, HABITAT4J_APPNAME_DEFAULT, HABITAT4J_CONTEXT_APPLICATION_NAME, HABITAT4J_CONTEXT_ENVIRONMENT, HABITAT4J_CONTEXT_INSTANCE_DESCRIPTION, HABITAT4J_CONTEXT_INSTANCE_ENUMERATION, HABITAT4J_CONTEXT_INSTANCE_NAME, HABITAT4J_CONTEXT_INSTANCE_OS, HABITAT4J_CONTEXT_LEGAL_ROLE_NAMES, HABITAT4J_CONTEXT_PREFIX, HABITAT4J_CONTEXT_ROLE_NAME, HABITAT4J_CONTEXT_ROLE_PATCH_LEVEL, HABITAT4J_CONTEXT_ROLE_PRODUCT, HABITAT4J_CONTEXT_ROLE_TYPE, HABITAT4J_CONTEXT_ROLE_VENDOR, HABITAT4J_CONTEXT_ROLE_VERSION, HABITAT4J_DEFINITIONS_PACKAGE, HABITAT4J_GENERIC_VALUE_DEFAULT, HABITAT4J_GENERIC_VALUE_EMPTY_STRING, HABITAT4J_GENERIC_VALUE_FALSE, HABITAT4J_GENERIC_VALUE_NO, HABITAT4J_GENERIC_VALUE_OFF, HABITAT4J_GENERIC_VALUE_ON, HABITAT4J_GENERIC_VALUE_ONE, HABITAT4J_GENERIC_VALUE_TRUE, HABITAT4J_GENERIC_VALUE_YES, HABITAT4J_GENERIC_VALUE_ZERO, HABITAT4J_HIDDEN_FIELD_DECODED, HABITAT4J_HIDDEN_FIELD_DECODED_DECRYPTED, HABITAT4J_HIDDEN_FIELD_DECRYPTED, HABITAT4J_LOG4J_LOGGER, HABITAT4J_LOG4J_LOGMANAGER_CLASS, HABITAT4J_LOG4J_LOGMANAGER_GETLOGGER_METHOD, HABITAT4J_PRAGMA_ATTRIBUTE_NAME, HABITAT4J_PRAGMA_ATTRIBUTE_VALUE, HABITAT4J_PROPERTY_ARRAY_INSTANCE_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_ARRAY_INSTANCE_ATTRIBUTE_VALUE_APPEND, HABITAT4J_PROPERTY_ARRAY_INSTANCE_ATTRIBUTE_VALUE_DEFAULT, HABITAT4J_PROPERTY_ARRAY_INSTANCE_ATTRIBUTE_VALUE_PREPEND, HABITAT4J_PROPERTY_ARRAY_INSTANCE_ATTRIBUTE_VALUE_REPLACE, HABITAT4J_PROPERTY_ARRAY_ITEM_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_ARRAY_INIT_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_ARRAY_INSTANCE_ATTRIBUTE_VALUE_APPEND, HABITAT4J_PROPERTY_BEAN_ARRAY_INSTANCE_ATTRIBUTE_VALUE_DEFAULT, HABITAT4J_PROPERTY_BEAN_ARRAY_INSTANCE_ATTRIBUTE_VALUE_PREPEND, HABITAT4J_PROPERTY_BEAN_ARRAY_INSTANCE_ATTRIBUTE_VALUE_REPLACE, HABITAT4J_PROPERTY_BEAN_ARRAY_ITEM_INIT_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_ARRAY_ITEM_SETTER_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_ARRAY_SETTER_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_DESCRIPTOR_CLASS_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_BEAN_DESCRIPTOR_COPY_METHOD_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_BEAN_DESCRIPTOR_COPY_METHOD_VALUE_DEFAULT, HABITAT4J_PROPERTY_BEAN_DESCRIPTOR_COPY_METHOD_VALUE_REFLECT, HABITAT4J_PROPERTY_BEAN_DESCRIPTOR_COPY_METHOD_VALUE_SERIALIZE, HABITAT4J_PROPERTY_BEAN_DESCRIPTOR_ID_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_BEAN_HASH_INIT_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_HASH_INSTANCE_ATTRIBUTE_VALUE_DEFAULT, HABITAT4J_PROPERTY_BEAN_HASH_INSTANCE_ATTRIBUTE_VALUE_REPLACE, HABITAT4J_PROPERTY_BEAN_HASH_INSTANCE_ATTRIBUTE_VALUE_REVISE, HABITAT4J_PROPERTY_BEAN_HASH_ITEM_INIT_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_HASH_ITEM_SETTER_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_HASH_SETTER_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_ID_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_BEAN_INIT_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_INSTANCE_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_BEAN_INSTANCE_ATTRIBUTE_VALUE_DEFAULT, HABITAT4J_PROPERTY_BEAN_INSTANCE_ATTRIBUTE_VALUE_REPLACE, HABITAT4J_PROPERTY_BEAN_INSTANCE_ATTRIBUTE_VALUE_REVISE, HABITAT4J_PROPERTY_BEAN_NAME_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_BEAN_SETTER_METHOD_PREFIX, HABITAT4J_PROPERTY_BEAN_VALUE_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_DECODING_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_DECRYPTING_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_HASH_INSTANCE_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_HASH_INSTANCE_ATTRIBUTE_VALUE_DEFAULT, HABITAT4J_PROPERTY_HASH_INSTANCE_ATTRIBUTE_VALUE_REPLACE, HABITAT4J_PROPERTY_HASH_INSTANCE_ATTRIBUTE_VALUE_REVISE, HABITAT4J_PROPERTY_HASH_ITEM_METHOD_PREFIX, HABITAT4J_PROPERTY_HASH_KEY_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_HASH_TYPE_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_KIND_HABITAT4J, HABITAT4J_PROPERTY_KIND_SECURITY, HABITAT4J_PROPERTY_KIND_SYSTEM, HABITAT4J_PROPERTY_LIST_NAME_DEFAULT, HABITAT4J_PROPERTY_LIST_TO_STRING_ITEMS_PER_LINE_DEFAULT, HABITAT4J_PROPERTY_LIST_XSD_RESOURCE_PATH_DEFAULT, HABITAT4J_PROPERTY_NAME_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_TYPE_DELIMITER, HABITAT4J_PROPERTY_VALUE_ATTRIBUTE_NAME, HABITAT4J_PROPERTY_VALUE_SUBSTITUTION_DELIMITER, HABITAT4J_PROPERTY_VALUE_SUBSTITUTION_PREFIX, HABITAT4J_PROPERTY_VALUE_SUBSTITUTION_SUFFIX, HABITAT4J_ROLE_ATTRIBUTE_NAME, HABITAT4J_SAX_DRIVER_DEFAULT, HABITAT4J_SAX_DRIVER_SYSTEM_PROPERTY_NAME, HABITAT4J_SAX_SCHEMA_FEATURE, HABITAT4J_SAX_VALIDATION_FEATURE, HABITAT4J_SAX_XSD_LOCATION, HABITAT4J_SERVER_IDENTITY_FILE_PATH_DEFAULT, HABITAT4J_SERVER_IDENTITY_FILE_PATH_SYSTEM_PROPERTY_NAME, HABITAT4J_SERVER_IDENTITY_XSD_RESOURCE_PATH_DEFAULT, HABITAT4J_TEMP_PROPERTY_LIST_PREFIX, HABITAT4J_UNIX_OS_NAME_LIST_PROPERTY_NAME, HABITAT4J_VERSION, HABITAT4J_WINDOWS_OS_NAME_LIST_PROPERTY_NAME, HABITAT4J_XML_ELEMENT_DELIMITER, SAX_DRIVER_SYSTEM_PROPERTY_NAME, SERVER_IDENTITY_INSTANCE_OS_OTHER, SERVER_IDENTITY_INSTANCE_OS_UNIX, SERVER_IDENTITY_INSTANCE_OS_WINDOWS, SERVER_IDENTITY_MODE_FILE, SERVER_IDENTITY_MODE_JVM, SERVER_IDENTITY_MODE_JVM_ENVIRONMENT, SERVER_IDENTITY_MODE_JVM_INSTANCE_DESCRIPTION, SERVER_IDENTITY_MODE_JVM_INSTANCE_ENUMERATION, SERVER_IDENTITY_MODE_JVM_INSTANCE_NAME, SERVER_IDENTITY_MODE_NULL, SYSTEM_PROPERTY_OS_NAME
 
Method Summary
static java.lang.String getApplicationName()
          This method returns the application name specified when initializing the ServerIdentity instance.
static java.lang.String getEnvironment()
          This method returns the environment specified in the ServerIdentity instance.
static java.lang.String getInstanceDescription()
          This method returns the instance description specified in the ServerIdentity instance.
static java.lang.String getInstanceEnumeration()
          This method returns the instance enumeration specified in the ServerIdentity instance.
static java.lang.String getInstanceName()
          This method returns the instance name specified in the ServerIdentity instance.
static java.lang.String getInstanceOS()
          This method returns the instance operating system specified in the ServerIdentity instance.
static java.lang.String getModifiedBy()
           
static java.lang.String getPragmaDefinition(java.lang.String name)
          This method returns the pragma definition in the ServerIdentity instance defined by a specific name.
static java.util.Hashtable getPragmaDefinitions()
          This method returns the pragma definition hashtable specified in the ServerIdentity instance.
static ServerIdentityRole getRole(java.lang.String name)
          This method returns the ServerIdentityRole in the ServerIdentity instance defined by a specific name.
static java.util.Hashtable getRoles()
          This method returns the roles hashtable specified in the ServerIdentity instance.
static ServerIdentity getServerIdentity()
          This method returns the ServerIdentity object managed by this ServerIdentityManager.
static ServerIdentityManager getServerIdentityManager()
          This method returns this singleton instance of the ServerIdentityManager.
static java.lang.String getVersion()
           
static ServerIdentityManager initialize(java.lang.String applicationName)
          This method returns this singleton instance of the ServerIdentityManager.
static ServerIdentityManager initialize(java.lang.String applicationName, java.lang.String mode)
          This method returns this singleton instance of the ServerIdentityManager.
static boolean isInitialized()
          This method returns whether the ServerIdentityManager has been initialized.
static ServerIdentity loadServerIdentity()
          This method returns the ServerIdentity object managed by this ServerIdentityManager object.
static ServerIdentity loadServerIdentity(ServerIdentityXMLMap map)
          This method returns the ServerIdentity object managed by this ServerIdentityManager object.
static void reset()
          This method resets this singleton instance of the ServerIdentityManager.
static void setFeature(java.lang.String name, boolean value)
          This method sets a Habitat4J feature.
static void setFeature(java.lang.String name, java.lang.String value)
          This method sets a Habitat4J feature.
static void setPragmaDefinition(java.lang.String name, java.lang.String value)
           
static java.lang.String toDisplayString()
          This method returns a human-readable presentation of the ServerIdentity object maintained by this singleton ServerIdentityManager object.
 
Methods inherited from class org.productivity.java.habitat4j.common.AbstractServerIdentityManager
_getApplicationName, _getEnvironment, _getInstanceDescription, _getInstanceEnumeration, _getInstanceName, _getInstanceOS, _getModifiedBy, _getPragmaDefinition, _getPragmaDefinitions, _getRole, _getRoles, _getServerIdentity, _getVersion, _initialize, _isInitialized, _loadServerIdentity, _loadServerIdentity, _loadServerIdentityViaFile, _loadServerIdentityViaFile, _loadServerIdentityViaJVM, _setFeature, _setFeature, _setPragmaDefinition, _toDisplayString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getApplicationName

public static java.lang.String getApplicationName()
This method returns the application name specified when initializing the ServerIdentity instance.

Returns:
Returns the application name specified when initializing the ServerIdentity instance.

getEnvironment

public static java.lang.String getEnvironment()
This method returns the environment specified in the ServerIdentity instance.

Returns:
Returns the environment specified in the ServerIdentity instance.

getInstanceDescription

public static java.lang.String getInstanceDescription()
This method returns the instance description specified in the ServerIdentity instance.

Returns:
Returns the instance description specified in the ServerIdentity instance.

getInstanceEnumeration

public static java.lang.String getInstanceEnumeration()
This method returns the instance enumeration specified in the ServerIdentity instance.

Returns:
Returns the instance enumeration specified in the ServerIdentity instance.

getInstanceName

public static java.lang.String getInstanceName()
This method returns the instance name specified in the ServerIdentity instance.

Returns:
Returns the instance name specified in the ServerIdentity instance.

getInstanceOS

public static java.lang.String getInstanceOS()
This method returns the instance operating system specified in the ServerIdentity instance.

Returns:
Returns the instance operating system specified in the ServerIdentity instance.

getModifiedBy

public static java.lang.String getModifiedBy()
Returns:
Returns the ServerIdentity XML file modifiedBy attribute.

getPragmaDefinition

public static java.lang.String getPragmaDefinition(java.lang.String name)
This method returns the pragma definition in the ServerIdentity instance defined by a specific name.

Parameters:
name - - the name of the pragma definition
Returns:
Returns the pragma definition in the ServerIdentity instance defined by a specific name.

getPragmaDefinitions

public static java.util.Hashtable getPragmaDefinitions()
This method returns the pragma definition hashtable specified in the ServerIdentity instance.

Returns:
Returns the pragma definition hashtable specified in the ServerIdentity instance.

getRole

public static ServerIdentityRole getRole(java.lang.String name)
This method returns the ServerIdentityRole in the ServerIdentity instance defined by a specific name.

Parameters:
name - - the name of the role
Returns:
Returns the ServerIdentityRole in the ServerIdentity instance defined by a specific name.

getRoles

public static java.util.Hashtable getRoles()
This method returns the roles hashtable specified in the ServerIdentity instance.

Returns:
Returns the roles hashtable specified in the ServerIdentity instance.

getServerIdentity

public static ServerIdentity getServerIdentity()
This method returns the ServerIdentity object managed by this ServerIdentityManager.

Returns:
Returns the ServerIdentity object managed by this ServerIdentityManager.

getServerIdentityManager

public static ServerIdentityManager getServerIdentityManager()
This method returns this singleton instance of the ServerIdentityManager.

Returns:
Returns this singleton instance of the ServerIdentityManager.

getVersion

public static java.lang.String getVersion()
Returns:
Returns the ServerIdentity XML file version attribute.

initialize

public static ServerIdentityManager initialize(java.lang.String applicationName,
                                               java.lang.String mode)
This method returns this singleton instance of the ServerIdentityManager.

Parameters:
applicationName -
mode -
Returns:
Returns this singleton instance of the ServerIdentityManager.

initialize

public static ServerIdentityManager initialize(java.lang.String applicationName)
This method returns this singleton instance of the ServerIdentityManager.

Parameters:
applicationName - - the name of the calling application
Returns:
Returns this singleton instance of the ServerIdentityManager.

isInitialized

public static boolean isInitialized()
This method returns whether the ServerIdentityManager has been initialized.

Returns:
Returns whether the ServerIdentityManager has been initialized.

loadServerIdentity

public static ServerIdentity loadServerIdentity()
                                         throws ServerIdentityHandlerException
This method returns the ServerIdentity object managed by this ServerIdentityManager object.

Returns:
Returns the ServerIdentity object managed by this ServerIdentityManager object.
Throws:
ServerIdentityHandlerException

loadServerIdentity

public static ServerIdentity loadServerIdentity(ServerIdentityXMLMap map)
                                         throws ServerIdentityHandlerException
This method returns the ServerIdentity object managed by this ServerIdentityManager object.

Parameters:
map - - ServerIdentityXMLMap definition to use
Returns:
Returns the ServerIdentity object managed by this ServerIdentityManager object.
Throws:
ServerIdentityHandlerException

reset

public static void reset()
This method resets this singleton instance of the ServerIdentityManager. It is implemented for purposes of JUnit testing, and probably does not serve a practical purpose.


setFeature

public static void setFeature(java.lang.String name,
                              boolean value)
                       throws ServerIdentityHandlerException
This method sets a Habitat4J feature.

Parameters:
name - - the Habitat4J feature to set
value - - the Habitat4J feature's value to set
Throws:
ServerIdentityHandlerException

setFeature

public static void setFeature(java.lang.String name,
                              java.lang.String value)
                       throws ServerIdentityHandlerException
This method sets a Habitat4J feature.

Parameters:
name - - the Habitat4J feature to set
value - - the Habitat4J feature's value to set
Throws:
ServerIdentityHandlerException

setPragmaDefinition

public static void setPragmaDefinition(java.lang.String name,
                                       java.lang.String value)
                                throws ServerIdentityHandlerException
Parameters:
name - - the pragma definition name to set
value - - the pragma definition value to set
Throws:
ServerIdentityHandlerException

toDisplayString

public static java.lang.String toDisplayString()
This method returns a human-readable presentation of the ServerIdentity object maintained by this singleton ServerIdentityManager object.

Returns:
Returns a human-readable presentation of the ServerIdentity object maintained by this singleton ServerIdentityManager object.