public class WekaPackageManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Set<java.lang.String> |
m_doNotLoadList
The set of packages that the user has requested not to load
|
static boolean |
m_initialPackageLoadingInProcess
Package loading in progress?
|
static boolean |
m_noPackageMetaDataAvailable |
static boolean |
m_offline
Operating offline?
|
static java.io.File |
PACKAGES_DIR
The default packages directory
|
static java.io.File |
PROPERTIES_DIR
The default properties directory
|
static java.io.File |
WEKA_HOME
Default path to where Weka's configuration and packages are stored
|
Constructor and Description |
---|
WekaPackageManager() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkForMissingClasses(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(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)
Check for new packages on the server and refresh the local cache if needed
|
static boolean |
checkForUnsetEnvVar(Package toLoad,
java.io.PrintStream... progress)
Checks to see if there are any environment variables or properties that
should be set at startup before allowing this package to be loaded.
|
static java.lang.Exception |
establishCacheIfNeeded(java.io.PrintStream... progress)
Establish the local copy of the package meta data if needed
|
static java.util.List<Dependency> |
getAllDependenciesForPackage(Package target,
java.util.Map<java.lang.String,java.util.List<Dependency>> conflicts)
Get a list of dependencies for a given package
|
static java.util.List<Package> |
getAllPackages()
Get a list of all packages
|
static java.util.List<Package> |
getAvailableCompatiblePackages()
Get a list of the most recent version of all available packages (i.e.
|
static java.util.List<Package> |
getAvailablePackages()
Get a list of all available packages (i.e.
|
static Package |
getInstalledPackageInfo(java.lang.String packageName)
Get meta data for an installed package
|
static java.util.List<Package> |
getInstalledPackages()
Get a list of installed packages
|
static Package |
getPackageArchiveInfo(java.lang.String packageArchivePath)
Extract meta data from a package archive
|
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()
Get the package repository URL
|
static Package |
getRepositoryPackageInfo(java.lang.String packageName)
Get meta data for the latest version of a package from the repository
|
static Package |
getRepositoryPackageInfo(java.lang.String packageName,
java.lang.String version)
Get meta data for a specific version of a package from the repository
|
static java.util.List<java.lang.Object> |
getRepositoryPackageVersions(java.lang.String packageName)
Get the versions of the supplied package available on the server
|
static PackageManager |
getUnderlyingPackageManager()
Get the underlying package manager implementation
|
static boolean |
installedPackageResourceExists(java.lang.String packageName,
java.lang.String resourceName)
Check if a named resource exists in an installed package
|
static java.lang.String |
installPackageFromArchive(java.lang.String packageArchivePath,
java.io.PrintStream... progress)
Install a package from an archive
|
static boolean |
installPackageFromRepository(java.lang.String packageName,
java.lang.String version,
java.io.PrintStream... progress)
Install a named package by retrieving the location of the archive from the
meta data stored in the repository
|
static java.lang.String |
installPackageFromURL(java.net.URL packageURL,
java.io.PrintStream... progress)
Insstall a package from the supplied URL
|
static boolean |
installPackages(java.util.List<Package> toInstall,
java.io.PrintStream... progress)
Install the supplied list of packages
|
static boolean |
loadCheck(Package toLoad,
java.io.File packageRoot,
java.io.PrintStream... progress)
Check whether a package should be loaded or not.
|
static void |
loadPackages(boolean verbose)
Load all packages
|
static void |
loadPackages(boolean verbose,
boolean avoidTriggeringFullClassDiscovery,
boolean refreshGOEProperties)
Load all packages
|
static void |
main(java.lang.String[] args)
Main method for using the package manager from the command line
|
static Package |
mostRecentVersionWithRespectToConstraint(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)
Refresh the local copy of the package meta data
|
static void |
refreshGOEProperties()
Refresh the generic object editor properties via re-running of the dynamic
class discovery process.
|
static void |
removeExplorerProps(java.lang.String installedPackageName)
Remove any ExplorerDefaults properties specified in the supplied package
|
static int |
repoZipArchiveSize()
Retrieves the size (in KB) of the repository zip archive stored on the
server.
|
static java.util.List<java.lang.String> |
toggleLoadStatus(java.util.List<java.lang.String> packageNames)
Toggle the load status of the supplied list of package names
|
static void |
uninstallPackage(java.lang.String packageName,
boolean updateKnowledgeFlow,
java.io.PrintStream... progress)
Uninstall a named package
|
public static java.io.File WEKA_HOME
public static java.io.File PACKAGES_DIR
public static java.io.File PROPERTIES_DIR
public static boolean m_offline
public static boolean m_initialPackageLoadingInProcess
public static boolean m_noPackageMetaDataAvailable
public static java.util.Set<java.lang.String> m_doNotLoadList
public static void removeExplorerProps(java.lang.String installedPackageName)
installedPackageName
- the package specifying properties that should
be removed from ExplorerDefaultspublic static boolean loadCheck(Package toLoad, java.io.File packageRoot, java.io.PrintStream... progress)
toLoad
- the package to checkpackageRoot
- the root directory of the packageprogress
- for reporting loading progresspublic static boolean checkForUnsetEnvVar(Package toLoad, java.io.PrintStream... progress)
toLoad
- the package to checkpublic static boolean checkForMissingClasses(Package toLoad, java.io.PrintStream... progress)
toLoad
- the package to checkpublic static boolean checkForMissingFiles(Package toLoad, java.io.File packageRoot, java.io.PrintStream... progress)
toLoad
- the package to checkpackageRoot
- the root directory of the packagepublic static java.util.List<java.lang.String> toggleLoadStatus(java.util.List<java.lang.String> packageNames) throws java.lang.Exception
packageNames
- the packages to toggle the load status forjava.lang.Exception
- if a problem occurspublic static void loadPackages(boolean verbose)
verbose
- true if loading progress should be outputpublic static void loadPackages(boolean verbose, boolean avoidTriggeringFullClassDiscovery, boolean refreshGOEProperties)
verbose
- true if loading progress should be outputavoidTriggeringFullClassDiscovery
- true if we should avoid processing
any properties files that might cause a full class discovery run,
and may involve instantiating GUI classes.refreshGOEProperties
- true if the GOE properties should be refreshed
after loading (i.e. a re-run of the class discovery mechanism,
re-initialization of the Knowledge Flow etc.)public static void refreshGOEProperties()
public static PackageManager getUnderlyingPackageManager()
public static int repoZipArchiveSize()
public static int numRepositoryPackages()
public static java.util.Map<java.lang.String,java.lang.String> getPackageList(boolean local)
local
- true if the local package list in the cache should be read
rather than the online repositorypublic static java.lang.Exception establishCacheIfNeeded(java.io.PrintStream... progress)
progress
- for reporting progresspublic static java.lang.Exception checkForNewPackages(java.io.PrintStream... progress)
progress
- to report progress topublic static java.lang.Exception refreshCache(java.io.PrintStream... progress)
progress
- to report progress topublic static boolean installedPackageResourceExists(java.lang.String packageName, java.lang.String resourceName)
packageName
- the name of the package in questionresourceName
- the name of the resource to check forpublic static java.io.File getPackageHome()
public static Package mostRecentVersionWithRespectToConstraint(PackageConstraint toCheck) throws java.lang.Exception
toCheck
- the PackageConstraint containing the package in questionjava.lang.Exception
- if a version can't be found that satisfies the constraint
or an error occurs while communicating with the respositorypublic static boolean installPackages(java.util.List<Package> toInstall, java.io.PrintStream... progress) throws java.lang.Exception
toInstall
- packages to installprogress
- to report progress tojava.lang.Exception
- if a problem occurspublic static java.util.List<java.lang.Object> getRepositoryPackageVersions(java.lang.String packageName) throws java.lang.Exception
packageName
- the package name to get available versions forjava.lang.Exception
- if a problem occurspublic static java.net.URL getPackageRepositoryURL()
public static java.util.List<Package> getAllPackages() throws java.lang.Exception
java.lang.Exception
- if a problem occurspublic static java.util.List<Package> getAvailablePackages() throws java.lang.Exception
java.lang.Exception
- if a problem occurspublic static java.util.List<Package> getAvailableCompatiblePackages() throws java.lang.Exception
java.lang.Exception
- if a problem occurspublic static java.util.List<Package> getInstalledPackages() throws java.lang.Exception
java.lang.Exception
- if a problem occurspublic static java.util.List<Dependency> getAllDependenciesForPackage(Package target, java.util.Map<java.lang.String,java.util.List<Dependency>> conflicts) throws java.lang.Exception
target
- the package to get the dependencies forconflicts
- will hold any conflictsjava.lang.Exception
- if a problem occurspublic static Package getPackageArchiveInfo(java.lang.String packageArchivePath) throws java.lang.Exception
packageArchivePath
- the path to the package archivejava.lang.Exception
- if a problem occurspublic static Package getInstalledPackageInfo(java.lang.String packageName) throws java.lang.Exception
packageName
- the name of the packagejava.lang.Exception
- if a problem occurspublic static Package getRepositoryPackageInfo(java.lang.String packageName) throws java.lang.Exception
packageName
- the name of the packagejava.lang.Exception
- if a problem occurspublic static Package getRepositoryPackageInfo(java.lang.String packageName, java.lang.String version) throws java.lang.Exception
packageName
- the name of the packageversion
- the version to get meta data forjava.lang.Exception
- if a problem occurspublic static boolean installPackageFromRepository(java.lang.String packageName, java.lang.String version, java.io.PrintStream... progress) throws java.lang.Exception
packageName
- the name of the package to installversion
- the version of the package to installprogress
- for reporting progressjava.lang.Exception
- if a problem occurspublic static java.lang.String installPackageFromArchive(java.lang.String packageArchivePath, java.io.PrintStream... progress) throws java.lang.Exception
packageArchivePath
- the path to the package archive file to installprogress
- for reporting progressjava.lang.Exception
- if a problem occurspublic static java.lang.String installPackageFromURL(java.net.URL packageURL, java.io.PrintStream... progress) throws java.lang.Exception
packageURL
- the URL to the package archive to installprogress
- for reporting progressjava.lang.Exception
- if a problem occurspublic static void uninstallPackage(java.lang.String packageName, boolean updateKnowledgeFlow, java.io.PrintStream... progress) throws java.lang.Exception
packageName
- the name of the package to removeupdateKnowledgeFlow
- true if any Knowledge Flow beans provided by the
package should be deregistered from the KnoweledgeFlowprogress
- for reporting progressjava.lang.Exception
- if a problem occurspublic static void main(java.lang.String[] args)
args
- command line arguments