package org.apache.tuscany.sca.binding.jms;
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
A processor to read the XML that describes the JMS binding...
<binding.jms correlationScheme="string"?
initialContextFactory="xs:anyURI"?
jndiURL="xs:anyURI"?
requestConnection="QName"?
responseConnection="QName"?
operationProperties="QName"?
...>
<headers type="string"?
deliveryMode="string"?
timeToLive="int"?
priority="string"?>
<property name="NMTOKEN" type="NMTOKEN">*
</headers>?
<destination jndiName="xs:anyURI" type="string"? create="string"?>
<property name="NMTOKEN" type="NMTOKEN">*
</destination>?
<connectionFactory jndiName="xs:anyURI" create="string"?>
<property name="NMTOKEN" type="NMTOKEN">*
</connectionFactory>?
<activationSpec name="xs:anyURI" create="string"?>
<property name="NMTOKEN" type="NMTOKEN">*
</activationSpec>?
<response>
<destination jndiName="xs:anyURI" type="string"? create="string"?>
<property name="NMTOKEN" type="NMTOKEN">*
</destination>?
<connectionFactory jndiName="xs:anyURI" create="string"?>
<property name="NMTOKEN" type="NMTOKEN">*
</connectionFactory>?
<activationSpec name="xs:anyURI" create="string"?>
<property name="NMTOKEN" type="NMTOKEN">*
</activationSpec>?
<wireFormat.someWireFormat/>?
</response>?
<complexType name="SubscriptionHeaders">
<attribute name="JMSSelector" type="string"/>
</complexType>
<resourceAdapter name="NMTOKEN">?
<property name="NMTOKEN" type="NMTOKEN">*
</resourceAdapter>?
<operationProperties name="string" selectedOperation="string"?>
<property name="NMTOKEN" type="NMTOKEN">*
<headers type="string"?
deliveryMode="string"?
timeToLive="int"?
priority="string"?>
<property name="NMTOKEN" type="NMTOKEN">*
</headers>?
</operationProperties>*
<wireFormat.someWireFormat/>?
</binding.jms>
Parsing error messages are recorded locally and reported as validation exceptions. Parsing
warnings do not cause validation exceptions.
- Version:
- $Rev: 1025750 $ $Date: 2010-10-20 22:08:56 +0100 (Wed, 20 Oct 2010) $
Report a error.
- Parameters:
problems
message
model
Report an error.
One side effect is that error messages are saved for future validation calls.
- Parameters:
problems
message
model
if (uri != null && uri.length() > 0) {
if (correlationScheme != null) {
error(monitor, "InvalidCorrelationScheme", reader, correlationScheme);
if (initialContextFactory != null && initialContextFactory.length() > 0) {
if (jndiURL != null && jndiURL.length() > 0) {
if (messageProcessorName != null && messageProcessorName.length() > 0) {
if (requestConnectionName != null && requestConnectionName.length() > 0) {
if (responseConnectionName != null && responseConnectionName.length() > 0) {
if (operationPropertiesName != null && operationPropertiesName.length() > 0) {
boolean endFound = false;
if ("destination".equals(elementName)) {
} else if ("connectionFactory".equals(elementName)) {
} else if ("activationSpec".equals(elementName)) {
} else if ("response".equals(elementName)) {
} else if ("resourceAdapter".equals(elementName)) {
} else if ("headers".equals(elementName)) {
} else if ("operationProperties".equals(elementName)) {
} else if ("messageSelection".equals(elementName)) {
error(monitor, "WireFormatAlreadyDefined", reader, extension.toString());
error(monitor, "OpSelectorAlreadyDefined", reader, extension.toString());
error(monitor, "UnexpectedElement", reader, extension.toString());
error(monitor, "MustStartWithSchema", jmsBinding, uri);
error(monitor, "UnknownTokenInURI", jmsBinding, s, uri);
error(context.getMonitor(), "BindingNotFound", model, attrName, bindingName);
if (name != null && name.length() > 0) {
if (type != null && type.length() > 0) {
error(monitor, "InvalidDestinationType", reader, type);
if (create != null && create.length() > 0) {
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_NEVER", reader);
if (name != null && name.length() > 0) {
error(monitor, "MissingConnectionFactoryName", reader);
if (create != null && create.length() > 0) {
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_NEVER", reader);
if (name != null && name.length() > 0) {
if (create != null && create.length() > 0) {
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_NEVER", reader);
if (name != null && name.length() > 0) {
if (type != null && type.length() > 0) {
warning(monitor, "DoesntProcessResponseDestinationType", jmsBinding);
error(monitor, "InvalidResponseDestinationType", reader, type);
if (create != null && create.length() > 0) {
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_NEVER", reader);
if (name != null && name.length() > 0) {
warning(monitor, "MissingResponseConnectionFactory", reader);
if (create != null && create.length() > 0) {
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_NEVER", reader);
if (name != null && name.length() > 0) {
if (create != null && create.length() > 0) {
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
if (name == null || name.length() < 1) {
error(monitor, "MissingNameForCREATE_NEVER", reader);
error(monitor, "InvalidCreate", reader, create);
if ("destination".equals(elementName)) {
} else if ("connectionFactory".equals(elementName)) {
} else if ("activationSpec".equals(elementName)) {
if (name != null && name.length() > 0) {
error(monitor, "MissingResourceAdapterName", reader);
<headers JMSType="string"?
JMSCorrelationID="string"?
JMSDeliveryMode="PERSISTENT or NON_PERSISTENT"?
timeToLive="long"?
JMSPriority="0 .. 9"?>
<property name="NMTOKEN" type="NMTOKEN"?>*
</headers>?
if (jmsType != null && jmsType.length() > 0) {
if (jmsDeliveryMode != null && jmsDeliveryMode.length() > 0) {
error(monitor, "InvalidJMSDeliveryMode", jmsBinding, jmsDeliveryMode);
if (jmsTimeToLive != null && jmsTimeToLive.length() > 0) {
if (jmsPriority != null && jmsPriority.length() > 0) {
warning(monitor, "InvalidJMSPriority", jmsBinding, jmsPriority);
error(monitor, "InvalidJMSPriority", jmsBinding, jmsPriority);
error(monitor, "UnexpectedResponseElement", reader, x.toString());
if (name != null && name.length() > 0) {
<operationProperties name="string" selectedOperation="string"?>
<property name="NMTOKEN" type="NMTOKEN"?>*
<headers JMSType="string"?
JMSCorrelationID="string"?
JMSDeliveryMode="PERSISTENT or NON_PERSISTENT"?
timeToLive="long"?
JMSPriority="0 .. 9"?>
<property name="NMTOKEN" type="NMTOKEN"?>*
</headers>?
</operationProperties>*
error(monitor, "DuplicateOperationProperties", jmsBinding);
if (opName == null || opName.length() < 1) {
error(monitor, "MissingJMSOperationPropertyName", jmsBinding);
if (nativeOpName != null && nativeOpName.length() > 0) {
error(monitor, "UnexpectedResponseElement", reader, x.toString());
if (jmsType != null && jmsType.length() > 0) {
if (jmsDeliveryMode != null && jmsDeliveryMode.length() > 0) {
error(monitor, "InvalidOPJMSDeliveryMode", jmsBinding, jmsDeliveryMode);
if (jmsTimeToLive != null && jmsTimeToLive.length() > 0) {
if (jmsPriority != null && jmsPriority.length() > 0) {
warning(monitor, "InvalidOPJMSPriority", jmsBinding, jmsPriority);
error(monitor, "InvalidOPJMSPriority", jmsBinding, jmsPriority);
error(monitor, "UnexpectedResponseElement", reader, x.toString());
if (propName != null && propName.length() > 0) {
boolean completed = false;
if ("property".equals(elementName)) {
if (parentName.equals(endName)) {
if (name == null || name.length() < 1) {
error(monitor, "InvalidPropertyElement", reader);
Preserve an existing public method. The method validate() is a legacy method
that was called from reading am XML stream via the read(XMLStreamReader) method above.
However read(XMLStreamReader) now calls validate(JMSBinding jmsBinding) and
passes in the jmsBinding model.
The older validate() now calls validate(JMSBinding jmsBinding) with a null model.
Validates JMS parsing and JMSBinding model.
Validation rules are taken from the binding schema and the OSOA and OASIS specs:
http://www.oasis-open.org/committees/documents.php?wg_abbrev=sca-bindings
(sca-binding-jms-1.1-spec-cd01-rev4.pdf)
http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
(SCA JMS Binding V1.00 )
- Parameters:
jmsBinding
an optional JMS binding model to check for validity.- Since:
- 1.4
if ( jmsBinding == null ) {
if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
if ( connectionFactoryName.contains( "topic" )) {
error(monitor, "DestinationQueueContradiction", jmsBinding, connectionFactoryName );
if ( connectionFactoryName.contains( "queue" )) {
error(monitor, "DestinationTopicContradiction", jmsBinding, connectionFactoryName );
if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
if ((activationSpecName != null) && (activationSpecName.length() > 0 )) {
error(monitor, "ConnectionFactoryActivationSpecContradiction", jmsBinding, connectionFactoryName, activationSpecName );
error(monitor, "ActivationSpecNameRequiredForCreateAlways", jmsBinding);
if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {