org.osgi.jmx.codec
Class OSGiBundle

java.lang.Object
  extended by org.osgi.jmx.codec.OSGiBundle

public class OSGiBundle
extends java.lang.Object

Author:
Hal Hildebrand Date: Nov 24, 2008 Time: 7:19:21 AM

This class represents the CODEC for the composite data representing a single OSGi Bundle.

It serves as both the documentation of the type structure and as the codification of the mechanism to convert to/from the CompositeData.

The structure of the composite data is:

Location String
Identifier long
SymbolicName String
StartLevel int
State String
LastModified long
PersistentlyStarted boolean
RemovalPending boolean
Required boolean
Fragment boolean
RegisteredServices Array of long
ServicesInUse Array of long
Headers TabularData of Key/Value String pairs
ExportedPackages Array of String
ImportedPackages Array of String
Fragments Array of long
Hosts Array of long
RequiredBundles Array of long
RequiringBundles Array of long

Field Summary
static javax.management.openmbean.CompositeType BUNDLE
          The CompositeType which represents a single OSGi bundle
static javax.management.openmbean.CompositeType BUNDLE_HEADER
          The CompositeType which represents a key/value header pair
static javax.management.openmbean.TabularType BUNDLE_HEADER_TABLE
          The TabularType which represents the map of bundle headers
static javax.management.openmbean.TabularType BUNDLE_TABLE
          The TabularType which represents a list of bundles
 
Constructor Summary
OSGiBundle(org.osgi.framework.BundleContext bc, org.osgi.service.packageadmin.PackageAdmin admin, org.osgi.service.startlevel.StartLevel sl, org.osgi.framework.Bundle b)
          Construct an OSGiBundle representation
OSGiBundle(javax.management.openmbean.CompositeData data)
          Construct an OSGiBundle from the encoded CompositeData
OSGiBundle(java.lang.String location, long identifier, java.lang.String symbolicName, int startLevel, java.lang.String state, long lastModified, boolean persistentlyStarted, boolean removalPending, boolean required, boolean fragment, long[] registeredServices, long[] servicesInUse, java.util.Map<java.lang.String,java.lang.String> headers, java.lang.String[] exportedPackages, java.lang.String[] importedPackages, long[] fragments, long[] hosts, long[] requiredBundles, long[] requiringBundles)
          Construct and OSGiBundle
 
Method Summary
 javax.management.openmbean.CompositeData asCompositeData()
          Answer the receiver encoded as CompositeData
 java.lang.String[] getExportedPackages()
           
 long[] getFragments()
           
 java.util.Map<java.lang.String,java.lang.String> getHeaders()
           
 long[] getHosts()
           
 long getIdentifier()
           
 java.lang.String[] getImportedPackages()
           
 long getLastModified()
           
 java.lang.String getLocation()
           
 long[] getRegisteredServices()
           
 long[] getRequiredBundles()
           
 long[] getRequiringBundles()
           
 long[] getServicesInUse()
           
 int getStartLevel()
           
 java.lang.String getState()
           
 java.lang.String getSymbolicName()
           
static javax.management.openmbean.TabularData headerTable(org.osgi.framework.Bundle b)
          Answer the TabularData representing the list of bundle headers for a bundle
static javax.management.openmbean.TabularData headerTable(java.util.Map<java.lang.String,java.lang.String> headers)
           
 boolean isFragment()
           
 boolean isPersistentlyStarted()
           
 boolean isRemovalPending()
           
 boolean isRequired()
           
static javax.management.openmbean.TabularData tableFrom(java.util.ArrayList<OSGiBundle> bundles)
          Answer the TabularData representing the list of OSGiBundle state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLE_HEADER

public static final javax.management.openmbean.CompositeType BUNDLE_HEADER
The CompositeType which represents a key/value header pair


BUNDLE_HEADER_TABLE

public static final javax.management.openmbean.TabularType BUNDLE_HEADER_TABLE
The TabularType which represents the map of bundle headers


BUNDLE

public static final javax.management.openmbean.CompositeType BUNDLE
The CompositeType which represents a single OSGi bundle


BUNDLE_TABLE

public static final javax.management.openmbean.TabularType BUNDLE_TABLE
The TabularType which represents a list of bundles

Constructor Detail

OSGiBundle

