org.jboss.osgi.resolver.spi
Class AbstractResource

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

public class AbstractResource
extends Object
implements XResource

The abstract implementation of an XResource.

Since:
02-Jul-2010
Author:
thomas.diesler@jboss.com

Constructor Summary
AbstractResource()
           
 
Method Summary
<T> T
addAttachment(Class<T> clazz, T value)
          Attach an arbirtary object with this element.
protected  void addCapability(Capability cap)
           
protected  void addRequirement(Requirement req)
           
<T> T
getAttachment(Class<T> clazz)
          Get the attached object for a given key
 List<Capability> getCapabilities(String namespace)
          Returns the capabilities declared by this resource.
 XIdentityCapability getIdentityCapability()
          Get the identity capability for this resource
 List<Requirement> getRequirements(String namespace)
          Returns the requirements declared by this bundle resource.
 boolean isFragment()
          True if this resource is a fragment
<T> T
removeAttachment(Class<T> clazz)
          Remove an attached object for a given key
 String toString()
           
 
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.XAttachmentSupport
addAttachment, getAttachment, removeAttachment
 
Methods inherited from interface org.osgi.resource.Resource
equals, hashCode
 

Constructor Detail

AbstractResource

public AbstractResource()
Method Detail

addCapability

protected void addCapability(Capability cap)

addRequirement

protected void addRequirement(Requirement req)

getCapabilities

public List<Capability> getCapabilities(String namespace)
Description copied from interface: Resource
Returns the capabilities declared by this resource.

Specified by:
getCapabilities in interface Resource
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 Capabilitys from the specified namespace. The returned list will be empty if this resource declares no capabilities in the specified namespace.

getRequirements

public List<Requirement> getRequirements(String namespace)
Description copied from interface: Resource
Returns the requirements declared by this bundle resource.

Specified by:
getRequirements in interface Resource
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 Requirement s from the specified namespace. The returned list will be empty if this resource declares no requirements in the specified namespace.

getIdentityCapability

public XIdentityCapability getIdentityCapability()
Description copied from interface: XResource
Get the identity capability for this resource

Specified by:
getIdentityCapability in interface XResource

isFragment

public boolean isFragment()
Description copied from interface: XResource
True if this resource is a fragment

Specified by:
isFragment in interface XResource

toString

public String toString()
Overrides:
toString in class Object

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