public class PackageBrowser
extends java.lang.Object
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.InstallationDescriptor
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BINARY_DIR |
static java.lang.String |
CONFIGURATION_DIR |
static java.lang.String |
DATA_DIR |
static java.lang.String |
DESCRIPTORS_DIR |
static java.lang.String |
DOCUMENTATION_DIR |
static java.lang.String |
INSTALLATION_DESCRIPTOR_FILE |
static java.lang.String |
LIBRARY_DIR |
static java.lang.String |
METADATA_DIR |
static java.lang.String |
PEAR_PROPERTIES_FILE |
static java.lang.String |
RESOURCES_DIR |
static java.lang.String |
SETENV_TXT_FILE |
static java.lang.String |
SOURCES_DIR |
static java.lang.String |
SUBMISSION_PROPERTIES_FILE |
Constructor and Description |
---|
PackageBrowser(java.io.File pearPackageDir)
Constructor that allows browsing a given unacrhived PEAR package before or after its
installation.
|
PackageBrowser(java.util.jar.JarFile pearPackage)
Constructor that allows browsing a given PEAR package without unarchiving it.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
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 its
lib directory. |
java.lang.String |
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 its
lib directory. |
java.lang.String |
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.
|
java.lang.String |
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.
|
java.lang.String |
buildComponentRuntimeClassPath()
Like
buildComponentClassPath() , but without all jars from the lib dir. |
java.io.File[] |
findDirectory(java.lang.String dirNamePattern)
Looks for package directories matching a given directory name pattern in the PEAR package.
|
java.io.File[] |
findFile(java.lang.String fileNamePattern)
Looks for package files matching a given file name pattern in the PEAR package.
|
java.io.File |
findStandardDirectory(java.lang.String stdDirName)
Looks for a given standard package directory.
|
java.io.File |
findStandardFile(java.lang.String stdFileName)
Looks for a given standard package file.
|
java.io.File[] |
getAllDirectories() |
java.io.File[] |
getAllFiles() |
java.lang.String |
getComponentDataPath()
Returns the UIMA datapath setting for the component.
|
java.util.Properties |
getComponentEnvVars()
Returns the environment variable settings for the component.
|
java.lang.String |
getComponentPearDescPath()
returns the pear component pearSpecifier file path.
|
InstallationDescriptor |
getInstallationDescriptor()
Loads the
INSTALLATION_DESCRIPTOR_FILE file, and creates the
InstallationDescriptor (InsD) object. |
java.io.File |
getRootDirectory() |
boolean |
isArchived() |
public static final java.lang.String BINARY_DIR
public static final java.lang.String CONFIGURATION_DIR
public static final java.lang.String DATA_DIR
public static final java.lang.String DESCRIPTORS_DIR
public static final java.lang.String DOCUMENTATION_DIR
public static final java.lang.String LIBRARY_DIR
public static final java.lang.String METADATA_DIR
public static final java.lang.String RESOURCES_DIR
public static final java.lang.String SOURCES_DIR
public static final java.lang.String INSTALLATION_DESCRIPTOR_FILE
public static final java.lang.String PEAR_PROPERTIES_FILE
public static final java.lang.String SUBMISSION_PROPERTIES_FILE
public static final java.lang.String SETENV_TXT_FILE
public PackageBrowser(java.util.jar.JarFile pearPackage) throws java.io.IOException
pearPackage
- The given archived PEAR package to browse.java.io.IOException
- if a problem with IOpublic PackageBrowser(java.io.File pearPackageDir) throws java.io.IOException
pearPackageDir
- The root directory where the PEAR package was unarchived.java.io.IOException
- if a problem with IOpublic java.lang.String buildComponentClassPath() throws java.io.IOException
lib
directory. The output string includes absolute path expressions for all
relevant objects containing in the component PEAR package. If the component package is
archived, returns null
.java.io.IOException
- If any I/O exception occurred.public java.lang.String buildComponentRuntimeClassPath() throws java.io.IOException
buildComponentClassPath()
, but without all jars from the lib dir.java.io.IOException
- if there was an IO problempublic java.lang.String buildComponentClassPath(boolean relativePath, boolean addLibDir) throws java.io.IOException
lib
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
given boolean
argument. If the component package is archived, returns
null
.relativePath
- If true
, 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).java.io.IOException
- If any I/O exception occurred.public java.lang.String buildComponentPath() throws java.io.IOException
null
.java.io.IOException
- If any I/O exception occurred.public java.lang.String buildComponentPath(boolean relativePath) throws java.io.IOException
boolean
argument. If
the component package is archived, returns null
.relativePath
- If true
, 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.java.io.IOException
- If any I/O exception occurred.public java.io.File[] findDirectory(java.lang.String dirNamePattern)
dirNamePattern
- The given directory name pattern to look for.public java.io.File[] findFile(java.lang.String fileNamePattern)
fileNamePattern
- The given file name pattern to look for.public java.io.File findStandardDirectory(java.lang.String stdDirName)
stdDirName
- The given full standard package directory name.null
otherwise.public java.io.File findStandardFile(java.lang.String stdFileName)
stdFileName
- The given full standard package file name.null
otherwise.public java.io.File[] getAllDirectories()
File
objects representing all directories existing in the
package.public java.io.File[] getAllFiles()
File
objects representing all files existing in the package.public InstallationDescriptor getInstallationDescriptor() throws java.io.IOException
INSTALLATION_DESCRIPTOR_FILE
file, and creates the
InstallationDescriptor
(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
.java.io.IOException
- If any I/O exception occurred.public java.io.File getRootDirectory()
public boolean isArchived()
true
, if the archived package was specified, false
otherwise.public java.lang.String getComponentPearDescPath() throws java.io.IOException
java.io.IOException
- if there was an IO problempublic java.lang.String getComponentDataPath() throws java.io.IOException
uima.datapath
.java.io.IOException
- If any I/O exception occurred while reading the component meta data.public java.util.Properties getComponentEnvVars() throws java.io.IOException
classpath
and uima.datapath
settings for the
component.java.io.IOException
- If any I/O exception occurred while reading the component meta data.Copyright © 2006–2014 The Apache Software Foundation. All rights reserved.