|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.osgi.framework.internal.core.Framework
public class Framework
Core OSGi Framework class.
Field Summary | |
---|---|
protected boolean |
active
Has the service space been started |
protected FrameworkAdaptor |
adaptor
FrameworkAdaptor specific functions. |
protected static AliasMapper |
aliasMapper
The AliasMapper used to alias OS Names. |
protected static int |
BATCHEVENT_BEGIN
|
protected static int |
BATCHEVENT_END
|
protected EventListeners |
bundleEvent
List of BundleContexts for bundle's BundleListeners. |
protected static int |
BUNDLEEVENT
|
protected EventListeners |
bundleEventSync
List of BundleContexts for bundle's SynchronousBundleListeners. |
protected static int |
BUNDLEEVENTSYNC
|
protected BundleRepository |
bundles
The bundles installed in the framework |
protected ConditionalPermissionAdminImpl |
condPermAdmin
|
protected EventManager |
eventManager
EventManager for event delivery. |
protected EventListeners |
frameworkEvent
List of BundleContexts for bundle's FrameworkListeners. |
protected static int |
FRAMEWORKEVENT
|
protected java.util.Hashtable |
installLock
|
protected PackageAdminImpl |
packageAdmin
Package Admin object. |
protected PermissionAdminImpl |
permissionAdmin
Package Admin object. |
protected java.util.Properties |
properties
Framework properties object. |
protected EventListeners |
serviceEvent
List of BundleContexts for bundle's ServiceListeners. |
protected static int |
SERVICEEVENT
|
protected long |
serviceid
next free service id. |
protected ServiceRegistry |
serviceRegistry
The ServiceRegistry |
protected StartLevelManager |
startLevelManager
Startlevel object. |
protected SystemBundle |
systemBundle
System Bundle object |
Constructor Summary | |
---|---|
Framework(FrameworkAdaptor adaptor)
Constructor for the Framework instance. |
Method Summary | |
---|---|
protected void |
checkAdminPermission(Bundle bundle,
java.lang.String action)
Check for specific AdminPermission (RFC 73) |
protected void |
checkGetServicePermission(java.lang.String name)
Check for permission to get a service. |
protected void |
checkGetServicePermission(java.lang.String[] names)
Check for permission to get a service. |
protected void |
checkRegisterServicePermission(java.lang.String[] names)
Check for permission to register a service. |
void |
close()
This method is called to destory the framework instance. |
void |
dispatchEvent(java.lang.Object l,
java.lang.Object lo,
int action,
java.lang.Object object)
Top level event dispatcher for the framework. |
protected AbstractBundle[] |
getAllBundles()
Retrieve a list of all installed bundles. |
AbstractBundle |
getBundle(long id)
Retrieve the bundle that has the given unique identifier. |
protected AbstractBundle |
getBundleByLocation(java.lang.String location)
Locate an installed bundle with a given identity. |
protected AbstractBundle[] |
getBundleBySymbolicName(java.lang.String symbolicName)
Locate an installed bundle with a given symbolic name |
AbstractBundle |
getBundleBySymbolicName(java.lang.String symbolicName,
Version version)
Retrieve the bundle that has the given symbolic name and version. |
protected BundleRepository |
getBundles()
Retrieve the BundleRepository of all installed bundles. |
protected java.io.File |
getDataFile(AbstractBundle bundle,
java.lang.String filename)
Creates a File object for a file in the persistent
storage area provided for the bundle by the framework. |
protected long |
getNextServiceId()
Method to return the next available service id. |
java.lang.String |
getProperty(java.lang.String key)
Retrieve the value of the named environment property. |
protected java.lang.String |
getProperty(java.lang.String key,
java.lang.String def)
Retrieve the value of the named environment property. |
protected ServiceReference[] |
getServiceReferences(java.lang.String clazz,
java.lang.String filterstring,
BundleContextImpl context,
boolean allservices)
Returns a list of ServiceReference objects. |
protected void |
initialize(FrameworkAdaptor adaptor)
Initialize the framework to an unlaunched state. |
protected void |
initializeProperties(java.util.Properties adaptorProperties)
Initialize the System properties by copying properties from the adaptor properties object. |
AbstractBundle |
installBundle(java.lang.String location)
Install a bundle from a location. |
protected AbstractBundle |
installBundle(java.lang.String location,
java.io.InputStream in)
Install a bundle from an InputStream. |
protected void |
installSecurityManager()
This is necessary for running from a JXE, otherwise the SecurityManager is set much later than we would like! |
protected AbstractBundle |
installWorker(java.lang.String location,
java.security.PrivilegedExceptionAction action)
Worker method to install a bundle. |
protected AbstractBundle |
installWorkerPrivileged(java.lang.String location,
java.net.URLConnection source,
java.security.AccessControlContext callerContext)
Worker method to install a bundle. |
protected boolean |
isActive()
This method return the state of the framework. |
void |
launch()
Start the framework. |
void |
publishBundleEvent(int type,
Bundle bundle)
Deliver a BundleEvent to SynchronousBundleListeners (synchronous). and BundleListeners (asynchronous). |
void |
publishBundleEventPrivileged(BundleEvent event)
|
void |
publishFrameworkEvent(int type,
Bundle bundle,
java.lang.Throwable throwable)
Deliver a FrameworkEvent. |
void |
publishFrameworkEventPrivileged(FrameworkEvent event)
|
void |
publishServiceEvent(int type,
ServiceReference reference)
Deliver a ServiceEvent. |
void |
publishServiceEventPrivileged(ServiceEvent event)
|
protected void |
resumeBundle(AbstractBundle bundle)
Resume a bundle. |
protected java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Set a system property. |
void |
shutdown()
Stop the framework. |
protected boolean |
suspendBundle(AbstractBundle bundle,
boolean lock)
Suspend a bundle. |
protected boolean |
verifyExecutionEnvironment(java.util.Dictionary manifest)
Verifies that the framework supports one of the required Execution Environments |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected FrameworkAdaptor adaptor
protected java.util.Properties properties
protected boolean active
protected BundleRepository bundles
protected PackageAdminImpl packageAdmin
protected PermissionAdminImpl permissionAdmin
protected StartLevelManager startLevelManager
protected ServiceRegistry serviceRegistry
protected long serviceid
protected EventListeners bundleEvent
protected static final int BUNDLEEVENT
protected EventListeners bundleEventSync
protected static final int BUNDLEEVENTSYNC
protected EventListeners serviceEvent
protected static final int SERVICEEVENT
protected EventListeners frameworkEvent
protected static final int FRAMEWORKEVENT
protected static final int BATCHEVENT_BEGIN
protected static final int BATCHEVENT_END
protected EventManager eventManager
protected java.util.Hashtable installLock
protected SystemBundle systemBundle
protected static AliasMapper aliasMapper
protected ConditionalPermissionAdminImpl condPermAdmin
Constructor Detail |
---|
public Framework(FrameworkAdaptor adaptor)
Method Detail |
---|
protected void initialize(FrameworkAdaptor adaptor)
protected void initializeProperties(java.util.Properties adaptorProperties)
protected boolean isActive()
public void close()
public void launch()
public void shutdown()
protected boolean verifyExecutionEnvironment(java.util.Dictionary manifest) throws BundleException
manifest
- BundleManifest of the bundle to verify the Execution
Enviroment for
BundleException
- if the framework does not support the required Execution
Environment.public java.lang.String getProperty(java.lang.String key)
org.osgi.framework.version
org.osgi.framework.vendor
org.osgi.framework.language
org.osgi.framework.os.name
org.osgi.framework.os.version
org.osgi.framework.processor
Note: These last four properties are used by the Bundle-NativeCode
manifest header's matching algorithm for selecting native code.
key
- The name of the requested property.
null
if
the property is undefined.protected java.lang.String getProperty(java.lang.String key, java.lang.String def)
org.osgi.framework.version
org.osgi.framework.vendor
org.osgi.framework.language
org.osgi.framework.os.name
org.osgi.framework.os.version
org.osgi.framework.processor
Note: These last four properties are used by the Bundle-NativeCode
manifest header's matching algorithm for selecting native code.
key
- The name of the requested property.def
- A default value is the requested property is not present.
protected java.lang.Object setProperty(java.lang.String key, java.lang.String value)
key
- The name of the property to set.value
- The value to set.
public AbstractBundle installBundle(java.lang.String location) throws BundleException
location
- The location identifier of the bundle to install.
BundleException
protected AbstractBundle installBundle(java.lang.String location, java.io.InputStream in) throws BundleException
This method performs all the steps listed in
installBundle(java.lang.String)
, except the bundle's content
will be read from the InputStream. The location identifier specified
will be used as the identity of the bundle.
location
- The location identifier of the bundle to install.in
- The InputStream from which the bundle will be read.
BundleException
protected AbstractBundle installWorker(java.lang.String location, java.security.PrivilegedExceptionAction action) throws BundleException
location
- The location identifier of the bundle to install.action
- A PrivilegedExceptionAction which calls the real worker.
AbstractBundle
of the installed bundle.
BundleException
- If the action throws an error.protected AbstractBundle installWorkerPrivileged(java.lang.String location, java.net.URLConnection source, java.security.AccessControlContext callerContext) throws BundleException
location
- The location identifier of the bundle to install.source
- The URLConnection from which the bundle will be read.
AbstractBundle
of the installed bundle.
BundleException
- If the provided stream cannot be read.public AbstractBundle getBundle(long id)
id
- The identifier of the bundle to retrieve.
AbstractBundle
object, or null
if the
identifier doesn't match any installed bundle.public AbstractBundle getBundleBySymbolicName(java.lang.String symbolicName, Version version)
symbolicName
- The symbolic name of the bundle to retrieveversion
- The version of the bundle to retrieve
AbstractBundle
object, or null
if the
identifier doesn't match any installed bundle.protected BundleRepository getBundles()
protected AbstractBundle[] getAllBundles()
AbstractBundle
objects, one object per installed
bundle.protected void resumeBundle(AbstractBundle bundle)
bundle
- Bundle to resume.protected boolean suspendBundle(AbstractBundle bundle, boolean lock)
bundle
- Bundle to suspend.lock
- true if state change lock should be held when returning from
this method.
protected AbstractBundle getBundleByLocation(java.lang.String location)
location
- string for the bundle
protected AbstractBundle[] getBundleBySymbolicName(java.lang.String symbolicName)
symbolicName
- The symbolic name for the bundle
protected ServiceReference[] getServiceReferences(java.lang.String clazz, java.lang.String filterstring, BundleContextImpl context, boolean allservices) throws InvalidSyntaxException
The list is valid at the time of the call to this method, however as the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
filter is used to select the registered service whose
properties objects contain keys and values which satisfy the filter. See
FilterImpl
for a description of the filter string syntax.
If filter is null, all registered services are considered to match the filter.
If filter cannot be parsed, an InvalidSyntaxException
will be thrown with a human readable message where the filter became
unparsable.
The following steps are required to select a service:
clazz
is not null, the set is further
reduced to those services which are an instanceof and were
registered under the specified class. The complete list of classes of
which a service is an instance and which were specified when the service
was registered is available from the service's
Constants.OBJECTCLASS
property.
clazz
- The class name with which the service was registered, or null
for all services.filterstring
- The filter criteria.
InvalidSyntaxException
- If filter contains an invalid filter string
which cannot be parsed.protected long getNextServiceId()
protected java.io.File getDataFile(AbstractBundle bundle, java.lang.String filename)
File
object for a file in the persistent
storage area provided for the bundle by the framework. If the adaptor
does not have file system support, this method will return null
.
A File
object for the base directory of the persistent
storage area provided for the context bundle by the framework can be
obtained by calling this method with the empty string ("") as the
parameter.
protected void checkAdminPermission(Bundle bundle, java.lang.String action)
protected void checkRegisterServicePermission(java.lang.String[] names)
protected void checkGetServicePermission(java.lang.String[] names)
protected void checkGetServicePermission(java.lang.String name)
protected void installSecurityManager()
public void publishFrameworkEvent(int type, Bundle bundle, java.lang.Throwable throwable)
publishFrameworkEvent
in interface EventPublisher
type
- FrameworkEvent type.bundle
- Affected bundle or null for system bundle.throwable
- Related exception or null.FrameworkEvent
public void publishFrameworkEventPrivileged(FrameworkEvent event)
public void publishBundleEvent(int type, Bundle bundle)
type
- BundleEvent type.bundle
- Affected bundle or null.public void publishBundleEventPrivileged(BundleEvent event)
public void publishServiceEvent(int type, ServiceReference reference)
type
- ServiceEvent type.reference
- Affected service reference.public void publishServiceEventPrivileged(ServiceEvent event)
public void dispatchEvent(java.lang.Object l, java.lang.Object lo, int action, java.lang.Object object)
dispatchEvent
in interface EventDispatcher
l
- BundleContext for receiving bundlelo
- BundleContext for receiving bundleaction
- Event class typeobject
- ListenerQueue to populate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |