weka.core
Class WekaPackageManager

java.lang.Object
  extended by weka.core.WekaPackageManager

public class WekaPackageManager
extends java.lang.Object

Class providing package management and manipulation routines. Also provides a command line interface for package management.

Version:
$Revision: 7804 $
Author:
Mark Hall (mhall{[at]}pentaho{[dot]}com)

Field Summary
static boolean m_initialPackageLoadingInProcess
           
static java.io.File PACKAGES_DIR
           
static java.io.File PROPERTIES_DIR
           
static java.io.File WEKA_HOME
           
 
Constructor Summary
WekaPackageManager()
           
 
Method Summary
static boolean checkForMissingClasses(org.pentaho.packageManagement.Package toLoad, java.io.PrintStream... progress)
          Checks to see if there are any classes that we should try to instantiate before allowing this package to be loaded.
static boolean checkForMissingFiles(org.pentaho.packageManagement.Package toLoad, java.io.File packageRoot, java.io.PrintStream... progress)
          Checks to see if there are any missing files/directories for a given package.
static java.lang.Exception checkForNewPackages(java.io.PrintStream... progress)
           
static java.lang.Exception establishCacheIfNeeded(java.io.PrintStream... progress)
           
static java.util.List<org.pentaho.packageManagement.Dependency> getAllDependenciesForPackage(org.pentaho.packageManagement.Package target, java.util.Map<java.lang.String,java.util.List<org.pentaho.packageManagement.Dependency>> conflicts)
           
static java.util.List<org.pentaho.packageManagement.Package> getAllPackages()
           
static java.util.List<org.pentaho.packageManagement.Package> getAvailablePackages()
           
static org.pentaho.packageManagement.Package getInstalledPackageInfo(java.lang.String packageName)
           
static java.util.List<org.pentaho.packageManagement.Package> getInstalledPackages()
           
static org.pentaho.packageManagement.Package getPackageArchiveInfo(java.lang.String packageArchivePath)
           
static java.io.File getPackageHome()
           
static java.util.Map<java.lang.String,java.lang.String> getPackageList(boolean local)
          Just get a list of the package names.
static java.net.URL getPackageRepositoryURL()
           
static org.pentaho.packageManagement.Package getRepositoryPackageInfo(java.lang.String packageName)
           
static org.pentaho.packageManagement.Package getRepositoryPackageInfo(java.lang.String packageName, java.lang.String version)
           
static java.util.List<java.lang.Object> getRepositoryPackageVersions(java.lang.String packageName)
           
static org.pentaho.packageManagement.PackageManager getUnderlyingPackageManager()
           
static boolean installedPackageResourceExists(java.lang.String packageName, java.lang.String resourceName)
           
static java.lang.String installPackageFromArchive(java.lang.String packageArchivePath, java.io.PrintStream... progress)
           
static void installPackageFromRepository(java.lang.String packageName, java.lang.String version, java.io.PrintStream... progress)
           
static java.lang.String installPackageFromURL(java.net.URL packageURL, java.io.PrintStream... progress)
           
static void installPackages(java.util.List<org.pentaho.packageManagement.Package> toInstall, java.io.PrintStream... progress)
           
static boolean loadCheck(org.pentaho.packageManagement.Package toLoad, java.io.File packageRoot, java.io.PrintStream... progress)
           
static void loadPackages(boolean verbose)
           
static void loadPackages(boolean verbose, boolean refreshGOEProperties)
           
static void main(java.lang.String[] args)
           
static org.pentaho.packageManagement.Package mostRecentVersionWithRespectToConstraint(org.pentaho.packageManagement.PackageConstraint toCheck)
          Find the most recent version of the package encapsulated in the supplied PackageConstraint argument that satisfies the constraint
static int numRepositoryPackages()
          Get the number of packages that are available at the repository.
static java.lang.Exception refreshCache(java.io.PrintStream... progress)
           
static void refreshGOEProperties()
           
static void removeExplorerProps(java.lang.String installedPackageName)
           
static void uninstallPackage(java.lang.String packageName, boolean updateKnowledgeFlow, java.io.PrintStream... progress)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WEKA_HOME

public static java.io.File WEKA_HOME

PACKAGES_DIR

public static java.io.File PACKAGES_DIR

PROPERTIES_DIR

public static java.io.File PROPERTIES_DIR

m_initialPackageLoadingInProcess

public static boolean m_initialPackageLoadingInProcess
Constructor Detail

WekaPackageManager

public WekaPackageManager()
Method Detail

removeExplorerProps

public static void removeExplorerProps(java.lang.String installedPackageName)

loadCheck

public static boolean loadCheck(org.pentaho.packageManagement.Package toLoad,
                                java.io.File packageRoot,
                                java.io.PrintStream... progress)

checkForMissingClasses

public static boolean checkForMissingClasses(org.pentaho.packageManagement.Package toLoad,
                                             java.io.PrintStream... progress)
Checks to see if there are any classes that we should try to instantiate before allowing this package to be loaded. This is useful for checking to see if third-party classes are accessible. An example would be Java3D, which has an installer that installs into the JRE/JDK.

Parameters:
toLoad - the package to check
Returns:
true if good to go

checkForMissingFiles

public static boolean checkForMissingFiles(org.pentaho.packageManagement.Package toLoad,
                                           java.io.File packageRoot,
                                           java.io.PrintStream... progress)
