org.jboss.osgi.spi.capability
Class Capability

java.lang.Object
  extended by org.jboss.osgi.spi.capability.Capability
Direct Known Subclasses:
CompendiumCapability, ConfigAdminCapability, EventAdminCapability, LoggingCapability, LogServiceCapability, WebAppCapability, XMLParserCapability

public abstract class Capability
extends Object

An abstract OSGi capability that can be installed in an OSGiRuntime. The capability is only installed if the service name given in the constructor is not already registered with the OSGi framework. It maintains an ordered set of dependent capabilities and bundles that must be installed to provide the functionality advertised by this capability.

Since:
05-May-2009
Author:
thomas.diesler@jboss.com

Constructor Summary
Capability(String serviceName)
          Construct a capability that is identified by the given service name.
Capability(String serviceName, String filter)
          Construct a capability that is identified by the given service name and filter string.
 
Method Summary
protected  void addBundle(String location)
           
protected  void addDependency(Capability dependency)
           
 void addSystemProperty(String key, String value)
          Add a system property provided by this capability.
 List<BundleInfo> getBundles()
           
 List<Capability> getDependencies()
           
 String getFilter()
          Get the filter that is used for service lookup.
 List<OSGiBundle> getInstalledBundles()
           
 String getServiceName()
          Get the service name associated with this capability.
 Map<String,String> getSystemProperties()
          Get the system properties for this capability.
 void install(OSGiRuntime runtime)
           
 void setFilter(String filter)
          Set the filter that is used for service lookup.
 void start(OSGiRuntime runtime)
           
 void stop(OSGiRuntime runtime)
           
 void uninstall(OSGiRuntime runtime)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Capability

public Capability(String serviceName)
Construct a capability that is identified by the given service name. If the service name is already registered with the OSGiRuntime adding this capability does nothing. If the service name is null the capability will install each associated bundle unless a bundle with the same symbolic name is already installed.

Parameters:
serviceName - The service that would be registered by this capability.

Capability

public Capability(String serviceName,
                  String filter)
Construct a capability that is identified by the given service name and filter string. If the service is already registered with the OSGiRuntime adding this capability does nothing.

Method Detail

getServiceName

public String getServiceName()
Get the service name associated with this capability.


getFilter

public String getFilter()
Get the filter that is used for service lookup.


setFilter

public void setFilter(String filter)
Set the filter that is used for service lookup.


addSystemProperty

public void addSystemProperty(String key,
                              String value)
Add a system property provided by this capability. Adding this capability will set the associated system properties if a propperty is not set already.


getSystemProperties

public Map<String,String> getSystemProperties()
Get the system properties for this capability.


getDependencies

public List<Capability> getDependencies()

addDependency

protected void addDependency(Capability dependency)

getBundles

public List<BundleInfo> getBundles()

addBundle

protected void addBundle(String location)

getInstalledBundles

public List<OSGiBundle> getInstalledBundles()

install

public void install(OSGiRuntime runtime)
             throws BundleException
Throws:
BundleException

start

public void start(OSGiRuntime runtime)
           throws BundleException
Throws:
BundleException

stop

public void stop(OSGiRuntime runtime)

uninstall

public void uninstall(OSGiRuntime runtime)


Copyright © 2011. All Rights Reserved.