You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by jf...@apache.org on 2009/03/21 17:44:06 UTC

svn commit: r756970 - in /webservices/juddi/branches/v3_trunk: juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java juddi-core/src/main/resources/messages_en.properties uddi-tck/src/main/java/org/uddi/api_v3/tck/TckTModel.java

Author: jfaath
Date: Sat Mar 21 16:44:04 2009
New Revision: 756970

URL: http://svn.apache.org/viewvc?rev=756970&view=rev
Log:
JUDDI-170: all user supplied keys in publishing operations are case-folded

Modified:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
    webservices/juddi/branches/v3_trunk/uddi-tck/src/main/java/org/uddi/api_v3/tck/TckTModel.java

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java?rev=756970&r1=756969&r2=756970&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java Sat Mar 21 16:44:04 2009
@@ -137,7 +137,7 @@
 			
 			Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
 			if (obj == null)
-				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingNotFound", entityKey));
+				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", entityKey));
 			
 			if (!publisher.isOwner((UddiEntity)obj))
 				throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
@@ -308,7 +308,7 @@
 	
 	public void validateBusinessEntity(EntityManager em, org.uddi.api_v3.BusinessEntity businessEntity) throws DispositionReportFaultMessage {
 		
-		// A supplied businessService can't be null
+		// A supplied businessEntity can't be null
 		if (businessEntity == null)
 			throw new ValueNotAllowedException(new ErrorMessage("errors.businessentity.NullInput"));
 		
@@ -320,6 +320,10 @@
 			businessEntity.setBusinessKey(entityKey);
 		}
 		else {
+			// Per section 4.4: keys must be case-folded
+			entityKey = entityKey.toLowerCase();
+			businessEntity.setBusinessKey(entityKey);
+			
 			Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
 			if (obj != null) {
 				entityExists = true;
@@ -382,10 +386,21 @@
 		
 		// Retrieve the service's passed key
 		String entityKey = businessService.getServiceKey();
+		if (entityKey != null && entityKey.length() > 0) {
+			// Per section 4.4: keys must be case-folded
+			entityKey = entityKey.toLowerCase();
+			businessService.setServiceKey(entityKey);
+		}
 		
 		// The parent key is either supplied or provided by the higher call to the parent entity save.  If the passed-in parent's business key differs from 
 		// the (non-null) business key retrieved from the service, then we have a possible service projection.
 		String parentKey = businessService.getBusinessKey();
+		if (parentKey != null && parentKey.length() > 0) {
+			// Per section 4.4: keys must be case-folded
+			parentKey = parentKey.toLowerCase();
+			businessService.setBusinessKey(parentKey);
+		}
+		
 		boolean isProjection = false;
 		if (parent != null) {
 			if (parentKey != null && parentKey.length() > 0) {
@@ -416,7 +431,6 @@
 			}
 		}
 		else {
-
 			boolean entityExists = false;
 			if (entityKey == null || entityKey.length() == 0) {
 				KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
@@ -424,6 +438,7 @@
 				businessService.setServiceKey(entityKey);
 			}
 			else {
+				
 				Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
 				if (obj != null) {
 					entityExists = true;
@@ -522,10 +537,21 @@
 
 		// Retrieve the binding's passed key
 		String entityKey = bindingTemplate.getBindingKey();
+		if (entityKey != null && entityKey.length() > 0) {
+			// Per section 4.4: keys must be case-folded
+			entityKey = entityKey.toLowerCase();
+			bindingTemplate.setBindingKey(entityKey);
+		}
 
 		// The parent key is either supplied or provided by the higher call to the parent entity save.  If it is provided in both instances, if they differ, an 
 		// error occurs.
 		String parentKey = bindingTemplate.getServiceKey();
+		if (parentKey != null && parentKey.length() > 0) {
+			// Per section 4.4: keys must be case-folded
+			parentKey = parentKey.toLowerCase();
+			bindingTemplate.setServiceKey(parentKey);
+		}
+		
 		if (parent != null) {
 			if (parentKey != null && parentKey.length() > 0) {
 				if (!parentKey.equalsIgnoreCase(parent.getBusinessKey()))
@@ -542,6 +568,7 @@
 			bindingTemplate.setBindingKey(entityKey);
 		}
 		else {
+			
 			Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
 			if (obj != null) {
 				entityExists = true;
@@ -631,6 +658,10 @@
 			tModel.setTModelKey(entityKey);
 		}
 		else {
+			// Per section 4.4: keys must be case-folded
+			entityKey = entityKey.toLowerCase();
+			tModel.setTModelKey(entityKey);
+			
 			Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
 			if (obj != null) {
 				entityExists = true;

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties?rev=756970&r1=756969&r2=756970&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties Sat Mar 21 16:44:04 2009
@@ -73,7 +73,7 @@
 errors.invalidkey.EntityNotFound=The entity was not found for the given id
 errors.invalidkey.BusinessNotFound=The business entity was not found for the given key
 errors.invalidkey.ServiceNotFound=The business service was not found for the given key
-errors.invalidkey.BindingTemplatelNotFound=The binding template was not found for the given key
+errors.invalidkey.BindingTemplateNotFound=The binding template was not found for the given key
 errors.invalidkey.TModelNotFound=The technical model was not found for the given key
 errors.invalidkey.ParentServiceNotFound=The business service parent was not found for the given key
 errors.invalidkey.ParentBusinessNotFound=The business entity parent was not found for the given key

Modified: webservices/juddi/branches/v3_trunk/uddi-tck/src/main/java/org/uddi/api_v3/tck/TckTModel.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/uddi-tck/src/main/java/org/uddi/api_v3/tck/TckTModel.java?rev=756970&r1=756969&r2=756970&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/uddi-tck/src/main/java/org/uddi/api_v3/tck/TckTModel.java (original)
+++ webservices/juddi/branches/v3_trunk/uddi-tck/src/main/java/org/uddi/api_v3/tck/TckTModel.java Sat Mar 21 16:44:04 2009
@@ -34,7 +34,7 @@
 public class TckTModel 
 {
 	final static String JOE_PUBLISHER_TMODEL_XML      = "uddi_data/joepublisher/tModelKeyGen.xml";
-    final static String JOE_PUBLISHER_TMODEL_KEY      = "uddi:uddi.joepublisher.com:KEYGENERATOR";
+    final static String JOE_PUBLISHER_TMODEL_KEY      = "uddi:uddi.joepublisher.com:keygenerator";
     final static String SAM_SYNDICATOR_TMODEL_XML     = "uddi_data/samsyndicator/tModelKeyGen.xml";
     final static String SAM_SYNDICATOR_TMODEL_KEY     = "uddi:www.samco.com:keygenerator";
  



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org