|
||||||||||
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(java.util.Map configMap)
This constructor creates a framework instance with a specified Map of configuration properties. |
Method Summary | |
---|---|
protected void |
acquireInstallLock(java.lang.String location)
|
protected void |
addBundleListener(org.osgi.framework.Bundle bundle,
org.osgi.framework.BundleListener l)
|
protected void |
addFrameworkListener(org.osgi.framework.Bundle bundle,
org.osgi.framework.FrameworkListener l)
|
protected void |
addServiceListener(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceListener l,
java.lang.String f)
Implementation for BundleContext.addServiceListener(). |
java.util.Enumeration |
findEntries(java.lang.String path,
java.lang.String filePattern,
boolean recurse)
|
protected org.osgi.framework.Bundle |
getBundle(java.lang.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 org.osgi.framework.Bundle |
getBundle(long id)
Implementation for BundleContext.getBundle(). |
protected org.osgi.framework.Bundle |
getBundle(java.lang.String location)
Retrieves a bundle from its location. |
org.osgi.framework.BundleContext |
getBundleContext()
|
long |
getBundleId()
Returns the Framework unique identifier. |
protected org.osgi.framework.Bundle[] |
getBundles()
Implementation for BundleContext.getBundles(). |
protected java.io.File |
getDataFile(org.apache.felix.framework.BundleImpl bundle,
java.lang.String s)
|
java.net.URL |
getEntry(java.lang.String name)
|
java.util.Enumeration |
getEntryPaths(java.lang.String path)
|
protected org.osgi.service.packageadmin.ExportedPackage[] |
getExportedPackages(org.osgi.framework.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 org.osgi.service.packageadmin.ExportedPackage[] |
getExportedPackages(java.lang.String pkgName)
Returns the exported packages associated with the specified package name. |
java.util.Dictionary |
getHeaders()
|
java.util.Dictionary |
getHeaders(java.lang.String locale)
|
protected org.osgi.framework.Bundle[] |
getImportingBundles(org.osgi.service.packageadmin.ExportedPackage ep)
|
long |
getLastModified()
|
java.lang.String |
getLocation()
|
int |
getPersistentState()
|
protected java.lang.String |
getProperty(java.lang.String key)
Implementation for BundleContext.getProperty(). |
org.osgi.framework.ServiceReference[] |
getRegisteredServices()
Returns an array of service references corresponding to the bundle's registered services. |
java.net.URL |
getResource(java.lang.String name)
Returns a URL to a named resource in the bundle. |
java.util.Enumeration |
getResources(java.lang.String name)
|
protected java.lang.Object |
getService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceReference ref)
|
org.osgi.framework.ServiceReference[] |
getServicesInUse()
|
int |
getState()
|
java.lang.String |
getSymbolicName()
|
boolean |
hasPermission(java.lang.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 org.osgi.framework.Bundle |
installBundle(java.lang.String location,
java.io.InputStream is)
|
java.lang.Class |
loadClass(java.lang.String name)
|
protected org.osgi.framework.ServiceRegistration |
registerService(org.apache.felix.framework.BundleImpl bundle,
java.lang.String[] classNames,
java.lang.Object svcObj,
java.util.Dictionary dict)
Implementation for BundleContext.registerService(). |
protected void |
releaseInstallLock(java.lang.String location)
|
protected void |
removeBundleListener(org.osgi.framework.Bundle bundle,
org.osgi.framework.BundleListener l)
|
protected void |
removeFrameworkListener(org.osgi.framework.Bundle bundle,
org.osgi.framework.FrameworkListener l)
|
protected void |
removeServiceListener(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceListener l)
Implementation for BundleContext.removeServiceListener(). |
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 Framework. |
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 Framework. |
java.lang.String |
toString()
|
protected boolean |
ungetService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceReference ref)
|
void |
uninstall()
The Framework cannot be uninstalled. |
void |
update()
Stop and restart this Framework. |
void |
update(java.io.InputStream is)
Stop and restart this Framework. |
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(java.util.Map configMap)
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.Method Detail |
---|
public long getBundleId()
Framework
getBundleId
in interface org.osgi.framework.Bundle
getBundleId
in interface Framework
Bundle.getBundleId()
public long getLastModified()
getLastModified
in interface org.osgi.framework.Bundle
public int getPersistentState()
public void setPersistentStateInactive()
public void setPersistentStateActive()
public void setPersistentStateUninstalled()
public boolean hasPermission(java.lang.Object obj)
hasPermission
in interface org.osgi.framework.Bundle
public void init() throws org.osgi.framework.BundleException
init
in interface Framework
org.osgi.framework.BundleException
- if any error occurs.public void start() throws org.osgi.framework.BundleException
start
in interface org.osgi.framework.Bundle
start
in interface Framework
org.osgi.framework.BundleException
- if any error occurs.public void start(int options) throws org.osgi.framework.BundleException
Framework
Calling this method is the same as calling Framework.start()
. There are no
start options for the Framework.
start
in interface org.osgi.framework.Bundle
start
in interface Framework
options
- Ignored. There are no start options for the Framework.
org.osgi.framework.BundleException
- If this Framework could not be started.Framework.start()
public void stop() throws org.osgi.framework.BundleException
stop
in interface org.osgi.framework.Bundle
stop
in interface Framework
org.osgi.framework.BundleException
- If stopping this Framework could not be
initiated.public void stop(int options) throws org.osgi.framework.BundleException
Framework
Calling this method is the same as calling Framework.stop()
. There are no
stop options for the Framework.
stop
in interface org.osgi.framework.Bundle
stop
in interface Framework
options
- Ignored. There are no stop options for the Framework.
org.osgi.framework.BundleException
- If stopping this Framework could not be
initiated.Framework.stop()
public FrameworkEvent waitForStop(long timeout) throws java.lang.InterruptedException
waitForStop
in interface Framework
timeout
- A timeout value.
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 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 Framework has stopped.java.lang.InterruptedException
- If the thread was interrupted.public void uninstall() throws org.osgi.framework.BundleException
Framework
This method always throws a BundleException.
uninstall
in interface org.osgi.framework.Bundle
uninstall
in interface Framework
org.osgi.framework.BundleException
- This Framework cannot be uninstalled.public void update() throws org.osgi.framework.BundleException
Framework
The method returns immediately to the caller after initiating the following steps to be taken on another thread.
Framework.stop()
method to stop this
Framework.Framework.start()
method to start this
Framework.
update
in interface org.osgi.framework.Bundle
update
in interface Framework
org.osgi.framework.BundleException
- If stopping and restarting this Framework could
not be initiated.public void update(java.io.InputStream is) throws org.osgi.framework.BundleException
Framework
Calling this method is the same as calling Framework.update()
except that
any provided InputStream is immediately closed.
update
in interface org.osgi.framework.Bundle
update
in interface Framework
is
- Any provided InputStream is immediately closed before returning
from this method and otherwise ignored.
org.osgi.framework.BundleException
- If stopping and restarting this Framework could
not be initiated.public java.lang.String toString()
protected java.lang.String getProperty(java.lang.String key)
key
- The name of the property to retrieve.
protected org.osgi.framework.Bundle installBundle(java.lang.String location, java.io.InputStream is) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
protected org.osgi.framework.Bundle getBundle(java.lang.String location)
location
- The location of the bundle to retrieve.
protected org.osgi.framework.Bundle getBundle(long id)
id
- The identifier of the bundle to retrieve.
protected org.osgi.framework.Bundle[] getBundles()
protected void addBundleListener(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleListener l)
protected void removeBundleListener(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleListener l)
protected void addServiceListener(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceListener l, java.lang.String f) throws org.osgi.framework.InvalidSyntaxException
ServiceEvent
s.
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.
org.osgi.framework.InvalidSyntaxException
protected void removeServiceListener(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceListener l)
bundle
- The context bundle of the listenerl
- The service listener to remove from the listener list.protected void addFrameworkListener(org.osgi.framework.Bundle bundle, org.osgi.framework.FrameworkListener l)
protected void removeFrameworkListener(org.osgi.framework.Bundle bundle, org.osgi.framework.FrameworkListener l)
protected org.osgi.framework.ServiceRegistration registerService(org.apache.felix.framework.BundleImpl bundle, java.lang.String[] classNames, java.lang.Object svcObj, java.util.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 java.lang.Object getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceReference ref)
protected boolean ungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceReference ref)
protected java.io.File getDataFile(org.apache.felix.framework.BundleImpl bundle, java.lang.String s)
protected org.osgi.framework.Bundle getBundle(java.lang.Class clazz)
clazz
- the class for which to find its associated bundle.
protected org.osgi.service.packageadmin.ExportedPackage[] getExportedPackages(java.lang.String pkgName)
pkgName
- The name of the exported package to find.
protected org.osgi.service.packageadmin.ExportedPackage[] getExportedPackages(org.osgi.framework.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 org.osgi.framework.Bundle[] getImportingBundles(org.osgi.service.packageadmin.ExportedPackage ep)
protected void acquireInstallLock(java.lang.String location) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
protected void releaseInstallLock(java.lang.String location)
public org.osgi.framework.BundleContext getBundleContext()
getBundleContext
in interface org.osgi.framework.Bundle
public java.net.URL getEntry(java.lang.String name)
getEntry
in interface org.osgi.framework.Bundle
public java.util.Enumeration getEntryPaths(java.lang.String path)
getEntryPaths
in interface org.osgi.framework.Bundle
public java.util.Enumeration findEntries(java.lang.String path, java.lang.String filePattern, boolean recurse)
findEntries
in interface org.osgi.framework.Bundle
public java.util.Dictionary getHeaders()
getHeaders
in interface org.osgi.framework.Bundle
public java.util.Dictionary getHeaders(java.lang.String locale)
getHeaders
in interface org.osgi.framework.Bundle
public java.lang.String getLocation()
getLocation
in interface org.osgi.framework.Bundle
public java.net.URL getResource(java.lang.String name)
getResource
in interface org.osgi.framework.Bundle
public java.util.Enumeration getResources(java.lang.String name) throws java.io.IOException
getResources
in interface org.osgi.framework.Bundle
java.io.IOException
public org.osgi.framework.ServiceReference[] getRegisteredServices()
getRegisteredServices
in interface org.osgi.framework.Bundle
public org.osgi.framework.ServiceReference[] getServicesInUse()
getServicesInUse
in interface org.osgi.framework.Bundle
public int getState()
getState
in interface org.osgi.framework.Bundle
public java.lang.String getSymbolicName()
getSymbolicName
in interface org.osgi.framework.Bundle
public java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
loadClass
in interface org.osgi.framework.Bundle
java.lang.ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |