org.openide.modules
Class ModuleDescription

java.lang.Object
  |
  +--org.openide.modules.ModuleDescription

public final class ModuleDescription
extends Object

A description of a module that is constructed from the module's manifest file. This provides a convenient way to parse a manifest file.


Inner Class Summary
static class ModuleDescription.Dependency
          Deprecated. A type of dependency that the module can have on its environment.
static interface ModuleDescription.PackageAccessibleClassLoader
          Deprecated. Interface to permit a couple of methods in ClassLoader to be made public.
 
Field Summary
static String SECTION_ACTION
          Deprecated. "Action" module section.
static String SECTION_CLIPBOARD_CONVERTOR
          Deprecated. "ClipboardConvertor" module section.
static String SECTION_DEBUGGER
          Deprecated. "Debugger" module section.
static String SECTION_FILESYSTEM
          Deprecated. "Filesystem" module section.
static String SECTION_LOADER
          Deprecated. "Loader" module section.
static String SECTION_NODE
          Deprecated. "Node" module section.
static String SECTION_OPTION
          Deprecated. "Option" module section.
static String SECTION_SERVICE
          Deprecated. "Service" module section.
static Attributes.Name TAG_CATEGORY
          Deprecated. Category of module for display purposes.
static Attributes.Name TAG_DESCRIPTION
          Deprecated. Name of an (optional) JavaHelp-style help set.
static Attributes.Name TAG_FILESYSTEM_HELP
          Deprecated. Help resource for a file system.
static Attributes.Name TAG_FILESYSTEM_NAME
          Deprecated. Display name of a file system type.
static Attributes.Name TAG_IDE_DEPENDENCIES
          Deprecated. IDE dependency tag for whole module.
static Attributes.Name TAG_IMPL_VERSION
          Deprecated. Implementation version tag for whole module.
static Attributes.Name TAG_INSTALL_AFTER
          Deprecated. Option to install this loader after another.
static Attributes.Name TAG_INSTALL_BEFORE
          Deprecated. Option to install this loader before another.
static Attributes.Name TAG_JAVA_DEPENDENCIES
          Deprecated. Java dependency tag for whole module.
static Attributes.Name TAG_LAYER
          Deprecated. Name of (optional) XML filesystem layer.
static Attributes.Name TAG_LONG_DESCRIPTION
          Deprecated. Long description of module.
static Attributes.Name TAG_MAGIC
          Deprecated. Global tag for whole module.
static Attributes.Name TAG_MAIN
          Deprecated. Name of (optional) main class.
static Attributes.Name TAG_MODULE_DEPENDENCIES
          Deprecated. Module dependency tag for whole module.
static Attributes.Name TAG_NAME
          Deprecated. Display name of module.
static Attributes.Name TAG_NODE_TYPE
          Deprecated. Option to distingiush between different types of nodes.
static Attributes.Name TAG_PACKAGE_DEPENDENCIES
          Deprecated. Package dependency tag for whole module.
static Attributes.Name TAG_SECTION_CLASS
          Deprecated. Tag for a section.
static Attributes.Name TAG_SERVICE_DEFAULT
          Deprecated. Whether this service should be the default for its category.
static Attributes.Name TAG_SHORT_DESCRIPTION
          Deprecated. Short description of module.
static Attributes.Name TAG_SPEC_VERSION
          Deprecated. Specification version tag for whole module.
 
Constructor Summary
ModuleDescription(File jar)
          Deprecated. Only for testing.
ModuleDescription(String text)
          Deprecated. Only for testing.
ModuleDescription(String name, Manifest man)
          Deprecated. Better to explicitly provide a classloader.
ModuleDescription(String name, Manifest man, ClassLoader cl)
          Deprecated. Create new description from a provided manifest file and classloader.
 
