Package org.apache.uima.pear.tools
Class PackageBrowser
java.lang.Object
org.apache.uima.pear.tools.PackageBrowser
The
PackageBrowser
class allows browsing both archived and unarchived PEAR packages,
finding package files and directories, loading installation descriptor files and returning
run-time environment settings required for installed components.- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPackageBrowser
(File pearPackageDir) Constructor that allows browsing a given unacrhived PEAR package before or after its installation.PackageBrowser
(JarFile pearPackage) Constructor that allows browsing a given PEAR package without unarchiving it. -
Method Summary
Modifier and TypeMethodDescriptionCreates a string that should be added to the CLASSPATH to run the given installed component, based on its installation descriptor specifications, as well as the contents of itslib
directory.buildComponentClassPath
(boolean relativePath, boolean addLibDir) Creates a string that should be added to the CLASSPATH to run the given installed component, based on its installation descriptor specifications, as well as the contents of itslib
directory.Creates a string that should be added to the PATH to run the given installed component, based on the PEAR package defaults and its installation descriptor specifications.buildComponentPath
(boolean relativePath) Creates a string that should be added to the PATH to run the given installed component, based on the PEAR package defaults and its installation descriptor specifications.LikebuildComponentClassPath()
, but without all jars from the lib dir.File[]
findDirectory
(String dirNamePattern) Looks for package directories matching a given directory name pattern in the PEAR package.File[]
Looks for package files matching a given file name pattern in the PEAR package.findStandardDirectory
(String stdDirName) Looks for a given standard package directory.findStandardFile
(String stdFileName) Looks for a given standard package file.File[]
File[]
Returns the UIMA datapath setting for the component.Returns the environment variable settings for the component.returns the pear component pearSpecifier file path.Loads theINSTALLATION_DESCRIPTOR_FILE
file, and creates theInstallationDescriptor
(InsD) object.boolean
-
Field Details
-
BINARY_DIR
-
CONFIGURATION_DIR
-
DATA_DIR
-
DESCRIPTORS_DIR
-
DOCUMENTATION_DIR
-
LIBRARY_DIR
-
METADATA_DIR
-
RESOURCES_DIR
-
SOURCES_DIR
-
INSTALLATION_DESCRIPTOR_FILE
-
PEAR_PROPERTIES_FILE
-
SUBMISSION_PROPERTIES_FILE
-
SETENV_TXT_FILE
-
-
Constructor Details
-
PackageBrowser
Constructor that allows browsing a given PEAR package without unarchiving it.- Parameters:
pearPackage
- The given archived PEAR package to browse.- Throws:
IOException
- if a problem with IO
-
PackageBrowser
Constructor that allows browsing a given unacrhived PEAR package before or after its installation.- Parameters:
pearPackageDir
- The root directory where the PEAR package was unarchived.- Throws:
IOException
- if a problem with IO
-
-
Method Details
-
buildComponentClassPath
Creates a string that should be added to the CLASSPATH to run the given installed component, based on its installation descriptor specifications, as well as the contents of itslib
directory. The output string includes absolute path expressions for all relevant objects containing in the component PEAR package. If the component package is archived, returnsnull
.- Returns:
- The string that needs to be added to the CLASSPATH to run the given installed component.
- Throws:
IOException
- If any I/O exception occurred.
-
buildComponentRuntimeClassPath
LikebuildComponentClassPath()
, but without all jars from the lib dir.- Returns:
- The runtime classpath for the component.
- Throws:
IOException
- if there was an IO problem
-
buildComponentClassPath
Creates a string that should be added to the CLASSPATH to run the given installed component, based on its installation descriptor specifications, as well as the contents of itslib
directory. The output string includes absolute or relative path expressions for all relevant objects containing in the component PEAR package, depending on the value of a givenboolean
argument. If the component package is archived, returnsnull
.- Parameters:
relativePath
- Iftrue
, the output string will include relative path expressions for all relevant objects containing in the component PEAR package, otherwise it will contain absolute path expressions for these objects.addLibDir
- Whether to add jars from the lib dir to the classpath (true at packaging time, false at runtime).- Returns:
- The string that should be added to the CLASSPATH to run the given installed component.
- Throws:
IOException
- If any I/O exception occurred.
-
buildComponentPath
Creates a string that should be added to the PATH to run the given installed component, based on the PEAR package defaults and its installation descriptor specifications. The output string includes absolute path expressions for all relevant objects containing in the component PEAR package. If the component package is archived, returnsnull
.- Returns:
- The string that needs to be added to the PATH to run the given installed component.
- Throws:
IOException
- If any I/O exception occurred.
-
buildComponentPath
Creates a string that should be added to the PATH to run the given installed component, based on the PEAR package defaults and its installation descriptor specifications. The output string includes absolute or relative path expressions for all relevant objects containing in the component PEAR package, depending on the value of a givenboolean
argument. If the component package is archived, returnsnull
.- Parameters:
relativePath
- Iftrue
, the output string will include relative path expressions for all relevant objects containing in the component PEAR package, otherwise it will contain absolute path expressions for these objects.- Returns:
- The string that needs to be added to the PATH to run the given installed component.
- Throws:
IOException
- If any I/O exception occurred.
-
findDirectory
Looks for package directories matching a given directory name pattern in the PEAR package. If the given directory name pattern starts with '/' or '\', the method looks for directory names that start with the given name pattern, otherwise it looks for directory names that contain the given name pattern as a substring. The method does not support wild cards.- Parameters:
dirNamePattern
- The given directory name pattern to look for.- Returns:
- The array of matching package directories.
-
findFile
Looks for package files matching a given file name pattern in the PEAR package. If the given file name pattern starts with '/' or '\', the method looks for file names that start from the given name pattern, otherwise it looks for file names that contain the given name pattern as a substring. The method does not support wild cards.- Parameters:
fileNamePattern
- The given file name pattern to look for.- Returns:
- The array of matching package files.
-
findStandardDirectory
Looks for a given standard package directory. This method assumes that the given standard directory name is the full name of the directory in the package root directory.- Parameters:
stdDirName
- The given full standard package directory name.- Returns:
- The specified standard package directory, if this directory exists in the package,
null
otherwise.
-
findStandardFile
Looks for a given standard package file. This method assumes that the given standard file name is the full name of the file in the package root directory.- Parameters:
stdFileName
- The given full standard package file name.- Returns:
- The specified standard package file, if this file exists in the package,
null
otherwise.
-
getAllDirectories
- Returns:
- Array of
File
objects representing all directories existing in the package.
-
getAllFiles
- Returns:
- Array of
File
objects representing all files existing in the package.
-
getInstallationDescriptor
Loads theINSTALLATION_DESCRIPTOR_FILE
file, and creates theInstallationDescriptor
(InsD) object.Note: if the component package has been installed, the InsD object contains real specifications of package directories, otherwise it may contain macros like
$main_root
.- Returns:
- The InsD object corresponding the installation descriptor file.
- Throws:
IOException
- If any I/O exception occurred.
-
getRootDirectory
- Returns:
- The package root directory, where the package was unarchived, or the directory corresponding to the package file path without its extension, if the archived package was specified.
-
isArchived
public boolean isArchived()- Returns:
true
, if the archived package was specified,false
otherwise.
-
getComponentPearDescPath
returns the pear component pearSpecifier file path.- Returns:
- returns the pear component pearSpecifier file path or null if an archived package was used.
- Throws:
IOException
- if there was an IO problem
-
getComponentDataPath
Returns the UIMA datapath setting for the component. The datapath of the component must be specified as environment variable with the keyuima.datapath
.- Returns:
- the datapath setting for the component or null if the datapath is not specified.
- Throws:
IOException
- If any I/O exception occurred while reading the component meta data.
-
getComponentEnvVars
Returns the environment variable settings for the component. The variable settings does not contain theclasspath
anduima.datapath
settings for the component.- Returns:
- returns the environment variable settings for the component
- Throws:
IOException
- If any I/O exception occurred while reading the component meta data.
-