ws-scout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r797311 [3/3] - in /webservices/scout/branches/v1.1: jaxr-api/src/main/java/javax/xml/registry/ jaxr-api/src/main/java/javax/xml/registry/infomodel/ scout/src/main/java/org/apache/ws/scout/registry/ scout/src/main/java/org/apache/ws/scout/r...
Date Fri, 24 Jul 2009 02:45:34 GMT
Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java?rev=797311&r1=797310&r2=797311&view=diff
==============================================================================
--- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
(original)
+++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
Fri Jul 24 02:45:33 2009
@@ -1,355 +1,339 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ws.scout.registry.infomodel;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.LifeCycleManager;
-import javax.xml.registry.UnsupportedCapabilityException;
-import javax.xml.registry.infomodel.Association;
-import javax.xml.registry.infomodel.Classification;
-import javax.xml.registry.infomodel.Concept;
-import javax.xml.registry.infomodel.ExternalIdentifier;
-import javax.xml.registry.infomodel.ExternalLink;
-import javax.xml.registry.infomodel.InternationalString;
-import javax.xml.registry.infomodel.Key;
-import javax.xml.registry.infomodel.Organization;
-import javax.xml.registry.infomodel.RegistryObject;
-
-/**
- * Implements  RegistryObject Interface
- * Implements JAXR Interface.
- * For futher details, look into the JAXR API Javadoc.
- *
- * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
- * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
- */
-public class RegistryObjectImpl extends ExtensibleObjectImpl implements RegistryObject
-{
-    private final LifeCycleManager lifeCycleManager;
-    private Key key;
-    private InternationalString name = new InternationalStringImpl();
-    private InternationalString desc = new InternationalStringImpl();
-
-    private Set<Classification> classifications = new HashSet<Classification>();
-    private Set<Association> associations = new HashSet<Association>();
-    private Set<ExternalIdentifier> externalIds = new HashSet<ExternalIdentifier>();
-    private Set<ExternalLink> externalLinks = new HashSet<ExternalLink>();
-
-    private OrganizationImpl submittingOrganization;
-
-    public RegistryObjectImpl(LifeCycleManager lifeCycleManager)
-    {
-        this.lifeCycleManager = lifeCycleManager;
-    }
-
-    public RegistryObjectImpl(LifeCycleManager lifeCycleManager, InternationalString n)
-    {
-        this.lifeCycleManager = lifeCycleManager;
-        name = n;
-    }
-
-    public Key getKey()
-    {
-        return key;
-    }
-
-    public InternationalString getDescription()
-    {
-        return desc;
-    }
-
-    public void setDescription(InternationalString description)
-    {
-        this.desc = description;
-    }
-
-    public InternationalString getName()
-    {
-        return name;
-    }
-
-    public void setName(InternationalString name)
-    {
-        this.name = name;
-    }
-
-    public void setKey(Key k)
-    {
-        key = k;
-    }
-
-    public String toXML() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("toXML is not supported");
-    }
-
-    public void addClassification(Classification classification)
-    {
-        classifications.add(classification);
-    }
-
-    public void addClassifications(Collection collection)
-    {
-        if (collection!=null) {
-            for (Iterator i = collection.iterator(); i.hasNext();)
-            {
-                Classification classification = (Classification) i.next();
-                classifications.add(classification);
-            }
-        }
-    }
-
-    public void removeClassification(Classification classification)
-    {
-        classifications.remove(classification);
-    }
-
-    public void removeClassifications(Collection<Classification> collection)
-    {
-        classifications.removeAll(collection);
-    }
-
-    public Collection getClassifications()
-    {
-        return Collections.unmodifiableSet(classifications);
-    }
-
-    public void setClassifications(Collection<Classification> collection)
-    {
-        Set<Classification> newClassifications = new HashSet<Classification>(collection.size());
-        for (Iterator i = collection.iterator(); i.hasNext();)
-        {
-            Classification classification = (Classification) i.next();
-            newClassifications.add(classification);
-        }
-        classifications = newClassifications;
-    }
-
-    /**
-     *  Adds specified Association to use this object as source.
-     *  Silently replaces the sourceObject in Association with
-     *  reference to this object.
-     *
-     * @param association
-     * @throws JAXRException
-     */
-    public void addAssociation(Association association)
-        throws JAXRException
-    {
-        associations.add(association);
-
-        association.setSourceObject(this);
-    }
-
-    public void addAssociations(Collection collection) throws JAXRException
-    {
-        for (Iterator i = collection.iterator(); i.hasNext();)
-        {
-            Association association = (Association) i.next();
-
-            addAssociation(association);
-        }
-    }
-
-    public Collection<Association> getAssociations() throws JAXRException
-    {
-        return Collections.unmodifiableSet(associations);
-    }
-
-    public void setAssociations(Collection collection)
-    {
-        Set<Association> newAssociations = new HashSet<Association>(collection.size());
-        for (Iterator i = collection.iterator(); i.hasNext();)
-        {
-            Association association = (Association) i.next();
-            newAssociations.add(association);
-        }
-        associations = newAssociations;
-    }
-
-    public void removeAssociation(Association association)
-    {
-        associations.remove(association);
-    }
-
-    public void removeAssociations(Collection collection)
-    {
-        associations.removeAll(collection);
-    }
-
-    public void addExternalIdentifier(ExternalIdentifier externalIdentifier)
-    {
-        externalIds.add(externalIdentifier);
-        ((ExternalIdentifierImpl) externalIdentifier).setRegistryObject(this);
-    }
-
-    public void addExternalIdentifiers(Collection<ExternalIdentifier> collection)
-    {
-        if (collection!=null) {
-            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<ExternalIdentifier> getExternalIdentifiers()
-    {
-        return Collections.unmodifiableSet(externalIds);
-    }
-
-    public void setExternalIdentifiers(Collection<ExternalIdentifier> collection)
-    {
-        Set<ExternalIdentifier> newExternalIds = new HashSet<ExternalIdentifier>(collection.size());
-        for (Iterator i = collection.iterator(); i.hasNext();)
-        {
-            ExternalIdentifier externalId = (ExternalIdentifier) i.next();
-            newExternalIds.add(externalId);
-        }
-        externalIds = newExternalIds;
-    }
-
-    public void addExternalLink(ExternalLink externalLink)
-    {
-        externalLinks.add(externalLink);
-        ((ExternalLinkImpl) externalLink).addLinkedObject(this);
-    }
-
-    public void addExternalLinks(Collection<ExternalLink> 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);
-    }
-
-    public Collection<ExternalLink> getExternalLinks()
-    {
-        return Collections.unmodifiableSet(externalLinks);
-    }
-
-    public void setExternalLinks(Collection<ExternalLink> collection)
-    {
-        Set<ExternalLink> newExternalLinks = new HashSet<ExternalLink>(collection.size());
-        for (Iterator i = collection.iterator(); i.hasNext();)
-        {
-            ExternalLink externalLink = (ExternalLink) i.next();
-            newExternalLinks.add(externalLink);
-        }
-        externalLinks = newExternalLinks;
-    }
-
-    public Organization getSubmittingOrganization()
-    {
-        return submittingOrganization;
-    }
-
-    public LifeCycleManager getLifeCycleManager()
-    {
-        return lifeCycleManager;
-    }
-
-    /**
-     * The spec does not define how equality is defined for RegistryObject's.
-     * We choose to define it as having the same class and key value; if the
-     * key is null then the objects are not equal.
-     *
-     * @param obj the object to compare to
-     * @return true if the other object is of the same class and has the same key value
-     */
-    public boolean equals(Object obj)
-    {
-        if (obj == this) return true;
-        if (obj == null || !this.getClass().equals(obj.getClass())) return false;
-        final RegistryObjectImpl other = (RegistryObjectImpl) obj;
-        return this.key != null && key.equals(other.key);
-    }
-
-    public int hashCode()
-    {
-        return key == null ? 0 : key.hashCode();
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    // Level 1 features must throw exceptions
-    ///////////////////////////////////////////////////////////////////////////
-
-    public Collection getAuditTrail() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public Collection getAssociatedObjects() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public Concept getObjectType() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public Collection getRegistryPackages() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.scout.registry.infomodel;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.UnsupportedCapabilityException;
+import javax.xml.registry.infomodel.Association;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.ExternalIdentifier;
+import javax.xml.registry.infomodel.ExternalLink;
+import javax.xml.registry.infomodel.InternationalString;
+import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.RegistryObject;
+
+/**
+ * Implements  RegistryObject Interface
+ * Implements JAXR Interface.
+ * For futher details, look into the JAXR API Javadoc.
+ *
+ * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ */
+public class RegistryObjectImpl extends ExtensibleObjectImpl implements RegistryObject
+{
+    private final LifeCycleManager lifeCycleManager;
+    private Key key;
+    private InternationalString name = new InternationalStringImpl();
+    private InternationalString desc = new InternationalStringImpl();
+
+    private Set<Classification> classifications = new HashSet<Classification>();
+    private Set<Association> associations = new HashSet<Association>();
+    private Set<ExternalIdentifier> externalIds = new HashSet<ExternalIdentifier>();
+    private Set<ExternalLink> externalLinks = new HashSet<ExternalLink>();
+
+    //TODO never assigned
+    private OrganizationImpl submittingOrganization;
+
+    public RegistryObjectImpl(LifeCycleManager lifeCycleManager)
+    {
+        this.lifeCycleManager = lifeCycleManager;
+    }
+
+    public RegistryObjectImpl(LifeCycleManager lifeCycleManager, InternationalString n)
+    {
+        this.lifeCycleManager = lifeCycleManager;
+        name = n;
+    }
+
+    public Key getKey()
+    {
+        return key;
+    }
+
+    public InternationalString getDescription()
+    {
+        return desc;
+    }
+
+    public void setDescription(InternationalString description)
+    {
+        this.desc = description;
+    }
+
+    public InternationalString getName()
+    {
+        return name;
+    }
+
+    public void setName(InternationalString name)
+    {
+        this.name = name;
+    }
+
+    public void setKey(Key k)
+    {
+        key = k;
+    }
+
+    public String toXML() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("toXML is not supported");
+    }
+
+    public void addClassification(Classification classification)
+    {
+        classifications.add(classification);
+    }
+
+    public void addClassifications(Collection collection)
+    {
+        if (collection!=null) {
+            for (Object classification : collection) {
+                classifications.add((Classification)classification);
+            }
+        }
+    }
+
+    public void removeClassification(Classification classification)
+    {
+        classifications.remove(classification);
+    }
+
+    public void removeClassifications(Collection collection)
+    {
+        classifications.removeAll(collection);
+    }
+
+    public Collection getClassifications()
+    {
+        return Collections.unmodifiableSet(classifications);
+    }
+
+    public void setClassifications(Collection collection)
+    {
+        Set<Classification> newClassifications = new HashSet<Classification>(collection.size());
+        for (Object classification : collection) {
+            newClassifications.add((Classification) classification);
+        }
+        classifications = newClassifications;
+    }
+
+    /**
+     *  Adds specified Association to use this object as source.
+     *  Silently replaces the sourceObject in Association with
+     *  reference to this object.
+     *
+     * @param association association to add
+     * @throws JAXRException
+     */
+    public void addAssociation(Association association)
+        throws JAXRException
+    {
+        associations.add(association);
+
+        association.setSourceObject(this);
+    }
+
+    public void addAssociations(Collection collection) throws JAXRException
+    {
+        for (Object association : collection) {
+            addAssociation((Association) association);
+        }
+    }
+
+    public Collection<Association> getAssociations() throws JAXRException
+    {
+        return Collections.unmodifiableSet(associations);
+    }
+
+    public void setAssociations(Collection collection)
+    {
+        Set<Association> newAssociations = new HashSet<Association>(collection.size());
+        for (Object association : collection) {
+            newAssociations.add((Association) association);
+        }
+        associations = newAssociations;
+    }
+
+    public void removeAssociation(Association association)
+    {
+        associations.remove(association);
+    }
+
+    public void removeAssociations(Collection collection)
+    {
+        associations.removeAll(collection);
+    }
+
+    public void addExternalIdentifier(ExternalIdentifier externalIdentifier)
+    {
+        externalIds.add(externalIdentifier);
+        ((ExternalIdentifierImpl) externalIdentifier).setRegistryObject(this);
+    }
+
+    public void addExternalIdentifiers(Collection collection)
+    {
+        if (collection!=null) {
+            for (Object externalId : collection) {
+                externalIds.add((ExternalIdentifier) 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<ExternalIdentifier> getExternalIdentifiers()
+    {
+        return Collections.unmodifiableSet(externalIds);
+    }
+
+    public void setExternalIdentifiers(Collection collection)
+    {
+        Set<ExternalIdentifier> newExternalIds = new HashSet<ExternalIdentifier>(collection.size());
+        for (Object externalId : collection) {
+            newExternalIds.add((ExternalIdentifier) externalId);
+        }
+        externalIds = newExternalIds;
+    }
+
+    public void addExternalLink(ExternalLink externalLink)
+    {
+        externalLinks.add(externalLink);
+        ((ExternalLinkImpl) externalLink).addLinkedObject(this);
+    }
+
+    public void addExternalLinks(Collection collection)
+    {
+        for (Object externalLink : collection) {
+            externalLinks.add((ExternalLink) 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);
+    }
+
+    public Collection<ExternalLink> getExternalLinks()
+    {
+        return Collections.unmodifiableSet(externalLinks);
+    }
+
+    public void setExternalLinks(Collection collection)
+    {
+        Set<ExternalLink> newExternalLinks = new HashSet<ExternalLink>(collection.size());
+        for (Object externalLink : collection) {
+            newExternalLinks.add((ExternalLink) externalLink);
+        }
+        externalLinks = newExternalLinks;
+    }
+
+    public Organization getSubmittingOrganization()
+    {
+        return submittingOrganization;
+    }
+
+    public LifeCycleManager getLifeCycleManager()
+    {
+        return lifeCycleManager;
+    }
+
+    /**
+     * The spec does not define how equality is defined for RegistryObject's.
+     * We choose to define it as having the same class and key value; if the
+     * key is null then the objects are not equal.
+     *
+     * @param obj the object to compare to
+     * @return true if the other object is of the same class and has the same key value
+     */
+    public boolean equals(Object obj)
+    {
+        if (obj == this) return true;
+        if (obj == null || !this.getClass().equals(obj.getClass())) return false;
+        final RegistryObjectImpl other = (RegistryObjectImpl) obj;
+        return this.key != null && key.equals(other.key);
+    }
+
+    public int hashCode()
+    {
+        return key == null ? 0 : key.hashCode();
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Level 1 features must throw exceptions
+    ///////////////////////////////////////////////////////////////////////////
+
+    public Collection getAuditTrail() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public Collection getAssociatedObjects() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public Concept getObjectType() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public Collection getRegistryPackages() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+}

Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ServiceBindingImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ServiceBindingImpl.java?rev=797311&r1=797310&r2=797311&view=diff
==============================================================================
--- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ServiceBindingImpl.java
(original)
+++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ServiceBindingImpl.java
Fri Jul 24 02:45:33 2009
@@ -98,7 +98,7 @@
         links.remove(link);
     }
 
-    public void removeSpecificationLinks(Collection<SpecificationLink> col) throws
JAXRException
+    public void removeSpecificationLinks(Collection col) throws JAXRException
     {
         links.removeAll(col);
     }

Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/SlotImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/SlotImpl.java?rev=797311&r1=797310&r2=797311&view=diff
==============================================================================
--- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/SlotImpl.java
(original)
+++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/SlotImpl.java
Fri Jul 24 02:45:33 2009
@@ -66,7 +66,7 @@
         slotType = s;
     }
 
-    public void setValues(Collection<String> collection) throws JAXRException
+    public void setValues(Collection collection) throws JAXRException
     {
         if (collection == null)
         {

Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java?rev=797311&r1=797310&r2=797311&view=diff
==============================================================================
--- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
(original)
+++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
Fri Jul 24 02:45:33 2009
@@ -16,10 +16,7 @@
  */
 package org.apache.ws.scout.util;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.StringTokenizer;
+import java.util.*;
 
 import javax.xml.registry.JAXRException;
 import javax.xml.registry.infomodel.Association;
@@ -195,16 +192,9 @@
               bt.setServiceKey(svc.getKey().getId());
            }
 			
-			InternationalString idesc = ((RegistryObject) serviceBinding).getDescription();
+			InternationalString idesc = serviceBinding.getDescription();
             
-            if (idesc != null) {
-                for (LocalizedString locName : idesc.getLocalizedStrings()) {
-                    Description desc = objectFactory.createDescription();
-                    bt.getDescription().add(desc);
-                    desc.setValue(locName.getValue());
-                    desc.setLang(locName.getLocale().getLanguage());                
-                }
-            }
+            addDescriptions(bt.getDescription(), idesc);
 
 			// SpecificationLink
            Collection<SpecificationLink> slcol = serviceBinding.getSpecificationLinks();
@@ -221,7 +211,8 @@
 					if (specificationObject.getKey() != null && specificationObject.getKey().getId()
!= null) {
 						emptyTInfo.setTModelKey(specificationObject.getKey().getId());
                         if (specificationObject.getDescription()!=null) {
-                            for (LocalizedString locDesc : specificationObject.getDescription().getLocalizedStrings())
{
+                            for (Object o : specificationObject.getDescription().getLocalizedStrings())
{
+                                LocalizedString locDesc = (LocalizedString) o;
                                 Description description = objectFactory.createDescription();
                                 emptyTInfo.getDescription().add(description);
                                 description.setValue(locDesc.getValue());
@@ -332,25 +323,13 @@
 			Service service) throws JAXRException {
 		BusinessService bs = objectFactory.createBusinessService();
 		try {
-			InternationalString iname = ((RegistryObject) service).getName();
+			InternationalString iname = service.getName();
 						
-			for (LocalizedString locName : iname.getLocalizedStrings()) {
-			    Name name = objectFactory.createName();
-			    bs.getName().add(name);
-			    name.setValue(locName.getValue());
-			    name.setLang(locName.getLocale().getLanguage());                
-			}
+			addNames(bs.getName(), iname);
 	         
-            InternationalString idesc = ((RegistryObject) service).getDescription();
+            InternationalString idesc = service.getDescription();
     
-            if (idesc != null) {
-                for (LocalizedString locName : idesc.getLocalizedStrings()) {
-                    Description desc = objectFactory.createDescription();
-                    bs.getDescription().add(desc);
-                    desc.setValue(locName.getValue());
-                    desc.setLang(locName.getLocale().getLanguage());                
-                }
-            }
+           addDescriptions(bs.getDescription(), idesc);
 
             Organization o = service.getProvidingOrganization();
 
@@ -428,25 +407,13 @@
                 tm.setOperator(s.getName());
             }
 
-			InternationalString iname = ((RegistryObject) classificationScheme).getName();
+			InternationalString iname = classificationScheme.getName();
 			 
-			for (LocalizedString locName : iname.getLocalizedStrings()) {
-			    Name name = objectFactory.createName();
-			    tm.setName(name);
-			    name.setValue(locName.getValue());
-			    name.setLang(locName.getLocale().getLanguage());                
-			}
-	         
-			InternationalString idesc = ((RegistryObject) classificationScheme).getDescription();
+            tm.setName(getFirstName(iname));
+
+			InternationalString idesc = classificationScheme.getDescription();
 			
-			if (idesc != null) {
-			    for (LocalizedString locName : idesc.getLocalizedStrings()) {
-			        Description desc = objectFactory.createDescription();
-			        tm.getDescription().add(desc);
-			        desc.setValue(locName.getValue());
-	                desc.setLang(locName.getLocale().getLanguage());                
-	            }
-			}
+		    addDescriptions(tm.getDescription(), idesc);
 
             IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(classificationScheme.getExternalIdentifiers());
             if (idBag!=null) {
@@ -481,26 +448,15 @@
 			if (sl2 != null && sl2.getName() != null)
 				tm.setOperator(sl2.getName());
 
-			InternationalString iname = ((RegistryObject) concept).getName();
+			InternationalString iname = concept.getName();
+
+            tm.setName(getFirstName(iname));
+
+            InternationalString idesc = concept.getDescription();
 			
-			for (LocalizedString locName : iname.getLocalizedStrings()) {
-			    Name name = objectFactory.createName();
-			    tm.setName(name);
-			    name.setValue(locName.getValue());
-			    name.setLang(locName.getLocale().getLanguage());			    
-			}
-			
-			InternationalString idesc = ((RegistryObject) concept).getDescription();
-			
-            if (idesc != null) {
-                for (LocalizedString locName : idesc.getLocalizedStrings()) {
-                    Description desc = objectFactory.createDescription();
-                    tm.getDescription().add(desc);
-                    desc.setValue(locName.getValue());
-                    desc.setLang(locName.getLocale().getLanguage());
-                }
-            }
-//          External Links 
+            addDescriptions(tm.getDescription(), idesc);
+
+//          External Links
             Collection<ExternalLink> externalLinks = concept.getExternalLinks(); 
             if(externalLinks != null && externalLinks.size() > 0)
             {
@@ -521,7 +477,39 @@
         }
         return tm;
     }
-    
+
+    private static void addDescriptions(List<Description> descripions, InternationalString
idesc) throws JAXRException {
+        if (idesc != null) {
+            for (Object o : idesc.getLocalizedStrings()) {
+                LocalizedString locName = (LocalizedString) o;
+                Description desc = objectFactory.createDescription();
+                descripions.add(desc);
+                desc.setValue(locName.getValue());
+                desc.setLang(locName.getLocale().getLanguage());
+            }
+        }
+    }
+
+    private static Name getFirstName(InternationalString iname) throws JAXRException {
+        for (Object o : iname.getLocalizedStrings()) {
+            LocalizedString locName = (LocalizedString) o;
+            Name name = objectFactory.createName();
+            name.setValue(locName.getValue());
+            name.setLang(locName.getLocale().getLanguage());
+            return name;
+        }
+        return null;
+    }
+    private static void addNames(List<Name> names, InternationalString iname) throws
JAXRException {
+        for (Object o : iname.getLocalizedStrings()) {
+            LocalizedString locName = (LocalizedString) o;
+            Name name = objectFactory.createName();
+            name.setValue(locName.getValue());
+            name.setLang(locName.getLocale().getLanguage());
+            names.add(name);
+        }
+    }
+
     public static BusinessEntity getBusinessEntityFromJAXROrg(Organization organization)
 			throws JAXRException {
 		BusinessEntity biz = objectFactory.createBusinessEntity();
@@ -540,26 +528,14 @@
 			
 			InternationalString iname = organization.getName();
 			
-			if (iname != null) {    
-			    for (LocalizedString locName : iname.getLocalizedStrings()) {
-			        Name name = objectFactory.createName();
-			        biz.getName().add(name);
-			        name.setValue(locName.getValue());
-			        name.setLang(locName.getLocale().getLanguage());                
-			    }
+			if (iname != null) {
+                addNames(biz.getName(), iname);
 			}
 			
 			InternationalString idesc = organization.getDescription();
 			
-			if (idesc != null) {
-			    for (LocalizedString locName : idesc.getLocalizedStrings()) {
-			        Description desc = objectFactory.createDescription();
-			        biz.getDescription().add(desc);
-			        desc.setValue(locName.getValue());
-			        desc.setLang(locName.getLocale().getLanguage());                
-			    }
-			}
-			
+            addDescriptions(biz.getDescription(), idesc);
+
 			if (organization.getPrimaryContact() != null && 
 				organization.getPrimaryContact().getPersonName()!= null &&
 				organization.getPrimaryContact().getPersonName().getFullName() != null) {
@@ -802,8 +778,7 @@
      * These KeyedReferences optionally refer to a tModel that identifies the type of category
(translates to the ClassificationScheme key).  If
      * this is set and the tModel doesn't exist in the UDDI registry, then an invalid key
error will occur when trying to save the object.
      * 
-     * @param regObj
-     * @param destinationObj
+     * @param classifications classifications to turn into categories
      * @throws JAXRException
      */
 	public static CategoryBag getCategoryBagFromClassifications(Collection classifications)
throws JAXRException {
@@ -901,8 +876,7 @@
 	/**
      * Adds the objects identifiers from JAXR's external identifier collection
      * 
-     * @param identifiers
-     * @param ibag
+     * @param identifiers external identifiers to turn into identifiers
      * @throws JAXRException
      */
 	public static IdentifierBag getIdentifierBagFromExternalIdentifiers(Collection identifiers)
throws JAXRException {
@@ -977,5 +951,5 @@
             }
         }
         return bt; 
-    } 
+    }
 }



---------------------------------------------------------------------
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