org.jboss.osgi.testing.internal
Class OSGiRuntimeImpl

java.lang.Object
  extended by org.jboss.osgi.testing.internal.OSGiRuntimeImpl
All Implemented Interfaces:
OSGiRuntime
Direct Known Subclasses:
EmbeddedRuntime, RemoteRuntime

public abstract class OSGiRuntimeImpl
extends Object
implements OSGiRuntime

An abstract implementation of the OSGiRuntime

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

Constructor Summary
OSGiRuntimeImpl(OSGiRuntimeHelper helper)
           
 
Method Summary
 void addCapability(Capability capability)
          Add a Capability to the runtime.
 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.
 org.osgi.jmx.framework.BundleStateMBean getBundleStateMBean()
          Get the BundleStateMBean
 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.
 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, long timeout)
          Returns a ServiceReference object for a service that implements and was registered under the specified class.
 org.osgi.jmx.framework.ServiceStateMBean getServiceStateMBean()
          Get the ServiceStateMBean
 OSGiRuntimeHelper getTestHelper()
           
 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 virtualFile)
          Install an OSGiBundle from the given virtual file.
 void removeCapability(Capability capability)
          Remove a Capability from the runtime.
 void shutdown()
          Shutdown the OSGiRuntime.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.osgi.testing.OSGiRuntime
getBundle, getBundles, getMBeanServer, getServiceReference, getServiceReferences, isRemoteRuntime, refreshPackages
 

Constructor Detail

OSGiRuntimeImpl

public OSGiRuntimeImpl(OSGiRuntimeHelper helper)
Method Detail

getTestHelper

public OSGiRuntimeHelper getTestHelper()

addCapability

public void addCapability(Capability capability)
                   throws org.osgi.framework.BundleException
Description copied from interface: OSGiRuntime
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.

Specified by:
addCapability in interface OSGiRuntime
Throws:
org.osgi.framework.BundleException

removeCapability

public void removeCapability(Capability capability)
Description copied from interface: OSGiRuntime
Remove a Capability from the runtime. Removing a capability does the reverse of OSGiRuntime.addCapability(Capability).

Specified by:
removeCapability in interface OSGiRuntime

installBundle

public OSGiBundle installBundle(String location)
                         throws org.osgi.framework.BundleException
Description copied from interface: OSGiRuntime
Install an OSGiBundle from the given location.

Specified by:
installBundle in interface OSGiRuntime
Throws:
org.osgi.framework.BundleException

installBundle

public OSGiBundle installBundle(org.jboss.shrinkwrap.api.Archive<?> archive)
                         throws org.osgi.framework.BundleException,
                                IOException
Description copied from interface: OSGiRuntime
Install an OSGiBundle from the given archive.

Specified by:
installBundle in interface OSGiRuntime
Throws:
org.osgi.framework.BundleException
IOException

installBundle

public OSGiBundle installBundle(org.jboss.osgi.vfs.VirtualFile virtualFile)
                         throws org.osgi.framework.BundleException
Description copied from interface: OSGiRuntime
Install an OSGiBundle from the given virtual file.

Specified by:
installBundle in interface OSGiRuntime
Throws:
org.osgi.framework.BundleException

shutdown

public void shutdown()
Description copied from interface: OSGiRuntime
Shutdown the OSGiRuntime. This will remove added Capability.

Specified by:
shutdown in interface OSGiRuntime

getMBeanProxy

public <T> T getMBeanProxy(ObjectName name,
                           Class<T> interf)
Description copied from interface: OSGiRuntime
Get an MBeanProxy for the given interface.

Specified by:
getMBeanProxy in interface OSGiRuntime

getFrameworkMBean

public org.osgi.jmx.framework.FrameworkMBean getFrameworkMBean()
                                                        throws IOException
Description copied from interface: OSGiRuntime
Get the FrameworkMBean

Specified by:
getFrameworkMBean in interface OSGiRuntime
Throws:
IOException

getBundleStateMBean

public org.osgi.jmx.framework.BundleStateMBean getBundleStateMBean()
                                                            throws IOException
Description copied from interface: OSGiRuntime
Get the BundleStateMBean

Specified by:
getBundleStateMBean in interface OSGiRuntime
Throws:
IOException

getPackageStateMBean

public org.osgi.jmx.framework.PackageStateMBean getPackageStateMBean()
                                                              throws IOException
Description copied from interface: OSGiRuntime
Get the PackageStateMBean

Specified by:
getPackageStateMBean in interface OSGiRuntime
Throws:
IOException

getServiceStateMBean

public org.osgi.jmx.framework.ServiceStateMBean getServiceStateMBean()
                                                              throws IOException
Description copied from interface: OSGiRuntime
Get the ServiceStateMBean

Specified by:
getServiceStateMBean in interface OSGiRuntime
Throws:
IOException

getInitialContext

public InitialContext getInitialContext()
                                 throws NamingException
Description copied from interface: OSGiRuntime
Get the initial naming context for this OSGiRuntime

Specified by:
getInitialContext in interface OSGiRuntime
Throws:
NamingException

getServerHost

public String getServerHost()
Description copied from interface: OSGiRuntime
Get the host name that this OSGiRuntime is running on. This is the value of the 'jboss.bind.address' system property.

Specified by:
getServerHost in interface OSGiRuntime

getBundle

public OSGiBundle getBundle(String symbolicName,
                            org.osgi.framework.Version version)
Description copied from interface: OSGiRuntime
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.

Specified by:
getBundle in interface OSGiRuntime
version - may be null
Returns:
The bundle or null if there is none

getServiceReference

public OSGiServiceReference getServiceReference(String clazz,
                                                long timeout)
Description copied from interface: OSGiRuntime
Returns a ServiceReference object for a service that implements and was registered under the specified class.

Specified by:
getServiceReference in interface OSGiRuntime
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.


Copyright © 2010. All Rights Reserved.