Method Summary
static boolean compatibleWith(String older, String newer)
          Deprecated. Check whether specification versions are compatible.
 Enumeration dependencies()
          Deprecated. Get all dependencies.
 boolean dependsOnModule(ModuleDescription other)
          Deprecated. Check whether this description depends on another module.
 void forEachSection(ManifestSection.Iterator it)
          Deprecated. Iterates over all entries found in the module.
 Set getBadClasses()
          Deprecated. Get a set of classes that were not loaded by the requested classloader.
 ClassLoader getClassLoader()
          Deprecated. Get the classloader used to load this module.
 String getCodeName()
          Deprecated. Get code name of the module.
 String getCodeNameBase()
          Deprecated. Get code name base of the module.
 int getCodeNameRelease()
          Deprecated. Get the major release number of the module code name.
 ModuleDescription.Dependency[] getDependencies()
          Deprecated. Get a list of all dependencies.
 URL getDescription()
          Deprecated. Currently disused in favor of getDescriptionResource()
 String getDescriptionResource()
          Deprecated. Get JavaHelp helpset as a resource path.
 String getDisplayCategory()
          Deprecated. Get the module's display category.
 String getImplVersion()
          Deprecated. Get the implementation version of this module.
 URL getLayer()
          Deprecated. getLayerResource() actually used now
 String getLayerResource()
          Deprecated. Get the resource path to the filesystem layer.
 String getLongDescription()
          Deprecated. Get the module's long description (paragraph-length summary).
 ModuleInstall getModule()
          Deprecated. Get the main hook object of the module (to run hooks from).
 String getName()
          Deprecated. Get display name of the module.
 String getShortDescription()
          Deprecated. Get the module's short description (like a tool tip).
 String getSpecVersion()
          Deprecated. Get the specification version of this module.
 String reasonWhyUnsatisfied(ModuleDescription[] otherModules)
          Deprecated. Check whether this description satisfies all of its dependencies, and if not say why.
static List resolveOrdering(Set modules)
          Deprecated. Resolve the proper ordering of a set of modules.
static List resolveOrderingForRealInstall(Set restored, Set installed)
          Deprecated. Actually generate a list of newly-installable modules in this IDE (but do not install them).
 void setClassLoader(ClassLoader cl)
          Deprecated. Set the classloader used to load this module.
 String toString()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAG_MAGIC

public static final Attributes.Name TAG_MAGIC
Deprecated. 
Global tag for whole module. Identifies the JAR as a module and gives its code name.

TAG_NAME

public static final Attributes.Name TAG_NAME
Deprecated. 
Display name of module. May be localized, e.g. OpenIDE-Module-Name_cs.

TAG_SHORT_DESCRIPTION

public static final Attributes.Name TAG_SHORT_DESCRIPTION
Deprecated. 
Short description of module. May be localized, e.g. OpenIDE-Module-Short-Description_cs.

TAG_LONG_DESCRIPTION

public static final Attributes.Name TAG_LONG_DESCRIPTION
Deprecated. 
Long description of module. May be localized, e.g. OpenIDE-Module-Long-Description_cs.
Since:
1.1.6

TAG_CATEGORY

public static final Attributes.Name TAG_CATEGORY
Deprecated. 
Category of module for display purposes. May be localized, e.g. OpenIDE-Module-Display-Category_cs.

TAG_SPEC_VERSION

public static final Attributes.Name TAG_SPEC_VERSION
Deprecated. 
Specification version tag for whole module. Identifies the specification version of the module.

TAG_IMPL_VERSION

public static final Attributes.Name TAG_IMPL_VERSION
Deprecated. 
Implementation version tag for whole module. Identifies the implementation version of the module.

TAG_MODULE_DEPENDENCIES

public static final Attributes.Name TAG_MODULE_DEPENDENCIES
Deprecated. 
Module dependency tag for whole module. Identifies the modules on which this module depends.

TAG_PACKAGE_DEPENDENCIES

public static final Attributes.Name TAG_PACKAGE_DEPENDENCIES
Deprecated. 
Package dependency tag for whole module. Identifies the package versions on which this module depends.

TAG_JAVA_DEPENDENCIES

public static final Attributes.Name TAG_JAVA_DEPENDENCIES
Deprecated. 
Java dependency tag for whole module. Identifies the Java version on which this module depends.

TAG_IDE_DEPENDENCIES

