|
||||||||||
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
Field Summary |
---|
Fields inherited from interface org.osgi.framework.Bundle |
---|
ACTIVE, INSTALLED, RESOLVED, STARTING, STOPPING, UNINSTALLED |
Constructor Summary | |
---|---|
Felix(Logger logger,
java.util.Map configMutableMap,
java.util.List activatorList)
This method creates the framework instance; instances of the framework are not active until they are started. |
|
Felix(java.util.Map configMutableMap,
java.util.List activatorList)
Creates a new Felix framework instance with a default logger. |
Method Summary | |
---|---|
protected void |
_resolveBundle(org.apache.felix.framework.FelixBundle bundle)
|
protected void |
_updateBundle(org.apache.felix.framework.FelixBundle bundle,
java.io.InputStream is)
|
protected void |
acquireBundleLock(org.apache.felix.framework.FelixBundle bundle)
|
protected boolean |
acquireBundleLockOrFail(org.apache.felix.framework.FelixBundle bundle)
|
protected org.apache.felix.framework.FelixBundle[] |
acquireBundleRefreshLocks(org.osgi.framework.Bundle[] targets)
|
protected org.apache.felix.framework.FelixBundle[] |
acquireBundleResolveLocks(org.osgi.framework.Bundle[] targets)
|
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 |
addRequirement(org.apache.felix.framework.FelixBundle bundle,
java.lang.String s)
|
protected void |
addServiceListener(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceListener l,
java.lang.String f)
Implementation for BundleContext.addServiceListener(). |
protected boolean |
bundleHasPermission(org.apache.felix.framework.FelixBundle bundle,
java.lang.Object obj)
|
protected java.util.Enumeration |
findBundleEntries(org.apache.felix.framework.FelixBundle bundle,
java.lang.String path,
java.lang.String filePattern,
boolean recurse)
Implementation for findEntries(). |
java.util.Enumeration |
findEntries(java.lang.String path,
java.lang.String filePattern,
boolean recurse)
|
protected org.osgi.framework.ServiceReference[] |
getAllowedServiceReferences(org.apache.felix.framework.FelixBundle bundle,
java.lang.String className,
java.lang.String expr,
boolean checkAssignable)
Retrieves Array of ServiceReference objects based on calling bundle, service class name,
optional filter expression, and optionally filters further on the version. |
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()
|
protected java.net.URL |
getBundleEntry(org.apache.felix.framework.FelixBundle bundle,
java.lang.String name)
Implementation for Bundle.getEntry(). |
protected java.util.Enumeration |
getBundleEntryPaths(org.apache.felix.framework.FelixBundle bundle,
java.lang.String path)
Implementation for Bundle.getEntryPaths(). |
protected java.util.Dictionary |
getBundleHeaders(org.apache.felix.framework.FelixBundle bundle,
java.lang.String locale)
Get bundle headers and resolve any localized strings from resource bundles. |
long |
getBundleId()
|
protected java.lang.String |
getBundleLocation(org.apache.felix.framework.FelixBundle bundle)
Implementation for Bundle.getLocation(). |
protected org.osgi.framework.ServiceReference[] |
getBundleRegisteredServices(org.apache.felix.framework.FelixBundle bundle)
|
protected java.net.URL |
getBundleResource(org.apache.felix.framework.FelixBundle bundle,
java.lang.String name)
Implementation for Bundle.getResource(). |
protected java.util.Enumeration |
getBundleResources(org.apache.felix.framework.FelixBundle bundle,
java.lang.String name)
Implementation for Bundle.getResources(). |
protected org.osgi.framework.Bundle[] |
getBundles()
Implementation for BundleContext.getBundles(). |
protected org.osgi.framework.ServiceReference[] |
getBundleServicesInUse(org.osgi.framework.Bundle bundle)
|
protected int |
getBundleStartLevel(org.osgi.framework.Bundle bundle)
Returns the start level for the specified bundle; this method implements functionality for the Start Level service. |
protected java.lang.String |
getBundleSymbolicName(org.apache.felix.framework.FelixBundle bundle)
Implementation for Bundle.getSymbolicName(). |
protected java.io.File |
getDataFile(org.apache.felix.framework.FelixBundle bundle,
java.lang.String s)
|
protected org.osgi.framework.Bundle[] |
getDependentBundles(org.apache.felix.framework.FelixBundle exporter)
|
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)
|
protected int |
getInitialBundleStartLevel()
Returns the start level into which newly installed bundles will be placed by default; this method implements functionality for the Start Level service. |
long |
getLastModified()
|
java.lang.String |
getLocation()
|
protected java.lang.String |
getProperty(java.lang.String key)
Implementation for BundleContext.getProperty(). |
org.osgi.framework.ServiceReference[] |
getRegisteredServices()
|
java.net.URL |
getResource(java.lang.String name)
|
java.util.Enumeration |
getResources(java.lang.String name)
|
protected java.lang.Object |
getService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceReference ref)
|
protected org.osgi.framework.ServiceReference[] |
getServiceReferences(org.apache.felix.framework.FelixBundle bundle,
java.lang.String className,
java.lang.String expr,
boolean checkAssignable)
Retrieves an array of ServiceReference objects based on calling bundle,
service class name, and filter expression. |
org.osgi.framework.ServiceReference[] |
getServicesInUse()
|
protected int |
getStartLevel()
Returns the active start level of the framework; this method implements functionality for the Start Level service. |
int |
getState()
|
java.lang.String |
getSymbolicName()
|
boolean |
hasPermission(java.lang.Object obj)
|
protected org.osgi.framework.Bundle |
installBundle(java.lang.String location,
java.io.InputStream is)
|
protected boolean |
isBundlePersistentlyStarted(org.osgi.framework.Bundle bundle)
Returns whether a bundle is persistently started; this is an method implementation for the Start Level service. |
protected java.lang.Class |
loadBundleClass(org.apache.felix.framework.FelixBundle bundle,
java.lang.String name)
Implementation for Bundle.loadClass(). |
java.lang.Class |
loadClass(java.lang.String name)
|
protected void |
refreshPackages(org.osgi.framework.Bundle[] targets)
|
protected org.osgi.framework.ServiceRegistration |
registerService(org.apache.felix.framework.FelixBundle bundle,
java.lang.String[] classNames,
java.lang.Object svcObj,
java.util.Dictionary dict)
Implementation for BundleContext.registerService(). |
protected void |
releaseBundleLock(org.apache.felix.framework.FelixBundle bundle)
|
protected void |
releaseBundleLocks(org.apache.felix.framework.FelixBundle[] bundles)
|
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(). |
protected boolean |
resolveBundles(org.osgi.framework.Bundle[] targets)
|
protected void |
setBundleStartLevel(org.osgi.framework.Bundle bundle,
int startLevel)
Sets the start level of the specified bundle; this method implements functionality for the Start Level service. |
protected void |
setFrameworkStartLevel(int requestedLevel)
Implements the functionality of the setStartLevel() method for the StartLevel service, but does not do the security or parameter check. |
protected void |
setInitialBundleStartLevel(int startLevel)
Sets the default start level into which newly installed bundles will be placed; this method implements functionality for the Start Level service. |
void |
start()
|
protected void |
startBundle(org.apache.felix.framework.FelixBundle bundle,
boolean record)
Implementation for Bundle.start(). |
void |
stop()
This method cleanly shuts down the framework, it must be called at the end of a session in order to shutdown all active bundles. |
void |
stopAndWait()
|
protected void |
stopBundle(org.apache.felix.framework.FelixBundle bundle,
boolean record)
|
java.lang.String |
toString()
|
protected boolean |
ungetService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceReference ref)
|
void |
uninstall()
|
protected void |
uninstallBundle(org.apache.felix.framework.FelixBundle bundle)
|
void |
update()
|
void |
update(java.io.InputStream is)
|
protected void |
updateBundle(org.apache.felix.framework.FelixBundle bundle,
java.io.InputStream is)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Felix(java.util.Map configMutableMap, java.util.List activatorList)
configMutableMap
- An map for obtaining configuration properties,
may be null.activatorList
- A list of System Bundle activators.Felix(Logger, Map, List)
public Felix(Logger logger, java.util.Map configMutableMap, java.util.List activatorList)
This method creates the framework instance; instances of the framework are not active until they are started. The constructor accepts a Map instance that will be used to obtain configuration or framework properties. Configuration properties are used internally by the framework and its extensions to alter its default behavior. Framework properties are used by bundles and are accessible from BundleContext.getProperty(). This map instance is used directly (i.e., it is not copied), which means that it is possible to change the property values externally at run time, but this is strongly discouraged for the framework's configuration properties.
Configuration properties are the sole means to configure the framework's default behavior; the framework does not 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. However, if the DefaulBundleCache is used, then at a minimum a profile name or profile directory must be specified.
The following configuration properties can be specified:
Besides the above framework configuration properties, it is also possible to specify properties for the bundle cache. The available bundle cache properties depend on the cache implementation being used. For the properties of the default bundle cache, refer to the DefaulBundleCache API documentation.
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.
logger
- The logger for use by the framework or null
use the default logger.configMutableMap
- A map for obtaining configuration properties,
may be null.activatorList
- A list of System Bundle activators.Method Detail |
---|
public org.osgi.framework.BundleContext getBundleContext()
public long getBundleId()
public java.net.URL getEntry(java.lang.String name)
public java.util.Enumeration getEntryPaths(java.lang.String path)
public java.util.Enumeration findEntries(java.lang.String path, java.lang.String filePattern, boolean recurse)
public java.util.Dictionary getHeaders()
public java.util.Dictionary getHeaders(java.lang.String locale)
public long getLastModified()
public java.lang.String getLocation()
public java.net.URL getResource(java.lang.String name)
public java.util.Enumeration getResources(java.lang.String name) throws java.io.IOException
java.io.IOException
public org.osgi.framework.ServiceReference[] getRegisteredServices()
public org.osgi.framework.ServiceReference[] getServicesInUse()
public int getState()
public java.lang.String getSymbolicName()
public boolean hasPermission(java.lang.Object obj)
public java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public void start() throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
public void stop() throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
public void stopAndWait()
public void uninstall() throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
public void update() throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
public void update(java.io.InputStream is) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
public java.lang.String toString()
toString
in class java.lang.Object
protected int getStartLevel()
protected void setFrameworkStartLevel(int requestedLevel)
requestedLevel
- The new start level of the framework.protected int getInitialBundleStartLevel()
protected void setInitialBundleStartLevel(int startLevel)
startLevel
- The new default start level for newly installed
bundles.
java.lang.IllegalArgumentException
- If the specified start
level is not greater than zero.
java.security.SecurityException
- If the caller does not
have AdminPermission.protected int getBundleStartLevel(org.osgi.framework.Bundle bundle)
bundle
- The bundle to examine.
java.lang.IllegalArgumentException
- If the specified
bundle has been uninstalled.protected void setBundleStartLevel(org.osgi.framework.Bundle bundle, int startLevel)
bundle
- The bundle whose start level is to be modified.startLevel
- The new start level of the specified bundle.
java.lang.IllegalArgumentException
- If the specified
bundle is the system bundle or if the bundle has been
uninstalled.
java.security.SecurityException
- If the caller does not
have AdminPermission.protected boolean isBundlePersistentlyStarted(org.osgi.framework.Bundle bundle)
bundle
- The bundle to examine.
java.lang.IllegalArgumentException
- If the specified
bundle has been uninstalled.protected java.lang.String getBundleSymbolicName(org.apache.felix.framework.FelixBundle bundle)
protected java.util.Dictionary getBundleHeaders(org.apache.felix.framework.FelixBundle bundle, java.lang.String locale)
bundle
- locale
-
protected java.lang.String getBundleLocation(org.apache.felix.framework.FelixBundle bundle)
protected java.net.URL getBundleResource(org.apache.felix.framework.FelixBundle bundle, java.lang.String name)
protected java.util.Enumeration getBundleResources(org.apache.felix.framework.FelixBundle bundle, java.lang.String name)
protected java.net.URL getBundleEntry(org.apache.felix.framework.FelixBundle bundle, java.lang.String name)
protected java.util.Enumeration getBundleEntryPaths(org.apache.felix.framework.FelixBundle bundle, java.lang.String path)
protected java.util.Enumeration findBundleEntries(org.apache.felix.framework.FelixBundle bundle, java.lang.String path, java.lang.String filePattern, boolean recurse)
protected org.osgi.framework.ServiceReference[] getBundleRegisteredServices(org.apache.felix.framework.FelixBundle bundle)
protected org.osgi.framework.ServiceReference[] getBundleServicesInUse(org.osgi.framework.Bundle bundle)
protected boolean bundleHasPermission(org.apache.felix.framework.FelixBundle bundle, java.lang.Object obj)
protected java.lang.Class loadBundleClass(org.apache.felix.framework.FelixBundle bundle, java.lang.String name) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
protected void startBundle(org.apache.felix.framework.FelixBundle bundle, boolean record) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
protected void _resolveBundle(org.apache.felix.framework.FelixBundle bundle) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
protected void updateBundle(org.apache.felix.framework.FelixBundle bundle, java.io.InputStream is) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
protected void _updateBundle(org.apache.felix.framework.FelixBundle bundle, java.io.InputStream is) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
protected void stopBundle(org.apache.felix.framework.FelixBundle bundle, boolean record) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
protected void uninstallBundle(org.apache.felix.framework.FelixBundle bundle) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
protected void addRequirement(org.apache.felix.framework.FelixBundle bundle, java.lang.String s) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
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.FelixBundle 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 org.osgi.framework.ServiceReference[] getServiceReferences(org.apache.felix.framework.FelixBundle bundle, java.lang.String className, java.lang.String expr, boolean checkAssignable) throws org.osgi.framework.InvalidSyntaxException
ServiceReference
objects based on calling bundle,
service class name, and filter expression. Optionally checks for isAssignable to
make sure that the service can be cast to the
bundle
- Calling BundleclassName
- Service Classname or null
for allexpr
- Filter Criteria or null
org.osgi.framework.InvalidSyntaxException
protected org.osgi.framework.ServiceReference[] getAllowedServiceReferences(org.apache.felix.framework.FelixBundle bundle, java.lang.String className, java.lang.String expr, boolean checkAssignable) throws org.osgi.framework.InvalidSyntaxException
ServiceReference
objects based on calling bundle, service class name,
optional filter expression, and optionally filters further on the version.
If running under a SecurityManager
, checks that the calling bundle has permissions to
see the service references and removes references that aren't.
bundle
- Calling BundleclassName
- Service Classname or null
for allexpr
- Filter Criteria or null
checkAssignable
- true
to check for isAssignable, false
to return all versions
org.osgi.framework.InvalidSyntaxException
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.FelixBundle 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[] getDependentBundles(org.apache.felix.framework.FelixBundle exporter)
protected org.osgi.framework.Bundle[] getImportingBundles(org.osgi.service.packageadmin.ExportedPackage ep)
protected boolean resolveBundles(org.osgi.framework.Bundle[] targets)
protected void refreshPackages(org.osgi.framework.Bundle[] targets)
protected void acquireInstallLock(java.lang.String location) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
protected void releaseInstallLock(java.lang.String location)
protected void acquireBundleLock(org.apache.felix.framework.FelixBundle bundle)
protected boolean acquireBundleLockOrFail(org.apache.felix.framework.FelixBundle bundle)
protected void releaseBundleLock(org.apache.felix.framework.FelixBundle bundle)
protected org.apache.felix.framework.FelixBundle[] acquireBundleResolveLocks(org.osgi.framework.Bundle[] targets)
protected org.apache.felix.framework.FelixBundle[] acquireBundleRefreshLocks(org.osgi.framework.Bundle[] targets)
protected void releaseBundleLocks(org.apache.felix.framework.FelixBundle[] bundles)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |