org.jboss.osgi.testing
Interface OSGiRuntime

All Known Implementing Classes:
EmbeddedRuntime, OSGiRuntimeImpl, RemoteRuntime

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, org.osgi.framework.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
 org.osgi.jmx.framework.BundleStateMBean getBundleStateMBean()
          Get the BundleStateMBean
 ClipboardMBean getClipboardMBean()
          Get the ClipboardMBean
 org.osgi.jmx.framework.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
 org.osgi.jmx.framework.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.
 org.osgi.jmx.framework.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(org.jboss.osgi.vfs.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 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(org.jboss.shrinkwrap.api.Archive<?> archive)
                         throws org.osgi.framework.BundleException,
                                IOException
Install an OSGiBundle from the given archive.

Throws:
org.osgi.framework.BundleException
IOException

installBundle

OSGiBundle installBundle(org.jboss.osgi.vfs.VirtualFile vfsfile)
                         throws org.osgi.framework.BundleException,
                                IOException
Install an OSGiBundle from the given virtual file.

Throws:
org.osgi.framework.BundleException
IOException

installBundle

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

Throws:
org.osgi.framework.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

org.osgi.jmx.framework.FrameworkMBean getFrameworkMBean()
                                                        throws IOException
Get the FrameworkMBean

Throws:
IOException

getBundleStateMBean

org.osgi.jmx.framework.BundleStateMBean getBundleStateMBean()
                                                            throws IOException
Get the BundleStateMBean

Throws:
IOException

getServiceStateMBean

org.osgi.jmx.framework.ServiceStateMBean getServiceStateMBean()
                                                              throws IOException
Get the ServiceStateMBean

Throws:
IOException

getPackageStateMBean

org.osgi.jmx.framework.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,
                     org.osgi.framework.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. All Rights Reserved.