bactivator, bundleContext, bundleDir, generations, operation
ACTIVE, INSTALLED, RESOLVED, SIGNERS_ALL, SIGNERS_TRUSTED, START_ACTIVATION_POLICY, START_TRANSIENT, STARTING, STOP_TRANSIENT, STOPPING, UNINSTALLED
Modifier and Type | Method and Description |
---|---|
<A> A |
adapt(java.lang.Class<A> type)
Adapt this bundle to the specified type.
|
java.util.Enumeration<java.net.URL> |
findEntries(java.lang.String path,
java.lang.String filePattern,
boolean recurse)
Get bundle data.
|
java.net.URL |
getEntry(java.lang.String name)
Returns a URL to the entry at the specified path in this bundle.
|
java.util.Enumeration<java.lang.String> |
getEntryPaths(java.lang.String path)
Returns an Enumeration of all the paths (
String objects) to
entries within this bundle whose longest sub-path matches the specified
path. |
java.util.Dictionary<java.lang.String,java.lang.String> |
getHeaders()
Get header data.
|
java.util.Dictionary<java.lang.String,java.lang.String> |
getHeaders(java.lang.String locale)
Get header data.
|
boolean |
hasPermission(java.lang.Object permission)
The system has all the permissions.
|
void |
init()
Initialize this framework.
|
void |
start(int options)
Start this framework.
|
void |
stop(int options)
Stop this framework.
|
void |
uninstall()
Uninstall of framework are not allowed.
|
void |
update(java.io.InputStream in)
Restart this framework.
|
FrameworkEvent |
waitForStop(long timeout)
Wait until this Framework has completely stopped.
|
compareTo, getBundleContext, getBundleId, getDataFile, getLastModified, getLocation, getRegisteredServices, getResource, getResources, getServicesInUse, getSignerCertificates, getState, getSymbolicName, getVersion, loadClass, start, stop, toString, update
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBundleId, getLocation, getSymbolicName, start, stop, update
getBundleContext, getDataFile, getLastModified, getRegisteredServices, getResource, getResources, getServicesInUse, getSignerCertificates, getState, getVersion, loadClass
public void init() throws BundleException
init
in interface Framework
BundleException
- If this Framework could not be initialized.org.osgi.framework.Framework#init
public void start(int options) throws BundleException
start
in interface Bundle
start
in interface Framework
start
in class BundleImpl
options
- The options for starting this bundle. See
Bundle.START_TRANSIENT
and Bundle.START_ACTIVATION_POLICY
. The
Framework must ignore unrecognized options.BundleException
- If this bundle could not be started.
BundleException types thrown by this method include:
BundleException.START_TRANSIENT_ERROR
,
BundleException.NATIVECODE_ERROR
,
BundleException.RESOLVE_ERROR
,
BundleException.STATECHANGE_ERROR
, and
BundleException.ACTIVATOR_ERROR
.org.osgi.framework.Framework#start
public FrameworkEvent waitForStop(long timeout) throws java.lang.InterruptedException
Framework
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.
waitForStop
in interface Framework
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.java.lang.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.public void stop(int options) throws BundleException
stop
in interface Bundle
stop
in interface Framework
stop
in class BundleImpl
options
- The options for stopping this bundle. See
Bundle.STOP_TRANSIENT
. The Framework must ignore unrecognized
options.BundleException
- BundleException types thrown by this method
include: BundleException.STATECHANGE_ERROR
and
BundleException.ACTIVATOR_ERROR
.org.osgi.framework.Framework#stop
public void update(java.io.InputStream in) throws BundleException
update
in interface Bundle
update
in interface Framework
update
in class BundleImpl
in
- The InputStream
from which to read the new bundle or
null
to indicate the Framework must create the input
stream from this bundle's Bundle-UpdateLocation
Manifest header, if present, or this
bundle's original location. The input stream must always be closed
when this method completes, even if an exception is thrown.BundleException
- If this bundle could not be updated.
BundleException types thrown by this method include:
BundleException.READ_ERROR
,
BundleException.DUPLICATE_BUNDLE_ERROR
,
BundleException.MANIFEST_ERROR
,
BundleException.NATIVECODE_ERROR
,
BundleException.RESOLVE_ERROR
,
BundleException.STATECHANGE_ERROR
, and
BundleException.ACTIVATOR_ERROR
.org.osgi.framework.Framework#update
public void uninstall() throws BundleException
uninstall
in interface Bundle
uninstall
in interface Framework
uninstall
in class BundleImpl
BundleException
- If the uninstall failed. This can occur if
another thread is attempting to change this bundle's state and
does not complete in a timely manner. BundleException types
thrown by this method include:
BundleException.STATECHANGE_ERROR
org.osgi.framework.Framework#uninstall
public boolean hasPermission(java.lang.Object permission)
hasPermission
in interface Bundle
hasPermission
in class BundleImpl
permission
- The permission to verify.true
if this bundle has the specified permission or the
permissions possessed by this bundle imply the specified
permission; false
if this bundle does not have the
specified permission or permission
is not an
instanceof
java.security.Permission
.Bundle.hasPermission(java.lang.Object)
public java.util.Dictionary<java.lang.String,java.lang.String> getHeaders()
getHeaders
in interface Bundle
getHeaders
in class BundleImpl
Dictionary
object containing this
bundle's Manifest headers and values.Bundle.getHeaders()
public java.util.Dictionary<java.lang.String,java.lang.String> getHeaders(java.lang.String locale)
getHeaders
in interface Bundle
getHeaders
in class BundleImpl
locale
- The locale name into which the header values are to be
localized. If the specified locale is null
then the locale
returned by java.util.Locale.getDefault
is used. If the
specified locale is the empty string, this method will return the
raw (unlocalized) manifest headers including any leading
"%".Dictionary
object containing this
bundle's Manifest headers and values.Bundle.getHeaders()
public java.util.Enumeration<java.net.URL> findEntries(java.lang.String path, java.lang.String filePattern, boolean recurse)
findEntries
in interface Bundle
findEntries
in interface Framework
findEntries
in class BundleImpl
path
- The path name in which to look. The path is always relative
to the root of this bundle and may begin with "/". A
path value of "/" indicates the root of this bundle.filePattern
- The file name pattern for selecting entries in the
specified path. The pattern is only matched against the last
element of the entry path. If the entry is a directory then the
trailing "/" is not used for pattern matching. Substring
matching is supported, as specified in the Filter specification,
using the wildcard character ("*"). If null is
specified, this is equivalent to "*" and matches all
files.recurse
- If true
, recurse into subdirectories. Otherwise
only return entries from the specified path.null
if no matching entry could be found or if the caller
does not have the appropriate
AdminPermission[this,RESOURCE]
, and the Java Runtime
Environment supports permissions. The URLs are sorted such that
entries from this bundle are returned first followed by the
entries from attached fragments in attachment order. If this
bundle is a fragment, then only matching entries in this fragment
are returned.Bundle.findEntries(java.lang.String, java.lang.String, boolean)
public java.net.URL getEntry(java.lang.String name)
Bundle
The specified path is always relative to the root of this bundle and may begin with "/". A path value of "/" indicates the root of this bundle.
Note: Jar and zip files are not required to include directory entries. URLs to directory entries will not be returned if the bundle contents do not contain directory entries.
getEntry
in interface Bundle
getEntry
in interface Framework
getEntry
in class BundleImpl
name
- The path name of the entry.null
if no entry could be found or
if the caller does not have the appropriate
AdminPermission[this,RESOURCE]
and the Java Runtime
Environment supports permissions.public java.util.Enumeration<java.lang.String> getEntryPaths(java.lang.String path)
Bundle
String
objects) to
entries within this bundle whose longest sub-path matches the specified
path. This bundle's class loader is not used to search for entries. Only
the contents of this bundle are searched.
The specified path is always relative to the root of this bundle and may begin with a "/". A path value of "/" indicates the root of this bundle.
Returned paths indicating subdirectory paths end with a "/". The returned paths are all relative to the root of this bundle and must not begin with "/".
Note: Jar and zip files are not required to include directory entries. Paths to directory entries will not be returned if the bundle contents do not contain directory entries.
getEntryPaths
in interface Bundle
getEntryPaths
in interface Framework
getEntryPaths
in class BundleImpl
path
- The path name for which to return entry paths.String
objects) or
null
if no entry could be found or if the caller does not
have the appropriate AdminPermission[this,RESOURCE]
and
the Java Runtime Environment supports permissions.public <A> A adapt(java.lang.Class<A> type)
Bundle
Adapting this bundle to the specified type may require certain checks,
including security checks, to succeed. If a check does not succeed, then
this bundle cannot be adapted and null
is returned.
adapt
in interface Bundle
adapt
in interface Framework
adapt
in class BundleImpl
A
- The type to which this bundle is to be adapted.type
- Class object for the type to which this bundle is to be
adapted.null
if this bundle cannot be adapted to the
specified type.