in modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java [1041:1110]
protected void validate( JMSBinding jmsBinding, Monitor monitor ) {
// If no JMSBinding model is provided, that is all the validation we can do.
if ( jmsBinding == null ) {
return;
}
// Connection factory should not contradict destination type.
String connectionFactoryName = jmsBinding.getConnectionFactoryName();
if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
if (JMSBindingConstants.DESTINATION_TYPE_QUEUE == jmsBinding.getDestinationType()) {
if ( connectionFactoryName.contains( "topic" )) {
error(monitor, "DestinationQueueContradiction", jmsBinding, connectionFactoryName );
}
}
if (JMSBindingConstants.DESTINATION_TYPE_TOPIC == jmsBinding.getDestinationType()) {
if ( connectionFactoryName.contains( "queue" )) {
error(monitor, "DestinationTopicContradiction", jmsBinding, connectionFactoryName );
}
}
}
// Connection factory and activation Specification are mutually exclusive.
if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
String activationSpecName = jmsBinding.getActivationSpecName();
if ((activationSpecName != null) && (activationSpecName.length() > 0 )) {
error(monitor, "ConnectionFactoryActivationSpecContradiction", jmsBinding, connectionFactoryName, activationSpecName );
}
}
// If URI is specified, destination should not be present
if ( ( jmsBinding.getJMSURI() != null ) && ( jmsBinding.getJMSURI().length() > 0) &&
(jmsBinding.isDestinationSpecified())) {
error(monitor, "DestinationURIContradiction", jmsBinding, jmsBinding.getJMSURI(), jmsBinding.getDestinationName());
}
// If activation spec exists with create=always, a jndiName must be specified
if (JMSBindingConstants.CREATE_ALWAYS.equals(jmsBinding.getActivationSpecCreate()) &&
(jmsBinding.getActivationSpecName() == null)) {
error(monitor, "ActivationSpecNameRequiredForCreateAlways", jmsBinding);
}
// If Connection factory specified then destination name must also be
if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
String destinationName = jmsBinding.getDestinationName();
if ((destinationName == null) || (destinationName.length() < 1 )) {
error(monitor, "ConnectionFactoryDestinationContradiction", jmsBinding, connectionFactoryName);
}
}
// Given a response connection name attribute, there must not be a response element.
// 156 /binding.jms/@responseConnection - identifies a binding.jms element that is present in a
// 157 definition document, whose response child element is used to define the values for this binding. In
// 158 this case this binding.jms element MUST NOT contain a response element.
QName responseConnectionName = jmsBinding.getResponseConnectionName();
if (( responseConnectionName != null ) && ( responseConnectionName.getLocalPart().length() > 0 )) {
String responseDestinationName = jmsBinding.getResponseDestinationName();
if (( responseDestinationName != null ) && (responseDestinationName.length() > 0)) {
error(monitor, "ResponseAttrElement", jmsBinding, responseConnectionName, responseDestinationName );
}
}
// [BJM30029] The value of the operationProperties/@selectedOperation attribute MUST be unique across the containing binding.jms element
Set<String> ops = new HashSet<String>(jmsBinding.getNativeOperationNames().values());
if (ops.size() != jmsBinding.getNativeOperationNames().values().size()) {
error(monitor, "BJM30029", jmsBinding);
}
// Other jmsBinding model validation may be added here.
}