| org.netbeans.Module
All known Subclasses: org.netbeans.StandardModule, org.netbeans.FixedModule,
Module | abstract public class Module extends ModuleInfo (Code) | | Object representing one module, possibly installed.
Responsible for opening of module JAR file; reading
manifest; parsing basic information such as dependencies;
and creating a classloader for use by the installer.
Methods not defined in ModuleInfo must be called from within
the module manager's read mutex as a rule.
author: Jesse Glick since: 2.1 the class was made public abstract |
Inner Class :final public static class PackageExport | |
Constructor Summary | |
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. |
Method Summary | |
abstract protected void | classLoaderDown() Turn off the classloader and release all resources. | abstract protected void | classLoaderUp(Set<Module> parents) Turn on the classloader. | abstract protected void | cleanup() Should be called after turning off the classloader of one or more modules & GC'ing. | abstract protected void | destroy() Notify the module that it is being deleted. | final void | firePropertyChange0(String prop, Object old, Object nue) | abstract public List<File> | getAllJars() Get all JARs loaded by this module. | public Object | getAttribute(String attr) Get an associated arbitrary attribute.
Right now, simply provides the main attributes of the manifest.
In the future some of these could be suppressed (if only of dangerous
interest, e.g. | public ClassLoader | getClassLoader() | public String | getCodeName() | public String | getCodeNameBase() | public int | getCodeNameRelease() | public Set<Dependency> | getDependencies() | final public Dependency[] | getDependenciesArray() | final public Object | getHistory() Get the history object representing what has happened to this module before. | public File | getJarFile() Get the JAR this module is packaged in. | public ModuleManager | getManager() Get the associated module manager. | abstract public Manifest | getManifest() Get the JAR manifest. | public Set<Object> | getProblems() Get a set of
org.openide.modules.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. | public String[] | getProvides() | public PackageExport[] | getPublicPackages() Get all packages exported by this module to other modules. | public SpecificationVersion | getSpecificationVersion() | public 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 | isDeclaredAsFriend(Module module) Checks whether we use friends attribute and if so, then
whether the name of module is listed there. | public boolean | isEager() Is this module eagerly enabled?
If so, no information about its state is kept permanently.
It is turned on whenever it can be, i.e. | public boolean | isEnabled() | abstract public boolean | isFixed() Fixed modules are treated differently. | public boolean | isReloadable() Is this module supposed to be easily reloadable?
If so, it is suitable for testing inside the IDE. | public boolean | isValid() Normally a module once created and managed is valid
(that is, either installed or not, but at least managed). | public boolean | owns(Class clazz) | protected void | parseManifest() Parse information from the current manifest. | final public boolean | provides(String token) Test whether the module provides a given token or not. | public void | releaseManifest() Release memory storage for the JAR manifest, if applicable. | abstract public void | reload() Reload this module. | void | setEnabled(boolean enabled) | abstract public void | setReloadable(boolean r) Set whether this module is supposed to be reloadable. | public String | toString() String representation for debugging. |
PROP_CLASS_LOADER | final public static String PROP_CLASS_LOADER(Code) | | |
PROP_RELOADABLE | final public static String PROP_RELOADABLE(Code) | | |
classloader | protected ClassLoader classloader(Code) | | currently active module classloader
|
events | final protected Events events(Code) | | event logging (should not be much here)
|
reloadable | protected boolean reloadable(Code) | | |
classLoaderDown | abstract protected void classLoaderDown()(Code) | | Turn off the classloader and release all resources.
|
classLoaderUp | abstract protected void classLoaderUp(Set<Module> parents) throws IOException(Code) | | Turn on the classloader. Passed a list of parent modules to use.
The parents should already have had their classloaders initialized.
|
cleanup | abstract protected void cleanup()(Code) | | Should be called after turning off the classloader of one or more modules & GC'ing.
|
destroy | abstract protected void destroy()(Code) | | Notify the module that it is being deleted.
|
getAllJars | abstract public List<File> getAllJars()(Code) | | Get all JARs loaded by this module.
Includes the module itself, any locale variants of the module,
any extensions specified with Class-Path, any locale variants
of those extensions.
The list will be in classpath order (patches first).
Currently the temp JAR is provided in the case of test modules, to prevent
sporadic ZIP file exceptions when background threads (like Java parsing) tries
to open libraries found in the library path.
JARs already present in the classpath are not listed.
a list of JARs |
getAttribute | public Object getAttribute(String attr)(Code) | | Get an associated arbitrary attribute.
Right now, simply provides the main attributes of the manifest.
In the future some of these could be suppressed (if only of dangerous
interest, e.g. Class-Path) or enhanced with other information available
from the core (if needed).
|
getCodeNameRelease | public int getCodeNameRelease()(Code) | | |
getDependencies | public Set<Dependency> getDependencies()(Code) | | |
getDependenciesArray | final public Dependency[] getDependenciesArray()(Code) | | |
getHistory | final public Object getHistory()(Code) | | Get the history object representing what has happened to this module before.
See Also: ModuleHistory |
getJarFile | public File getJarFile()(Code) | | Get the JAR this module is packaged in.
May be null for modules installed specially, e.g.
automatically from the classpath.
See Also: Module.isFixed |
getManifest | abstract public Manifest getManifest()(Code) | | Get the JAR manifest.
Should never be null, even if disabled.
Might change if a module is reloaded.
It is not guaranteed that change events will be fired
for changes in this property.
|
getProblems | public Set<Object> getProblems()(Code) | | Get a set of
org.openide.modules.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.
|
getPublicPackages | public PackageExport[] getPublicPackages()(Code) | | Get all packages exported by this module to other modules.
a list (possibly empty) of exported packages, or null to export everything since: org.netbeans.core/1 > 1.4 See Also: "#19621" |
getSpecificationVersion | public SpecificationVersion getSpecificationVersion()(Code) | | |
isAutoload | public boolean isAutoload()(Code) | | 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.
See Also: #9779 |
isDeclaredAsFriend | boolean isDeclaredAsFriend(Module module)(Code) | | Checks whether we use friends attribute and if so, then
whether the name of module is listed there.
|
isEager | public boolean isEager()(Code) | | Is this module eagerly enabled?
If so, no information about its state is kept permanently.
It is turned on whenever it can be, i.e. whenever it meets all of
its dependencies. This may be used to implement "bridge" modules with
simple functionality that just depend on two normal modules.
A module may not be simultaneously eager and autoload.
See Also: #17501 since: org.netbeans.core/1 1.3 |
isEnabled | public boolean isEnabled()(Code) | | |
isFixed | abstract public boolean isFixed()(Code) | | Fixed modules are treated differently.
See Also: FixedModule |
isReloadable | public boolean isReloadable()(Code) | | Is this module supposed to be easily reloadable?
If so, it is suitable for testing inside the IDE.
Controls whether a copy of the JAR file is made before
passing it to the classloader, which can affect locking
and refreshing of the JAR.
|
isValid | public boolean isValid()(Code) | | Normally a module once created and managed is valid
(that is, either installed or not, but at least managed).
If it is deleted any remaining references to it become
invalid.
|
parseManifest | protected void parseManifest() throws InvalidException(Code) | | Parse information from the current manifest.
Includes code name, specification version, and dependencies.
If anything is in an invalid format, throws an exception with
some kind of description of the problem.
|
provides | final public boolean provides(String token)(Code) | | Test whether the module provides a given token or not.
since: JST-PENDING again used from NbProblemDisplayer |
releaseManifest | public void releaseManifest()(Code) | | Release memory storage for the JAR manifest, if applicable.
|
reload | abstract public void reload() throws IOException(Code) | | Reload this module. Access from ModuleManager.
If an exception is thrown, the module is considered
to be in an invalid state.
since: JST-PENDING: needed from ModuleSystem |
setEnabled | void setEnabled(boolean enabled)(Code) | | |
setReloadable | abstract public void setReloadable(boolean r)(Code) | | Set whether this module is supposed to be reloadable.
Has no immediate effect, only impacts what happens the
next time it is enabled (after having been disabled if
necessary).
Must be called from within a write mutex.
Parameters: r - whether the module should be considered reloadable |
toString | public String toString()(Code) | | String representation for debugging.
|
|
|