|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Framework
The System Bundle for a Framework instance. The main class of a framework implementation must implement this interface. The instantiator of the framework implementation class then has a System Bundle object and can then use the methods of this interface to manage and control the created framework instance.
The main class of a framework implementation must provide a public
constructor that takes a single argument of type Map
. This
configuration argument provides this System Bundle with framework properties
to configure the framework instance. The framework instance must also examine
the system properties for framework properties which are not set in the
configuration argument. A framework property in the configuration argument
with a null
value indicates the framework property is
unset and the system properties must not be examined for a value of
the framework property. This allows the configuration argument to
unset framework properties in the system properties .
If framework properties are not provided by the configuration argument or the
system properties, this System Bundle must use some reasonable default
configuration appropriate for the current VM. For example, the system
packages for the current execution environment should be properly exported.
The configuration argument may be null
. The framework instance
must copy any information needed from the configuration argument since the
configuration argument can be changed after the framework instance has been
created.
A newly constructed System Bundle must be in the Bundle.INSTALLED
state.
Field Summary |
---|
Fields inherited from interface org.osgi.framework.Bundle |
---|
ACTIVE, INSTALLED, RESOLVED, START_ACTIVATION_POLICY, START_TRANSIENT, STARTING, STOP_TRANSIENT, STOPPING, UNINSTALLED |
Method Summary | |
---|---|
long |
getBundleId()
Returns the System Bundle unique identifier. |
String |
getLocation()
Returns the System Bundle location identifier. |
String |
getSymbolicName()
Returns the symbolic name of this System Bundle. |
void |
init()
Initialize this System Bundle. |
void |
start()
Start this System Bundle. |
void |
start(int options)
Start this System Bundle. |
void |
stop()
Stop this System Bundle. |
void |
stop(int options)
Stop this System Bundle. |
void |
uninstall()
The System Bundle cannot be uninstalled. |
void |
update()
Stop and restart this System Bundle. |
void |
update(InputStream in)
Stop and restart this System Bundle. |
FrameworkEvent |
waitForStop(long timeout)
Wait until this System Bundle has completely stopped. |
Methods inherited from interface org.osgi.framework.Bundle |
---|
findEntries, getBundleContext, getEntry, getEntryPaths, getHeaders, getHeaders, getLastModified, getRegisteredServices, getResource, getResources, getServicesInUse, getState, hasPermission, loadClass |
Method Detail |
---|
void init() throws BundleException
Bundle.STARTING
state.PackageAdmin
,
ConditionalPermissionAdmin
, StartLevel
.
This System Bundle will not actually be started until start
is called.
This method does nothing if called when this System Bundle is in the
Bundle.STARTING
, Bundle.ACTIVE
or Bundle.STOPPING
states.
BundleException
- If this System Bundle could not be initialized.FrameworkEvent waitForStop(long timeout) throws InterruptedException
stop
and update
methods on a System Bundle
performs an asynchronous stop of the System Bundle. This method can be
used to wait until the asynchronous stop of this System Bundle has
completed. This method will only wait if called when this System Bundle
is in the Bundle.STARTING
, Bundle.ACTIVE
, or Bundle.STOPPING
states. Otherwise it will return immediately.
A Framework Event is returned to indicate why this System Bundle has stopped.
timeout
- Maximum number of milliseconds to wait until this System
Bundle has completely stopped. A value of zero will wait
indefinitely.
FrameworkEvent
types may be returned by
this method.
STOPPED
- This System Bundle
has been stopped which has shutdown its framework instance. STOPPED_UPDATE
- This
System Bundle has been updated which has shutdown and will
restart its framework instance.STOPPED_BOOTCLASSPATH_MODIFIED
- This System Bundle has been
stopped which has shutdown its framework instance and a
bootclasspath extension bundle has been installed or updated. The
VM must be restarted in order for the changed boot class path to
take affect. ERROR
- The
Framework encountered an error while shutting down or an error
has occurred which forced the framework to shutdown. INFO
- This method has timed out and
returned before this System Bundle has stopped.InterruptedException
- If another thread interrupted the current
thread before or while the current thread was waiting for this
System Bundle to completely stop. The interrupted status
of the current thread is cleared when this exception is thrown.
IllegalArgumentException
- If the value of timeout is negative.void start() throws BundleException
The following steps are taken to start this System Bundle:
Bundle.STARTING
state,
initialize
this System Bundle.beginning start level
framework property, as described in the Start Level Service
Specification. If this framework property is not specified, then the
start level of this System Bundle's framework instance is moved to start
level one (1).BundleException
and then published as a framework event of type
FrameworkEvent.ERROR
Bundle.ACTIVE
.FrameworkEvent.STARTED
is fired
start
in interface Bundle
BundleException
- If this System Bundle could not be started.
SecurityException
- If the caller does not have the
appropriate AdminPermission[this,EXECUTE]
, and the
Java Runtime Environment supports permissions.void start(int options) throws BundleException
Calling this method is the same as calling start()
. There are no
start options for the System Bundle.
start
in interface Bundle
options
- Ignored. There are no start options for the System Bundle.
BundleException
- If this System Bundle could not be started.
SecurityException
- If the caller does not have the
appropriate AdminPermission[this,EXECUTE]
, and the
Java Runtime Environment supports permissions.start()
void stop() throws BundleException
The method returns immediately to the caller after initiating the following steps to be taken on another thread.
Bundle.STOPPING
.BundleException
and then published as a framework event of type
FrameworkEvent.ERROR
Bundle.RESOLVED
.waitForStop
that the stop operation has completed.After being stopped, this System Bundle may be discarded, initialized or started.
stop
in interface Bundle
BundleException
- If stopping this System Bundle could not be
initiated.
SecurityException
- If the caller does not have the
appropriate AdminPermission[this,EXECUTE]
, and the
Java Runtime Environment supports permissions.void stop(int options) throws BundleException
Calling this method is the same as calling stop()
. There are no
stop options for the System Bundle.
stop
in interface Bundle
options
- Ignored. There are no stop options for the System Bundle.
BundleException
- If stopping this System Bundle could not be
initiated.
SecurityException
- If the caller does not have the
appropriate AdminPermission[this,EXECUTE]
, and the
Java Runtime Environment supports permissions.stop()
void uninstall() throws BundleException
This method always throws a BundleException.
uninstall
in interface Bundle
BundleException
- This System Bundle cannot be uninstalled.
SecurityException
- If the caller does not have the
appropriate AdminPermission[this,LIFECYCLE]
, and the
Java Runtime Environment supports permissions.void update() throws BundleException
The method returns immediately to the caller after initiating the following steps to be taken on another thread.
stop()
method to stop this System
Bundle.start()
method to start this System
Bundle.
update
in interface Bundle
BundleException
- If stopping and restarting this System Bundle
could not be initiated.
SecurityException
- If the caller does not have the
appropriate AdminPermission[this,LIFECYCLE]
, and the
Java Runtime Environment supports permissions.void update(InputStream in) throws BundleException
Calling this method is the same as calling update()
except that
any provided InputStream is immediately closed.
update
in interface Bundle
in
- Any provided InputStream is immediately closed before returning
from this method and otherwise ignored.
BundleException
- If stopping and restarting this System Bundle
could not be initiated.
SecurityException
- If the caller does not have the
appropriate AdminPermission[this,LIFECYCLE]
, and the
Java Runtime Environment supports permissions.long getBundleId()
getBundleId
in interface Bundle
Bundle.getBundleId()
String getLocation()
getLocation
in interface Bundle
System Bundle
".
SecurityException
- If the caller does not have the
appropriate AdminPermission[this,METADATA]
, and the
Java Runtime Environment supports permissions.Bundle.getLocation()
,
Constants.SYSTEM_BUNDLE_LOCATION
String getSymbolicName()
system.bundle
" must be recognized as an
alias to the implementation-defined symbolic name.
getSymbolicName
in interface Bundle
Bundle.getSymbolicName()
,
Constants.SYSTEM_BUNDLE_SYMBOLICNAME
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |