ws-scout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r432612 - in /webservices/scout/branches/v0.7rc1/modules/scout: ./ src/java/org/apache/ws/scout/registry/ src/java/org/apache/ws/scout/registry/infomodel/ src/java/org/apache/ws/scout/util/
Date Fri, 18 Aug 2006 14:59:19 GMT
Author: anil
Date: Fri Aug 18 07:59:19 2006
New Revision: 432612

URL: http://svn.apache.org/viewvc?rev=432612&view=rev
Log:
v0.7rc1 code changes

Modified:
    webservices/scout/branches/v0.7rc1/modules/scout/project.xml
    webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
    webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
    webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java
    webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
    webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
    webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ClassificationSchemeImpl.java
    webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
    webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java

Modified: webservices/scout/branches/v0.7rc1/modules/scout/project.xml
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v0.7rc1/modules/scout/project.xml?rev=432612&r1=432611&r2=432612&view=diff
==============================================================================
--- webservices/scout/branches/v0.7rc1/modules/scout/project.xml (original)
+++ webservices/scout/branches/v0.7rc1/modules/scout/project.xml Fri Aug 18 07:59:19 2006
@@ -18,7 +18,7 @@
  -->
 <project>
     <pomVersion>3</pomVersion>
-    <extend>../../project.xml</extend>
+    <extend>../../etc/project.xml</extend>
 
     <id>scout</id>
     <name>Apache Scout Implementation</name>
@@ -27,7 +27,7 @@
         <dependency>
             <groupId>scout</groupId>
             <artifactId>jaxr-api</artifactId>
-            <version>${pom.currentVersion}</version>
+            <version>0.7</version>
         </dependency>
 
         <!-- external JARs -->
@@ -52,11 +52,13 @@
             <artifactId>commons-logging</artifactId>
             <version>${clogging_version}</version>
         </dependency>
+    <!--
         <dependency>
             <groupId>commons-discovery</groupId>
             <artifactId>commons-discovery</artifactId>
             <version>${commons_discovery_version}</version>
         </dependency>
+    -->
         <dependency>
             <groupId>axis</groupId>
             <artifactId>axis</artifactId>
@@ -71,6 +73,11 @@
             <groupId>axis</groupId>
             <artifactId>axis-jaxrpc</artifactId>
             <version>${axis_version}</version>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>${log4j_version}</version>
         </dependency>
     </dependencies>
 </project>

Modified: webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java?rev=432612&r1=432611&r2=432612&view=diff
==============================================================================
--- webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
(original)
+++ webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
Fri Aug 18 07:59:19 2006
@@ -16,38 +16,56 @@
  */
 package org.apache.ws.scout.registry;
 
-import org.apache.juddi.IRegistry;
-import org.apache.juddi.datatype.binding.BindingTemplate;
-import org.apache.juddi.datatype.business.BusinessEntity;
-import org.apache.juddi.datatype.response.*;
-import org.apache.juddi.datatype.service.BusinessService;
-import org.apache.juddi.datatype.tmodel.TModel;
-import org.apache.juddi.datatype.assertion.PublisherAssertion;
-import org.apache.juddi.datatype.KeyedReference;
-import org.apache.juddi.datatype.request.AuthInfo;
-import org.apache.juddi.error.RegistryException;
-import org.apache.ws.scout.registry.infomodel.KeyImpl;
-import org.apache.ws.scout.registry.infomodel.ConceptImpl;
-import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
-import org.apache.ws.scout.util.ScoutJaxrUddiHelper;
-import org.apache.ws.scout.util.ScoutUddiJaxrHelper;
+import java.io.Serializable;
+import java.net.PasswordAuthentication;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
 
-import javax.xml.registry.*;
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessLifeCycleManager;
+import javax.xml.registry.DeleteException;
+import javax.xml.registry.InvalidRequestException;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.SaveException;
+import javax.xml.registry.UnexpectedObjectException;
 import javax.xml.registry.infomodel.Association;
 import javax.xml.registry.infomodel.ClassificationScheme;
 import javax.xml.registry.infomodel.Concept;
 import javax.xml.registry.infomodel.Key;
 import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.RegistryObject;
 import javax.xml.registry.infomodel.Service;
 import javax.xml.registry.infomodel.ServiceBinding;
-import javax.xml.registry.infomodel.RegistryObject;
-import java.io.Serializable;
-import java.net.PasswordAuthentication;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
+
+import org.apache.juddi.IRegistry;
+import org.apache.juddi.datatype.KeyedReference;
+import org.apache.juddi.datatype.assertion.PublisherAssertion;
+import org.apache.juddi.datatype.binding.BindingTemplate;
+import org.apache.juddi.datatype.business.BusinessEntity;
+import org.apache.juddi.datatype.request.AuthInfo;
+import org.apache.juddi.datatype.response.AssertionStatusItem;
+import org.apache.juddi.datatype.response.AssertionStatusReport;
+import org.apache.juddi.datatype.response.AuthToken;
+import org.apache.juddi.datatype.response.BindingDetail;
+import org.apache.juddi.datatype.response.BusinessDetail;
+import org.apache.juddi.datatype.response.DispositionReport;
+import org.apache.juddi.datatype.response.ErrInfo;
+import org.apache.juddi.datatype.response.PublisherAssertions;
+import org.apache.juddi.datatype.response.Result;
+import org.apache.juddi.datatype.response.ServiceDetail;
+import org.apache.juddi.datatype.response.TModelDetail;
+import org.apache.juddi.datatype.service.BusinessService;
+import org.apache.juddi.datatype.tmodel.TModel;
+import org.apache.juddi.error.RegistryException;
+import org.apache.log4j.Logger;
+import org.apache.ws.scout.registry.infomodel.KeyImpl;
+import org.apache.ws.scout.util.ScoutJaxrUddiHelper;
 
 /**
  * Implements JAXR BusinessLifeCycleManager Interface.
@@ -59,7 +77,11 @@
 public class BusinessLifeCycleManagerImpl extends LifeCycleManagerImpl
         implements BusinessLifeCycleManager, Serializable {
 
-    public BusinessLifeCycleManagerImpl(RegistryService registry) {
+	private static final long serialVersionUID = 4662854497208312765L;
+	
+	private static Logger log = Logger.getLogger(BusinessLifeCycleManagerImpl.class);
+
+	public BusinessLifeCycleManagerImpl(RegistryService registry) {
         super(registry);
     }
 
@@ -270,7 +292,7 @@
                 throw new UnexpectedObjectException();
             }
         }
-        System.out.println("Method:save_classificationscheme: ENlength=" + entityvect.size());
+        log.debug("Method:save_classificationscheme: ENlength=" + entityvect.size());
         // Save business
         TModelDetail td = null;
         try {
@@ -283,7 +305,7 @@
         }
 
         entityvect = td.getTModelVector();
-        System.out.println("After Saving TModel. Obtained vector size:" + entityvect.size());
+        log.debug("After Saving TModel. Obtained vector size:" + entityvect.size());
         for (int i = 0; entityvect != null && i < entityvect.size(); i++) {
             TModel tm = (TModel) entityvect.elementAt(i);
             coll.add(new KeyImpl(tm.getTModelKey()));
@@ -315,7 +337,7 @@
                 throw new UnexpectedObjectException();
             }
         }
-        System.out.println("Method:save_concept: ENlength=" + entityvect.size());
+        log.debug("Method:save_concept: ENlength=" + entityvect.size());
         // Save business
         TModelDetail td = null;
         try {
@@ -328,7 +350,7 @@
         }
 
         entityvect = td.getTModelVector();
-        System.out.println("After Saving TModel. Obtained vector size:" + entityvect.size());
+        log.debug("After Saving TModel. Obtained vector size:" + entityvect.size());
         for (int i = 0; entityvect != null && i < entityvect.size(); i++) {
             TModel tm = (TModel) entityvect.elementAt(i);
             coll.add(new KeyImpl(tm.getTModelKey()));
@@ -360,7 +382,7 @@
                 throw new UnexpectedObjectException();
             }
         }
-        System.out.println("Method:save_business: ENlength=" + entityvect.size());
+        log.debug("Method:save_business: ENlength=" + entityvect.size());
         // Save business
         BusinessDetail bd = null;
         try {
@@ -373,7 +395,7 @@
         }
 
         entityvect = bd.getBusinessEntityVector();
-        System.out.println("After Saving Business. Obtained vector size:" + entityvect.size());
+        log.debug("After Saving Business. Obtained vector size:" + entityvect.size());
         for (int i = 0; entityvect != null && i < entityvect.size(); i++) {
             BusinessEntity entity = (BusinessEntity) entityvect.elementAt(i);
             coll.add(new KeyImpl(entity.getBusinessKey()));
@@ -596,7 +618,7 @@
        }
        catch (RegistryException e)
        {
-          e.printStackTrace();
+          log.error("Error:",e);
        }
 
           if(pasvect != null && pasvect.size() > 0)
@@ -606,7 +628,7 @@
              }
              catch (RegistryException e)
              {
-                e.printStackTrace();
+                log.error("Ignorable exception:",e);
                 //IGNORE
              }
        }
@@ -631,13 +653,12 @@
             while (iter.hasNext()) {
                 Key key = (Key) iter.next();
                 keyvect.add(key.getId());
-            }
-            //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());
+            log.debug("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();
@@ -701,7 +722,7 @@
         }
         catch (Exception e)
         {
-            e.printStackTrace();
+            log.error("Exception::",e);
             throw new JAXRException(e);
         }
         return token;

Modified: webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java?rev=432612&r1=432611&r2=432612&view=diff
==============================================================================
--- webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
(original)
+++ webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
Fri Aug 18 07:59:19 2006
@@ -17,6 +17,8 @@
 package org.apache.ws.scout.registry;
 
 import org.apache.juddi.IRegistry;
+import org.apache.juddi.datatype.CategoryBag;
+import org.apache.juddi.datatype.Description;
 import org.apache.juddi.datatype.KeyedReference;
 import org.apache.juddi.datatype.Name;
 import org.apache.juddi.datatype.assertion.PublisherAssertion;
@@ -27,6 +29,7 @@
 import org.apache.juddi.datatype.service.BusinessService;
 import org.apache.juddi.datatype.tmodel.TModel;
 import org.apache.juddi.error.RegistryException;
+import org.apache.log4j.Logger;
 import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
 import org.apache.ws.scout.registry.infomodel.ConceptImpl;
 import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
@@ -49,6 +52,7 @@
 import javax.xml.registry.infomodel.ClassificationScheme;
 import javax.xml.registry.infomodel.Concept;
 import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.LocalizedString;
 import javax.xml.registry.infomodel.Organization;
 import javax.xml.registry.infomodel.RegistryObject;
 import javax.xml.registry.infomodel.Service;
@@ -59,6 +63,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
@@ -74,6 +79,8 @@
 public class BusinessQueryManagerImpl implements BusinessQueryManager
 {
     private final RegistryServiceImpl registryService;
+    
+    private static Logger log = Logger.getLogger(BusinessQueryManagerImpl.class);
 
 
     public BusinessQueryManagerImpl(RegistryServiceImpl registry)
@@ -146,9 +153,7 @@
         //TODO: Currently we just return all the Association objects owned by the caller
         IRegistry registry = registryService.getRegistry();
         try
-        {
-            FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
-
+        {  
             ConnectionImpl con = ((RegistryServiceImpl)getRegistryService()).getConnection();
             AuthToken auth = this.getAuthToken(con,registry);
             PublisherAssertions result =
@@ -196,9 +201,7 @@
         //TODO: Currently we just return all the Association objects owned by the caller
         IRegistry registry = registryService.getRegistry();
         try
-        {
-            FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
-
+        { 
             ConnectionImpl con = ((RegistryServiceImpl)getRegistryService()).getConnection();
             AuthToken auth = this.getAuthToken(con,registry);
            
@@ -444,7 +447,7 @@
 
                 } catch (RegistryException e)
                 {
-                    e.printStackTrace();
+                    log.error("Exception ::",e);
                     throw new JAXRException(e.getLocalizedMessage());
                 }
             }
@@ -531,7 +534,7 @@
 
             } catch (RegistryException e)
             {
-                e.printStackTrace();
+                log.error("RegistryException::",e);
                 throw new JAXRException(e.getLocalizedMessage());
             }
         }
@@ -584,7 +587,7 @@
             }
         }
         catch (RegistryException e) {
-            e.printStackTrace();
+            log.error("RegistryException::",e);
             throw new JAXRException(e.getLocalizedMessage());
         }
 
@@ -654,7 +657,7 @@
             }
         }
         catch (RegistryException e) {
-            e.printStackTrace();
+            log.error("RegistryException::",e);
             throw new JAXRException(e.getLocalizedMessage());
         }
 
@@ -676,22 +679,43 @@
             try {
 
                 TModelDetail tmodeldetail = registry.getTModelDetail(id);
-                Concept c = ScoutUddiJaxrHelper.getConcept(tmodeldetail, lcm);
-
-                /*
-                 * now turn into a concrete ClassificationScheme
-                 */
-
-                ClassificationScheme scheme = new ClassificationSchemeImpl(lcm);
+                if(tmodeldetail != null && tmodeldetail.getTModelVector().size()
> 0)
+                {
+                	TModel tmodel = (TModel)tmodeldetail.getTModelVector().elementAt(0);
+                	ClassificationSchemeImpl scheme = new ClassificationSchemeImpl(lcm);
+                	boolean uddiBased = isUDDIBasedTModel(tmodel);
+                    if(uddiBased)
+                    {
+                    	scheme.setName(new InternationalStringImpl(tmodel.getName()));
+                    	Vector descVect = tmodel.getDescriptionVector();
+                    	if(descVect != null && descVect.size() > 0)
+                    	{
+                    		Description d = (Description)descVect.elementAt(0);
+                    		scheme.setDescription(new InternationalStringImpl(d.getValue()));
+                    	}
+                    	scheme.setExternalLinks(ScoutUddiJaxrHelper.getExternalLinks(tmodel.getOverviewDoc()
+                    			                              ,lcm));
+                    	scheme.setExternalIdentifiers(ScoutUddiJaxrHelper.getExternalIdentifiers(tmodel.getIdentifierBag()
+                    			                              ,lcm));  
+                    	scheme.setClassifications(ScoutUddiJaxrHelper.getClassifications(tmodel.getCategoryBag(),lcm));
+                    }
+                    else
+                    {
+                    	Concept c = ScoutUddiJaxrHelper.getConcept(tmodeldetail, lcm);
 
-                scheme.setName(c.getName());
-                scheme.setDescription(c.getDescription());
-                scheme.setKey(c.getKey());
+                        /*
+                         * now turn into a concrete ClassificationScheme
+                         */ 
+                        scheme.setName(c.getName());
+                        scheme.setDescription(c.getDescription());
+                        scheme.setKey(c.getKey()); 
+                    }
 
-                return scheme;
+                    return scheme;
+                } 
             }
             catch (RegistryException e) {
-                e.printStackTrace();
+            	log.error("RegistryException::",e);
                 throw new JAXRException(e.getLocalizedMessage());
             }
         }
@@ -703,7 +727,7 @@
                 return ScoutUddiJaxrHelper.getOrganization(orgdetail, lcm);
             }
             catch (RegistryException e) {
-                e.printStackTrace();
+            	log.error("RegistryException::",e);
                 throw new JAXRException(e.getLocalizedMessage());
             }
         }
@@ -715,7 +739,7 @@
                 return ScoutUddiJaxrHelper.getConcept(tmodeldetail, lcm);
             }
             catch (RegistryException e) {
-                e.printStackTrace();
+            	log.error("RegistryException::",e);
                 throw new JAXRException(e.getLocalizedMessage());
             }
         }
@@ -739,7 +763,7 @@
                 }
             }
             catch (RegistryException e) {
-                e.printStackTrace();
+            	log.error("RegistryException::",e);
             }
         }
 
@@ -842,7 +866,7 @@
 
             } catch (RegistryException e)
             {
-                e.printStackTrace();
+            	log.error("RegistryException::",e);
                 throw new JAXRException(e.getLocalizedMessage());
             }
         }
@@ -875,7 +899,7 @@
             }
             catch (RegistryException e)
             {
-                e.printStackTrace();
+            	log.error("RegistryException::",e);
                 throw new JAXRException(e.getLocalizedMessage());
             }
         }
@@ -976,14 +1000,27 @@
     }
 
     static Vector mapNamePatterns(Collection namePatterns)
+    throws JAXRException
     {
         if (namePatterns == null)
             return null;
         Vector result = new Vector(namePatterns.size());
         for (Iterator i = namePatterns.iterator(); i.hasNext();)
         {
-            String pattern = (String) i.next();
-            result.add(new Name(pattern));
+        	Name name = null;
+        	Object obj = i.next();
+        	Locale locale = Locale.getDefault();
+        	if(obj instanceof String)
+        	{ 
+        		name = new Name((String)obj, locale.getLanguage()); 
+        	}
+        	else
+        	 if(obj instanceof LocalizedString)
+        	 {
+        		LocalizedString ls = (LocalizedString)obj;
+        		name = new Name(ls.getValue(),ls.getLocale().getLanguage()); 
+        	 } 
+            result.add(name);
         }
         return result;
     }
@@ -1014,5 +1051,47 @@
             throw new JAXRException(e);
         }
         return token;
+    }
+    
+    private boolean isUDDIBasedTModel(TModel tmodel)
+    {
+    	/**
+    	 * JAXR 1.0 Specification: Section 6.4.3
+    	 */
+    	String uddi_org_types = "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4";
+    	
+    	boolean result = false;
+    	CategoryBag cbag = tmodel.getCategoryBag();
+    	if(cbag != null)
+    	{
+    		Vector vect  = cbag.getKeyedReferenceVector();
+    		if(vect != null)
+    		{
+    			Iterator iter = vect.iterator();
+    			while(iter.hasNext())
+    			{
+    				KeyedReference kr = (KeyedReference)iter.next();
+    				if(kr != null)
+    	    		{
+    	    			String key = kr.getTModelKey();
+    	    			String tval = kr.getKeyValue();
+    	    			result = key.equals(uddi_org_types); 
+    	    			//Check the taxonomy values
+    	    			result = checkTaxonomyValue(tval);
+    	    			if(result)
+    	    				break;
+    	    		}
+    			}
+    		} 
+    	}
+    	return result;
+    }
+    
+    private boolean checkTaxonomyValue(String tval)
+    {
+    	return (tval.equalsIgnoreCase("Identifier") || 
+				tval.equalsIgnoreCase("Namespace") || 
+				tval.equalsIgnoreCase("Categorization") ||
+				tval.equalsIgnoreCase("PostalAddress"));
     }
 }

Modified: webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java?rev=432612&r1=432611&r2=432612&view=diff
==============================================================================
--- webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java
(original)
+++ webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java
Fri Aug 18 07:59:19 2006
@@ -38,7 +38,8 @@
  */
 public class ConnectionFactoryImpl extends ConnectionFactory implements Serializable
 {
-    private static final String QUERYMANAGER_PROPERTY = "javax.xml.registry.queryManagerURL";
+	private static final long serialVersionUID = 462542187808710650L;
+	private static final String QUERYMANAGER_PROPERTY = "javax.xml.registry.queryManagerURL";
     private static final String LIFECYCLEMANAGER_PROPERTY = "javax.xml.registry.lifeCycleManagerURL";
     private static final String SEMANTICEQUIVALENCES_PROPERTY = "javax.xml.registry.semanticEquivalences";
     private static final String POSTALADDRESSSCHEME_PROPERTY = "javax.xml.registry.postalAddressScheme";

Modified: webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java?rev=432612&r1=432611&r2=432612&view=diff
==============================================================================
--- webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
(original)
+++ webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
Fri Aug 18 07:59:19 2006
@@ -34,7 +34,8 @@
  */
 public class ConnectionImpl implements Connection, Serializable
 {
-    private boolean closed = false;
+	private static final long serialVersionUID = -4020142276466440718L;
+	private boolean closed = false;
     private boolean synchronous = true;
     private Set credentials;
     private final RegistryProxy registry;

Modified: webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java?rev=432612&r1=432611&r2=432612&view=diff
==============================================================================
--- webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
(original)
+++ webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
Fri Aug 18 07:59:19 2006
@@ -24,6 +24,8 @@
 import javax.xml.registry.infomodel.RegistryObject;
 import javax.xml.registry.infomodel.Key;
 
+import org.apache.log4j.Logger;
+
 /**
  * Implements JAXR Association Interface.
  * For futher details, look into the JAXR API Javadoc.
@@ -32,6 +34,8 @@
  */
 public class AssociationImpl extends RegistryObjectImpl implements Association
 {
+	private static Logger log = Logger.getLogger(AssociationImpl.class);
+	
     private Concept type = null;
     private RegistryObject source = null;
     private RegistryObject target = null;
@@ -117,15 +121,14 @@
          if(k == null || k.getId() == "" ) id +=":NULL";
          else
           id+=":"+k.getId();
-         id += ":" + "Concept";  //UDDI: KeyedReference->Key Name
-         String val = "NULL";
+         id += ":" + "Concept";  //UDDI: KeyedReference->Key Name 
          if(type!= null)  id += ":" + type.getValue();
          else  id +=":NULL";
 
       }
       catch (JAXRException e)
       {
-         e.printStackTrace();
+         log.error("JaxrException::",e);
       }
 
       if(id != null) key = new KeyImpl(id);

Modified: webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ClassificationSchemeImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ClassificationSchemeImpl.java?rev=432612&r1=432611&r2=432612&view=diff
==============================================================================
--- webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ClassificationSchemeImpl.java
(original)
+++ webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/ClassificationSchemeImpl.java
Fri Aug 18 07:59:19 2006
@@ -37,9 +37,7 @@
         implements ClassificationScheme
 {
 
-    private Collection childConcepts = new ArrayList();
-
-    private int valueType = 1;
+    private Collection childConcepts = new ArrayList(); 
 
     private boolean external = false;
     

Modified: webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java?rev=432612&r1=432611&r2=432612&view=diff
==============================================================================
--- webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
(original)
+++ webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
Fri Aug 18 07:59:19 2006
@@ -27,9 +27,11 @@
 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.BindingTemplates;
 import org.apache.juddi.datatype.binding.HostingRedirector;
 import org.apache.juddi.datatype.binding.TModelInstanceDetails;
 import org.apache.juddi.datatype.binding.TModelInstanceInfo;
+import org.apache.log4j.Logger;
 import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
 
 import javax.xml.registry.infomodel.*;
@@ -49,6 +51,11 @@
  */
 public class ScoutJaxrUddiHelper
 {
+	private static Logger log = Logger.getLogger(ScoutJaxrUddiHelper.class);
+	
+	//Some constants
+	private static final String UDDI_ORG_TYPES = "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4";
+	
     /**
      * Get UDDI Address given JAXR Postal Address
      */
@@ -154,7 +161,7 @@
               }
               bt.setTModelInstanceDetails(tid);
            }
-            System.out.println("BindingTemplate=" + bt.toString());
+           log.debug("BindingTemplate=" + bt.toString());
         } catch (Exception ud)
         {
             throw new JAXRException("Apache JAXR Impl:", ud);
@@ -180,7 +187,8 @@
                 //enumeration, the key can be the parent classification scheme
                 key = c.getClassificationScheme().getKey();
             }
-            kr.setTModelKey(key.getId());
+            if(key != null)
+              kr.setTModelKey(key.getId());
             kr.setKeyName("Concept");
             kr.setKeyValue(v);
             pa.setKeyedReference(kr);
@@ -253,8 +261,11 @@
             if (serve.getKey() != null) {
                 bs.setServiceKey(serve.getKey().getId());
             }
+            
+            //Add the ServiceBinding information
+            bs.setBindingTemplates(getBindingTemplates(serve.getServiceBindings()));
 
-            System.out.println("BusinessService=" + bs.toString());
+            log.debug("BusinessService=" + bs.toString());
         } catch (Exception ud)
         {
             throw new JAXRException("Apache JAXR Impl:", ud);
@@ -327,7 +338,26 @@
             String name = iname.getValue();
             tm.setName(new Name(name, Locale.getDefault().getLanguage()));
             tm.addDescription(new Description( scheme.getDescription().getValue()));
-            //ToDO:  overviewDoc,identifierBag,categoryBag
+             
+            //External Links 
+            Collection externalLinks = scheme.getExternalLinks(); 
+            if(externalLinks != null && externalLinks.size() > 0)
+            {
+            	tm.setOverviewDoc(getOverviewDocFromExternalLink((ExternalLink)externalLinks.iterator().next()));
+            }  
+            
+            //External Identifiers 
+            IdentifierBag idBag = new IdentifierBag();
+            idBag.setKeyedReferenceVector(getKeyedReferenceVector(scheme.getExternalIdentifiers()));
+            tm.setIdentifierBag(idBag);
+            
+            //Classifications
+            Collection classifications = scheme.getClassifications();
+            if(classifications != null && classifications.isEmpty() == false)
+            {
+            	//Spec says from Concept, always assume the uddi-org:types
+            	tm.setCategoryBag(getCategoryBagFromConcept()); 
+            } 
         } catch (Exception ud)
         {
             throw new JAXRException("Apache JAXR Impl:", ud);
@@ -356,7 +386,7 @@
                 biz.setAuthorizedName(org.getPrimaryContact().getPersonName().getFullName());
 
             Collection s = org.getServices();
-            System.out.println("?Org has services=" + s.isEmpty());
+            log.debug("?Org has services=" + s.isEmpty());
             Iterator iter = s.iterator();
             while (iter.hasNext())
             {
@@ -375,11 +405,8 @@
             Vector cvect = new Vector();
 
             User primaryContact = org.getPrimaryContact();
-            Collection users = org.getUsers();
-
-            // TODO - remove this
-            System.out.println("?Org has users=" + users.isEmpty());
-
+            Collection users = org.getUsers(); 
+            
             /*
              * first do primary, and then filter that out in the loop
              */
@@ -472,7 +499,7 @@
                 TelephoneNumber t = (TelephoneNumber) it.next();
                 Phone phone = new Phone();
                 String str = t.getNumber();
-                System.out.println("Telephone=" + str);
+                log.debug("Telephone=" + str);
                 phone.setValue(str);
                 // phone.setText( str );
                 phonevect.add(phone);
@@ -518,5 +545,129 @@
 
        return uri;
    }
-
+   
+   private static OverviewDoc getOverviewDocFromExternalLink(ExternalLink link)
+   throws JAXRException
+   {
+	   OverviewDoc od = new OverviewDoc();
+	   String url = link.getExternalURI();
+	   if(url != null)
+		   od.setOverviewURL(new OverviewURL(url));
+	   InternationalString extDesc = link.getDescription();
+	   if(extDesc != null)
+		   od.addDescription(new Description(extDesc.getValue()));
+	   return od;
+   }
+   
+   private static Vector getKeyedReferenceVector(Collection externalIdentifiers)
+   throws JAXRException
+   {
+	   Vector krv = new Vector();
+	   if(externalIdentifiers != null)
+	   {
+		   Iterator iter = externalIdentifiers.iterator();
+		   while(iter.hasNext())
+		   {
+			   KeyedReference kr = new KeyedReference();
+			   ExternalIdentifier eid = (ExternalIdentifier)iter.next();
+			   kr.setTModelKey(eid.getObjectType().getClassificationScheme().getKey().getId());
+			   kr.setKeyName(eid.getObjectType().getName().getValue());
+			   kr.setKeyValue(eid.getObjectType().getValue());
+
+			   krv.add(kr); 
+		   }
+	   }
+	   return krv;
+   }
+   
+   private static CategoryBag getCategoryBagFromConcept()  
+   {
+	   /**
+	    * JAXR 1.0 Specification: Section D6.4.4
+	    * Specification related tModels mapped from Concept may be automatically
+	    * categorized by the well-known uddi-org:types taxonomy in UDDI (with
+	    * tModelKey uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4) as follows:
+	    * The keyed reference is assigned a taxonomy value of specification.
+	    */
+	   CategoryBag cbag = new CategoryBag();
+	   Vector krv = new Vector();
+	   KeyedReference kr = new KeyedReference();
+	   kr.setTModelKey(UDDI_ORG_TYPES);
+	   kr.setKeyValue("specification"); 
+	   krv.add(kr);
+	   cbag.setKeyedReferenceVector(krv);
+	   return cbag; 
+   }
+   
+   private static BindingTemplates getBindingTemplates(Collection serviceBindings)
+   throws JAXRException
+   {
+	   BindingTemplates bt = new BindingTemplates();
+	   if(serviceBindings != null)
+	   {
+		   Iterator iter = serviceBindings.iterator();
+		   while(iter.hasNext())
+		   {
+			   ServiceBinding sb = (ServiceBinding)iter.next();
+			   bt.addBindingTemplate(getBindingTemplate(sb));
+		   }
+	   }
+	   return bt; 
+   } 
+   
+   private static BindingTemplate getBindingTemplate(ServiceBinding serviceBinding)
+   throws JAXRException
+   {
+	   BindingTemplate bt = new BindingTemplate();
+	   if(serviceBinding != null)
+	   {
+		   //Access URI
+		   String accessURI = serviceBinding.getAccessURI();
+		   if(accessURI != null)
+			   bt.setAccessPoint(getAccessPoint(accessURI));
+		   ServiceBinding sb = serviceBinding.getTargetBinding();
+		   if(sb != null)
+		   {
+			  bt.setHostingRedirector(new HostingRedirector(accessURI));
+		   }
+		    
+		   Key key = serviceBinding.getKey();
+		   if(key != null)
+		     bt.setBindingKey(key.getId());
+		   Key serviceKey = serviceBinding.getService().getKey();
+		   if(serviceKey != null)
+		     bt.setServiceKey(serviceKey.getId());
+		   //Description
+		   InternationalString desc = serviceBinding.getDescription();
+		   if(desc != null)
+		   {
+			   Vector dvect = new Vector();
+			   dvect.add(new Description(desc.getValue()));
+			   bt.setDescriptionVector(dvect);
+		   } 
+	   }
+	   return bt; 
+   }
+   
+   private static AccessPoint getAccessPoint(String accessURI)
+   {
+	   String type = AccessPoint.OTHER;
+	   String temp = accessURI.toLowerCase();
+	   if(temp.startsWith("https"))
+		   type = AccessPoint.HTTPS;
+	   else
+		   if(temp.startsWith("http"))
+			   type = AccessPoint.HTTP;
+		   else
+			   if(temp.startsWith("mail"))
+			     type = AccessPoint.MAILTO;
+			   else
+				   if(temp.startsWith("ftp"))
+			         type = AccessPoint.FTP;
+				   else
+					   if(Character.isLetterOrDigit(temp.charAt(0)))
+				         type = AccessPoint.PHONE; 
+	   
+	   return new AccessPoint(type, accessURI);
+   }
 }

Modified: webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java?rev=432612&r1=432611&r2=432612&view=diff
==============================================================================
--- webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
(original)
+++ webservices/scout/branches/v0.7rc1/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
Fri Aug 18 07:59:19 2006
@@ -16,14 +16,19 @@
  */
 package org.apache.ws.scout.util;
 
+import org.apache.juddi.datatype.CategoryBag;
 import org.apache.juddi.datatype.Description;
 import org.apache.juddi.datatype.DiscoveryURL;
 import org.apache.juddi.datatype.DiscoveryURLs;
 import org.apache.juddi.datatype.IdentifierBag;
 import org.apache.juddi.datatype.KeyedReference;
 import org.apache.juddi.datatype.Name;
+import org.apache.juddi.datatype.OverviewDoc;
 import org.apache.juddi.datatype.binding.AccessPoint;
 import org.apache.juddi.datatype.binding.BindingTemplate;
+import org.apache.juddi.datatype.binding.BindingTemplates;
+import org.apache.juddi.datatype.binding.HostingRedirector;
+import org.apache.juddi.datatype.binding.InstanceDetails; 
 import org.apache.juddi.datatype.binding.TModelInstanceDetails;
 import org.apache.juddi.datatype.binding.TModelInstanceInfo;
 import org.apache.juddi.datatype.business.BusinessEntity;
@@ -41,7 +46,10 @@
 import javax.xml.registry.JAXRException;
 import javax.xml.registry.LifeCycleManager;
 import javax.xml.registry.infomodel.*;
+
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.Vector;
 
 /**
@@ -80,7 +88,7 @@
 
       //Set Services also
       BusinessServices services = entity.getBusinessServices();
-      Vector svect = services.getBusinessServiceVector();
+      Vector svect = services != null ? services.getBusinessServiceVector() : null;
       for (int i = 0; svect != null && i < svect.size(); i++)
       {
          BusinessService s = (BusinessService)svect.elementAt(i);
@@ -98,7 +106,7 @@
        */
 
       Contacts contacts = entity.getContacts();
-      Vector cvect = contacts.getContactVector();
+      Vector cvect = contacts != null ? contacts.getContactVector(): null;
 
       for (int i = 0; cvect != null && i < cvect.size(); i++)
       {
@@ -267,6 +275,10 @@
       Vector descvect = bs.getDescriptionVector();
       Description desc = descvect != null ? (Description)descvect.elementAt(0) : null;
       if(desc != null ) serve.setDescription(lcm.createInternationalString(desc.getValue()));
+      //Get Service Binding
+      BindingTemplates bindingTemplates = bs.getBindingTemplates();
+      if(bindingTemplates != null) 
+    	  serve.addServiceBindings(getServiceBindings(bindingTemplates,lcm));
       return serve;
    }
 
@@ -293,25 +305,38 @@
    public static ServiceBinding getServiceBinding(BindingTemplate bs, LifeCycleManager lcm)
            throws JAXRException
    {
-      ServiceBinding serve = new ServiceBindingImpl(lcm);
-
+      ServiceBindingImpl serve = new ServiceBindingImpl(lcm);
 
+      /**Section D.10 of JAXR 1.0 Specification */
+      
       TModelInstanceDetails details = bs.getTModelInstanceDetails();
       Vector tiv = details.getTModelInstanceInfoVector();
       for (int i = 0; tiv != null && i < tiv.size(); i++)
       {
          TModelInstanceInfo info = (TModelInstanceInfo)tiv.elementAt(i);
+         InstanceDetails idetails = info.getInstanceDetails(); 
+         Collection elinks = getExternalLinks(idetails.getOverviewDoc(),lcm);
+         SpecificationLinkImpl slink = new SpecificationLinkImpl(lcm);
+         slink.addExternalIdentifiers(elinks);
+         serve.addSpecificationLink(slink); 
+         
+         ConceptImpl c = new ConceptImpl(lcm);
+         c.setExternalLinks(elinks);
+         c.setKey(lcm.createKey(info.getTModelKey())); 
+         c.setName(lcm.createInternationalString(idetails.getInstanceParmsString()));
+         c.setValue(idetails.getInstanceParms().getValue()); 
+         
+         slink.setSpecificationObject(c);
       }
       String keystr = bs.getServiceKey();
       if (keystr != null)
       {
          Service svc = new ServiceImpl(lcm);
          svc.setKey(lcm.createKey(keystr));
-         ((ServiceBindingImpl)serve).setService(svc);
+         serve.setService(svc);
       }
       String bindingKey = bs.getBindingKey();
-      if(bindingKey != null) serve.setKey(new KeyImpl(bindingKey));
-      //TODO:Add more stuff
+      if(bindingKey != null) serve.setKey(new KeyImpl(bindingKey)); 
       //Access URI
       AccessPoint access = bs.getAccessPoint();
       if (access != null) serve.setAccessURI(access.getURL());
@@ -323,6 +348,14 @@
          Description des = (Description)dv.elementAt(0);
          serve.setDescription(new InternationalStringImpl(des.getValue()));
       }
+      
+      HostingRedirector hr = bs.getHostingRedirector();
+      if(hr != null)
+      {
+    	 ServiceBinding sb = lcm.createServiceBinding();
+    	 sb.setKey(new KeyImpl(hr.getBindingKey()));
+         serve.setTargetBinding(sb);
+      }
 
       return serve;
    }
@@ -335,10 +368,12 @@
       TModel tmodel = (TModel)tc.elementAt(0);
       concept.setKey(lcm.createKey(tmodel.getTModelKey()));
       concept.setName(lcm.createInternationalString(tmodel.getName()));
-
-      Vector descvect = tmodel.getDescriptionVector();
+ 
       Description desc = getDescription(tmodel);
       if( desc != null ) concept.setDescription(lcm.createInternationalString(desc.getValue()));
+      
+      CategoryBag cbag = tmodel.getCategoryBag();
+      concept.setClassifications(getClassifications(cbag,lcm)); 
 
       return concept;
    }
@@ -349,8 +384,7 @@
       Concept concept = new ConceptImpl(lcm);
       concept.setKey(lcm.createKey(tmodel.getTModelKey()));
       concept.setName(lcm.createInternationalString(tmodel.getName()));
-
-      Vector descvect = tmodel.getDescriptionVector();
+ 
       Description desc = getDescription(tmodel);
       concept.setDescription(lcm.createInternationalString(desc.getValue()));
 
@@ -366,12 +400,90 @@
 
       return concept;
    }
+   
+   public static Collection getExternalLinks(OverviewDoc odoc , LifeCycleManager lcm)
+   throws JAXRException
+   {
+	   ArrayList alist = new ArrayList(1);
+	   if(odoc != null)
+	   {
+		   Vector descVect = odoc.getDescriptionVector();
+		   String desc = "";
+		   if(descVect != null && descVect.size() > 0)
+		     desc = ((Description)descVect.elementAt(0)).getValue(); 
+		   alist.add(lcm.createExternalLink(odoc.getOverviewURLString(),desc));
+	   }
+	   
+	   return alist;
+   }
+   
+   public static Collection getExternalIdentifiers(IdentifierBag ibag , LifeCycleManager
lcm)
+   throws JAXRException
+   {
+	   ArrayList alist = new ArrayList(1);
+	   if(ibag != null)
+	   {
+		   Vector krv = ibag.getKeyedReferenceVector();
+		   KeyedReference kr = null; 
+		   if(krv != null && krv.size() > 0)
+		   {
+			   kr = (KeyedReference)krv.elementAt(0);
+			   ClassificationSchemeImpl csimpl = new ClassificationSchemeImpl(lcm);
+			   csimpl.setKey(new KeyImpl(kr.getTModelKey()));
+			   ExternalIdentifierImpl ei = new ExternalIdentifierImpl(lcm);
+			   ei.setIdentificationScheme(csimpl);
+			   ei.setName(lcm.createInternationalString(kr.getKeyName()));
+			   ei.setValue(kr.getKeyValue());
+               alist.add(ei); 
+		   } 
+	   }
+	   
+	   return alist;
+   }
+   
+   public static Collection getClassifications(CategoryBag cbag, LifeCycleManager lcm)
+   throws JAXRException
+   {
+	   ArrayList alist = new ArrayList(1);
+	   if(cbag != null)
+	   { 
+		   Vector krv = cbag.getKeyedReferenceVector();
+		   KeyedReference kr = null; 
+		   if(krv != null && krv.size() > 0)
+		   {
+			   kr = (KeyedReference)krv.elementAt(0);
+			   ClassificationImpl cimpl = new ClassificationImpl(lcm);
+			   ClassificationSchemeImpl csimpl = new ClassificationSchemeImpl(lcm);
+			   csimpl.setKey(new KeyImpl(kr.getTModelKey())); 
+               cimpl.setClassificationScheme(csimpl);
+               cimpl.setName(lcm.createInternationalString(kr.getKeyName()));
+               cimpl.setValue(kr.getKeyValue());
+               alist.add(cimpl); 
+		   } 
+	   }
+	   
+	   return alist;
+   }
+   
 
    private static Description getDescription( TModel tmodel )
    {
       Vector descvect = tmodel.getDescriptionVector();
       Description desc = descvect != null ? (Description)descvect.elementAt(0) : null;
       return desc;
-   }
+   } 
 
+   private static Collection getServiceBindings(BindingTemplates bts, LifeCycleManager lcm)
+   throws JAXRException
+   {
+	   ArrayList alist = new ArrayList();
+	   Vector vect = bts.getBindingTemplateVector();
+	   Iterator iter = vect != null ? vect.iterator() : null;
+	   while(iter != null && iter.hasNext())
+	   {
+		  BindingTemplate bt = (BindingTemplate)iter.next();
+		  alist.add(getServiceBinding(bt,lcm)); 
+	   }
+	   return alist;
+   }
 }



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