Class StringSubstitutionEngine
- java.lang.Object
-
- com.sun.enterprise.admin.servermgmt.stringsubs.impl.StringSubstitutionEngine
-
- All Implemented Interfaces:
StringSubstitutor
public class StringSubstitutionEngine extends Object implements StringSubstitutor
A class to encapsulate string-subs definition. Parse, validate and performs String substitution for the given string-subs.xml.
-
-
Constructor Summary
Constructors Constructor Description StringSubstitutionEngine(InputStream inputStream)
ConstructsStringSubstitutionEngine
based on the given string-subs configuration stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<com.sun.enterprise.admin.servermgmt.xml.stringsubs.Property>
getDefaultProperties(com.sun.enterprise.admin.servermgmt.xml.stringsubs.PropertyType type)
Gets the defaultProperty
for the givenPropertyType
, If the property type is null then all the default properties will be returned.com.sun.enterprise.admin.servermgmt.xml.stringsubs.StringsubsDefinition
getStringSubsDefinition()
Gets the string-subs definition object.void
setAttributePreprocessor(AttributePreprocessor attributePreprocessor)
Set's theAttributePreprocessor
to customize the substitution process.void
setEntryFactory(SubstitutableFactory factory)
Set's a factory which can process aFileEntry
or anArchive
entry to retrieve all theSubstitutable
entries.void
setFileBackupLocation(File backupLocation)
TODO: Missing Implementationvoid
substituteAll()
Performs string substitution.void
substituteComponents(List<String> components)
Performs string substitution for give components.void
substituteGroups(List<String> groups)
Performs string substitution for give groups.
-
-
-
Constructor Detail
-
StringSubstitutionEngine
public StringSubstitutionEngine(InputStream inputStream) throws StringSubstitutionException
ConstructsStringSubstitutionEngine
based on the given string-subs configuration stream. Engine parse and validate the configuration and build the internal representation to perform string substitution.- Parameters:
inputStream
- The string-subs configuration stream.- Throws:
StringSubstitutionException
- If any error occurs in engine initialization.
-
-
Method Detail
-
setAttributePreprocessor
public void setAttributePreprocessor(AttributePreprocessor attributePreprocessor)
Description copied from interface:StringSubstitutor
Set's theAttributePreprocessor
to customize the substitution process. Attribute preprocessor takes care to retrieve the value of substitutable key.- Specified by:
setAttributePreprocessor
in interfaceStringSubstitutor
- Parameters:
attributePreprocessor
- Custom implementation ofAttributePreprocessor
-
setEntryFactory
public void setEntryFactory(SubstitutableFactory factory)
Description copied from interface:StringSubstitutor
Set's a factory which can process aFileEntry
or anArchive
entry to retrieve all theSubstitutable
entries.- Specified by:
setEntryFactory
in interfaceStringSubstitutor
-
setFileBackupLocation
public void setFileBackupLocation(File backupLocation)
Description copied from interface:StringSubstitutor
TODO: Missing Implementation- Specified by:
setFileBackupLocation
in interfaceStringSubstitutor
-
getDefaultProperties
public List<com.sun.enterprise.admin.servermgmt.xml.stringsubs.Property> getDefaultProperties(com.sun.enterprise.admin.servermgmt.xml.stringsubs.PropertyType type)
Description copied from interface:StringSubstitutor
Gets the defaultProperty
for the givenPropertyType
, If the property type is null then all the default properties will be returned.- Specified by:
getDefaultProperties
in interfaceStringSubstitutor
- Parameters:
type
- The type for which default properties has to be retrieved.- Returns:
- List of default properties or empty list if no property found.
-
substituteAll
public void substituteAll() throws StringSubstitutionException
Description copied from interface:StringSubstitutor
Performs string substitution.- Specified by:
substituteAll
in interfaceStringSubstitutor
- Throws:
StringSubstitutionException
- If any error occurs in string substitution.
-
substituteComponents
public void substituteComponents(List<String> components) throws StringSubstitutionException
Description copied from interface:StringSubstitutor
Performs string substitution for give components.- Specified by:
substituteComponents
in interfaceStringSubstitutor
- Parameters:
components
- List ofComponent
identifiers for which the string substitution has to be performed.- Throws:
StringSubstitutionException
- If any error occurs during substitution.
-
substituteGroups
public void substituteGroups(List<String> groups) throws StringSubstitutionException
Description copied from interface:StringSubstitutor
Performs string substitution for give groups.- Specified by:
substituteGroups
in interfaceStringSubstitutor
- Parameters:
groups
- List ofGroup
identifiers for which the string substitution has to be performed.- Throws:
StringSubstitutionException
- If any error occurs during substitution.
-
getStringSubsDefinition
public com.sun.enterprise.admin.servermgmt.xml.stringsubs.StringsubsDefinition getStringSubsDefinition()
Description copied from interface:StringSubstitutor
Gets the string-subs definition object. AStringSubsDefiniton
object contains the details of component, groups and files used in substitution.NOTE: This object is updateable.
- Specified by:
getStringSubsDefinition
in interfaceStringSubstitutor
- Returns:
- Parsed string-subs configuration object.
-
-