ws-scout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r125361 - in webservices/scout/trunk/modules/scout/src: java/org/apache/ws/scout/registry java/org/apache/ws/scout/registry/infomodel java/org/apache/ws/scout/util test/org/apache/ws/scout/registry/Delete test/org/apache/ws/scout/registry/Publish test/org/apache/ws/scout/registry/query
Date Sun, 16 Jan 2005 19:03:25 GMT
Author: anil
Date: Sun Jan 16 11:03:24 2005
New Revision: 125361

URL: http://svn.apache.org/viewcvs?view=rev&rev=125361
Log:
Latest Scout changes.

Added:
   webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/
   webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
   webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
   webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/query/
   webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/query/JAXRQueryTest.java
Removed:
   webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Delete/DeleteOrgTest.java
Modified:
   webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
   webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
   webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalLinkImpl.java
   webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/InternationalStringImpl.java
   webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Publish/PublishConceptTest.java

Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java?view=diff&rev=125361&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java&r1=125360&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java&r2=125361
==============================================================================
--- webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java	(original)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java	Sun Jan 16 11:03:24 2005
@@ -28,6 +28,7 @@
 import org.apache.juddi.datatype.response.*;
 import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
 import org.apache.ws.scout.registry.infomodel.KeyImpl;
+import org.apache.ws.scout.util.ScoutJaxrUddiHelper;
 
 import javax.xml.registry.*;
 import javax.xml.registry.infomodel.*;
@@ -52,72 +53,32 @@
 
     public BulkResponse deleteAssociations(Collection associationKeys) throws JAXRException
     {
-        return null;
+        return this.deleteOperation(associationKeys,"DELETE_ASSOCIATION");
     }
 
     public BulkResponse deleteClassificationSchemes(Collection schemeKeys) throws JAXRException
     {
-        return null;
+        return this.deleteOperation(schemeKeys,"DELETE_CLASSIFICATIONSCHEME");
     }
 
     public BulkResponse deleteConcepts(Collection conceptKeys) throws JAXRException
     {
-        return null;
+        return this.deleteOperation(conceptKeys,"DELETE_CONCEPT");
     }
 
     public BulkResponse deleteOrganizations(Collection orgkeys) throws JAXRException
     {
-        //Now we need to convert the collection into a vector for juddi
-        BulkResponseImpl bulk = new BulkResponseImpl();
-        Vector keyvect = new Vector();
-
-        Collection coll = new ArrayList();
-        Collection exceptions = new ArrayList();
-
-        try
-        {
-            Iterator iter = orgkeys.iterator();
-            while (iter.hasNext())
-            {
-                Key key = (Key)iter.next();
-                keyvect.add(key.getId());
-            }
-            System.out.println("Method:del_business: ENlength=" + keyvect.size());
-            // Save business
-            DispositionReport bd = (DispositionReport) executeOperation(keyvect, "DELETE_ORG");
-
-            keyvect = bd.getResultVector();
-            System.out.println("After deleting Business. Obtained vector size:" + keyvect.size());
-            for (int i = 0; keyvect != null && i < keyvect.size(); i++)
-            {
-                Result result = (Result) keyvect.elementAt(i);
-                int errno = result.getErrno();
-                if(errno == 0) coll.addAll(orgkeys);
-                else
-                {
-                    ErrInfo errinfo = result.getErrInfo();
-                    DeleteException de = new DeleteException(errinfo.getErrCode()+":"+errinfo.getErrMsg());
-                    exceptions.add(de);
-                }
-            }
-
-            bulk.setCollection(coll);
-            bulk.setExceptions(exceptions);
-        } catch (Exception tran)
-        {
-            throw new JAXRException("Apache JAXR Impl:", tran);
-        }
-        return bulk;
+       return this.deleteOperation(orgkeys,"DELETE_ORG");
     }
 
     public BulkResponse deleteServiceBindings(Collection bindingKeys) throws JAXRException
     {
-        return null;
+       return this.deleteOperation(bindingKeys,"DELETE_SERVICEBINDING");
     }
 
     public BulkResponse deleteServices(Collection serviceKeys) throws JAXRException
     {
-        return null;
+        return this.deleteOperation(serviceKeys,"DELETE_SERVICE");
     }
 
     public BulkResponse saveAssociations(Collection associationKeys, boolean replace) throws JAXRException
@@ -140,7 +101,7 @@
             while (iter.hasNext())
             {
                 TModel en =
-                        getTModelFromJAXRClassificationScheme((ClassificationScheme) iter.next());
+                        ScoutJaxrUddiHelper.getTModelFromJAXRClassificationScheme((ClassificationScheme) iter.next());
                 entityvect.add(en);
             }
             System.out.println("Method:save_business: ENlength=" + entityvect.size());
@@ -179,7 +140,7 @@
             while (iter.hasNext())
             {
                 TModel en =
-                        getTModelFromJAXRConcept((Concept) iter.next());
+                        ScoutJaxrUddiHelper.getTModelFromJAXRConcept((Concept) iter.next());
                 entityvect.add(en);
             }
             System.out.println("Method:save_concept: ENlength=" + entityvect.size());
@@ -218,7 +179,7 @@
             while (iter.hasNext())
             {
                 BusinessEntity en =
-                        getBusinessEntityFromJAXROrg((Organization) iter.next());
+                        ScoutJaxrUddiHelper.getBusinessEntityFromJAXROrg((Organization) iter.next());
                 entityvect.add(en);
             }
             System.out.println("Method:save_business: ENlength=" + entityvect.size());
@@ -255,7 +216,7 @@
             Iterator iter = bindings.iterator();
             while (iter.hasNext())
             {
-                BindingTemplate bs = getBindingTemplateFromJAXRSB((ServiceBinding) iter.next());
+                BindingTemplate bs = ScoutJaxrUddiHelper.getBindingTemplateFromJAXRSB((ServiceBinding) iter.next());
                 sbvect.add(bs);
             }
             // Save ServiceBinding
@@ -289,7 +250,7 @@
             Iterator iter = services.iterator();
             while (iter.hasNext())
             {
-                BusinessService bs = getBusinessServiceFromJAXRService((Service) iter.next());
+                BusinessService bs = ScoutJaxrUddiHelper.getBusinessServiceFromJAXRService((Service) iter.next());
                 svect.add(bs);
             }
             // Save Service
