[riftsaw-commits] riftsaw SVN: r974 - trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi.

riftsaw-commits at lists.jboss.org riftsaw-commits at lists.jboss.org
Wed Sep 22 15:02:03 EDT 2010


Author: kurt.stam at jboss.com
Date: 2010-09-22 15:02:02 -0400 (Wed, 22 Sep 2010)
New Revision: 974

Modified:
   trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java
Log:
RIFTSAW-276, uddi client no longer throws an exception when no results are found. Updating the RiftSaw UDDI code to handle this.

Modified: trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java
===================================================================
--- trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java	2010-09-22 16:56:08 UTC (rev 973)
+++ trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java	2010-09-22 19:02:02 UTC (rev 974)
@@ -247,32 +247,17 @@
 		try {
 			//Checking if this serviceKey already exist
 			service = clerk.findService(serviceKey, clerk.getUDDINode().getApiNode());
-			log.debug("Service " + serviceName + " already present in the UDDI Registry");
+			if (service==null) {
+				service = createBusinessService(serviceName, serviceKey, properties);
+			} else {
+				log.debug("Service " + serviceName + " already present in the UDDI Registry");
+			}
 		} catch (Exception e) {
-			//If it does not exist construct service information
-			log.debug("Constructing Service UDDI Information for " + serviceName);
-			service = new BusinessService();
-			service.setBusinessKey(TokenResolver.replaceTokens("uddi:${keyDomain}:${businessKey}", properties));
-			service.setServiceKey(serviceKey);
-			if (properties.containsKey(SERVICE_DESCRIPTION)) {
-				Description description = new Description();
-				String lang = "en";
-				if (properties.containsKey(LANG)) lang = properties.getProperty(LANG);
-				description.setLang(lang);
-				description.setValue(properties.getProperty(SERVICE_DESCRIPTION));
-				Name sName = new Name();
-				sName.setLang(lang);
-				sName.setValue(serviceName);
-				service.getName().add(sName);
-				service.getDescription().add(description);
-			}
-			//default categoryBag on the binding
-			if (properties.containsKey(SERVICE_CATEGORY_BAG)) {
-				String defaultCategoryBag = properties.getProperty(SERVICE_CATEGORY_BAG);
-				log.info("Adding categoryBag: " + defaultCategoryBag);
-				CategoryBag categoryBag = parseCategoryBag(defaultCategoryBag);
-		        service.setCategoryBag(categoryBag);
-			}
+			
+			//This is here to support the jUDDI-client code prior to 3.0.3 where an
+			//exception was thrown when a service was not found.
+			//DEPRECATED, please remove when older jUDDI-client versions are no longer supported.
+			service = createBusinessService(serviceName, serviceKey, properties);
 		}
 		//Construct bindingTemplate
 		BindingTemplate binding = createBindingTemplate(clerk, serviceName, portName, accessUrl);
@@ -285,6 +270,34 @@
 		return service;
 	}
 	
+	private BusinessService createBusinessService(String serviceName, String serviceKey, Properties properties) {
+		//If it does not exist construct service information
+		log.debug("Constructing Service UDDI Information for " + serviceName);
+		BusinessService service = new BusinessService();
+		service.setBusinessKey(TokenResolver.replaceTokens("uddi:${keyDomain}:${businessKey}", properties));
+		service.setServiceKey(serviceKey);
+		String lang = "en";
+		if (properties.containsKey(SERVICE_DESCRIPTION)) {
+			Description description = new Description();
+			if (properties.containsKey(LANG)) lang = properties.getProperty(LANG);
+			description.setLang(lang);
+			description.setValue(properties.getProperty(SERVICE_DESCRIPTION));
+			service.getDescription().add(description);
+		}
+		Name sName = new Name();
+		sName.setLang(lang);
+		sName.setValue(serviceName);
+		service.getName().add(sName);
+		//default categoryBag on the binding
+		if (properties.containsKey(SERVICE_CATEGORY_BAG)) {
+			String defaultCategoryBag = properties.getProperty(SERVICE_CATEGORY_BAG);
+			log.info("Adding categoryBag: " + defaultCategoryBag);
+			CategoryBag categoryBag = parseCategoryBag(defaultCategoryBag);
+	        service.setCategoryBag(categoryBag);
+		}
+		return service;
+	}
+	
 	private BindingTemplate createBindingTemplate(UDDIClerk clerk,
 			String serviceName, String portName, URL accessURL) {
 		



More information about the riftsaw-commits mailing list