Author: anil
Date: Fri Jan 21 12:35:59 2005
New Revision: 125960

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

Added:
   
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
   
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/EnumerationHelper.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/ConnectionImpl.java
   
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java
   
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java
   
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalIdentifierImpl.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/OrganizationImpl.java
   
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
   
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.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=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java&r2=125960
==============================================================================
--- 
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
       Fri Jan 21 12:35:59 2005
@@ -35,6 +35,7 @@
 import javax.xml.registry.infomodel.RegistryObject;

 import java.util.*;

 import java.net.PasswordAuthentication;

+import java.io.Serializable;

 

 /**

  * Implements JAXR BusinessLifeCycleManager Interface.

@@ -43,7 +44,7 @@
  * @author Anil Saldhana  <[EMAIL PROTECTED]>

  */

 public class BusinessLifeCycleManagerImpl extends LifeCycleManagerImpl

-        implements BusinessLifeCycleManager

+        implements BusinessLifeCycleManager, Serializable

 {

 

     public BusinessLifeCycleManagerImpl(RegistryService registry)

@@ -104,7 +105,7 @@
                         
ScoutJaxrUddiHelper.getTModelFromJAXRClassificationScheme((ClassificationScheme)
 iter.next());

                 entityvect.add(en);

             }

-            System.out.println("Method:save_business: ENlength=" + 
entityvect.size());

+            System.out.println("Method:save_classificationscheme: ENlength=" + 
entityvect.size());

             // Save business

             TModelDetail td = (TModelDetail) executeOperation(entityvect, 
"SAVE_TMODEL");

 


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=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java&r2=125960
==============================================================================
--- 
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
   Fri Jan 21 12:35:59 2005
@@ -22,11 +22,16 @@
 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.response.TModelList;

+import org.apache.juddi.datatype.response.TModelInfo;

+import org.apache.juddi.datatype.response.TModelInfos;

 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.registry.infomodel.InternationalStringImpl;

 import org.apache.ws.scout.util.ScoutUddiJaxrHelper;

+import org.apache.ws.scout.util.EnumerationHelper;

 

 import javax.xml.registry.BulkResponse;

 import javax.xml.registry.BusinessQueryManager;

@@ -35,6 +40,7 @@
 import javax.xml.registry.LifeCycleManager;

 import javax.xml.registry.RegistryService;

 import javax.xml.registry.UnsupportedCapabilityException;

+import javax.xml.registry.InvalidRequestException;

 import javax.xml.registry.infomodel.ClassificationScheme;

 import javax.xml.registry.infomodel.Concept;

 import javax.xml.registry.infomodel.Key;

@@ -85,7 +91,7 @@
                                                    juddiFindQualifiers,

                                                    
registryService.getMaxRows());

             Vector v = result.getBusinessInfos().getBusinessInfoVector();

-            Collection orgs = null;

+            Collection orgs = new ArrayList();

             int len = 0;

             if (v != null)

             {

@@ -95,7 +101,9 @@
             for (int i = 0; i < len; i++)

             {

                 BusinessInfo info = (BusinessInfo) v.elementAt(i);

-                
orgs.add(registryService.getLifeCycleManagerImpl().createOrganization(info));

+                //Now get the details on the individual biz

+                BusinessDetail detail = 
registry.getBusinessDetail(info.getBusinessKey());

+                
orgs.add(registryService.getLifeCycleManagerImpl().createOrganization(detail));

             }

             return new BulkResponseImpl(orgs);

         } catch (RegistryException e)

@@ -124,27 +132,62 @@
                                                                String 
namePatterns) throws JAXRException

     {

         ClassificationScheme scheme = null;

-        //TODO:What to do with findQualifiers?

+

         if (namePatterns.equalsIgnoreCase("uddi-org:types"))

         {

             scheme = new 
ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());

+            scheme.setName(new InternationalStringImpl("uddi-org:types"));

             scheme.setKey(new KeyImpl(TModel.TYPES_TMODEL_KEY));

         } else if (namePatterns.equalsIgnoreCase("dnb-com:D-U-N-S"))

         {

             scheme = new 
ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());

+            scheme.setName(new InternationalStringImpl("dnb-com:D-U-N-S"));

             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.setName(new 
InternationalStringImpl("uddi-org:iso-ch:3166:1999"));

             scheme.setKey(new KeyImpl(TModel.ISO_CH_TMODEL_KEY));

         } else if (namePatterns.equalsIgnoreCase("unspsc-org:unspsc"))

         {

             scheme = new 
ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());

+            scheme.setName(new InternationalStringImpl("unspsc-org:unspsc"));

             scheme.setKey(new KeyImpl(TModel.UNSPSC_TMODEL_KEY));

         } else if (namePatterns.equalsIgnoreCase("ntis-gov:naics"))

         {

             scheme = new 
ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());

+            scheme.setName(new InternationalStringImpl("ntis-gov:naics"));

             scheme.setKey(new KeyImpl(TModel.NAICS_TMODEL_KEY));

+        }else

+        {

+            //Lets ask the uddi registry if it has the TModels

+            IRegistry registry = registryService.getRegistry();

+            FindQualifiers juddiFindQualifiers = 
mapFindQualifiers(findQualifiers);

+            Vector nameVector = new Vector();

+            nameVector.add(namePatterns);

+            try

+            {

+                //We are looking for one exact match, so getting upto 3 
records is fine

+                TModelList list = 
registry.findTModel(namePatterns,null,null,juddiFindQualifiers,3);

+                TModelInfos infos = null;

+                Vector tmvect = null;

+                if( list != null )   infos  = list.getTModelInfos();

+                if(infos != null ) tmvect =  infos.getTModelInfoVector() ;

+                if(tmvect != null )

+                {

+                    if(  tmvect.size() > 1)

+                     throw new InvalidRequestException("Multiple matches 
found");

+                    

+                    TModelInfo info = (TModelInfo)tmvect.elementAt(0);

+                    scheme.setName( new 
InternationalStringImpl(info.getName().getValue()));

+                    scheme.setKey(new KeyImpl(info.getTModelKey()));

+                }

+

+            } catch (RegistryException e)

+            {

+                e.printStackTrace();

+                throw new JAXRException(e.getLocalizedMessage());

+            }

         }

         return scheme;

     }

@@ -159,7 +202,12 @@
 

     public Concept findConceptByPath(String path) throws JAXRException

     {

-        return null;

+        //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,


Modified: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
Url: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java?view=diff&rev=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java&r2=125960
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
     (original)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
     Fri Jan 21 12:35:59 2005
@@ -25,6 +25,7 @@
 import java.net.URL;

 import java.util.Set;

 import java.util.Properties;

+import java.io.Serializable;

 

 /**

  * Apache Scout Implementation of a JAXR Connection.

@@ -32,7 +33,7 @@
  *

  * @author Anil Saldhana  <[EMAIL PROTECTED]>

  */

-public class ConnectionImpl implements Connection {

+public class ConnectionImpl implements Connection, Serializable {

     private boolean closed = false;

     private boolean synchronous = true;

     private Set credentials;


Modified: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java
Url: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java?view=diff&rev=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java&r2=125960
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java
       (original)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java
       Fri Jan 21 12:35:59 2005
@@ -18,9 +18,13 @@
 

 import org.apache.juddi.datatype.Description;

 import org.apache.juddi.datatype.Name;

+import org.apache.juddi.datatype.service.BusinessServices;

+import org.apache.juddi.datatype.business.BusinessEntity;

 import org.apache.juddi.datatype.response.BusinessInfo;

 import org.apache.juddi.datatype.response.ServiceInfo;

+import org.apache.juddi.datatype.response.BusinessDetail;

 import org.apache.ws.scout.registry.infomodel.*;

+import org.apache.ws.scout.util.ScoutUddiJaxrHelper;

 

 import javax.activation.DataHandler;

 import javax.xml.registry.BulkResponse;

@@ -83,7 +87,7 @@
         // we may not have permission to do so

         if (LifeCycleManager.ASSOCIATION.equals(interfaceName))

         {

-            throw new UnsupportedCapabilityException();

+            return new AssociationImpl(this);

         } else if (LifeCycleManager.AUDITABLE_EVENT.equals(interfaceName))

         {

             throw new UnsupportedCapabilityException();

@@ -161,12 +165,19 @@
 

     public Association createAssociation(RegistryObject targetObject, Concept 
associationType) throws JAXRException

     {

-        return (Association) this.createObject(LifeCycleManager.ASSOCIATION);

+        Association assoc =  (Association) 
this.createObject(LifeCycleManager.ASSOCIATION);

+        assoc.setTargetObject(targetObject);

+        assoc.setAssociationType(associationType);

+        return assoc;

     }

 

     public Classification createClassification(Concept concept) throws 
JAXRException, InvalidRequestException

     {

-        return (Classification) 
this.createObject(LifeCycleManager.CLASSIFICATION);

+        if(concept.getClassificationScheme() == null )

+            throw new InvalidRequestException("Concept is not under 
classification scheme");

+        Classification classify =  (Classification) 
this.createObject(LifeCycleManager.CLASSIFICATION);

+        classify.setConcept(concept);

+        return classify;

     }

 

     public Classification createClassification(ClassificationScheme scheme,

@@ -189,6 +200,11 @@
 

     public ClassificationScheme createClassificationScheme(Concept concept) 
throws JAXRException, InvalidRequestException

     {

+        //Check if the passed concept has a classificationscheme or has a 
parent concept

+        if(concept.getParentConcept() != null || 
concept.getClassificationScheme() != null )

+           throw new InvalidRequestException("Concept has classificationscheme 
or has a parent");

+

+

         ClassificationScheme cs = new ClassificationSchemeImpl(this);

         cs.addChildConcept(concept);

         return cs;

@@ -462,7 +478,13 @@
             }

             org.addServices(services);

         }

+

         return org;

+    }

+

+    Organization createOrganization(BusinessDetail detail) throws JAXRException

+    {

+        return ScoutUddiJaxrHelper.getOrganization(detail,this);

     }

 

     Service createService(ServiceInfo info) throws JAXRException


Modified: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java
Url: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java?view=diff&rev=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java&r2=125960
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java
        (original)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java
        Fri Jan 21 12:35:59 2005
@@ -87,6 +87,8 @@
     }

 

     public BulkResponse getBulkResponse(String s) throws JAXRException, 
InvalidRequestException {

+        if(s == "" || s==null)

+            throw new InvalidRequestException();

         return null;

     }

 


Added: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
Url: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java?view=auto&rev=125960
==============================================================================
--- (empty file)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
  Fri Jan 21 12:35:59 2005
@@ -0,0 +1,101 @@
+/**
+ *
+ * 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.infomodel;
+
+import javax.xml.registry.infomodel.Association;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.InternationalString;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.LifeCycleManager;
+
+/**
+ * Implements JAXR Association Interface.
+ * For futher details, look into the JAXR API Javadoc.
+ *
+ * @author Anil Saldhana  <[EMAIL PROTECTED]>
+ */
+public class AssociationImpl extends RegistryObjectImpl implements Association
+{
+    private Concept type = null;
+    private RegistryObject source = null;
+    private RegistryObject target = null;
+    private boolean isConfirmed = true;
+    private boolean isConfirmedBySourceOwner = true;
+    private boolean isConfirmedByTargetOwner = true;
+    private boolean isExtramural = true;
+
+    public AssociationImpl(LifeCycleManager lifeCycleManager)
+    {
+        super(lifeCycleManager);
+    }
+
+    public AssociationImpl(LifeCycleManager lifeCycleManager, 
InternationalString n)
+    {
+        super(lifeCycleManager, n);
+    }
+
+    public Concept getAssociationType() throws JAXRException
+    {
+        return type;
+    }
+
+    public RegistryObject getSourceObject() throws JAXRException
+    {
+        return source;
+    }
+
+    public RegistryObject getTargetObject() throws JAXRException
+    {
+        return target;
+    }
+
+    public boolean isConfirmed() throws JAXRException
+    {
+        return isConfirmed;
+    }
+
+    public boolean isConfirmedBySourceOwner() throws JAXRException
+    {
+        return isConfirmedBySourceOwner;
+    }
+
+    public boolean isConfirmedByTargetOwner() throws JAXRException
+    {
+        return isConfirmedByTargetOwner;
+    }
+
+    public boolean isExtramural() throws JAXRException
+    {
+        return isExtramural;
+    }
+
+    public void setAssociationType(Concept concept) throws JAXRException
+    {
+         type = concept;
+    }
+
+    public void setSourceObject(RegistryObject ro) throws JAXRException
+    {
+         source = ro;
+    }
+
+    public void setTargetObject(RegistryObject ro) throws JAXRException
+    {
+         target = ro;
+    }
+}

Modified: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalIdentifierImpl.java
Url: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalIdentifierImpl.java?view=diff&rev=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalIdentifierImpl.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalIdentifierImpl.java&r2=125960
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalIdentifierImpl.java
   (original)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalIdentifierImpl.java
   Fri Jan 21 12:35:59 2005
@@ -74,4 +74,10 @@
         value = str;

     }

 

+    //Specific API

+    public void setRegistryObject(RegistryObject obj)

+    {

+        parent = obj;

+    }

+

 }


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=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalLinkImpl.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ExternalLinkImpl.java&r2=125960
==============================================================================
--- 
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
 Fri Jan 21 12:35:59 2005
@@ -18,6 +18,7 @@
 

 import javax.xml.registry.JAXRException;

 import javax.xml.registry.LifeCycleManager;

+import javax.xml.registry.infomodel.RegistryObject;

 import java.util.ArrayList;

 import java.util.Collection;

 

@@ -31,6 +32,7 @@
         implements javax.xml.registry.infomodel.ExternalLink {

     private String uri = new String();

     private boolean validateuri = false;

+    private Collection linkedObj = new ArrayList();

 

     /**

      * Creates a new instance of ExternalLinkImpl

@@ -44,7 +46,7 @@
     }

 

     public Collection getLinkedObjects() throws JAXRException {

-        throw new javax.xml.registry.InvalidRequestException("Not supported in 
UDDI");

+        return linkedObj;

     }

 

     public boolean getValidateURI() throws JAXRException {

@@ -57,6 +59,17 @@
 

     public void setValidateURI(boolean param) throws JAXRException {

         this.validateuri = param;

+    }

+

+    //Specific API

+    public void addLinkedObject(RegistryObject obj)

+    {

+        linkedObj.add(obj);

+    }

+

+    public void removeLinkedObject(RegistryObject obj)

+    {

+        linkedObj.remove(obj);

     }

 

 }


Modified: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java
Url: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java?view=diff&rev=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java&r2=125960
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java
 (original)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java
 Fri Jan 21 12:35:59 2005
@@ -77,7 +77,7 @@
     }

 

     public Collection getUsers() throws JAXRException {

-        return Collections.unmodifiableCollection(users);

+        return users;

     }

 

     public void removeUser(User user) throws JAXRException {

@@ -107,7 +107,7 @@
                 }

             }

         }

-        return Collections.unmodifiableSet(filteredNumbers);

+        return filteredNumbers;

     }

 

     public void setTelephoneNumbers(Collection collection) throws 
JAXRException {

@@ -133,7 +133,7 @@
     }

 

     public Collection getServices() throws JAXRException {

-        return Collections.unmodifiableSet(services);

+        return services;

     }

 

     public void removeService(Service service) throws JAXRException {


Modified: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
Url: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java?view=diff&rev=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java&r2=125960
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
       (original)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
       Fri Jan 21 12:35:59 2005
@@ -156,25 +156,35 @@
 

     public void addExternalIdentifier(ExternalIdentifier externalIdentifier) {

         externalIds.add(externalIdentifier);

+        ((ExternalIdentifierImpl)externalIdentifier).setRegistryObject(this);

     }

 

     public void addExternalIdentifiers(Collection collection) {

         for (Iterator i = collection.iterator(); i.hasNext();) {

             ExternalIdentifier externalId = (ExternalIdentifier) i.next();

             externalIds.add(externalId);

+            ((ExternalIdentifierImpl)externalId).setRegistryObject(this);

         }

     }

 

     public void removeExternalIdentifier(ExternalIdentifier 
externalIdentifier) {

         externalIds.remove(externalIdentifier);

+        ((ExternalIdentifierImpl)externalIdentifier).setRegistryObject(null);

     }

 

     public void removeExternalIdentifiers(Collection collection) {

+        //Lets clear out the reference to this in the ext id

+        Iterator iter = collection.iterator();

+        while(iter != null && iter.hasNext())

+        {

+           ExternalIdentifier externalId = (ExternalIdentifier) iter.next();

+           ((ExternalIdentifierImpl)externalId).setRegistryObject(null);

+        }

         externalIds.removeAll(collection);

     }

 

     public Collection getExternalIdentifiers() {

-        return externalIds;

+        return Collections.unmodifiableSet(externalIds) ;

     }

 

     public void setExternalIdentifiers(Collection collection) {

@@ -188,20 +198,29 @@
 

     public void addExternalLink(ExternalLink externalLink) {

         externalLinks.add(externalLink);

+        ((ExternalLinkImpl)externalLink).addLinkedObject(this);

     }

 

     public void addExternalLinks(Collection collection) {

         for (Iterator i = collection.iterator(); i.hasNext();) {

             ExternalLink externalLink = (ExternalLink) i.next();

             externalLinks.add(externalLink);

+            ((ExternalLinkImpl)externalLink).addLinkedObject(this);

         }

     }

 

     public void removeExternalLink(ExternalLink externalLink) {

+        ((ExternalLinkImpl)externalLink).removeLinkedObject(this);

         externalLinks.remove(externalLink);

     }

 

     public void removeExternalLinks(Collection collection) {

+        Iterator iter = collection.iterator();

+        while(iter != null && iter.hasNext())

+        {

+           ExternalLink externalLink = (ExternalLink) iter.next();

+           ((ExternalLinkImpl)externalLink).removeLinkedObject(this);

+        }

         externalLinks.removeAll(collection);

     }

 


Added: 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/EnumerationHelper.java
Url: 
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/EnumerationHelper.java?view=auto&rev=125960
==============================================================================
--- (empty file)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/EnumerationHelper.java
      Fri Jan 21 12:35:59 2005
@@ -0,0 +1,92 @@
+/**
+ *
+ * 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.ws.scout.registry.infomodel.ClassificationSchemeImpl;
+import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
+import org.apache.ws.scout.registry.infomodel.ConceptImpl;
+
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.JAXRException;
+import java.util.StringTokenizer;
+
+/**
+ * Helper class that deals with predefined enumerations
+ *
+ * @author Anil Saldhana  <[EMAIL PROTECTED]>
+ */
+public class EnumerationHelper
+{
+    public static Concept getConceptByPath( String path)
+    throws IllegalArgumentException, JAXRException
+    {
+        //Lets tokenize the path
+        StringTokenizer tokenizer = new StringTokenizer(path,"/");
+        //Deal with the first token
+        String firstToken = "";
+        if(tokenizer.hasMoreTokens())
+        {
+           firstToken = tokenizer.nextToken();
+           if(!checkFirstToken( firstToken))
+               throw new IllegalArgumentException("Wrong Path");;
+        }
+
+        String secondToken = tokenizer.nextToken();
+        //TODO:Check whether the second token is also valid
+        return createConcept(firstToken, secondToken) ;
+
+    }
+
+
+    private static boolean checkFirstToken(String token)
+    throws IllegalArgumentException
+    {
+        if(token == null )
+            throw new IllegalArgumentException();
+        if(token.equalsIgnoreCase("AssociationType"))  return true;
+        if(token.equalsIgnoreCase("URLType"))  return true;
+        if(token.equalsIgnoreCase("PhoneType"))  return true;
+        if(token.equalsIgnoreCase("PostalAddressAttributes"))  return true;
+        if(token.equalsIgnoreCase("ObjectType"))  return true;
+        return false;
+    }
+
+    /**
+     *
+     * @param firstToken
+     * @param secondToken
+     * @return
+     * @throws JAXRException
+     */
+    private static  Concept createConcept(String firstToken, String 
secondToken)
+            throws JAXRException
+    {
+        /**
+         * This is a hack!!!  Need to figure out how to do this!
+         */
+        ClassificationScheme cs = new ClassificationSchemeImpl(null);
+        cs.setName(new InternationalStringImpl(firstToken));
+
+        Concept concept = new ConceptImpl(null);
+        concept.setName(new 
InternationalStringImpl(secondToken.toLowerCase()));
+        concept.setValue(secondToken);
+        ((ConceptImpl)concept).setScheme(((ClassificationSchemeImpl)cs));
+        return concept;
+
+    }
+}

Modified: 
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=diff&rev=125960&p1=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java&r1=125959&p2=webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java&r2=125960
==============================================================================
--- 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
    (original)
+++ 
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
    Fri Jan 21 12:35:59 2005
@@ -36,6 +36,9 @@
 import org.apache.juddi.datatype.tmodel.TModel;
 import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
 import org.apache.ws.scout.registry.infomodel.OrganizationImpl;
+import org.apache.ws.scout.registry.infomodel.UserImpl;
+import org.apache.ws.scout.registry.infomodel.PersonNameImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceImpl;
 
 import javax.xml.registry.JAXRException;
 import javax.xml.registry.LifeCycleManager;
@@ -81,6 +84,26 @@
         org.setName(getIString(name,lcm));
         org.setDescription(getIString((String)desc.getValue(),lcm));
         org.setKey(lcm.createKey(entity.getBusinessKey()));
+
+        //Set Services also
+        BusinessServices services = entity.getBusinessServices();
+        Vector svect = services.getBusinessServiceVector();
+        for(int i=0; svect != null && i< svect.size();i++)
+        {
+            BusinessService s = (BusinessService)svect.elementAt(i);
+            org.addService(getService(s,lcm));
+        }
+        //Get Contacts or Users
+        Contacts contacts = entity.getContacts();
+        Vector cvect = contacts.getContactVector();
+        for(int i=0; cvect != null && i< cvect.size();i++)
+        {
+            Contact contact = (Contact)cvect.elementAt(i);
+            User user = new UserImpl(null);
+            String pname = contact.getPersonName().getValue();
+            user.setPersonName(new PersonNameImpl(pname));
+            org.addUser(user);
+        }
         return org;
     }
 
@@ -88,6 +111,22 @@
             throws JAXRException
     {
         return blm.createInternationalString(str);
+    }
+
+    public static Service getService(BusinessService bs,LifeCycleManager lcm )
+            throws JAXRException
+    {
+        Service serve = new ServiceImpl(lcm);
+        String keystr = bs.getBusinessKey();
+        if(keystr != null ) serve.setKey(lcm.createKey(keystr));
+        Vector namevect = bs.getNameVector();
+        Name n = (Name)namevect.elementAt(0);
+        String name = n.getValue() ;
+        serve.setName(lcm.createInternationalString(name));
+        Vector descvect = bs.getDescriptionVector();
+        Description desc = (Description)descvect.elementAt(0);
+        serve.setDescription(lcm.createInternationalString(desc.getValue()));
+        return serve;
     }
 
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to