org.jboss.osgi.testing
Class OSGiBundle

java.lang.Object
  extended by org.jboss.osgi.testing.OSGiBundle

public abstract class OSGiBundle
extends java.lang.Object

An abstraction of an OSGi Bundle.

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

Constructor Summary
OSGiBundle()
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Return true if symbolic name and version are equal
abstract  long getBundleId()
          Returns this bundle's unique identifier.
abstract  java.io.File getDataFile(java.lang.String filename)
          Creates a File object for a file in the persistent storage area provided for the bundle by the Framework.
abstract  java.net.URL getEntry(java.lang.String path)
          Returns a URL to the entry at the specified path in this bundle.
abstract  java.util.Dictionary<java.lang.String,java.lang.String> getHeaders()
          Returns this bundle's Manifest headers and values.
abstract  java.util.Dictionary<java.lang.String,java.lang.String> getHeaders(java.lang.String locale)
          Returns this bundle's Manifest headers and values localized to the specified locale.
abstract  java.lang.String getLocation()
          Returns this bundle's location.
abstract  java.lang.String getProperty(java.lang.String key)
          Returns the value of the specified property.
abstract  java.net.URL getResource(java.lang.String name)
          Find the specified resource from this bundle's class loader.
abstract  OSGiRuntime getRuntime()
          Get the runtime associated with this bundle.
abstract  int getState()
          Returns this bundle's current state.
abstract  java.lang.String getSymbolicName()
          Returns the symbolic name of this bundle as specified by its Bundle-SymbolicName manifest header.
abstract  org.osgi.framework.Version getVersion()
          Returns the version of this bundle.
 int hashCode()
          Returns the hash code for this bundle.
abstract  OSGiBundle loadClass(java.lang.String name)
          Loads the specified class using this bundle's class loader.
abstract  void start()
          Starts this bundle.
abstract  void stop()
          Stops this bundle.
 java.lang.String toString()
          Returns the string representation of this bundle
abstract  void uninstall()
          Uninstalls this bundle.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OSGiBundle

public OSGiBundle()
Method Detail

getRuntime

public abstract OSGiRuntime getRuntime()
Get the runtime associated with this bundle.


getBundleId

public abstract long getBundleId()
Returns this bundle's unique identifier.


getSymbolicName

public abstract java.lang.String getSymbolicName()
Returns the symbolic name of this bundle as specified by its Bundle-SymbolicName manifest header.


getVersion

public abstract org.osgi.framework.Version getVersion()
Returns the version of this bundle.


getLocation

public abstract java.lang.String getLocation()
Returns this bundle's location.


getHeaders

public abstract java.util.Dictionary<java.lang.String,java.lang.String> getHeaders()
Returns this bundle's Manifest headers and values.


getHeaders

public abstract java.util.Dictionary<java.lang.String,java.lang.String> getHeaders(java.lang.String locale)
Returns this bundle's Manifest headers and values localized to the specified locale.


getState

public abstract int getState()
Returns this bundle's current state.


getProperty

public abstract java.lang.String getProperty(java.lang.String key)
Returns the value of the specified property.


getDataFile

public abstract java.io.File getDataFile(java.lang.String filename)
Creates a File object for a file in the persistent storage area provided for the bundle by the Framework.


loadClass

public abstract OSGiBundle loadClass(java.lang.String name)
                              throws java.lang.ClassNotFoundException
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:
java.lang.ClassNotFoundException - If no such class can be found or if this bundle is a fragment bundle

getEntry

public abstract java.net.URL getEntry(java.lang.String path)
Returns a URL to the entry at the specified path in this bundle.

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

getResource

public abstract java.net.URL getResource(java.lang.String name)
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

start

public abstract void start()
                    throws org.osgi.framework.BundleException
Starts this bundle.

Throws:
org.osgi.framework.BundleException

stop

public abstract void stop()
                   throws org.osgi.framework.BundleException
Stops this bundle.

Throws:
org.osgi.framework.BundleException

uninstall

public abstract void uninstall()
                        throws org.osgi.framework.BundleException
Uninstalls this bundle.

Throws:
org.osgi.framework.BundleException

equals

public boolean equals(java.lang.Object obj)
Return true if symbolic name and version are equal

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns the hash code for this bundle.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns the string representation of this bundle

Overrides:
toString in class java.lang.Object


Copyright © 2010. All Rights Reserved.