public static final Attributes.Name TAG_IDE_DEPENDENCIES
Deprecated. 
IDE dependency tag for whole module. Identifies the version of the core IDE on which this module depends.

TAG_MAIN

public static final Attributes.Name TAG_MAIN
Deprecated. 
Name of (optional) main class. Must be public with a no-argument public constructor, and implement ModuleInstall.

TAG_LAYER

public static final Attributes.Name TAG_LAYER
Deprecated. 
Name of (optional) XML filesystem layer. This is given in the global attributes of a module. Should be given as a resource path such as:
org/netbeans/modules/foo/resources/layer.xml
The path will be treated as localizable, so for example the above path may actually load:
org/netbeans/modules/foo/resources/layer_ja.xml

TAG_DESCRIPTION

public static final Attributes.Name TAG_DESCRIPTION
Deprecated. 
Name of an (optional) JavaHelp-style help set. May be localized.

For example, the value org.netbeans.module.Index will look for one of the following, according to locale:

 /org/netbeans/module/Index_cs.html
 /org/netbeans/module/Index.html
 

TAG_SECTION_CLASS

public static final Attributes.Name TAG_SECTION_CLASS
Deprecated. 
Tag for a section. Identifies that the entry is specially treated somehow.

SECTION_ACTION

public static final String SECTION_ACTION
Deprecated. 
"Action" module section.

SECTION_OPTION

public static final String SECTION_OPTION
Deprecated. 
"Option" module section.

SECTION_LOADER

public static final String SECTION_LOADER
Deprecated. 
"Loader" module section.

TAG_INSTALL_BEFORE

public static final Attributes.Name TAG_INSTALL_BEFORE
Deprecated. 
Option to install this loader before another.

TAG_INSTALL_AFTER

public static final Attributes.Name TAG_INSTALL_AFTER
Deprecated. 
Option to install this loader after another.

SECTION_FILESYSTEM

public static final String SECTION_FILESYSTEM
Deprecated. 
"Filesystem" module section.

TAG_FILESYSTEM_NAME

public static final Attributes.Name TAG_FILESYSTEM_NAME
Deprecated. 
Display name of a file system type. Used e.g. in popup menus to add a new instance to the Repository.

TAG_FILESYSTEM_HELP

public static final Attributes.Name TAG_FILESYSTEM_HELP
Deprecated. 
Help resource for a file system.

SECTION_SERVICE

public static final String SECTION_SERVICE
Deprecated. 
"Service" module section.

TAG_SERVICE_DEFAULT

public static final Attributes.Name TAG_SERVICE_DEFAULT
Deprecated. 
Whether this service should be the default for its category.

SECTION_DEBUGGER

public static final String SECTION_DEBUGGER
Deprecated. 
"Debugger" module section.

SECTION_NODE

public static final String SECTION_NODE
Deprecated. 
"Node" module section.

TAG_NODE_TYPE

public static final Attributes.Name TAG_NODE_TYPE
Deprecated. 
Option to distingiush between different types of nodes.

Currently the possible types are Environment, Roots, and Session. If the attribute is missing, Environment is assumed.


SECTION_CLIPBOARD_CONVERTOR

public static final String SECTION_CLIPBOARD_CONVERTOR
Deprecated. 
"ClipboardConvertor" module section.
Constructor Detail

ModuleDescription

public ModuleDescription(String name,
                         Manifest man)
                  throws IllegalModuleException
Deprecated. Better to explicitly provide a classloader.

Create new description from a provided manifest file. It is assumed that the JAR file is already known to the current Repository class loader.
Parameters:
name - name of the JAR file
man - the manifest file within that JAR
Throws:
IllegalModuleException - if there is an error reading the description

ModuleDescription

public ModuleDescription(String name,
                         Manifest man,
                         ClassLoader cl)
                  throws IllegalModuleException
Deprecated. 
Create new description from a provided manifest file and classloader.
Parameters:
name - name of the JAR file
man - the manifest file within that JAR
cl - classloader which should be able to find objects mentioned in the manifest; if null, must be set later with setClassLoader(java.lang.ClassLoader)
Throws:
IllegalModuleException - if there is an error reading the description

ModuleDescription

public ModuleDescription(File jar)
                  throws IllegalModuleException,
                         IOException
Deprecated. Only for testing.

Create new description from a fixed JAR file on disk (for testing). This constructor may be conveniently used to test parsing of a module JAR, as well as testing cross-dependencies and so on. Both the Repository and the JAR itself will be searched for classes.
Parameters:
jar - the JAR file
Throws:
IllegalModuleException - if there is an error reading the description
IOException - if the JAR file could not be opened or read

ModuleDescription

public ModuleDescription(String text)
                  throws IllegalModuleException,
                         IOException
Deprecated. Only for testing.

Create new description from a string (for testing). This constructor may be conveniently used to test parsing of a module JAR, as well as testing cross-dependencies and so on. The Repository will be searched for classes.
Parameters:
text - the full text of the manifest file
Throws:
IllegalModuleException - if there is an error reading the description
IOException - should not be thrown
Method Detail

getName

public String getName()
Deprecated. 
Get display name of the module.
Returns:
the name
See Also:
TAG_NAME

getShortDescription

public String getShortDescription()
Deprecated. 
Get the module's short description (like a tool tip).
Returns:
the short description, or null if unspecified
See Also:
TAG_SHORT_DESCRIPTION

getLongDescription

public String getLongDescription()
Deprecated. 
Get the module's long description (paragraph-length summary).
Returns:
the long description, or null if unspecified
Since:
1.1.6
See Also:
TAG_LONG_DESCRIPTION

getDisplayCategory

public String getDisplayCategory()
Deprecated. 
Get the module's display category.
Returns:
the display category, or null if unspecified
See Also:
TAG_CATEGORY

getCodeName

public String getCodeName()
Deprecated. 
Get code name of the module.
Returns:
the code name (should not normally change between releases except to indicate incompatible changes)
See Also:
TAG_MAGIC

getCodeNameBase

public String getCodeNameBase()
Deprecated. 
Get code name base of the module. E.g. for the code name foo/3, this would give foo.
Returns:
the code name base (should not change between releases)
See Also:
getCodeName()

getCodeNameRelease

public int getCodeNameRelease()
Deprecated. 
Get the major release number of the module code name. E.g. for the code name foo/3, this would give 3.
Returns:
the release number (should change between releases to indicate incompatible changes), or -1 if unspecified
See Also:
getCodeName()

getClassLoader

public ClassLoader getClassLoader()
Deprecated. 
Get the classloader used to load this module.
Returns:
its classloader

setClassLoader

public void setClassLoader(ClassLoader cl)
Deprecated. 
Set the classloader used to load this module. May be null, in which case resources associated with this module are cleared; before attempting to load anything again, the loader must be set back to something.
Parameters:
cl - the classloader

getBadClasses

public Set getBadClasses()
Deprecated. 
Get a set of classes that were not loaded by the requested classloader.
Returns:
a set of Class
See Also:
getClassLoader()

getModule

public ModuleInstall getModule()
Deprecated. 
Get the main hook object of the module (to run hooks from). If the module did not specify a main class, a dummy will be returned instead.
Returns:
main object of the module
See Also:
TAG_MAIN

getLayer

public URL getLayer()
Deprecated. getLayerResource() actually used now

Get the filesystem layer. If non-null, will be a pointer to an XML filesystem which should be added by the module as a project layer.
Returns:
a URL to the layer, or null if none was specified

getLayerResource

public String getLayerResource()
Deprecated. 
Get the resource path to the filesystem layer.
Returns:
the resource path, or null

getDescription

public URL getDescription()
Deprecated. Currently disused in favor of getDescriptionResource()

Get a URL to a page describing the module.
Returns:
the URL of a JavaHelp HelpSet file, or null if the module did not specify a description
Throws:
IllegalStateException - if the tag is specified but the HelpSet file was not found
See Also:
TAG_DESCRIPTION

getDescriptionResource

public String getDescriptionResource()
Deprecated. 
Get JavaHelp helpset as a resource path. This returns a resource path to the base-locale helpset.
Returns:
the path to the helpset, or null if no helpset was specified

forEachSection

