org.apache.tuscany.sca.assembly.xml
Class ConstrainingTypeDocumentProcessor

java.lang.Object
  extended by org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor
      extended by org.apache.tuscany.sca.assembly.xml.ConstrainingTypeDocumentProcessor
All Implemented Interfaces:
Constants, ArtifactProcessor<ConstrainingType>, URLArtifactProcessor<ConstrainingType>

public class ConstrainingTypeDocumentProcessor
extends BaseStAXArtifactProcessor
implements URLArtifactProcessor<ConstrainingType>

A contrainingType content handler.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor
BaseStAXArtifactProcessor.XAttr
 
Field Summary
protected  AssemblyFactory assemblyFactory
           
protected  ContributionFactory contributionFactory
           
protected  StAXArtifactProcessor<java.lang.Object> extensionProcessor
           
protected  IntentAttachPointTypeFactory intentAttachPointTypeFactory
           
protected  PolicyFactory policyFactory
           
protected  PolicyAttachPointProcessor policyProcessor
           
 
Fields inherited from interface org.apache.tuscany.sca.assembly.xml.Constants
APPLICABLE_POLICY_SETS, AUTOWIRE, BINDING_SCA, BINDING_SCA_QNAME, CALLBACK, CALLBACK_QNAME, COMPONENT, COMPONENT_QNAME, COMPONENT_TYPE, COMPONENT_TYPE_QNAME, COMPOSITE, COMPOSITE_QNAME, CONSTRAINING_TYPE, CONSTRAINING_TYPE_QNAME, ELEMENT, FILE, IMPLEMENTATION, IMPLEMENTATION_COMPOSITE, IMPLEMENTATION_COMPOSITE_QNAME, IMPLEMENTATION_QNAME, INCLUDE, INCLUDE_QNAME, LOCAL, MANY, MULTIPLICITY, MUST_SUPPLY, NAME, ONE_N, ONE_ONE, OPERATION, OPERATION_QNAME, POLICY_SETS, PROMOTE, PROPERTY, PROPERTY_QNAME, REFERENCE, REFERENCE_QNAME, REQUIRES, SCA10_NS, SCA10_TUSCANY_NS, SERVICE, SERVICE_QNAME, SOURCE, TARGET, TARGET_NAMESPACE, TYPE, URI, WIRE, WIRE_QNAME, WIRED_BY_IMPL, ZERO_N, ZERO_ONE
 
Constructor Summary
ConstrainingTypeDocumentProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor staxProcessor, Monitor monitor)
          Constructs a new constrainingType processor.
ConstrainingTypeDocumentProcessor(StAXArtifactProcessor staxProcessor, javax.xml.stream.XMLInputFactory inputFactory, Monitor monitor)
          Construct a new constrainingType processor.
 
Method Summary
protected  void addInheritedIntents(java.util.List<Intent> sourceList, java.util.List<Intent> targetList)
           
protected  void addInheritedPolicySets(java.util.List<PolicySet> sourceList, java.util.List<PolicySet> targetList)
           
protected  void error(java.lang.String message, java.lang.Object model, java.lang.Exception ex)
          Marshals exceptions into the monitor
protected  void error(java.lang.String message, java.lang.Object model, java.lang.Object... messageParameters)
          Marshals errors into the monitor
 java.lang.String getArtifactType()
          Returns the type of artifact handled by this artifact processor.
 java.lang.Class<ConstrainingType> getModelType()
          Returns the type of model handled by this artifact processor.
 ConstrainingType read(java.net.URL contributionURL, java.net.URI uri, java.net.URL url)
          Reads a model from a URL.
protected  void readAbstractProperty(AbstractProperty property, javax.xml.stream.XMLStreamReader reader)
          Reads an abstract property element.
protected  ConstrainingType readConstrainingType(javax.xml.stream.XMLStreamReader reader)
          Returns the value of a constrainingType attribute.
protected  void readExtendedAttributes(javax.xml.stream.XMLStreamReader reader, javax.xml.namespace.QName elementName, Extensible estensibleElement, StAXAttributeProcessor extensionAttributeProcessor)
           
