org.apache.tuscany.sca.extension.helper.impl
Class BindingSCDLProcessor

java.lang.Object
  extended by org.apache.tuscany.sca.extension.helper.impl.BindingSCDLProcessor
All Implemented Interfaces:
ArtifactProcessor, StAXArtifactProcessor

public class BindingSCDLProcessor
extends java.lang.Object
implements StAXArtifactProcessor

An SCDL ArtifactProcessor which uses the Binding class getters/setters to define the SCDL attributes. TODO: merge this with SCDLProcessor


Field Summary
protected  java.util.Map<java.lang.String,java.lang.reflect.Method> attributeSetters
           
protected  java.lang.Class<Binding> bindingClass
           
protected  java.lang.reflect.Method elementTextSetter
           
protected  javax.xml.namespace.QName scdlQName
           
 
Constructor Summary
BindingSCDLProcessor(javax.xml.namespace.QName scdlQName, java.lang.Class<Binding> implementationClass)
           
 
Method Summary
 javax.xml.namespace.QName getArtifactType()
          Returns the type of artifact handled by this artifact processor.
protected  java.lang.String getFieldName(java.lang.reflect.Method m)
          Remove get/set from method name, set 1st char to lowercase and remove any trailing underscore character
 java.lang.Class getModelType()
          Returns the type of model handled by this artifact processor.
protected  void initAttributes()
           
 Binding read(javax.xml.stream.XMLStreamReader reader)
          Reads a model from an XMLStreamReader.
 void resolve(java.lang.Object model, ModelResolver resolver)
          Resolve references from this model to other models.
 void write(java.lang.Object model, javax.xml.stream.XMLStreamWriter writer)
          Writes a model to an XMLStreamWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scdlQName

protected javax.xml.namespace.QName scdlQName

bindingClass

protected java.lang.Class<Binding> bindingClass

attributeSetters

protected java.util.Map<java.lang.String,java.lang.reflect.Method> attributeSetters

elementTextSetter

protected java.lang.reflect.Method elementTextSetter
Constructor Detail

BindingSCDLProcessor

public BindingSCDLProcessor(javax.xml.namespace.QName scdlQName,
                            java.lang.Class<Binding> implementationClass)
Method Detail

initAttributes

protected void initAttributes()

getFieldName

protected java.lang.String getFieldName(java.lang.reflect.Method m)
Remove get/set from method name, set 1st char to lowercase and remove any trailing underscore character


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
Returns:
The type of artifact handled by this artifact processor

getModelType

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

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

read

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

Specified by:
read in interface StAXArtifactProcessor
Parameters:
reader - The XMLStreamReader
Returns:
A model representation of the input.
Throws:
ContributionReadException
javax.xml.stream.XMLStreamException

resolve

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

write

public void write(java.lang.Object model,
                  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
Parameters:
model - A model representing the source
writer - The XML stream writer
Throws:
ContributionWriteException
javax.xml.stream.XMLStreamException