org.jboss.osgi.resolver.spi
Class AbstractPackageRequirement

java.lang.Object
  extended by org.jboss.osgi.resolver.spi.AbstractPackageRequirement
All Implemented Interfaces:
XAttachmentSupport, XAttributeSupport, XDirectiveSupport, XElement, XPackageRequirement, XRequirement
Direct Known Subclasses:
AbstractDynamicPackageRequirement

public class AbstractPackageRequirement
extends Object
implements XPackageRequirement

The abstract implementation of a XPackageRequirement.

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

Constructor Summary
AbstractPackageRequirement(AbstractModule module, String name, Map<String,String> dirs, Map<String,Object> atts)
           
 
Method Summary
<T> T
addAttachment(Class<T> clazz, T value)
          Attach an arbirtary object with this element.
<T> T
getAttachment(Class<T> clazz)
          Get the attached object for a given key
 Object getAttribute(String key)
          Get the value of the given attribute
 Map<String,Object> getAttributes()
          Get the attributes
 String getBundleSymbolicName()
          The bundle symbolic name of the exporting bundle
 Version getBundleVersion()
          The bundle version of the exporting bundle
 String getDirective(String key)
          Get the value of the given directive
 Map<String,String> getDirectives()
          Get the directives
 XModule getModule()
          Get associated module.
 String getName()
          Get the name for this capability.
 String getResolution()
          The required resolution
 XVersionRange getVersionRange()
          Get the required version range
 XCapability getWiredCapability()
          Get the wired capbillity for this requirement.
 boolean isDynamic()
          True if this is a dynamic requirement.
 boolean isOptional()
          True if this requirement is optional
 boolean match(XPackageCapability cap)
          True if the given capability matches this requirement
 boolean matchPackageName(XPackageCapability cap)
           
<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.XPackageRequirement
isDynamic
 
Methods inherited from interface org.jboss.osgi.resolver.XRequirement
getModule, getWiredCapability, isOptional
 
Methods inherited from interface org.jboss.osgi.resolver.XElement
getName
 
Methods inherited from interface org.jboss.osgi.resolver.XAttributeSupport
getAttribute, getAttributes
 
Methods inherited from interface org.jboss.osgi.resolver.XDirectiveSupport
getDirective, getDirectives
 
Methods inherited from interface org.jboss.osgi.resolver.XAttachmentSupport
addAttachment, getAttachment, removeAttachment
 

Constructor Detail

AbstractPackageRequirement

public AbstractPackageRequirement(AbstractModule module,
                                  String name,
                                  Map<String,String> dirs,
                                  Map<String,Object> atts)
Method Detail

getResolution

public String getResolution()
Description copied from interface: XPackageRequirement
The required resolution

Specified by:
getResolution in interface XPackageRequirement
Returns:
the resolution or null for dynamic package requirements

getVersionRange

public XVersionRange getVersionRange()
Description copied from interface: XPackageRequirement
Get the required version range

Specified by:
getVersionRange in interface XPackageRequirement

getBundleSymbolicName

public String getBundleSymbolicName()
Description copied from interface: XPackageRequirement
The bundle symbolic name of the exporting bundle

Specified by:
getBundleSymbolicName in interface XPackageRequirement

getBundleVersion

public Version getBundleVersion()
Description copied from interface: XPackageRequirement
The bundle version of the exporting bundle

Specified by:
getBundleVersion in interface XPackageRequirement

match

public boolean match(XPackageCapability cap)
Description copied from interface: XPackageRequirement
True if the given capability matches this requirement

Specified by:
match in interface XPackageRequirement

matchPackageName

public boolean matchPackageName(XPackageCapability cap)

toString

public String toString()
Overrides:
toString in class Object

getModule

public XModule getModule()
Description copied from interface: XRequirement
Get associated module.

Specified by:
getModule in interface XRequirement

isOptional

public boolean isOptional()
Description copied from interface: XRequirement
True if this requirement is optional

Specified by:
isOptional in interface XRequirement

isDynamic

public boolean isDynamic()
Description copied from interface: XRequirement
True if this is a dynamic requirement.

Specified by:
isDynamic in interface XRequirement

getWiredCapability

public XCapability getWiredCapability()
Description copied from interface: XRequirement
Get the wired capbillity for this requirement.

Specified by:
getWiredCapability in interface XRequirement
Returns:
The wired capabillity or null

getAttribute

public Object getAttribute(String key)
Description copied from interface: XAttributeSupport
Get the value of the given attribute

Specified by:
getAttribute in interface XAttributeSupport
Returns:
null if no such attribute is associated with this capability

getAttributes

public Map<String,Object> getAttributes()
Description copied from interface: XAttributeSupport
Get the attributes

Specified by:
getAttributes in interface XAttributeSupport

getDirective

public String getDirective(String key)
Description copied from interface: XDirectiveSupport
Get the value of the given directive

Specified by:
getDirective in interface XDirectiveSupport
Returns:
null if no such directive is associated with this capability

getDirectives

public Map<String,String> getDirectives()
Description copied from interface: XDirectiveSupport
Get the directives

Specified by:
getDirectives in interface XDirectiveSupport

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

getName

public String getName()
Description copied from interface: XElement
Get the name for this capability.

Specified by:
getName in interface XElement


Copyright © 2011. All Rights Reserved.