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 [2/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/registry/BusinessQueryManagerV3Impl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessQueryManagerV3Impl.java?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessQueryManagerV3Impl.java (added)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessQueryManagerV3Impl.java Sun Sep  6 23:21:23 2009
@@ -0,0 +1,989 @@
+/**
+ *
+ * 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.registry;
+
+import java.net.PasswordAuthentication;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessLifeCycleManager;
+import javax.xml.registry.BusinessQueryManager;
+import javax.xml.registry.InvalidRequestException;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.UnsupportedCapabilityException;
+import javax.xml.registry.infomodel.Association;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.LocalizedString;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.uddi.api_v3.*;
+import org.apache.ws.scout.registry.infomodel.AssociationImpl;
+import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
+import org.apache.ws.scout.registry.infomodel.ConceptImpl;
+import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
+import org.apache.ws.scout.registry.infomodel.KeyImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceBindingImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceImpl;
+import org.apache.ws.scout.util.EnumerationHelper;
+import org.apache.ws.scout.util.ScoutJaxrUddiV3Helper;
+import org.apache.ws.scout.util.ScoutUddiV3JaxrHelper;
+
+/**
+ * Implements the JAXR BusinessQueryManager Interface
+ * For futher details, look into the JAXR API Javadoc.
+ *
+ * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
+ * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
+ * @author <a href="mailto:jboynes@apache.org">Jeremy Boynes</a>
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ */
+public class BusinessQueryManagerV3Impl implements BusinessQueryManager
+{
+    private final RegistryServiceImpl registryService;
+    private Log log = LogFactory.getLog(this.getClass());
+
+    private static ObjectFactory objectFactory = new ObjectFactory();
+
+    public BusinessQueryManagerV3Impl(RegistryServiceImpl registry)
+    {
+        this.registryService = registry;
+    }
+
+    public RegistryService getRegistryService()
+    {
+        return registryService;
+    }
+
+    /**
+     * Finds organizations in the registry that match the specified parameters
+     *
+     * @param findQualifiers
+     * @param namePatterns
+     * @param classifications
+     * @param specifications
+     * @param externalIdentifiers
+     * @param externalLinks
+     * @return BulkResponse
+     * @throws JAXRException
+     */
+    public BulkResponse findOrganizations(Collection findQualifiers,
+                                          Collection namePatterns,
+                                          Collection classifications,
+                                          Collection specifications,
+                                          Collection externalIdentifiers,
+                                          Collection externalLinks) throws JAXRException
+    {
+        IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
+        try
+        {
+            FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
+            Name[] nameArray = mapNamePatterns(namePatterns);
+            BusinessList result = registry.findBusiness(nameArray,
+                    null, 
+                    ScoutJaxrUddiV3Helper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers), 
+                    ScoutJaxrUddiV3Helper.getCategoryBagFromClassifications(classifications), 
+                    ScoutJaxrUddiV3Helper.getTModelBagFromSpecifications(specifications),
+                    juddiFindQualifiers,
+                    registryService.getMaxRows());
+            
+            BusinessInfo[] bizInfoArr =null;
+            BusinessInfos bizInfos = result.getBusinessInfos();
+            LinkedHashSet<Organization> orgs = new LinkedHashSet<Organization>();
+            if(bizInfos != null)
+            {
+            	List<BusinessInfo> bizInfoList = bizInfos.getBusinessInfo();
+            	for (BusinessInfo businessInfo : bizInfoList) {
+                    //Now get the details on the individual biz
+                    BusinessDetail detail = registry.getBusinessDetail(businessInfo.getBusinessKey());
+                    BusinessLifeCycleManagerV3Impl blcm = (BusinessLifeCycleManagerV3Impl)registryService.getLifeCycleManagerImpl();
+                    orgs.add(blcm.createOrganization(detail));
+				}
+            	bizInfoArr = new BusinessInfo[bizInfoList.size()];
+            	bizInfoList.toArray(bizInfoArr);
+            }
+            return new BulkResponseImpl(orgs);
+        } catch (RegistryV3Exception e)
+        {
+            throw new JAXRException(e);
+        }
+    }
+
+    public BulkResponse findAssociations(Collection findQualifiers,
+                                         String sourceObjectId,
+                                         String targetObjectId,
+                                         Collection associationTypes) throws JAXRException
+    {
+        //TODO: Currently we just return all the Association objects owned by the caller
+        IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
+        try
+        {
+            ConnectionImpl con = ((RegistryServiceImpl)getRegistryService()).getConnection();
+            AuthToken auth = this.getAuthToken(con,registry);
+            PublisherAssertions result =
+                    registry.getPublisherAssertions(auth.getAuthInfo());
+            List<PublisherAssertion> publisherAssertionList = result.getPublisherAssertion();
+            LinkedHashSet<Association> col = new LinkedHashSet<Association>();
+            for (PublisherAssertion pas : publisherAssertionList) {
+                String sourceKey = pas.getFromKey();
+                String targetKey = pas.getToKey();
+                Collection<Key> orgcol = new ArrayList<Key>();
+                orgcol.add(new KeyImpl(sourceKey));
+                orgcol.add(new KeyImpl(targetKey));
+                BulkResponse bl = getRegistryObjects(orgcol, LifeCycleManager.ORGANIZATION);
+                Association asso = ScoutUddiV3JaxrHelper.getAssociation(bl.getCollection(),
+                                             registryService.getBusinessLifeCycleManager());
+                KeyedReference keyr = pas.getKeyedReference();
+                Concept c = new ConceptImpl(getRegistryService().getBusinessLifeCycleManager());
+                c.setName(new InternationalStringImpl(keyr.getKeyName()));
+                c.setKey( new KeyImpl(keyr.getTModelKey()) );
+                c.setValue(keyr.getKeyValue());
+                asso.setAssociationType(c);
+                col.add(asso);
+            }
+            return new BulkResponseImpl(col);
+        } catch (RegistryV3Exception e)
+        {
+            throw new JAXRException(e);
+        }
+    }
+
+    public BulkResponse findCallerAssociations(Collection findQualifiers,
+                                               Boolean confirmedByCaller,
+                                               Boolean confirmedByOtherParty,
+                                               Collection associationTypes) throws JAXRException
+    {
+        //TODO: Currently we just return all the Association objects owned by the caller
+        IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
+        try
+        {
+            ConnectionImpl con = ((RegistryServiceImpl)getRegistryService()).getConnection();
+            AuthToken auth = this.getAuthToken(con,registry);
+           
+            AssertionStatusReport report = null;
+            String confirm = "";
+            boolean caller = confirmedByCaller.booleanValue();
+            boolean other = confirmedByOtherParty.booleanValue();
+
+            if(caller  && other   )
+                        confirm = Constants.COMPLETION_STATUS_COMPLETE;
+            else
+              if(!caller  && other  )
+                        confirm = Constants.COMPLETION_STATUS_FROMKEY_INCOMPLETE;
+            else
+                 if(caller  && !other   )
+                        confirm = Constants.COMPLETION_STATUS_TOKEY_INCOMPLETE;
+
+            report = registry.getAssertionStatusReport(auth.getAuthInfo(),confirm);
+            
+            
+            List<AssertionStatusItem> assertionStatusItemList = report.getAssertionStatusItem();
+            LinkedHashSet<Association> col = new LinkedHashSet<Association>();
+            for (AssertionStatusItem asi : assertionStatusItemList) {
+                String sourceKey = asi.getFromKey();
+                String targetKey = asi.getToKey();
+                Collection<Key> orgcol = new ArrayList<Key>();
+                orgcol.add(new KeyImpl(sourceKey));
+                orgcol.add(new KeyImpl(targetKey));
+                BulkResponse bl = getRegistryObjects(orgcol, LifeCycleManager.ORGANIZATION);
+                Association asso = ScoutUddiV3JaxrHelper.getAssociation(bl.getCollection(),
+                                             registryService.getBusinessLifeCycleManager());
+                //Set Confirmation
+                ((AssociationImpl)asso).setConfirmedBySourceOwner(caller);
+                ((AssociationImpl)asso).setConfirmedByTargetOwner(other);
+
+                if(confirm != Constants.COMPLETION_STATUS_COMPLETE)
+                     ((AssociationImpl)asso).setConfirmed(false);
+
+                Concept c = new ConceptImpl(getRegistryService().getBusinessLifeCycleManager());
+                KeyedReference keyr = asi.getKeyedReference();
+                c.setKey(new KeyImpl(keyr.getTModelKey()));
+                c.setName(new InternationalStringImpl(keyr.getKeyName()));
+                c.setValue(keyr.getKeyValue());
+                asso.setKey(new KeyImpl(keyr.getTModelKey())); //TODO:Validate this
+                asso.setAssociationType(c);
+                col.add(asso);
+            }
+
+
+            return new BulkResponseImpl(col);
+        } catch (RegistryV3Exception e)
+        {
+            throw new JAXRException(e);
+        }
+    }
+
+    /**
+     *  TODO - need to support the qualifiers
+     *
+     * @param findQualifiers
+     * @param namePatterns
+     * @return ClassificationScheme
+     * @throws JAXRException
+     */
+    public ClassificationScheme findClassificationSchemeByName(Collection findQualifiers,
+                                                               String namePatterns) throws JAXRException
+    {
+        ClassificationScheme scheme = null;
+
+        if (namePatterns.indexOf("uddi-org:types") != -1) {
+
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setName(new InternationalStringImpl(namePatterns));
+            scheme.setKey(new KeyImpl(Constants.TMODEL_TYPES_TMODEL_KEY));
+        }
+        else if (namePatterns.indexOf("dnb-com:D-U-N-S") != -1) {
+
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setName(new InternationalStringImpl(namePatterns));
+            scheme.setKey(new KeyImpl(Constants.TMODEL_D_U_N_S_TMODEL_KEY));
+        }
+        else if (namePatterns.indexOf("uddi-org:iso-ch:3166:1999") != -1)
+        {
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setName(new InternationalStringImpl(namePatterns));
+            scheme.setKey(new KeyImpl(Constants.TMODEL_ISO_CH_TMODEL_KEY));
+        }
+        else if (namePatterns.indexOf("uddi-org:iso-ch:3166-1999") != -1)
+        {
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setName(new InternationalStringImpl(namePatterns));
+            scheme.setKey(new KeyImpl(Constants.TMODEL_ISO_CH_TMODEL_KEY));
+        }
+        else if (namePatterns.indexOf("iso-ch:3166:1999") != -1)
+        {
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setName(new InternationalStringImpl(namePatterns));
+            scheme.setKey(new KeyImpl(Constants.TMODEL_ISO_CH_TMODEL_KEY));
+        }
+        else if (namePatterns.indexOf("iso-ch:3166-1999") != -1)
+        {
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setName(new InternationalStringImpl(namePatterns));
+            scheme.setKey(new KeyImpl(Constants.TMODEL_ISO_CH_TMODEL_KEY));
+        }
+        else if (namePatterns.indexOf("unspsc-org:unspsc") != -1) {
+
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setName(new InternationalStringImpl(namePatterns));
+            scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY));
+        }
+        else if (namePatterns.indexOf("ntis-gov:naics") != -1) {
+
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setName(new InternationalStringImpl(namePatterns));
+            scheme.setKey(new KeyImpl(Constants.TMODEL_NAICS_TMODEL_KEY));
+        }
+        else
+        {   //TODO:Before going to the registry, check if it a predefined Enumeration
+
+            /*
+             * predefined Enumerations
+             */
+
+            if ("AssociationType".equals(namePatterns)) {
+                scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+
+                scheme.setName(new InternationalStringImpl(namePatterns));
+
+                scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY));
+
+                addChildConcept((ClassificationSchemeImpl)scheme, "RelatedTo");
+                addChildConcept((ClassificationSchemeImpl)scheme, "HasChild");
+                addChildConcept((ClassificationSchemeImpl)scheme, "HasMember");
+                addChildConcept((ClassificationSchemeImpl)scheme, "HasParent");
+                addChildConcept((ClassificationSchemeImpl)scheme, "ExternallyLinks");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Contains");
+                addChildConcept((ClassificationSchemeImpl)scheme, "EquivalentTo");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Extends");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Implements");
+                addChildConcept((ClassificationSchemeImpl)scheme, "InstanceOf");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Supersedes");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Uses");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Replaces");
+                addChildConcept((ClassificationSchemeImpl)scheme, "ResponsibleFor");
+                addChildConcept((ClassificationSchemeImpl)scheme, "SubmitterOf");
+            }
+            else if ("ObjectType".equals(namePatterns)) {
+                scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+
+                scheme.setName(new InternationalStringImpl(namePatterns));
+
+                scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY));
+
+                addChildConcept((ClassificationSchemeImpl)scheme, "CPP");
+                addChildConcept((ClassificationSchemeImpl)scheme, "CPA");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Process");
+                addChildConcept((ClassificationSchemeImpl)scheme, "WSDL");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Association");
+                addChildConcept((ClassificationSchemeImpl)scheme, "AuditableEvent");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Classification");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Concept");
+                addChildConcept((ClassificationSchemeImpl)scheme, "ExternalIdentifier");
+                addChildConcept((ClassificationSchemeImpl)scheme, "ExternalLink");
+                addChildConcept((ClassificationSchemeImpl)scheme, "ExtrinsicObject");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Organization");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Package");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Service");
+                addChildConcept((ClassificationSchemeImpl)scheme, "ServiceBinding");
+                addChildConcept((ClassificationSchemeImpl)scheme, "User");
+            }
+            else if ("PhoneType".equals(namePatterns)) {
+                scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+
+                scheme.setName(new InternationalStringImpl(namePatterns));
+
+                scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY));
+
+                addChildConcept((ClassificationSchemeImpl)scheme, "OfficePhone");
+                addChildConcept((ClassificationSchemeImpl)scheme, "HomePhone");
+                addChildConcept((ClassificationSchemeImpl)scheme, "MobilePhone");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Beeper");
+                addChildConcept((ClassificationSchemeImpl)scheme, "FAX");
+            }
+            else if ("URLType".equals(namePatterns)) {
+                scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+
+                scheme.setName(new InternationalStringImpl(namePatterns));
+
+                scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY));
+
+                addChildConcept((ClassificationSchemeImpl)scheme, "HTTP");
+                addChildConcept((ClassificationSchemeImpl)scheme, "HTTPS");
+                addChildConcept((ClassificationSchemeImpl)scheme, "SMTP");
+                addChildConcept((ClassificationSchemeImpl)scheme, "PHONE");
+                addChildConcept((ClassificationSchemeImpl)scheme, "FAX");
+                addChildConcept((ClassificationSchemeImpl)scheme, "OTHER");
+            }
+            else if ("PostalAddressAttributes".equals(namePatterns)) {
+                scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+
+                scheme.setName(new InternationalStringImpl(namePatterns));
+
+                scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY));
+
+                addChildConcept((ClassificationSchemeImpl)scheme, "StreetNumber");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Street");
+                addChildConcept((ClassificationSchemeImpl)scheme, "City");
+                addChildConcept((ClassificationSchemeImpl)scheme, "State");
+                addChildConcept((ClassificationSchemeImpl)scheme, "PostalCode");
+                addChildConcept((ClassificationSchemeImpl)scheme, "Country");
+            }
+            else {
+
+                //Lets ask the uddi registry if it has the TModels
+                IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
+                FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
+                try
+                {
+                    //We are looking for one exact match, so getting upto 3 records is fine
+                    TModelList list = registry.findTModel(namePatterns, null, null, juddiFindQualifiers, 3);
+                    if (list != null) {
+                        TModelInfos infos = list.getTModelInfos();
+                        if (infos != null) {
+                            List<TModelInfo> tmodelInfoList = infos.getTModelInfo();
+                            if (tmodelInfoList.size() > 1) {
+                                throw new InvalidRequestException("Multiple matches found:" + tmodelInfoList.size());
+                            }
+                            if (tmodelInfoList.size() ==1) {
+                                TModelInfo info = tmodelInfoList.get(0);
+                                scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+                                scheme.setName(new InternationalStringImpl(info.getName().getValue()));
+                                scheme.setKey(new KeyImpl(info.getTModelKey()));
+                            }
+                        }
+                    }
+
+                } catch (RegistryV3Exception e)
+                { 
+                    throw new JAXRException(e.getLocalizedMessage());
+                }
+            }
+        }
+        return scheme;
+    }
+
+    /**
+     * Creates a new Concept, associates w/ parent scheme, and then
+     * adds as decendent.
+     * @param scheme
+     * @param name
+     * @throws JAXRException
+     */
+    private void addChildConcept(ClassificationSchemeImpl scheme, String name)
+        throws JAXRException {
+        Concept c = new ConceptImpl(registryService.getLifeCycleManagerImpl());
+
+        c.setName(new InternationalStringImpl(name));
+        c.setValue(name);
+        ((ConceptImpl)c).setScheme((ClassificationSchemeImpl)scheme);
+
+        scheme.addChildConcept(c);
+    }
+
+    public BulkResponse findClassificationSchemes(Collection findQualifiers, 
+    											  Collection namePatterns, 
+    											  Collection classifications, 
+    											  Collection externalLinks) throws JAXRException
+	{
+		//TODO: Handle this better
+        LinkedHashSet<ClassificationScheme> col = new LinkedHashSet<ClassificationScheme>();
+		Iterator iter = namePatterns.iterator();
+		String name = "";
+		while(iter.hasNext())
+		{
+			name = (String)iter.next();
+			break;
+		}
+		
+        ClassificationScheme classificationScheme = findClassificationSchemeByName(findQualifiers,name);
+        if (classificationScheme!=null) {
+            col.add(classificationScheme);
+        }
+		return new BulkResponseImpl(col);
+	}
+
+    public Concept findConceptByPath(String path) throws JAXRException
+    {
+        //We will store the enumerations datastructure in the util package
+        /**
+         * I am not clear about how this association type enumerations
+         * are to be implemented.
+         */
+        return EnumerationHelper.getConceptByPath(path);
+    }
+
+    public BulkResponse findConcepts(Collection findQualifiers,
+                                     Collection namePatterns,
+                                     Collection classifications,
+                                     Collection externalIdentifiers,
+                                     Collection externalLinks) throws JAXRException
+    {
+        LinkedHashSet<Concept> col = new LinkedHashSet<Concept>();
+
+        //Lets ask the uddi registry if it has the TModels
+        IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
+        FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
+        Iterator iter = null;
+        if (namePatterns != null) iter = namePatterns.iterator();
+        while (iter.hasNext())
+        {
+            String namestr = (String) iter.next();
+            try
+            {
+                TModelList list = registry.findTModel(namestr, 
+                        ScoutJaxrUddiV3Helper.getCategoryBagFromClassifications(classifications), 
+                        ScoutJaxrUddiV3Helper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers), 
+                		juddiFindQualifiers, 10);
+               
+                if (list != null && list.getTModelInfos()!=null) {
+                	List<TModelInfo> tmodelInfoList = list.getTModelInfos().getTModelInfo();
+                	if (tmodelInfoList!=null) {
+                		for (TModelInfo info: tmodelInfoList) {
+                            col.add(ScoutUddiV3JaxrHelper.getConcept(info, this.registryService.getBusinessLifeCycleManager()));
+						}
+                	}
+                }
+            } catch (RegistryV3Exception e) { 
+                throw new JAXRException(e.getLocalizedMessage());
+            }
+        }
+
+        return new BulkResponseImpl(col);
+    }
+
+    public BulkResponse findRegistryPackages(Collection findQualifiers,
+                                             Collection namePatterns,
+                                             Collection classifications,
+                                             Collection externalLinks) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException();
+    }
+
+    public BulkResponse findServiceBindings(Key serviceKey,
+                                            Collection findQualifiers,
+                                            Collection classifications,
+                                            Collection specifications) throws JAXRException
+    {
+        BulkResponseImpl blkRes = new BulkResponseImpl();
+
+        IRegistryV3 iRegistry = (IRegistryV3) registryService.getRegistry();
+        FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
+
+        try
+        {
+ 
+            BindingDetail bindingDetail = iRegistry.findBinding(serviceKey.getId(),
+                    ScoutJaxrUddiV3Helper.getCategoryBagFromClassifications(classifications), 
+            		ScoutJaxrUddiV3Helper.getTModelBagFromSpecifications(specifications),
+            		juddiFindQualifiers,registryService.getMaxRows());
+
+            /*
+             * now convert  from jUDDI ServiceInfo objects to JAXR Services
+             */
+            if (bindingDetail != null) {
+
+            	List<BindingTemplate> bindingTemplateList = bindingDetail.getBindingTemplate();
+                BindingTemplate[] bindarr = new BindingTemplate[bindingTemplateList.size()];
+                bindingTemplateList.toArray(bindarr);
+                
+                LinkedHashSet<ServiceBinding> col = new LinkedHashSet<ServiceBinding>();
+
+                for (int i=0; bindarr != null && i < bindarr.length; i++) {
+                    BindingTemplate si = bindarr[i];
+                    ServiceBinding sb =  ScoutUddiV3JaxrHelper.getServiceBinding(si,
+                            registryService.getBusinessLifeCycleManager());
+                    col.add(sb);
+                   //Fill the Service object by making a call to registry
+                   Service s = (Service)getRegistryObject(serviceKey.getId(), LifeCycleManager.SERVICE);
+                   ((ServiceBindingImpl)sb).setService(s);
+                }
+
+                blkRes.setCollection(col);
+            }
+        }
+        catch (RegistryV3Exception e) {
+            throw new JAXRException(e.getLocalizedMessage());
+        }
+
+        return blkRes;
+    }
+
+
+    /**
+     * Finds all Service objects that match all of the criteria specified by
+     * the parameters of this call.  This is a logical AND operation between
+     * all non-null parameters
+     *
+     * TODO - support findQualifiers, classifications and specifications
+     *
+     * @param orgKey
+     * @param findQualifiers
+     * @param namePatterns
+     * @param classifications
+     * @param specificationa
+     * @return BulkResponse
+     * @throws JAXRException
+     */
+    public BulkResponse findServices(Key orgKey, Collection findQualifiers,
+                                     Collection namePatterns,
+                                     Collection classifications,
+                                     Collection specificationa) throws JAXRException
+    {
+        BulkResponseImpl blkRes = new BulkResponseImpl();
+
+        IRegistryV3 iRegistry = (IRegistryV3) registryService.getRegistry();
+        FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
+        Name[] juddiNames = mapNamePatterns(namePatterns);
+
+        try
+        {
+            /*
+             * hit the registry.  The key is not required for UDDI2
+             */
+
+            String id = null;
+
+            if (orgKey != null) {
+                id = orgKey.getId();
+            }
+
+            ServiceList serviceList = iRegistry.findService(id, 
+            		juddiNames,
+                    ScoutJaxrUddiV3Helper.getCategoryBagFromClassifications(classifications), 
+                    null, 
+                    juddiFindQualifiers, registryService.getMaxRows());
+
+            /*
+             * now convert  from jUDDI ServiceInfo objects to JAXR Services
+             */
+            if (serviceList != null) {
+
+                ServiceInfos serviceInfos = serviceList.getServiceInfos();
+                LinkedHashSet<Service> col = new LinkedHashSet<Service>();
+                
+                if(serviceInfos != null && serviceInfos.getServiceInfo()!=null) {
+                	for (ServiceInfo si : serviceInfos.getServiceInfo()) {
+                		Service srv = (Service) getRegistryObject(si.getServiceKey(), LifeCycleManager.SERVICE);
+                        col.add(srv);
+					}
+                	
+                }
+                blkRes.setCollection(col);
+            }
+        }
+        catch (RegistryV3Exception e) {
+            throw new JAXRException(e.getLocalizedMessage());
+        }
+
+        return blkRes;
+    }
+
+    public RegistryObject getRegistryObject(String id) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException();
+    }
+
+    public RegistryObject getRegistryObject(String id, String objectType) throws JAXRException
+    {
+        IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
+        BusinessLifeCycleManager lcm = registryService.getBusinessLifeCycleManager();
+
+        if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType)) {
+
+            try {
+
+                TModelDetail tmodeldetail = registry.getTModelDetail(id);
+                Concept c = ScoutUddiV3JaxrHelper.getConcept(tmodeldetail, lcm);
+
+                /*
+                 * now turn into a concrete ClassificationScheme
+                 */
+
+                ClassificationScheme scheme = new ClassificationSchemeImpl(lcm);
+
+                scheme.setName(c.getName());
+                scheme.setDescription(c.getDescription());
+                scheme.setKey(c.getKey());
+
+                return scheme;
+            }
+            catch (RegistryV3Exception e) {
+                throw new JAXRException(e.getLocalizedMessage());
+            }
+        }
+        else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType)) {        	
+            try
+            {
+                BusinessDetail orgdetail = registry.getBusinessDetail(id);
+                return ScoutUddiV3JaxrHelper.getOrganization(orgdetail, lcm);
+            }
+            catch (RegistryV3Exception e) {
+                throw new JAXRException(e.getLocalizedMessage());
+            }
+
+        }
+        else if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType)) {
+
+            try
+            {
+                TModelDetail tmodeldetail = registry.getTModelDetail(id);
+                return ScoutUddiV3JaxrHelper.getConcept(tmodeldetail, lcm);
+            }
+            catch (RegistryV3Exception e) { 
+                throw new JAXRException(e.getLocalizedMessage());
+            }
+        }
+        else if (LifeCycleManager.SERVICE.equalsIgnoreCase(objectType)) {
+
+            try {
+                ServiceDetail sd = registry.getServiceDetail(id);
+                if (sd != null && sd.getBusinessService()!=null) {
+                    for (BusinessService businessService : sd.getBusinessService()) {
+                    	Service service = getServiceFromBusinessService(businessService, lcm);
+                    	return service;
+					}
+                }
+            }
+            catch (RegistryV3Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     *  Helper routine to take a jUDDI business service and turn into a useful
+     *  Service.  Needs to go back to the registry to get the organization to
+     *  properly hydrate the Service
+     *
+     * @param bs  BusinessService object to turn in to a Service
+     * @param lcm manager to use
+     * @return new Service object
+     * @throws JAXRException
+     */
+    protected Service getServiceFromBusinessService(BusinessService bs, LifeCycleManager lcm)
+        throws JAXRException {
+
+        ServiceImpl service  = (ServiceImpl) ScoutUddiV3JaxrHelper.getService(bs, lcm);
+        service.setSubmittingOrganizationKey(bs.getBusinessKey());
+
+        return service;
+    }
+
+    /**
+     * Gets the RegistryObjects owned by the caller. The objects
+     * are returned as their concrete type (e.g. Organization, User etc.)
+     *
+     *  TODO - need to figure out what the set are.  This is just to get some
+     *  basic functionality
+     *
+     * @return BulkResponse
+     * @throws JAXRException
+     */
+    public BulkResponse getRegistryObjects() throws JAXRException
+    {
+        String types[] = {
+            LifeCycleManager.ORGANIZATION,
+            LifeCycleManager.SERVICE};
+
+        LinkedHashSet<Object> c = new LinkedHashSet<Object>();
+
+        for (int i = 0; i < types.length; i++) {
+            try {
+                BulkResponse bk = getRegistryObjects(types[i]);
+
+                if (bk.getCollection() != null) {
+                    c.addAll(bk.getCollection());
+                }
+            } catch(JAXRException e) {
+            	log.debug("ignore - just a problem with that type? " + e.getMessage(), e);
+            }
+        }
+
+        return new BulkResponseImpl(c);
+    }
+
+    public BulkResponse getRegistryObjects(Collection objectKeys) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException();
+    }
+
+    public BulkResponse getRegistryObjects(Collection objectKeys, String objectType) throws JAXRException
+    {
+        IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
+        //Convert into a vector of strings
+        String[] keys = new String[objectKeys.size()];
+        int currLoc = 0;
+        for (Key key : (Collection<Key>) objectKeys) {
+            keys[currLoc] = key.getId();
+            currLoc++;
+        }
+        LinkedHashSet<RegistryObject> col = new LinkedHashSet<RegistryObject>();
+        LifeCycleManager lcm = registryService.getLifeCycleManagerImpl();
+
+        if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType))
+        {
+            try
+            {
+                TModelDetail tmodeldetail = registry.getTModelDetail(keys);
+                List<TModel> tmodelList = tmodeldetail.getTModel();
+
+                for (TModel tModel: tmodelList)
+                {
+                    col.add(ScoutUddiV3JaxrHelper.getConcept(tModel, lcm));
+                }
+
+            } catch (RegistryV3Exception e)
+            { 
+                throw new JAXRException(e.getLocalizedMessage());
+            }
+        }
+        else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType))
+        {
+        	ConnectionImpl con = ((RegistryServiceImpl)getRegistryService()).getConnection();
+            AuthToken auth = this.getAuthToken(con,registry);
+        	
+            try
+            {
+            	RegisteredInfo ri = registry.getRegisteredInfo(auth.getAuthInfo());
+                if (ri != null) {
+                    BusinessInfos infos = ri.getBusinessInfos();
+                    if (infos != null) {
+                        List<BusinessInfo> bizInfoList = infos.getBusinessInfo();
+                        for (BusinessInfo businessInfo: bizInfoList) {
+                            BusinessDetail detail = registry.getBusinessDetail(businessInfo.getBusinessKey());
+                            col.add(((BusinessLifeCycleManagerV3Impl)registryService.getLifeCycleManagerImpl()).createOrganization(detail));
+                        }
+                    }
+                }
+            } catch (RegistryV3Exception e) {
+                    throw new JAXRException(e.getLocalizedMessage());
+            }
+        }
+        else if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType))
+        {
+            try {
+                TModelDetail tmodeldetail = registry.getTModelDetail(keys);
+                List<TModel> tmodelList = tmodeldetail.getTModel();
+
+                for (TModel tmodel: tmodelList)
+                {
+                    col.add(ScoutUddiV3JaxrHelper.getConcept(tmodel, lcm));
+                }
+
+            }
+            catch (RegistryV3Exception e)
+            { 
+                throw new JAXRException(e.getLocalizedMessage());
+            }
+        }
+        else if (LifeCycleManager.SERVICE.equalsIgnoreCase(objectType)) {
+
+            try {
+                ServiceDetail serviceDetail = registry.getServiceDetail(keys);
+
+                if (serviceDetail != null) {
+                    List<BusinessService> bizServiceList = serviceDetail.getBusinessService();
+
+                    for (BusinessService businessService: bizServiceList) {
+
+                        Service service = getServiceFromBusinessService(businessService, lcm);
+                        
+                        col.add(service);
+                    }
+                }
+            }
+            catch (RegistryV3Exception e) {
+                throw new JAXRException(e);
+            }
+        }
+        else {
+            throw new JAXRException("Unsupported type " + objectType +
+                    " for getRegistryObjects() in Apache Scout");
+        }
+
+        return new BulkResponseImpl(col);
+
+    }
+
+    public BulkResponse getRegistryObjects(String id) throws JAXRException
+    {
+        if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(id)) {
+            IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
+        	ConnectionImpl con = ((RegistryServiceImpl)getRegistryService()).getConnection();
+            AuthToken auth = this.getAuthToken(con,registry);
+    		LinkedHashSet<Organization> orgs = null;
+            try
+            {
+            	RegisteredInfo ri = registry.getRegisteredInfo(auth.getAuthInfo());
+            	if (ri != null && ri.getBusinessInfos()!=null) {
+            		List<BusinessInfo> bizInfoList = ri.getBusinessInfos().getBusinessInfo();
+            		orgs = new LinkedHashSet<Organization>();
+            		for (BusinessInfo businessInfo : bizInfoList) {
+            			BusinessDetail detail = registry.getBusinessDetail(businessInfo.getBusinessKey());
+                        orgs.add(((BusinessLifeCycleManagerV3Impl)registryService.getLifeCycleManagerImpl()).createOrganization(detail));
+					}
+            	}
+            	
+            } catch (RegistryV3Exception re) {
+            	throw new JAXRException(re);
+            }
+            return new BulkResponseImpl(orgs);
+        }
+        else if (LifeCycleManager.SERVICE.equalsIgnoreCase(id)) {
+            List<String> a = new ArrayList<String>();
+            a.add("%");
+
+            BulkResponse br = this.findServices(null,null, a, null, null);
+
+            return br;
+        }
+        else
+        {
+            throw new JAXRException("Unsupported type for getRegistryObjects() :" + id);
+        }
+
+    }
+
+    static FindQualifiers mapFindQualifiers(Collection jaxrQualifiers) throws UnsupportedCapabilityException
+    {
+        if (jaxrQualifiers == null)
+        {
+            return null;
+        }
+        FindQualifiers result = objectFactory.createFindQualifiers();
+        for (Iterator i = jaxrQualifiers.iterator(); i.hasNext();)
+        {
+            String jaxrQualifier = (String) i.next();
+            String juddiQualifier = jaxrQualifier;
+            if (juddiQualifier == null)
+            {
+                throw new UnsupportedCapabilityException("jUDDI does not support FindQualifer: " + jaxrQualifier);
+            }
+            result.getFindQualifier().add(juddiQualifier);
+        }
+        return result;
+    }
+
+    static Name[] mapNamePatterns(Collection namePatterns)
+        throws JAXRException
+    {
+        if (namePatterns == null)
+            return null;
+        Name[] result = new Name[namePatterns.size()];
+        int currLoc = 0;
+        for (Iterator i = namePatterns.iterator(); i.hasNext();)
+        {
+            Object obj = i.next();
+            Name name = objectFactory.createName();
+            if (obj instanceof String) {
+                name.setValue((String)obj);
+            } else if (obj instanceof LocalizedString) {
+                LocalizedString ls = (LocalizedString)obj;
+                name.setValue(ls.getValue());
+                name.setLang(ls.getLocale().getLanguage());
+            }
+            result[currLoc] = name;
+            currLoc++;
+        }
+        return result;
+    }
+
+   /**
+     * Get the Auth Token from the registry
+     *
+     * @param connection
+     * @param ireg
+     * @return auth token
+     * @throws JAXRException
+     */
+    private AuthToken getAuthToken(ConnectionImpl connection, IRegistryV3 ireg)
+            throws JAXRException {
+        Set creds = connection.getCredentials();
+        Iterator it = creds.iterator();
+        String username = "", pwd = "";
+        while (it.hasNext()) {
+            PasswordAuthentication pass = (PasswordAuthentication) it.next();
+            username = pass.getUserName();
+            pwd = new String(pass.getPassword());
+        }
+        AuthToken token = null;
+        try {
+            token = ireg.getAuthToken(username, pwd);
+        }
+        catch (Exception e) {
+            throw new JAXRException(e);
+        }
+        return token;
+    }
+}

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java Sun Sep  6 23:21:23 2009
@@ -36,12 +36,14 @@
  *
  * @author Anil Saldhana  <an...@apache.org>
  * @author Jeremy Boynes  <jb...@apache.org>
+ * @author Tom Cunningham <tc...@apache.org>
  */
 public class ConnectionFactoryImpl extends ConnectionFactory implements Serializable
 {
     private static final long serialVersionUID = 1L;
     private static final String QUERYMANAGER_PROPERTY = "javax.xml.registry.queryManagerURL";
     private static final String LIFECYCLEMANAGER_PROPERTY = "javax.xml.registry.lifeCycleManagerURL";
+    private static final String SECURITYMANAGER_PROPERTY = "javax.xml.registry.securityManagerURL";
     private static final String SEMANTICEQUIVALENCES_PROPERTY = "javax.xml.registry.semanticEquivalences";
     private static final String POSTALADDRESSSCHEME_PROPERTY = "javax.xml.registry.postalAddressScheme";
     private static final String AUTHENTICATIONMETHOD_PROPERTY = "javax.xml.registry.security.authenticationMethod";
@@ -49,11 +51,14 @@
 
     private String queryManagerURL;
     private String lifeCycleManagerURL;
+    private String securityManagerURL;
     private String transportClass;
     private String semanticEquivalences;
     private String authenticationMethod;
     private Integer maxRows;
     private String postalAddressScheme;
+	private String uddiNamespace;
+	private String uddiVersion;
 
     /**
      * Public no-arg constructor so that this ConnectionFactory can be
@@ -71,6 +76,7 @@
         }
         URI queryManager;
         URI lifeCycleManager;
+        URI securityManager = null;
         try
         {
             queryManager = new URI(queryManagerURL);
@@ -85,7 +91,16 @@
         {
             throw new InvalidRequestException("Invalid lifeCycleManagerURL: " + lifeCycleManagerURL, e);
         }
-        return new ConnectionImpl(queryManager, lifeCycleManager, transportClass, null, maxRows == null ? -1 : maxRows.intValue());
+        try
+        {      
+        	if (securityManagerURL != null) {
+        		securityManager = new URI(securityManagerURL);
+        	}
+        } catch (URISyntaxException e) {
+        	securityManager = null;
+        }
+        	return new ConnectionImpl(queryManager, lifeCycleManager, securityManager, transportClass, null, maxRows == null ? -1 : maxRows.intValue(),
+                               uddiNamespace, uddiVersion);
     }
 
     public FederatedConnection createFederatedConnection(Collection collection) throws JAXRException
@@ -111,6 +126,10 @@
         {
             props.put(LIFECYCLEMANAGER_PROPERTY, lifeCycleManagerURL);
         }
+        if (securityManagerURL != null)
+        {
+        	props.put(SECURITYMANAGER_PROPERTY, securityManagerURL);
+        }
         if (semanticEquivalences != null)
         {
             props.put(SEMANTICEQUIVALENCES_PROPERTY, semanticEquivalences);
@@ -127,6 +146,13 @@
         {
             props.put(MAXROWS_PROPERTY, maxRows.toString());
         }
+        if (uddiNamespace != null) {
+        	props.put(RegistryImpl.UDDI_NAMESPACE_PROPERTY_NAME, uddiNamespace);
+        }
+        if (uddiVersion != null) {
+        	props.put(RegistryImpl.UDDI_VERSION_PROPERTY_NAME, uddiVersion);
+        }
+
         return props;
     }
 
@@ -139,10 +165,15 @@
     {
         queryManagerURL = properties.getProperty(QUERYMANAGER_PROPERTY);
         lifeCycleManagerURL = properties.getProperty(LIFECYCLEMANAGER_PROPERTY);
+        securityManagerURL = properties.getProperty(SECURITYMANAGER_PROPERTY);
+
         transportClass = properties.getProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME);
         semanticEquivalences = properties.getProperty(SEMANTICEQUIVALENCES_PROPERTY);
         authenticationMethod = properties.getProperty(AUTHENTICATIONMETHOD_PROPERTY);
         postalAddressScheme = properties.getProperty(POSTALADDRESSSCHEME_PROPERTY);
+        uddiVersion = properties.getProperty(RegistryImpl.UDDI_VERSION_PROPERTY_NAME);
+        uddiNamespace = properties.getProperty(RegistryImpl.UDDI_NAMESPACE_PROPERTY_NAME);
+
         String val = properties.getProperty(MAXROWS_PROPERTY);
         maxRows = (val == null) ? null : Integer.valueOf(val);
     }

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionImpl.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionImpl.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionImpl.java Sun Sep  6 23:21:23 2009
@@ -30,6 +30,7 @@
  * For futher details, look into the JAXR API Javadoc.
  *
  * @author Anil Saldhana  <an...@apache.org>
+ * @author Tom Cunningham <tc...@apache.org>
  */
 public class ConnectionImpl implements Connection, Serializable
 {
@@ -37,11 +38,13 @@
     private boolean closed = false;
     private boolean synchronous = true;
     private Set credentials;
-    private final RegistryImpl registry;
+    private final IRegistryBase registry;
     private final String postalScheme;
     private final int maxRows;
+    private String uddiVersion;
 
-    public ConnectionImpl(URI queryManagerURI, URI lifeCycleManagerURI, String transportClass, String postalScheme, int maxRows)
+    public ConnectionImpl(URI queryManagerURI, URI lifeCycleManagerURI, URI securityManagerURI, String transportClass, String postalScheme, int maxRows,
+    	String uddiNamespace, String uddiVersion)
     {
         Properties prop = new Properties();
         /**
@@ -49,8 +52,12 @@
          * juddi RegistryProxy uses, set the System property
          * accordingly.
          */
+		this.uddiVersion = uddiVersion;
+
         if (transportClass!=null) {
     		prop.setProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME, transportClass);
+    		prop.setProperty(RegistryImpl.UDDI_NAMESPACE_PROPERTY_NAME, uddiNamespace);
+    		prop.setProperty(RegistryImpl.UDDI_VERSION_PROPERTY_NAME, uddiVersion);
     	} else {
     		String transport = SecurityActions.getProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME);
     		if (transport != null) {
@@ -61,9 +68,14 @@
          * Even if the properties passed contains no values,
          * juddi takes default values
          */
-        registry = new RegistryImpl(prop);   
+        if ("3.0".equals(uddiVersion)) {
+        	registry = new RegistryV3Impl(prop);
+        } else {
+            registry = new RegistryImpl(prop);           	
+        }
         registry.setInquiryURI(queryManagerURI);
         registry.setPublishURI(lifeCycleManagerURI);
+        registry.setSecurityURI(securityManagerURI);
         this.postalScheme = postalScheme;
         this.maxRows = maxRows;
 
@@ -71,7 +83,7 @@
 
     public RegistryService getRegistryService() throws JAXRException
     {
-        RegistryServiceImpl reg = new RegistryServiceImpl(registry, postalScheme, maxRows);
+        RegistryServiceImpl reg = new RegistryServiceImpl(registry, postalScheme, maxRows, uddiVersion);
         reg.setConnection(this);
         return reg;
     }

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistry.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistry.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistry.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistry.java Sun Sep  6 23:21:23 2009
@@ -50,12 +50,11 @@
  *  
  * <i>Borrowed from jUDDI.</i>
  * 
+ *
+ * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
  */
 
-public interface IRegistry {
-	
-	String execute(String uddiRequest, String urltype) throws RegistryException;
-	
+public interface IRegistry extends IRegistryBase {		
 	/**
 	 * @return Returns the inquiryURL.
 	 */

Added: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistryBase.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistryBase.java?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistryBase.java (added)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistryBase.java Sun Sep  6 23:21:23 2009
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2001-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.registry;
+
+import java.net.URI;
+
+import org.apache.ws.scout.transport.Transport;
+import org.apache.ws.scout.transport.TransportException;
+
+/**
+ * 
+ * IRegistryBase interface.
+ * 
+ * <p>Provides a common interface to IRegistry and IRegistryV3 and any
+ * subsequent directory implementation.</p>
+ *  
+ * <i>Borrowed from jUDDI.</i>
+ * 
+ *
+ * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
+ */
+
+public interface IRegistryBase {
+
+	String execute(String uddiRequest, String urltype) throws TransportException;
+	
+	/**
+	 * @return Returns the inquiryURL.
+	 */
+	URI getInquiryURI();
+	
+	/**
+	 * @param uri The inquiry uri to set.
+	 */
+	void setInquiryURI(URI uri);
+	
+	/**
+	 * @return Returns the publishURL.
+	 */
+	URI getPublishURI();	
+	
+	/**
+	 * @param uri The publish uri to set.
+	 */
+	void setPublishURI(URI uri);
+	
+	/**
+	 * @return Returns the publishURL.
+	 */
+	URI getSecurityURI();	
+	
+	/**
+	 * @param uri The publish uri to set.
+	 */
+	void setSecurityURI(URI uri);
+
+	
+	/**
+	 * @return Returns the transport.
+	 */
+	Transport getTransport();
+	
+	/**
+	 * @param transport The transport to set.
+	 */
+	void setTransport(Transport transport);
+
+}

Added: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistryV3.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistryV3.java?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistryV3.java (added)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/IRegistryV3.java Sun Sep  6 23:21:23 2009
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2001-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.registry;
+
+import java.net.URI;
+import org.uddi.api_v3.*;
+import org.apache.ws.scout.transport.Transport;
+
+/**
+ * 
+ * IRegistry interface.
+ * 
+ * <p>Only the functions that scout relies on, are in this interface.</p>
+ *  
+ * <i>Borrowed from jUDDI.</i>
+ * 
+ */
+
+public interface IRegistryV3 extends IRegistryBase {
+		
+	/**
+	 * @return Returns the inquiryURL.
+	 */
+	URI getInquiryURI();
+	
+	/**
+	 * @param uri The inquiry uri to set.
+	 */
+	void setInquiryURI(URI uri);
+	
+	/**
+	 * @return Returns the publishURL.
+	 */
+	URI getPublishURI();	
+	
+	/**
+	 * @param uri The publish uri to set.
+	 */
+	void setPublishURI(URI uri);
+	
+	/**
+	 * @return Returns the transport.
+	 */
+	Transport getTransport();
+	
+	/**
+	 * @param transport The transport to set.
+	 */
+	void setTransport(Transport transport);
+
+	/**
+	 * @exception RegistryV3Exception;
+	 */
+	PublisherAssertions setPublisherAssertions(String authInfo, PublisherAssertion[] assertionArray)
+	throws RegistryV3Exception;
+
+	/**
+	 * "Used to register or update complete information about a businessService
+	 *  exposed by a specified businessEntity."
+	 *
+	 * @exception RegistryV3Exception;
+	 */
+	ServiceDetail saveService(String authInfo, BusinessService[] serviceArray)
+	throws RegistryV3Exception;
+
+	/**
+	 * "Used to register new bindingTemplate information or update existing
+	 *  bindingTemplate information.  Use this to control information about
+	 *  technical capabilities exposed by a registered business."
+	 *
+	 * @exception RegistryV3Exception;
+	 */
+	BindingDetail saveBinding(String authInfo, BindingTemplate[] bindingArray)
+	throws RegistryV3Exception;
+	
+	/**
+	 * "Used to register new businessEntity information or update existing
+	 *  businessEntity information.  Use this to control the overall
+	 *  information about the entire business.  Of the save_x APIs this one
+	 *  has the broadest effect."
+	 *
+	 * @exception RegistryV3Exception;
+	 */
+	BusinessDetail saveBusiness(String authInfo, BusinessEntity[] businessArray)
+	throws RegistryV3Exception;
+	
+	
+	/**
+	 * "Used to register or update complete information about a tModel."
+	 *
+	 * @exception RegistryV3Exception;
+	 */
+	TModelDetail saveTModel(String authInfo, TModel[] tModelArray)
+	throws RegistryV3Exception;
+	
+	/**
+	 * "Used to remove an existing bindingTemplate from the bindingTemplates
+	 *  collection that is part of a specified businessService structure."
+	 *
+	 * @exception RegistryV3Exception;
+	 */
+	DispositionReport deleteBinding(String authInfo, String[] bindingKeyArray)
+	throws RegistryV3Exception;
+	
+	/**
+	 * "Used to delete registered businessEntity information from the registry."
+	 *
+	 * @exception RegistryV3Exception;
+	 */
+	DispositionReport deleteBusiness(String authInfo, String[] businessKeyArray)
+	throws RegistryV3Exception;
+	
+	/**
+	 * "Used to delete an existing businessService from the businessServices
+	 *  collection that is part of a specified businessEntity."
+	 *
+	 * @exception RegistryV3Exception;
+	 */
+	DispositionReport deleteService(String authInfo, String[] serviceKeyArray)
+	throws RegistryV3Exception;
+
+	/**
+	 * "Used to delete registered information about a tModel.  If there
+	 *  are any references to a tModel when this call is made, the tModel
+	 *  will be marked deleted instead of being physically removed."
+	 *
+	 * @exception RegistryV3Exception;
+	 */
+	DispositionReport deleteTModel(String authInfo, String[] tModelKeyArray)
+	throws RegistryV3Exception;
+	
+	/**
+	 * @exception RegistryV3Exception;
+	 */
+	AssertionStatusReport getAssertionStatusReport(String authInfo, String completionStatus)
+	throws RegistryV3Exception;
+
+	/**
+	 * @exception RegistryV3Exception;
+	 */
+	DispositionReport deletePublisherAssertions(String authInfo, PublisherAssertion[] assertionArray)
+	throws RegistryV3Exception;
+	
+	/**
+	 * "Used to request an authentication token from an Operator Site.
+	 *  Authentication tokens are required to use all other APIs defined
+	 *  in the publishers API.  This server serves as the program's
+	 *  equivalent of a login request."
+	 *
+	 * @exception RegistryV3Exception;
+	 */
+	AuthToken getAuthToken(String userID,String cred)
+    throws RegistryV3Exception;
+
+	  /**
+	   * Used to locate information about one or more businesses. Returns a
+	   * businessList message that matches the conditions specified.
+	   *
+	   * @exception RegistryV3Exception;
+	   */
+	  BusinessList findBusiness(Name[] nameArray,DiscoveryURLs discoveryURLs,IdentifierBag identifierBag,CategoryBag categoryBag,TModelBag tModelBag,FindQualifiers findQualifiers,int maxRows)
+	    throws RegistryV3Exception;
+	  
+	  /**
+	   * "Used to get the full businessEntity information for one or more
+	   *  businesses. Returns a businessDetail message."
+	   *
+	   * @exception RegistryV3Exception;
+	   */
+	  BusinessDetail getBusinessDetail(String businessKey)
+	    throws RegistryV3Exception;
+
+	  /**
+	   * "Used to get the full businessEntity information for one or more
+	   *  businesses. Returns a businessDetail message."
+	   *
+	   * @exception RegistryV3Exception;
+	   */
+	  BusinessDetail getBusinessDetail(String[] businessKeyVector)
+	    throws RegistryV3Exception;
+	  
+	  /**
+	   * @exception RegistryV3Exception;
+	   */
+	  PublisherAssertions getPublisherAssertions(String authInfo)
+	    throws RegistryV3Exception;
+	  
+	  /**
+	   * @exception RegistryV3Exception;
+	   */
+	  RegisteredInfo getRegisteredInfo(String authInfo)
+	  	throws RegistryV3Exception;
+	  
+	  /**
+	   * "Used to locate one or more tModel information structures. Returns a
+	   *  tModelList structure."
+	   *
+	   * @exception RegistryV3Exception;
+	   */
+	  TModelList findTModel(String name,CategoryBag categoryBag,IdentifierBag identifierBag,FindQualifiers findQualifiers,int maxRows)
+	  throws RegistryV3Exception;
+	  
+	  /**
+	   * "Used to locate specific bindings within a registered
+	   *  businessService. Returns a bindingDetail message."
+	   *
+	   * @exception RegistryV3Exception
+	   */
+	  BindingDetail findBinding(String serviceKey,CategoryBag categoryBag,TModelBag tModelBag,FindQualifiers findQualifiers,int maxRows)
+	  throws RegistryV3Exception;
+	  
+	  /**
+	   * "Used to locate specific services within a registered
+	   *  businessEntity. Return a serviceList message." From the
+	   *  XML spec (API, p18) it appears that the name, categoryBag,
+	   *  and tModelBag arguments are mutually exclusive.
+	   *
+	   * @exception RegistryV3Exception;
+	   */
+	  ServiceList findService(String businessKey,Name[] nameArray,CategoryBag categoryBag,TModelBag tModelBag,FindQualifiers findQualifiers,int maxRows)
+	  throws RegistryV3Exception;
+	  
+	  /**
+	   * "Used to get full details for a given set of registered tModel
+	   *  data. Returns a tModelDetail message."
+	   *
+	   * @exception RegistryV3Exception;
+	   */
+	  TModelDetail getTModelDetail(String tModelKey)
+	  throws RegistryV3Exception;
+	  
+	  /**
+	   * "Used to get full details for a given set of registered tModel
+	   *  data. Returns a tModelDetail message."
+	   *
+	   * @exception RegistryV3Exception;
+	   */
+	  TModelDetail getTModelDetail(String[] tModelKeyArray)
+	  throws RegistryV3Exception;
+
+	  /**
+	   * "Used to get full details for a given set of registered
+	   *  businessService data. Returns a serviceDetail message."
+	   *
+	   * @exception RegistryV3Exception;
+	   */
+	  ServiceDetail getServiceDetail(String serviceKey)
+	    throws RegistryV3Exception;
+
+	  /**
+	   * "Used to get full details for a given set of registered
+	   *  businessService data. Returns a serviceDetail message."
+	   *
+	   * @exception RegistryV3Exception;
+	   */
+	  ServiceDetail getServiceDetail(String[] serviceKeyArray)
+	    throws RegistryV3Exception;
+
+
+}

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java Sun Sep  6 23:21:23 2009
@@ -18,7 +18,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 import java.util.Locale;
 
 import javax.activation.DataHandler;
@@ -51,11 +50,6 @@
 import javax.xml.registry.infomodel.TelephoneNumber;
 import javax.xml.registry.infomodel.User;
 
-import org.apache.ws.scout.model.uddi.v2.BusinessDetail;
-import org.apache.ws.scout.model.uddi.v2.BusinessInfo;
-import org.apache.ws.scout.model.uddi.v2.Description;
-import org.apache.ws.scout.model.uddi.v2.Name;
-import org.apache.ws.scout.model.uddi.v2.ServiceInfo;
 import org.apache.ws.scout.registry.infomodel.AssociationImpl;
 import org.apache.ws.scout.registry.infomodel.ClassificationImpl;
 import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
@@ -75,7 +69,6 @@
 import org.apache.ws.scout.registry.infomodel.SpecificationLinkImpl;
 import org.apache.ws.scout.registry.infomodel.TelephoneNumberImpl;
 import org.apache.ws.scout.registry.infomodel.UserImpl;
-import org.apache.ws.scout.util.ScoutUddiJaxrHelper;
 
 /**
  * Implements JAXR LifeCycleManager Interface
@@ -449,45 +442,4 @@
         throw new UnsupportedCapabilityException();
     }
 
-    Organization createOrganization(BusinessInfo bizInfo) throws JAXRException {
-        String key = bizInfo.getBusinessKey();
-        List<Name> names = bizInfo.getName(); 
-        
-        List<Description> descriptions = bizInfo.getDescription();
-        List<ServiceInfo> serviceInfos = bizInfo.getServiceInfos().getServiceInfo();
-        
-        OrganizationImpl org = new OrganizationImpl(this);
-        org.setKey(createKey(key));
-        if (names != null && names.size() > 0) {
-            org.setName(createInternationalString(names.get(0).getValue()));
-        }
-        if (descriptions != null && descriptions.size() > 0) {
-            org.setDescription(createInternationalString(descriptions.get(0).getValue()));
-        }
-        if (serviceInfos != null && serviceInfos.size() > 0) {
-            List<Service> services = new ArrayList<Service>(serviceInfos.size());
-            for (int i = 0; i < serviceInfos.size(); i++) {
-                ServiceInfo serviceInfo = serviceInfos.get(i);
-                services.add(createService(serviceInfo));
-            }
-            org.addServices(services);
-        }
-
-        return org;
-    }
-
-    Organization createOrganization(BusinessDetail bizDetail) throws JAXRException {
-        return ScoutUddiJaxrHelper.getOrganization(bizDetail, this);
-    }
-
-    Service createService(ServiceInfo serviceInfo) throws JAXRException {
-        String key = serviceInfo.getServiceKey();
-        List<Name> names = serviceInfo.getName();
-        ServiceImpl service = new ServiceImpl(this);
-        service.setKey(createKey(key));
-        if (names != null && names.size() > 0) {
-            service.setName(createInternationalString(names.get(0).getValue()));
-        }
-        return service;
-    }
 }

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java Sun Sep  6 23:21:23 2009
@@ -22,6 +22,7 @@
 import java.net.URISyntaxException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Properties;
 
@@ -82,8 +83,11 @@
 import org.apache.ws.scout.model.uddi.v2.TModelDetail;
 import org.apache.ws.scout.model.uddi.v2.TModelList;
 import org.apache.ws.scout.transport.Transport;
+import org.apache.ws.scout.transport.TransportException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
@@ -103,6 +107,7 @@
 
 	public static final String INQUIRY_ENDPOINT_PROPERTY_NAME = "scout.proxy.inquiryURL";
 	public static final String PUBLISH_ENDPOINT_PROPERTY_NAME = "scout.proxy.publishURL";
+	public static final String SECURITY_ENDPOINT_PROPERTY_NAME = "scout.proxy.securityURL";
 	public static final String ADMIN_ENDPOINT_PROPERTY_NAME = "scout.proxy.adminURL";
 	public static final String TRANSPORT_CLASS_PROPERTY_NAME = "scout.proxy.transportClass";
 	public static final String SECURITY_PROVIDER_PROPERTY_NAME = "scout.proxy.securityProvider";
@@ -112,6 +117,7 @@
 
 	public static final String DEFAULT_INQUIRY_ENDPOINT = "http://localhost/juddi/inquiry";
 	public static final String DEFAULT_PUBLISH_ENDPOINT = "http://localhost/juddi/publish";
+	public static final String DEFAULT_SECURITY_ENDPOINT = "http://localhost/juddi/security";
 	public static final String DEFAULT_ADMIN_ENDPOINT = "http://localhost/juddi/admin";
 	public static final String DEFAULT_TRANSPORT_CLASS = "org.apache.ws.scout.transport.AxisTransport";
 	public static final String DEFAULT_SECURITY_PROVIDER = "com.sun.net.ssl.internal.ssl.Provider";
@@ -122,6 +128,7 @@
 	private URI adminURI;
 	private URI inquiryURI;
 	private URI publishURI;
+	private URI securityURI;
 
 	private Transport transport;
 
@@ -169,6 +176,12 @@
 			else
 				this.setPublishURI(new URI(DEFAULT_PUBLISH_ENDPOINT));
 
+			String sURL = props.getProperty(SECURITY_ENDPOINT_PROPERTY_NAME);
+			if (sURL != null)
+				this.setSecurityURI(new URI(sURL));
+			else
+				this.setSecurityURI(new URI(DEFAULT_SECURITY_ENDPOINT));
+			
 			String aURL = props.getProperty(ADMIN_ENDPOINT_PROPERTY_NAME);
 			if (aURL != null)
 				this.setAdminURI(new URI(aURL));
@@ -211,8 +224,13 @@
 		try
 		{
 			JAXBContext context = JAXBContext.newInstance(new Class[] {ObjectFactory.class});
+			JAXBContext v3context = JAXBContext.newInstance(new Class[] {org.uddi.api_v3.ObjectFactory.class});
+			if ("3.0".equals(uddiVer)) { 
+				this.unmarshaller = v3context.createUnmarshaller(); 
+			} else {
+				this.unmarshaller = context.createUnmarshaller(); 
+			}
 			this.marshaller = context.createMarshaller();
-			this.unmarshaller = context.createUnmarshaller(); 
 		}
 		catch(JAXBException e)
 		{
@@ -227,7 +245,7 @@
 	 * @throws RegistryException
 	 */
 	public String execute(String uddiRequest, String urltype)
-			throws RegistryException {
+			throws TransportException {
 		URI endPointURL = null;
 		if (urltype.equalsIgnoreCase("INQUIRY"))
 			endPointURL = this.getInquiryURI();
@@ -266,16 +284,42 @@
         }
 		Element request = doc.getDocumentElement();
 
-	    request.setAttribute("generic", this.getUddiVersion());
+	    request.setAttribute("xmlns", this.getUddiNamespace());
+	    if (!"3.0".equals(this.getUddiVersion())) {
+	    	request.setAttribute("generic", this.getUddiVersion());
+	    }
 	    //request.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
 	    // A SOAP request is made and a SOAP response
 	    // is returned.
 
-	    Element response = transport.send(request, endPointURI);
-        
-        if (response.getNamespaceURI()==null) {
+	    
+	    Element response;
+	    try {
+	    	response = transport.send(request, endPointURI);
+	    } catch (TransportException te) {
+	    	throw new RegistryException(te);
+	    }
+	   /* if (response.hasAttributes()) {
+		    NamedNodeMap am = response.getAttributes();
+		    ArrayList<String> al = new ArrayList<String>();
+		    for (int i = 0; i < am.getLength(); i++) {
+		    	Node n = am.item(i);
+		    	String attribute = n.getNodeName();
+		    	if (attribute!= null && attribute.startsWith("xmlns")) {
+		    		al.add(attribute);
+		    	}
+		    }
+		    for (String attr : al) {
+		    	response.removeAttribute(attr);
+		    }
+	    }*/
+
+	    if (response.getNamespaceURI()==null) {
             response.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
         }
+	    
+	    // If we are getting responses from a UDDI v3, remove the xmlns
+	    
 	    // First, let's make sure that a response
 	    // (any response) is found in the SOAP Body.
 
@@ -283,8 +327,8 @@
 	    if (responseName == null) {
 	        throw new RegistryException("Unsupported response "
 	                + "from registry. A value was not present.");
-		}
- 
+		} 
+	    
         // Let's now try to determine which UDDI response
         // we received and unmarshal it appropriately or
         // throw a RegistryException if it's unknown.
@@ -399,6 +443,13 @@
 	public URI getPublishURI() {
 		return this.publishURI;
 	}
+	
+	/**
+	 * @return Returns the publishURL.
+	 */
+	public URI getSecurityURI() {
+		return this.securityURI;
+	}
 
 	/**
 	 * @param publishURI
@@ -407,6 +458,14 @@
 	public void setPublishURI(URI publishURI) {
 		this.publishURI = publishURI;
 	}
+	
+	/**
+	 * @param publishURI
+	 *            The publishURI to set.
+	 */
+	public void setSecurityURI(URI securityURI) {
+		this.securityURI = securityURI;
+	}
 
 	/**
 	 * @return Returns the securityProvider.
@@ -812,9 +871,16 @@
 			request.setCred(cred);
 		}
 
+		URI getAuthTokenURI = null;
+		if ("3.0".equals(uddiVersion)) {
+			getAuthTokenURI = this.getSecurityURI();
+		} else {
+			getAuthTokenURI = this.getPublishURI();
+		}
+		
         AuthToken at;
         JAXBElement<?> o = execute(this.objectFactory.createGetAuthToken(request), 
-        		this.getPublishURI());
+        		getAuthTokenURI);
         at = (AuthToken) o.getValue();
 
         return at;

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryServiceImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryServiceImpl.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryServiceImpl.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryServiceImpl.java Sun Sep  6 23:21:23 2009
@@ -29,6 +29,7 @@
 
 import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
 import org.apache.ws.scout.registry.infomodel.KeyImpl;
+import org.apache.ws.scout.transport.TransportException;
 
 /**
  * Scout implementation of javax.xml.registry.RegistryService
@@ -36,25 +37,32 @@
  *
  * @author Anil Saldhana  <an...@apache.org>
  * @author Jeremy Boynes <jb...@apache.org>
+ * @author Tom Cunningham <tc...@apache.org>
  */
 public class RegistryServiceImpl implements RegistryService
 {
-    private final RegistryImpl registry;
-    private final BusinessQueryManagerImpl queryManager;
-    private final BusinessLifeCycleManagerImpl lifeCycleManager;
-
+    private final IRegistryBase registry;
+    private final BusinessQueryManager queryManager;
+    private final BusinessLifeCycleManager lifeCycleManager;
+    
     private final ClassificationSchemeImpl postalScheme;
     private final int maxRows;
-
+    private final String uddiVersion;
 
     private ConnectionImpl connection;
 
-    public RegistryServiceImpl(RegistryImpl registry, String postalScheme, int maxRows)
+    public RegistryServiceImpl(IRegistryBase registry, String postalScheme, int maxRows, String uddiVersion)
     {
         this.registry = registry;
         this.maxRows = maxRows;
-        queryManager = new BusinessQueryManagerImpl(this);
-        lifeCycleManager = new BusinessLifeCycleManagerImpl(this);
+        this.uddiVersion = uddiVersion;
+        if ("3.0".equals(uddiVersion)) {
+        	queryManager = new BusinessQueryManagerV3Impl(this);
+        	lifeCycleManager = new BusinessLifeCycleManagerV3Impl(this);
+        } else {
+        	queryManager = new BusinessQueryManagerImpl(this);
+        	lifeCycleManager = new BusinessLifeCycleManagerImpl(this);
+        }
         if (postalScheme == null)
         {
             this.postalScheme = null;
@@ -64,13 +72,13 @@
             this.postalScheme.setKey(new KeyImpl(postalScheme));
         }
     }
-
-    IRegistry getRegistry()
+ 
+    IRegistryBase getRegistry()
     {
         return registry;
     }
 
-    BusinessLifeCycleManagerImpl getLifeCycleManagerImpl()
+    BusinessLifeCycleManager getLifeCycleManagerImpl()
     {
         return lifeCycleManager;
     }
@@ -85,6 +93,10 @@
         return new CapabilityProfileImpl();
     }
 
+    public String getUddiVersion() {
+    	return uddiVersion;
+    }
+    
     public BusinessQueryManager getBusinessQueryManager() throws JAXRException
     {
         return queryManager;
@@ -124,15 +136,12 @@
        else
        type = inquiry;
 
-       try
-       {
-          return registry.execute(s,type);
-       }
-       catch (RegistryException e)
-       {
-          throw new JAXRException(e.getLocalizedMessage());
-       }
-    }
+       try {
+    	   return registry.execute(s,type);
+	   } catch (TransportException e) {
+		   throw new JAXRException(e.getLocalizedMessage());
+	   } 
+     }
 
     public ConnectionImpl getConnection()
     {



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