org.milyn.javabean
Class ValueBinder

java.lang.Object
  extended by org.milyn.javabean.ValueBinder
All Implemented Interfaces:
org.milyn.delivery.ContentHandler, org.milyn.delivery.dom.DOMElementVisitor, org.milyn.delivery.dom.DOMVisitAfter, org.milyn.delivery.dom.DOMVisitBefore, org.milyn.delivery.dom.DOMVisitor, org.milyn.delivery.ordering.Producer, org.milyn.delivery.sax.SAXVisitAfter, org.milyn.delivery.sax.SAXVisitBefore, org.milyn.delivery.sax.SAXVisitor, org.milyn.delivery.Visitor

public class ValueBinder
extends Object
implements org.milyn.delivery.dom.DOMElementVisitor, org.milyn.delivery.sax.SAXVisitBefore, org.milyn.delivery.sax.SAXVisitAfter, org.milyn.delivery.ordering.Producer

Value Binder.

This class can be used to configure a Smooks instance for creating value objects using the Smooks DataDecoders.

XML Schema & Namespace

The Value Binder XML configuration schema is in the following XML Schema Namespace:

http://www.milyn.org/xsd/smooks/javabean-1.3.xsd

The value binder element is '<value>'. Take a look in the schema for all the configuration attributes.

Programmatic configuration

The value binder can be programmatic configured using the Value Object.

Example

Taking the "classic" Order message as an example and getting the order number and name as Value Objects in the form of an Integer and String.

The Message

 <order xmlns="http://x">
     <header>
         <y:date xmlns:y="http://y">Wed Nov 15 13:45:28 EST 2006</y:date>
         <customer number="123123">Joe</customer>
         <privatePerson></privatePerson>
     </header>
     <order-items>
         <!-- .... -->
     </order-items>
 </order>
 

The Binding Configuration

 <?xml version="1.0"?>
 <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.3.xsd">

    <jb:value
       beanId="customerName"
       data="customer"
       default="unknown"
    />

    <jb:value
       beanId="customerNumber"
       data="customer/@number"
             decoder="Integer"
    />

 </smooks-resource-list>
 

Author:
maurice.zeijen@smies.com

Constructor Summary
ValueBinder()
           
ValueBinder(String beanId)
           
 
Method Summary
 String getBeanIdName()
           
 org.milyn.javabean.DataDecoder getDecoder()
           
 String getDefaultValue()
           
 Set<? extends Object> getProducts()
           
 String getTypeAlias()
           
 String getValueAttributeName()
           
 void initialize()
          Set the resource configuration on the bean populator.
 void setBeanIdName(String beanIdName)
           
 void setDecoder(org.milyn.javabean.DataDecoder decoder)
           
 void setDefaultValue(String defaultValue)
           
 void setTypeAlias(String typeAlias)
           
 void setValueAttributeName(String valueAttributeName)
           
 void visitAfter(Element element, org.milyn.container.ExecutionContext executionContext)
           
 void visitAfter(org.milyn.delivery.sax.SAXElement element, org.milyn.container.ExecutionContext executionContext)
           
 void visitBefore(Element element, org.milyn.container.ExecutionContext executionContext)
           
 void visitBefore(org.milyn.delivery.sax.SAXElement element, org.milyn.container.ExecutionContext executionContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueBinder

public ValueBinder()

ValueBinder

public ValueBinder(String beanId)
Parameters:
beanId -
Method Detail

getBeanIdName

public String getBeanIdName()
Returns:
the beanIdName

setBeanIdName

public void setBeanIdName(String beanIdName)
Parameters:
beanIdName - the beanIdName to set

getValueAttributeName

public String getValueAttributeName()
Returns:
the valueAttributeName

setValueAttributeName

public void setValueAttributeName(String valueAttributeName)
Parameters:
valueAttributeName - the valueAttributeName to set

getDefaultValue

public String getDefaultValue()
Returns:
the defaultValue

setDefaultValue

public void setDefaultValue(String defaultValue)
Parameters:
defaultValue - the defaultValue to set

getTypeAlias

public String getTypeAlias()
Returns:
the typeAlias

setTypeAlias

public void setTypeAlias(String typeAlias)
Parameters:
typeAlias - the typeAlias to set

getDecoder

public org.milyn.javabean.DataDecoder getDecoder()
Returns:
the decoder

setDecoder

public void setDecoder(org.milyn.javabean.DataDecoder decoder)
Parameters:
decoder - the decoder to set

initialize

@Initialize
public void initialize()
                throws org.milyn.cdr.SmooksConfigurationException
Set the resource configuration on the bean populator.

Throws:
org.milyn.cdr.SmooksConfigurationException - Incorrectly configured resource.

visitBefore

public void visitBefore(Element element,
                        org.milyn.container.ExecutionContext executionContext)
                 throws org.milyn.SmooksException
Specified by:
visitBefore in interface org.milyn.delivery.dom.DOMVisitBefore
Throws:
org.milyn.SmooksException

visitAfter

public void visitAfter(Element element,
                       org.milyn.container.ExecutionContext executionContext)
                throws org.milyn.SmooksException
Specified by:
visitAfter in interface org.milyn.delivery.dom.DOMVisitAfter
Throws:
org.milyn.SmooksException

visitBefore

public void visitBefore(org.milyn.delivery.sax.SAXElement element,
                        org.milyn.container.ExecutionContext executionContext)
                 throws org.milyn.SmooksException,
                        IOException
Specified by:
visitBefore in interface org.milyn.delivery.sax.SAXVisitBefore
Throws:
org.milyn.SmooksException
IOException

visitAfter

public void visitAfter(org.milyn.delivery.sax.SAXElement element,
                       org.milyn.container.ExecutionContext executionContext)
                throws org.milyn.SmooksException,
                       IOException
Specified by:
visitAfter in interface org.milyn.delivery.sax.SAXVisitAfter
Throws:
org.milyn.SmooksException
IOException

getProducts

public Set<? extends Object> getProducts()
Specified by:
getProducts in interface org.milyn.delivery.ordering.Producer


Copyright © 2018. All rights reserved.