org.jboss.osgi.resolver.spi
Class AbstractBundleRevision

java.lang.Object
  extended by org.jboss.osgi.resolver.spi.AbstractResource
      extended by org.jboss.osgi.resolver.spi.AbstractBundleRevision
All Implemented Interfaces:
XAttachmentSupport, XBundleRevision, XElement, XResource, org.osgi.framework.BundleReference, BundleRevision, Resource

public class AbstractBundleRevision
extends AbstractResource
implements XBundleRevision

The abstract implementation of an XBundleRevision.

Since:
30-May-2012
Author:
thomas.diesler@jboss.com

Field Summary
 
Fields inherited from interface org.osgi.framework.wiring.BundleRevision
BUNDLE_NAMESPACE, HOST_NAMESPACE, PACKAGE_NAMESPACE, TYPE_FRAGMENT
 
Constructor Summary
AbstractBundleRevision()
           
 
Method Summary
<T> T
addAttachment(Class<T> clazz, T value)
          Attach an arbirtary object with this element.
 Enumeration<URL> findEntries(String path, String filePattern, boolean recursive)
           
<T> T
getAttachment(Class<T> clazz)
          Get the attached object for a given key
 XBundle getBundle()
          Get the associated XBundle
 List<BundleCapability> getDeclaredCapabilities(String namespace)
          Returns the capabilities declared by this bundle revision.
 List<BundleRequirement> getDeclaredRequirements(String namespace)
          Returns the requirements declared by this bundle revision.
 URL getEntry(String path)
           
 Enumeration<String> getEntryPaths(String path)
           
 org.jboss.modules.ModuleClassLoader getModuleClassLoader()
          Get the associated ModuleIdentifier or null if the revision is not resolved
 org.jboss.modules.ModuleIdentifier getModuleIdentifier()
          Get the associated ModuleIdentifier or null if the revision is not resolved
 URL getResource(String name)
           
 Enumeration<URL> getResources(String name)
           
 String getSymbolicName()
          Returns the symbolic name for this bundle revision.
 int getTypes()
          Returns the special types of this bundle revision.
 org.osgi.framework.Version getVersion()
          Returns the version for this bundle revision.
 BundleWiring getWiring()
          Returns the bundle wiring which is using this bundle revision.
<T> T
removeAttachment(Class<T> clazz)
          Remove an attached object for a given key
 
Methods inherited from class org.jboss.osgi.resolver.spi.AbstractResource
addCapability, addRequirement, getCapabilities, getIdentityCapability, getRequirements, isFragment, isMutable, makeImmutable, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.osgi.resolver.XResource
getIdentityCapability, isFragment, isMutable, makeImmutable, validate
 
Methods inherited from interface org.jboss.osgi.resolver.XAttachmentSupport
addAttachment, getAttachment, removeAttachment
 
Methods inherited from interface org.osgi.framework.wiring.BundleRevision
getCapabilities, getRequirements
 
Methods inherited from interface org.osgi.resource.Resource
equals, hashCode
 

Constructor Detail

AbstractBundleRevision

public AbstractBundleRevision()
Method Detail

getSymbolicName

public String getSymbolicName()
Description copied from interface: BundleRevision
Returns the symbolic name for this bundle revision.

Specified by:
getSymbolicName in interface BundleRevision
Returns:
The symbolic name for this bundle revision.
See Also:
Bundle.getSymbolicName()

getVersion

public org.osgi.framework.Version getVersion()
Description copied from interface: BundleRevision
Returns the version for this bundle revision.

Specified by:
getVersion in interface BundleRevision
Returns:
The version for this bundle revision, or Version.emptyVersion if this bundle revision has no version information.
See Also:
Bundle.getVersion()

getDeclaredCapabilities

public List<BundleCapability> getDeclaredCapabilities(String namespace)
Description copied from interface: BundleRevision
Returns the capabilities declared by this bundle revision.

Specified by:
getDeclaredCapabilities in interface BundleRevision
Parameters:
namespace - The namespace of the declared capabilities to return or null to return the declared capabilities from all namespaces.
Returns:
An unmodifiable list containing the declared BundleCapabilitys from the specified namespace. The returned list will be empty if this bundle revision declares no capabilities in the specified namespace. The list contains the declared capabilities in the order they are specified in the manifest.