protected  void readMultiplicity(AbstractReference reference, javax.xml.stream.XMLStreamReader reader)
          Read a multiplicity attribute.
protected  org.w3c.dom.Document readPropertyValue(javax.xml.namespace.QName element, javax.xml.namespace.QName type, javax.xml.stream.XMLStreamReader reader)
          Read a property value into a DOM document.
protected  void readTargets(Reference reference, javax.xml.stream.XMLStreamReader reader)
          Read list of reference targets
 void resolve(ConstrainingType constrainingType, ModelResolver resolver)
          Resolve references from this model to other models.
protected
<C extends AbstractContract>
void
resolveAbstractContracts(java.util.List<C> contracts, ModelResolver resolver)
          Resolve interface and callback interface on a list of abstract contracts.
protected
<C extends Contract>
void
resolveContracts(Base parent, java.util.List<C> contracts, ModelResolver resolver)
          Resolve interface, callback interface and bindings on a list of contracts.
protected
<C extends Contract>
void
resolveContracts(java.util.List<C> contracts, ModelResolver resolver)
          Resolve interface, callback interface and bindings on a list of contracts.
protected  Implementation resolveImplementation(Implementation implementation, ModelResolver resolver)
          Resolve an implementation.
protected  void resolveIntents(java.util.List<Intent> policyIntents, ModelResolver resolver)
          Resolve policy intents attached to a specific SCA Artifact
protected  void resolvePolicySets(java.util.List<PolicySet> policySets, ModelResolver resolver)
          Resolve policy sets attached to a specific SCA Construct
protected  void warning(java.lang.String message, java.lang.Object model, java.lang.String... messageParameters)
          Marshals warnings into the monitor
protected  BaseStAXArtifactProcessor.XAttr writeConstrainingType(ComponentType componentType)
          Returns a constrainingType attribute.
protected  void writeExtendedAttributes(javax.xml.stream.XMLStreamWriter writer, Extensible extensibleElement, StAXAttributeProcessor extensionAttributeProcessor)
           
protected  BaseStAXArtifactProcessor.XAttr writeMultiplicity(AbstractReference reference)
           
protected  void writePropertyValue(java.lang.Object propertyValue, javax.xml.namespace.QName element, javax.xml.namespace.QName type, javax.xml.stream.XMLStreamWriter writer)
          Write the value of a property
protected  void writeStart(javax.xml.stream.XMLStreamWriter writer, java.lang.String name, BaseStAXArtifactProcessor.XAttr... attrs)
          Start an element.
protected  void writeStartDocument(javax.xml.stream.XMLStreamWriter writer, java.lang.String name, BaseStAXArtifactProcessor.XAttr... attrs)
          Start a document.
protected  BaseStAXArtifactProcessor.XAttr writeTargets(Reference reference)
          Write a list of targets into an attribute
 
Methods inherited from class org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor
getBoolean, getQName, getQNames, getQNameValue, getString, getXSIType, isSet, nextChildElement, skipToEndElement, writeAttributePrefixes, writeAttributes, writeEnd, writeEndDocument, writeStart, writeStart, writeStartDocument, writeStartDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contributionFactory

protected ContributionFactory contributionFactory

assemblyFactory

protected AssemblyFactory assemblyFactory

policyFactory

protected PolicyFactory policyFactory

extensionProcessor

protected StAXArtifactProcessor<java.lang.Object> extensionProcessor

policyProcessor

protected PolicyAttachPointProcessor policyProcessor

intentAttachPointTypeFactory

protected IntentAttachPointTypeFactory intentAttachPointTypeFactory
Constructor Detail

ConstrainingTypeDocumentProcessor

public ConstrainingTypeDocumentProcessor(StAXArtifactProcessor staxProcessor,
                                         javax.xml.stream.XMLInputFactory inputFactory,
                                         Monitor monitor)
Construct a new constrainingType processor.

Parameters:
factory -
policyFactory -
staxProcessor -

ConstrainingTypeDocumentProcessor

public ConstrainingTypeDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
                                         StAXArtifactProcessor staxProcessor,
                                         Monitor monitor)
Constructs a new constrainingType processor.

Parameters:
modelFactories -
staxProcessor -
Method Detail

