tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r989225 - in /tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main: java/org/apache/tuscany/sca/binding/jms/ resources/
Date Wed, 25 Aug 2010 17:04:13 GMT
Author: antelder
Date: Wed Aug 25 17:04:13 2010
New Revision: 989225

URL: http://svn.apache.org/viewvc?rev=989225&view=rev
Log:
Updates for create attribute validation

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java?rev=989225&r1=989224&r2=989225&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
Wed Aug 25 17:04:13 2010
@@ -88,14 +88,14 @@ public class JMSBinding implements Bindi
     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;

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java?rev=989225&r1=989224&r2=989225&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java
Wed Aug 25 17:04:13 2010
@@ -448,7 +448,12 @@ public class JMSBindingProcessor extends
         
         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
         } 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
         } 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
         	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
         } 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
         } 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();

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties?rev=989225&r1=989224&r2=989225&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
Wed Aug 25 17:04:13 2010
@@ -52,5 +52,6 @@ DuplicateOperationProperties = Must not 
 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
+MissingNameForCREATE_NEVER = Must specify jndiName attribute when create mode is "never"
+MissingNameForCREATE_IF_NOT_EXIST = Must specify jndiName attribute when create mode is "ifNotExist"
+InvalidCreate = Attribute create {0} invalid, must be 'always', 'never', or 'ifNotExist'



Mime
View raw message