You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2006/07/14 02:39:51 UTC

svn commit: r421773 - in /webservices/muse/trunk/modules: muse-tools/src/org/apache/muse/tools/inspector/ muse-util/src/org/apache/muse/util/uuid/

Author: danj
Date: Thu Jul 13 17:39:50 2006
New Revision: 421773

URL: http://svn.apache.org/viewvc?rev=421773&view=rev
Log:
Storing WS-A actions and generated IDs based on Strings, not URIs, as part of MUSE-28 fix: 
http://svn.apache.org/viewvc?view=rev&revision=421765

Modified:
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/Messages.properties
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java
    webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/RandomUuidFactory.java
    webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/UuidFactory.java

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/Messages.properties?rev=421773&r1=421772&r2=421773&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/Messages.properties (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/Messages.properties Thu Jul 13 17:39:50 2006
@@ -1,13 +1,5 @@
-CreateFile = Creating source file XXX.
-StartCodeGen = Starting code generation for XXX.
-FinishCodeGen = Finished code generation for XXX.
-MethodGen = Generating method 'XXX'.
-NumberOfOps = The WSDL portType 'XXX' has XXX operations defined.
-PortTypeNotFound = The portType 'XXX' was not found in the WSDL provided.
-NotDocLiteral = The WSDL operation 'XXX' is not doc-literal because it defines a message with more than one message part for its SOAP Body. The SOAP Body of a doc-literal message should contain one root request element (with the operation name) with zero or more child elements (the parameters).
-Extending = Class XXX is extending Muse client class XXX.
 NoTypeDef = No type definition found for 'XXX'.
-PropertiesGen = Generating XXX resource properties found in WSDL's WS-RP definition.
-OperationUndefined = There is no operation for the Java method 'XXX' - you can only invoke operations that are defined in the resource's WSDL (remote interface).
-OneServicePerWSDL = The resource inspector can only process WSDLs with one service element.
+NotDocLiteral = The WSDL operation 'XXX' is not doc-literal because it defines a message with more than one message part for its SOAP Body. The SOAP Body of a doc-literal message should contain one root request element (with the operation name) with zero or more child elements (the parameters).
 OnePortPerWSDL = The resource inspector can only process WSDLs with one port element. The WSDL can have multiple portTypes, but only one concrete service and port.
+OneServicePerWSDL = The resource inspector can only process WSDLs with one service element.
+OperationUndefined = There is no operation for the Java method 'XXX' - you can only invoke operations that are defined in the resource's WSDL (remote interface).
\ No newline at end of file

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java?rev=421773&r1=421772&r2=421773&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java Thu Jul 13 17:39:50 2006
@@ -133,6 +133,8 @@
     // The service's WS-RP doc
     //
     private ResourcePropertiesSchema _wsrpSchema = null;
+
+	private LinkedHashMap _javaMethodsByName;
     
     private Object createBaseProxy(WsResourceClient resource)
         throws Exception
@@ -155,7 +157,6 @@
         method.setReturnName(getOutputName(op));
         
         Element inputElement = WsdlUtils.getTypeDeclaration(wsdl, method.getName());
-        
         if (inputElement == null)
         {
             Object[] filler = { method.getName() };
@@ -171,6 +172,7 @@
         method.setReturnType(getJavaType(method.getReturnSchemaType()));
         
         Element[] paramXML = XmlUtils.findInSubTree(inputElement, XsdUtils.ELEMENT_QNAME);
+
         Element schema = (Element)inputElement.getParentNode();
         String targetNS = schema.getAttribute(XmlUtils.TARGET_NS);
         
@@ -181,7 +183,12 @@
         for (int n = 0; n < paramXML.length; ++n)
         {
             String localName = paramXML[n].getAttribute(XsdUtils.NAME);
-            parameterTypeNames[n] = new QName(targetNS, localName, "pfx");
+            if(localName != null && localName.length() != 0) {
+            	parameterTypeNames[n] = new QName(targetNS, localName, "pfx");            	
+            } else {
+            	parameterTypeNames[n] = XmlUtils.parseQName(paramXML[n].getAttribute(XsdUtils.REF),paramXML[n]);
+            }            
+            
             parameterSchemaTypes[n] = getSchemaType(paramXML[n]);
             parameterTypes[n] = getJavaType(parameterSchemaTypes[n]);
         }
@@ -215,7 +222,7 @@
             action += '/';
         
         action += method.getName().getLocalPart();
-        handler.setAction(URI.create(action));
+        handler.setAction(action);
         
         handler.setRequestName(method.getName());
         handler.setRequestParameterNames(method.getParameterTypeNames());
@@ -228,7 +235,7 @@
         return handler;
     }
     
-    public URI getAction(String operation)
+    public String getAction(String operation)
     {
         ProxyHandler handler = getHandler(operation);
         
@@ -293,8 +300,6 @@
         if (operationName == null)
             throw new NullPointerException(_MESSAGES.get("NullOperationName"));
         
-        System.out.println("OperationName " + operationName);
-        
         char first = operationName.charAt(0);
         return Character.toLowerCase(first) + operationName.substring(1);
     }
@@ -341,17 +346,17 @@
         
         List operations = portType.getOperations();
         
-        Map javaMethodsByName = new LinkedHashMap();
+        _javaMethodsByName = new LinkedHashMap();
         Iterator i = operations.iterator();
         
         while (i.hasNext())
         {
             Operation next = (Operation)i.next();            
             JavaMethod method = createJavaMethod(wsdlXML, next);            
-            javaMethodsByName.put(method.getName(), method);
+            _javaMethodsByName.put(method.getName(), method);
         }
         
-        return getHandlers(javaMethodsByName);
+        return getHandlers(_javaMethodsByName);
     }
 
 	private QName getOutputName(Operation op)