public OSGiBundle(javax.management.openmbean.CompositeData data)
Construct an OSGiBundle from the encoded CompositeData

Parameters:
data - - the encoded representation of the bundle

OSGiBundle

public OSGiBundle(org.osgi.framework.BundleContext bc,
                  org.osgi.service.packageadmin.PackageAdmin admin,
                  org.osgi.service.startlevel.StartLevel sl,
                  org.osgi.framework.Bundle b)
Construct an OSGiBundle representation

Parameters:
bc - - the BundleContext to be used.
admin - - the PackageAdmin service
sl - - the StartLevel service
b - - the Bundle to represent

OSGiBundle

public OSGiBundle(java.lang.String location,
                  long identifier,
                  java.lang.String symbolicName,
                  int startLevel,
                  java.lang.String state,
                  long lastModified,
                  boolean persistentlyStarted,
                  boolean removalPending,
                  boolean required,
                  boolean fragment,
                  long[] registeredServices,
                  long[] servicesInUse,
                  java.util.Map<java.lang.String,java.lang.String> headers,
                  java.lang.String[] exportedPackages,
                  java.lang.String[] importedPackages,
                  long[] fragments,
                  long[] hosts,
                  long[] requiredBundles,
                  long[] requiringBundles)
Construct and OSGiBundle

Parameters:
location -
identifier -
symbolicName -
startLevel -
state -
lastModified -
persistentlyStarted -
removalPending -
required -
fragment -
registeredServices -
servicesInUse -
headers -
exportedPackages -
importedPackages -
fragments -
hosts -
requiredBundles -
requiringBundles -
Method Detail

tableFrom

public static javax.management.openmbean.TabularData tableFrom(java.util.ArrayList<OSGiBundle> bundles)
Answer the TabularData representing the list of OSGiBundle state

Parameters:
bundles - - the list of bundles to represent
Returns:
the Tabular data which represents the list of bundles

headerTable

public static javax.management.openmbean.TabularData headerTable(org.osgi.framework.Bundle b)
Answer the TabularData representing the list of bundle headers for a bundle

Parameters:
b -
Returns:
the bundle headers

headerTable

public static javax.management.openmbean.TabularData headerTable(java.util.Map<java.lang.String,java.lang.String> headers)

asCompositeData

public javax.management.openmbean.CompositeData asCompositeData()
Answer the receiver encoded as CompositeData

Returns:
the CompositeData encoding of the receiver.

getExportedPackages

public java.lang.String[] getExportedPackages()
Returns:
The list of exported packages by this bundle, in the form of ;

getFragments

public long[] getFragments()
Returns:
the list of identifiers of the bundle fragments which use this bundle as a host

getHeaders

public java.util.Map<java.lang.String,java.lang.String> getHeaders()
Returns:
the map of headers for this bundle

getHosts

public long[] getHosts()
Returns:
list of identifiers of the bundles which host this fragment

getIdentifier

public long getIdentifier()
Returns:
the identifier of this bundle

getImportedPackages

public java.lang.String[] getImportedPackages()
Returns:
The list of imported packages by this bundle, in the form of ;

getLastModified

public long getLastModified()
Returns:
the last modified time of this bundle

getLocation

public java.lang.String getLocation()
Returns:
the name of this bundle

getRegisteredServices

public long[] getRegisteredServices()
Returns:
the list of identifiers of the services registered by this bundle

getRequiredBundles

public long[] getRequiredBundles()
Returns:
the list of identifiers of bundles required by this bundle

getRequiringBundles

public long[] getRequiringBundles()
Returns:
the list of identifiers of bundles which require this bundle

getServicesInUse

public long[] getServicesInUse()
Returns:
the list of identifiers of services in use by this bundle

getStartLevel

public int getStartLevel()
Returns:
the start level of this bundle

getState

public java.lang.String getState()
Returns:
the state of this bundle

getSymbolicName

public java.lang.String getSymbolicName()
Returns:
the symbolic name of this bundle

isFragment

public boolean isFragment()
Returns:
true if this bundle represents a fragment

isPersistentlyStarted

public boolean isPersistentlyStarted()
Returns:
true if this bundle is persistently started

isRemovalPending

public boolean isRemovalPending()
Returns:
true if this bundle is pending removal

isRequired

public boolean isRequired()
Returns:
true if this bundle is required


Copyright © 2009. All Rights Reserved.