read

public ConstrainingType read(java.net.URL contributionURL,
                             java.net.URI uri,
                             java.net.URL url)
                      throws ContributionReadException
Description copied from interface: URLArtifactProcessor
Reads a model from a URL.

Specified by:
read in interface URLArtifactProcessor<ConstrainingType>
Parameters:
contributionURL - Contribution location URL
uri - Artifact URI
url - Artifact location URL
Returns:
A model representation of the input.
Throws:
ContributionReadException

resolve

public void resolve(ConstrainingType constrainingType,
                    ModelResolver resolver)
             throws ContributionResolveException
Description copied from interface: ArtifactProcessor
Resolve references from this model to other models. For example references from a composite to another one, or references from a composite to a WSDL model.

Specified by:
resolve in interface ArtifactProcessor<ConstrainingType>
Parameters:
constrainingType - The model to resolve
resolver - The resolver to use to resolve referenced models
Throws:
ContributionResolveException

getArtifactType

public java.lang.String getArtifactType()
Description copied from interface: URLArtifactProcessor
Returns the type of artifact handled by this artifact processor.

Specified by:
getArtifactType in interface URLArtifactProcessor<ConstrainingType>
Returns:
The type of artifact handled by this artifact processor

getModelType

public java.lang.Class<ConstrainingType> getModelType()
Description copied from interface: ArtifactProcessor
Returns the type of model handled by this artifact processor.

Specified by:
getModelType in interface ArtifactProcessor<ConstrainingType>
Returns:
The type of model handled by this artifact processor

warning

protected void warning(java.lang.String message,
                       java.lang.Object model,
                       java.lang.String... messageParameters)
Marshals warnings into the monitor

Parameters:
message -
model -
messageParameters -

error

protected void error(java.lang.String message,
                     java.lang.Object model,
                     java.lang.Object... messageParameters)
Marshals errors into the monitor

Parameters:
problems -
message -
model -

error

protected void error(java.lang.String message,
                     java.lang.Object model,
                     java.lang.Exception ex)
Marshals exceptions into the monitor

Parameters:
problems -
message -
model -

writeStart

protected void writeStart(javax.xml.stream.XMLStreamWriter writer,
                          java.lang.String name,
                          BaseStAXArtifactProcessor.XAttr... attrs)
                   throws javax.xml.stream.XMLStreamException
Start an element.

Parameters:
writer -
name -
attrs -
Throws:
javax.xml.stream.XMLStreamException

writeStartDocument

protected void writeStartDocument(javax.xml.stream.XMLStreamWriter writer,
                                  java.lang.String name,
                                  BaseStAXArtifactProcessor.XAttr... attrs)
                           throws javax.xml.stream.XMLStreamException
Start a document.

Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

readTargets

protected void readTargets(Reference reference,
                           javax.xml.stream.XMLStreamReader reader)
Read list of reference targets

Parameters:
reference -
reader -

writeTargets

protected BaseStAXArtifactProcessor.XAttr writeTargets(Reference reference)
Write a list of targets into an attribute

Parameters:
reference -
Returns:

readMultiplicity

protected void readMultiplicity(AbstractReference reference,
                                javax.xml.stream.XMLStreamReader reader)
Read a multiplicity attribute.

Parameters:
reference -
reader -

writeMultiplicity

protected BaseStAXArtifactProcessor.XAttr writeMultiplicity(AbstractReference reference)

readConstrainingType

protected ConstrainingType readConstrainingType(javax.xml.stream.XMLStreamReader reader)
Returns the value of a constrainingType attribute.

Parameters:
reader -
Returns:

readAbstractProperty

protected void readAbstractProperty(AbstractProperty property,
                                    javax.xml.stream.XMLStreamReader reader)
                             throws javax.xml.stream.XMLStreamException,
                                    ContributionReadException
Reads an abstract property element.

Parameters:
property -
reader -
Throws:
javax.xml.stream.XMLStreamException
ContributionReadException

resolveImplementation

protected Implementation resolveImplementation(Implementation implementation,
                                               ModelResolver resolver)
                                        throws ContributionResolveException,
                                               PolicyValidationException
Resolve an implementation.

