org.jboss.osgi.testing.internal
Class EmbeddedBundle

java.lang.Object
  extended by org.jboss.osgi.testing.internal.OSGiBundleImpl
      extended by org.jboss.osgi.testing.internal.EmbeddedBundle
All Implemented Interfaces:
OSGiBundle

public class EmbeddedBundle
extends OSGiBundleImpl

An OSGi Test Case

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

Constructor Summary
EmbeddedBundle(OSGiRuntimeImpl runtime, org.osgi.framework.Bundle bundle)
           
 
Method Summary
 org.osgi.framework.Bundle getBundle()
           
 long getBundleId()
          Returns this bundle's unique identifier.
 File getDataFile(String filename)
          Creates a File object for a file in the persistent storage area provided for the bundle by the Framework.
 URL getEntry(String path)
          Returns a URL to the entry at the specified path in this bundle.
 Dictionary<String,String> getHeaders()
          Returns this bundle's Manifest headers and values.
 Dictionary<String,String> getHeaders(String locale)
          Returns this bundle's Manifest headers and values localized to the specified locale.
 String getLocation()
          Returns this bundle's location.
 String getProperty(String key)
          Returns the value of the specified property.
 URL getResource(String name)
          Find the specified resource from this bundle's class loader.
 int getState()
          Returns this bundle's current state.
 String getSymbolicName()
          Returns the symbolic name of this bundle as specified by its Bundle-SymbolicName manifest header.
 org.osgi.framework.Version getVersion()
          Returns the version of this bundle.
 OSGiBundle loadClass(String name)
          Loads the specified class using this bundle's class loader.
protected  void startInternal()
           
protected  void stopInternal()
           
protected  void uninstallInternal()
           
 
Methods inherited from class org.jboss.osgi.testing.internal.OSGiBundleImpl
equals, getRuntime, hashCode, start, stop, toString, uninstall
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EmbeddedBundle

public EmbeddedBundle(OSGiRuntimeImpl runtime,
                      org.osgi.framework.Bundle bundle)
Method Detail

getBundle

public org.osgi.framework.Bundle getBundle()

getState

public int getState()
Description copied from interface: OSGiBundle
Returns this bundle's current state.


getSymbolicName

public String getSymbolicName()
Description copied from interface: OSGiBundle
Returns the symbolic name of this bundle as specified by its Bundle-SymbolicName manifest header.


getVersion

public org.osgi.framework.Version getVersion()
Description copied from interface: OSGiBundle
Returns the version of this bundle.


getLocation

public String getLocation()
Description copied from interface: OSGiBundle
Returns this bundle's location.


getHeaders

public Dictionary<String,String> getHeaders()
Description copied from interface: OSGiBundle
Returns this bundle's Manifest headers and values.


getHeaders

public Dictionary<String,String> getHeaders(String locale)
Description copied from interface: OSGiBundle
Returns this bundle's Manifest headers and values localized to the specified locale.


getBundleId

public long getBundleId()
Description copied from interface: OSGiBundle
Returns this bundle's unique identifier.


getProperty

public String getProperty(String key)
Description copied from interface: OSGiBundle
Returns the value of the specified property.


getEntry

public URL getEntry(String path)
Description copied from interface: OSGiBundle
Returns a URL to the entry at the specified path in this bundle.

Parameters:
path - The path name of the entry
Returns:
A URL to the entry, or null if no entry could be found

getResource

public URL getResource(String name)
Description copied from interface: OSGiBundle
Find the specified resource from this bundle's class loader.

Parameters:
name - The name of the resource.
Returns:
A URL to the named resource, or null if the resource could not be found

getDataFile

public File getDataFile(String filename)
Description copied from interface: OSGiBundle
Creates a File object for a file in the persistent storage area provided for the bundle by the Framework.


loadClass

public OSGiBundle loadClass(String name)
                     throws ClassNotFoundException
Description copied from interface: OSGiBundle
Loads the specified class using this bundle's class loader.

Parameters:
name - The name of the class to load
Returns:
The OSGiBundle that is wired to this bundle class loader and contains the class.
Throws:
ClassNotFoundException - If no such class can be found or if this bundle is a fragment bundle

startInternal

protected void startInternal()
                      throws org.osgi.framework.BundleException
Specified by:
startInternal in class OSGiBundleImpl
Throws:
org.osgi.framework.BundleException

stopInternal

protected void stopInternal()
                     throws org.osgi.framework.BundleException
Specified by:
stopInternal in class OSGiBundleImpl
Throws:
org.osgi.framework.BundleException

uninstallInternal

protected void uninstallInternal()
                          throws org.osgi.framework.BundleException
Specified by:
uninstallInternal in class OSGiBundleImpl
Throws:
org.osgi.framework.BundleException


Copyright © 2010. All Rights Reserved.