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(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
 BundleStateMBean getBundleStateMBean()
          Get the BundleStateMBean
 ClipboardMBean getClipboardMBean()
          Get the ClipboardMBean
 FrameworkMBean getFrameworkMBean()
          Get the FrameworkMBean
 InitialContext getInitialContext()
          Get the initial naming context for this OSGiRuntime
<T> T
getMBeanProxy(ObjectName name, Class<T> interf)
          Get an MBeanProxy for the given interface.
 MBeanServerConnection getMBeanServer()
          Get the MBeanServerConnection for this OSGiRuntime
 PackageStateMBean getPackageStateMBean()
          Get the PackageStateMBean
 String getServerHost()
          Get the host name that this OSGiRuntime is running on.
 OSGiServiceReference getServiceReference(String clazz)
          Returns a ServiceReference object for a service that implements and was registered under the specified class.
 OSGiServiceReference getServiceReference(String clazz, long timeout)
          Returns a ServiceReference object for a service that implements and was registered under the specified class.
 OSGiServiceReference[] getServiceReferences(String clazz, String filter)
          Returns an array of ServiceReference objects.
 ServiceStateMBean getServiceStateMBean()
          Get the ServiceStateMBean
 OSGiBundle installBundle(org.jboss.shrinkwrap.api.Archive<?> archive)
          Install an OSGiBundle from the given archive.
 OSGiBundle installBundle(String location)
          Install an OSGiBundle from the given location.
 OSGiBundle installBundle(VirtualFile vfsfile)
          Install an OSGiBundle from the given virtual file.
 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
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

removeCapability

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


installBundle

OSGiBundle installBundle(org.jboss.shrinkwrap.api.Archive<?> archive)
                         throws BundleException,
                                IOException
Install an OSGiBundle from the given archive.

Throws:
BundleException
IOException

installBundle

OSGiBundle installBundle(VirtualFile vfsfile)
                         throws BundleException,
                                IOException
Install an OSGiBundle from the given virtual file.

Throws:
BundleException
IOException

installBundle

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

Throws:
BundleException

getMBeanServer

MBeanServerConnection getMBeanServer()
Get the MBeanServerConnection for this OSGiRuntime


getMBeanProxy

<T> T getMBeanProxy(ObjectName name,
                    Class<T> interf)
Get an MBeanProxy for the given interface.


getFrameworkMBean

FrameworkMBean getFrameworkMBean()
                                 throws IOException
Get the FrameworkMBean

Throws:
IOException

getBundleStateMBean

BundleStateMBean getBundleStateMBean()
                                     throws IOException
Get the BundleStateMBean

Throws:
IOException

getServiceStateMBean

ServiceStateMBean getServiceStateMBean()
                                       throws IOException
Get the ServiceStateMBean

Throws:
IOException

getPackageStateMBean

PackageStateMBean getPackageStateMBean()
                                       throws IOException
Get the PackageStateMBean

Throws:
IOException

getClipboardMBean

ClipboardMBean getClipboardMBean()
                                 throws IOException
Get the ClipboardMBean

Throws:
IOException

getBundles

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


getBundle

OSGiBundle getBundle(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

getServiceReference

OSGiServiceReference getServiceReference(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(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(String clazz,
                                            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

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

Throws:
NamingException

getServerHost

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 © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.