org.jboss.osgi.spi.util
Class BundleInfo

java.lang.Object
  extended by org.jboss.osgi.spi.util.BundleInfo
All Implemented Interfaces:
Serializable

public class BundleInfo
extends Object
implements Serializable

Primitive access to bundle meta data and root virtual file. The bundle info can be constructed from various locations. If that succeeds, there is a valid OSGi Manifest.

Since:
16-Oct-2009
Author:
thomas.diesler@jboss.com
See Also:
Serialized Form

Method Summary
 void close()
          Closes the accociated resources.
static BundleInfo createBundleInfo(String location)
           
static BundleInfo createBundleInfo(URL url)
           
static BundleInfo createBundleInfo(VirtualFile root)
           
static BundleInfo createBundleInfo(VirtualFile root, String location)
           
 boolean equals(Object obj)
           
static int getBundleManifestVersion(Manifest manifest)
          Get the bundle manifest version.
 String getLocation()
          Get the bundle location
 String getManifestHeader(String key)
          Get the manifest header for the given key.
 VirtualFile getRoot()
          Get the bundle root file
 URL getRootURL()
          Get the bundle root url
 String getSymbolicName()
          Get the bundle symbolic name
 Version getVersion()
          Get the bundle version
 int hashCode()
           
 String toString()
           
static void validateBundleManifest(Manifest manifest)
          Validate a given bundle manifest.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createBundleInfo

public static BundleInfo createBundleInfo(String location)
                                   throws BundleException
Throws:
BundleException

createBundleInfo

public static BundleInfo createBundleInfo(URL url)
                                   throws BundleException
Throws:
BundleException

createBundleInfo

public static BundleInfo createBundleInfo(VirtualFile root)
                                   throws BundleException
Throws:
BundleException

createBundleInfo

public static BundleInfo createBundleInfo(VirtualFile root,
                                          String location)
                                   throws BundleException
Throws:
BundleException

validateBundleManifest

public static void validateBundleManifest(Manifest manifest)
                                   throws BundleException
Validate a given bundle manifest.

Parameters:
manifest - The given manifest
Throws:
BundleException - if this is not a valid bundle manifest

getBundleManifestVersion

public static int getBundleManifestVersion(Manifest manifest)
Get the bundle manifest version.

Parameters:
manifest - The given manifest
Returns:
The value of the Bundle-ManifestVersion header, or -1 for a non OSGi manifest

getManifestHeader

public String getManifestHeader(String key)
Get the manifest header for the given key.


getLocation

public String getLocation()
Get the bundle location


getRoot

public VirtualFile getRoot()
Get the bundle root file


getRootURL

public URL getRootURL()
Get the bundle root url


getSymbolicName

public String getSymbolicName()
Get the bundle symbolic name


getVersion

public Version getVersion()
Get the bundle version


close

public void close()
Closes the accociated resources.


equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.