You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scout-dev@ws.apache.org by tc...@apache.org on 2009/09/07 01:21:24 UTC

svn commit: r811951 [4/4] - in /webservices/scout/trunk: ./ src/main/java/org/apache/ws/scout/registry/ src/main/java/org/apache/ws/scout/transport/ src/main/java/org/apache/ws/scout/util/ src/test/java/org/apache/ws/scout/ src/test/java/org/apache/ws/...

Added: webservices/scout/trunk/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiV3Helper.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiV3Helper.java?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiV3Helper.java (added)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiV3Helper.java Sun Sep  6 23:21:23 2009
@@ -0,0 +1,931 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout.util;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.infomodel.Association;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.EmailAddress;
+import javax.xml.registry.infomodel.ExternalIdentifier;
+import javax.xml.registry.infomodel.ExternalLink;
+import javax.xml.registry.infomodel.InternationalString;
+import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.LocalizedString;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.PostalAddress;
+import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.Slot;
+import javax.xml.registry.infomodel.SpecificationLink;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.uddi.api_v3.*;
+import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
+
+/**
+ * Helper class that does Jaxr->UDDI Mapping
+ *
+ * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
+ * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
+ */
+public class ScoutJaxrUddiV3Helper 
+{
+    private static final String UDDI_ORG_TYPES = "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4";
+	private static Log log = LogFactory.getLog(ScoutJaxrUddiV3Helper.class);
+	private static ObjectFactory objectFactory = new ObjectFactory();
+	
+    /**
+     * Get UDDI Address given JAXR Postal Address
+     */
+	public static Address getAddress(PostalAddress postalAddress) throws JAXRException {
+		Address address = objectFactory.createAddress();
+
+		AddressLine[] addarr = new AddressLine[6];
+
+        String stnum = postalAddress.getStreetNumber();
+        String st = postalAddress.getStreet();
+        String city = postalAddress.getCity();
+        String country = postalAddress.getCountry();
+        String code = postalAddress.getPostalCode();
+        String state = postalAddress.getStateOrProvince();
+
+		AddressLine stnumAL = objectFactory.createAddressLine();
+        stnumAL.setKeyName("STREET_NUMBER");
+		if (stnum != null) {
+        stnumAL.setKeyValue(stnum);
+		}
+
+		AddressLine stAL = objectFactory.createAddressLine();
+        stAL.setKeyName("STREET");
+		if (st != null) {
+        stAL.setKeyValue(st);
+		}
+
+		AddressLine cityAL = objectFactory.createAddressLine();
+        cityAL.setKeyName("CITY");
+		if (city != null) {
+        cityAL.setKeyValue(city);
+		}
+
+		AddressLine countryAL = objectFactory.createAddressLine();
+        countryAL.setKeyName("COUNTRY");
+		if (country != null) {
+        countryAL.setKeyValue(country);
+		}
+
+		AddressLine codeAL = objectFactory.createAddressLine();
+        codeAL.setKeyName("POSTALCODE");
+		if (code != null) {
+        codeAL.setKeyValue(code);
+		}
+
+		AddressLine stateAL = objectFactory.createAddressLine();
+        stateAL.setKeyName("STATE");
+		if (state != null) {
+        stateAL.setKeyValue(state);
+		}
+
+		// Add the AddressLine to vector
+		addarr[0] = stnumAL;
+		addarr[1] = stAL;
+		addarr[2] = cityAL;
+		addarr[3] = countryAL;
+		addarr[4] = codeAL;
+		addarr[5] = stateAL;
+
+		address.getAddressLine().addAll(Arrays.asList(addarr));
+
+        return address;
+    }
+
+	public static BindingTemplate getBindingTemplateFromJAXRSB(
+			ServiceBinding serviceBinding) throws JAXRException {
+		BindingTemplate bt = objectFactory.createBindingTemplate();
+		if (serviceBinding.getKey() != null && serviceBinding.getKey().getId() != null) {
+			bt.setBindingKey(serviceBinding.getKey().getId());
+		} else {
+			bt.setBindingKey("");
+		}
+	
+		try {
+			// Set Access URI
+            String accessuri = serviceBinding.getAccessURI();
+			if (accessuri != null) {
+				AccessPoint accessPoint = objectFactory.createAccessPoint();
+                accessPoint.setUseType(getUseType(accessuri));
+				accessPoint.setValue(accessuri);
+                bt.setAccessPoint(accessPoint);
+            }
+            ServiceBinding sb = serviceBinding.getTargetBinding();
+			if (sb != null) {
+				HostingRedirector red = objectFactory.createHostingRedirector();
+                Key key = sb.getKey();
+				if (key != null && key.getId() != null) {
+					red.setBindingKey(key.getId());
+                } else {
+                    red.setBindingKey("");
+                }
+                bt.setHostingRedirector(red);
+            } else {
+            	if (bt.getAccessPoint() == null) {
+            		bt.setAccessPoint(objectFactory.createAccessPoint());
+            	}
+            }
+			// TODO:Need to look further at the mapping b/w BindingTemplate and
+			// Jaxr ServiceBinding
+
+			// Get Service information
+           Service svc = serviceBinding.getService();
+			if (svc != null && svc.getKey() != null && svc.getKey().getId() != null) {
+              bt.setServiceKey(svc.getKey().getId());
+           }
+			
+			InternationalString idesc = serviceBinding.getDescription();
+            
+            addDescriptions(bt.getDescription(), idesc);
+
+			// SpecificationLink
+           Collection<SpecificationLink> slcol = serviceBinding.getSpecificationLinks();
+			TModelInstanceDetails tid = objectFactory.createTModelInstanceDetails();
+			if (slcol != null && !slcol.isEmpty()) {
+              Iterator<SpecificationLink> iter = slcol.iterator();
+				while (iter.hasNext()) {
+					SpecificationLink slink = (SpecificationLink) iter.next();
+
+					TModelInstanceInfo emptyTInfo = objectFactory.createTModelInstanceInfo();
+					tid.getTModelInstanceInfo().add(emptyTInfo);
+
+                    RegistryObject specificationObject = slink.getSpecificationObject();
+					if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
+						emptyTInfo.setTModelKey(specificationObject.getKey().getId());
+                        if (specificationObject.getDescription()!=null) {
+                            for (Object o : specificationObject.getDescription().getLocalizedStrings()) {
+                                LocalizedString locDesc = (LocalizedString) o;
+                                Description description = objectFactory.createDescription();
+                                emptyTInfo.getDescription().add(description);
+                                description.setValue(locDesc.getValue());
+                                description.setLang(locDesc.getLocale().getLanguage());
+                            }
+                        }
+                        Collection<ExternalLink> externalLinks = slink.getExternalLinks();
+                        if (externalLinks!=null && externalLinks.size()>0) {
+                            for (ExternalLink link : externalLinks) {
+                                InstanceDetails ids = objectFactory.createInstanceDetails();
+                                emptyTInfo.setInstanceDetails(ids);
+                                if (link.getDescription()!=null) {
+                                    Description description = objectFactory.createDescription();
+                                    ids.getDescription().add(description);
+                                    description.setValue(link.getDescription().getValue());
+                                }
+                                if (link.getExternalURI()!=null) {
+                                    OverviewDoc overviewDoc = objectFactory.createOverviewDoc();
+                                    ids.getOverviewDoc().add(overviewDoc);
+                                    org.uddi.api_v3.OverviewURL ourl = new org.uddi.api_v3.OverviewURL();
+                                    ourl.setValue(link.getExternalURI());
+                                    overviewDoc.setOverviewURL(ourl);
+                                }
+                            } 
+                        }
+					}
+              }
+            }
+			if (tid.getTModelInstanceInfo().size() != 0) {
+				bt.setTModelInstanceDetails(tid);
+			}
+			log.debug("BindingTemplate=" + bt.toString());
+		} catch (Exception ud) {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return bt;
+    }
+
+	public static PublisherAssertion getPubAssertionFromJAXRAssociation(
+			Association association) throws JAXRException {
+		PublisherAssertion pa = objectFactory.createPublisherAssertion();
+		try {
+			if (association.getSourceObject().getKey() != null && 
+				association.getSourceObject().getKey().getId() != null) {
+            pa.setFromKey(association.getSourceObject().getKey().getId());
+			}
+			
+			if (association.getTargetObject().getKey() != null &&
+				association.getTargetObject().getKey().getId() != null) {
+            pa.setToKey(association.getTargetObject().getKey().getId());
+			}
+            Concept c = association.getAssociationType();
+            String v = c.getValue();
+			KeyedReference kr = objectFactory.createKeyedReference();
+            Key key = c.getKey();
+			if (key == null) {
+				// TODO:Need to check this. If the concept is a predefined
+				// enumeration, the key can be the parent classification scheme
+                key = c.getClassificationScheme().getKey();
+            }
+			if (key != null && key.getId() != null) {
+				kr.setTModelKey(key.getId());
+			} 
+            kr.setKeyName("Concept");
+
+			if (v != null) {
+				kr.setKeyValue(v);
+			}
+
+            pa.setKeyedReference(kr);
+		} catch (Exception ud) {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return pa;
+    }
+
+	public static PublisherAssertion getPubAssertionFromJAXRAssociationKey(
+			String key) throws JAXRException {
+		PublisherAssertion pa = objectFactory.createPublisherAssertion();
+		try {
+			StringTokenizer token = new StringTokenizer(key, ":");
+			if (token.hasMoreTokens()) {
+               pa.setFromKey(getToken(token.nextToken()));
+               pa.setToKey(getToken(token.nextToken()));
+				KeyedReference kr = objectFactory.createKeyedReference();
+				// Sometimes the Key is UUID:something
+               String str = getToken(token.nextToken());
+				if ("UUID".equals(str))
+					str += ":" + getToken(token.nextToken());
+               kr.setTModelKey(str);
+               kr.setKeyName(getToken(token.nextToken()));
+               kr.setKeyValue(getToken(token.nextToken()));
+               pa.setKeyedReference(kr);
+            }
+
+		} catch (Exception ud) {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return pa;
+    }
+
+	public static BusinessService getBusinessServiceFromJAXRService(
+			Service service) throws JAXRException {
+		BusinessService bs = objectFactory.createBusinessService();
+		try {
+			InternationalString iname = service.getName();
+						
+			addNames(bs.getName(), iname);
+	         
+            InternationalString idesc = service.getDescription();
+    
+           addDescriptions(bs.getDescription(), idesc);
+
+            Organization o = service.getProvidingOrganization();
+
+            /*
+             * there may not always be a key...
+             */
+            if (o != null) {
+                Key k = o.getKey();
+
+				if (k != null && k.getId() != null) {
+                    bs.setBusinessKey(k.getId());
+                } 
+                    
+			} else {
+                /*
+                 * gmj - I *think* this is the right thing to do
+                 */
+				throw new JAXRException(
+						"Service has no associated organization");
+            }
+
+			if (service.getKey() != null && service.getKey().getId() != null) {
+                bs.setServiceKey(service.getKey().getId());
+            } else {
+                bs.setServiceKey("");
+            }
+
+            CategoryBag catBag = getCategoryBagFromClassifications(service.getClassifications());
+            if (catBag!=null) {
+                bs.setCategoryBag(catBag);
+            }
+
+            //Add the ServiceBinding information
+            BindingTemplates bt = getBindingTemplates(service.getServiceBindings());
+            if (bt != null) {
+                bs.setBindingTemplates(bt);
+            }
+   		    
+            log.debug("BusinessService=" + bs.toString());
+		} catch (Exception ud) {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return bs;
+    }
+
+	public static TModel getTModelFromJAXRClassificationScheme(
+			ClassificationScheme classificationScheme) throws JAXRException {
+		TModel tm = objectFactory.createTModel();
+		try {
+            /*
+             * a fresh scheme might not have a key
+             */
+
+            Key k = classificationScheme.getKey();
+
+            if (k != null && k.getId() != null) {
+                tm.setTModelKey(k.getId());
+            } else {
+                tm.setTModelKey("");
+            }
+
+            /*
+             * There's no reason to believe these are here either
+             */
+
+            Slot s = classificationScheme.getSlot("authorizedName");
+/*
+			if (s != null && s.getName() != null) {
+                tm.setAuthorizedName(s.getName());
+            }
+*/
+            s = classificationScheme.getSlot("operator");
+/*
+			if (s != null && s.getName() != null) {
+                tm.setOperator(s.getName());
+            }
+*/
+			InternationalString iname = classificationScheme.getName();
+			 
+            tm.setName(getFirstName(iname));
+
+			InternationalString idesc = classificationScheme.getDescription();
+			
+		    addDescriptions(tm.getDescription(), idesc);
+
+            IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(classificationScheme.getExternalIdentifiers());
+            if (idBag!=null) {
+                tm.setIdentifierBag(idBag);
+            }
+            CategoryBag catBag = getCategoryBagFromClassifications(classificationScheme.getClassifications());
+            if (catBag!=null) {
+                tm.setCategoryBag(catBag);
+            }
+			
+			// ToDO: overviewDoc
+		} catch (Exception ud) {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return tm;
+    }
+
+    public static TModel getTModelFromJAXRConcept(Concept concept)
+			throws JAXRException {
+    	TModel tm = objectFactory.createTModel();
+		if (concept == null)
+			return null;
+		try {
+            Key key = concept.getKey();
+			if (key != null && key.getId() != null)
+				tm.setTModelKey(key.getId());
+            Slot sl1 = concept.getSlot("authorizedName");
+            /*
+			if (sl1 != null && sl1.getName() != null)
+				tm.setAuthorizedName(sl1.getName());
+
+            Slot sl2 = concept.getSlot("operator");
+			if (sl2 != null && sl2.getName() != null)
+				tm.setOperator(sl2.getName());
+			*/
+			InternationalString iname = concept.getName();
+
+            tm.setName(getFirstName(iname));
+
+            InternationalString idesc = concept.getDescription();
+			
+            addDescriptions(tm.getDescription(), idesc);
+
+//          External Links
+            Collection<ExternalLink> externalLinks = concept.getExternalLinks(); 
+            if(externalLinks != null && externalLinks.size() > 0)
+            {
+                tm.getOverviewDoc().add(getOverviewDocFromExternalLink((ExternalLink)externalLinks.iterator().next()));
+            }  
+
+            IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(concept.getExternalIdentifiers());
+            if (idBag!=null) {
+                tm.setIdentifierBag(idBag);
+            }
+            CategoryBag catBag = getCategoryBagFromClassifications(concept.getClassifications());
+            if (catBag!=null) {
+                tm.setCategoryBag(catBag);
+            }
+
+		} catch (Exception ud) {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return tm;
+    }
+
+    private static void addDescriptions(List<Description> descripions, InternationalString idesc) throws JAXRException {
+        if (idesc != null) {
+            for (Object o : idesc.getLocalizedStrings()) {
+                LocalizedString locName = (LocalizedString) o;
+                Description desc = objectFactory.createDescription();
+                descripions.add(desc);
+                desc.setValue(locName.getValue());
+                desc.setLang(locName.getLocale().getLanguage());
+            }
+        }
+    }
+
+    private static Name getFirstName(InternationalString iname) throws JAXRException {
+        for (Object o : iname.getLocalizedStrings()) {
+            LocalizedString locName = (LocalizedString) o;
+            Name name = objectFactory.createName();
+            name.setValue(locName.getValue());
+            name.setLang(locName.getLocale().getLanguage());
+            return name;
+        }
+        return null;
+    }
+    private static void addNames(List<Name> names, InternationalString iname) throws JAXRException {
+        for (Object o : iname.getLocalizedStrings()) {
+            LocalizedString locName = (LocalizedString) o;
+            Name name = objectFactory.createName();
+            name.setValue(locName.getValue());
+            name.setLang(locName.getLocale().getLanguage());
+            names.add(name);
+        }
+    }
+
+    public static BusinessEntity getBusinessEntityFromJAXROrg(Organization organization)
+			throws JAXRException {
+		BusinessEntity biz = objectFactory.createBusinessEntity();
+		BusinessServices bss = objectFactory.createBusinessServices();
+		BusinessService[] barr = new BusinessService[0];
+
+		try {
+			// It may just be an update
+            Key key = organization.getKey();
+			if (key != null && key.getId() != null) {
+				biz.setBusinessKey(key.getId());
+            } else {
+                biz.setBusinessKey("");
+            }
+			// Lets get the Organization attributes at the top level
+			
+			InternationalString iname = organization.getName();
+			
+			if (iname != null) {
+                addNames(biz.getName(), iname);
+			}
+			
+			InternationalString idesc = organization.getDescription();
+			
+            addDescriptions(biz.getDescription(), idesc);
+
+			if (organization.getPrimaryContact() != null && 
+				organization.getPrimaryContact().getPersonName()!= null &&
+				organization.getPrimaryContact().getPersonName().getFullName() != null) {
+
+				//biz.setAuthorizedName(organization.getPrimaryContact().getPersonName()
+				//		.getFullName());
+			}
+
+            Collection<Service> s = organization.getServices();
+            log.debug("?Org has services=" + s.isEmpty());
+
+			barr = new BusinessService[s.size()];
+
+            Iterator<Service> iter = s.iterator();
+			int barrPos = 0;
+			while (iter.hasNext()) {
+				BusinessService bs = ScoutJaxrUddiV3Helper
+						.getBusinessServiceFromJAXRService((Service) iter
+								.next());
+				barr[barrPos] = bs;
+				barrPos++;
+            }
+
+            /*
+             * map users : JAXR has concept of 'primary contact', which is a
+             * special designation for one of the users, and D6.1 seems to say
+             * that the first UDDI user is the primary contact
+             */
+
+			Contacts cts = objectFactory.createContacts();
+			Contact[] carr = new Contact[0];
+
+            User primaryContact = organization.getPrimaryContact();
+            Collection<User> users = organization.getUsers();
+
+            // Expand array to necessary size only (xmlbeans does not like
+            // null items in cases like this)
+
+            int carrSize = 0;
+
+            if (primaryContact != null) {
+                carrSize += 1;
+            }
+
+            // TODO: Clean this up and make it more efficient
+            Iterator<User> it = users.iterator();
+            while (it.hasNext()) {
+                User u = (User) it.next();
+                if (u != primaryContact) {
+                    carrSize++;
+                }
+            }
+
+            carr = new Contact[carrSize];
+
+            /*
+             * first do primary, and then filter that out in the loop
+             */
+            if (primaryContact != null) {
+                Contact ct = getContactFromJAXRUser(primaryContact);
+                carr[0] = ct;
+            }
+
+            it = users.iterator();
+            int carrPos = 1;
+            while (it.hasNext()) {
+                User u = (User) it.next();
+
+                if (u != primaryContact) {
+                    Contact ct = getContactFromJAXRUser(u);
+                    carr[carrPos] = ct;
+                    carrPos++;
+                }
+            }
+
+			bss.getBusinessService().addAll(Arrays.asList(barr));
+            if (carr.length>0) {
+                cts.getContact().addAll(Arrays.asList(carr));
+                biz.setContacts(cts);
+            }
+            biz.setBusinessServices(bss);
+
+            // External Links
+            Iterator<ExternalLink> exiter = organization.getExternalLinks().iterator();
+            DiscoveryURLs emptyDUs = null;
+            boolean first = true;
+            while (exiter.hasNext()) {
+                ExternalLink link = (ExternalLink) exiter.next();
+                /** Note: jUDDI adds its own discoverURL as the businessEntity* */
+                if (first) {
+                    emptyDUs = objectFactory.createDiscoveryURLs();
+                    biz.setDiscoveryURLs(emptyDUs);
+                    first = false;
+                }
+                DiscoveryURL emptyDU = objectFactory.createDiscoveryURL();
+                emptyDUs.getDiscoveryURL().add(emptyDU);
+                emptyDU.setUseType("businessEntityExt");
+				
+                if (link.getExternalURI() != null) {
+                    emptyDU.setValue(link.getExternalURI());
+                }
+            }
+			
+          IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(organization.getExternalIdentifiers());
+          if (idBag!=null) {
+              biz.setIdentifierBag(idBag);
+          }
+          CategoryBag catBag = getCategoryBagFromClassifications(organization.getClassifications());
+          if (catBag!=null) {
+              biz.setCategoryBag(catBag);
+          }
+			
+		} catch (Exception ud) {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return biz;
+    }
+
+    /**
+     *
+     * Convert JAXR User Object to UDDI  Contact
+     */
+    public static Contact getContactFromJAXRUser(User user)
+			throws JAXRException {
+		Contact ct = objectFactory.createContact();
+        if (user == null) {
+            return null;
+        }
+
+		Address[] addarr = new Address[0];
+		Phone[] phonearr = new Phone[0];
+		Email[] emailarr = new Email[0];
+		try {
+			
+			if (user.getPersonName() != null && user.getPersonName().getFullName() != null) {
+				org.uddi.api_v3.PersonName pn = new org.uddi.api_v3.PersonName();
+				pn.setValue(user.getPersonName().getFullName());
+				ct.getPersonName().add(pn);
+			}
+			
+			if (user.getType() != null) {
+            ct.setUseType(user.getType());
+			}
+			// Postal Address
+            Collection<PostalAddress> postc = user.getPostalAddresses();
+
+			addarr = new Address[postc.size()];
+
+            Iterator<PostalAddress> iterator = postc.iterator();
+			int addarrPos = 0;
+			while (iterator.hasNext()) {
+                PostalAddress post = (PostalAddress) iterator.next();
+				addarr[addarrPos] = ScoutJaxrUddiV3Helper.getAddress(post);
+				addarrPos++;
+            }
+			// Phone Numbers
+            Collection ph = user.getTelephoneNumbers(null);
+
+			phonearr = new Phone[ph.size()];
+
+            Iterator it = ph.iterator();
+			int phonearrPos = 0;
+			while (it.hasNext()) {
+                TelephoneNumber t = (TelephoneNumber) it.next();
+				Phone phone = objectFactory.createPhone();
+                String str = t.getNumber();
+                log.debug("Telephone=" + str);
+				
+				// FIXME: If phone number is null, should the phone 
+				// not be set at all, or set to empty string?
+				if (str != null) {
+					phone.setValue(str);
+				} else {
+					phone.setValue("");
+				}
+
+				phonearr[phonearrPos] = phone;
+				phonearrPos++;
+            }
+
+			// Email Addresses
+            Collection ec = user.getEmailAddresses();
+
+			emailarr = new Email[ec.size()];
+
+            Iterator iter = ec.iterator();
+			int emailarrPos = 0;
+			while (iter.hasNext()) {
+                EmailAddress ea = (EmailAddress) iter.next();
+				Email email = objectFactory.createEmail();
+				
+				if (ea.getAddress() != null) {
+					email.setValue(ea.getAddress());
+				}
+				// email.setText( ea.getAddress() );
+				
+				if (ea.getType() != null) {
+                email.setUseType(ea.getType());
+            }
+
+				emailarr[emailarrPos] = email;
+				emailarrPos++;
+			}
+			ct.getAddress().addAll(Arrays.asList(addarr));
+			ct.getPhone().addAll(Arrays.asList(phonearr));
+			ct.getEmail().addAll(Arrays.asList(emailarr));
+		} catch (Exception ud) {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return ct;
+    }
+
+	private static String getToken(String tokenstr) {
+		// Token can have the value NULL which need to be converted into null
+		if (tokenstr.equals("NULL"))
+			tokenstr = "";
+      return tokenstr;
+   }
+
+	private static String getUseType(String accessuri) {
+       String acc = accessuri.toLowerCase();
+		String uri = "other";
+		if (acc.startsWith("http:"))
+			uri = "http:";
+		else if (acc.startsWith("https:"))
+			uri = "https:";
+		else if (acc.startsWith("ftp:"))
+			uri = "ftp:";
+		else if (acc.startsWith("phone:"))
+			uri = "phone:";
+
+       return uri;
+   }
+    
+	/**
+     * According to JAXR Javadoc, there are two types of classification, internal and external and they use the Classification, Concept,     
+     * and ClassificationScheme objects.  It seems the only difference between internal and external (as related to UDDI) is that the
+     * name/value pair of the categorization is held in the Concept for internal classifications and the Classification for external (bypassing
+     * the Concept entirely).
+     * 
+     * The translation to UDDI is simple.  Relevant objects have a category bag which contains a bunch of KeyedReferences (name/value pairs).  
+     * These KeyedReferences optionally refer to a tModel that identifies the type of category (translates to the ClassificationScheme key).  If
+     * this is set and the tModel doesn't exist in the UDDI registry, then an invalid key error will occur when trying to save the object.
+     * 
+     * @param classifications classifications to turn into categories
+     * @throws JAXRException
+     */
+	public static CategoryBag getCategoryBagFromClassifications(Collection classifications) throws JAXRException {
+    	try {
+			if (classifications == null || classifications.size()==0)
+				return null;
+    		
+    		// Classifications
+			CategoryBag cbag = objectFactory.createCategoryBag();
+			Iterator classiter = classifications.iterator();
+			while (classiter.hasNext()) {
+				Classification classification = (Classification) classiter.next();
+				if (classification != null ) {
+					KeyedReference keyr = objectFactory.createKeyedReference();
+					cbag.getKeyedReference().add(keyr);
+	
+					InternationalStringImpl iname = null;
+					String value = null;
+					ClassificationScheme scheme = classification.getClassificationScheme();
+                    if (scheme==null || (classification.isExternal() && classification.getConcept()==null)) {
+                        /*
+                        * JAXR 1.0 Specification: Section D6.4.4
+                        * Specification related tModels mapped from Concept may be automatically
+                        * categorized by the well-known uddi-org:types taxonomy in UDDI (with
+                        * tModelKey uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4) as follows:
+                        * The keyed reference is assigned a taxonomy value of specification.
+                        */
+                        keyr.setTModelKey(UDDI_ORG_TYPES);
+                        keyr.setKeyValue("specification"); 
+                    } else {
+    					if (classification.isExternal()) {
+                            iname = (InternationalStringImpl) ((RegistryObject) classification).getName();
+                            value = classification.getValue();
+    					} else {
+    						Concept concept = classification.getConcept();
+    						if (concept != null) {
+    							iname = (InternationalStringImpl) ((RegistryObject) concept).getName();
+    							value = concept.getValue();
+    							scheme = concept.getClassificationScheme();
+    						}
+    					}
+    	
+    					String name = iname.getValue();
+    					if (name != null)
+    						keyr.setKeyName(name);
+    	
+    					if (value != null)
+    						keyr.setKeyValue(value);
+    					
+    					if (scheme != null) {
+    						Key key = scheme.getKey();
+    						if (key != null && key.getId() != null)
+    							keyr.setTModelKey(key.getId());
+    					}
+    				}
+                }
+			}
+			return cbag;
+    	} catch (Exception ud) {
+			throw new JAXRException("Apache JAXR Impl:", ud);
+		}
+    }
+
+	public static TModelBag getTModelBagFromSpecifications(Collection specifications) throws JAXRException {
+    	try {
+			if (specifications == null || specifications.size()==0)
+				return null;
+    		
+    		// Classifications
+			TModelBag tbag = objectFactory.createTModelBag();
+			Iterator speciter = specifications.iterator();
+			while (speciter.hasNext()) {
+				RegistryObject registryobject = (RegistryObject) speciter.next();
+				if (registryobject instanceof SpecificationLink) {
+					SpecificationLink specificationlink = (SpecificationLink) registryobject;
+					if (specificationlink.getSpecificationObject() != null) {
+						RegistryObject ro = specificationlink.getSpecificationObject();
+						if (ro.getKey() != null) {
+							Key key = ro.getKey();
+							tbag.getTModelKey().add(key.toString());
+						}
+					}
+				} else {
+					log.info("ebXML case - the RegistryObject is an ExtrinsicObject, Not implemented");
+				}
+			}
+			return tbag;
+    	} catch (Exception ud) {
+			throw new JAXRException("Apache JAXR Impl:", ud);
+		}
+    }
+
+	
+	/**
+     * Adds the objects identifiers from JAXR's external identifier collection
+     * 
+     * @param identifiers external identifiers to turn into identifiers
+     * @throws JAXRException
+     */
+	public static IdentifierBag getIdentifierBagFromExternalIdentifiers(Collection identifiers) throws JAXRException {
+    	try {
+			if (identifiers == null || identifiers.size()==0)
+				return null;
+    		
+    		// Identifiers
+			IdentifierBag ibag = objectFactory.createIdentifierBag();
+			Iterator iditer = identifiers.iterator();
+			while (iditer.hasNext()) {
+				ExternalIdentifier extid = (ExternalIdentifier) iditer.next();
+				if (extid != null ) {
+					KeyedReference keyr = objectFactory.createKeyedReference();
+					ibag.getKeyedReference().add(keyr);
+	
+					InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) extid).getName();
+					String value = extid.getValue();
+					ClassificationScheme scheme = extid.getIdentificationScheme();
+	
+					String name = iname.getValue();
+					if (name != null)
+						keyr.setKeyName(name);
+	
+					if (value != null)
+						keyr.setKeyValue(value);
+					
+					if (scheme != null) {
+						Key key = scheme.getKey();
+						if (key != null && key.getId() != null)
+							keyr.setTModelKey(key.getId());
+					}
+				}
+			}
+			return ibag;
+    	} catch (Exception ud) {
+			throw new JAXRException("Apache JAXR Impl:", ud);
+		}
+    }
+    
+    private static OverviewDoc getOverviewDocFromExternalLink(ExternalLink link)
+       throws JAXRException
+       {
+           OverviewDoc od = objectFactory.createOverviewDoc();
+           String url = link.getExternalURI();
+           if(url != null) {
+        	   org.uddi.api_v3.OverviewURL ourl = new org.uddi.api_v3.OverviewURL();
+        	   ourl.setValue(url.toString());
+        	   od.setOverviewURL(ourl);
+           }
+           InternationalString extDesc = link.getDescription();
+           if(extDesc != null) {
+               Description description = objectFactory.createDescription();
+               od.getDescription().add(description);
+               description.setValue(extDesc.getValue());
+           }
+           return od;
+       }
+
+    private static BindingTemplates getBindingTemplates(Collection serviceBindings)
+        throws JAXRException {
+        BindingTemplates bt = null;
+        if(serviceBindings != null && serviceBindings.size() > 0) {
+            bt = objectFactory.createBindingTemplates();
+            Iterator iter = serviceBindings.iterator();
+            int currLoc = 0;
+            BindingTemplate[] bindingTemplateArray = new BindingTemplate[serviceBindings.size()];
+            while(iter.hasNext()) {
+                ServiceBinding sb = (ServiceBinding)iter.next();
+                bindingTemplateArray[currLoc] = getBindingTemplateFromJAXRSB(sb);
+                currLoc++;
+            }
+            if (bindingTemplateArray != null) {
+                bt.getBindingTemplate().addAll(Arrays.asList(bindingTemplateArray));
+            }
+        }
+        return bt; 
+    }
+}

Added: webservices/scout/trunk/src/main/java/org/apache/ws/scout/util/ScoutUddiV3JaxrHelper.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/util/ScoutUddiV3JaxrHelper.java?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/util/ScoutUddiV3JaxrHelper.java (added)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/util/ScoutUddiV3JaxrHelper.java Sun Sep  6 23:21:23 2009
@@ -0,0 +1,601 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.infomodel.Association;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.EmailAddress;
+import javax.xml.registry.infomodel.ExternalIdentifier;
+import javax.xml.registry.infomodel.ExternalLink;
+import javax.xml.registry.infomodel.InternationalString;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.PostalAddress;
+import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.SpecificationLink;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
+
+import org.uddi.api_v3.*;
+import org.apache.ws.scout.registry.infomodel.AssociationImpl;
+import org.apache.ws.scout.registry.infomodel.ClassificationImpl;
+import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
+import org.apache.ws.scout.registry.infomodel.ConceptImpl;
+import org.apache.ws.scout.registry.infomodel.EmailAddressImpl;
+import org.apache.ws.scout.registry.infomodel.ExternalIdentifierImpl;
+import org.apache.ws.scout.registry.infomodel.ExternalLinkImpl;
+import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
+import org.apache.ws.scout.registry.infomodel.KeyImpl;
+import org.apache.ws.scout.registry.infomodel.OrganizationImpl;
+import org.apache.ws.scout.registry.infomodel.PersonNameImpl;
+import org.apache.ws.scout.registry.infomodel.PostalAddressImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceBindingImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceImpl;
+import org.apache.ws.scout.registry.infomodel.SpecificationLinkImpl;
+import org.apache.ws.scout.registry.infomodel.TelephoneNumberImpl;
+import org.apache.ws.scout.registry.infomodel.UserImpl;
+
+/**
+ * Helper class that does UDDI->Jaxr Mapping
+ *
+ * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
+ */
+public class ScoutUddiV3JaxrHelper
+{
+	public static Association getAssociation(Collection orgs,
+			LifeCycleManager lcm)
+	throws JAXRException
+	{
+		Association asso = new AssociationImpl(lcm);
+		Object[] arr = orgs.toArray();
+		asso.setSourceObject((RegistryObject)arr[0]);
+		asso.setTargetObject((RegistryObject)arr[1]);
+		return asso;
+	}
+
+	public static Organization getOrganization(BusinessEntity businessEntity,
+			LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		List<Name> namesList = businessEntity.getName();
+		Name n = null;
+		if (namesList.size()>0) n = namesList.get(0);
+
+		List<Description> descriptionList = businessEntity.getDescription();
+		Description desc =null;
+		if (descriptionList.size()>0) desc = descriptionList.get(0);
+
+		Organization org = new OrganizationImpl(lifeCycleManager);
+		if(n != null ) {
+			org.setName(getIString(n.getLang(), n.getValue(), lifeCycleManager));
+		}
+		if( desc != null) {
+			org.setDescription(getIString(desc.getLang(), desc.getValue(), lifeCycleManager));
+		}
+		org.setKey(lifeCycleManager.createKey(businessEntity.getBusinessKey()));
+
+		//Set Services also
+		BusinessServices services = businessEntity.getBusinessServices();
+		if(services != null)
+		{
+			List<BusinessService> bizServiceList = services.getBusinessService();
+			for (BusinessService businessService : bizServiceList) {
+				org.addService(getService(businessService, lifeCycleManager));
+			}
+		}
+
+		/*
+		 *  Users
+		 *
+		 *  we need to take the first contact and designate as the
+		 *  'primary contact'.  Currently, the OrganizationImpl
+		 *  class does that automatically as a safety in case
+		 *  user forgets to set - lets be explicit here as to not
+		 *  depend on that behavior
+		 */
+
+		Contacts contacts = businessEntity.getContacts();
+		if(contacts != null)
+		{
+			List<Contact> contactList = contacts.getContact();
+			if (contactList!=null) {
+				boolean isFirst=true;
+				for (Contact contact : contactList) {
+					User user = new UserImpl(null);
+					List<PersonName> pname = contact.getPersonName();
+					if (pname != null && pname.size() > 0) {
+						String name = pname.get(0).getValue();
+						user.setPersonName(new PersonNameImpl(name));						
+					}
+					if (isFirst) {
+						isFirst=false;
+						org.setPrimaryContact(user);
+					} else {
+						org.addUser(user);
+					}
+				}
+			}
+		}
+
+		//External Links
+		DiscoveryURLs durls = businessEntity.getDiscoveryURLs();
+		if (durls != null)
+		{
+			List<DiscoveryURL> discoveryURL_List = durls.getDiscoveryURL();
+			for (DiscoveryURL discoveryURL : discoveryURL_List) {
+				ExternalLink link = new ExternalLinkImpl(lifeCycleManager);
+				link.setExternalURI(discoveryURL.getValue());
+				org.addExternalLink(link);
+			}
+		}
+
+		org.addExternalIdentifiers(getExternalIdentifiers(businessEntity.getIdentifierBag(), lifeCycleManager));
+		org.addClassifications(getClassifications(businessEntity.getCategoryBag(), lifeCycleManager));
+
+		return org;
+	}
+
+
+	public static Organization getOrganization(BusinessDetail bizdetail,
+			LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		List<BusinessEntity> bizEntityList = bizdetail.getBusinessEntity();
+		if (bizEntityList.size() != 1) {
+			throw new JAXRException("Unexpected count of organizations in BusinessDetail: " + bizEntityList.size());
+		}
+		BusinessEntity entity = bizEntityList.get(0);
+		Name n = null;
+		if (entity.getName().size()>0) n = entity.getName().get(0);
+
+		List<Description> descriptionList = entity.getDescription();
+		Description desc =null;
+		if (descriptionList.size()>0) desc = descriptionList.get(0);
+
+		Organization org = new OrganizationImpl(lifeCycleManager);
+		if( n != null ) {
+			org.setName(getIString(n.getLang(), n.getValue(), lifeCycleManager));
+		}
+		if( desc != null ) {
+			org.setDescription(getIString(desc.getLang(), desc.getValue(), lifeCycleManager));
+		}
+		org.setKey(lifeCycleManager.createKey(entity.getBusinessKey()));
+
+		//Set Services also
+		BusinessServices services = entity.getBusinessServices();
+		if (services != null) {
+			List<BusinessService> bizServiceList = services.getBusinessService();
+			for (BusinessService businessService : bizServiceList) {
+				org.addService(getService(businessService, lifeCycleManager));
+			}
+		}
+			
+		/*
+		 *  Users
+		 *
+		 *  we need to take the first contact and designate as the
+		 *  'primary contact'.  Currently, the OrganizationImpl
+		 *  class does that automatically as a safety in case
+		 *  user forgets to set - lets be explicit here as to not
+		 *  depend on that behavior
+		 */
+		Contacts contacts = entity.getContacts();
+		if (contacts != null) {
+			List<Contact> contactList = contacts.getContact();
+			boolean isFirst=true;
+			for (Contact contact : contactList) {
+				User user = new UserImpl(null);
+				List<PersonName> pnames = (List<PersonName>) contact.getPersonName();
+				String pname = null;
+				if (pnames != null && pnames.size() > 0) {
+					PersonName personname = pnames.get(0);
+					pname = personname.getValue();
+				}
+				user.setType(contact.getUseType());
+				user.setPersonName(new PersonNameImpl(pname));
+	
+				List<Email> emailList = contact.getEmail();
+				ArrayList<EmailAddress> tempEmails = new ArrayList<EmailAddress>();
+				for (Email email : emailList) {
+					tempEmails.add(new EmailAddressImpl(email.getValue(), null));
+				}
+				user.setEmailAddresses(tempEmails);
+	
+				List<Address> addressList = contact.getAddress();
+				ArrayList<PostalAddress> tempAddresses = new ArrayList<PostalAddress>();
+				for (Address address : addressList) {
+					ArrayList<AddressLine> addressLineList = new ArrayList<AddressLine>(address.getAddressLine());
+					AddressLine[] alines = new AddressLine[addressLineList.size()];
+					addressLineList.toArray(alines);
+	
+					PostalAddress pa = getPostalAddress(alines);
+					tempAddresses.add(pa);
+				}
+				user.setPostalAddresses(tempAddresses);
+	
+				List<Phone> phoneList = contact.getPhone();
+				ArrayList<TelephoneNumber> tempPhones = new ArrayList<TelephoneNumber>();
+				for (Phone phone : phoneList) {
+					TelephoneNumberImpl tni = new TelephoneNumberImpl();
+					tni.setType(phone.getUseType());
+					tni.setNumber(phone.getValue());
+					tempPhones.add(tni);
+				}
+				user.setTelephoneNumbers(tempPhones);
+				if (isFirst) {
+					isFirst=false;
+					org.setPrimaryContact(user);
+				} else {
+					org.addUser(user);
+				}
+			}
+		}
+		//External Links
+		DiscoveryURLs durls = entity.getDiscoveryURLs();
+		if (durls != null)
+		{
+			List<DiscoveryURL> discoveryURL_List = durls.getDiscoveryURL();
+			for (DiscoveryURL discoveryURL : discoveryURL_List) {
+				ExternalLink link = new ExternalLinkImpl(lifeCycleManager);
+				link.setExternalURI(discoveryURL.getValue());
+				org.addExternalLink(link);
+			}
+		}
+
+		org.addExternalIdentifiers(getExternalIdentifiers(entity.getIdentifierBag(), lifeCycleManager));
+		org.addClassifications(getClassifications(entity.getCategoryBag(), lifeCycleManager));
+
+		return org;
+	}
+
+	private static PostalAddress getPostalAddress(AddressLine[] addressLineArr) throws JAXRException {
+		PostalAddress pa = new PostalAddressImpl();
+		HashMap<String, String> hm = new HashMap<String, String>();
+		for (AddressLine anAddressLineArr : addressLineArr) {
+			hm.put(anAddressLineArr.getKeyName(), anAddressLineArr.getKeyValue());
+		}
+
+		if (hm.containsKey("STREET_NUMBER")) {
+			pa.setStreetNumber(hm.get("STREET_NUMBER"));
+		}
+
+		if (hm.containsKey("STREET")) {
+			pa.setStreet(hm.get("STREET"));
+		}
+
+		if (hm.containsKey("CITY")) {
+			pa.setCity(hm.get("CITY"));
+		}
+
+		if (hm.containsKey("COUNTRY")) {
+			pa.setCountry(hm.get("COUNTRY"));
+		}
+
+		if (hm.containsKey("POSTALCODE")) {
+			pa.setPostalCode(hm.get("POSTALCODE"));
+		}
+
+		if (hm.containsKey("STATE")) {
+			pa.setStateOrProvince(hm.get("STATE"));
+		}
+
+		return pa;
+	}
+
+	private static InternationalString getIString(String lang, String str, LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		if (str!=null) {
+			return lifeCycleManager.createInternationalString(getLocale(lang), str);
+		} else {
+			return null;
+		}
+	}
+
+	public static InternationalString getIString(String str, LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		return lifeCycleManager.createInternationalString(str);
+	}
+
+	public static Service getService(BusinessService businessService, LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		Service serve = new ServiceImpl(lifeCycleManager);
+
+		String keystr = businessService.getServiceKey();
+
+		if (keystr != null)
+		{
+			serve.setKey(lifeCycleManager.createKey(keystr));
+		}
+
+		Name n = null;
+		if (businessService.getName().size()>0) n = businessService.getName().get(0);
+
+		if (n != null) {
+			String name = n.getValue();
+			serve.setName(lifeCycleManager.createInternationalString(getLocale(n.getLang()), name));
+		}
+
+		Description desc =null;
+		if (businessService.getDescription().size()>0) desc = businessService.getDescription().get(0);
+		if (desc != null ) {
+			serve.setDescription(lifeCycleManager.createInternationalString(getLocale(desc.getLang()), desc.getValue()));
+		}
+
+		//Populate the ServiceBindings for this Service
+		BindingTemplates bts = businessService.getBindingTemplates();
+		if (bts != null) {
+			List<BindingTemplate> bindingTemplateList = bts.getBindingTemplate();
+			for (BindingTemplate bindingTemplate : bindingTemplateList) {
+				serve.addServiceBinding(getServiceBinding(bindingTemplate, lifeCycleManager));
+			}
+		}
+		serve.addClassifications(getClassifications(businessService.getCategoryBag(), lifeCycleManager));
+
+		return serve;
+	}
+
+	public static Service getService(ServiceInfo serviceInfo, LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		Service service = new ServiceImpl(lifeCycleManager);
+
+		String keystr = serviceInfo.getServiceKey();
+
+		if (keystr != null)
+		{
+			service.setKey(lifeCycleManager.createKey(keystr));
+		}
+
+		Name n = null;
+		if (serviceInfo.getName().size()>0) n = serviceInfo.getName().get(0);
+		if (n != null) {
+			String name = n.getValue();
+			service.setName(lifeCycleManager.createInternationalString(getLocale(n.getLang()), name));
+		}
+		return service;
+	}
+
+	public static ServiceBinding getServiceBinding(BindingTemplate businessTemplate, LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		ServiceBinding serviceBinding = new ServiceBindingImpl(lifeCycleManager);
+
+		String keystr = businessTemplate.getServiceKey();
+		if (keystr != null)
+		{
+			Service svc = new ServiceImpl(lifeCycleManager);
+			svc.setKey(lifeCycleManager.createKey(keystr));
+			((ServiceBindingImpl)serviceBinding).setService(svc);
+		}
+		String bindingKey = businessTemplate.getBindingKey();
+		if(bindingKey != null) serviceBinding.setKey(new KeyImpl(bindingKey));
+
+		//Access URI
+		AccessPoint access = businessTemplate.getAccessPoint();
+		if (access != null) serviceBinding.setAccessURI(access.getValue());
+
+		//Description
+		Description desc = null;
+		if (businessTemplate.getDescription().size()>0) desc = businessTemplate.getDescription().get(0);
+		if (desc!=null) {
+			serviceBinding.setDescription(new InternationalStringImpl(desc.getValue()));
+		}
+		/**Section D.10 of JAXR 1.0 Specification */
+
+		TModelInstanceDetails details = businessTemplate.getTModelInstanceDetails();
+		if (details != null) {
+			List<TModelInstanceInfo> tmodelInstanceInfoList = details.getTModelInstanceInfo();
+	
+			for (TModelInstanceInfo info: tmodelInstanceInfoList)
+			{
+				if (info!=null && info.getInstanceDetails()!=null) {
+					InstanceDetails idetails = info.getInstanceDetails();
+					Collection<ExternalLink> elinks = getExternalLinks(idetails.getOverviewDoc(),lifeCycleManager);
+					SpecificationLink slink = new SpecificationLinkImpl(lifeCycleManager);
+					slink.addExternalLinks(elinks);
+					serviceBinding.addSpecificationLink(slink); 
+	
+					ConceptImpl c = new ConceptImpl(lifeCycleManager);
+					c.setExternalLinks(elinks);
+					c.setKey(lifeCycleManager.createKey(info.getTModelKey())); 
+					c.setName(lifeCycleManager.createInternationalString(idetails.getInstanceParms()));
+					c.setValue(idetails.getInstanceParms());
+	
+					slink.setSpecificationObject(c);
+				}
+			}
+		}
+		HostingRedirector hr = businessTemplate.getHostingRedirector();
+		if(hr != null)
+		{
+			ServiceBinding sb = lifeCycleManager.createServiceBinding();
+			sb.setKey(new KeyImpl(hr.getBindingKey()));
+			serviceBinding.setTargetBinding(sb);
+		}
+
+		return serviceBinding;
+	}
+
+	public static Concept getConcept(TModelDetail tModelDetail, LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		Concept concept = new ConceptImpl(lifeCycleManager);
+		List<TModel> tmodelList = tModelDetail.getTModel();
+		for (TModel tmodel : tmodelList) {
+			concept.setKey(lifeCycleManager.createKey(tmodel.getTModelKey()));
+			concept.setName(lifeCycleManager.createInternationalString(getLocale(tmodel.getName().getLang()),
+					tmodel.getName().getValue()));
+
+			Description desc = getDescription(tmodel);
+			if( desc != null ) {
+				concept.setDescription(lifeCycleManager.createInternationalString(getLocale(desc.getLang()), 
+						desc.getValue()));
+			}
+
+			concept.addExternalIdentifiers(getExternalIdentifiers(tmodel.getIdentifierBag(), lifeCycleManager));
+			concept.addClassifications(getClassifications(tmodel.getCategoryBag(), lifeCycleManager));
+		}
+		return concept;
+	}
+
+	public static Concept getConcept(TModel tmodel, LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		Concept concept = new ConceptImpl(lifeCycleManager);
+		concept.setKey(lifeCycleManager.createKey(tmodel.getTModelKey()));
+		concept.setName(lifeCycleManager.createInternationalString(getLocale(tmodel.getName().getLang()),
+				tmodel.getName().getValue()));
+
+		Description desc = getDescription(tmodel);
+		if (desc != null) {
+			concept.setDescription(lifeCycleManager.createInternationalString(getLocale(desc.getLang()), 
+					desc.getValue()));
+		}
+
+		concept.addExternalIdentifiers(getExternalIdentifiers(tmodel.getIdentifierBag(), lifeCycleManager));
+		concept.addClassifications(getClassifications(tmodel.getCategoryBag(), lifeCycleManager));
+
+		return concept;
+	}
+
+	public static Concept getConcept(TModelInfo tModelInfo, LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		Concept concept = new ConceptImpl(lifeCycleManager);
+		concept.setKey(lifeCycleManager.createKey(tModelInfo.getTModelKey()));
+		concept.setName(lifeCycleManager.createInternationalString(getLocale(tModelInfo.getName().getLang()), 
+				tModelInfo.getName().getValue()));
+
+		return concept;
+	}
+
+	private static Description getDescription( TModel tmodel )
+	{
+		Description desc = null;
+		if (tmodel.getDescription().size()>0) desc=tmodel.getDescription().get(0);
+		return desc;
+	}
+
+	/**
+	 * Classifications - going to assume all are external since UDDI does not use "Concepts".
+	 * @param categoryBag categories
+	 * @param lifeCycleManager lifecycleManager
+	 * @return Collection Classifications
+	 * @throws JAXRException on error
+	 */
+	public static Collection getClassifications(CategoryBag categoryBag, LifeCycleManager lifeCycleManager) 
+	throws JAXRException {
+		Collection<Classification> classifications = null;
+		if (categoryBag != null) {
+			classifications = new ArrayList<Classification>();
+			List<KeyedReference> keyedReferenceList = categoryBag.getKeyedReference();
+			for (KeyedReference keyedReference : keyedReferenceList) {
+				Classification classification = new ClassificationImpl(lifeCycleManager);
+				classification.setValue(keyedReference.getKeyValue());
+				classification.setName(new InternationalStringImpl(keyedReference.getKeyName()));
+				String tmodelKey = keyedReference.getTModelKey();
+				if (tmodelKey != null) {
+					ClassificationScheme scheme = new ClassificationSchemeImpl(lifeCycleManager);
+					scheme.setKey(new KeyImpl(tmodelKey));
+					classification.setClassificationScheme(scheme);
+				}
+				classifications.add(classification);
+			}
+		}
+		return classifications;
+	}
+
+	public static Collection<ExternalLink> getExternalLinks(List<OverviewDoc> overviewDocs, LifeCycleManager lifeCycleManager)
+	throws JAXRException
+	{
+		ArrayList<ExternalLink> alist = new ArrayList<ExternalLink>();
+		if((overviewDocs != null) && (overviewDocs.size() != 0))
+		{
+			Iterator docIter = overviewDocs.iterator();
+			while (docIter.hasNext()) {
+				OverviewDoc overviewDoc = (OverviewDoc) docIter.next();
+				String descStr = "";
+				Description desc = null;
+				if (overviewDoc.getDescription().size()>0) desc = overviewDoc.getDescription().get(0);
+				if (desc !=null) descStr = desc.getValue();
+				alist.add(lifeCycleManager.createExternalLink(overviewDoc.getOverviewURL().toString(),descStr));
+
+			}
+		}
+		return alist;
+	}
+
+	/**
+	 * External Identifiers
+	 * @param identifierBag identifiers
+	 * @param lifeCycleManager lifecycleManager
+	 * @return Collection ExternalIdentifier
+	 * @throws JAXRException on error
+	 */
+
+	public static Collection getExternalIdentifiers(IdentifierBag identifierBag, LifeCycleManager lifeCycleManager) 
+	throws JAXRException {
+		Collection<ExternalIdentifier> extidentifiers = null;
+		if (identifierBag != null) {
+			extidentifiers = new ArrayList<ExternalIdentifier>();
+
+			List<KeyedReference> keyedReferenceList = identifierBag.getKeyedReference();
+			for (KeyedReference keyedReference : keyedReferenceList) {
+				ExternalIdentifier extId = new ExternalIdentifierImpl(lifeCycleManager);
+				extId.setValue(keyedReference.getKeyValue());
+				extId.setName(new InternationalStringImpl(keyedReference.getKeyName()));
+
+				String tmodelKey = keyedReference.getTModelKey();
+				if (tmodelKey != null) {
+					ClassificationScheme scheme = new ClassificationSchemeImpl(lifeCycleManager);
+					scheme.setKey(new KeyImpl(tmodelKey));
+					extId.setIdentificationScheme(scheme);
+				}
+				extidentifiers.add(extId);
+			}
+		}
+		return extidentifiers;
+	}
+
+	private static Locale getLocale(String lang) {
+		if (lang == null || lang.trim().length() == 0) {
+			return Locale.getDefault();
+		} else if (lang.equalsIgnoreCase(Locale.getDefault().getLanguage())) {
+			return Locale.getDefault();
+		} else {
+			return new Locale(lang);
+		} 
+	}
+
+}
\ No newline at end of file

Modified: webservices/scout/trunk/src/test/java/org/apache/ws/scout/BaseTestCase.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/java/org/apache/ws/scout/BaseTestCase.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/test/java/org/apache/ws/scout/BaseTestCase.java (original)
+++ webservices/scout/trunk/src/test/java/org/apache/ws/scout/BaseTestCase.java Sun Sep  6 23:21:23 2009
@@ -27,6 +27,7 @@
 import javax.xml.registry.ConnectionFactory;
 import javax.xml.registry.JAXRException;
 
+import org.apache.ws.scout.registry.RegistryImpl;
 /**
  * Test to check Jaxr Publish
  * Open source UDDI Browser  <http://www.uddibrowser.org>
@@ -43,6 +44,8 @@
     protected BusinessQueryManager bqm;
 
     //Set some default values
+	protected String uddiversion = RegistryImpl.DEFAULT_UDDI_VERSION;
+    protected String uddinamespace = RegistryImpl.DEFAULT_UDDI_NAMESPACE;
     protected String userid = System.getProperty("uddi.test.uid")  == null ? "jdoe"     : System.getProperty("uddi.test.uid");
     protected String passwd = System.getProperty("uddi.test.pass") == null ? "password" : System.getProperty("uddi.test.pass");
     
@@ -68,6 +71,7 @@
             
             final String INQUERY_URI      = scoutProperties.getProperty("inquery.uri");
             final String PUBLISH_URI      = scoutProperties.getProperty("publish.uri");
+            final String SECURITY_URI    = scoutProperties.getProperty("security.uri");
             final String TRANSPORT_CLASS  = scoutProperties.getProperty("transport.class");
              
             if (scoutProperties.getProperty("userid")!=null) {
@@ -84,6 +88,14 @@
                 passwd = scoutProperties.getProperty("password2");
             }
             
+            if (scoutProperties.getProperty("scout.proxy.uddiVersion") != null)
+            {
+            	uddiversion = scoutProperties.getProperty("scout.proxy.uddiVersion");
+            }
+            if (scoutProperties.getProperty("scout.proxy.uddiNamespace") != null) {
+            	uddinamespace = scoutProperties.getProperty("scout.proxy.uddiNamespace");
+            }            
+            
             // Define connection configuration properties
             // To query, you need only the query URL
             Properties props = new Properties();
@@ -96,12 +108,20 @@
             				System.getProperty("javax.xml.registry.lifeCycleManagerURL") == null ? 
             				PUBLISH_URI :
             				System.getProperty("javax.xml.registry.lifeCycleManagerURL"));
+            if ("3.0".equals(uddiversion)) {
+            	props.setProperty("javax.xml.registry.securityManagerURL",
+    				System.getProperty("javax.xml.registry.securityManagerURL") == null ? 
+    				SECURITY_URI :
+    				System.getProperty("javax.xml.registry.securityManagerURL"));
+            }
             props.setProperty("javax.xml.registry.factoryFactoryClass",
                     "org.apache.ws.scout.? it isregistry.ConnectionFactoryImpl");
             props.setProperty("scout.proxy.transportClass", TRANSPORT_CLASS);
             props.setProperty("javax.xml.registry.uddi.maxRows", String.valueOf(maxRows));
        
-       
+            props.setProperty("scout.proxy.uddiVersion", uddiversion);
+            props.setProperty("scout.proxy.uddiNamespace", uddinamespace);
+
             // Create the connection, passing it the configuration properties
             ConnectionFactory factory = ConnectionFactory.newInstance();
             factory.setProperties(props);

Modified: webservices/scout/trunk/src/test/java/org/apache/ws/scout/Finder.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/java/org/apache/ws/scout/Finder.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/test/java/org/apache/ws/scout/Finder.java (original)
+++ webservices/scout/trunk/src/test/java/org/apache/ws/scout/Finder.java Sun Sep  6 23:21:23 2009
@@ -31,6 +31,7 @@
 import javax.xml.registry.infomodel.Key;
 import javax.xml.registry.infomodel.Service;
 import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.SpecificationLink;
 
 /**
  * Find RegistryObjects
@@ -41,10 +42,18 @@
 public class Finder
 {
     private BusinessQueryManager bqm;
+    private String uddiVersion;
     
     public Finder(BusinessQueryManager bqm) {
         super();
         this.bqm = bqm;
+        this.uddiVersion = "2.0";
+    }
+    
+    public Finder(BusinessQueryManager bqm, String version) {
+    	super();
+    	this.bqm = bqm;
+    	this.uddiVersion = version;
     }
 
     public Collection findOrganizationsByName(String queryStr) throws JAXRException {
@@ -52,8 +61,11 @@
     	Collection<String> findQualifiers = new ArrayList<String>();
     	findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
     	Collection<String> namePatterns = new ArrayList<String>();
-    	namePatterns.add("%" + queryStr + "%");
-    	
+    	if ("3.0".equals(uddiVersion)) {
+    		namePatterns.add(queryStr);
+    	} else {
+    		namePatterns.add("%" + queryStr + "%");
+    	}
     	// Find based upon qualifier type and values
     	System.out.println("\n-- searching the registry --\n");
         BulkResponse response =
@@ -72,8 +84,11 @@
         Collection<String> findQualifiers = new ArrayList<String>();
         findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
         Collection<String> namePatterns = new ArrayList<String>();
-        namePatterns.add("%" + queryStr + "%");
-        
+        if ("3.0".equals(uddiVersion)) {
+        	namePatterns.add(queryStr);
+        } else {
+        	namePatterns.add("%" + queryStr + "%");
+        }
         // Find based upon qualifier type and values
         System.out.println("\n-- searching the registry --\n");
         BulkResponse response =
@@ -90,7 +105,7 @@
         Collection<String> findQualifiers = new ArrayList<String>();
         findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
         Collection<String> namePatterns = new ArrayList<String>();
-        namePatterns.add("%" + queryStr + "%");
+        namePatterns.add(queryStr);
         
         // Find based upon qualifier type and values
         System.out.println("\n-- searching the registry --\n");
@@ -99,6 +114,9 @@
                     namePatterns,
                     null,
                     null);
+        if ((response == null) || (response.getCollection() == null) || (response.getCollection().size() ==0) ) {
+        	return null;
+        }
         
         return (ClassificationScheme) response.getCollection().iterator().next();
     }
@@ -160,4 +178,35 @@
         return serviceBindings;
     }
 
+    @SuppressWarnings("unchecked")
+    public Collection<ServiceBinding> findServiceBindings(Key serviceKey, Classification classification) throws JAXRException
+    {
+        Collection<ServiceBinding> serviceBindings=null;
+        Collection<String> findQualifiers = new ArrayList<String>();
+        findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
+        Collection<Classification> classifications = new ArrayList<Classification>();
+        classifications.add(classification);
+        BulkResponse bulkResponse = bqm.findServiceBindings(serviceKey,findQualifiers,classifications,null);
+        if (bulkResponse.getStatus()==JAXRResponse.STATUS_SUCCESS){
+            serviceBindings = (Collection<ServiceBinding>) bulkResponse.getCollection();
+        }
+        return serviceBindings;
+    }
+
+    
+    
+    @SuppressWarnings("unchecked")
+    public Collection<ServiceBinding> findServiceBindings(Key serviceKey, SpecificationLink specLink) throws JAXRException
+    {
+        Collection<ServiceBinding> serviceBindings=null;
+        Collection<String> findQualifiers = new ArrayList<String>();
+        findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
+        Collection<SpecificationLink> specifications = new ArrayList<SpecificationLink>();
+        specifications.add(specLink);
+        BulkResponse bulkResponse = bqm.findServiceBindings(serviceKey,findQualifiers,null,specifications);
+        if (bulkResponse.getStatus()==JAXRResponse.STATUS_SUCCESS){
+            serviceBindings = (Collection<ServiceBinding>) bulkResponse.getCollection();
+        }
+        return serviceBindings;
+    }
 }

Modified: webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java (original)
+++ webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java Sun Sep  6 23:21:23 2009
@@ -28,6 +28,7 @@
 import org.junit.Before;
 import org.junit.Test;
 
+
 /**
  *  Tests the BusinessLifecycleManagerImpl class
  */

Modified: webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java (original)
+++ webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java Sun Sep  6 23:21:23 2009
@@ -13,7 +13,7 @@
 
     public void testFindClassificationSchemeByName() throws JAXRException {
 
-        BusinessQueryManager blm = new BusinessQueryManagerImpl(new RegistryServiceImpl(null, null, -1));
+        BusinessQueryManager blm = new BusinessQueryManagerV3Impl(new RegistryServiceImpl(null, null, -1, "3.0"));
 
         ClassificationScheme scheme = blm.findClassificationSchemeByName(null, "AssociationType");
         assertNotNull(scheme);

Modified: webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/LifeCycleManagerTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/LifeCycleManagerTest.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/LifeCycleManagerTest.java (original)
+++ webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/LifeCycleManagerTest.java Sun Sep  6 23:21:23 2009
@@ -260,6 +260,6 @@
     }
     protected void setUp() throws Exception {
         super.setUp();
-        manager = new ConcreteLifeCycleManager(new RegistryServiceImpl(null, null, -1));
+        manager = new ConcreteLifeCycleManager(new RegistryServiceImpl(null, null, -1, "3.0"));
     }
 }

Modified: webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java (original)
+++ webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java Sun Sep  6 23:21:23 2009
@@ -37,7 +37,7 @@
 
     @Before
     public void setUp() throws Exception {
-        registry = new RegistryServiceImpl(null, null, -1);
+        registry = new RegistryServiceImpl(null, null, -1, "3.0");
     }
     
     @Test

Modified: webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java (original)
+++ webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java Sun Sep  6 23:21:23 2009
@@ -230,9 +230,13 @@
 		Collection<String> findQualifiers = new ArrayList<String>();
 		findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
 		Collection<String> namePatterns = new ArrayList<String>();
-		namePatterns.add("%" + tempSrcOrgName + "%");
-		namePatterns.add("%" + tempTgtOrgName + "%");
-
+		if ("3.0".equals(uddiversion)) {
+			namePatterns.add(tempSrcOrgName);
+			namePatterns.add(tempTgtOrgName);
+		} else {
+			namePatterns.add("%" + tempSrcOrgName + "%");
+			namePatterns.add("%" + tempTgtOrgName + "%");
+		}
 		// Find based upon qualifier type and values
 		System.out.println("\n-- searching the registry --\n");
 		BulkResponse response = bqm.findOrganizations(findQualifiers,

Modified: webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java (original)
+++ webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java Sun Sep  6 23:21:23 2009
@@ -106,9 +106,19 @@
             
             System.out.println("\nCreating service binding...\n");
             Key sbKey = createServiceBinding(tmpSvc);
+                       
+            
+            SpecificationLink specLink = blm.createSpecificationLink();            
+            Concept concept = null;
+            if ("3.0".equals(uddiversion)) {
+            	concept = (Concept)bqm.getRegistryObject("uddi:uddi.org:findqualifier:orlikekeys", BusinessLifeCycleManager.CONCEPT);
+            } else {
+            	concept = (Concept)bqm.getRegistryObject("uuid:AD61DE98-4DB8-31B2-A299-A2373DC97212",BusinessLifeCycleManager.CONCEPT);
+            }
+            specLink.setSpecificationObject(concept);
             
             //find serviceBinding
-            Collection<ServiceBinding> serviceBindings2 = finder.findServiceBindings(tmpSvcKey );
+            Collection<ServiceBinding> serviceBindings2 = finder.findServiceBindings(tmpSvcKey, specLink);
             @SuppressWarnings("unused")
 			ServiceBinding serviceBinding2 = serviceBindings2.iterator().next();
             
@@ -141,11 +151,16 @@
         
         RegistryService rs = connection.getRegistryService();
         bqm = rs.getBusinessQueryManager();
-        Concept concept = (Concept)bqm.getRegistryObject("uuid:AD61DE98-4DB8-31B2-A299-A2373DC97212",BusinessLifeCycleManager.CONCEPT);
+        Concept concept = null;
+        if ("3.0".equals(uddiversion)) {        
+        	concept = (Concept)bqm.getRegistryObject("uddi:uddi.org:findqualifier:orlikekeys", BusinessLifeCycleManager.CONCEPT);
+        } else {
+        	concept = (Concept)bqm.getRegistryObject("uuid:AD61DE98-4DB8-31B2-A299-A2373DC97212",BusinessLifeCycleManager.CONCEPT);
+        }
+        
         specLink.setSpecificationObject(concept);
         
         serviceBinding.addSpecificationLink(specLink);
-        
         ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
         serviceBindings.add(serviceBinding);
 

Modified: webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR060RegistryTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR060RegistryTest.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR060RegistryTest.java (original)
+++ webservices/scout/trunk/src/test/java/org/apache/ws/scout/registry/qa/JAXR060RegistryTest.java Sun Sep  6 23:21:23 2009
@@ -125,7 +125,7 @@
         {
             RegistryService rs = connection.getRegistryService();
             bqm = rs.getBusinessQueryManager();
-            Finder finder = new Finder(bqm);
+            Finder finder = new Finder(bqm, uddiversion);
 			Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
 			Organization org = orgs.iterator().next();
 			assertEquals("Red Hat/JBossESB", org.getName().getValue());
@@ -135,7 +135,7 @@
 		try {
             RegistryService rs = connection.getRegistryService();
             bqm = rs.getBusinessQueryManager();
-            Finder finder = new Finder(bqm);
+            Finder finder = new Finder(bqm, uddiversion);
             Collection<Organization> orgs = finder.findOrganizationsByName("Not Existing Org");
 			assertEquals(0, orgs.size());
 		} catch (JAXRException je) {
@@ -145,7 +145,7 @@
 		try {
             RegistryService rs = connection.getRegistryService();
             bqm = rs.getBusinessQueryManager();
-            Finder finder = new Finder(bqm);
+            Finder finder = new Finder(bqm, uddiversion);
             Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
             Organization organization = orgs.iterator().next();
             
@@ -173,7 +173,7 @@
             RegistryService rs = connection.getRegistryService();
             bqm = rs.getBusinessQueryManager();
             blm = rs.getBusinessLifeCycleManager();
-            Finder finder = new Finder(bqm);
+            Finder finder = new Finder(bqm, uddiversion);
             //Find the service
             Service service = finder.findService("registry","Registry Test ServiceName", blm);
             assertEquals("Registry Test ServiceName", service.getName().getValue());
@@ -185,7 +185,7 @@
             RegistryService rs = connection.getRegistryService();
             bqm = rs.getBusinessQueryManager();
             blm = rs.getBusinessLifeCycleManager();
-            Finder finder = new Finder(bqm);
+            Finder finder = new Finder(bqm, uddiversion);
             //Find the service
             Service service = finder.findService("registry","Registry Test ServiceName", blm);
             
@@ -210,7 +210,7 @@
             assertEquals(BulkResponse.STATUS_SUCCESS, br2.getStatus());
            
             //Delete one binding            
-            Collection<ServiceBinding> serviceBindings2 = finder.findServiceBindings(service.getKey());
+            Collection<ServiceBinding> serviceBindings2 = finder.findServiceBindings(service.getKey(),classification);
             if ((serviceBindings2 != null) && (serviceBindings2.iterator() != null) 
             		&& (serviceBindings2.iterator().hasNext())) {
             	ServiceBinding serviceBinding2 = serviceBindings2.iterator().next();
@@ -225,7 +225,7 @@
         {
             RegistryService rs = connection.getRegistryService();
             bqm = rs.getBusinessQueryManager();
-            Finder finder = new Finder(bqm);
+            Finder finder = new Finder(bqm, uddiversion);
 			Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
             Organization org = orgs.iterator().next();
 			//Listing out the services and their Bindings
@@ -259,7 +259,7 @@
             RegistryService rs = connection.getRegistryService();
             bqm = rs.getBusinessQueryManager();
             blm = rs.getBusinessLifeCycleManager();
-            Finder finder = new Finder(bqm);
+            Finder finder = new Finder(bqm, uddiversion);
             //Find the service
             Service service = finder.findService("registry","Registry Test ServiceName", blm);
             Remover remover = new Remover(blm);
@@ -273,7 +273,7 @@
             RegistryService rs = connection.getRegistryService();
             bqm = rs.getBusinessQueryManager();
             blm = rs.getBusinessLifeCycleManager();
-            Finder finder = new Finder(bqm);
+            Finder finder = new Finder(bqm, uddiversion);
             Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
             Organization org = orgs.iterator().next();
             Remover remover = new Remover(blm);

Added: webservices/scout/trunk/src/test/resources/scoutv3.properties-example
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/test/resources/scoutv3.properties-example?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/test/resources/scoutv3.properties-example (added)
+++ webservices/scout/trunk/src/test/resources/scoutv3.properties-example Sun Sep  6 23:21:23 2009
@@ -0,0 +1,36 @@
+########################################################################################################
+# TRANSPORT
+########################################################################################################
+#local transport
+#inquery.uri     =org.apache.juddi.registry.local.InquiryService#inquire
+#publish.uri     =org.apache.juddi.registry.local.PublishService#publish
+#transport.class =org.apache.ws.scout.transport.LocalTransport
+#rmi transport        
+#inquery.uri     =jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire
+#publish.uri     =jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish
+#transport.class =org.apache.ws.scout.transport.RMITransport
+#axis transport
+inquery.uri     =http://localhost:8080/juddi/services/inquiry
+publish.uri     =http://localhost:8080/juddi/services/publish
+security.uri	=http://localhost:8080/juddi/services/security
+transport.class =org.apache.ws.scout.transport.AxisTransport
+scout.proxy.uddiVersion=3.0
+scout.proxy.uddiNamespace=urn:uddi-org:api_v3
+#axis2 transport
+#inquery.uri     =http://localhost:8080/juddi/inquiry
+#publish.uri     =http://localhost:8080/juddi/publish
+#transport.class =org.apache.ws.scout.transport.Axis2Transport
+#soap transport
+#inquery.uri     =http://kstam.int.atl.jboss.com:9901/uddi/inquiry_v2
+#publish.uri     =http://kstam.int.atl.jboss.com:9901/uddi/publish_v2
+#transport.class =org.apache.ws.scout.transport.AxisTransport
+#userid          =Administrator
+#password        =password
+#
+########################################################################################################
+# SECURITY
+########################################################################################################
+userid          =root
+password        =root
+
+javax.xml.registry.uddi.maxRows=10



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