|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.felix.framework.Felix
public class Felix
| Nested Class Summary | |
|---|---|
class |
Felix.FelixResolver
|
| Field Summary |
|---|
| Fields inherited from interface org.osgi.framework.Bundle |
|---|
ACTIVE, INSTALLED, RESOLVED, START_ACTIVATION_POLICY, START_TRANSIENT, STARTING, STOP_TRANSIENT, STOPPING, UNINSTALLED |
| Constructor Summary | |
|---|---|
Felix(Map configMap)
This constructor creates a framework instance with a specified Map of configuration properties. |
|
| Method Summary | |
|---|---|
protected void |
_refreshPackages(org.apache.felix.framework.BundleImpl[] bundles)
|
protected void |
_resolveBundle(org.apache.felix.framework.BundleImpl bundle)
|
protected void |
acquireInstallLock(String location)
|
protected void |
addBundleListener(Bundle bundle,
BundleListener l)
|
protected void |
addFrameworkListener(Bundle bundle,
FrameworkListener l)
|
protected void |
addServiceListener(Bundle bundle,
ServiceListener l,
String f)
Implementation for BundleContext.addServiceListener(). |
Enumeration |
findEntries(String path,
String filePattern,
boolean recurse)
|
protected Bundle |
getBundle(Class clazz)
This method returns the bundle associated with the specified class if the class was loaded from a bundle from this framework instance. |
protected Bundle |
getBundle(long id)
Implementation for BundleContext.getBundle(). |
protected Bundle |
getBundle(String location)
Retrieves a bundle from its location. |
BundleContext |
getBundleContext()
|
long |
getBundleId()
Returns the System Bundle unique identifier. |
protected Bundle[] |
getBundles()
Implementation for BundleContext.getBundles(). |
protected File |
getDataFile(org.apache.felix.framework.BundleImpl bundle,
String s)
|
URL |
getEntry(String name)
|
Enumeration |
getEntryPaths(String path)
|
protected ExportedPackage[] |
getExportedPackages(Bundle b)
Returns an array of all actively exported packages from the specified bundle or if the specified bundle is null an array containing all actively exported packages by all bundles. |
protected ExportedPackage[] |
getExportedPackages(String pkgName)
Returns the exported packages associated with the specified package name. |
Dictionary |
getHeaders()
|
Dictionary |
getHeaders(String locale)
|
protected Bundle[] |
getImportingBundles(ExportedPackage ep)
|
long |
getLastModified()
|
String |
getLocation()
|
int |
getPersistentState()
|
protected String |
getProperty(String key)
Implementation for BundleContext.getProperty(). |
ServiceReference[] |
getRegisteredServices()
Returns an array of service references corresponding to the bundle's registered services. |
URL |
getResource(String name)
Returns a URL to a named resource in the bundle. |
Enumeration |
getResources(String name)
|
protected Object |
getService(Bundle bundle,
ServiceReference ref)
|
ServiceReference[] |
getServicesInUse()
|
int |
getState()
|
String |
getSymbolicName()
|
boolean |
hasPermission(Object obj)
|
void |
init()
This method initializes the framework, which is comprised of resolving the system bundle, reloading any cached bundles, and activating the system bundle. |
protected Bundle |
installBundle(String location,
InputStream is)
|
Class |
loadClass(String name)
|
protected void |
refreshPackages(Bundle[] targets)
|
protected ServiceRegistration |
registerService(org.apache.felix.framework.BundleImpl bundle,
String[] classNames,
Object svcObj,
Dictionary dict)
Implementation for BundleContext.registerService(). |
protected void |
releaseInstallLock(String location)
|
protected void |
removeBundleListener(Bundle bundle,
BundleListener l)
|
protected void |
removeFrameworkListener(Bundle bundle,
FrameworkListener l)
|
protected void |
removeServiceListener(Bundle bundle,
ServiceListener l)
Implementation for BundleContext.removeServiceListener(). |
protected boolean |
resolveBundles(Bundle[] targets)
|
void |
setPersistentStateActive()
|
void |
setPersistentStateInactive()
|
void |
setPersistentStateUninstalled()
|
void |
start()
This method starts the framework instance, which will transition the framework from start level 0 to its active start level as specified in its configuration properties (1 by default). |
void |
start(int options)
Start this System Bundle. |
void |
stop()
This method asynchronously shuts down the framework, it must be called at the end of a session in order to shutdown all active bundles. |
void |
stop(int options)
Stop this System Bundle. |
String |
toString()
|
protected boolean |
ungetService(Bundle bundle,
ServiceReference ref)
|
void |
uninstall()
The System Bundle cannot be uninstalled. |
void |
update()
Stop and restart this System Bundle. |
void |
update(InputStream is)
Stop and restart this System Bundle. |
FrameworkEvent |
waitForStop(long timeout)
This method will cause the calling thread to block until the framework shuts down. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.osgi.framework.launch.Framework |
|---|
getLocation, getSymbolicName |
| Methods inherited from interface org.osgi.framework.Bundle |
|---|
findEntries, getBundleContext, getEntry, getEntryPaths, getHeaders, getHeaders, getRegisteredServices, getResource, getResources, getServicesInUse, getState, loadClass |
| Constructor Detail |
|---|
public Felix(Map configMap)
throws Exception
This constructor creates a framework instance with a specified Map of configuration properties. Configuration properties are used internally by the framework to alter its default behavior. The configuration properties should have a String key and an Object value. The passed in Map is copied by the framework and all keys are converted to Strings.
Configuration properties are generally the sole means to configure the framework's default behavior; the framework does not typically refer to any system properties for configuration information. If a Map is supplied to this method for configuration properties, then the framework will consult the Map instance for any and all configuration properties. It is possible to specify a null for the configuration property map, in which case the framework will use its default behavior in all cases.
The following configuration properties can be specified (properties starting with "felix" are specific to Felix, while those starting with "org.osgi" are standard OSGi properties):
The Main class implements some functionality for default property file handling, which makes it possible to specify configuration properties and framework properties in files that are automatically loaded when starting the framework. If you plan to create your own framework instance, you may be able to take advantage of the features it provides; refer to its class documentation for more information.
The framework is not actually started until the start() method is called.
configMap - A map for obtaining configuration properties,
may be null.
Exception| Method Detail |
|---|
public long getBundleId()
Framework
getBundleId in interface BundlegetBundleId in interface FrameworkBundle.getBundleId()public long getLastModified()
getLastModified in interface Bundlepublic int getPersistentState()
public void setPersistentStateInactive()
public void setPersistentStateActive()
public void setPersistentStateUninstalled()
public boolean hasPermission(Object obj)
hasPermission in interface Bundle
public void init()
throws BundleException
init in interface FrameworkBundleException - if any error occurs.
public void start()
throws BundleException
start in interface Bundlestart in interface FrameworkBundleException - if any error occurs.
public void start(int options)
throws BundleException
Framework
Calling this method is the same as calling Framework.start(). There are no
start options for the System Bundle.
start in interface Bundlestart in interface Frameworkoptions - Ignored. There are no start options for the System Bundle.
BundleException - If this System Bundle could not be started.Framework.start()
public void stop()
throws BundleException
stop in interface Bundlestop in interface FrameworkBundleException - If stopping this System Bundle could not be
initiated.
public void stop(int options)
throws BundleException
Framework
Calling this method is the same as calling Framework.stop(). There are no
stop options for the System Bundle.
stop in interface Bundlestop in interface Frameworkoptions - Ignored. There are no stop options for the System Bundle.
BundleException - If stopping this System Bundle could not be
initiated.Framework.stop()
public FrameworkEvent waitForStop(long timeout)
throws InterruptedException
waitForStop in interface Frameworktimeout - A timeout value.
FrameworkEvent types may be returned by
this method.
STOPPED - This System Bundle
has been stopped which has shutdown its framework instance. STOPPED_UPDATE - This
System Bundle has been updated which has shutdown and will
restart its framework instance.STOPPED_BOOTCLASSPATH_MODIFIED - This System Bundle has been
stopped which has shutdown its framework instance 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 affect. ERROR - The
Framework encountered an error while shutting down or an error
has occurred which forced the framework to shutdown. INFO - This method has timed out and
returned before this System Bundle has stopped.InterruptedException - If the thread was interrupted.
public void uninstall()
throws BundleException
FrameworkThis method always throws a BundleException.
uninstall in interface Bundleuninstall in interface FrameworkBundleException - This System Bundle cannot be uninstalled.
public void update()
throws BundleException
FrameworkThe method returns immediately to the caller after initiating the following steps to be taken on another thread.
Framework.stop() method to stop this System
Bundle.Framework.start() method to start this System
Bundle.
update in interface Bundleupdate in interface FrameworkBundleException - If stopping and restarting this System Bundle
could not be initiated.
public void update(InputStream is)
throws BundleException
Framework
Calling this method is the same as calling Framework.update() except that
any provided InputStream is immediately closed.
update in interface Bundleupdate in interface Frameworkis - Any provided InputStream is immediately closed before returning
from this method and otherwise ignored.
BundleException - If stopping and restarting this System Bundle
could not be initiated.public String toString()
protected void _resolveBundle(org.apache.felix.framework.BundleImpl bundle)
throws BundleException
BundleExceptionprotected String getProperty(String key)
key - The name of the property to retrieve.
protected Bundle installBundle(String location,
InputStream is)
throws BundleException
BundleExceptionprotected Bundle getBundle(String location)
location - The location of the bundle to retrieve.
protected Bundle getBundle(long id)
id - The identifier of the bundle to retrieve.
protected Bundle[] getBundles()
protected void addBundleListener(Bundle bundle,
BundleListener l)
protected void removeBundleListener(Bundle bundle,
BundleListener l)
protected void addServiceListener(Bundle bundle,
ServiceListener l,
String f)
throws InvalidSyntaxException
ServiceEvents.
bundle - The bundle that registered the listener.l - The service listener to add to the listener list.f - The filter for the listener; may be null.
InvalidSyntaxException
protected void removeServiceListener(Bundle bundle,
ServiceListener l)
bundle - The context bundle of the listenerl - The service listener to remove from the listener list.
protected void addFrameworkListener(Bundle bundle,
FrameworkListener l)
protected void removeFrameworkListener(Bundle bundle,
FrameworkListener l)
protected ServiceRegistration registerService(org.apache.felix.framework.BundleImpl bundle,
String[] classNames,
Object svcObj,
Dictionary dict)
classNames - A string array containing the names of the classes
under which the new service is available.svcObj - The service object or ServiceFactory.dict - A dictionary of properties that further describe the
service or null.
ServiceRegistration object or null.
protected Object getService(Bundle bundle,
ServiceReference ref)
protected boolean ungetService(Bundle bundle,
ServiceReference ref)
protected File getDataFile(org.apache.felix.framework.BundleImpl bundle,
String s)
protected Bundle getBundle(Class clazz)
clazz - the class for which to find its associated bundle.
protected ExportedPackage[] getExportedPackages(String pkgName)
pkgName - The name of the exported package to find.
protected ExportedPackage[] getExportedPackages(Bundle b)
b - The bundle whose exported packages are to be retrieved
or null if the exported packages of all bundles are
to be retrieved.
protected Bundle[] getImportingBundles(ExportedPackage ep)
protected boolean resolveBundles(Bundle[] targets)
protected void refreshPackages(Bundle[] targets)
protected void _refreshPackages(org.apache.felix.framework.BundleImpl[] bundles)
protected void acquireInstallLock(String location)
throws BundleException
BundleExceptionprotected void releaseInstallLock(String location)
public BundleContext getBundleContext()
getBundleContext in interface Bundlepublic URL getEntry(String name)
getEntry in interface Bundlepublic Enumeration getEntryPaths(String path)
getEntryPaths in interface Bundle
public Enumeration findEntries(String path,
String filePattern,
boolean recurse)
findEntries in interface Bundlepublic Dictionary getHeaders()
getHeaders in interface Bundlepublic Dictionary getHeaders(String locale)
getHeaders in interface Bundlepublic String getLocation()
getLocation in interface Bundlepublic URL getResource(String name)
getResource in interface Bundle
public Enumeration getResources(String name)
throws IOException
getResources in interface BundleIOExceptionpublic ServiceReference[] getRegisteredServices()
getRegisteredServices in interface Bundlepublic ServiceReference[] getServicesInUse()
getServicesInUse in interface Bundlepublic int getState()
getState in interface Bundlepublic String getSymbolicName()
getSymbolicName in interface Bundle
public Class loadClass(String name)
throws ClassNotFoundException
loadClass in interface BundleClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||