org.apache.servicemix.validation
Class ValidationEndpoint

java.lang.Object
  extended by org.apache.servicemix.common.endpoints.AbstractEndpoint
      extended by org.apache.servicemix.common.endpoints.SimpleEndpoint
          extended by org.apache.servicemix.common.endpoints.ProviderEndpoint
              extended by org.apache.servicemix.validation.ValidationEndpoint
All Implemented Interfaces:
Endpoint, ValidationEndpointType

public class ValidationEndpoint
extends ProviderEndpoint
implements ValidationEndpointType

Author:
lhein

Field Summary
static java.lang.String FAULT_FLOW
           
static java.lang.String FAULT_JBI
           
static java.lang.String TAG_ERROR_END
           
static java.lang.String TAG_ERROR_START
           
static java.lang.String TAG_FATAL_END
           
static java.lang.String TAG_FATAL_START
           
static java.lang.String TAG_RESULT_END
           
static java.lang.String TAG_RESULT_START
           
static java.lang.String TAG_WARNING_END
           
static java.lang.String TAG_WARNING_START
           
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, logger, service, serviceUnit
 
Constructor Summary
ValidationEndpoint()
           
 
Method Summary
protected  void done(javax.jbi.messaging.MessageExchange messageExchange)
           
protected  void doValidation(javax.xml.validation.Validator validator, javax.xml.transform.dom.DOMSource src, javax.xml.transform.dom.DOMResult result)
          does the validation
protected  void fail(javax.jbi.messaging.MessageExchange messageExchange, java.lang.Exception e)
           
 MessageAwareErrorHandlerFactory getErrorHandlerFactory()
           
 java.lang.String getHandlingErrorMethod()
           
 org.springframework.core.io.Resource getNoNamespaceSchemaResource()
           
 javax.xml.validation.Schema getSchema()
           
 java.lang.String getSchemaLanguage()
           
 org.springframework.core.io.Resource getSchemaResource()
           
 javax.xml.transform.Source getSchemaSource()
           
protected  void processInOnly(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage in)
           
protected  void processInOut(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage in, javax.jbi.messaging.NormalizedMessage out)
           
protected  void send(javax.jbi.messaging.MessageExchange messageExchange)
           
protected  void sendSync(javax.jbi.messaging.MessageExchange messageExchange)
           
 void setErrorHandlerFactory(MessageAwareErrorHandlerFactory errorHandlerFactory)
          Set a custom error handler to deal with validation errors.
 void setHandlingErrorMethod(java.lang.String handlingErrorMethod)
          Configure how validation errors should be handled.
 void setNoNamespaceSchemaResource(org.springframework.core.io.Resource schemaResource)
          Set the validation schema to be used when no namespace is specified.
 void setSchema(javax.xml.validation.Schema schema)
          Set the validation schema instance.
 void setSchemaLanguage(java.lang.String schemaLanguage)
          Set the validation schema language.
 void setSchemaResource(org.springframework.core.io.Resource schemaResource)
          Set the validation schema as a Spring Resource.
 void setSchemaSource(javax.xml.transform.Source schemaSource)
          Set the validation schema as an XML Source.
 void start()
           
 void startValidation(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage in, javax.jbi.messaging.NormalizedMessage out, javax.jbi.messaging.Fault fault)
          does the validation
 void stop()
           
 
Methods inherited from class org.apache.servicemix.common.endpoints.ProviderEndpoint
activate, deactivate, getRole, process
 
Methods inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
getChannel, getContext, getExchangeFactory
 
Methods inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
getDefinition, getDescription, getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FAULT_FLOW

public static final java.lang.String FAULT_FLOW
See Also:
Constant Field Values

FAULT_JBI

public static final java.lang.String FAULT_JBI
See Also:
Constant Field Values

TAG_RESULT_START

public static final java.lang.String TAG_RESULT_START
See Also:
Constant Field Values

TAG_RESULT_END

public static final java.lang.String TAG_RESULT_END
See Also:
Constant Field Values

TAG_WARNING_START

public static final java.lang.String TAG_WARNING_START
See Also:
Constant Field Values

TAG_WARNING_END

public static final java.lang.String TAG_WARNING_END
See Also:
Constant Field Values

TAG_ERROR_START

public static final java.lang.String TAG_ERROR_START
See Also:
Constant Field Values

TAG_ERROR_END

public static final java.lang.String TAG_ERROR_END
See Also:
Constant Field Values

TAG_FATAL_START

public static final java.lang.String TAG_FATAL_START
See Also:
Constant Field Values

TAG_FATAL_END

public static final java.lang.String TAG_FATAL_END
See Also:
Constant Field Values
Constructor Detail

ValidationEndpoint

