Package org.apache.uima.pear.tools
Class InstallationProcessor
- java.lang.Object
-
- org.apache.uima.pear.tools.InstallationProcessor
-
public class InstallationProcessor extends java.lang.ObjectTheInstallationProcessorclass implements operations specified in the installation descriptor. This class also allows generating the default Vinci Service descriptor for the specified component.- See Also:
InstallationDescriptor
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringBuffer__regexBufferprivate boolean_completedprivate InstallationController_controllerprivate InstallationDescriptor_insdObjectprivate java.util.Hashtable<java.lang.String,java.lang.String>_installationTableprivate java.lang.String_mainRootPathprivate java.util.Hashtable<java.lang.String,java.lang.String>_pathSubstitutionTableprivate java.util.Hashtable<java.lang.String,java.lang.String>_urlSubstitutionTableprotected static java.lang.StringDELEGATE_ROOT_PREFIX_REGEXprotected static java.lang.StringDELEGATE_ROOT_REL_SUFFIX_REGEXprotected static java.lang.StringDELEGATE_ROOT_SUFFIX_REGEXprotected static java.lang.StringDELEGATE_ROOT_URL_SUFFIX_REGEXstatic java.lang.StringINSD_FILE_PATHprotected static java.lang.StringMAIN_ROOT_REGEXprotected static java.lang.StringMAIN_ROOT_REL_REGEXprotected static java.lang.StringMAIN_ROOT_URL_REGEXstatic java.lang.StringVS_DESCRIPTOR_PATH
-
Constructor Summary
Constructors Constructor Description InstallationProcessor(java.lang.String mainRootPath, java.util.Hashtable<java.lang.String,java.lang.String> installationTable)Constructs an instance of theInstallationProcessorclass, using given main component root path and a table of installed delegate components.InstallationProcessor(java.lang.String mainRootPath, java.util.Hashtable<java.lang.String,java.lang.String> installationTable, InstallationController controller)Similar to previous constructor, but sets a givenInstallationControllerobject as the requestor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.lang.StringcomponentIdRootRegExp(java.lang.String componentId, java.lang.String suffix)Builds $component_id$<suffix> regular expression string for a given component ID and a given 'suffix' string.protected static voidfindAndReplacePath(InstallationDescriptor.ActionInfo action)Performs a specified 'find_and_replace_path' installation action.static voidgenerateVSDescriptor(InstallationDescriptor insdObject, java.io.File mainRootDir)Generates default Vinci Service descriptor for a specified component, and puts it to a specified location.static java.io.InputStreamgenerateVSDescriptorAsStream(InstallationDescriptor insdObject)Generates default Vinci Service descriptor for a specified component, and returns the content of the descriptor as a stream (for Eclipse plug-in).protected static java.lang.StringgenerateVSDescriptorContent(InstallationDescriptor insdObject)Generates the default Vinci Service descriptor content for a specified component.InstallationDescriptorgetInstallationDescriptor()protected voidinitSubstitutionTables(java.lang.String mainRootPath)Initializes twoHashtableobjects that are used to substitute $dlg_comp_id$root macros in URL and absolute path expressions.voidprocess()Starts processing installation instructions from the specified installation descriptor.protected static java.lang.StringsubstituteCompIdRootInString(java.lang.String source, java.lang.String compId, java.lang.String compRootPath)Substitutes '$dlg_comp_id$root_url' and '$dlg_comp_id$root' macros in a given string for a given delegate component.protected static java.lang.StringsubstituteMainRootInString(java.lang.String source, java.lang.String mainRootPath)Substitutes '$main_root_url' and '$main_root' macros in a given string.protected voidsubstituteStringVariablesInAction(java.util.Properties params)Substitutes two $main_root as well as two $comp_id$root macros in a given 'action'Propertiesobject values.protected voidsubstituteStringVariablesInFiles(java.io.File dir)Substitutes two $main_root as well as three $comp_id$root macros in all files in a given directory, including its sub-directories.
-
-
-
Field Detail
-
INSD_FILE_PATH
public static final java.lang.String INSD_FILE_PATH
- See Also:
- Constant Field Values
-
VS_DESCRIPTOR_PATH
public static final java.lang.String VS_DESCRIPTOR_PATH
- See Also:
- Constant Field Values
-
MAIN_ROOT_REGEX
protected static final java.lang.String MAIN_ROOT_REGEX
- See Also:
- Constant Field Values
-
MAIN_ROOT_REL_REGEX
protected static final java.lang.String MAIN_ROOT_REL_REGEX
- See Also:
- Constant Field Values
-
MAIN_ROOT_URL_REGEX
protected static final java.lang.String MAIN_ROOT_URL_REGEX
- See Also:
- Constant Field Values
-
DELEGATE_ROOT_PREFIX_REGEX
protected static final java.lang.String DELEGATE_ROOT_PREFIX_REGEX
- See Also:
- Constant Field Values
-
DELEGATE_ROOT_SUFFIX_REGEX
protected static final java.lang.String DELEGATE_ROOT_SUFFIX_REGEX
- See Also:
- Constant Field Values
-
DELEGATE_ROOT_REL_SUFFIX_REGEX
protected static final java.lang.String DELEGATE_ROOT_REL_SUFFIX_REGEX
- See Also:
- Constant Field Values
-
DELEGATE_ROOT_URL_SUFFIX_REGEX
protected static final java.lang.String DELEGATE_ROOT_URL_SUFFIX_REGEX
- See Also:
- Constant Field Values
-
__regexBuffer
private static java.lang.StringBuffer __regexBuffer
-
_mainRootPath
private java.lang.String _mainRootPath
-
_installationTable
private java.util.Hashtable<java.lang.String,java.lang.String> _installationTable
-
_urlSubstitutionTable
private java.util.Hashtable<java.lang.String,java.lang.String> _urlSubstitutionTable
-
_pathSubstitutionTable
private java.util.Hashtable<java.lang.String,java.lang.String> _pathSubstitutionTable
-
_insdObject
private InstallationDescriptor _insdObject
-
_completed
private boolean _completed
-
_controller
private InstallationController _controller
-
-
Constructor Detail
-
InstallationProcessor
public InstallationProcessor(java.lang.String mainRootPath, java.util.Hashtable<java.lang.String,java.lang.String> installationTable)Constructs an instance of theInstallationProcessorclass, using given main component root path and a table of installed delegate components.- Parameters:
mainRootPath- The given main component root path.installationTable- The given table of installed delegate components.
-
InstallationProcessor
public InstallationProcessor(java.lang.String mainRootPath, java.util.Hashtable<java.lang.String,java.lang.String> installationTable, InstallationController controller)Similar to previous constructor, but sets a givenInstallationControllerobject as the requestor.- Parameters:
mainRootPath- The given main component root path.installationTable- The given table of installed delegate components.controller- The givenInstallationControllerrequestor.
-
-
Method Detail
-
componentIdRootRegExp
protected static java.lang.String componentIdRootRegExp(java.lang.String componentId, java.lang.String suffix)Builds $component_id$<suffix> regular expression string for a given component ID and a given 'suffix' string. Valid 'suffix' strings are InstallationDescriptor.DELEGATE_ROOT_SUFFIX_REGEX for absolute path, InstallationDescriptor.DELEGATE_ROOT_REL_SUFFIX_REGEX for relative path, InstallationDescriptor.DELEGATE_ROOT_URL_SUFFIX_REGEX for URL.- Parameters:
componentId- The given component ID.suffix- a suffix to be added to the component ID Valid 'suffix' strings are InstallationDescriptor.DELEGATE_ROOT_SUFFIX_REGEX for absolute path, InstallationDescriptor.DELEGATE_ROOT_REL_SUFFIX_REGEX for relative path, InstallationDescriptor.DELEGATE_ROOT_URL_SUFFIX_REGEX for URL.- Returns:
- The $component_id$root regular expression string.
-
generateVSDescriptor
public static void generateVSDescriptor(InstallationDescriptor insdObject, java.io.File mainRootDir) throws java.io.IOException
Generates default Vinci Service descriptor for a specified component, and puts it to a specified location.- Parameters:
insdObject- The given installation descriptor of the component.mainRootDir- The given root directory of the component.- Throws:
java.io.IOException- if any I/O exception occurred.
-
generateVSDescriptorAsStream
public static java.io.InputStream generateVSDescriptorAsStream(InstallationDescriptor insdObject) throws java.io.IOException
Generates default Vinci Service descriptor for a specified component, and returns the content of the descriptor as a stream (for Eclipse plug-in).- Parameters:
insdObject- The given installation descriptor of the component.- Returns:
- The stream that contains the default Vinci Service descriptor for the specified component.
- Throws:
java.io.IOException- if any I/O exception occurred.
-
generateVSDescriptorContent
protected static java.lang.String generateVSDescriptorContent(InstallationDescriptor insdObject)
Generates the default Vinci Service descriptor content for a specified component.- Parameters:
insdObject- The given installation descriptor of the component.- Returns:
- The content of the default Vinci Service descriptor for the specified component.
-
findAndReplacePath
protected static void findAndReplacePath(InstallationDescriptor.ActionInfo action) throws java.io.IOException
Performs a specified 'find_and_replace_path' installation action.- Parameters:
action- The given 'find_and_replace_path' installation action.- Throws:
java.io.IOException- if any I/O exception occurred.
-
substituteCompIdRootInString
protected static java.lang.String substituteCompIdRootInString(java.lang.String source, java.lang.String compId, java.lang.String compRootPath)Substitutes '$dlg_comp_id$root_url' and '$dlg_comp_id$root' macros in a given string for a given delegate component.- Parameters:
source- The given source string.compId- The given component ID.compRootPath- The given component root directory path.- Returns:
- The result string with all the 'delegate' macros substituted and all '\' characters replaced with '/' characters.
-
substituteMainRootInString
protected static java.lang.String substituteMainRootInString(java.lang.String source, java.lang.String mainRootPath)Substitutes '$main_root_url' and '$main_root' macros in a given string.- Parameters:
source- The given source string.mainRootPath- The given main component root directory path.- Returns:
- The result string with all the 'main' macros substituted and all '\' characters replaced with '/' characters.
-
getInstallationDescriptor
public InstallationDescriptor getInstallationDescriptor()
- Returns:
- The modified
InstallationDescriptorobject, if the processing completed,nullotherwise.
-
initSubstitutionTables
protected void initSubstitutionTables(java.lang.String mainRootPath)
Initializes twoHashtableobjects that are used to substitute $dlg_comp_id$root macros in URL and absolute path expressions.- Parameters:
mainRootPath- The given main component root directory path.
-
process
public void process() throws java.io.IOExceptionStarts processing installation instructions from the specified installation descriptor.- Throws:
java.io.IOException- if any I/O exception occurred.
-
substituteStringVariablesInAction
protected void substituteStringVariablesInAction(java.util.Properties params)
Substitutes two $main_root as well as two $comp_id$root macros in a given 'action'Propertiesobject values.- Parameters:
params- The givenPropertiesobject.
-
substituteStringVariablesInFiles
protected void substituteStringVariablesInFiles(java.io.File dir) throws java.io.IOExceptionSubstitutes two $main_root as well as three $comp_id$root macros in all files in a given directory, including its sub-directories.- Parameters:
dir- The given directory.- Throws:
java.io.IOException- if any I/O exception occurred.
-
-