ws-scout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r536553 - in /webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout: registry/RegistryImpl.java registry/infomodel/RegistryEntryImpl.java util/ScoutUddiJaxrHelper.java
Date Wed, 09 May 2007 14:52:34 GMT
Author: dims
Date: Wed May  9 07:52:34 2007
New Revision: 536553

URL: http://svn.apache.org/viewvc?view=rev&rev=536553
Log:
Fix for SCOUT-29 - AuthTokenImpl.getAuthInfo() doesn't seem to work correctly
Fix for SCOUT-32 - Fix NPE at getConcept
Fix for SCOUT-33 - Should throw exception when level 1 feature is accessed in RegistryEntryImpl.java


Modified:
    webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryImpl.java
    webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryEntryImpl.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/RegistryImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryImpl.java?view=diff&rev=536553&r1=536552&r2=536553
==============================================================================
--- webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryImpl.java
(original)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryImpl.java
Wed May  9 07:52:34 2007
@@ -20,11 +20,13 @@
 import java.net.URISyntaxException;
 import java.util.Properties;
 
+import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.ws.scout.transport.Transport;
+import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.w3c.dom.Document;
@@ -262,43 +264,58 @@
         }
 		Element request = doc.getDocumentElement();
 
-		request.setAttribute("generic", this.getUddiVersion());
-		request.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
-		// A SOAP request is made and a SOAP response
-		// is returned.
+	    request.setAttribute("generic", this.getUddiVersion());
+	    request.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
+	    // A SOAP request is made and a SOAP response
+	    // is returned.
 
-		Element response = transport.send(request, endPointURI);
+	    Element response = transport.send(request, endPointURI);
         
         if (response.getNamespaceURI()==null) {
             response.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
         }
-		// First, let's make sure that a response
-		// (any response) is found in the SOAP Body.
-
-		String responseName = response.getLocalName();
-		if (responseName == null) {
-			throw new RegistryException("Unsupported response "
-					+ "from registry. A value was not present.");
-		}
-
-		// Let's now try to determine which UDDI response
-		// we received and unmarshal it appropriately or
-		// throw a RegistryException if it's unknown.
-
-		// Well, we have now determined that something was
-		// returned and it is "a something" that we know
-		// about so let's unmarshal it into a RegistryObject
-
-		// Next, let's make sure we didn't recieve a SOAP
-		// Fault. If it is a SOAP Fault then throw it
-		// immediately.
+	    // First, let's make sure that a response
+	    // (any response) is found in the SOAP Body.
 