public ValidationEndpoint()
Method Detail

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Endpoint
Overrides:
start in class SimpleEndpoint
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Endpoint
Overrides:
stop in class SimpleEndpoint
Throws:
java.lang.Exception

processInOnly

protected void processInOnly(javax.jbi.messaging.MessageExchange exchange,
                             javax.jbi.messaging.NormalizedMessage in)
                      throws java.lang.Exception
Overrides:
processInOnly in class ProviderEndpoint
Throws:
java.lang.Exception

processInOut

protected void processInOut(javax.jbi.messaging.MessageExchange exchange,
                            javax.jbi.messaging.NormalizedMessage in,
                            javax.jbi.messaging.NormalizedMessage out)
                     throws java.lang.Exception
Overrides:
processInOut in class ProviderEndpoint
Throws:
java.lang.Exception

startValidation

public void startValidation(javax.jbi.messaging.MessageExchange exchange,
                            javax.jbi.messaging.NormalizedMessage in,
                            javax.jbi.messaging.NormalizedMessage out,
                            javax.jbi.messaging.Fault fault)
                     throws java.lang.Exception
does the validation

Parameters:
exchange -
in -
out -
fault -
Throws:
java.lang.Exception

doValidation

protected void doValidation(javax.xml.validation.Validator validator,
                            javax.xml.transform.dom.DOMSource src,
                            javax.xml.transform.dom.DOMResult result)
                     throws org.xml.sax.SAXException,
                            java.io.IOException
does the validation

Parameters:
validator -
src -
result -
Throws:
org.xml.sax.SAXException
java.io.IOException

fail

protected void fail(javax.jbi.messaging.MessageExchange messageExchange,
                    java.lang.Exception e)
             throws javax.jbi.messaging.MessagingException
Overrides:
fail in class SimpleEndpoint
Throws:
javax.jbi.messaging.MessagingException

send

protected void send(javax.jbi.messaging.MessageExchange messageExchange)
             throws javax.jbi.messaging.MessagingException
Overrides:
send in class SimpleEndpoint
Throws:
javax.jbi.messaging.MessagingException

sendSync

protected void sendSync(javax.jbi.messaging.MessageExchange messageExchange)
                 throws javax.jbi.messaging.MessagingException
Overrides:
sendSync in class SimpleEndpoint
Throws:
javax.jbi.messaging.MessagingException

done

protected void done(javax.jbi.messaging.MessageExchange messageExchange)
             throws javax.jbi.messaging.MessagingException
Overrides:
done in class SimpleEndpoint
Throws:
javax.jbi.messaging.MessagingException

getHandlingErrorMethod

public java.lang.String getHandlingErrorMethod()

setHandlingErrorMethod

public void setHandlingErrorMethod(java.lang.String handlingErrorMethod)
Configure how validation errors should be handled. Default value is FAULT_JBI.
FAULT_JBI
A jbi exception is thrown on validation errors (depending on used MEP)
FAULT_FLOW
The validation result will be sent in out / fault message (depending on used MEP)

Parameters:
handlingErrorMethod -

getSchema

public javax.xml.validation.Schema getSchema()

setSchema

public void setSchema(javax.xml.validation.Schema schema)
Set the validation schema instance.

Parameters:
schema -

getSchemaLanguage

public java.lang.String getSchemaLanguage()

setSchemaLanguage

public void setSchemaLanguage(java.lang.String schemaLanguage)
Set the validation schema language. Defaults to http://www.w3.org/2001/XMLSchema

Parameters:
schemaLanguage -

getSchemaSource

public javax.xml.transform.Source getSchemaSource()

setSchemaSource

public void setSchemaSource(javax.xml.transform.Source schemaSource)
Set the validation schema as an XML Source.

Parameters:
schemaSource -

getSchemaResource

public org.springframework.core.io.Resource getSchemaResource()

setSchemaResource

public void setSchemaResource(org.springframework.core.io.Resource schemaResource)
Set the validation schema as a Spring Resource.

Parameters:
schemaResource -

getNoNamespaceSchemaResource

public org.springframework.core.io.Resource getNoNamespaceSchemaResource()

setNoNamespaceSchemaResource

public void setNoNamespaceSchemaResource(org.springframework.core.io.Resource schemaResource)
Set the validation schema to be used when no namespace is specified.

Parameters:
schemaResource -

getErrorHandlerFactory

public MessageAwareErrorHandlerFactory getErrorHandlerFactory()

setErrorHandlerFactory

public void setErrorHandlerFactory(MessageAwareErrorHandlerFactory errorHandlerFactory)
Set a custom error handler to deal with validation errors. Defaults to a CountingErrorHandlerFactory.

Parameters:
errorHandlerFactory -


Copyright © 2005-2011 FuseSource. All Rights Reserved.