org.apache.felix.moduleloader
Interface IWire
- All Known Implementing Classes:
- R4Wire, R4WireModule
public interface IWire
This interface represents a directed class/resource loading dependency
between two modules, which result when the framework resolves
Import-Package or Require-Bundle declarations. A wire is
the means by which a dependent module makes a class/resource request on
the providing module.
Method Summary |
ICapability |
getCapability()
Returns the associated capability from the exporting module that
satisfies the requirement of the importing module. |
Class |
getClass(String name)
Requests a class from the exporting module. |
IModule |
getExporter()
Returns the exporting module. |
IModule |
getImporter()
Returns the importing module. |
IRequirement |
getRequirement()
Returns the associated requirement from the importing module that
resulted in the creation of this wire. |
URL |
getResource(String name)
Requests a resource from the exporting module. |
Enumeration |
getResources(String name)
Requests resources from the exporting module. |
boolean |
hasPackage(String pkgName)
Returns whether or not the wire has a given package name. |
getImporter
IModule getImporter()
- Returns the importing module.
- Returns:
- The importing module.
getRequirement
IRequirement getRequirement()
- Returns the associated requirement from the importing module that
resulted in the creation of this wire.
- Returns:
getExporter
IModule getExporter()
- Returns the exporting module.
- Returns:
- The exporting module.
getCapability
ICapability getCapability()
- Returns the associated capability from the exporting module that
satisfies the requirement of the importing module.
- Returns:
hasPackage
boolean hasPackage(String pkgName)
- Returns whether or not the wire has a given package name. For some
wires, such as ones for Require-Bundle, there may be many packages.
This method is necessary since the set of packages attained by wires
restrict which packages can be dynamically imported (i.e., you cannot
dynamically import a package that is already attainable from an
existing wire).
- Returns:
- true if the package name is attainable from this wire,
false otherwise.
getClass
Class getClass(String name)
throws ClassNotFoundException
- Requests a class from the exporting module. If the class is found, then
it is returned. If the class is not found, then this method may or may
not throw an exception depending on the wire type (e.g., for an
imported package or a required bundle). Throwing an exception indicates
that the search should be aborted, while returning a null
indicates that the search should continue.
- Returns:
- The class if found or null if not found and the search
should continue.
- Throws:
ClassNotFoundException
- If the class was not found and
the search should be aborted.
getResource
URL getResource(String name)
throws ResourceNotFoundException
- Requests a resource from the exporting module. If the resource is found,
then an URL is returned. If the resource is not found, then this method may
or may not throw an exception depending on the wire type (e.g., for an
imported package or a required bundle). Throwing an exception indicates
that the search should be aborted, while returning a null
indicates that the search should continue.
- Returns:
- An URL to the resource if found or null if not found
and the search should continue.
- Throws:
ResourceNotFoundException
- If the resource was not found and
the search should be aborted.
getResources
Enumeration getResources(String name)
throws ResourceNotFoundException
- Requests resources from the exporting module. If the resources are found,
then an enumeration of URLs is returned. If the resources are not found,
then this method may or may not throw an exception depending on the wire
type (e.g., for an imported package or a required bundle). Throwing an
exception indicates that the search should be aborted, while returning a
null indicates that the search should continue.
- Returns:
- An enumeration of URLs for the resource if found or null
if not found and the search should continue.
- Throws:
ResourceNotFoundException
- If the resource was not found and
the search should be aborted.