diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-25 09:59:59 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-25 09:59:59 +0000 |
commit | 1cb0854316ad05d174753092d72edd6ff43d96d4 (patch) | |
tree | 2c2d316476e4e94342f6a0c74043ca51f59e817d /sca-java-2.x/trunk/modules/binding-jms/src/main | |
parent | 22b5a56aaca5537add1ce62c05410345db520131 (diff) |
Updates to create mode validation
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@988962 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jms/src/main')
3 files changed, 26 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingConstants.java b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingConstants.java index 80bc61baa1..25fbefa0a9 100644 --- a/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingConstants.java +++ b/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingConstants.java @@ -47,7 +47,7 @@ public interface JMSBindingConstants { Arrays.asList(new String[] {DESTINATION_TYPE_QUEUE, DESTINATION_TYPE_TOPIC}); String CREATE_ALWAYS = "always"; String CREATE_NEVER = "never"; - String CREATE_IF_NOT_EXIST = "ifnotexist"; + String CREATE_IF_NOT_EXIST = "ifNotExist"; String DEFAULT_CONTEXT_FACTORY_NAME = "org.apache.activemq.jndi.ActiveMQInitialContextFactory"; String DEFAULT_JNDI_URL = "tcp://localhost:61616"; int DEFAULT_TIME_TO_LIVE = 20000; // in milliseconds @@ -65,7 +65,7 @@ public interface JMSBindingConstants { String FAULT_PROPERTY = "org_apache_tuscany_sca_fault"; String CALLBACK_ID_PROPERTY = "CallbackID"; - String CALLBACK_Q_PROPERTY = "scaCallbackQueue"; + String CALLBACK_Q_PROPERTY = "scaCallbackDestination"; String CONVERSATION_ID_PROPERTY = "scaConversationId"; // XML element and attribute names 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 cf2a468fce..f4f1e5a2e3 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 @@ -440,10 +440,17 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St String create = reader.getAttributeValue(null, "create"); if (create != null && create.length() > 0) { + validateCreate(create, reader, monitor); jmsBinding.setDestinationCreate(create); } jmsBinding.getDestinationProperties().putAll(parseBindingProperties(reader, monitor)); + + if (jmsBinding.getDestinationCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) { + if (name == null || name.length() < 1) { + error(monitor, "MissingNameForCreate", reader); + } + } } private void parseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException { @@ -486,13 +493,27 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St String create = reader.getAttributeValue(null, "create"); if (create != null && create.length() > 0) { + validateCreate(create, reader, monitor); jmsBinding.setResponseDestinationCreate(create); } jmsBinding.getResponseDestinationProperties().putAll(parseBindingProperties(reader, monitor)); } - private void parseResponseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException { + 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) { jmsBinding.setResponseConnectionFactoryName(name); diff --git a/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties b/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties index 94f4c70cb1..acc7024a9c 100644 --- a/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties +++ b/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties @@ -52,3 +52,5 @@ DuplicateOperationProperties = Must not use both operationProperties attribute a WireFormatAlreadyDefined = The request wireformat has already been defined. Only one request wire format can be specified. OpSelectorAlreadyDefined = More than one operation selector has been specified. Only one operation selector can be specified. ResponseWireformatAlreadyDefined = The response wireformat has already been defined. Only one response wire format can be specified. +MissingNameForCreate = Must specify jndiName attribute when create mode is "ifNotExist" +InvalidCreate = Attribute create {0} invalid, must be 'always', 'never', or 'ifNotExist'
\ No newline at end of file |