org.jboss.osgi.testing
Interface OSGiRuntime


public interface OSGiRuntime

An abstraction of an OSGi Runtime.

Since:
25-Sep-2008
Author:
Thomas.Diesler@jboss.org

Method Summary
 void addCapability(Capability capability)
          Add a Capability to the runtime.
 OSGiBundle getBundle(long bundleId)
          Get the OSGiBundle for a given bundle id.
 OSGiBundle getBundle(java.lang.String symbolicName, Version version)
          Get the OSGiBundle for a given symbolic name and version In case the version is left unspecified, it returns the first bundle that matches the symbolic name.
 OSGiBundle[] getBundles()
          Get the array of installed OSGiBundles
 javax.naming.InitialContext getInitialContext()
          Get the initial naming context for this OSGiRuntime
 javax.management.MBeanServerConnection getMBeanServer()
          Get the MBeanServerConnection for this OSGiRuntime
 OSGiPackageAdmin getPackageAdmin()
          Get an abstraction of the PackageAdmin.
 java.lang.String getServerHost()
          Get the host name that this OSGiRuntime is running on.
 OSGiServiceReference getServiceReference(java.lang.String clazz)
          Returns a ServiceReference object for a service that implements and was registered under the specified class.
 OSGiServiceReference getServiceReference(java.lang.String clazz, long timeout)
          Returns a ServiceReference object for a service that implements and was registered under the specified class.
 OSGiServiceReference[] getServiceReferences(java.lang.String clazz, java.lang.String filter)
          Returns an array of ServiceReference objects.
 OSGiBundle installBundle(java.lang.String location)
          Install an OSGiBundle from the given location.
 boolean isRemoteRuntime()
          Return true if this OSGiRuntime connects to a remote Framework.
 void removeCapability(Capability capability)
          Remove a Capability from the runtime.
 void shutdown()
          Shutdown the OSGiRuntime.
 

Method Detail

addCapability

void addCapability(Capability capability)
                   throws BundleException,
                          InvalidSyntaxException
Add a Capability to the runtime. Adding a capability recursively adds the orderded set of dependent capabilities before it installs and starts the orderded set bundles.

Throws:
BundleException
InvalidSyntaxException

removeCapability

void removeCapability(Capability capability)
Remove a Capability from the runtime. Removing a capability does the reverse of addCapability(Capability).


installBundle

OSGiBundle installBundle(java.lang.String location)
                         throws BundleException
Install an OSGiBundle from the given location.

Throws:
BundleException

getBundles

OSGiBundle[] getBundles()
Get the array of installed OSGiBundles


getBundle

OSGiBundle getBundle(java.lang.String symbolicName,
                     Version version)
Get the OSGiBundle for a given symbolic name and version In case the version is left unspecified, it returns the first bundle that matches the symbolic name.

Parameters:
version - may be null
Returns:
The bundle or null if there is none

getBundle

OSGiBundle getBundle(long bundleId)
Get the OSGiBundle for a given bundle id.

Returns:
The bundle or null if there is none

getPackageAdmin

OSGiPackageAdmin getPackageAdmin()
Get an abstraction of the PackageAdmin.


getServiceReference

OSGiServiceReference getServiceReference(java.lang.String clazz)
Returns a ServiceReference object for a service that implements and was registered under the specified class.

Returns:
A ServiceReference object, or null if no services are registered which implement the named class.

getServiceReference

OSGiServiceReference getServiceReference(java.lang.String clazz,
                                         long timeout)
Returns a ServiceReference object for a service that implements and was registered under the specified class.

Parameters:
timeout - the timeout to wait for the service to become available
Returns:
A ServiceReference object, or null if no services are registered which implement the named class.

getServiceReferences

OSGiServiceReference[] getServiceReferences(java.lang.String clazz,
                                            java.lang.String filter)
Returns an array of ServiceReference objects. The returned array of ServiceReference objects contains services that were registered under the specified class and match the specified filter criteria.


getInitialContext

javax.naming.InitialContext getInitialContext()
                                              throws javax.naming.NamingException
Get the initial naming context for this OSGiRuntime

Throws:
javax.naming.NamingException

getMBeanServer

javax.management.MBeanServerConnection getMBeanServer()
Get the MBeanServerConnection for this OSGiRuntime


getServerHost

java.lang.String getServerHost()
Get the host name that this OSGiRuntime is running on. This is the value of the 'jboss.bind.address' system property.


isRemoteRuntime

boolean isRemoteRuntime()
Return true if this OSGiRuntime connects to a remote Framework.


shutdown

void shutdown()
Shutdown the OSGiRuntime. This will remove all installed OSGiBundles and added Capability.



Copyright © 2009. All Rights Reserved.