org.jboss.osgi.resolver.spi
Class AbstractRequirement

java.lang.Object
  extended by org.jboss.osgi.resolver.spi.AbstractElement
      extended by org.jboss.osgi.resolver.spi.AbstractRequirement
All Implemented Interfaces:
XAttachmentSupport, XAttributeSupport, XCapabilityRequirement, XDirectiveSupport, XElement, XHostRequirement, XPackageRequirement, XRequirement, XResourceRequirement, org.osgi.resource.Requirement
Direct Known Subclasses:
AbstractBundleRequirement

public class AbstractRequirement
extends AbstractElement
implements XHostRequirement, XPackageRequirement, XResourceRequirement, XCapabilityRequirement

The abstract implementation of a XRequirement.

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

Constructor Summary
AbstractRequirement(XResource resource, String namespace, Map<String,Object> atts, Map<String,String> dirs)
           
 
Method Summary
<T extends XRequirement>
T
adapt(Class<T> clazz)
          Adapt this requirement to another type
 Object getAttribute(String key)
          Get the value of the given attribute
 Map<String,Object> getAttributes()
          Get the attributes
 String getDirective(String key)
          Get the value of the given directive
 Map<String,String> getDirectives()
          Get the directives
 org.osgi.framework.Filter getFilter()
          Get the filter associated with this requirement.
 String getNamespace()
           
 String getPackageName()
          The package name
 org.osgi.resource.Resource getResource()
           
 String getSymbolicName()
          The bundle symbolic name
 org.osgi.framework.VersionRange getVersionRange()
          The bundle version range
 String getVisibility()
          Get the value of the visibility directive
 boolean isDynamic()
          A flag indicating that this is a dynamic package requirement
 boolean isOptional()
          A flag indicating that this is an optional requirement.
 boolean matches(org.osgi.resource.Capability cap)
          Matches this requirement against the given capability.
 String toString()
           
 void validate()
          Validate the requirement
 
Methods inherited from class org.jboss.osgi.resolver.spi.AbstractElement
addAttachment, getAttachment, removeAttachment
 
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.Requirement
equals, hashCode
 

Constructor Detail

AbstractRequirement

public AbstractRequirement(XResource resource,
                           String namespace,
                           Map<String,Object> atts,
                           Map<String,String> dirs)
Method Detail

getFilter

public org.osgi.framework.Filter getFilter()
Description copied from interface: XRequirement
Get the filter associated with this requirement.

Specified by:
getFilter in interface XRequirement

getResource

public org.osgi.resource.Resource getResource()
Specified by:
getResource in interface org.osgi.resource.Requirement

validate

public void validate()
Description copied from interface: XRequirement
Validate the requirement

Specified by:
validate in interface XRequirement

getNamespace

public String getNamespace()
Specified by:
getNamespace in interface org.osgi.resource.Requirement

isOptional

public boolean isOptional()
Description copied from interface: XRequirement
A flag indicating that this is an optional requirement.

Specified by:
isOptional in interface XRequirement

getDirectives

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

Specified by:
getDirectives in interface XDirectiveSupport
Specified by:
getDirectives in interface org.osgi.resource.Requirement

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

getAttributes

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

Specified by:
getAttributes in interface XAttributeSupport
Specified by:
getAttributes in interface org.osgi.resource.Requirement

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

adapt

public <T extends XRequirement> T adapt(Class<T> clazz)
Description copied from interface: XRequirement
Adapt this requirement to another type

Specified by:
adapt in interface XRequirement

matches

public boolean matches(org.osgi.resource.Capability cap)
Description copied from interface: XRequirement
Matches this requirement against the given capability.

Specified by:
matches in interface XRequirement

getVisibility

public String getVisibility()
Description copied from interface: XResourceRequirement
Get the value of the visibility directive

Specified by:
getVisibility in interface XResourceRequirement
See Also:
BundleNamespace#REQUIREMENT_VISIBILITY_DIRECTIVE}

getSymbolicName

public String getSymbolicName()
Description copied from interface: XHostRequirement
The bundle symbolic name

Specified by:
getSymbolicName in interface XHostRequirement
Specified by:
getSymbolicName in interface XResourceRequirement

getPackageName

public String getPackageName()
Description copied from interface: XPackageRequirement
The package name

Specified by:
getPackageName in interface XPackageRequirement

getVersionRange

public org.osgi.framework.VersionRange getVersionRange()
Description copied from interface: XResourceRequirement
The bundle version range

Specified by:
getVersionRange in interface XResourceRequirement

isDynamic

public boolean isDynamic()
Description copied from interface: XPackageRequirement
A flag indicating that this is a dynamic package requirement

Specified by:
isDynamic in interface XPackageRequirement

toString

public String toString()
Overrides:
toString in class Object


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