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
|
protected static java.lang.String |
FORCED_REFRESH_COUNT_FILE
File to check against server equivalent for forced refresh
|
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?
|
protected static boolean |
m_packagesLoaded
Packages loaded OK?
|
protected static boolean |
m_wekaHomeEstablished
Established WEKA_HOME successfully?
|
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.
|
protected static java.lang.String |
PACKAGE_LIST_WITH_VERSION_FILE
File to check against server for new/updated packages
|
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.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 |
|---|---|
protected static boolean |
checkForForcedCacheRefresh() |
protected static void |
checkForInjectDependencies(Package toLoad,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> injectDeps)
Checks a package for the presence of any specified package dependencies to
inject at load time
|
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
|
protected static void |
cleanRepCacheDir()
Deletes the contents of $WEKA_HOME/repCache
|
static java.lang.Exception |
establishCacheIfNeeded(java.io.PrintStream... progress)
Establish the local copy of the package meta data if needed
|
protected static void |
establishMirror()
Establish the location of a mirror
|
protected static boolean |
establishWekaHome()
Establish WEKA_HOME 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. those
not yet installed or there is a higher version in the repository) that are
compatible with the version of Weka that is installed.
|
static java.util.List<Package> |
getAvailablePackages()
Get a list of all available packages (i.e. those not yet installed(.
|
protected static java.util.Set<java.lang.String> |
getDoNotLoadList()
Reads the doNotLoad list (if it exists) from the packages directory
|
protected static int |
getForcedRefreshCount(boolean local) |
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
|
protected static void |
injectPackageDependencies(java.util.Map<java.lang.String,java.util.List<java.lang.String>> injectDependencies)
Processes a map of dependencies to inject.
|
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
|
protected static void |
log(Logger.Level level,
java.lang.String message)
Write to the weka log
|
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.
|
protected static void |
printInstalledPackageInfo(java.lang.String packageName)
Print meta data for an installed package
|
protected static void |
printPackageArchiveInfo(java.lang.String packagePath)
Print meta data on a package
|
protected static void |
printRepositoryPackageInfo(java.lang.String packageName,
java.lang.String version)
Print meta data for a package listed in the repository
|
protected static void |
processExplorerProps(java.io.File propsFile)
Process a package's Explorer.props file
|
protected static void |
processGenericPropertiesCreatorProps(java.io.File propsFile)
Process a package's GenericPropertiesCreator.props file
|
protected static void |
processGUIEditorsProps(java.io.File propsFile,
boolean verbose)
Process a package's GUIEditors.props file
|
protected static void |
processPackageDirectory(java.io.File directory,
boolean verbose,
java.util.List<java.io.File> goePropsFiles,
boolean avoidTriggeringFullClassDiscovery)
Process properties in a package directory
|
protected static void |
processPluginManagerProps(java.lang.String packageName,
java.io.File propsFile)
Process a package's PluginManager.props file
|
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 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 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
protected static boolean m_wekaHomeEstablished
protected static boolean m_packagesLoaded
protected static final java.lang.String PACKAGE_LIST_WITH_VERSION_FILE
protected static final java.lang.String FORCED_REFRESH_COUNT_FILE
public static boolean m_initialPackageLoadingInProcess
public static boolean m_noPackageMetaDataAvailable
public static java.util.Set<java.lang.String> m_doNotLoadList
protected static boolean establishWekaHome()
protected static void establishMirror()
protected static void log(Logger.Level level, java.lang.String message)
level - logging levelmessage - message to writepublic static void removeExplorerProps(java.lang.String installedPackageName)
installedPackageName - the package specifying properties that should
be removed from ExplorerDefaultsprotected static void processGenericPropertiesCreatorProps(java.io.File propsFile)
propsFile - the props file to processprotected static void processExplorerProps(java.io.File propsFile)
propsFile - the properties file to processprotected static void processGUIEditorsProps(java.io.File propsFile,
boolean verbose)
propsFile - the properties file to processverbose - true to output more infoprotected static void processPluginManagerProps(java.lang.String packageName,
java.io.File propsFile)
packageName - the name of the package that owns this PluginManager
props filepropsFile - the properties file to processprotected static void processPackageDirectory(java.io.File directory,
boolean verbose,
java.util.List<java.io.File> goePropsFiles,
boolean avoidTriggeringFullClassDiscovery)
throws java.lang.Exception
directory - the package directory to processverbose - true for verbose outputgoePropsFiles - store any GenericObjectEditor.props files for
post-processing after all jars have been loadedjava.lang.Exception - if a problem occurspublic 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 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 packageprotected static java.util.Set<java.lang.String> getDoNotLoadList()
public 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.)protected static void checkForInjectDependencies(Package toLoad, java.util.Map<java.lang.String,java.util.List<java.lang.String>> injectDeps)
toLoad - the package to checkinjectDeps - a map (keyed by source package name) containing lists of
target packages. Each source package will have the entries in its
target package list injected (via the WekaLibIsolatingClassLoader)
as dependencies.protected static void injectPackageDependencies(java.util.Map<java.lang.String,java.util.List<java.lang.String>> injectDependencies)
injectDependencies - a map of source to target dependencies.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 progressprotected static boolean checkForForcedCacheRefresh()
throws java.net.MalformedURLException
java.net.MalformedURLExceptionprotected static int getForcedRefreshCount(boolean local)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic static java.lang.Exception checkForNewPackages(java.io.PrintStream... progress)
progress - to report progress toprotected static void cleanRepCacheDir()
public 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 occursprotected static void printPackageArchiveInfo(java.lang.String packagePath)
throws java.lang.Exception
packagePath - the path to the package to print meta data forjava.lang.Exception - if a problem occursprotected static void printInstalledPackageInfo(java.lang.String packageName)
throws java.lang.Exception
packageName - the name of the package to print meta data forjava.lang.Exception - if a problem occursprotected static void printRepositoryPackageInfo(java.lang.String packageName,
java.lang.String version)
throws java.lang.Exception
packageName - the name of the package to print meta data forversion - the version of the packagejava.lang.Exception - if a problem occurspublic static void main(java.lang.String[] args)
args - command line arguments