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/17 04:36:06 UTC

svn commit: r422604 - in /webservices/muse/trunk/modules: muse-tools/src/org/apache/muse/tools/inspector/ muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/ muse-wsrf-impl/src/org/apache/muse/ws/resource/impl/ muse-wsrf-impl/src/org/apach...

Author: danj
Date: Sun Jul 16 19:36:05 2006
New Revision: 422604

URL: http://svn.apache.org/viewvc?rev=422604&view=rev
Log:
Fix for MUSE-40 - we now keep the WSRP document name in the ResourcePropertiesSchema and use it whenever we construct the 
WSRP DOM in GetResourcePropertyDocument. The name can also be set after initialization, although SimpleWsResource will 
save the name correctly in initialize().

The change to WsrpUtils was to make the convenience method getPropertiesDefinition() into getPropertiesName(), since there 
was only one line of code required after the WSRP name was determined. SimpleWsResource can now call this method to get the 
name, run one more line of code - WsdlUtils.getTypeDeclaration() - and get the Element and the QName it needs.

Modified:
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java
    webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/OpenPropertiesSchema.java
    webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchema.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/impl/SimpleWsResource.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/WsrpUtils.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/Messages.properties
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/SimpleResourcePropertiesSchema.java

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=422604&r1=422603&r2=422604&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 Sun Jul 16 19:36:05 2006
@@ -527,8 +527,9 @@
     
     private ResourcePropertiesSchema getWsrpSchema(Element wsdl, QName portType)
     {
-        Element wsrp = WsrpUtils.getPropertiesDefinition(wsdl, portType);
-        return new SimpleResourcePropertiesSchema(wsrp);
+        QName wsrpName = WsrpUtils.getPropertiesName(wsdl, portType);
+        Element wsrp = WsdlUtils.getTypeDeclaration(wsdl, wsrpName);
+        return new SimpleResourcePropertiesSchema(wsrpName, wsrp);
     }
     
     /**

Modified: webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/OpenPropertiesSchema.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/OpenPropertiesSchema.java?rev=422604&r1=422603&r2=422604&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/OpenPropertiesSchema.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/OpenPropertiesSchema.java Sun Jul 16 19:36:05 2006
@@ -22,8 +22,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.muse.ws.resource.WsResourceCapability;
-
-
+import org.apache.muse.ws.resource.properties.WsrpConstants;
 
 /**
  *
@@ -147,6 +146,16 @@
     }
 
     public void setCapability(QName property, WsResourceCapability capability)
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public QName getElementName()
+    {
+        return WsrpConstants.DEFAULT_DOCUMENT_QNAME;
+    }
+
+    public void setElementName(QName wsrpName)
     {
         throw new UnsupportedOperationException();
     }

Modified: webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchema.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchema.java?rev=422604&r1=422603&r2=422604&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchema.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchema.java Sun Jul 16 19:36:05 2006
@@ -46,6 +46,13 @@
     
     /**
      * 
+     * @return The name of the schema element representing the WSRP document.
+     *
+     */
+    QName getElementName();
+    
+    /**
+     * 
      * @param property
      *        
      * @return The maximum number of occurrences for the given property, or 
@@ -115,4 +122,12 @@
     boolean hasCapability(QName property);
     
     void setCapability(QName property, WsResourceCapability capability);
+    
+    /**
+     * 
+     * @param wsrpName
+     *        The name of the schema element representing the WSRP document.
+     *
+     */
+    void setElementName(QName wsrpName);
 }

Modified: webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/impl/SimpleWsResource.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/impl/SimpleWsResource.java?rev=422604&r1=422603&r2=422604&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/impl/SimpleWsResource.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/impl/SimpleWsResource.java Sun Jul 16 19:36:05 2006
@@ -16,6 +16,8 @@
 
 package org.apache.muse.ws.resource.impl;
 