@@ -375,8 +380,6 @@
     
     public String[] getParameterNames(String operation)
     {
-    	
-    	System.out.println("Examining operation = " + operation);
         QName[] qnames = getParameterQNames(operation);
         String[] names = new String[qnames.length];
         
@@ -391,8 +394,6 @@
     {
         ProxyHandler handler = getHandler(operation);
         
-        System.out.println("handler from ["+operation+"] is null? " + (handler == null));
-        
         if (handler != null)
             return handler.getRequestParameterNames();
         
@@ -452,12 +453,16 @@
     
     public Collection getProperties()
     {
-        return _wsrpSchema.getPropertyNames();
+        return _wsrpSchema == null?null:_wsrpSchema.getPropertyNames();
     }
         
     public Class getPropertyType(QName property)
     {
         QName type = _wsrpSchema.getPropertyTypeName(property);
+        //HACK
+        if(type.getNamespaceURI() == null|| type.getNamespaceURI().length() == 0) {
+        	type = new QName(XsdUtils.NAMESPACE_URI, type.getLocalPart());
+        }
         Class javaType = getXsdJavaType(type);
         
         if (isPropertyMultiple(property))
@@ -628,7 +633,11 @@
         }
         
         _portType = getPortType(def);
-        _wsrpSchema = getWsrpSchema(wsdl, _portType);
+        try {
+        	_wsrpSchema = getWsrpSchema(wsdl, _portType);
+        } catch (Exception e) {
+        	//TODO handle
+        }
         _handlersByName = getOperations(def, wsdl, _portType);
     }
     
@@ -700,8 +709,8 @@
         new QName(NAMESPACE_URI, "anyType", PREFIX);
     
     public static final QName ANY_URI_QNAME = 
-        new QName(NAMESPACE_URI, "anyURI", PREFIX);
-
+        new QName(NAMESPACE_URI, "anyURI", PREFIX);    
+    
     public static final QName BOOLEAN_QNAME = 
         new QName(NAMESPACE_URI, "boolean", PREFIX);
 
@@ -774,6 +783,9 @@
     public static final QName SIMPLE_TYPE_QNAME = 
         new QName(NAMESPACE_URI, "simpleType", PREFIX);
     
+    public static final QName LANGSTRING_QNAME = 
+        new QName("http://docs.oasis-open.org/wsdm/muws2-2.xsd", "LangString");
+        
     static
     {
         //
@@ -795,6 +807,7 @@
         _JAVA_TYPES.put(DATE_QNAME, Date.class);
         _JAVA_TYPES.put(DATE_TIME_QNAME, Date.class);
         _JAVA_TYPES.put(DURATION_QNAME, String.class);
+        _JAVA_TYPES.put(LANGSTRING_QNAME, String.class);
         
         //
         // this isn't a XSD type, but it's common to all WS-* services
@@ -803,4 +816,33 @@
         _JAVA_TYPES.put(WsaConstants.EPR_TYPE_QNAME, EndpointReference.class);
     }
 
+    public Map getJavaMethods() {
+    	return _javaMethodsByName;
+    }
+    
+    public static Element removeImports(Element schema)
+    {
+        //
+        // remove <xsd:import> elements
+        //
+        Element[] imports = XmlUtils.getElements(schema, XsdUtils.IMPORT_QNAME);
+        
+        for (int i = 0; i < imports.length; ++i)
+            schema.removeChild(imports[i]);
+        
+        return schema;
+    }
+    
+    public static Element removeIncludes(Element schema)
+    {        
+        //
+        // remove <xsd:include> elements
+        //
+        Element[] includes = XmlUtils.getElements(schema, XsdUtils.INCLUDE_QNAME);
+        
+        for (int i = 0; i < includes.length; ++i)
+            schema.removeChild(includes[i]);
+        
+        return schema;
+    }
 }

Modified: webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/RandomUuidFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/RandomUuidFactory.java?rev=421773&r1=421772&r2=421773&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/RandomUuidFactory.java (original)
+++ webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/RandomUuidFactory.java Thu Jul 13 17:39:50 2006
@@ -15,8 +15,6 @@
  *=============================================================================*/
 
 package org.apache.muse.util.uuid;
-
-import java.net.URI;
 import java.security.SecureRandom;
 
 /**
@@ -65,12 +63,10 @@
     /**
      * 
      * @return A unique UUID of the form <em>uuid:<b>X</b></em>, where 
-     *        <b>X</b> is the generated value.         
-     *
-     * @see UuidFactory#createUUID()
+     *        <b>X</b> is the generated value.
      *
      */
-    public URI createUUID()
+    public String createUUID()
     {
         //
         // first get 16 random bytes...
@@ -100,7 +96,7 @@
             uuid.append(_HEX_VALUES[hex & 15]);
         }
         
-        return URI.create(uuid.toString());
+        return uuid.toString();
     }
     
     /**

Modified: webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/UuidFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/UuidFactory.java?rev=421773&r1=421772&r2=421773&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/UuidFactory.java (original)
+++ webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/uuid/UuidFactory.java Thu Jul 13 17:39:50 2006
@@ -16,8 +16,6 @@
 
 package org.apache.muse.util.uuid;
 
-import java.net.URI;
-
 /**
  *
  * UuidFactory defines an interface for UUID generators. The UUIDs created 
@@ -39,5 +37,5 @@
      * @return Any valid UUID.
      *
      */
-    URI createUUID();
+    String createUUID();
 }



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