Parameters:
implementation -
resolver -
Returns:
Throws:
ContributionResolveException
PolicyValidationException

resolveContracts

protected <C extends Contract> void resolveContracts(java.util.List<C> contracts,
                                                     ModelResolver resolver)
                         throws ContributionResolveException
Resolve interface, callback interface and bindings on a list of contracts.

Parameters:
contracts - the list of contracts
resolver - the resolver to use to resolve models
Throws:
ContributionResolveException

resolveContracts

protected <C extends Contract> void resolveContracts(Base parent,
                                                     java.util.List<C> contracts,
                                                     ModelResolver resolver)
                         throws ContributionResolveException
Resolve interface, callback interface and bindings on a list of contracts.

Parameters:
parent - element for the contracts
contracts - the list of contracts
resolver - the resolver to use to resolve models
Throws:
ContributionResolveException

resolveAbstractContracts

protected <C extends AbstractContract> void resolveAbstractContracts(java.util.List<C> contracts,
                                                                     ModelResolver resolver)
                                 throws ContributionResolveException
Resolve interface and callback interface on a list of abstract contracts.

Parameters:
contracts - the list of contracts
resolver - the resolver to use to resolve models
Throws:
ContributionResolveException

writeConstrainingType

protected BaseStAXArtifactProcessor.XAttr writeConstrainingType(ComponentType componentType)
Returns a constrainingType attribute.

Parameters:
componentType -
Returns:

readPropertyValue

protected org.w3c.dom.Document readPropertyValue(javax.xml.namespace.QName element,
                                                 javax.xml.namespace.QName type,
                                                 javax.xml.stream.XMLStreamReader reader)
                                          throws javax.xml.stream.XMLStreamException,
                                                 ContributionReadException
Read a property value into a DOM document.

Parameters:
element -
type -
reader -
Returns:
Throws:
javax.xml.stream.XMLStreamException
ContributionReadException
javax.xml.parsers.ParserConfigurationException

resolveIntents

protected void resolveIntents(java.util.List<Intent> policyIntents,
                              ModelResolver resolver)
Resolve policy intents attached to a specific SCA Artifact

Parameters:
policyIntents - list of policy intents
resolver -

resolvePolicySets

protected void resolvePolicySets(java.util.List<PolicySet> policySets,
                                 ModelResolver resolver)
Resolve policy sets attached to a specific SCA Construct

Parameters:
policySets - list of attached policy sets
resolver -

writePropertyValue

protected void writePropertyValue(java.lang.Object propertyValue,
                                  javax.xml.namespace.QName element,
                                  javax.xml.namespace.QName type,
                                  javax.xml.stream.XMLStreamWriter writer)
                           throws javax.xml.stream.XMLStreamException
Write the value of a property

Parameters:
document -
element -
type -
writer -
Throws:
javax.xml.stream.XMLStreamException

addInheritedIntents

protected void addInheritedIntents(java.util.List<Intent> sourceList,
                                   java.util.List<Intent> targetList)

addInheritedPolicySets

protected void addInheritedPolicySets(java.util.List<PolicySet> sourceList,
                                      java.util.List<PolicySet> targetList)

readExtendedAttributes

protected void readExtendedAttributes(javax.xml.stream.XMLStreamReader reader,
                                      javax.xml.namespace.QName elementName,
                                      Extensible estensibleElement,
                                      StAXAttributeProcessor extensionAttributeProcessor)
                               throws ContributionReadException,
                                      javax.xml.stream.XMLStreamException
Parameters:
reader -
elementName -
estensibleElement -
extensionAttributeProcessor -
Throws:
ContributionReadException
javax.xml.stream.XMLStreamException

writeExtendedAttributes

protected void writeExtendedAttributes(javax.xml.stream.XMLStreamWriter writer,
                                       Extensible extensibleElement,
                                       StAXAttributeProcessor extensionAttributeProcessor)
                                throws ContributionWriteException,
                                       javax.xml.stream.XMLStreamException
Parameters:
attributeModel -
writer -
extensibleElement -
extensionAttributeProcessor -
Throws:
ContributionWriteException
javax.xml.stream.XMLStreamException