getDeclaredRequirements

public List<BundleRequirement> getDeclaredRequirements(String namespace)
Description copied from interface: BundleRevision
Returns the requirements declared by this bundle revision.

Specified by:
getDeclaredRequirements in interface BundleRevision
Parameters:
namespace - The namespace of the declared requirements to return or null to return the declared requirements from all namespaces.
Returns:
An unmodifiable list containing the declared BundleRequirements from the specified namespace. The returned list will be empty if this bundle revision declares no requirements in the specified namespace. The list contains the declared requirements in the order they are specified in the manifest.

getTypes

public int getTypes()
Description copied from interface: BundleRevision
Returns the special types of this bundle revision. The bundle revision type values are: A bundle revision may be more than one type at a time. A type code is used to identify the bundle revision type for future extendability.

If this bundle revision is not one or more of the defined types then 0 is returned.

Specified by:
getTypes in interface BundleRevision
Returns:
The special types of this bundle revision. The type values are ORed together.

getWiring

public BundleWiring getWiring()
Description copied from interface: BundleRevision
Returns the bundle wiring which is using this bundle revision.

Specified by:
getWiring in interface BundleRevision
Returns:
The bundle wiring which is using this bundle revision or null if no bundle wiring is using this bundle revision.
See Also:
BundleWiring.getRevision()

getBundle

public XBundle getBundle()
Description copied from interface: XBundleRevision
Get the associated XBundle

Specified by:
getBundle in interface XBundleRevision
Specified by:
getBundle in interface org.osgi.framework.BundleReference

getModuleIdentifier

public org.jboss.modules.ModuleIdentifier getModuleIdentifier()
Description copied from interface: XBundleRevision
Get the associated ModuleIdentifier or null if the revision is not resolved

Specified by:
getModuleIdentifier in interface XBundleRevision

getModuleClassLoader

public org.jboss.modules.ModuleClassLoader getModuleClassLoader()
Description copied from interface: XBundleRevision
Get the associated ModuleIdentifier or null if the revision is not resolved

Specified by:
getModuleClassLoader in interface XBundleRevision

findEntries

public Enumeration<URL> findEntries(String path,
                                    String filePattern,
                                    boolean recursive)
Specified by:
findEntries in interface XBundleRevision
See Also:
Bundle#findEntries(String, String, boolean)}

getResource

public URL getResource(String name)
Specified by:
getResource in interface XBundleRevision
See Also:
Bundle#getResource(String)}

getResources

public Enumeration<URL> getResources(String name)
                              throws IOException
Specified by:
getResources in interface XBundleRevision
Throws:
IOException
See Also:
Bundle#getResources(String)}

getEntry

public URL getEntry(String path)
Specified by:
getEntry in interface XBundleRevision
See Also:
Bundle#getEntry(String)}

getEntryPaths

public Enumeration<String> getEntryPaths(String path)
Specified by:
getEntryPaths in interface XBundleRevision
See Also:
Bundle#getEntryPaths(String)}

addAttachment

public <T> T addAttachment(Class<T> clazz,
                           T value)
Description copied from interface: XAttachmentSupport
Attach an arbirtary object with this element.

Specified by:
addAttachment in interface XAttachmentSupport
Parameters:
clazz - key for the attachment
Returns:
The previously attachment object or null

getAttachment

public <T> T getAttachment(Class<T> clazz)
Description copied from interface: XAttachmentSupport
Get the attached object for a given key

Specified by:
getAttachment in interface XAttachmentSupport
Parameters:
clazz - key for the attachment
Returns:
The attached object or null

removeAttachment

public <T> T removeAttachment(Class<T> clazz)
Description copied from interface: XAttachmentSupport
Remove an attached object for a given key

Specified by:
removeAttachment in interface XAttachmentSupport
Parameters:
clazz - key for the attachment
Returns:
The attached object or null


Copyright © 2012 JBoss by Red Hat. All Rights Reserved.