org.jboss.osgi.spi.management
Class ManagedBundle

java.lang.Object
  extended by org.jboss.osgi.spi.management.ManagedBundle
All Implemented Interfaces:
ManagedBundleMBean

public class ManagedBundle
extends java.lang.Object
implements ManagedBundleMBean

The managed view of an OSGi Bundle

Since:
23-Jan-2009
Author:
thomas.diesler@jboss.com

Field Summary
static java.lang.String PROPERTY_ID
           
static java.lang.String PROPERTY_SYMBOLIC_NAME
           
static java.lang.String PROPERTY_VERSION
           
 
Constructor Summary
ManagedBundle(org.osgi.framework.BundleContext context, org.osgi.framework.Bundle bundle)
           
 
Method Summary
 long getBundleId()
          Returns this bundle's unique identifier.
 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.
 java.lang.String getEntry(java.lang.String path)
          Returns a string encoded URL to the entry at the specified path in this bundle.
 java.util.Dictionary<java.lang.String,java.lang.String> getHeaders()
          Returns the bundle manifest headers
 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.
 java.lang.String getLocation()
          Returns the location of this bundle
 javax.management.ObjectName getObjectName()
          Get the bundles object name.
static javax.management.ObjectName getObjectName(org.osgi.framework.Bundle bundle)
           
static javax.management.ObjectName getObjectName(long id, java.lang.String name, org.osgi.framework.Version version)
           
 java.lang.String getProperty(java.lang.String key)
          Returns the value of the specified property from the BundleContext.
 java.lang.String getResource(java.lang.String name)
          Find the specified resource from this bundle's class loader.
 int getState()
          Returns this bundle's current state.
 java.lang.String getSymbolicName()
          Returns the symbolic name of this bundle as specified by its Bundle-SymbolicName manifest header
 javax.management.ObjectName loadClass(java.lang.String name)
          Loads the specified class using this bundle's class loader.
 void start()
          Starts this bundle with no options
 void stop()
          Stops this bundle with no options.
 void update()
          Update this bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_ID

public static final java.lang.String PROPERTY_ID
See Also:
Constant Field Values

PROPERTY_SYMBOLIC_NAME

public static final java.lang.String PROPERTY_SYMBOLIC_NAME
See Also:
Constant Field Values

PROPERTY_VERSION

public static final java.lang.String PROPERTY_VERSION
See Also:
Constant Field Values
Constructor Detail

ManagedBundle

public ManagedBundle(org.osgi.framework.BundleContext context,
                     org.osgi.framework.Bundle bundle)
Method Detail

getObjectName

public static javax.management.ObjectName getObjectName(org.osgi.framework.Bundle bundle)

getObjectName

public static javax.management.ObjectName getObjectName(long id,
                                                        java.lang.String name,
                                                        org.osgi.framework.Version version)

getObjectName

public javax.management.ObjectName getObjectName()
Description copied from interface: ManagedBundleMBean
Get the bundles object name.

Specified by:
getObjectName in interface ManagedBundleMBean

getProperty

public java.lang.String getProperty(java.lang.String key)
Description copied from interface: ManagedBundleMBean
Returns the value of the specified property from the BundleContext.

Specified by:
getProperty in interface ManagedBundleMBean

getState

public int getState()
Description copied from interface: ManagedBundleMBean
Returns this bundle's current state. A bundle can be in only one state at any time.

Specified by:
getState in interface ManagedBundleMBean
Returns:
An element of UNINSTALLED,INSTALLED, RESOLVED,STARTING, STOPPING,ACTIVE.

getBundleId

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

Specified by:
getBundleId in interface ManagedBundleMBean

getSymbolicName

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

Specified by:
getSymbolicName in interface ManagedBundleMBean

getLocation

public java.lang.String getLocation()
Description copied from interface: ManagedBundleMBean
Returns the location of this bundle

Specified by:
getLocation in interface ManagedBundleMBean

getHeaders

public java.util.Dictionary<java.lang.String,java.lang.String> getHeaders()
Description copied from interface: ManagedBundleMBean
Returns the bundle manifest headers

Specified by:
getHeaders in interface ManagedBundleMBean

getHeaders

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

Specified by:
getHeaders in interface ManagedBundleMBean

getEntry

public java.lang.String getEntry(java.lang.String path)
Description copied from interface: ManagedBundleMBean
Returns a string encoded URL to the entry at the specified path in this bundle.

Specified by:
getEntry in interface ManagedBundleMBean
Returns:
A URL to the entry, or null if no entry could be found

getResource

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

Specified by:
getResource in interface ManagedBundleMBean
Parameters:
name - The name of the resource.
Returns:
A string encoded URL to the named resource, or null if the resource could not be found

loadClass

public javax.management.ObjectName loadClass(java.lang.String name)
                                      throws java.lang.ClassNotFoundException
Description copied from interface: ManagedBundleMBean
Loads the specified class using this bundle's class loader.

Specified by:
loadClass in interface ManagedBundleMBean
Parameters:
name - The name of the class to load
Returns:
The object name of the bundle 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

getDataFile

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

Specified by:
getDataFile in interface ManagedBundleMBean

start

public void start()
           throws org.osgi.framework.BundleException
Description copied from interface: ManagedBundleMBean
Starts this bundle with no options

Specified by:
start in interface ManagedBundleMBean
Throws:
org.osgi.framework.BundleException

stop

public void stop()
          throws org.osgi.framework.BundleException
Description copied from interface: ManagedBundleMBean
Stops this bundle with no options.

Specified by:
stop in interface ManagedBundleMBean
Throws:
org.osgi.framework.BundleException

update

public void update()
            throws org.osgi.framework.BundleException
Description copied from interface: ManagedBundleMBean
Update this bundle.

Specified by:
update in interface ManagedBundleMBean
Throws:
org.osgi.framework.BundleException


Copyright © 2010. All Rights Reserved.