|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.core.config.type.TokenReplacer
This class provides tokenization and value linking for configuration values in order to minimize the duplication of data. It supports two types of value replacement, document property and deployment property.
The Document Property has a form of {document-name$attribute-name}. This
would search for a document named document-name
and then look
for an attribute named attribute-name
.
The Deployment Property lookup has a form of {deployment-property}.
This would
retrieve the Deployment Property deployment-property
from
the BootStrapper.
This mechanism should not be used for normal
configurations and is specially provided for instances where deployment
values can not or do not want to be known ahead of time (such as the base
file-system directory of config or a database password).
Copyright 2002 Sapient
Field Summary | |
private static String |
ALL_DELIMETERS
Delimiters to tokenize on. |
private static String |
ATTRIBUTE_DELIMETER
The delimeter used for seperating a config document name from the value that is required from it. |
private static String |
BEGIN_DELIMETER
The delimiter that begins a replaceable config value |
private String |
data
The data to be tokenized, mapped and replaced necessary. |
private static String |
END_DELIMETER
The end delimter that declares the end of a replaceable config value |
private static String |
ESCAPE_DELIMETER
The character set used to escape other delimeters so that they can be used as real values. |
private org.apache.commons.logging.Log |
log
Provides a handle to Apache-commons logger |
private String |
replacedValue
The replaced value of the data. |
Constructor Summary | |
TokenReplacer(String data)
Creates a new token replacer for the specified configuration value. |
Method Summary | |
boolean |
containsTokens()
Tests if the data contains tokens. |
private String |
lookupConfigurationValue(String configName,
String attributeName)
Looks up a Configuration value from the Config using token replacement. |
String |
replaceTokens()
Replaces tokens within configuration attributes with values from other configurations. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.apache.commons.logging.Log log
private static final String BEGIN_DELIMETER
private static final String END_DELIMETER
private static final String ATTRIBUTE_DELIMETER
private static final String ESCAPE_DELIMETER
private static final String ALL_DELIMETERS
private String data
private String replacedValue
Constructor Detail |
public TokenReplacer(String data)
data
- the data to run the replacer onMethod Detail |
public boolean containsTokens()
public String replaceTokens() throws ConfigurationTypeException
ConfigurationTypeException
- thrown when unable to retrieve a
referenced value or in case there is a failure parse the reference.private String lookupConfigurationValue(String configName, String attributeName) throws TokenReplacementException
configName
- name of the configuration to lookupattributeName
- name of the attribute to retreive from config
TokenReplacementException
- indicates an error retreiving
the value from the configuration
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |