org.jboss.osgi.resolver.spi
Class AbstractResource

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

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(org.osgi.resource.Capability cap)
           
protected  void addRequirement(org.osgi.resource.Requirement req)
           
<T> T
getAttachment(Class<T> clazz)
          Get the attached object for a given key
 List<org.osgi.resource.Capability> getCapabilities(String namespace)
           
 XIdentityCapability getIdentityCapability()
          Get the identity capability for this resource
 List<org.osgi.resource.Requirement> getRequirements(String namespace)
           
 boolean isFragment()
          True if this resource is a fragment
 boolean isMutable()
          True if the resource is mutable
 void makeImmutable()
          Make the resource immutable
<T> T
removeAttachment(Class<T> clazz)
          Remove an attached object for a given key
 String toString()
           
 void validate()
          Validate the resource
 
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(org.osgi.resource.Capability cap)

addRequirement

protected void addRequirement(org.osgi.resource.Requirement req)

makeImmutable

public void makeImmutable()
Description copied from interface: XResource
Make the resource immutable

Specified by:
makeImmutable in interface XResource

isMutable

public boolean isMutable()
Description copied from interface: XResource
True if the resource is mutable

Specified by:
isMutable in interface XResource

validate

public void validate()
Description copied from interface: XResource
Validate the resource

Specified by:
validate in interface XResource

getCapabilities

public List<org.osgi.resource.Capability> getCapabilities(String namespace)
Specified by:
getCapabilities in interface org.osgi.resource.Resource

getRequirements

public List<org.osgi.resource.Requirement> getRequirements(String namespace)
Specified by:
getRequirements in interface org.osgi.resource.Resource

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 JBoss by Red Hat. All Rights Reserved.