-		XmlObject uddiResponse = null;
-		try {
-			uddiResponse = XmlObject.Factory.parse(response);
-		} catch (XmlException xmle) {
-			throw (new RegistryException(xmle));
+	    String responseName = response.getLocalName();
+	    if (responseName == null) {
+	        throw new RegistryException("Unsupported response "
+	                + "from registry. A value was not present.");
 		}
+ 
+        // Let's now try to determine which UDDI response
+        // we received and unmarshal it appropriately or
+        // throw a RegistryException if it's unknown.
+        // Well, we have now determined that something was
+        // returned and it is "a something" that we know
+        // about so let's unmarshal it into a RegistryObject
+        // Next, let's make sure we didn't recieve a SOAP
+        // Fault. If it is a SOAP Fault then throw it
+        // immediately.
+
+        XmlObject uddiResponse = null;
+	    try {
+	        uddiResponse = XmlObject.Factory.parse(response);
+            XmlCursor cursor = uddiResponse.newCursor();
+            cursor.toNextToken();
+            //set the namespace if it is empty here.  This is needed for the find_element_user
to work.
+            if ("".equals(cursor.getName().getNamespaceURI())) {
+                cursor.setName(new QName(this.getUddiNamespace(), cursor.getName().getLocalPart()));
+                //there seems to have a bug in setName and it will set the next Start with
xmlns="".
+                //The workaround is to set it to uddiNamespace when it is empty.
+                while (cursor.hasNextToken()) {
+                    cursor.toNextToken();
+                    if (cursor.isStart()) {
+                        if ("".equals(cursor.getName().getNamespaceURI())) {
+                            cursor.setName(new QName(this.getUddiNamespace(), cursor.getName().getLocalPart()));
+                        }
+                    }
+                }
+                cursor.dispose();
+            }
+	    } catch (XmlException xmle) {
+	        throw (new RegistryException(xmle));
+	    }
 
 		if (responseName.toLowerCase().equals("fault")) {
 			NodeList nodeList = null;

Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryEntryImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryEntryImpl.java?view=diff&rev=536553&r1=536552&r2=536553
==============================================================================
--- webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryEntryImpl.java
(original)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryEntryImpl.java
Wed May  9 07:52:34 2007
@@ -1,103 +1,104 @@
-/*
- * 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 javax.xml.registry.JAXRException;
-import javax.xml.registry.LifeCycleManager;
-import javax.xml.registry.infomodel.RegistryEntry;
-import java.util.Date;
-
-/**
- * Implements JAXR Interface.
- * For futher details, look into the JAXR API Javadoc.
- *
- * @author Anil Saldhana  <anil@apache.org>
- */
-public class RegistryEntryImpl extends RegistryObjectImpl implements RegistryEntry
-{
-    private Date expiry = null;
-    private int major = 1;
-    private int minor = 0;
-    private int stability = 1;
-    private int status = 1;
-
-    private String userversion = new String();
-
-    /**
-     * Creates a new instance of RegistryEntryImpl
-     */
-    public RegistryEntryImpl(LifeCycleManager lifeCycleManager)
-    {
-        super(lifeCycleManager);
-    }
-
-    public Date getExpiration() throws JAXRException
-    {
-        return expiry;
-    }
-
-    public int getMajorVersion() throws JAXRException
-    {
-        return major;
-    }
-
-    public int getMinorVersion() throws JAXRException
-    {
-        return minor;
-    }
-
-    public int getStability() throws JAXRException
-    {
-        return stability;
-    }
-
-    public int getStatus() throws JAXRException
-    {
-        return status;
-    }
-
-    public String getUserVersion() throws JAXRException
-    {
-        return userversion;
-    }
-
-    public void setExpiration(Date date) throws JAXRException
-    {
-        expiry = date;
-    }
-
-    public void setMajorVersion(int param) throws JAXRException
-    {
-        major = param;
-    }
-
-    public void setMinorVersion(int param) throws JAXRException
-    {
-        minor = param;
-    }
-
-    public void setStability(int param) throws JAXRException
-    {
-        stability = param;
-    }
-
-    public void setUserVersion(String str) throws JAXRException
-    {
-        userversion = str;
-    }
-
-}
+/*
+ * 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 javax.xml.registry.JAXRException;
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.UnsupportedCapabilityException;
+import javax.xml.registry.infomodel.RegistryEntry;
+import java.util.Date;
+
+/**
+ * Implements JAXR Interface.
+ * For futher details, look into the JAXR API Javadoc.
+ *
+ * @author Anil Saldhana  <anil@apache.org>
+ */
+public class RegistryEntryImpl extends RegistryObjectImpl implements RegistryEntry
+{
+    private Date expiry = null;
+    private int major = 1;
+    private int minor = 0;
+    private int stability = 1;
+    private int status = 1;
+
+    private String userversion = new String();
+
+    /**
+     * Creates a new instance of RegistryEntryImpl
+     */
+    public RegistryEntryImpl(LifeCycleManager lifeCycleManager)
+    {
+        super(lifeCycleManager);
+    }
+
+    public Date getExpiration() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public int getMajorVersion() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public int getMinorVersion() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public int getStability() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public int getStatus() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public String getUserVersion() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void setExpiration(Date date) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void setMajorVersion(int param) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void setMinorVersion(int param) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void setStability(int param) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void setUserVersion(String str) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+}

Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java?view=diff&rev=536553&r1=536552&r2=536553
==============================================================================
--- 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
Wed May  9 07:52:34 2007
@@ -343,8 +343,10 @@
       concept.setName(lcm.createInternationalString(tmodel.getName().getStringValue()));
 
       Description desc = getDescription(tmodel);
-      concept.setDescription(lcm.createInternationalString(desc.getStringValue()));
-
+      if (desc != null) {
+          concept.setDescription(lcm.createInternationalString(desc.getStringValue()));
+      }
+      
       concept.addExternalIdentifiers(getExternalIdentifiers(tmodel.getIdentifierBag(), lcm));
       concept.addClassifications(getClassifications(tmodel.getCategoryBag(), lcm));
 



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