org.jboss.osgi.spi.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(java.lang.String symbolicName, java.lang.String 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[] 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.
 void removeCapability(Capability capability)
          Remove a Capability from the runtime.
 void shutdown()
          Shutdown the OSGiRuntime.
 void startLogEntryTracking(LogEntryCache logEntryCache)
          Start log entry tracking for this OSGiRuntime
 void stopLogEntryTracking()
          Stop log entry tracking for this OSGiRuntime
 

Method Detail

addCapability

void addCapability(Capability capability)
                   throws org.osgi.framework.BundleException
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:
org.osgi.framework.BundleException

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 org.osgi.framework.BundleException
Install an OSGiBundle from the given location.

Throws:
org.osgi.framework.BundleException

getBundles

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


getBundle

OSGiBundle getBundle(java.lang.String symbolicName,
                     java.lang.String 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

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.

getServiceReferences

OSGiServiceReference[] getServiceReferences(java.lang.String clazz,
                                            java.lang.String filter)
                                            throws org.osgi.framework.InvalidSyntaxException
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.

Throws:
org.osgi.framework.InvalidSyntaxException

startLogEntryTracking

void startLogEntryTracking(LogEntryCache logEntryCache)
Start log entry tracking for this OSGiRuntime

See Also:
RemoteLogCapability}

stopLogEntryTracking

void stopLogEntryTracking()
Stop log entry tracking for this OSGiRuntime

See Also:
RemoteLogCapability}

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.


shutdown

void shutdown()
Shutdown the OSGiRuntime. This will remove all added Capability. The installed bundles are currently NOT uninstalled automatically. [TODO] JBOSGI-93



Copyright © 2009. All Rights Reserved.