org.sape.carbon.core.bootstrap
Class DeploymentProperties

java.lang.Object
  |
  +--org.sape.carbon.core.bootstrap.DeploymentProperties

final class DeploymentProperties
extends Object

Class that encapsulates Deployment Properties within the bootstrapper. This is the only class in all of Carbon that logs using System.out and uses a direct extension of RuntimeException for exception handling. Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.11 $($Author: dvoet $ / $Date: 2003/05/05 21:21:11 $)
Author:
Douglas Voet, Jul 23, 2002

Field Summary
private static String DEPLOYMENT_CONFIG_FILE_NAME
          The default name of the carbon core deployement property file
private  Properties deploymentProperties
          The internal store of properties
private  org.apache.commons.logging.Log log
          The handle to Apache-commons logger
 
Constructor Summary
(package private) DeploymentProperties()
           
 
Method Summary
private  Properties fetchDeploymentProperties()
          Fetches the Properties object used for deploymentProperties
 String get(String key)
          This method provides access to properties that are specific to this deployment of Carbon.
 Object set(String key, String value)
          This method sets Deployment properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private org.apache.commons.logging.Log log
The handle to Apache-commons logger


DEPLOYMENT_CONFIG_FILE_NAME

private static final String DEPLOYMENT_CONFIG_FILE_NAME
The default name of the carbon core deployement property file

See Also:
Constant Field Values

deploymentProperties

private final Properties deploymentProperties
The internal store of properties

Constructor Detail

DeploymentProperties

DeploymentProperties()
Method Detail

get

public String get(String key)
This method provides access to properties that are specific to this deployment of Carbon. The system properties are searched for the requested property first. If it is not found, the value is returned from a properties file name by BootStrapper.DEPLOYMENT_CONFIG_FILE_NAME and located using the ClassLoader.getResource method. Deployment Properties should be properties that either change based on deployment or are required before the ConfigurationService is loaded. Cases of properties varying based on deployment should be minimal. In this case, the DeploymentService should be used.

This method has the same semantics as java.util.Properties.getProperty(String)

Parameters:
key - the name of the property
Returns:
String the value of the property or null if it does not exist
See Also:
ClassLoader.getResource(String), Properties.getProperty(String), DeploymentService

set

public Object set(String key,
                  String value)
This method sets Deployment properties. If the property exists within the System properties, it is replaced, otherwise, it is written to the deployment properties maintained by this class. It does not write the new value to the properties file. This method affects the smallest scope possible. It will not write to the system wide properties unless the property already exists because that could affect other applications running in the same JVM.

This method has the same semantics as java.util.Properties.setProperty(String, String)

Parameters:
key - key to set a deployment property
value - value to set for the property
Returns:
Object the old value of the property
See Also:
Properties.setProperty(String, String)

fetchDeploymentProperties

private Properties fetchDeploymentProperties()
Fetches the Properties object used for deploymentProperties

Returns:
Properties for deploymentProperties


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.