@@ -346,284 +307,76 @@
         } else if (op.equalsIgnoreCase("DELETE_ORG"))
         {
             regobj = ireg.deleteBusiness(token.getAuthInfo(), datavect);
-        } else
-            throw new JAXRException("Unsupported operation:" + op);
-
-        return regobj;
-    }
-
-    //Private methods
-    private BusinessEntity getBusinessEntityFromJAXROrg(Organization org)
-            throws JAXRException
-    {
-        BusinessEntity biz = new BusinessEntity();
-        BusinessServices bss = new BusinessServices();
-        Contacts cts = new Contacts();
-        Vector bvect = new Vector();
-        Vector cvect = new Vector();
-
-        try
+        } else if (op.equalsIgnoreCase("DELETE_SERVICE"))
         {
-            //Lets get the Organization attributes at the top level
-            String language = Locale.getDefault().getLanguage();
-
-            biz.addName(new Name(org.getName().getValue(), language));
-            biz.addDescription(new Description(org.getDescription().getValue()));
-            if(org.getPrimaryContact() != null )
-                biz.setAuthorizedName(org.getPrimaryContact().getPersonName().getFullName());
-
-            Collection s = org.getServices();
-            System.out.println("?Org has services=" + s.isEmpty());
-            Iterator iter = s.iterator();
-            while (iter.hasNext())
-            {
-                BusinessService bs =
-                        getBusinessServiceFromJAXRService((Service) iter.next());
-                bvect.add(bs);
-            }
-
-            Collection users = org.getUsers();
-            System.out.println("?Org has users=" + users.isEmpty());
-            Iterator it = users.iterator();
-            while (it.hasNext())
-            {
-                Contact ct =
-                        getContactFromJAXRUser((User) it.next());
-                cvect.add(ct);
-            }
-
-            bss.setBusinessServiceVector(bvect);
-            cts.setContactVector(cvect);
-            biz.setContacts(cts);
-
-            biz.setBusinessServices(bss);
-        } catch (Exception ud)
+            regobj = ireg.deleteService(token.getAuthInfo(), datavect);
+        }else if (op.equalsIgnoreCase("DELETE_SERVICEBINDING"))
         {
-            throw new JAXRException("Apache JAXR Impl:", ud);
-        }
-        return biz;
-    }
-
-    /**
-     * Convert JAXR User Object to UDDI  Contact
-     */
-    private Contact getContactFromJAXRUser(User user)
-            throws JAXRException
-    {
-        Contact ct = new Contact();
-        Vector addvect = new Vector();
-        Vector phonevect = new Vector();
-        Vector emailvect = new Vector();
-        try
+            regobj = ireg.deleteBinding(token.getAuthInfo(), datavect);
+        }else if (op.equalsIgnoreCase("DELETE_CONCEPT"))
         {
-            ct.setPersonName(new PersonName(user.getPersonName().getFullName()));
-            //Postal Address
-            Collection postc = user.getPostalAddresses();
-            Iterator iterator = postc.iterator();
-            while (iterator.hasNext())
-            {
-                PostalAddress post = (PostalAddress) iterator.next();
-                addvect.add(getAddress(post));
-            }
-            //Phone Numbers
-            Collection ph = user.getTelephoneNumbers(null);
-            Iterator it = ph.iterator();
-            while (it.hasNext())
-            {
-                TelephoneNumber t = (TelephoneNumber) it.next();
-                Phone phone = new Phone();
-                String str = t.getNumber();
-                System.out.println("Telephone=" + str);
-                phone.setValue(str);
-                // phone.setText( str );
-                phonevect.add(phone);
-            }
-
-            //Email Addresses
-            Collection ec = user.getEmailAddresses();
-            Iterator iter = ec.iterator();
-            while (iter.hasNext())
-            {
-                EmailAddress ea = (EmailAddress) iter.next();
-                Email email = new Email();
-                email.setValue(ea.getAddress());
-                //email.setText( ea.getAddress() );
-                email.setUseType(ea.getType());
-                emailvect.add(email);
-            }
-            ct.setAddressVector(addvect);
-            ct.setPhoneVector(phonevect);
-            ct.setEmailVector(emailvect);
-        } catch (Exception ud)
+            regobj = ireg.deleteTModel(token.getAuthInfo(), datavect);
+        } else if (op.equalsIgnoreCase("DELETE_ASSOCIATION"))
         {
-            throw new JAXRException("Apache JAXR Impl:", ud);
+            regobj = ireg.deletePublisherAssertions(token.getAuthInfo(), datavect);
         }
-        return ct;
-    }
-
-    /**
-     * Get UDDI Address given JAXR Postal Address
-     */
-    private Address getAddress(PostalAddress post)
-            throws JAXRException
-    {
-        Address address = new Address();
-
-        Vector addvect = new Vector();
-
-        String stnum = post.getStreetNumber();
-        String st = post.getStreet();
-        String city = post.getCity();
-        String country = post.getCountry();
-        String code = post.getPostalCode();
-        String state = post.getStateOrProvince();
-
-        AddressLine stnumAL = new AddressLine();
-        stnumAL.setKeyName("STREET_NUMBER");
-        stnumAL.setKeyValue(stnum);
-
-        AddressLine stAL = new AddressLine();
-        stAL.setKeyName("STREET");
-        stAL.setKeyValue(st);
-
-        AddressLine cityAL = new AddressLine();
-        cityAL.setKeyName("CITY");
-        cityAL.setKeyValue(city);
-
-        AddressLine countryAL = new AddressLine();
-        countryAL.setKeyName("COUNTRY");
-        countryAL.setKeyValue(country);
+        else if (op.equalsIgnoreCase("DELETE_CLASSIFICATIONSCHEME"))
+        {
+            regobj = ireg.deleteTModel(token.getAuthInfo(), datavect);
+        } else
+            throw new JAXRException("Unsupported operation:" + op);
 
-        AddressLine codeAL = new AddressLine();
-        codeAL.setKeyName("POSTALCODE");
-        codeAL.setKeyValue(code);
+        return regobj;
 
-        AddressLine stateAL = new AddressLine();
-        stateAL.setKeyName("STATE");
-        stateAL.setKeyValue(state);
+    }
 
-        //Add the AddressLine to vector
-        addvect.add(stnumAL);
-        addvect.add(stAL);
-        addvect.add(cityAL);
-        addvect.add(countryAL);
-        addvect.add(codeAL);
-        addvect.add(stateAL);
 
-        address.setAddressLineVector(addvect);
+    protected BulkResponse deleteOperation(Collection keys, String op)
+    throws JAXRException
+    {
+      //Now we need to convert the collection into a vector for juddi
+        BulkResponseImpl bulk = new BulkResponseImpl();
+        Vector keyvect = new Vector();
 
-        return address;
-    }
+        Collection coll = new ArrayList();
+        Collection exceptions = new ArrayList();
 
-    private BindingTemplate getBindingTemplateFromJAXRSB(ServiceBinding serve)
-            throws JAXRException
-    {
-        BindingTemplate bt = new BindingTemplate();
         try
         {
-            InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) serve).getName();
-            String name = iname.getValue();
-            //Set Access URI
-            String accessuri = serve.getAccessURI();
-            if (accessuri != null)
+            Iterator iter = keys.iterator();
+            while (iter.hasNext())
             {
-                AccessPoint ap = new AccessPoint();
-                ap.setURL(accessuri);
-                bt.setAccessPoint(ap);
+                Key key = (Key)iter.next();
+                keyvect.add(key.getId());
             }
-            ServiceBinding sb = serve.getTargetBinding();
-            if (sb != null)
+            System.out.println("Method:"+op+": ENlength=" + keyvect.size());
+            // Save business
+            DispositionReport bd = (DispositionReport) executeOperation(keyvect, op);
+
+            keyvect = bd.getResultVector();
+            System.out.println("After deleting Business. Obtained vector size:" + keyvect.size());
+            for (int i = 0; keyvect != null && i < keyvect.size(); i++)
             {
-                HostingRedirector red = new HostingRedirector();
-                Key key = sb.getKey();
-                if( key != null) red.setBindingKey(key.getId());
-                bt.setHostingRedirector(red);
+                Result result = (Result) keyvect.elementAt(i);
+                int errno = result.getErrno();
+                if(errno == 0) coll.addAll(keys);
+                else
+                {
+                    ErrInfo errinfo = result.getErrInfo();
+                    DeleteException de = new DeleteException(errinfo.getErrCode()+":"+errinfo.getErrMsg());
+                    exceptions.add(de);
+                }
             }
-            //TODO:Need to look further at the mapping b/w BindingTemplate and Jaxr ServiceBinding
-
-
-            bt.addDescription(new Description(((RegistryObject) serve).getDescription().getValue()));
-            System.out.println("BindingTemplate=" + bt.toString());
-        } catch (Exception ud)
-        {
-            throw new JAXRException("Apache JAXR Impl:", ud);
-        }
-        return bt;
-    }
-
-    private BusinessService getBusinessServiceFromJAXRService(Service serve)
-            throws JAXRException
-    {
-        BusinessService bs = new BusinessService();
-        try
-        {
-            InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) serve).getName();
-            String name = iname.getValue();
-            //bs.setDefaultNameString( name, Locale.getDefault().getLanguage());
-            bs.addName(new Name(name, Locale.getDefault().getLanguage()));
-            /**
-             bs.setBusinessKey( ((RegistryObject) serve).getKey().getId() );
-             **/
-
-            bs.addDescription(new Description(((RegistryObject) serve).getDescription().getValue()));
-            System.out.println("BusinessService=" + bs.toString());
-        } catch (Exception ud)
-        {
-            throw new JAXRException("Apache JAXR Impl:", ud);
-        }
-        return bs;
-    }
-
-    private TModel getTModelFromJAXRClassificationScheme(ClassificationScheme scheme)
-            throws JAXRException
-    {
-        TModel tm = new TModel();
-        try
-        {
-            tm.setTModelKey(scheme.getKey().getId());
-            tm.setAuthorizedName(scheme.getSlot("authorizedName").getName());
-            tm.setOperator(scheme.getSlot("operator").getName());
 
-
-            InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) scheme).getName();
-            String name = iname.getValue();
-            tm.setName(new Name(name, Locale.getDefault().getLanguage()));
-            tm.addDescription(new Description( scheme.getDescription().getValue()));
-            //ToDO:  overviewDoc,identifierBag,categoryBag
-        } catch (Exception ud)
+            bulk.setCollection(coll);
+            bulk.setExceptions(exceptions);
+        } catch (Exception tran)
         {
-            throw new JAXRException("Apache JAXR Impl:", ud);
+            throw new JAXRException("Apache JAXR Impl:", tran);
         }
-        return tm;
+        return bulk;
     }
 
-    private TModel getTModelFromJAXRConcept(Concept scheme)
-            throws JAXRException
-    {
-        TModel tm = new TModel();
-        if(scheme == null ) return null;
-        try
-        {
-            Key key = scheme.getKey();
-            if(key != null) tm.setTModelKey(key.getId());
-            Slot sl1 = scheme.getSlot("authorizedName");
-            if( sl1 != null ) tm.setAuthorizedName(sl1.getName());
-
-            Slot sl2 = scheme.getSlot("operator");
-            if( sl2 != null ) tm.setOperator(sl2.getName());
-
-
-            InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) scheme).getName();
-            String name = iname.getValue();
-            tm.setName(new Name(name, Locale.getDefault().getLanguage()));
-            tm.addDescription(new Description( scheme.getDescription().getValue()));
-            //ToDO:  overviewDoc,identifierBag,categoryBag
-        } catch (Exception ud)
-        {
-            throw new JAXRException("Apache JAXR Impl:", ud);
-        }
-        return tm;
-    }
 
     /**
      * Get the Auth Token from the registry

Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java?view=diff&rev=125361&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java&r1=125360&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java&r2=125361
==============================================================================
--- webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java	(original)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java	Sun Jan 16 11:03:24 2005
@@ -18,15 +18,23 @@
 
 import org.apache.juddi.IRegistry;
 import org.apache.juddi.datatype.Name;
-import org.apache.juddi.datatype.tmodel.TModel;
 import org.apache.juddi.datatype.request.FindQualifiers;
 import org.apache.juddi.datatype.response.BusinessInfo;
 import org.apache.juddi.datatype.response.BusinessList;
+import org.apache.juddi.datatype.response.BusinessDetail;
+import org.apache.juddi.datatype.tmodel.TModel;
 import org.apache.juddi.error.RegistryException;
 import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
 import org.apache.ws.scout.registry.infomodel.KeyImpl;
+import org.apache.ws.scout.util.ScoutUddiJaxrHelper;
 
-import javax.xml.registry.*;
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessQueryManager;
+import javax.xml.registry.FindQualifier;
+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.ClassificationScheme;
 import javax.xml.registry.infomodel.Concept;
 import javax.xml.registry.infomodel.Key;
@@ -41,120 +49,204 @@
 /**
  * Implements the JAXR BusinessQueryManager Interface
  * For futher details, look into the JAXR API Javadoc.
+ *
  * @author Anil Saldhana  <anil@apache.org>
  * @author Jeremy Boynes  <jboynes@apache.org>
  */
-public class BusinessQueryManagerImpl implements BusinessQueryManager {
+public class BusinessQueryManagerImpl implements BusinessQueryManager
+{
     private final RegistryServiceImpl registryService;
 
-    public BusinessQueryManagerImpl(RegistryServiceImpl registry) {
+
+    public BusinessQueryManagerImpl(RegistryServiceImpl registry)
+    {
         this.registryService = registry;
     }
 
-    public RegistryService getRegistryService() {
+    public RegistryService getRegistryService()
+    {
         return registryService;
     }
 
-    public BulkResponse findOrganizations(Collection findQualifiers, Collection namePatterns, Collection classifications, Collection specifications, Collection externalIdentifiers, Collection externalLinks) throws JAXRException {
+    public BulkResponse findOrganizations(Collection findQualifiers,
+                                          Collection namePatterns,
+                                          Collection classifications,
+                                          Collection specifications,
+                                          Collection externalIdentifiers,
+                                          Collection externalLinks) throws JAXRException
+    {
         IRegistry registry = registryService.getRegistry();
-        try {
+        try
+        {
             FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
             Vector nameVector = mapNamePatterns(namePatterns);
-            BusinessList result = registry.findBusiness(nameVector, null, null, null, null, juddiFindQualifiers, registryService.getMaxRows());
+            BusinessList result = registry.findBusiness(nameVector,
+                                                   null, null, null, null,
+                                                   juddiFindQualifiers,
+                                                   registryService.getMaxRows());
             Vector v = result.getBusinessInfos().getBusinessInfoVector();
             Collection orgs = null;
             int len = 0;
-            if( v!= null )
+            if (v != null)
             {
                 len = v.size();
                 orgs = new ArrayList(len);
             }
-            for (int i = 0; i < len; i++) {
+            for (int i = 0; i < len; i++)
+            {
                 BusinessInfo info = (BusinessInfo) v.elementAt(i);
                 orgs.add(registryService.getLifeCycleManagerImpl().createOrganization(info));
             }
             return new BulkResponseImpl(orgs);
-        } catch (RegistryException e) {
+        } catch (RegistryException e)
+        {
             throw new JAXRException(e);
         }
     }
 
-    public BulkResponse findAssociations(Collection findQualifiers, String sourceObjectId, String targetObjectId, Collection associationTypes) throws JAXRException {
+    public BulkResponse findAssociations(Collection findQualifiers,
+                                         String sourceObjectId,
+                                         String targetObjectId,
+                                         Collection associationTypes) throws JAXRException
+    {
         return null;
     }
 
-    public BulkResponse findCallerAssociations(Collection findQualifiers, Boolean confirmedByCaller, Boolean confirmedByOtherParty, Collection associationTypes) throws JAXRException {
+    public BulkResponse findCallerAssociations(Collection findQualifiers,
+                                               Boolean confirmedByCaller,
+                                               Boolean confirmedByOtherParty,
+                                               Collection associationTypes) throws JAXRException
+    {
         return null;
     }
 
-    public ClassificationScheme findClassificationSchemeByName(Collection findQualifiers, String namePatterns) throws JAXRException {
+    public ClassificationScheme findClassificationSchemeByName(Collection findQualifiers,
+                                                               String namePatterns) throws JAXRException
+    {
         ClassificationScheme scheme = null;
         //TODO:What to do with findQualifiers?
-        if(namePatterns.equalsIgnoreCase("uddi-org:types"))
+        if (namePatterns.equalsIgnoreCase("uddi-org:types"))
         {
             scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
             scheme.setKey(new KeyImpl(TModel.TYPES_TMODEL_KEY));
+        } else if (namePatterns.equalsIgnoreCase("dnb-com:D-U-N-S"))
+        {
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setKey(new KeyImpl(TModel.D_U_N_S_TMODEL_KEY));
+        } else if (namePatterns.equalsIgnoreCase("uddi-org:iso-ch:3166:1999"))
+        {
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setKey(new KeyImpl(TModel.ISO_CH_TMODEL_KEY));
+        } else if (namePatterns.equalsIgnoreCase("unspsc-org:unspsc"))
+        {
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setKey(new KeyImpl(TModel.UNSPSC_TMODEL_KEY));
+        } else if (namePatterns.equalsIgnoreCase("ntis-gov:naics"))
+        {
+            scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+            scheme.setKey(new KeyImpl(TModel.NAICS_TMODEL_KEY));
         }
         return scheme;
     }
 
-    public BulkResponse findClassificationSchemes(Collection findQualifiers, Collection namePatterns, Collection classifications, Collection externalLinks) throws JAXRException {
+    public BulkResponse findClassificationSchemes(Collection findQualifiers,
+                                                  Collection namePatterns,
+                                                  Collection classifications,
+                                                  Collection externalLinks) throws JAXRException
+    {
         return null;
     }
 
-    public Concept findConceptByPath(String path) throws JAXRException {
+    public Concept findConceptByPath(String path) throws JAXRException
+    {
         return null;
     }
 
-    public BulkResponse findConcepts(Collection findQualifiers, Collection namePatterns, Collection classifications, Collection externalIdentifiers, Collection externalLinks) throws JAXRException {
+    public BulkResponse findConcepts(Collection findQualifiers,
+                                     Collection namePatterns,
+                                     Collection classifications,
+                                     Collection externalIdentifiers,
+                                     Collection externalLinks) throws JAXRException
+    {
         return null;
     }
 
-    public BulkResponse findRegistryPackages(Collection findQualifiers, Collection namePatterns, Collection classifications, Collection externalLinks) throws JAXRException {
+    public BulkResponse findRegistryPackages(Collection findQualifiers,
+                                             Collection namePatterns,
+                                             Collection classifications,
+                                             Collection externalLinks) throws JAXRException
+    {
         return null;
     }
 
-    public BulkResponse findServiceBindings(Key serviceKey, Collection findQualifiers, Collection classifications, Collection specificationa) throws JAXRException {
+    public BulkResponse findServiceBindings(Key serviceKey,
+                                            Collection findQualifiers,
+                                            Collection classifications,
+                                            Collection specifications) throws JAXRException
+    {
         return null;
     }
 
-    public BulkResponse findServices(Key orgKey, Collection findQualifiers, Collection namePattersn, Collection classifications, Collection specificationa) throws JAXRException {
+    public BulkResponse findServices(Key orgKey, Collection findQualifiers,
+                                     Collection namePattersn,
+                                     Collection classifications,
+                                     Collection specificationa) throws JAXRException
+    {
         return null;
     }
 
-    public RegistryObject getRegistryObject(String id) throws JAXRException {
+    public RegistryObject getRegistryObject(String id) throws JAXRException
+    {
         return null;
     }
 
-    public RegistryObject getRegistryObject(String id, String objectType) throws JAXRException {
+    public RegistryObject getRegistryObject(String id, String objectType) throws JAXRException
+    {
+        IRegistry registry = registryService.getRegistry();
         RegistryObject regobj = null;
-        if(LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType))
+        if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType))
         {
             regobj = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
             regobj.setKey(new KeyImpl(id));
+        }if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType))
+        {
+            //Get the Organization from the uddi registry
+            try
+            {
+                BusinessDetail orgdetail = registry.getBusinessDetail(id);
+                regobj = (RegistryObject)ScoutUddiJaxrHelper.getOrganization(orgdetail,registryService.getBusinessLifeCycleManager());
+            } catch (RegistryException e)
+            {
+                e.printStackTrace();
+            }
         }
         return regobj;
     }
 
-    public BulkResponse getRegistryObjects() throws JAXRException {
+    public BulkResponse getRegistryObjects() throws JAXRException
+    {
         return null;
     }
 
-    public BulkResponse getRegistryObjects(Collection objectKeys) throws JAXRException {
+    public BulkResponse getRegistryObjects(Collection objectKeys) throws JAXRException
+    {
         return null;
     }
 
-    public BulkResponse getRegistryObjects(Collection objectKeys, String objectTypes) throws JAXRException {
+    public BulkResponse getRegistryObjects(Collection objectKeys, String objectTypes) throws JAXRException
+    {
         return null;
     }
 
-    public BulkResponse getRegistryObjects(String objectTypes) throws JAXRException {
+    public BulkResponse getRegistryObjects(String objectTypes) throws JAXRException
+    {
         return null;
     }
 
     private static final Map findQualifierMapping;
 
-    static {
+    static
+    {
         findQualifierMapping = new HashMap();
         findQualifierMapping.put(FindQualifier.AND_ALL_KEYS, new org.apache.juddi.datatype.request.FindQualifier(org.apache.juddi.datatype.request.FindQualifier.AND_ALL_KEYS));
         findQualifierMapping.put(FindQualifier.CASE_SENSITIVE_MATCH, new org.apache.juddi.datatype.request.FindQualifier(org.apache.juddi.datatype.request.FindQualifier.CASE_SENSITIVE_MATCH));
@@ -170,16 +262,20 @@
 //        findQualifierMapping.put(FindQualifier.SOUNDEX, null);
     }
 
-    static FindQualifiers mapFindQualifiers(Collection jaxrQualifiers) throws UnsupportedCapabilityException {
-        if (jaxrQualifiers == null) {
+    static FindQualifiers mapFindQualifiers(Collection jaxrQualifiers) throws UnsupportedCapabilityException
+    {
+        if (jaxrQualifiers == null)
+        {
             return null;
         }
         FindQualifiers result = new FindQualifiers(jaxrQualifiers.size());
-        for (Iterator i = jaxrQualifiers.iterator(); i.hasNext();) {
+        for (Iterator i = jaxrQualifiers.iterator(); i.hasNext();)
+        {
             String jaxrQualifier = (String) i.next();
             org.apache.juddi.datatype.request.FindQualifier juddiQualifier =
                     (org.apache.juddi.datatype.request.FindQualifier) findQualifierMapping.get(jaxrQualifier);
-            if (juddiQualifier == null) {
+            if (juddiQualifier == null)
+            {
                 throw new UnsupportedCapabilityException("jUDDI does not support FindQualifer: " + jaxrQualifier);
             }
             result.addFindQualifier(juddiQualifier);
@@ -187,11 +283,13 @@
         return result;
     }
 
-    static Vector mapNamePatterns(Collection namePatterns) {
+    static Vector mapNamePatterns(Collection namePatterns)
+    {
         if (namePatterns == null)
             return null;
         Vector result = new Vector(namePatterns.size());
-        for (Iterator i = namePatterns.iterator(); i.hasNext();) {
+        for (Iterator i = namePatterns.iterator(); i.hasNext();)
+        {
             String pattern = (String) i.next();
             result.add(new Name(pattern));
         }

Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalLinkImpl.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalLinkImpl.java?view=diff&rev=125361&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalLinkImpl.java&r1=125360&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalLinkImpl.java&r2=125361
==============================================================================
--- webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalLinkImpl.java	(original)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalLinkImpl.java	Sun Jan 16 11:03:24 2005
@@ -31,7 +31,6 @@
         implements javax.xml.registry.infomodel.ExternalLink {
     private String uri = new String();
     private boolean validateuri = false;
-    private Collection links = new ArrayList();
 
     /**
      * Creates a new instance of ExternalLinkImpl
@@ -45,7 +44,7 @@
     }
 
     public Collection getLinkedObjects() throws JAXRException {
-        return links;
+        throw new javax.xml.registry.InvalidRequestException("Not supported in UDDI");
     }
 
     public boolean getValidateURI() throws JAXRException {

Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/InternationalStringImpl.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/InternationalStringImpl.java?view=diff&rev=125361&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/InternationalStringImpl.java&r1=125360&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/InternationalStringImpl.java&r2=125361
==============================================================================
--- webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/InternationalStringImpl.java	(original)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/InternationalStringImpl.java	Sun Jan 16 11:03:24 2005
@@ -40,6 +40,13 @@
     public InternationalStringImpl() {
     }
 
+    public InternationalStringImpl(String str)
+    {
+        Locale locale = Locale.getDefault();
+        map.put(new MapKey(locale, LocalizedString.DEFAULT_CHARSET_NAME), new LocalizedStringImpl(locale, str, LocalizedString.DEFAULT_CHARSET_NAME));
+
+    }
+
     public InternationalStringImpl(Locale locale, String str, String charsetName) {
         MapKey mapKey = new MapKey(locale, charsetName);
         map.put(mapKey, new LocalizedStringImpl(locale, str, charsetName));

Added: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java?view=auto&rev=125361
==============================================================================
--- (empty file)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java	Sun Jan 16 11:03:24 2005
@@ -0,0 +1,348 @@
+/**
+ *
+ * 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 org.apache.juddi.datatype.Address;
+import org.apache.juddi.datatype.AddressLine;
+import org.apache.juddi.datatype.Description;
+import org.apache.juddi.datatype.Name;
+import org.apache.juddi.datatype.DiscoveryURL;
+import org.apache.juddi.datatype.PersonName;
+import org.apache.juddi.datatype.Phone;
+import org.apache.juddi.datatype.Email;
+import org.apache.juddi.datatype.business.BusinessEntity;
+import org.apache.juddi.datatype.business.Contacts;
+import org.apache.juddi.datatype.business.Contact;
+import org.apache.juddi.datatype.tmodel.TModel;
+import org.apache.juddi.datatype.service.BusinessService;
+import org.apache.juddi.datatype.service.BusinessServices;
+import org.apache.juddi.datatype.binding.BindingTemplate;
+import org.apache.juddi.datatype.binding.AccessPoint;
+import org.apache.juddi.datatype.binding.HostingRedirector;
+import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
+
+import javax.xml.registry.infomodel.PostalAddress;
+import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.Slot;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.User;
+import javax.xml.registry.infomodel.ExternalLink;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.EmailAddress;
+import javax.xml.registry.JAXRException;
+import java.util.Vector;
+import java.util.Locale;
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Helper class that does Jaxr->UDDI Mapping
+ *
+ * @author Anil Saldhana  <anil@apache.org>
+ */
+public class ScoutJaxrUddiHelper
+{
+    /**
+     * Get UDDI Address given JAXR Postal Address
+     */
+    public static Address getAddress(PostalAddress post)
+            throws JAXRException
+    {
+        Address address = new Address();
+
+        Vector addvect = new Vector();
+
+        String stnum = post.getStreetNumber();
+        String st = post.getStreet();
+        String city = post.getCity();
+        String country = post.getCountry();
+        String code = post.getPostalCode();
+        String state = post.getStateOrProvince();
+
+        AddressLine stnumAL = new AddressLine();
+        stnumAL.setKeyName("STREET_NUMBER");
+        stnumAL.setKeyValue(stnum);
+
+        AddressLine stAL = new AddressLine();
+        stAL.setKeyName("STREET");
+        stAL.setKeyValue(st);
+
+        AddressLine cityAL = new AddressLine();
+        cityAL.setKeyName("CITY");
+        cityAL.setKeyValue(city);
+
+        AddressLine countryAL = new AddressLine();
+        countryAL.setKeyName("COUNTRY");
+        countryAL.setKeyValue(country);
+
+        AddressLine codeAL = new AddressLine();
+        codeAL.setKeyName("POSTALCODE");
+        codeAL.setKeyValue(code);
+
+        AddressLine stateAL = new AddressLine();
+        stateAL.setKeyName("STATE");
+        stateAL.setKeyValue(state);
+
+        //Add the AddressLine to vector
+        addvect.add(stnumAL);
+        addvect.add(stAL);
+        addvect.add(cityAL);
+        addvect.add(countryAL);
+        addvect.add(codeAL);
+        addvect.add(stateAL);
+
+        address.setAddressLineVector(addvect);
+
+        return address;
+    }
+
+    public static BindingTemplate getBindingTemplateFromJAXRSB(ServiceBinding serve)
+            throws JAXRException
+    {
+        BindingTemplate bt = new BindingTemplate();
+        try
+        {
+            InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) serve).getName();
+            String name = iname.getValue();
+            //Set Access URI
+            String accessuri = serve.getAccessURI();
+            if (accessuri != null)
+            {
+                AccessPoint ap = new AccessPoint();
+                ap.setURL(accessuri);
+                bt.setAccessPoint(ap);
+            }
+            ServiceBinding sb = serve.getTargetBinding();
+            if (sb != null)
+            {
+                HostingRedirector red = new HostingRedirector();
+                Key key = sb.getKey();
+                if( key != null) red.setBindingKey(key.getId());
+                bt.setHostingRedirector(red);
+            }
+            //TODO:Need to look further at the mapping b/w BindingTemplate and Jaxr ServiceBinding
+
+
+            bt.addDescription(new Description(((RegistryObject) serve).getDescription().getValue()));
+            System.out.println("BindingTemplate=" + bt.toString());
+        } catch (Exception ud)
+        {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return bt;
+    }
+
+    public static BusinessService getBusinessServiceFromJAXRService(Service serve)
+            throws JAXRException
+    {
+        BusinessService bs = new BusinessService();
+        try
+        {
+            InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) serve).getName();
+            String name = iname.getValue();
+            //bs.setDefaultNameString( name, Locale.getDefault().getLanguage());
+            bs.addName(new Name(name, Locale.getDefault().getLanguage()));
+            /**
+             bs.setBusinessKey( ((RegistryObject) serve).getKey().getId() );
+             **/
+
+            bs.addDescription(new Description(((RegistryObject) serve).getDescription().getValue()));
+            System.out.println("BusinessService=" + bs.toString());
+        } catch (Exception ud)
+        {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return bs;
+    }
+
+    public static TModel getTModelFromJAXRClassificationScheme(ClassificationScheme scheme)
+            throws JAXRException
+    {
+        TModel tm = new TModel();
+        try
+        {
+            tm.setTModelKey(scheme.getKey().getId());
+            tm.setAuthorizedName(scheme.getSlot("authorizedName").getName());
+            tm.setOperator(scheme.getSlot("operator").getName());
+
+
+            InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) scheme).getName();
+            String name = iname.getValue();
+            tm.setName(new Name(name, Locale.getDefault().getLanguage()));
+            tm.addDescription(new Description( scheme.getDescription().getValue()));
+            //ToDO:  overviewDoc,identifierBag,categoryBag
+        } catch (Exception ud)
+        {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return tm;
+    }
+
+    public static TModel getTModelFromJAXRConcept(Concept scheme)
+            throws JAXRException
+    {
+        TModel tm = new TModel();
+        if(scheme == null ) return null;
+        try
+        {
+            Key key = scheme.getKey();
+            if(key != null) tm.setTModelKey(key.getId());
+            Slot sl1 = scheme.getSlot("authorizedName");
+            if( sl1 != null ) tm.setAuthorizedName(sl1.getName());
+
+            Slot sl2 = scheme.getSlot("operator");
+            if( sl2 != null ) tm.setOperator(sl2.getName());
+
+
+            InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) scheme).getName();
+            String name = iname.getValue();
+            tm.setName(new Name(name, Locale.getDefault().getLanguage()));
+            tm.addDescription(new Description( scheme.getDescription().getValue()));
+            //ToDO:  overviewDoc,identifierBag,categoryBag
+        } catch (Exception ud)
+        {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return tm;
+    }
+
+    public static BusinessEntity getBusinessEntityFromJAXROrg(Organization org)
+            throws JAXRException
+    {
+        BusinessEntity biz = new BusinessEntity();
+        BusinessServices bss = new BusinessServices();
+        Contacts cts = new Contacts();
+        Vector bvect = new Vector();
+        Vector cvect = new Vector();
+
+        try
+        {
+            //It may just be an update
+            Key key = org.getKey();
+            if(key  != null ) biz.setBusinessKey(key.getId());
+            //Lets get the Organization attributes at the top level
+            String language = Locale.getDefault().getLanguage();
+
+            biz.addName(new Name(org.getName().getValue(), language));
+            biz.addDescription(new Description(org.getDescription().getValue()));
+            if(org.getPrimaryContact() != null )
+                biz.setAuthorizedName(org.getPrimaryContact().getPersonName().getFullName());
+
+            Collection s = org.getServices();
+            System.out.println("?Org has services=" + s.isEmpty());
+            Iterator iter = s.iterator();
+            while (iter.hasNext())
+            {
+                BusinessService bs =
+                        ScoutJaxrUddiHelper.getBusinessServiceFromJAXRService((Service) iter.next());
+                bvect.add(bs);
+            }
+
+            Collection users = org.getUsers();
+            System.out.println("?Org has users=" + users.isEmpty());
+            Iterator it = users.iterator();
+            while (it.hasNext())
+            {
+                Contact ct =
+                        getContactFromJAXRUser((User) it.next());
+                cvect.add(ct);
+            }
+
+            bss.setBusinessServiceVector(bvect);
+            cts.setContactVector(cvect);
+            biz.setContacts(cts);
+
+            biz.setBusinessServices(bss);
+
+            //External Links
+            Iterator exiter = org.getExternalLinks().iterator();
+            while(exiter.hasNext())
+            {
+               ExternalLink link = (ExternalLink)exiter.next();
+               /**Note: jUDDI add its own discoverURL as the businessEntity**/
+               biz.addDiscoveryURL(new DiscoveryURL("businessEntityExt",link.getExternalURI()));
+            }
+        } 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 = new Contact();
+        Vector addvect = new Vector();
+        Vector phonevect = new Vector();
+        Vector emailvect = new Vector();
+        try
+        {
+            ct.setPersonName(new PersonName(user.getPersonName().getFullName()));
+            //Postal Address
+            Collection postc = user.getPostalAddresses();
+            Iterator iterator = postc.iterator();
+            while (iterator.hasNext())
+            {
+                PostalAddress post = (PostalAddress) iterator.next();
+                addvect.add(ScoutJaxrUddiHelper.getAddress(post));
+            }
+            //Phone Numbers
+            Collection ph = user.getTelephoneNumbers(null);
+            Iterator it = ph.iterator();
+            while (it.hasNext())
+            {
+                TelephoneNumber t = (TelephoneNumber) it.next();
+                Phone phone = new Phone();
+                String str = t.getNumber();
+                System.out.println("Telephone=" + str);
+                phone.setValue(str);
+                // phone.setText( str );
+                phonevect.add(phone);
+            }
+
+            //Email Addresses
+            Collection ec = user.getEmailAddresses();
+            Iterator iter = ec.iterator();
+            while (iter.hasNext())
+            {
+                EmailAddress ea = (EmailAddress) iter.next();
+                Email email = new Email();
+                email.setValue(ea.getAddress());
+                //email.setText( ea.getAddress() );
+                email.setUseType(ea.getType());
+                emailvect.add(email);
+            }
+            ct.setAddressVector(addvect);
+            ct.setPhoneVector(phonevect);
+            ct.setEmailVector(emailvect);
+        } catch (Exception ud)
+        {
+            throw new JAXRException("Apache JAXR Impl:", ud);
+        }
+        return ct;
+    }
+
+}

Added: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java?view=auto&rev=125361
==============================================================================
--- (empty file)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java	Sun Jan 16 11:03:24 2005
@@ -0,0 +1,93 @@
+/**
+ *
+ * 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 org.apache.juddi.datatype.Address;
+import org.apache.juddi.datatype.AddressLine;
+import org.apache.juddi.datatype.Description;
+import org.apache.juddi.datatype.DiscoveryURL;
+import org.apache.juddi.datatype.Email;
+import org.apache.juddi.datatype.Name;
+import org.apache.juddi.datatype.PersonName;
+import org.apache.juddi.datatype.Phone;
+import org.apache.juddi.datatype.binding.AccessPoint;
+import org.apache.juddi.datatype.binding.BindingTemplate;
+import org.apache.juddi.datatype.binding.HostingRedirector;
+import org.apache.juddi.datatype.business.BusinessEntity;
+import org.apache.juddi.datatype.business.Contact;
+import org.apache.juddi.datatype.business.Contacts;
+import org.apache.juddi.datatype.response.BusinessDetail;
+import org.apache.juddi.datatype.service.BusinessService;
+import org.apache.juddi.datatype.service.BusinessServices;
+import org.apache.juddi.datatype.tmodel.TModel;
+import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
+import org.apache.ws.scout.registry.infomodel.OrganizationImpl;
+
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.EmailAddress;
+import javax.xml.registry.infomodel.ExternalLink;
+import javax.xml.registry.infomodel.Key;
+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.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
+import javax.xml.registry.infomodel.InternationalString;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Vector;
+
+/**
+ * Helper class that does UDDI->Jaxr Mapping
+ *
+ * @author Anil Saldhana  <anil@apache.org>
+ */
+public class ScoutUddiJaxrHelper
+{
+    public static Organization getOrganization(BusinessDetail bizdetail,
+                                               LifeCycleManager lcm)
+            throws JAXRException
+    {
+        Vector bz = bizdetail.getBusinessEntityVector();
+        BusinessEntity entity = (BusinessEntity) bz.elementAt(0);
+        Vector namevect = entity.getNameVector();
+        Name n = (Name)namevect.elementAt(0);
+        String name = n.getValue() ;
+        Vector descvect = entity.getDescriptionVector();
+        Description desc = (Description)descvect.elementAt(0);
+
+        Organization org = new OrganizationImpl(lcm);
+        org.setName(getIString(name,lcm));
+        org.setDescription(getIString((String)desc.getValue(),lcm));
+        org.setKey(lcm.createKey(entity.getBusinessKey()));
+        return org;
+    }
+
+    public static InternationalString getIString(String str, LifeCycleManager blm)
+            throws JAXRException
+    {
+        return blm.createInternationalString(str);
+    }
+
+}

Deleted: /webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Delete/DeleteOrgTest.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Delete/DeleteOrgTest.java?view=auto&rev=125360
==============================================================================

Modified: webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Publish/PublishConceptTest.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Publish/PublishConceptTest.java?view=diff&rev=125361&p1=webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Publish/PublishConceptTest.java&r1=125360&p2=webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Publish/PublishConceptTest.java&r2=125361
==============================================================================
--- webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Publish/PublishConceptTest.java	(original)
+++ webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/Publish/PublishConceptTest.java	Sun Jan 16 11:03:24 2005
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.ws.scout.registry.Publish;
+package org.apache.ws.scout.registry.publish;
 
 import junit.framework.TestCase;
 
@@ -122,11 +122,13 @@
                 {
                     Exception e = (Exception) iter.next();
                     System.err.println(e.toString());
+                    fail(e.toString());
                 }
             }
         } catch (JAXRException e)
         {
             e.printStackTrace();
+            fail(e.getMessage());
         }
     }
 

Added: webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/query/JAXRQueryTest.java
Url: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/query/JAXRQueryTest.java?view=auto&rev=125361
==============================================================================
--- (empty file)
+++ webservices/scout/trunk/modules/scout/src/test/org/apache/ws/scout/registry/query/JAXRQueryTest.java	Sun Jan 16 11:03:24 2005
@@ -0,0 +1,202 @@
+/**
+ *
+ * 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.query;
+
+import junit.framework.TestCase;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessQueryManager;
+import javax.xml.registry.Connection;
+import javax.xml.registry.ConnectionFactory;
+import javax.xml.registry.FindQualifier;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.infomodel.EmailAddress;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.PersonName;
+import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+/**
+ * Testcase for JaxrQuery
+ * @author <mailto:dims@yahoo.com>Davanum Srinivas
+ * @author <mailto:anil@apache.org>Anil Saldhana
+ */
+public class JAXRQueryTest extends TestCase
+{
+    public void testQuery() throws Exception
+    {
+        String queryString = "IBM";
+        Connection connection = null;
+
+        // Define connection configuration properties
+        // To query, you need only the query URL
+        Properties props = new Properties();
+        props.setProperty("javax.xml.registry.queryManagerURL",
+                //        "http://uddi.microsoft.com:80/inquire");
+                "http://localhost:8080/juddi/inquiry");
+        props.setProperty("javax.xml.registry.factoryClass",
+                "org.apache.ws.scout.registry.ConnectionFactoryImpl");
+
+        try
+        {
+            // Create the connection, passing it the configuration properties
+            ConnectionFactory factory = ConnectionFactory.newInstance();
+            factory.setProperties(props);
+            connection = factory.createConnection();
+        } catch (JAXRException e)
+        {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+
+        try
+        {
+            // Get registry service and business query manager
+            RegistryService rs = connection.getRegistryService();
+            BusinessQueryManager bqm = rs.getBusinessQueryManager();
+            System.out.println("We have the Business Query Manager");
+
+            // Define find qualifiers and name patterns
+            Collection findQualifiers = new ArrayList();
+            findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
+            Collection namePatterns = new ArrayList();
+            namePatterns.add("%" + queryString + "%");
+
+            // Find based upon qualifier type and values
+            System.out.println("\n-- searching the registry --\n");
+            BulkResponse response =
+                    bqm.findOrganizations(findQualifiers,
+                            namePatterns,
+                            null,
+                            null,
+                            null,
+                            null);
+
+            // check how many organisation we have matched
+            Collection orgs = response.getCollection();
+            if (orgs == null)
+            {
+                System.out.println("\n-- Matched 0 orgs");
+
+            } else
+            {
+                System.out.println("\n-- Matched " + orgs.size() + " organisations --\n");
+
+                // then step through them
+                for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
+                {
+                    Organization org = (Organization) orgIter.next();
+                    System.out.println("Org name: " + getName(org));
+                    System.out.println("Org description: " + getDescription(org));
+                    System.out.println("Org key id: " + getKey(org));
+
+                    printUser(org);
+
+                    printServices(org);
+                    // Print spacer between organizations
+                    System.out.println(" --- ");
+                }
+            }//end else
+        } catch (JAXRException e)
+        {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally
+        {
+            connection.close();
+        }
+
+    }
+
+    private static void printServices(Organization org)
+            throws JAXRException
+    {
+        // Display service and binding information
+        Collection services = org.getServices();
+        for (Iterator svcIter = services.iterator(); svcIter.hasNext();)
+        {
+            Service svc = (Service) svcIter.next();
+            System.out.println(" Service name: " + getName(svc));
+            System.out.println(" Service description: " + getDescription(svc));
+            Collection serviceBindings = svc.getServiceBindings();
+            for (Iterator sbIter = serviceBindings.iterator(); sbIter.hasNext();)
+            {
+                ServiceBinding sb = (ServiceBinding) sbIter.next();
+                System.out.println("  Binding Description: " + getDescription(sb));
+                System.out.println("  Access URI: " + sb.getAccessURI());
+            }
+        }
+    }
+
+    private static void printUser(Organization org)
+    throws JAXRException
+    {
+        // Display primary contact information
+        User pc = org.getPrimaryContact();
+        if (pc != null)
+        {
+            PersonName pcName = pc.getPersonName();
+            System.out.println(" Contact name: " + pcName.getFullName());
+            Collection phNums = pc.getTelephoneNumbers(pc.getType());
+            for (Iterator phIter = phNums.iterator(); phIter.hasNext();)
+            {
+                TelephoneNumber num = (TelephoneNumber) phIter.next();
+                System.out.println("  Phone number: " + num.getNumber());
+            }
+            Collection eAddrs = pc.getEmailAddresses();
+            for (Iterator eaIter = eAddrs.iterator(); eaIter.hasNext();)
+            {
+                System.out.println("  Email Address: " + (EmailAddress) eaIter.next());
+            }
+        }
+    }
+
+    private static String getName(RegistryObject ro) throws JAXRException
+    {
+        if (ro != null && ro.getName() != null)
+        {
+            return ro.getName().getValue();
+        }
+        return "";
+    }
+
+    private static String getDescription(RegistryObject ro) throws JAXRException
+    {
+        if (ro != null && ro.getDescription() != null)
+        {
+            return ro.getDescription().getValue();
+        }
+        return "";
+    }
+
+    private static String getKey(RegistryObject ro) throws JAXRException
+    {
+        if (ro != null && ro.getKey() != null)
+        {
+            return ro.getKey().getId();
+        }
+        return "";
+    }
+}

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


Mime
View raw message