|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pentaho.packageManagement.PackageManager
org.pentaho.packageManagement.DefaultPackageManager
public class DefaultPackageManager
A concrete implementation of PackageManager that uses Java properties files/class to manage package meta data. Assumes that meta data for individual packages is stored on the central repository (accessible via http) in properties files that live in a subdirectory with the same name as the package. Furthermore, each property file is assumed to be named as the version number of the package in question with a ".props" extension. A "Latest.props" file should exist for each package and should always hold meta data on the latest version of a package.
| Field Summary |
|---|
| Fields inherited from class org.pentaho.packageManagement.PackageManager |
|---|
m_authenticatorSet, m_baseSystemName, m_baseSystemVersion, m_httpProxy, m_packageHome, m_packageRepository, m_proxyPassword, m_proxyUsername |
| Constructor Summary | |
|---|---|
DefaultPackageManager()
|
|
| Method Summary | |
|---|---|
protected static boolean |
checkDependencies(PackageConstraint toCheck,
Map<String,Dependency> lookup,
Map<String,List<Dependency>> conflicts)
Checks a given package's list of dependencies for any conflicts with the packages in the supplied Map. |
static void |
deleteDir(File dir,
PrintStream... progress)
|
protected File |
downloadArchive(URL packageURL,
String fileExtension,
PrintStream... progress)
|
protected boolean |
establishPackageHome()
Checks to see if the package home exists and creates it if necessary. |
List<Dependency> |
getAllDependenciesForPackage(Package target,
Map<String,List<Dependency>> conflicts)
Gets a full list of packages (encapsulated in Dependency objects) that are required by directly and indirectly by the named target package. |
List<Package> |
getAllPackages(PrintStream... progress)
Get all packages that the system knows about (i.e. |
List<Package> |
getAvailablePackages()
Get a list of packages that are not currently installed. |
Package |
getInstalledPackageInfo(String packageName)
Get package information on the named installed package. |
List<Package> |
getInstalledPackages()
Get a list of installed packages. |
Package |
getPackageArchiveInfo(String packageArchivePath)
Get package information from the supplied package archive file. |
Package |
getRepositoryPackageInfo(String packageName)
Get package information on the named package from the repository. |
Package |
getRepositoryPackageInfo(String packageName,
Object version)
Get package information on the named package from the repository. |
byte[] |
getRepositoryPackageMetaDataOnlyAsZip(PrintStream... progress)
Gets an array of bytes containing a zip of all the repository meta data and supporting files. |
byte[] |
getRepositoryPackageMetaDataOnlyAsZipLegacy(PrintStream... progress)
Gets an array of bytes containing a zip of all the repository meta data and supporting files using the legacy approach. |
List<Object> |
getRepositoryPackageVersions(String packageName)
Get a list of available versions of the named package. |
Package |
getURLPackageInfo(URL packageURL)
Get package information on the package at the given URL. |
protected void |
installAdditionalLibs(String packageName,
String[] additionalLibURLs,
PrintStream... progress)
Installs additional library jar files (as specified in the AdditionalLibs entry in the Description.props file). |
protected void |
installPackage(String packageArchivePath,
String packageName,
PrintStream... progress)
Installs a package from a zip/jar archive. |
String |
installPackageFromArchive(String packageArchivePath,
PrintStream... progress)
Install a package from an archive on the local file system. |
void |
installPackageFromRepository(String packageName,
Object version,
PrintStream... progress)
Install a package sourced from the repository. |
String |
installPackageFromURL(URL packageURL,
PrintStream... progress)
Install a package sourced from a given URL. |
void |
installPackages(List<Package> toInstall,
PrintStream... progress)
Installs all the packages in the supplied list. |
static void |
main(String[] args)
|
protected static String |
padLeft(String inString,
int length)
Pads a string to a specified length, inserting spaces on the left as required. |
protected static String |
padRight(String inString,
int length)
Pads a string to a specified length, inserting spaces on the right as required. |
void |
uninstallPackage(String packageName,
PrintStream... progress)
Uninstall a package. |
| Methods inherited from class org.pentaho.packageManagement.PackageManager |
|---|
create, establishProxy, getBaseSystemName, getBaseSystemVersion, getPackageHome, getPackageRepositoryURL, getProxy, setBaseSystemName, setBaseSystemVersion, setPackageHome, setPackageRepositoryURL, setProxy, setProxyAuthentication, setProxyPassword, setProxyUsername |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultPackageManager()
| Method Detail |
|---|
protected File downloadArchive(URL packageURL,
String fileExtension,
PrintStream... progress)
throws Exception
Exception
public Package getURLPackageInfo(URL packageURL)
throws Exception
getURLPackageInfo in class PackageManagerpackageURL - the URL to the package.
Exception - if the package meta data can't be retrieved.
public Package getRepositoryPackageInfo(String packageName)
throws Exception
getRepositoryPackageInfo in class PackageManagerpackageName - the name of the package to get information about.
Exception - if the package meta data can't be retrieved.
public List<Object> getRepositoryPackageVersions(String packageName)
throws Exception
getRepositoryPackageVersions in class PackageManagerpackageName - the name of the package to get versions.
Exception - if something goes wrong while trying to retrieve the list
of versions.
public Package getRepositoryPackageInfo(String packageName,
Object version)
throws Exception
getRepositoryPackageInfo in class PackageManagerpackageName - the name of the package to get information about.version - the version of the package to retrieve (may be null if not
applicable).
Exception - if the package meta data can't be retrieved.
public Package getPackageArchiveInfo(String packageArchivePath)
throws Exception
getPackageArchiveInfo in class PackageManagerpackageArchivePath - the path to the package archive file
Exception - if the package meta data can't be retrieved.
public Package getInstalledPackageInfo(String packageName)
throws Exception
getInstalledPackageInfo in class PackageManagerpackageName - the name of the package to get information about.
Exception - if the package meta data can't be retrieved.protected boolean establishPackageHome()
public static void deleteDir(File dir,
PrintStream... progress)
throws Exception
Exception
public void uninstallPackage(String packageName,
PrintStream... progress)
throws Exception
uninstallPackage in class PackageManagerpackageName - the package to uninstall.progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.
Exception - if the named package could not be removed for some
reason.
public String installPackageFromArchive(String packageArchivePath,
PrintStream... progress)
throws Exception
installPackageFromArchive in class PackageManagerpackageArchivePath - the path to the package archive file.progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.
Exception - if the package can't be installed for some reason.
protected void installAdditionalLibs(String packageName,
String[] additionalLibURLs,
PrintStream... progress)
throws Exception
packageName - the name of the package that will receive the downloaded
libraries into its lib directoryadditionalLibURLs - an array of urls to the libraries to downloadprogress - for progress reporting
Exception - if a problem occurs
public void installPackages(List<Package> toInstall,
PrintStream... progress)
throws Exception
installPackages in class PackageManagertoInstall - a list of Packages to install.progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.
Exception - if something goes wrong during the installation process.
protected static boolean checkDependencies(PackageConstraint toCheck,
Map<String,Dependency> lookup,
Map<String,List<Dependency>> conflicts)
throws Exception
toCheck - the package to check.lookup - a Map of package name, Dependency pairs to check against.conflicts - a list of Dependency objects for any conflicts that are
detected.
Exception - if a problem occurs when checking for conflicts.
public List<Dependency> getAllDependenciesForPackage(Package target,
Map<String,List<Dependency>> conflicts)
throws Exception
getAllDependenciesForPackage in class PackageManagertarget - the package for which a list of dependencies is required.conflicts - will hold any conflicts that are discovered while building
the full dependency list.
Exception - if a problem occurs while building the dependency list.
public void installPackageFromRepository(String packageName,
Object version,
PrintStream... progress)
throws Exception
installPackageFromRepository in class PackageManagerpackageName - the name of the package to installversion - the version of the package to install (may be null if not
applicable).progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.
Exception - if the package can't be installed for some reason.
public String installPackageFromURL(URL packageURL,
PrintStream... progress)
throws Exception
installPackageFromURL in class PackageManagerpackageURL - the URL to the package.progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.
Exception - if the package can't be installed for some reason.
protected void installPackage(String packageArchivePath,
String packageName,
PrintStream... progress)
throws Exception
packageArchivePath - the full path to the archived package to install.packageName - the name of the package to install.progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.
Exception - if the package can't be installed for some reason.
public byte[] getRepositoryPackageMetaDataOnlyAsZip(PrintStream... progress)
throws Exception
getRepositoryPackageMetaDataOnlyAsZip in class PackageManagerprogress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.
Exception - if the repository meta data can't be returned as a zip
public byte[] getRepositoryPackageMetaDataOnlyAsZipLegacy(PrintStream... progress)
throws Exception
Exception
public List<Package> getAllPackages(PrintStream... progress)
throws Exception
getAllPackages in class PackageManagerprogress - optional varargs parameter, that, if supplied is expected
to contain one or more PrintStream objects to write progress to.
Exception - if a list of packages can't be determined.
public List<Package> getAvailablePackages()
throws Exception
getAvailablePackages in class PackageManagerException - if a list of packages can't be determined.
public List<Package> getInstalledPackages()
throws Exception
getInstalledPackages in class PackageManagerException - if a list of packages can't be determined.
protected static String padLeft(String inString,
int length)
inString - the input stringlength - the desired length of the output string
protected static String padRight(String inString,
int length)
inString - the input stringlength - the desired length of the output string
public static void main(String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||