org.jboss.osgi.resolver.spi
Class AbstractWiring

java.lang.Object
  extended by org.jboss.osgi.resolver.spi.AbstractWiring
All Implemented Interfaces:
XWiring, Wiring

public class AbstractWiring
extends Object
implements XWiring

The abstract implementation of a Wiring.

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

Constructor Summary
AbstractWiring(Resource resource, List<Wire> wires)
           
 
Method Summary
protected  void addProvidedWire(Wire wire)
           
 List<Wire> getProvidedResourceWires(String namespace)
          Returns the Wires to the provided capabilities of this wiring.
 List<Wire> getRequiredResourceWires(String namespace)
          Returns the Wires to the requirements in use by this wiring.
 Resource getResource()
          Returns the resource associated with this wiring.
 List<Capability> getResourceCapabilities(String namespace)
          Returns the capabilities provided by this wiring.
 List<Requirement> getResourceRequirements(String namespace)
          Returns the requirements of this wiring.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractWiring

public AbstractWiring(Resource resource,
                      List<Wire> wires)
Method Detail

addProvidedWire

protected void addProvidedWire(Wire wire)

getResourceCapabilities

public List<Capability> getResourceCapabilities(String namespace)
Description copied from interface: Wiring
Returns the capabilities provided by this wiring.

Only capabilities considered by the resolver are returned. For example, capabilities with effective directive not equal to resolve are not returned.

A capability may not be required by any wiring and thus there may be no wires for the capability.

A wiring for a non-fragment resource provides a subset of the declared capabilities from the resource and all attached fragment resources. Not all declared capabilities may be provided since some may be discarded. For example, if a package is declared to be both exported and imported, only one is selected and the other is discarded.

A wiring for a fragment resource with a symbolic name must provide exactly one osgi.identity capability.

† The osgi.identity capability provided by attached fragment resource must not be included in the capabilities of the host wiring.

Specified by:
getResourceCapabilities in interface Wiring
Parameters:
namespace - The namespace of the capabilities to return or null to return the capabilities from all namespaces.
Returns:
A list containing a snapshot of the Capabilitys, or an empty list if this wiring provides no capabilities in the specified namespace. For a given namespace, the list contains the wires in the order the capabilities were specified in the manifests of the resource and the attached fragment resources of this wiring. There is no ordering defined between capabilities in different namespaces.

getResourceRequirements

public List<Requirement> getResourceRequirements(String namespace)
Description copied from interface: Wiring
Returns the requirements of this wiring.

Only requirements considered by the resolver are returned. For example, requirements with effective directive not equal to resolve are not returned.

A wiring for a non-fragment resource has a subset of the declared requirements from the resource and all attached fragment resources. Not all declared requirements may be present since some may be discarded. For example, if a package is declared to be optionally imported and is not actually imported, the requirement must be discarded.

Specified by:
getResourceRequirements in interface Wiring
Parameters:
namespace - The namespace of the requirements to return or null to return the requirements from all namespaces.
Returns:
A list containing a snapshot of the Requirements, or an empty list if this wiring uses no requirements in the specified namespace. For a given namespace, the list contains the wires in the order the requirements were specified in the manifests of the resource and the attached fragment resources of this wiring. There is no ordering defined between requirements in different namespaces.

getProvidedResourceWires

public List<Wire> getProvidedResourceWires(String namespace)
Description copied from interface: Wiring
Returns the Wires to the provided capabilities of this wiring.

Specified by:
getProvidedResourceWires in interface Wiring
Parameters:
namespace - The namespace of the capabilities for which to return wires or null to return the wires for the capabilities in all namespaces.
Returns:
A list containing a snapshot of the Wires for the capabilities of this wiring, or an empty list if this wiring has no capabilities in the specified namespace. For a given namespace, the list contains the wires in the order the capabilities were specified in the manifests of the resource and the attached fragment resources of this wiring. There is no ordering defined between capabilities in different namespaces.

getRequiredResourceWires

public List<Wire> getRequiredResourceWires(String namespace)
Description copied from interface: Wiring
Returns the Wires to the requirements in use by this wiring.

Specified by:
getRequiredResourceWires in interface Wiring
Parameters:
namespace - The namespace of the requirements for which to return wires or null to return the wires for the requirements in all namespaces.
Returns:
A list containing a snapshot of the Wires for the requirements of this wiring, or an empty list if this wiring has no requirements in the specified namespace. For a given namespace, the list contains the wires in the order the requirements were specified in the manifests of the resource and the attached fragment resources of this wiring. There is no ordering defined between requirements in different namespaces.

getResource

public Resource getResource()
Description copied from interface: Wiring
Returns the resource associated with this wiring.

Specified by:
getResource in interface Wiring
Returns:
The resource associated with this wiring.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.