public class WekaPackageManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DISABLE_KEY
Package metadata key for package disablement
|
static java.lang.String |
DISABLED_KEY
Package metadata key for package disablement
|
static java.lang.String |
DO_NOT_LOAD_IF_CLASS_NOT_PRESENT_KEY
Package metadata key for preventing load if a class is not available
|
static java.lang.String |
DO_NOT_LOAD_IF_CLASS_NOT_PRESENT_MESSAGE_KEY
Package metadata key for preventing load if a class is not available
|
static java.lang.String |
DO_NOT_LOAD_IF_ENV_VAR_NOT_SET_KEY
Package metadata key for preventing load if an environment variable is not
set
|
static java.lang.String |
DO_NOT_LOAD_IF_ENV_VAR_NOT_SET_MESSAGE_KEY
Package metadata key for preventing load if an environment variable is not
set
|
static java.lang.String |
DO_NOT_LOAD_IF_FILE_NOT_PRESENT_KEY
Package metadata key for preventing load if a file is not present
|
static java.lang.String |
DO_NOT_LOAD_IF_FILE_NOT_PRESENT_MESSAGE_KEY
Package metadata key for preventing load if a file is not present
|
static java.lang.String |
INJECT_DEPENDENCY_KEY
Package metadata key for dependency injection
|
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.lang.String |
MESSAGE_TO_DISPLAY_ON_INSTALLATION_KEY
Package metadata key for a message to display on installation
|
static java.io.File |
NATIVE_LIBS_DIR
The default native libraries directory
|
static java.lang.String |
NATIVE_LIBS_DIR_NAME |
static java.lang.String |
OS_ARCH_KEY
Package metadata key for OS architecture.
|
static java.lang.String |
OS_NAME_KEY
Package metadata key for OS name.
|
static java.io.File |
PACKAGES_DIR
The default packages directory
|
static java.lang.String |
PRECLUDES_KEY
Package metadata key for package preclusion
|
static java.io.File |
PROPERTIES_DIR
The default properties directory
|
static java.lang.String |
SET_SYSTEM_PROPERTIES_KEY
Package metadata key for setting system properties
|
static java.lang.String |
VERSION_KEY
Package metadata key for version info
|
static java.lang.String |
VM_VERSION_KEY
Package metadata key for JVM version.
|
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 |
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 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 |
getLatestCompatibleVersion(java.lang.String packageName)
Get the latest version of the named package that is compatible with the
base version of Weka being used.
|
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 |
hasBeenLoaded(Package toCheck)
Check to see if the named package has been loaded successfully
|
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 (unofficial package install route)
|
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)
Install 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 boolean |
osAndArchCheck(Package toLoad,
java.io.PrintStream... progress)
Checks the supplied package against the current OS and architecture.
|
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.lang.Exception |
startupCheck(boolean force,
java.io.PrintStream... progress) |
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
|
static boolean |
vmVersionCheck(Package toLoad,
java.io.PrintStream... progress)
Checks the supplied package against the JVM version running Weka.
|
public static final java.lang.String INJECT_DEPENDENCY_KEY
public static final java.lang.String VERSION_KEY
public static final java.lang.String DISABLE_KEY
public static final java.lang.String DISABLED_KEY
public static final java.lang.String PRECLUDES_KEY
public static final java.lang.String OS_NAME_KEY
public static final java.lang.String OS_ARCH_KEY
public static final java.lang.String VM_VERSION_KEY
public static final java.lang.String DO_NOT_LOAD_IF_ENV_VAR_NOT_SET_KEY
public static final java.lang.String DO_NOT_LOAD_IF_ENV_VAR_NOT_SET_MESSAGE_KEY
public static final java.lang.String DO_NOT_LOAD_IF_CLASS_NOT_PRESENT_KEY
public static final java.lang.String DO_NOT_LOAD_IF_CLASS_NOT_PRESENT_MESSAGE_KEY
public static final java.lang.String DO_NOT_LOAD_IF_FILE_NOT_PRESENT_KEY
public static final java.lang.String DO_NOT_LOAD_IF_FILE_NOT_PRESENT_MESSAGE_KEY
public static final java.lang.String MESSAGE_TO_DISPLAY_ON_INSTALLATION_KEY
public static final java.lang.String SET_SYSTEM_PROPERTIES_KEY
public static java.io.File WEKA_HOME
public static java.io.File PACKAGES_DIR
public static java.io.File PROPERTIES_DIR
public static java.lang.String NATIVE_LIBS_DIR_NAME
public static java.io.File NATIVE_LIBS_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 hasBeenLoaded(Package toCheck)
toCheck
- the name of the package to check forpublic 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 vmVersionCheck(Package toLoad, java.io.PrintStream... progress)
toLoad
- the package to checkprogress
- PrintStream for progress infopublic static boolean osAndArchCheck(Package toLoad, java.io.PrintStream... progress)
toLoad
- the package to checkprogress
- PrintStream for progress infopublic 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 Package getLatestCompatibleVersion(java.lang.String packageName) throws java.lang.Exception
packageName
- the name of the package to get the latest compatible
version ofjava.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 java.lang.Exception startupCheck(boolean force, java.io.PrintStream... progress)
public static void main(java.lang.String[] args)
args
- command line arguments