+import javax.xml.namespace.QName;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -97,7 +99,11 @@
 
     protected ResourcePropertiesSchema createPropertiesSchema(Document wsdl)
     {
-        Element wsrpDoc = WsrpUtils.getPropertiesDefinition(wsdl, getWsdlPortType());
+        //
+        // find the element that corresponds to the WS-RP name
+        // 
+        QName wsrpName = WsrpUtils.getPropertiesName(wsdl, getWsdlPortType());
+        Element wsrpDoc = WsdlUtils.getTypeDeclaration(wsdl, wsrpName);
         
         if (wsrpDoc == null) 
         {
@@ -107,7 +113,7 @@
             return OpenPropertiesSchema.getInstance();
         }
         
-        return new SimpleResourcePropertiesSchema(wsrpDoc);
+        return new SimpleResourcePropertiesSchema(wsrpName, wsrpDoc);
     }
     
     /**

Modified: webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java?rev=422604&r1=422603&r2=422604&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java Sun Jul 16 19:36:05 2006
@@ -40,7 +40,6 @@
 import org.apache.muse.ws.resource.metadata.impl.StaticValuesApprover;
 import org.apache.muse.ws.resource.metadata.impl.ValidValuesApprover;
 import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
-import org.apache.muse.ws.resource.properties.WsrpConstants;
 import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
 import org.apache.muse.ws.resource.properties.listeners.PropertyChangeApprover;
 import org.apache.muse.ws.resource.properties.listeners.PropertyChangeListener;
@@ -596,7 +595,8 @@
         throws BaseFault
     {
         Document doc = XmlUtils.createDocument();
-        Element root = XmlUtils.createElement(doc, WsrpConstants.DEFAULT_DOCUMENT_QNAME);
+        QName rootName = getSchema().getElementName();
+        Element root = XmlUtils.createElement(doc, rootName);
         doc.appendChild(root);
         
         Collection names = getPropertyNames();

Modified: webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/WsrpUtils.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/WsrpUtils.java?rev=422604&r1=422603&r2=422604&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/WsrpUtils.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/WsrpUtils.java Sun Jul 16 19:36:05 2006
@@ -130,7 +130,7 @@
 
     /**
      * 
-     * Searches a WSDL document for the schema definition of a resource's 
+     * Searches a WSDL document for the schema element name of a resource's 
      * WS-RP document. The WS-RP document is defined in the WSDL's <em>types</em> 
      * section and is an aggregate properties defined in other schemas (all 
      * properties listed in the WS-RP definition use the <em>ref</em> attribute 
@@ -142,12 +142,14 @@
      * @param portType
      *        The WSDL portType that has the name of the WS-RP definition.
      * 
-     * @return The Element that is the definition of the WS-RP document.
-     *         This element is a sequence of other XSD elements that use the 
-     *         <em>ref</em> attribute to define their types.
+     * @return The QName of the WS-RP document element in <types/>. This element 
+     *         is a sequence of other XSD elements that use the <em>ref</em> 
+     *         attribute to define their types.
+     *         
+     * @see WsdlUtils#getTypeDeclaration(Node, QName)
      *
      */
-    public static Element getPropertiesDefinition(Node wsdl, QName portType)
+    public static QName getPropertiesName(Node wsdl, QName portType)
     {
         if (wsdl == null)
             throw new NullPointerException(_MESSAGES.get("NullWSDLDocument"));
@@ -169,11 +171,6 @@
         if (definitionName == null || definitionName.length() == 0)
             throw new RuntimeException(_MESSAGES.get("NoPropertiesAttribute"));
         
-        QName definitionQName = XmlUtils.parseQName(definitionName, portTypeXML);
-        
-        //
-        // find the element that corresponds to the WS-RP name
-        // 
-        return WsdlUtils.getTypeDeclaration(wsdl, definitionQName);
+        return XmlUtils.parseQName(definitionName, portTypeXML);
     }
 }

Modified: webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/Messages.properties?rev=422604&r1=422603&r2=422604&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/Messages.properties (original)
+++ webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/Messages.properties Sun Jul 16 19:36:05 2006
@@ -41,3 +41,4 @@
 NoInstancesToDelete = There are no instances of the property 'XXX', so it cannot be deleted.
 InvalidQueryDialect = The query dialect 'XXX' is not supported by this WS-RP implementation. The only valid dialect is 'XXX'.
 QueryEvaluationError = There was an error trying to evaluate the query 'XXX'. The original error was: XXX
+NullWSRPElementName = The name of the WSRP document's root element cannot be null.

Modified: webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/SimpleResourcePropertiesSchema.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/SimpleResourcePropertiesSchema.java?rev=422604&r1=422603&r2=422604&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/SimpleResourcePropertiesSchema.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/schema/impl/SimpleResourcePropertiesSchema.java Sun Jul 16 19:36:05 2006
@@ -33,6 +33,7 @@
 import org.apache.muse.util.xml.XmlUtils;
 import org.apache.muse.util.xml.XsdUtils;
 import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
 import org.apache.muse.ws.resource.properties.schema.ResourcePropertiesSchema;
 
 /**
@@ -60,6 +61,12 @@
     //
     private Map _definitionsByQName = new HashMap();
     
+    //
+    // The name of the root element in the WSRP doc - this should be 
+    // whatever is used in the WSDL, but a default is provided
+    //
+    private QName _wsrpName = WsrpConstants.DEFAULT_DOCUMENT_QNAME;
+    
     /**
      * 
      * Creates a new schema by parsing the WS-RP document and storing the 
@@ -72,8 +79,11 @@
      *        The DOM Element containing the WS-RP document's type definition.
      *
      */
-    public SimpleResourcePropertiesSchema(Element wsrpElement)
+    public SimpleResourcePropertiesSchema(QName wsrpName, Element wsrpElement)
     {
+        if (wsrpName != null)
+            _wsrpName = wsrpName;
+        
         if (wsrpElement == null)
             throw new NullPointerException(_MESSAGES.get("NullPropertiesElement"));
         
@@ -151,6 +161,11 @@
         }
     }
     
+    public synchronized final QName getElementName()
+    {
+        return _wsrpName;
+    }
+    
     public int getMaxOccurs(QName property)
     {
         return getProperty(property).getMaxOccurs();
@@ -213,5 +228,13 @@
     public void setCapability(QName property, WsResourceCapability capability)
     {
         getProperty(property).setCapability(capability);
+    }
+    
+    public synchronized void setElementName(QName wsrpName)
+    {
+        if (wsrpName == null)
+            throw new NullPointerException(_MESSAGES.get("NullWSRPElementName"));
+        
+        _wsrpName = wsrpName;
     }
 }



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