Checks to see if there are any missing files/directories for a given package. If there are missing files, then the package can't be loaded. An example would be a connector package that, for whatever reason, can't include a necessary third-party jar file in its lib folder, and requires the user to download and install this jar file manually.

Parameters:
toLoad - the package to check
packageRoot - the root directory of the package
Returns:
true if good to go

loadPackages

public static void loadPackages(boolean verbose)

loadPackages

public static void loadPackages(boolean verbose,
                                boolean refreshGOEProperties)

refreshGOEProperties

public static void refreshGOEProperties()

getUnderlyingPackageManager

public static org.pentaho.packageManagement.PackageManager getUnderlyingPackageManager()

numRepositoryPackages

public static int numRepositoryPackages()
Get the number of packages that are available at the repository.

Returns:
the number of packages that are available (or -1 if this can't be determined for some reason.

getPackageList

public static java.util.Map<java.lang.String,java.lang.String> getPackageList(boolean local)
Just get a list of the package names. This is faster than calling getAllPackages(), especially if fetching from the online repository, since the full meta data for each package doesn't have to be read.

Parameters:
local - true if the local package list in the cache should be read rather than the online repository
Returns:
a Map of all the package names available either locally or at the repository

establishCacheIfNeeded

public static java.lang.Exception establishCacheIfNeeded(java.io.PrintStream... progress)

checkForNewPackages

public static java.lang.Exception checkForNewPackages(java.io.PrintStream... progress)

refreshCache

public static java.lang.Exception refreshCache(java.io.PrintStream... progress)

installedPackageResourceExists

public static boolean installedPackageResourceExists(java.lang.String packageName,
                                                     java.lang.String resourceName)

getPackageHome

public static java.io.File getPackageHome()

mostRecentVersionWithRespectToConstraint

public static org.pentaho.packageManagement.Package mostRecentVersionWithRespectToConstraint(org.pentaho.packageManagement.PackageConstraint toCheck)
                                                                                      throws java.lang.Exception
Find the most recent version of the package encapsulated in the supplied PackageConstraint argument that satisfies the constraint

Parameters:
toCheck - the PackageConstraint containing the package in question
Returns:
the most recent version of the package satisfying the constraint
Throws:
java.lang.Exception - if a version can't be found that satisfies the constraint or an error occurs while communicating with the respository

installPackages

public static void installPackages(java.util.List<org.pentaho.packageManagement.Package> toInstall,
                                   java.io.PrintStream... progress)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getRepositoryPackageVersions

public static java.util.List<java.lang.Object> getRepositoryPackageVersions(java.lang.String packageName)
                                                                     throws java.lang.Exception
Throws:
java.lang.Exception

getPackageRepositoryURL

public static java.net.URL getPackageRepositoryURL()

getAllPackages

public static java.util.List<org.pentaho.packageManagement.Package> getAllPackages()
                                                                            throws java.lang.Exception
Throws:
java.lang.Exception

getAvailablePackages

public static java.util.List<org.pentaho.packageManagement.Package> getAvailablePackages()
                                                                                  throws java.lang.Exception
Throws:
java.lang.Exception

getInstalledPackages

public static java.util.List<org.pentaho.packageManagement.Package> getInstalledPackages()
                                                                                  throws java.lang.Exception
Throws:
java.lang.Exception

getAllDependenciesForPackage

public static java.util.List<org.pentaho.packageManagement.Dependency> getAllDependenciesForPackage(org.pentaho.packageManagement.Package target,
                                                                                                    java.util.Map<java.lang.String,java.util.List<org.pentaho.packageManagement.Dependency>> conflicts)
                                                                                             throws java.lang.Exception
Throws:
java.lang.Exception

getPackageArchiveInfo

public static org.pentaho.packageManagement.Package getPackageArchiveInfo(java.lang.String packageArchivePath)
                                                                   throws java.lang.Exception
Throws:
java.lang.Exception

getInstalledPackageInfo

public static org.pentaho.packageManagement.Package getInstalledPackageInfo(java.lang.String packageName)
                                                                     throws java.lang.Exception
Throws:
java.lang.Exception

getRepositoryPackageInfo

public static org.pentaho.packageManagement.Package getRepositoryPackageInfo(java.lang.String packageName)
                                                                      throws java.lang.Exception
Throws:
java.lang.Exception

getRepositoryPackageInfo

public static org.pentaho.packageManagement.Package getRepositoryPackageInfo(java.lang.String packageName,
                                                                             java.lang.String version)
                                                                      throws java.lang.Exception
Throws:
java.lang.Exception

installPackageFromRepository

public static void installPackageFromRepository(java.lang.String packageName,
                                                java.lang.String version,
                                                java.io.PrintStream... progress)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

installPackageFromArchive

public static java.lang.String installPackageFromArchive(java.lang.String packageArchivePath,
                                                         java.io.PrintStream... progress)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

installPackageFromURL

public static java.lang.String installPackageFromURL(java.net.URL packageURL,
                                                     java.io.PrintStream... progress)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

uninstallPackage

public static void uninstallPackage(java.lang.String packageName,
                                    boolean updateKnowledgeFlow,
                                    java.io.PrintStream... progress)
                             throws java.lang.Exception
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)