Package org.apache.uima.pear.tools
Class InstallationProcessor
java.lang.Object
org.apache.uima.pear.tools.InstallationProcessor
The
InstallationProcessor
class implements operations specified in the installation
descriptor. This class also allows generating the default Vinci Service descriptor for the
specified component.- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionInstallationProcessor
(String mainRootPath, Hashtable<String, String> installationTable) Constructs an instance of theInstallationProcessor
class, using given main component root path and a table of installed delegate components.InstallationProcessor
(String mainRootPath, Hashtable<String, String> installationTable, InstallationController controller) Similar to previous constructor, but sets a givenInstallationController
object as the requestor. -
Method Summary
Modifier and TypeMethodDescriptionprotected static String
componentIdRootRegExp
(String componentId, String suffix) Builds $component_id$<suffix> regular expression string for a given component ID and a given 'suffix' string.protected static void
Performs a specified 'find_and_replace_path' installation action.static void
generateVSDescriptor
(InstallationDescriptor insdObject, File mainRootDir) Generates default Vinci Service descriptor for a specified component, and puts it to a specified location.static InputStream
generateVSDescriptorAsStream
(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 String
generateVSDescriptorContent
(InstallationDescriptor insdObject) Generates the default Vinci Service descriptor content for a specified component.protected void
initSubstitutionTables
(String mainRootPath) Initializes twoHashtable
objects that are used to substitute $dlg_comp_id$root macros in URL and absolute path expressions.void
process()
Starts processing installation instructions from the specified installation descriptor.protected static String
substituteCompIdRootInString
(String source, String compId, 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 String
substituteMainRootInString
(String source, String mainRootPath) Substitutes '$main_root_url' and '$main_root' macros in a given string.protected void
Substitutes two $main_root as well as two $comp_id$root macros in a given 'action'Properties
object values.protected void
Substitutes two $main_root as well as three $comp_id$root macros in all files in a given directory, including its sub-directories.
-
Field Details
-
INSD_FILE_PATH
- See Also:
-
VS_DESCRIPTOR_PATH
- See Also:
-
MAIN_ROOT_REGEX
- See Also:
-
MAIN_ROOT_REL_REGEX
- See Also:
-
MAIN_ROOT_URL_REGEX
- See Also:
-
DELEGATE_ROOT_PREFIX_REGEX
- See Also:
-
DELEGATE_ROOT_SUFFIX_REGEX
- See Also:
-
DELEGATE_ROOT_REL_SUFFIX_REGEX
- See Also:
-
DELEGATE_ROOT_URL_SUFFIX_REGEX
- See Also:
-
-
Constructor Details
-
InstallationProcessor
Constructs an instance of theInstallationProcessor
class, 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(String mainRootPath, Hashtable<String, String> installationTable, InstallationController controller) Similar to previous constructor, but sets a givenInstallationController
object as the requestor.- Parameters:
mainRootPath
- The given main component root path.installationTable
- The given table of installed delegate components.controller
- The givenInstallationController
requestor.
-
-
Method Details
-
componentIdRootRegExp
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, File mainRootDir) throws 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:
IOException
- if any I/O exception occurred.
-
generateVSDescriptorAsStream
public static InputStream generateVSDescriptorAsStream(InstallationDescriptor insdObject) throws 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:
IOException
- if any I/O exception occurred.
-
generateVSDescriptorContent
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 IOException Performs a specified 'find_and_replace_path' installation action.- Parameters:
action
- The given 'find_and_replace_path' installation action.- Throws:
IOException
- if any I/O exception occurred.
-
substituteCompIdRootInString
protected static String substituteCompIdRootInString(String source, String compId, 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
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
- Returns:
- The modified
InstallationDescriptor
object, if the processing completed,null
otherwise.
-
initSubstitutionTables
Initializes twoHashtable
objects 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
Starts processing installation instructions from the specified installation descriptor.- Throws:
IOException
- if any I/O exception occurred.
-
substituteStringVariablesInAction
Substitutes two $main_root as well as two $comp_id$root macros in a given 'action'Properties
object values.- Parameters:
params
- The givenProperties
object.
-
substituteStringVariablesInFiles
Substitutes 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:
IOException
- if any I/O exception occurred.
-