public class InternalSystemBundle extends BundleHost implements Framework
context, fragments, LAZY_TRIGGER
bundledata, domain, framework, manifestLocalization, state, statechangeLock, stateChanging
ACTIVE, INSTALLED, RESOLVED, SIGNERS_ALL, SIGNERS_TRUSTED, START_ACTIVATION_POLICY, START_TRANSIENT, STARTING, STOP_TRANSIENT, STOPPING, UNINSTALLED
Modifier | Constructor and Description |
---|---|
protected |
InternalSystemBundle(Framework framework)
Private SystemBundle object constructor.
|
Modifier and Type | Method and Description |
---|---|
protected <A> A |
adapt0(Class<A> adapterType) |
protected void |
close()
Close the the Bundle's file.
|
ClassLoader |
getClassLoader()
Gets the class loader for the host bundle.
|
Dictionary<String,String> |
getHeaders(String localeString)
Returns this bundle's Manifest headers and values.
|
URL |
getResource(String name)
Find the specified resource in this bundle.
|
boolean |
hasPermission(Object permission)
Determine whether the bundle has the requested
permission.
|
void |
init()
Initialize this Framework.
|
protected boolean |
isUnresolved()
Indicate SystemBundle is resolved.
|
protected void |
load()
Load the bundle.
|
protected Class<?> |
loadClass(String name,
boolean checkPermission)
This method loads a class from the bundle.
|
protected void |
refresh()
Refresh the bundle.
|
protected boolean |
reload(AbstractBundle newBundle)
Reload from a new bundle.
|
protected void |
resume()
Start the SystemBundle.
|
void |
start()
Start this bundle.
|
void |
start(int options)
Starts this bundle.
|
void |
stop()
Stop the framework.
|
void |
stop(int options)
Stops this bundle.
|
protected void |
suspend()
Stop the SystemBundle.
|
protected void |
suspend(boolean lock)
Stop this bundle w/o marking is persistently stopped.
|
void |
uninstall()
Uninstall this bundle.
|
protected boolean |
unload()
Unload the bundle.
|
protected void |
unresolvePermissions(AbstractBundle[] refreshedBundles)
No work to do for the SystemBundle.
|
void |
update()
Update this bundle.
|
void |
update(InputStream in)
Update this bundle from an InputStream.
|
FrameworkEvent |
waitForStop(long timeout)
Wait until this Framework has completely stopped.
|
attachFragment, createContext, getBundleLoader, getContext, getFragments, getLoaderProxy, getRegisteredServices, getResources, getServicesInUse, readyToResume, startHook, startWorker, stopHook, stopWorker
adapt, beginStateChange, checkValid, compare, compareTo, completeStateChange, createBundle, findEntries, getBundle, getBundleContext, getBundleData, getBundleDescription, getBundleId, getDataFile, getEntry, getEntryPaths, getFramework, getHeaders, getKey, getKeyHashCode, getLastModified, getLocation, getProtectionDomain, getResolutionFailureException, getResourceBundle, getRevisions, getSignerCertificates, getStartLevel, getState, getStateChanging, getSymbolicName, getVersion, isActivationPolicyUsed, isActive, isFragment, isPersistentlyStarted, isResolved, loadBundleActivator, loadClass, resolve, setStartLevel, setStatus, testStateChanging, toString, uninstallWorker, uninstallWorkerPrivileged, updateWorker, updateWorkerPrivileged
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
adapt, findEntries, getBundleId, getEntry, getEntryPaths, getLocation, getSymbolicName
getBundleContext, getDataFile, getHeaders, getLastModified, getRegisteredServices, getResources, getServicesInUse, getSignerCertificates, getState, getVersion, loadClass
compareTo
protected InternalSystemBundle(Framework framework) throws BundleException
framework
- Framework this bundle is running inBundleException
protected void load()
load
in class BundleHost
protected boolean reload(AbstractBundle newBundle)
reload
in class BundleHost
newBundle
- protected void refresh()
refresh
in class BundleHost
protected boolean unload()
unload
in class BundleHost
protected void close()
close
in class AbstractBundle
protected Class<?> loadClass(String name, boolean checkPermission) throws ClassNotFoundException
loadClass
in class BundleHost
name
- the name of the desired Class.checkPermission
- indicates whether a permission check should be done.ClassNotFoundException
- if the class definition was not found.public URL getResource(String name)
getResource
in interface Bundle
getResource
in class BundleHost
name
- The name of the resource.
See java.lang.ClassLoader.getResource for a description of
the format of a resource name.Bundle.getEntry(String)
,
Bundle.findEntries(String, String, boolean)
protected boolean isUnresolved()
public void start()
start
in interface Bundle
start
in interface Framework
start
in class AbstractBundle
Bundle.start(int)
public void start(int options)
Bundle
If this bundle's state is UNINSTALLED
then an
IllegalStateException
is thrown.
If the current start level is less than this bundle's start level:
Bundle.START_TRANSIENT
option is set, then a
BundleException
is thrown indicating this bundle cannot be
started due to the Framework's current start level.
Bundle.START_ACTIVATION_POLICY
option is set or
Started with eager activation if not set.
When the Framework's current start level becomes equal to or more than this bundle's start level, this bundle will be started.
Otherwise, the following steps are required to start this bundle:
BundleException
is thrown to indicate this bundle was unable to
be started.
ACTIVE
then this method returns
immediately.
Bundle.START_TRANSIENT
option is not set then set this
bundle's autostart setting to Started with declared activation
if the Bundle.START_ACTIVATION_POLICY
option is set or
Started with eager activation if not set. When the Framework is
restarted and this bundle's autostart setting is not Stopped,
this bundle must be automatically started.
RESOLVED
, an attempt is made to
resolve this bundle. If the Framework cannot resolve this bundle, a
BundleException
is thrown.
Bundle.START_ACTIVATION_POLICY
option is set and this
bundle's declared activation policy is lazy
then:
STARTING
then this method returns
immediately.
STARTING
.
BundleEvent.LAZY_ACTIVATION
is fired.
STARTING
.
BundleEvent.STARTING
is fired.
BundleActivator.start(BundleContext)
method of this
bundle's BundleActivator
, if one is specified, is called. If the
BundleActivator
is invalid or throws an exception then:
STOPPING
.
BundleEvent.STOPPING
is fired.
RESOLVED
.
BundleEvent.STOPPED
is fired.
BundleException
is then thrown.
UNINSTALLED
, because this bundle
was uninstalled while the BundleActivator.start
method was
running, a BundleException
is thrown.
ACTIVE
.
BundleEvent.STARTED
is fired.
getState()
in { INSTALLED
, RESOLVED
} or { INSTALLED
, RESOLVED
,
STARTING
} if this bundle has a lazy activation policy.
Bundle.START_TRANSIENT
option was set.
getState()
in { ACTIVE
} unless the
lazy activation policy was used.
BundleActivator.start()
has been called and did not throw an
exception unless the lazy activation policy was used.
Bundle.START_TRANSIENT
option was set.
getState()
not in { STARTING
, ACTIVE
}.
start
in interface Bundle
start
in interface Framework
start
in class AbstractBundle
options
- The options for starting this bundle. See
Bundle.START_TRANSIENT
and Bundle.START_ACTIVATION_POLICY
. The
Framework must ignore unrecognized options.Framework.start()
protected void resume()
resume
in class AbstractBundle
public void stop()
stop
in interface Bundle
stop
in interface Framework
stop
in class AbstractBundle
Bundle.start(int)
public void stop(int options)
Bundle
The following steps are required to stop a bundle:
UNINSTALLED
then an
IllegalStateException
is thrown.
BundleException
is thrown to indicate this bundle was unable to
be stopped.
Bundle.STOP_TRANSIENT
option is not set then then set this
bundle's persistent autostart setting to to Stopped. When the
Framework is restarted and this bundle's autostart setting is
Stopped, this bundle must not be automatically started.
STARTING
or ACTIVE
then
this method returns immediately.
STOPPING
.
BundleEvent.STOPPING
is fired.
ACTIVE
prior to setting the state
to STOPPING
, the BundleActivator.stop(BundleContext)
method of this bundle's BundleActivator
, if one is specified, is
called. If that method throws an exception, this method must continue to
stop this bundle and a BundleException
must be thrown after
completion of the remaining steps.
UNINSTALLED
, because this bundle
was uninstalled while the BundleActivator.stop
method was
running, a BundleException
must be thrown.
RESOLVED
.
BundleEvent.STOPPED
is fired.
getState()
in { ACTIVE
}.
Bundle.STOP_TRANSIENT
option was set.
getState()
not in { ACTIVE
, STOPPING
}.
BundleActivator.stop
has been called and did not throw an
exception.
Bundle.STOP_TRANSIENT
option was set.
stop
in interface Bundle
stop
in interface Framework
stop
in class AbstractBundle
options
- The options for stopping this bundle. See
Bundle.STOP_TRANSIENT
. The Framework must ignore unrecognized
options.Framework.stop()
protected void suspend()
protected void suspend(boolean lock)
AbstractBundle
The following steps are followed to stop a bundle:
Bundle.UNINSTALLED
then an IllegalStateException
is thrown.
Bundle.STOPPING
,Bundle.RESOLVED
, or
Bundle.INSTALLED
then this method returns immediately.
Bundle.STARTING
then this method may wait for
the bundle to reach the Bundle.ACTIVE
state before continuing. If this
does not occur in a reasonable time, a BundleException
is thrown
to indicate the bundle was unable to be stopped.
Bundle.STOPPING
.
stop
method of the bundle's
BundleActivator
, if one is specified, is called. If the
BundleActivator
throws an exception, this method will continue
to stop the bundle. A BundleException
will be thrown after
completion of the remaining steps.
Bundle.RESOLVED
.
BundleEvent
of type BundleEvent.STOPPED
is
broadcast.
Bundle.ACTIVE
}.
Bundle.ACTIVE
,Bundle.STOPPING
}.
BundleActivator.stop
has been called
and did not throw an exception.
suspend
in class AbstractBundle
lock
- true if state change lock should be held when returning from
this method.public void update()
update
in interface Bundle
update
in interface Framework
update
in class AbstractBundle
Bundle.update(InputStream)
public void update(InputStream in)
update
in interface Bundle
update
in interface Framework
update
in class AbstractBundle
in
- The InputStream from which to read the new bundle.Bundle.stop()
,
Bundle.start()
public void uninstall() throws BundleException
uninstall
in interface Bundle
uninstall
in interface Framework
uninstall
in class AbstractBundle
BundleException
- If the uninstall failed.AbstractBundle.stop()
public boolean hasPermission(Object permission)
true
.hasPermission
in interface Bundle
hasPermission
in class AbstractBundle
permission
- The requested permission.true
protected void unresolvePermissions(AbstractBundle[] refreshedBundles)
refreshedBundles
- A list of bundles which have been refreshed as a result
of a packageRefreshpublic Dictionary<String,String> getHeaders(String localeString)
AbstractBundle
Manifest header names are case-insensitive. The methods of the returned Dictionary object will operate on header names in a case-insensitive manner. If a Manifest header begins with a '%', it will be evaluated with the specified properties file for the specied Locale.
For example, the following Manifest headers and values are included if they are present in the Manifest file:
Bundle-Name Bundle-Vendor Bundle-Version Bundle-Description Bundle-DocURL Bundle-ContactAddress
This method will continue to return Manifest header information while this bundle is in the UNINSTALLED state.
getHeaders
in interface Bundle
getHeaders
in class AbstractBundle
localeString
- 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
"%".Bundle.getHeaders()
,
Constants.BUNDLE_LOCALIZATION
public void init()
Framework
framework UUID
.
Bundle.STARTING
state.ConditionalPermissionAdmin
.adaptable
to the OSGi defined types to which
a system bundle can be adapted.
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.
public FrameworkEvent waitForStop(long timeout) throws 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.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 ClassLoader getClassLoader()
BundleHost
getClassLoader
in class BundleHost
protected <A> A adapt0(Class<A> adapterType)
adapt0
in class AbstractBundle
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.