|
OSGi™ Core Release 6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@ProviderType public interface Framework
A Framework instance. A Framework is also known as a System Bundle.
Framework instances are created using a FrameworkFactory
. The methods
of this interface can be used to manage and control the created framework
instance.
Field Summary |
---|
Fields inherited from interface org.osgi.framework.Bundle |
---|
ACTIVE, INSTALLED, RESOLVED, SIGNERS_ALL, SIGNERS_TRUSTED, START_ACTIVATION_POLICY, START_TRANSIENT, STARTING, STOP_TRANSIENT, STOPPING, UNINSTALLED |
Method Summary | ||
---|---|---|
|
adapt(Class<A> type)
Adapt this Framework to the specified type. |
|
Enumeration<URL> |
findEntries(String path,
String filePattern,
boolean recurse)
Returns null as a framework implementation does not have a proper
bundle from which to return entries. |
|
long |
getBundleId()
Returns the Framework unique identifier. |
|
URL |
getEntry(String path)
Returns null as a framework implementation does not have a proper
bundle from which to return an entry. |
|
Enumeration<String> |
getEntryPaths(String path)
Returns null as a framework implementation does not have a proper
bundle from which to return entry paths. |
|
long |
getLastModified()
Returns the time when the set of bundles in this framework was last modified. |
|
String |
getLocation()
Returns the Framework location identifier. |
|
String |
getSymbolicName()
Returns the symbolic name of this Framework. |
|
void |
init()
Initialize this Framework. |
|
void |
init(FrameworkListener... listeners)
Initialize this Framework. |
|
void |
start()
Start this Framework. |
|
void |
start(int options)
Start this Framework. |
|
void |
stop()
Stop this Framework. |
|
void |
stop(int options)
Stop this Framework. |
|
void |
uninstall()
The Framework cannot be uninstalled. |
|
void |
update()
Stop and restart this Framework. |
|
void |
update(InputStream in)
Stop and restart this Framework. |
|
FrameworkEvent |
waitForStop(long timeout)
Wait until this Framework has completely stopped. |
Methods inherited from interface org.osgi.framework.Bundle |
---|
getBundleContext, getDataFile, getHeaders, getHeaders, getRegisteredServices, getResource, getResources, getServicesInUse, getSignerCertificates, getState, getVersion, hasPermission, loadClass |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Method Detail |
---|
void init() throws BundleException
This method performs the same function as calling
init(FrameworkListener...)
with no framework listeners.
BundleException
- If this Framework could not be initialized.
SecurityException
- If the Java Runtime Environment supports
permissions and the caller does not have the appropriate
AdminPermission[this,EXECUTE]
or if there is a security
manager already installed and the
Constants.FRAMEWORK_SECURITY
configuration property is
set.init(FrameworkListener...)
void init(FrameworkListener... listeners) throws BundleException
framework UUID
.
Bundle.STARTING
state.ConditionalPermissionAdmin
.adaptable
to the OSGi defined types to which
a system bundle can be adapted.start
method of the extension bundle
activator for all resolved extension bundles.
This Framework will not actually be started until start
is called.
This method does nothing if called when this Framework is in the
Bundle.STARTING
, Bundle.ACTIVE
or Bundle.STOPPING
states.
All framework events fired by this method method are also delivered to the specified FrameworkListeners in the order they are specified before returning from this method. After returning from this method the specified listeners are no longer notified of framework events.
listeners
- Zero or more listeners to be notified when framework
events occur while initializing the framework. The specified
listeners do not need to be otherwise registered with the
framework. If a specified listener is registered with the
framework, it will be notified twice for each framework event.
BundleException
- If this Framework could not be initialized.
SecurityException
- If the Java Runtime Environment supports
permissions and the caller does not have the appropriate
AdminPermission[this,EXECUTE]
or if there is a security
manager already installed and the
Constants.FRAMEWORK_SECURITY
configuration property is
set.FrameworkEvent waitForStop(long timeout) throws InterruptedException
stop
and
update
methods on a Framework performs an asynchronous stop of
the Framework. This method can be used to wait until the asynchronous
stop of this Framework has completed. This method will only wait if
called when this Framework 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 Framework has stopped.
timeout
- Maximum number of milliseconds to wait until this
Framework has completely stopped. A value of zero will wait
indefinitely.
FrameworkEvent
types may be returned by this
method.
STOPPED
- This Framework has
been stopped. STOPPED_UPDATE
- This
Framework has been updated which has shutdown and will now
restart.STOPPED_BOOTCLASSPATH_MODIFIED
- This Framework has been stopped
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 effect. ERROR
- The Framework
encountered an error while shutting down or an error has occurred
which forced the framework to shutdown. WAIT_TIMEDOUT
- This
method has timed out and returned before this Framework has
stopped.InterruptedException
- If another thread interrupted the current
thread before or while the current thread was waiting for this
Framework 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 Framework:
Bundle.STARTING
state,
initialize
this Framework.beginning start
level
framework property, as described in the Start Level
Specification. If this framework property is not specified, then the
start level of this Framework is moved to start level one (1). Any
exceptions that occur during bundle starting must be wrapped in a
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 Framework 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 Framework.
start
in interface Bundle
options
- Ignored. There are no start options for the Framework.
BundleException
- If this Framework 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 Framework may be discarded, initialized or started.
stop
in interface Bundle
BundleException
- If stopping this Framework 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 Framework.
stop
in interface Bundle
options
- Ignored. There are no stop options for the Framework.
BundleException
- If stopping this Framework 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 Framework cannot be uninstalled.
SecurityException
- If the caller does not have the appropriate
AdminPermission[this,LIFECYCLE]
, and the Java Runtime
Environment supports permissions.Bundle.stop()
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
Framework.start()
method to start this
Framework.
update
in interface Bundle
BundleException
- If stopping and restarting this Framework could
not be initiated.
SecurityException
- If the caller does not have the appropriate
AdminPermission[this,LIFECYCLE]
, and the Java Runtime
Environment supports permissions.Bundle.update(InputStream)
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 Framework could
not be initiated.
SecurityException
- If the caller does not have the appropriate
AdminPermission[this,LIFECYCLE]
, and the Java Runtime
Environment supports permissions.Bundle.stop()
,
Bundle.start()
long getBundleId()
getBundleId
in interface Bundle
Bundle.getBundleId()
String getLocation()
System Bundle
" since this Framework is
also a System Bundle.
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 since this Framework is also a
System Bundle.
getSymbolicName
in interface Bundle
Bundle.getSymbolicName()
,
Constants.SYSTEM_BUNDLE_SYMBOLICNAME
Enumeration<String> getEntryPaths(String path)
null
as a framework implementation does not have a proper
bundle from which to return entry paths.
getEntryPaths
in interface Bundle
path
- Ignored.
null
as a framework implementation does not have a proper
bundle from which to return entry paths.URL getEntry(String path)
null
as a framework implementation does not have a proper
bundle from which to return an entry.
getEntry
in interface Bundle
path
- Ignored.
null
as a framework implementation does not have a proper
bundle from which to return an entry.long getLastModified()
The time value is the number of milliseconds since January 1, 1970, 00:00:00 UTC.
getLastModified
in interface Bundle
Enumeration<URL> findEntries(String path, String filePattern, boolean recurse)
null
as a framework implementation does not have a proper
bundle from which to return entries.
findEntries
in interface Bundle
path
- Ignored.filePattern
- Ignored.recurse
- Ignored.
null
as a framework implementation does not have a proper
bundle from which to return entries.<A> A adapt(Class<A> type)
Adapting this Framework to the specified type may require certain checks,
including security checks, to succeed. If a check does not succeed, then
this Framework cannot be adapted and null
is returned. If this
Framework is not initialized
, then null
is
returned if the specified type is one of the OSGi defined types to which
a system bundle can be adapted.
adapt
in interface Bundle
A
- The type to which this Framework is to be adapted.type
- Class object for the type to which this Framework is to be
adapted.
null
if this Framework cannot be adapted
|
OSGi™ Core Release 6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |