Java Reference
In-Depth Information
Dictionary getHeaders();
Dictionary getHeaders(String locale);
URL getEntry(String path);
Enumeration getEntryPaths(String path);
Enumeration findEntries(String path, String pattern, boolean recurse);
URL getResource(String name);
Enumeration getResources(String name) throws IOException;
Class loadClass(String name) throws ClassNotFoundException;
Map getSignerCertificates(int signersType);
void start() throws BundleException;
void start(int options) throws BundleException;
void stop() throws BundleException;
void stop(int options) throws BundleException;
void update() throws BundleException;
void update(InputStream input) throws BundleException;
void uninstall() throws BundleException;
int getState();
BundleContext getBundleContext();
long getBundleId();
String getLocation();
long getLastModified();
ServiceReference[] getRegisteredServices();
ServiceReference[] getServicesInUse();
boolean hasPermission(Object permission);
}
Although this provides an internal framework
API
for other bundles, it doesn't help
externally when you want to create and start framework instances. When the R4.2
specification looked to address this situation, the logical place to start was with the
Bundle
interface. This was a good starting point, but it wasn't completely sufficient. To
address the missing pieces, the R4.2 specification defines a new
Bundle
subtype, called
Framework
, which is captured in the following snippet:
Content-access
methods
Lifecycle-
control
methods
Execution-time state- and
context-access methods
public interface Framework extends Bundle {
void init() throws BundleException;
FrameworkEvent waitForStop(long timeout) throws InterruptedException;
}
All R4.2-compliant framework implementations implement the
Framework
interface.
Because it extends
Bundle
, this means framework implementations now look like a
bundle externally as well as internally via the system bundle.
NOTE
Although this new
API
represents the framework instance inter-
nally and externally as a
Bundle
object, the specification doesn't require
the internal system bundle object to be the same object as the external
Framework
object. Whether this is or isn't the case depends on the frame-
work implementation.
As you can see, the
Framework
interface is a simple extension, so you don't have too
much new
API
to learn. In the following subsections, we'll fully explore how to use this
API
to configure, create, and control framework implementations in a standard way.