public class BundleHost extends AbstractBundle
Modifier and Type | Field and Description |
---|---|
protected BundleContextImpl |
context
The BundleContext that represents this Bundle and all of its fragments
|
protected BundleFragment[] |
fragments
The List of BundleFragments
|
static int |
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
Constructor and Description |
---|
BundleHost(BundleData bundledata,
Framework framework) |
Modifier and Type | Method and Description |
---|---|
protected void |
attachFragment(BundleFragment fragment)
Attaches a fragment to this BundleHost.
|
protected BundleContextImpl |
createContext()
Create a BundleContext for this bundle.
|
protected BundleLoader |
getBundleLoader() |
ClassLoader |
getClassLoader()
Gets the class loader for the host bundle.
|
protected BundleContextImpl |
getContext()
Return the current context for this bundle.
|
BundleFragment[] |
getFragments() |
BundleLoaderProxy |
getLoaderProxy() |
ServiceReference<?>[] |
getRegisteredServices()
Provides a list of
ServiceReference s for the services
registered by this bundle
or null if the bundle has no registered
services. |
URL |
getResource(String name)
Find the specified resource in this bundle.
|
Enumeration<URL> |
getResources(String name)
Find the specified resources from this bundle's class loader.
|
ServiceReference<?>[] |
getServicesInUse()
Provides a list of
ServiceReference s for the
services this bundle is using,
or null if the bundle is not using any services. |
protected void |
load()
Load the bundle.
|
protected Class<?> |
loadClass(String name,
boolean checkPermission)
This method loads a class from the bundle.
|
protected boolean |
readyToResume()
This method does the following
Return false if the bundle is a fragment
Return false if the bundle is not at the correct start-level
Return false if the bundle is not persistently marked for start
Return true if the bundle's activation policy is persistently ignored
Return true if the bundle does not define an activation policy
Transition to STARTING state and Fire LAZY_ACTIVATION event
Return false
|
protected void |
refresh()
Refresh the bundle.
|
protected boolean |
reload(AbstractBundle newBundle)
Reload from a new bundle.
|
protected void |
startHook() |
protected void |
startWorker(int options)
Internal worker to start a bundle.
|
protected void |
stopHook() |
protected void |
stopWorker(int options)
Internal worker to stop a bundle.
|
protected boolean |
unload()
Unload the bundle.
|
adapt, adapt0, beginStateChange, checkValid, close, compare, compareTo, completeStateChange, createBundle, findEntries, getBundle, getBundleContext, getBundleData, getBundleDescription, getBundleId, getDataFile, getEntry, getEntryPaths, getFramework, getHeaders, getHeaders, getKey, getKeyHashCode, getLastModified, getLocation, getProtectionDomain, getResolutionFailureException, getResourceBundle, getRevisions, getSignerCertificates, getStartLevel, getState, getStateChanging, getSymbolicName, getVersion, hasPermission, isActivationPolicyUsed, isActive, isFragment, isPersistentlyStarted, isResolved, loadBundleActivator, loadClass, resolve, resume, setStartLevel, setStatus, start, start, stop, stop, suspend, testStateChanging, toString, uninstall, uninstallWorker, uninstallWorkerPrivileged, update, update, updateWorker, updateWorkerPrivileged
public static final int LAZY_TRIGGER
protected BundleContextImpl context
protected BundleFragment[] fragments
public BundleHost(BundleData bundledata, Framework framework)
protected void load()
load
in class AbstractBundle
protected boolean reload(AbstractBundle newBundle)
reload
in class AbstractBundle
newBundle
- Dummy Bundle which contains new data.protected void refresh()
refresh
in class AbstractBundle
protected boolean unload()
unload
in class AbstractBundle
protected Class<?> loadClass(String name, boolean checkPermission) throws ClassNotFoundException
loadClass
in class AbstractBundle
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)
name
- The name of the resource.
See java.lang.ClassLoader.getResource for a description of
the format of a resource name.IllegalStateException
- If this bundle has been uninstalled.Bundle.getEntry(String)
,
Bundle.findEntries(String, String, boolean)
public Enumeration<URL> getResources(String name) throws IOException
Bundle
INSTALLED
, this method must
attempt to resolve this bundle before attempting to get the specified
resources. If this bundle cannot be resolved, then only this bundle must
be searched for the specified resources. Imported packages cannot be
searched when a bundle has not been resolved. If this bundle is a
fragment bundle then null
is returned.
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.
name
- The name of the resource. See
ClassLoader.getResources
for a description of the format
of a resource name.null
if
the resource could not be found or if this bundle is a fragment
bundle or if the caller does not have the appropriate
AdminPermission[this,RESOURCE]
, and the Java Runtime
Environment supports permissions.IOException
- If there is an I/O error.protected void startWorker(int options) throws BundleException
startWorker
in class AbstractBundle
options
- the start optionsBundleException
protected void startHook() throws BundleException
BundleException
protected boolean readyToResume()
AbstractBundle
readyToResume
in class AbstractBundle
protected BundleContextImpl createContext()
protected BundleContextImpl getContext()
getContext
in class AbstractBundle
protected void stopWorker(int options) throws BundleException
stopWorker
in class AbstractBundle
options
- the stop optionsBundleException
protected void stopHook() throws BundleException
BundleException
public ServiceReference<?>[] getRegisteredServices()
ServiceReference
s for the services
registered by this bundle
or null
if the bundle has no registered
services.
The list is valid at the time of the call to this method, but the framework is a very dynamic environment and services can be modified or unregistered at anytime.
ServiceReference
or null
.IllegalStateException
- If the
bundle has been uninstalled.ServiceRegistration
,
ServiceReference
public ServiceReference<?>[] getServicesInUse()
ServiceReference
s for the
services this bundle is using,
or null
if the bundle is not using any services.
A bundle is considered to be using a service if the bundle's
use count for the service is greater than zero.
The list is valid at the time of the call to this method, but the framework is a very dynamic environment and services can be modified or unregistered at anytime.
ServiceReference
or null
.IllegalStateException
- If the
bundle has been uninstalled.ServiceReference
public BundleFragment[] getFragments()
getFragments
in class AbstractBundle
protected void attachFragment(BundleFragment fragment) throws BundleException
fragment
- The fragment bundle to attach
return true if the fragment successfully attached; false if the fragment
could not be logically inserted at the end of the fragment chain.BundleException
protected BundleLoader getBundleLoader()
getBundleLoader
in class AbstractBundle
public BundleLoaderProxy getLoaderProxy()
public ClassLoader getClassLoader()
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.