public abstract class Module extends ModuleInfo
Modifier and Type | Class and Description |
---|---|
static class |
Module.PackageExport
Struct representing a package exported from a module.
|
Modifier and Type | Field and Description |
---|---|
protected ClassLoader |
classloader
currently active module classloader
|
protected Events |
events
event logging (should not be much here)
|
protected ModuleManager |
mgr
manager which owns this module
|
static String |
PROP_CLASS_LOADER |
static String |
PROP_MANIFEST |
static String |
PROP_PROBLEMS |
static String |
PROP_RELOADABLE |
static String |
PROP_VALID |
protected boolean |
reloadable |
PROP_ENABLED
Modifier | Constructor and Description |
---|---|
protected |
Module(ModuleManager mgr,
Events ev,
Object history,
boolean reloadable,
boolean autoload,
boolean eager)
Use ModuleManager.create as a factory.
|
protected |
Module(ModuleManager mgr,
Events ev,
Object history,
ClassLoader classloader)
Create a special-purpose "fixed" JAR.
|
protected |
Module(ModuleManager mgr,
Events ev,
Object history,
ClassLoader classloader,
boolean autoload,
boolean eager)
Create a special-purpose "fixed" JAR which may nonetheless be marked eager or autoload.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
classLoaderDown()
Turn off the classloader and release all resources.
|
protected abstract void |
classLoaderUp(Set<Module> parents)
Turn on the classloader.
|
protected abstract void |
cleanup()
Should be called after turning off the classloader of one or more modules & GC'ing.
|
protected abstract void |
destroy()
Notify the module that it is being deleted.
|
Enumeration<URL> |
findResources(String resources)
Locates resource in this module.
|
abstract List<File> |
getAllJars()
Get all JARs loaded by this module.
|
Object |
getAttribute(String attr)
Get an associated arbitrary attribute.
|
String |
getBuildVersion() |
ClassLoader |
getClassLoader() |
String |
getCodeName() |
String |
getCodeNameBase() |
int |
getCodeNameRelease() |
Set<Dependency> |
getDependencies() |
Dependency[] |
getDependenciesArray() |
Object |
getHistory()
Get the history object representing what has happened to this module before.
|
String |
getImplementationVersion() |
File |
getJarFile()
Get the JAR this module is packaged in.
|
ModuleManager |
getManager()
Get the associated module manager.
|
abstract Manifest |
getManifest()
Get the JAR manifest.
|
Set<Object> |
getProblems()
Get a set of
Dependency objects representing missed dependencies. |
String[] |
getProvides() |
Module.PackageExport[] |
getPublicPackages()
Get all packages exported by this module to other modules.
|
SpecificationVersion |
getSpecificationVersion() |
int |
getStartLevel()
Finds out if a module has been assigned with a specific start level.
|
boolean |
isAutoload()
Is this module automatically loaded?
If so, no information about its state is kept
permanently beyond the existence of its JAR file;
it is enabled when some real module needs it to be,
and disabled when this is no longer the case.
|
boolean |
isEager()
Is this module eagerly enabled?
If so, no information about its state is kept permanently.
|
boolean |
isEnabled() |
abstract boolean |
isFixed()
Fixed modules are treated differently.
|
boolean |
isNetigso()
Is this module a wrapper around OSGi?
|
boolean |
isReloadable()
Is this module supposed to be easily reloadable?
If so, it is suitable for testing inside the IDE.
|
boolean |
isValid()
Normally a module once created and managed is valid
(that is, either installed or not, but at least managed).
|
boolean |
owns(Class<?> clazz) |
protected void |
parseManifest()
Parse information from the current manifest.
|
boolean |
provides(String token)
Test whether the module provides a given token or not.
|
void |
releaseManifest()
Release memory storage for the JAR manifest, if applicable.
|
abstract void |
reload()
Reload this module.
|
abstract void |
setReloadable(boolean r)
Set whether this module is supposed to be reloadable.
|
String |
toString()
String representation for debugging.
|
addPropertyChangeListener, firePropertyChange, getDisplayName, getLocalizedAttribute, removePropertyChangeListener
public static final String PROP_RELOADABLE
public static final String PROP_CLASS_LOADER
public static final String PROP_MANIFEST
public static final String PROP_VALID
public static final String PROP_PROBLEMS
protected final ModuleManager mgr
protected final Events events
protected boolean reloadable
protected ClassLoader classloader
protected Module(ModuleManager mgr, Events ev, Object history, boolean reloadable, boolean autoload, boolean eager) throws IOException
IOException
protected Module(ModuleManager mgr, Events ev, Object history, ClassLoader classloader) throws InvalidException
InvalidException
protected Module(ModuleManager mgr, Events ev, Object history, ClassLoader classloader, boolean autoload, boolean eager) throws InvalidException
InvalidException
public ModuleManager getManager()
public boolean isEnabled()
isEnabled
in class ModuleInfo
public boolean isValid()
public boolean isAutoload()
public boolean isEager()
public Object getAttribute(String attr)
getAttribute
in class ModuleInfo
public String getCodeName()
getCodeName
in class ModuleInfo
public String getCodeNameBase()
getCodeNameBase
in class ModuleInfo
public int getCodeNameRelease()
getCodeNameRelease
in class ModuleInfo
public String[] getProvides()
getProvides
in class ModuleInfo
public final boolean provides(String token)
public Set<Dependency> getDependencies()
getDependencies
in class ModuleInfo
public final Dependency[] getDependenciesArray()
public SpecificationVersion getSpecificationVersion()
getSpecificationVersion
in class ModuleInfo
public String getImplementationVersion()
getImplementationVersion
in class ModuleInfo
public String getBuildVersion()
getBuildVersion
in class ModuleInfo
public boolean owns(Class<?> clazz)
owns
in class ModuleInfo
public Module.PackageExport[] getPublicPackages()
protected void parseManifest() throws InvalidException
InvalidException
public abstract List<File> getAllJars()
public boolean isReloadable()
public abstract void setReloadable(boolean r)
r
- whether the module should be considered reloadablepublic abstract void reload() throws IOException
IOException
public ClassLoader getClassLoader() throws IllegalArgumentException
getClassLoader
in class ModuleInfo
IllegalArgumentException
protected abstract void classLoaderUp(Set<Module> parents) throws IOException
IOException
protected abstract void classLoaderDown()
protected abstract void cleanup()
protected abstract void destroy()
public abstract boolean isFixed()
FixedModule
public File getJarFile()
Module.isFixed()
public abstract Manifest getManifest()
public void releaseManifest()
public Set<Object> getProblems()
Dependency
objects representing missed dependencies.
This module is examined to see
why it would not be installable.
If it is enabled, there are no problems.
If it is in fact installable (possibly only
by also enabling some other managed modules which are currently disabled), and
all of its non-module dependencies are met, the returned set will be empty.
Otherwise it will contain a list of reasons why this module cannot be installed:
non-module dependencies which are not met; and module dependencies on modules
which either do not exist in the managed set, or are the wrong version,
or themselves cannot be installed
for some reason or another (which may be separately examined).
Note that in the (illegal) situation of two or more modules forming a cyclic
dependency cycle, none of them will be installable, and the missing dependencies
for each will be stated as the dependencies on the others. Again other modules
dependent on modules in the cycle will list failed dependencies on the cyclic modules.
Missing package dependencies are not guaranteed to be reported unless an install
of the module has already been attempted, and failed due to them.
The set may also contain InvalidException
s representing known failures
of the module to be installed, e.g. due to classloader problems, missing runtime
resources, or failed ad-hoc dependencies. Again these are not guaranteed to be
reported unless an install has already been attempted and failed due to them.public final Object getHistory()
public final int getStartLevel()
public String toString()
public Enumeration<URL> findResources(String resources)
resources
- path to the resources we are looking forpublic final boolean isNetigso()