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

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

public class ComponentTypeProcessor
extends BaseStAXArtifactProcessor
implements StAXArtifactProcessor<ComponentType>

A componentType processor.


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
ComponentTypeProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessor extensionProcessor, StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor)
          Constructs a new componentType processor.
ComponentTypeProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor extensionProcessor, StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor)
          Constructs a new componentType 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
 javax.xml.namespace.QName getArtifactType()
          Returns the type of artifact handled by this artifact processor.
 java.lang.Class<ComponentType> getModelType()
          Returns the type of model handled by this artifact processor.
 ComponentType read(javax.xml.stream.XMLStreamReader reader)
          Reads a model from an XMLStreamReader.
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(ComponentType componentType, 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
 void write(ComponentType componentType, javax.xml.stream.XMLStreamWriter writer)
          Writes a model to an XMLStreamWriter.
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

ComponentTypeProcessor

public ComponentTypeProcessor(AssemblyFactory factory,
                              PolicyFactory policyFactory,
                              StAXArtifactProcessor extensionProcessor,
                              StAXAttributeProcessor extensionAttributeProcessor,
                              Monitor monitor)
Constructs a new componentType processor.

Parameters:
factory -
policyFactory -
registry -

ComponentTypeProcessor

public ComponentTypeProcessor(ModelFactoryExtensionPoint modelFactories,
                              StAXArtifactProcessor extensionProcessor,
                              StAXAttributeProcessor extensionAttributeProcessor,
                              Monitor monitor)
Constructs a new componentType processor.

Parameters:
modelFactories -
extensionProcessor -
Method Detail

read

public ComponentType read(javax.xml.stream.XMLStreamReader reader)
                   throws ContributionReadException
Description copied from interface: StAXArtifactProcessor
Reads a model from an XMLStreamReader.

Specified by:
read in interface StAXArtifactProcessor<ComponentType>
Parameters:
reader - The XMLStreamReader
Returns:
A model representation of the input.
Throws:
ContributionReadException

write

public void write(ComponentType componentType,
                  javax.xml.stream.XMLStreamWriter writer)
           throws ContributionWriteException,
                  javax.xml.stream.XMLStreamException
Description copied from interface: StAXArtifactProcessor
Writes a model to an XMLStreamWriter.

Specified by:
write in interface StAXArtifactProcessor<ComponentType>
Parameters:
componentType - A model representing the source
writer - The XML stream writer
Throws:
ContributionWriteException
javax.xml.stream.XMLStreamException

resolve

public void resolve(ComponentType componentType,
                    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<ComponentType>
Parameters:
componentType - The model to resolve
resolver - The resolver to use to resolve referenced models
Throws:
ContributionResolveException

getArtifactType

public javax.xml.namespace.QName getArtifactType()
Description copied from interface: StAXArtifactProcessor
Returns the type of artifact handled by this artifact processor.

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

getModelType

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

Specified by:
getModelType in interface ArtifactProcessor<ComponentType>
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