public void forEachSection(ManifestSection.Iterator it)
Deprecated. 
Iterates over all entries found in the module. It sends all the entries to the provided iterator's callback methods.
Parameters:
it - iterator over all sections

dependencies

public Enumeration dependencies()
Deprecated. 
Get all dependencies.
Returns:
an enumeration of ModuleDescription.Dependencys
See Also:
getDependencies()

getDependencies

public ModuleDescription.Dependency[] getDependencies()
Deprecated. 
Get a list of all dependencies.
Returns:
the dependencies
See Also:
dependencies()

getSpecVersion

public String getSpecVersion()
Deprecated. 
Get the specification version of this module.
Returns:
the spec version, or null
See Also:
TAG_SPEC_VERSION

getImplVersion

public String getImplVersion()
Deprecated. 
Get the implementation version of this module.
Returns:
the impl version, or null
See Also:
TAG_IMPL_VERSION

reasonWhyUnsatisfied

public String reasonWhyUnsatisfied(ModuleDescription[] otherModules)
                            throws IllegalModuleException
Deprecated. 
Check whether this description satisfies all of its dependencies, and if not say why.
Parameters:
otherModules - other modules which this module might require
Returns:
null if satisfied, else text explaining why it was not
See Also:
ModuleDescription.Dependency.checkForMiss(org.openide.modules.ModuleDescription[])

dependsOnModule

public boolean dependsOnModule(ModuleDescription other)
Deprecated. 
Check whether this description depends on another module. This does not check whether the dependency is fully satisfied (i.e. the versions match); it only checks whether there is some sort of dependency or not. Also note that implicit dependencies within sections, e.g. the implicit dependency one module may have on another based on loader pool installation or whatnot, is not considered at all. Modules are considered to depend on themselves.
Parameters:
other - the other module to compare to
Returns:
true if this module states that it depends on the other in its dependency list, false if it makes no such statement
See Also:
TAG_MODULE_DEPENDENCIES

toString

public String toString()
Deprecated. 
Overrides:
toString in class Object

resolveOrdering

public static List resolveOrdering(Set modules)
                            throws IllegalModuleException
Deprecated. 
Resolve the proper ordering of a set of modules. Checks the dependencies among the modules and attempts to order them according to a topological sort based on cross-dependencies. Where the ordering is not otherwise specified, orders modules alphabetically based on code name.
Parameters:
modules - a set of ModuleDescriptions to be installed
Returns:
a list of the same ModuleDescriptions in the order in which they should be installed
Throws:
IllegalModuleException - if the ordering cannot be resolved (for example, due to a cyclic dependency)
See Also:
dependsOnModule(org.openide.modules.ModuleDescription)

resolveOrderingForRealInstall

public static List resolveOrderingForRealInstall(Set restored,
                                                 Set installed)
                                          throws IllegalModuleException
Deprecated. 
Actually generate a list of newly-installable modules in this IDE (but do not install them). Checks all of their dependencies, and orders them properly. If any are missing dependencies, they are removed from the set (after notifying the user), and the remainder are reexamined in case other modules are now missing a dependency. They are ordered in the normal fashion. If there are exceptions in any calculations (not just missed dependencies), these are propagated without any attempt at further error recovery.
Parameters:
restored - a set of ModuleDescriptions for already-installed modules which should have already been restored
installed - a set of ModuleDescriptions for modules which are intended for installation and may be returned
Returns:
a (possibly empty) list of ModuleDescriptions for modules which may be installed, in the order in which they should be installed; will be a subset of installed
Throws:
IllegalModuleException - if any problem is encountered other than missed dependencies

compatibleWith

public static boolean compatibleWith(String older,
                                     String newer)
                              throws IllegalModuleException
Deprecated. 
Check whether specification versions are compatible. True if older version is less-than-or-equal-to newer version acc. to a Dewey-decimal lexicographic compare.

This algorithm should hopefully match that used by the Java Versioning specification (which unfortunately does not make its algorithm public).

Parameters:
older - the presumed older version
newer - the presumed newer version
Throws:
IllegalModuleException - in case of a number format error
See Also:
Package


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.