org.jboss.osgi.spi
Class BundleInfo

java.lang.Object
  extended by org.jboss.osgi.spi.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
 Manifest getManifest()
           
 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()
           
static boolean isValidateBundleManifest(Manifest manifest)
          Deprecated. use isValidBundleManifest(Manifest)
static boolean isValidBundle(VirtualFile virtualFile)
          Validate manifest from the given virtual file.
static boolean isValidBundleManifest(Manifest manifest)
          Validate a given bundle manifest.
 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

isValidBundle

public static boolean isValidBundle(VirtualFile virtualFile)
Validate manifest from the given virtual file.

Parameters:
virtualFile - The virtualFile that is checked for a valid manifest
Returns:
True if the virtualFile conatains a valid manifest

isValidBundleManifest

public static boolean isValidBundleManifest(Manifest manifest)
Validate a given bundle manifest.

Parameters:
manifest - The given manifest
Returns:
True if the manifest is valid

isValidateBundleManifest

public static boolean isValidateBundleManifest(Manifest manifest)
Deprecated. use isValidBundleManifest(Manifest)

Validate a given bundle manifest.

Parameters:
manifest - The given manifest
Returns:
True if the manifest is valid

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.


getManifest

public Manifest getManifest()

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 © 2012. All Rights Reserved.