diff options
Diffstat (limited to '')
2 files changed, 95 insertions, 16 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java index 39ffbfb854..977ef17d52 100644 --- a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java +++ b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java @@ -88,14 +88,14 @@ public class JMSBinding implements Binding, PolicySubject, OperationsConfigurato private Map<String, BindingProperty> connectionFactoryProperties = new HashMap<String, BindingProperty>(); private String activationSpecName = null; - private String activationSpecCreate = null; + private String activationSpecCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST; private Map<String, BindingProperty> activationSpecProperties = new HashMap<String, BindingProperty>(); private String resourceAdapterName;; private Map<String, BindingProperty> resourceAdapterProperties = new HashMap<String, BindingProperty>(); private String responseActivationSpecName = null; - private String responseActivationSpecCreate = null; + private String responseActivationSpecCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST; private Map<String, BindingProperty> responseActivationSpecProperties = new HashMap<String, BindingProperty>(); private String responseDestinationName = null; diff --git a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java index f4f1e5a2e3..b58a23c5ca 100644 --- a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java +++ b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java @@ -448,7 +448,12 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St if (jmsBinding.getDestinationCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) { if (name == null || name.length() < 1) { - error(monitor, "MissingNameForCreate", reader); + error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader); + } + } + if (jmsBinding.getDestinationCreate().equals(JMSBindingConstants.CREATE_NEVER)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_NEVER", reader); } } } @@ -460,6 +465,23 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St } else { error(monitor, "MissingConnectionFactoryName", reader); } + + String create = reader.getAttributeValue(null, "create"); + if (create != null && create.length() > 0) { + validateCreate(create, reader, monitor); + jmsBinding.setConnectionFactoryCreate(create); + } + if (jmsBinding.getConnectionFactoryCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader); + } + } + if (jmsBinding.getConnectionFactoryCreate().equals(JMSBindingConstants.CREATE_NEVER)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_NEVER", reader); + } + } + jmsBinding.getConnectionFactoryProperties().putAll(parseBindingProperties(reader, monitor)); } @@ -470,6 +492,23 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St } else { error(monitor, "MissingActivationSpecName", reader); } + + String create = reader.getAttributeValue(null, "create"); + if (create != null && create.length() > 0) { + validateCreate(create, reader, monitor); + jmsBinding.setActivationSpecCreate(create); + } + if (jmsBinding.getActivationSpecCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader); + } + } + if (jmsBinding.getActivationSpecCreate().equals(JMSBindingConstants.CREATE_NEVER)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_NEVER", reader); + } + } + jmsBinding.getActivationSpecProperties().putAll(parseBindingProperties(reader, monitor)); } @@ -496,23 +535,20 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St validateCreate(create, reader, monitor); jmsBinding.setResponseDestinationCreate(create); } + if (jmsBinding.getResponseDestinationCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader); + } + } + if (jmsBinding.getResponseDestinationCreate().equals(JMSBindingConstants.CREATE_NEVER)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_NEVER", reader); + } + } jmsBinding.getResponseDestinationProperties().putAll(parseBindingProperties(reader, monitor)); } - private void validateCreate(String create, XMLStreamReader reader, Monitor monitor) { - if (JMSBindingConstants.CREATE_ALWAYS.equals(create)) { - return; - } - if (JMSBindingConstants.CREATE_NEVER.equals(create)) { - return; - } - if (JMSBindingConstants.CREATE_IF_NOT_EXIST.equals(create)) { - return; - } - error(monitor, "InvalidCreate", reader, create); - } - private void parseResponseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException { String name = getURIString(reader, "jndiName"); if (name != null && name.length() > 0) { @@ -520,6 +556,21 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St } else { warning(monitor, "MissingResponseConnectionFactory", reader); } + String create = reader.getAttributeValue(null, "create"); + if (create != null && create.length() > 0) { + validateCreate(create, reader, monitor); + jmsBinding.setResponseConnectionFactoryCreate(create); + } + if (jmsBinding.getResponseConnectionFactoryCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader); + } + } + if (jmsBinding.getResponseConnectionFactoryCreate().equals(JMSBindingConstants.CREATE_NEVER)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_NEVER", reader); + } + } jmsBinding.getResponseConnectionFactoryProperties().putAll(parseBindingProperties(reader, monitor)); } @@ -530,9 +581,37 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St } else { warning(monitor, "MissingResponseActivationSpec", reader); } + String create = reader.getAttributeValue(null, "create"); + if (create != null && create.length() > 0) { + validateCreate(create, reader, monitor); + jmsBinding.setResponseActivationSpecCreate(create); + } + if (jmsBinding.getResponseActivationSpecCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader); + } + } + if (jmsBinding.getResponseActivationSpecCreate().equals(JMSBindingConstants.CREATE_NEVER)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCREATE_NEVER", reader); + } + } jmsBinding.getResponseActivationSpecProperties().putAll(parseBindingProperties(reader, monitor)); } + private void validateCreate(String create, XMLStreamReader reader, Monitor monitor) { + if (JMSBindingConstants.CREATE_ALWAYS.equals(create)) { + return; + } + if (JMSBindingConstants.CREATE_NEVER.equals(create)) { + return; + } + if (JMSBindingConstants.CREATE_IF_NOT_EXIST.equals(create)) { + return; + } + error(monitor, "InvalidCreate", reader, create); + } + private void parseResponse(XMLStreamReader reader, JMSBinding jmsBinding, ProcessorContext context) throws ContributionReadException, XMLStreamException { // Read sub-elements of response Monitor monitor = context.getMonitor(); |