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 2007/03/24 14:24:36 UTC

svn commit: r522026 [9/10] - in /webservices/muse/trunk/modules: osgi-bundles/muse-complete/src/org/apache/muse/complete/ osgi-bundles/muse-util-all/src/org/apache/muse/util/osgi/ osgi-bundles/muse-wsa-soap/src/org/apache/muse/ws/addressing/osgi/ osgi-...

Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutQNameRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutQNameRequest.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutQNameRequest.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutQNameRequest.java Sat Mar 24 06:24:32 2007
@@ -1,109 +1,112 @@
-/*=============================================================================*
- *  Copyright 2006 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.muse.ws.resource.transfer.put.impl;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
-import org.apache.muse.util.xml.XmlSerializable;
-import org.apache.muse.ws.resource.properties.set.SetRequest;
-import org.apache.muse.ws.resource.properties.set.SetRequestComponent;
-import org.apache.muse.ws.resource.properties.set.impl.SimpleSetRequest;
-import org.apache.muse.ws.resource.transfer.Fragment;
-import org.apache.muse.ws.resource.transfer.WsrtConstants;
-import org.apache.muse.ws.resource.transfer.impl.SimpleFragmentFactory;
-import org.apache.muse.ws.resource.transfer.put.PutModeUnsupportedFault;
-import org.apache.muse.ws.resource.transfer.put.PutValue;
-
-/**
- * Breaks down WS-RT Put requests with QName dialect into wsrf
- * SetRequestComponent objects.
- * 
- * @author Mohammad Fakhar
- * 
- */
-
-public class PutQNameRequest implements XmlSerializable
-{
-	
-	  //
-	  // Used to lookup all exception messages
-	  //
-	  private Messages _MESSAGES = MessagesFactory.get(PutQNameRequest.class);
-	
-    protected SetRequest wsrfSetRequest = null;
-
-    public PutQNameRequest(Element request) throws PutModeUnsupportedFault
-    {
-        // muses default fragment factory supports QName dialect
-        SimpleFragmentFactory fragFact = new SimpleFragmentFactory();
-
-        // create fragments out of ws-rt put request
-        Fragment[] fragments = fragFact.createFragments(request, WsrtConstants.QNAME_DIALECT);
-
-        // the wsrf request to which mapped set request components will be added
-        wsrfSetRequest = new SimpleSetRequest();
-
-        // break down fragments into SetRequestComponents that can be
-        // understaood by the wsrf set capability
-        for (int i = 0; i < fragments.length; i++)
-        {
-            Fragment frag = fragments[i];
-            SetRequestComponent comp = null;
-
-            if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_MODIFY))
-            {
-                comp = new PutModifyComponent(frag);
-            }
-            else if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_INSERT))
-            {
-                comp = new PutInsertComponent(frag);
-            }
-            else if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_REMOVE))
-            {
-                comp = new PutRemoveComponent(frag);
-            }
-            else
-            {
-                throw new PutModeUnsupportedFault(_MESSAGES.get("PUTMODEUNSUPPORTED", new Object[] {frag.getMode()}));
-            }
-            wsrfSetRequest.addRequestComponent(comp);
-        }
-
-    }
-
-    public PutValue getPutValue()
-    {
-
-        // return a PutValue that executes a wsrfSetRequest
-        return new SetRequestPutValue(wsrfSetRequest);
-    }
-
-    public Element toXML()
-    {
-        return null;
-    }
-
-    public Element toXML(Document doc)
-    {
-        return null;
-    }
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.muse.ws.resource.transfer.put.impl;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.resource.properties.set.SetRequest;
+import org.apache.muse.ws.resource.properties.set.SetRequestComponent;
+import org.apache.muse.ws.resource.properties.set.impl.SimpleSetRequest;
+import org.apache.muse.ws.resource.transfer.Fragment;
+import org.apache.muse.ws.resource.transfer.WsrtConstants;
+import org.apache.muse.ws.resource.transfer.impl.SimpleFragmentFactory;
+import org.apache.muse.ws.resource.transfer.put.PutModeUnsupportedFault;
+import org.apache.muse.ws.resource.transfer.put.PutValue;
+
+/**
+ * Breaks down WS-RT Put requests with QName dialect into wsrf
+ * SetRequestComponent objects.
+ * 
+ * @author Mohammad Fakhar
+ * 
+ */
+
+public class PutQNameRequest implements XmlSerializable
+{
+	
+	  //
+	  // Used to lookup all exception messages
+	  //
+	  private Messages _MESSAGES = MessagesFactory.get(PutQNameRequest.class);
+	
+    protected SetRequest wsrfSetRequest = null;
+
+    public PutQNameRequest(Element request) throws PutModeUnsupportedFault
+    {
+        // muses default fragment factory supports QName dialect
+        SimpleFragmentFactory fragFact = new SimpleFragmentFactory();
+
+        // create fragments out of ws-rt put request
+        Fragment[] fragments = fragFact.createFragments(request, WsrtConstants.QNAME_DIALECT);
+
+        // the wsrf request to which mapped set request components will be added
+        wsrfSetRequest = new SimpleSetRequest();
+
+        // break down fragments into SetRequestComponents that can be
+        // understaood by the wsrf set capability
+        for (int i = 0; i < fragments.length; i++)
+        {
+            Fragment frag = fragments[i];
+            SetRequestComponent comp = null;
+
+            if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_MODIFY))
+            {
+                comp = new PutModifyComponent(frag);
+            }
+            else if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_INSERT))
+            {
+                comp = new PutInsertComponent(frag);
+            }
+            else if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_REMOVE))
+            {
+                comp = new PutRemoveComponent(frag);
+            }
+            else
+            {
+                throw new PutModeUnsupportedFault(_MESSAGES.get("PUTMODEUNSUPPORTED", new Object[] {frag.getMode()}));
+            }
+            wsrfSetRequest.addRequestComponent(comp);
+        }
+
+    }
+
+    public PutValue getPutValue()
+    {
+
+        // return a PutValue that executes a wsrfSetRequest
+        return new SetRequestPutValue(wsrfSetRequest);
+    }
+
+    public Element toXML()
+    {
+        return null;
+    }
+
+    public Element toXML(Document doc)
+    {
+        return null;
+    }
+
+}

Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutRemoveComponent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutRemoveComponent.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutRemoveComponent.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutRemoveComponent.java Sat Mar 24 06:24:32 2007
@@ -1,44 +1,47 @@
-/*=============================================================================*
- *  Copyright 2006 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.muse.ws.resource.transfer.put.impl;
-
-import org.apache.muse.ws.resource.basefaults.BaseFault;
-import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
-import org.apache.muse.ws.resource.transfer.Fragment;
-
-/**
- * Maps QName dialect WS-RT Put fragment to a WSRF SetRequest component
- * 
- * @author Mohammad Fakhar
- * 
- */
-
-public class PutRemoveComponent extends PutComponent
-{
-
-    public PutRemoveComponent(Fragment frag)
-    {
-        super(frag);
-    }
-
-    public void execute(ResourcePropertyCollection props) throws BaseFault
-    {
-        props.deleteResourceProperty(getPropertyName(), getSecurityToken());
-    }
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.muse.ws.resource.transfer.put.impl;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
+import org.apache.muse.ws.resource.transfer.Fragment;
+
+/**
+ * Maps QName dialect WS-RT Put fragment to a WSRF SetRequest component
+ * 
+ * @author Mohammad Fakhar
+ * 
+ */
+
+public class PutRemoveComponent extends PutComponent
+{
+
+    public PutRemoveComponent(Fragment frag)
+    {
+        super(frag);
+    }
+
+    public void execute(ResourcePropertyCollection props) throws BaseFault
+    {
+        props.deleteResourceProperty(getPropertyName(), getSecurityToken());
+    }
+
+}

Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutRequest.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutRequest.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/PutRequest.java Sat Mar 24 06:24:32 2007
@@ -1,498 +1,501 @@
-/*=============================================================================*
- *  Copyright 2006 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.muse.ws.resource.transfer.put.impl;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.resource.basefaults.BaseFault;
-import org.apache.muse.ws.resource.metadata.MetadataDescriptor;
-import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
-import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
-import org.apache.muse.ws.resource.properties.set.SetRequest;
-import org.apache.muse.ws.resource.properties.set.SetRequestComponent;
-import org.apache.muse.ws.resource.properties.set.impl.DeleteRequest;
-import org.apache.muse.ws.resource.properties.set.impl.InsertRequest;
-import org.apache.muse.ws.resource.properties.set.impl.SimpleSetRequest;
-import org.apache.muse.ws.resource.properties.set.impl.UpdateRequest;
-import org.apache.muse.ws.resource.transfer.EvaluativeExpression;
-import org.apache.muse.ws.resource.transfer.Expression;
-import org.apache.muse.ws.resource.transfer.ExpressionFactory;
-import org.apache.muse.ws.resource.transfer.Fragment;
-import org.apache.muse.ws.resource.transfer.WsrtConstants;
-import org.apache.muse.ws.resource.transfer.faults.InvalidExpressionFault;
-import org.apache.muse.ws.resource.transfer.impl.SimpleFragmentFactory;
-import org.apache.muse.ws.resource.transfer.put.PutFault;
-import org.apache.muse.ws.resource.transfer.put.PutModeUnsupportedFault;
-import org.apache.muse.ws.resource.transfer.put.PutValue;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * This class breaks down a non-QName dialect WS-RT request to
- * SetRequestComponent objects that can be processed by wsrf Set capability.
- * 
- * It is designed to handle any dialect, including xpath. However, there are
- * some non-obvious limitations to what kind of node each operation can target,
- * these are commented in the applyXXX methods in this class.
- * 
- * @author Mohammad Fakhar
- * 
- */
-
-public class PutRequest
-{
-
-	  //
-	  // Used to lookup all exception messages
-	  //
-	  private Messages _MESSAGES = MessagesFactory.get(PutRequest.class);
-
-    protected ResourcePropertyCollection _rpCollection;
-
-    protected Element _wsrpDocElement = null;
-
-    protected Document _wsrpDoc = null;
-
-    protected Fragment[] _fragments = null;
-
-    public PutRequest(Element request, ResourcePropertyCollection rpCollection, ExpressionFactory expressionFactory, String dialect) throws BaseFault
-    {
-        _wsrpDocElement = rpCollection.getResourcePropertyDocument();
-        _wsrpDoc = _wsrpDocElement.getOwnerDocument();
-        _rpCollection = rpCollection;
-
-        // break down ws-rt put request into fragment objects
-        SimpleFragmentFactory fragFactory = new SimpleFragmentFactory(expressionFactory);
-        _fragments = fragFactory.createFragments(request, dialect);
-    }
-
-    /**
-     * This method executes ws-rt fragments on the resource property document
-     * and then creates a SetRequest object that can be passed to wsrf Set
-     * Capability for processing.
-     */
-    public PutValue applyFragsToWSRPDoc() throws InvalidExpressionFault, FragmentAlreadyExistsFault, PutFault, PutModeUnsupportedFault, InvalidResourcePropertyQNameFault, BaseFault
-    {
-        Set modifiedTopLevelProps = executeFragments();
-
-        // once fragments have been executed on rp doc, we break down
-        // the modifications made to doc into a SetRequest
-        SetRequest setReq = createSetRequest(modifiedTopLevelProps);
-
-        // return a putvalue that can be processed by wsrf set capability
-        PutValue putValue = new SetRequestPutValue(setReq);
-
-        return putValue;
-
-    }
-
-    /**
-     * This method executes the fragments on the resource property document and
-     * returns the Set of top level properties that were modified as a result of
-     * executing fragments.
-     */
-    private Set executeFragments() throws InvalidExpressionFault, FragmentAlreadyExistsFault, PutFault, PutModeUnsupportedFault
-    {
-        Set modifiedTopLevelProperties = new HashSet();
-
-        // apply fragments
-        for (int i = 0; i < _fragments.length; i++)
-        {
-            Fragment frag = _fragments[i];
-            Expression expression = frag.getExpression();
-
-            // the expression has to be evaluated so target nodes are set
-            evaluateExpression(expression);
-
-            // these are the nodes in the resource property document that are
-            // targetted by the expression
-            Node[] targetNodes = expression.getTargetNodes();
-
-            // a put operation can't target nodes that don't exist in the
-            // resource property document
-            checkForNullTargetNodes(frag, targetNodes);
-
-            // a put operation can't target read-only nodes
-            checkForReadOnlyTargetNodes(frag, targetNodes);
-
-            for (int j = 0; j < targetNodes.length; j++)
-            {
-                Node targetNode = targetNodes[j];
-                short targetNodeType = targetNode.getNodeType();
-                String targetNodeValue = targetNode.getNodeValue();
-
-                // ignore whitespace text nodes chosen in xpath.
-                // wsrt put xpaths won't be able to target whitespace.
-                if (targetNodeType == Node.TEXT_NODE
-                        && (targetNodeValue == null || targetNodeValue.trim().equals("")))
-                    continue;
-
-                // ensure that top level properties modified by fragment are
-                // added to list of modified properties.
-                markTopLevelPropsModified(targetNode, modifiedTopLevelProperties);
-
-                if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_MODIFY))
-                {
-                    applyModifyOp(targetNode, frag);
-                }
-                else if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_INSERT))
-                {
-                    applyInsertOp(targetNode, frag);
-                }
-                else if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_REMOVE))
-                {
-                    applyRemoveOp(targetNode, frag);
-                }
-                else
-                {
-                	throw new PutModeUnsupportedFault(_MESSAGES.get("PUTMODEUNSUPPORTED", new Object[] {frag.getMode()}));                
-                }
-
-            }
-        }
-
-        return modifiedTopLevelProperties;
-    }
-
-    /**
-     * Given a target node, figures out which top level property the target node
-     * belongs to and adds it to the set of modified top level properties
-     */
-    private void markTopLevelPropsModified(Node targetNode, Set modifiedTopLevelProperties)
-    {
-        if (targetNode == _wsrpDocElement)
-        {
-            // if the target was the entire rp doc then all non-read-only top
-            // level properties are modified
-            modifiedTopLevelProperties.addAll(getNonReadOnlyProps());
-        }
-        else
-        {
-            // find top level prop of target node
-            Node topLevelProp = targetNode;
-
-            while (topLevelProp.getParentNode() != _wsrpDocElement)
-                topLevelProp = topLevelProp.getParentNode();
-
-            QName topLevelPropName = new QName(topLevelProp.getNamespaceURI(),
-                    topLevelProp.getLocalName());
-            modifiedTopLevelProperties.add(topLevelPropName);
-        }
-    }
-
-    /**
-     * Given a set of top level properties that were modified, returns a
-     * SetRequest for executing modifications on those properties
-     */
-
-    private SetRequest createSetRequest(Set modifiedTopLevelProperties) throws BaseFault, InvalidResourcePropertyQNameFault
-    {
-
-        SetRequest setReq = new SimpleSetRequest();
-
-        for (Iterator i = modifiedTopLevelProperties.iterator(); i.hasNext();)
-        {
-            QName prop = (QName)i.next();
-
-            // get the modified values from rp doc to which fragments were
-            // applied
-            Element[] modifiedValues = XmlUtils.getElements(_wsrpDocElement, prop);
-
-            // get the original, non modified, values from rp collection
-            Element[] existentValues = _rpCollection.getResourceProperty(prop);
-
-            SetRequestComponent reqComp = null;
-
-            if (existentValues.length == 0)
-            {
-                if (modifiedValues.length != 0)
-                {
-                    // if no values currently exist for prop and if new values
-                    // were added by fragment(s),
-                    // then create an insert request for this property.
-                    reqComp = new InsertRequest(prop, modifiedValues);
-                }
-                else
-                {
-                    // do nothing. This can happen if at least one fragment's
-                    // target node was the wsrp doc root AND
-                    // no values existed for prop before and after fragment were
-                    // applied. So we don't need
-                    // to do anything here
-                }
-            }
-            else
-            {
-                if (modifiedValues.length == 0)
-                {
-                    // fragment(s) deleted all instances of top level property
-                    reqComp = new DeleteRequest(prop);
-                }
-                else
-                {
-                    // the prop was updated by fragment(s), so create update
-                    // request
-                    reqComp = new UpdateRequest(prop, modifiedValues);
-                }
-            }
-
-            if (reqComp != null)
-                setReq.addRequestComponent(reqComp);
-        }
-
-        return setReq;
-    }
-
-    private Set getNonReadOnlyProps()
-    {
-        HashSet nonReadOnlyProps = new HashSet();
-        Collection propNames = _rpCollection.getPropertyNames();
-        MetadataDescriptor md = _rpCollection.getMetadata();
-
-        for (Iterator i = propNames.iterator(); i.hasNext();)
-        {
-            QName prop = (QName)i.next();
-
-            if (!md.isReadOnlyExternal(prop))
-                nonReadOnlyProps.add(prop);
-        }
-
-        return nonReadOnlyProps;
-    }
-
-    private void evaluateExpression(Expression expression) throws InvalidExpressionFault
-    {
-        // if the expression is an evaluative expression (eg: an xpath
-        // expression),
-        // then evaluate the expression now.
-        if (expression instanceof EvaluativeExpression)
-        {
-            // the DOM to evaluate expression on is the resource document
-            EvaluativeExpression evalExpr = (EvaluativeExpression)expression;
-            evalExpr.setDomToQuery(_wsrpDocElement);
-            evalExpr.evaluate();
-        }
-    }
-
-    private void checkForNullTargetNodes(Fragment frag, Node[] targetNodes) throws PutFault
-    {
-        if (targetNodes == null || targetNodes.length == 0)
-        {
-            // a put modify or remove operation can't target nodes that don't
-            // exist
-            if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_MODIFY)
-                    || frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_REMOVE))
-            {
-                throw new PutFault(_MESSAGES.get("NODESNOTFOUND", 
-                									 new Object[] {XmlUtils.toString(frag.toXML(), false)}));
-            }
-            // the target nodes of create-only/insert expressions in Muse are
-            // the parent nodes under which
-            // to insert/create values; if the immediate parents under which to
-            // add values are null,
-            // we throw a fault. Look at PutInsertXPath expression to understand
-            // how target nodes
-            // of insert/create requests are evaluated
-            throw new PutFault(_MESSAGES.get("PARENTNOTFOUND", new Object[] {XmlUtils.toString(frag.toXML(), false)}));
-        }
-    }
-
-    private void checkForReadOnlyTargetNodes(Fragment frag, Node[] targetNodes) throws PutFault
-    {
-
-        // read-only properties are specified via metadata
-        MetadataDescriptor wsrpMD = _rpCollection.getMetadata();
-
-        // ensure that the target node's top level property isn't a read
-        // only/immutable property
-        for (int i = 0; i < targetNodes.length; i++)
-        {
-            Node topLevelProp = targetNodes[i];
-
-            if (topLevelProp == _wsrpDocElement)
-            {
-                // doesn't make sense to check if wsrp doc root is a read-only
-                // wsrf prop
-                return;
-            }
-            // find the top level property of target node
-            while (topLevelProp.getParentNode() != _wsrpDocElement)
-                topLevelProp = topLevelProp.getParentNode();
-
-            QName topLevelTargetNodeName = new QName(topLevelProp.getNamespaceURI(),
-                    topLevelProp.getLocalName());
-
-            if (wsrpMD.isReadOnlyExternal(topLevelTargetNodeName))
-            {
-                throw new PutFault("This fragment attempted to set read only property "
-                        + topLevelTargetNodeName + ": " + XmlUtils.toString(frag.toXML(), false));
-            }
-        }
-    }
-
-    /**
-     * Applies WS-RT Put modify fragment to target node. The target node must be
-     * an element, text or attribute node, otherwise a fault is thrown.
-     * 
-     */
-    private void applyModifyOp(Node targetNode, Fragment fragment) throws PutFault
-    {
-        // the value to be set by fragment
-        Node[] fragmentValue = fragment.getValue();
-        short targetNodeType = targetNode.getNodeType();
-
-        // node could be element, text, or an attribute.
-        if (targetNodeType == Node.ELEMENT_NODE)
-        {
-
-            // if target node to modify is an element, the fragment value Node[]
-            // should have
-            // ONE element node in it.
-            Node elementToSet = fragmentValue[0];
-
-            if (elementToSet.getNodeType() != Node.ELEMENT_NODE)
-                throw new PutFault(_MESSAGES.get("MODIFYTARGETELEMENTMISMATCH",
-                                    new Object[] {XmlUtils.toString(fragment.toXML())}));
-
-            // create a copy of value node in wsrp doc, otherwise replaceChild
-            // operation
-            // below will fail with a WRONG_DOCUMENT_ERR exception if we add
-            // frag value node directly
-            Element wsrpDocFragValue = createElementInDoc(_wsrpDoc, (Element)elementToSet);
-
-            Node parent = targetNode.getParentNode();
-            parent.replaceChild(wsrpDocFragValue, targetNode);
-
-        }
-        else if (targetNodeType == Node.ATTRIBUTE_NODE || targetNodeType == Node.TEXT_NODE)
-        {
-            // if target node to modify is a text or attribute, the fragment
-            // value Node[] should have
-            // ONE text node in it.
-            Node textToSet = fragmentValue[0];
-
-            if (textToSet.getNodeType() != Node.TEXT_NODE)
-                throw new PutFault(_MESSAGES.get("MODIFYTARGETTEXTMISMATCH",
-                                   new Object[] {XmlUtils.toString(fragment.toXML())}));
-
-            targetNode.setNodeValue(textToSet.getNodeValue());
-        }
-        else
-        {
-            throw new PutFault(_MESSAGES.get("MODIFYTARGETINVALID",
-            									 new Object[] {XmlUtils.toString(fragment.toXML())}));
-        }
-
-    }
-
-    /**
-     * Applies WS-RT Put insert fragment to target node. The target node is the
-     * node under which the fragment value has to be added as child(ren). The
-     * target must be an element.
-     * 
-     */
-    private void applyInsertOp(Node targetNode, Fragment fragment) throws PutFault
-    {
-        Node[] fragmentValue = fragment.getValue();
-        short targetNodeType = targetNode.getNodeType();
-
-        // only element nodes can be insertion points; it doesn't make
-        // sense to make an attribute or text node an insertion point because
-        // they can't have child nodes.
-
-        if (targetNodeType == Node.ELEMENT_NODE)
-        {
-            // if insertion point is an element node, value can be elements,
-            // text nodes
-            // or mixed content.
-            for (int n = 0; n < fragmentValue.length; n++)
-            {
-                Node fragValueChild = fragmentValue[n];
-
-                if (fragValueChild.getNodeType() == Node.ELEMENT_NODE)
-                {
-                    // create a copy of value element in wsrp doc, otherwise
-                    // appendChild operation
-                    // below will fail with a WRONG_DOCUMENT_ERR exception if we
-                    // add frag value node directly
-                    Element wsrpDocFragValue = createElementInDoc(_wsrpDoc, (Element)fragValueChild);
-                    targetNode.appendChild(wsrpDocFragValue);
-                }
-                else if (fragValueChild.getNodeType() == Node.TEXT_NODE)
-                {
-                    // create a copy of text node in wsrp doc, otherwise
-                    // appendChild operation
-                    // below will fail with a WRONG_DOCUMENT_ERR exception
-                    Node wsrpDocTextNode = _wsrpDoc.createTextNode(fragValueChild.getNodeValue());
-                    targetNode.appendChild(wsrpDocTextNode);
-                }
-                else
-                    throw new PutFault(_MESSAGES.get("INSERTTARGETELEMENTMISMATCH", 
-                    									new Object[] {XmlUtils.toString(fragment.toXML())}));
-
-            }
-        }
-        else
-        {
-            throw new PutFault(_MESSAGES.get("INSERTPARTENOTELEMENT",
-            										new Object[] {XmlUtils.toString(fragment.toXML())}));
-        }
-    }
-
-
-    /**
-     * Applies WS-RT Put remove fragment to target node. It simply removes the
-     * target node from document. The target node can not be the root element
-     * 
-     */
-    private void applyRemoveOp(Node targetNode, Fragment fragment) throws PutFault
-    {
-        if (targetNode == _wsrpDocElement)
-        {
-            // it doesnt make a lot of sense to be able to delete root element
-            // in this implementation since wsrt is wrapped around wsrf
-            // properties and
-            // the root wsrf element is pretty much a dumb element anyway; no
-            // read only
-            // properties can be applied to it etc, so we disallow this
-            // operation for now
-            throw new PutFault(_MESSAGES.get("REMOVEROOTERROR",
-            									 new Object[] {XmlUtils.toString(fragment.toXML())}));
-        }
-
-        targetNode.getParentNode().removeChild(targetNode);
-    }
-
-    private Element createElementInDoc(Document targetDoc, Element elementToCreate)
-    {
-        QName qname = new QName(elementToCreate.getNamespaceURI(), elementToCreate.getLocalName(),
-                elementToCreate.getPrefix());
-
-        return XmlUtils.createElement(targetDoc, qname, elementToCreate, true);
-    }
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.muse.ws.resource.transfer.put.impl;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.metadata.MetadataDescriptor;
+import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
+import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
+import org.apache.muse.ws.resource.properties.set.SetRequest;
+import org.apache.muse.ws.resource.properties.set.SetRequestComponent;
+import org.apache.muse.ws.resource.properties.set.impl.DeleteRequest;
+import org.apache.muse.ws.resource.properties.set.impl.InsertRequest;
+import org.apache.muse.ws.resource.properties.set.impl.SimpleSetRequest;
+import org.apache.muse.ws.resource.properties.set.impl.UpdateRequest;
+import org.apache.muse.ws.resource.transfer.EvaluativeExpression;
+import org.apache.muse.ws.resource.transfer.Expression;
+import org.apache.muse.ws.resource.transfer.ExpressionFactory;
+import org.apache.muse.ws.resource.transfer.Fragment;
+import org.apache.muse.ws.resource.transfer.WsrtConstants;
+import org.apache.muse.ws.resource.transfer.faults.InvalidExpressionFault;
+import org.apache.muse.ws.resource.transfer.impl.SimpleFragmentFactory;
+import org.apache.muse.ws.resource.transfer.put.PutFault;
+import org.apache.muse.ws.resource.transfer.put.PutModeUnsupportedFault;
+import org.apache.muse.ws.resource.transfer.put.PutValue;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * This class breaks down a non-QName dialect WS-RT request to
+ * SetRequestComponent objects that can be processed by wsrf Set capability.
+ * 
+ * It is designed to handle any dialect, including xpath. However, there are
+ * some non-obvious limitations to what kind of node each operation can target,
+ * these are commented in the applyXXX methods in this class.
+ * 
+ * @author Mohammad Fakhar
+ * 
+ */
+
+public class PutRequest
+{
+
+	  //
+	  // Used to lookup all exception messages
+	  //
+	  private Messages _MESSAGES = MessagesFactory.get(PutRequest.class);
+
+    protected ResourcePropertyCollection _rpCollection;
+
+    protected Element _wsrpDocElement = null;
+
+    protected Document _wsrpDoc = null;
+
+    protected Fragment[] _fragments = null;
+
+    public PutRequest(Element request, ResourcePropertyCollection rpCollection, ExpressionFactory expressionFactory, String dialect) throws BaseFault
+    {
+        _wsrpDocElement = rpCollection.getResourcePropertyDocument();
+        _wsrpDoc = _wsrpDocElement.getOwnerDocument();
+        _rpCollection = rpCollection;
+
+        // break down ws-rt put request into fragment objects
+        SimpleFragmentFactory fragFactory = new SimpleFragmentFactory(expressionFactory);
+        _fragments = fragFactory.createFragments(request, dialect);
+    }
+
+    /**
+     * This method executes ws-rt fragments on the resource property document
+     * and then creates a SetRequest object that can be passed to wsrf Set
+     * Capability for processing.
+     */
+    public PutValue applyFragsToWSRPDoc() throws InvalidExpressionFault, FragmentAlreadyExistsFault, PutFault, PutModeUnsupportedFault, InvalidResourcePropertyQNameFault, BaseFault
+    {
+        Set modifiedTopLevelProps = executeFragments();
+
+        // once fragments have been executed on rp doc, we break down
+        // the modifications made to doc into a SetRequest
+        SetRequest setReq = createSetRequest(modifiedTopLevelProps);
+
+        // return a putvalue that can be processed by wsrf set capability
+        PutValue putValue = new SetRequestPutValue(setReq);
+
+        return putValue;
+
+    }
+
+    /**
+     * This method executes the fragments on the resource property document and
+     * returns the Set of top level properties that were modified as a result of
+     * executing fragments.
+     */
+    private Set executeFragments() throws InvalidExpressionFault, FragmentAlreadyExistsFault, PutFault, PutModeUnsupportedFault
+    {
+        Set modifiedTopLevelProperties = new HashSet();
+
+        // apply fragments
+        for (int i = 0; i < _fragments.length; i++)
+        {
+            Fragment frag = _fragments[i];
+            Expression expression = frag.getExpression();
+
+            // the expression has to be evaluated so target nodes are set
+            evaluateExpression(expression);
+
+            // these are the nodes in the resource property document that are
+            // targetted by the expression
+            Node[] targetNodes = expression.getTargetNodes();
+
+            // a put operation can't target nodes that don't exist in the
+            // resource property document
+            checkForNullTargetNodes(frag, targetNodes);
+
+            // a put operation can't target read-only nodes
+            checkForReadOnlyTargetNodes(frag, targetNodes);
+
+            for (int j = 0; j < targetNodes.length; j++)
+            {
+                Node targetNode = targetNodes[j];
+                short targetNodeType = targetNode.getNodeType();
+                String targetNodeValue = targetNode.getNodeValue();
+
+                // ignore whitespace text nodes chosen in xpath.
+                // wsrt put xpaths won't be able to target whitespace.
+                if (targetNodeType == Node.TEXT_NODE
+                        && (targetNodeValue == null || targetNodeValue.trim().equals("")))
+                    continue;
+
+                // ensure that top level properties modified by fragment are
+                // added to list of modified properties.
+                markTopLevelPropsModified(targetNode, modifiedTopLevelProperties);
+
+                if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_MODIFY))
+                {
+                    applyModifyOp(targetNode, frag);
+                }
+                else if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_INSERT))
+                {
+                    applyInsertOp(targetNode, frag);
+                }
+                else if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_REMOVE))
+                {
+                    applyRemoveOp(targetNode, frag);
+                }
+                else
+                {
+                	throw new PutModeUnsupportedFault(_MESSAGES.get("PUTMODEUNSUPPORTED", new Object[] {frag.getMode()}));                
+                }
+
+            }
+        }
+
+        return modifiedTopLevelProperties;
+    }
+
+    /**
+     * Given a target node, figures out which top level property the target node
+     * belongs to and adds it to the set of modified top level properties
+     */
+    private void markTopLevelPropsModified(Node targetNode, Set modifiedTopLevelProperties)
+    {
+        if (targetNode == _wsrpDocElement)
+        {
+            // if the target was the entire rp doc then all non-read-only top
+            // level properties are modified
+            modifiedTopLevelProperties.addAll(getNonReadOnlyProps());
+        }
+        else
+        {
+            // find top level prop of target node
+            Node topLevelProp = targetNode;
+
+            while (topLevelProp.getParentNode() != _wsrpDocElement)
+                topLevelProp = topLevelProp.getParentNode();
+
+            QName topLevelPropName = new QName(topLevelProp.getNamespaceURI(),
+                    topLevelProp.getLocalName());
+            modifiedTopLevelProperties.add(topLevelPropName);
+        }
+    }
+
+    /**
+     * Given a set of top level properties that were modified, returns a
+     * SetRequest for executing modifications on those properties
+     */
+
+    private SetRequest createSetRequest(Set modifiedTopLevelProperties) throws BaseFault, InvalidResourcePropertyQNameFault
+    {
+
+        SetRequest setReq = new SimpleSetRequest();
+
+        for (Iterator i = modifiedTopLevelProperties.iterator(); i.hasNext();)
+        {
+            QName prop = (QName)i.next();
+
+            // get the modified values from rp doc to which fragments were
+            // applied
+            Element[] modifiedValues = XmlUtils.getElements(_wsrpDocElement, prop);
+
+            // get the original, non modified, values from rp collection
+            Element[] existentValues = _rpCollection.getResourceProperty(prop);
+
+            SetRequestComponent reqComp = null;
+
+            if (existentValues.length == 0)
+            {
+                if (modifiedValues.length != 0)
+                {
+                    // if no values currently exist for prop and if new values
+                    // were added by fragment(s),
+                    // then create an insert request for this property.
+                    reqComp = new InsertRequest(prop, modifiedValues);
+                }
+                else
+                {
+                    // do nothing. This can happen if at least one fragment's
+                    // target node was the wsrp doc root AND
+                    // no values existed for prop before and after fragment were
+                    // applied. So we don't need
+                    // to do anything here
+                }
+            }
+            else
+            {
+                if (modifiedValues.length == 0)
+                {
+                    // fragment(s) deleted all instances of top level property
+                    reqComp = new DeleteRequest(prop);
+                }
+                else
+                {
+                    // the prop was updated by fragment(s), so create update
+                    // request
+                    reqComp = new UpdateRequest(prop, modifiedValues);
+                }
+            }
+
+            if (reqComp != null)
+                setReq.addRequestComponent(reqComp);
+        }
+
+        return setReq;
+    }
+
+    private Set getNonReadOnlyProps()
+    {
+        HashSet nonReadOnlyProps = new HashSet();
+        Collection propNames = _rpCollection.getPropertyNames();
+        MetadataDescriptor md = _rpCollection.getMetadata();
+
+        for (Iterator i = propNames.iterator(); i.hasNext();)
+        {
+            QName prop = (QName)i.next();
+
+            if (!md.isReadOnlyExternal(prop))
+                nonReadOnlyProps.add(prop);
+        }
+
+        return nonReadOnlyProps;
+    }
+
+    private void evaluateExpression(Expression expression) throws InvalidExpressionFault
+    {
+        // if the expression is an evaluative expression (eg: an xpath
+        // expression),
+        // then evaluate the expression now.
+        if (expression instanceof EvaluativeExpression)
+        {
+            // the DOM to evaluate expression on is the resource document
+            EvaluativeExpression evalExpr = (EvaluativeExpression)expression;
+            evalExpr.setDomToQuery(_wsrpDocElement);
+            evalExpr.evaluate();
+        }
+    }
+
+    private void checkForNullTargetNodes(Fragment frag, Node[] targetNodes) throws PutFault
+    {
+        if (targetNodes == null || targetNodes.length == 0)
+        {
+            // a put modify or remove operation can't target nodes that don't
+            // exist
+            if (frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_MODIFY)
+                    || frag.getMode().equals(WsrtConstants.FRAGMENT_MODE_REMOVE))
+            {
+                throw new PutFault(_MESSAGES.get("NODESNOTFOUND", 
+                									 new Object[] {XmlUtils.toString(frag.toXML(), false)}));
+            }
+            // the target nodes of create-only/insert expressions in Muse are
+            // the parent nodes under which
+            // to insert/create values; if the immediate parents under which to
+            // add values are null,
+            // we throw a fault. Look at PutInsertXPath expression to understand
+            // how target nodes
+            // of insert/create requests are evaluated
+            throw new PutFault(_MESSAGES.get("PARENTNOTFOUND", new Object[] {XmlUtils.toString(frag.toXML(), false)}));
+        }
+    }
+
+    private void checkForReadOnlyTargetNodes(Fragment frag, Node[] targetNodes) throws PutFault
+    {
+
+        // read-only properties are specified via metadata
+        MetadataDescriptor wsrpMD = _rpCollection.getMetadata();
+
+        // ensure that the target node's top level property isn't a read
+        // only/immutable property
+        for (int i = 0; i < targetNodes.length; i++)
+        {
+            Node topLevelProp = targetNodes[i];
+
+            if (topLevelProp == _wsrpDocElement)
+            {
+                // doesn't make sense to check if wsrp doc root is a read-only
+                // wsrf prop
+                return;
+            }
+            // find the top level property of target node
+            while (topLevelProp.getParentNode() != _wsrpDocElement)
+                topLevelProp = topLevelProp.getParentNode();
+
+            QName topLevelTargetNodeName = new QName(topLevelProp.getNamespaceURI(),
+                    topLevelProp.getLocalName());
+
+            if (wsrpMD.isReadOnlyExternal(topLevelTargetNodeName))
+            {
+                throw new PutFault("This fragment attempted to set read only property "
+                        + topLevelTargetNodeName + ": " + XmlUtils.toString(frag.toXML(), false));
+            }
+        }
+    }
+
+    /**
+     * Applies WS-RT Put modify fragment to target node. The target node must be
+     * an element, text or attribute node, otherwise a fault is thrown.
+     * 
+     */
+    private void applyModifyOp(Node targetNode, Fragment fragment) throws PutFault
+    {
+        // the value to be set by fragment
+        Node[] fragmentValue = fragment.getValue();
+        short targetNodeType = targetNode.getNodeType();
+
+        // node could be element, text, or an attribute.
+        if (targetNodeType == Node.ELEMENT_NODE)
+        {
+
+            // if target node to modify is an element, the fragment value Node[]
+            // should have
+            // ONE element node in it.
+            Node elementToSet = fragmentValue[0];
+
+            if (elementToSet.getNodeType() != Node.ELEMENT_NODE)
+                throw new PutFault(_MESSAGES.get("MODIFYTARGETELEMENTMISMATCH",
+                                    new Object[] {XmlUtils.toString(fragment.toXML())}));
+
+            // create a copy of value node in wsrp doc, otherwise replaceChild
+            // operation
+            // below will fail with a WRONG_DOCUMENT_ERR exception if we add
+            // frag value node directly
+            Element wsrpDocFragValue = createElementInDoc(_wsrpDoc, (Element)elementToSet);
+
+            Node parent = targetNode.getParentNode();
+            parent.replaceChild(wsrpDocFragValue, targetNode);
+
+        }
+        else if (targetNodeType == Node.ATTRIBUTE_NODE || targetNodeType == Node.TEXT_NODE)
+        {
+            // if target node to modify is a text or attribute, the fragment
+            // value Node[] should have
+            // ONE text node in it.
+            Node textToSet = fragmentValue[0];
+
+            if (textToSet.getNodeType() != Node.TEXT_NODE)
+                throw new PutFault(_MESSAGES.get("MODIFYTARGETTEXTMISMATCH",
+                                   new Object[] {XmlUtils.toString(fragment.toXML())}));
+
+            targetNode.setNodeValue(textToSet.getNodeValue());
+        }
+        else
+        {
+            throw new PutFault(_MESSAGES.get("MODIFYTARGETINVALID",
+            									 new Object[] {XmlUtils.toString(fragment.toXML())}));
+        }
+
+    }
+
+    /**
+     * Applies WS-RT Put insert fragment to target node. The target node is the
+     * node under which the fragment value has to be added as child(ren). The
+     * target must be an element.
+     * 
+     */
+    private void applyInsertOp(Node targetNode, Fragment fragment) throws PutFault
+    {
+        Node[] fragmentValue = fragment.getValue();
+        short targetNodeType = targetNode.getNodeType();
+
+        // only element nodes can be insertion points; it doesn't make
+        // sense to make an attribute or text node an insertion point because
+        // they can't have child nodes.
+
+        if (targetNodeType == Node.ELEMENT_NODE)
+        {
+            // if insertion point is an element node, value can be elements,
+            // text nodes
+            // or mixed content.
+            for (int n = 0; n < fragmentValue.length; n++)
+            {
+                Node fragValueChild = fragmentValue[n];
+
+                if (fragValueChild.getNodeType() == Node.ELEMENT_NODE)
+                {
+                    // create a copy of value element in wsrp doc, otherwise
+                    // appendChild operation
+                    // below will fail with a WRONG_DOCUMENT_ERR exception if we
+                    // add frag value node directly
+                    Element wsrpDocFragValue = createElementInDoc(_wsrpDoc, (Element)fragValueChild);
+                    targetNode.appendChild(wsrpDocFragValue);
+                }
+                else if (fragValueChild.getNodeType() == Node.TEXT_NODE)
+                {
+                    // create a copy of text node in wsrp doc, otherwise
+                    // appendChild operation
+                    // below will fail with a WRONG_DOCUMENT_ERR exception
+                    Node wsrpDocTextNode = _wsrpDoc.createTextNode(fragValueChild.getNodeValue());
+                    targetNode.appendChild(wsrpDocTextNode);
+                }
+                else
+                    throw new PutFault(_MESSAGES.get("INSERTTARGETELEMENTMISMATCH", 
+                    									new Object[] {XmlUtils.toString(fragment.toXML())}));
+
+            }
+        }
+        else
+        {
+            throw new PutFault(_MESSAGES.get("INSERTPARTENOTELEMENT",
+            										new Object[] {XmlUtils.toString(fragment.toXML())}));
+        }
+    }
+
+
+    /**
+     * Applies WS-RT Put remove fragment to target node. It simply removes the
+     * target node from document. The target node can not be the root element
+     * 
+     */
+    private void applyRemoveOp(Node targetNode, Fragment fragment) throws PutFault
+    {
+        if (targetNode == _wsrpDocElement)
+        {
+            // it doesnt make a lot of sense to be able to delete root element
+            // in this implementation since wsrt is wrapped around wsrf
+            // properties and
+            // the root wsrf element is pretty much a dumb element anyway; no
+            // read only
+            // properties can be applied to it etc, so we disallow this
+            // operation for now
+            throw new PutFault(_MESSAGES.get("REMOVEROOTERROR",
+            									 new Object[] {XmlUtils.toString(fragment.toXML())}));
+        }
+
+        targetNode.getParentNode().removeChild(targetNode);
+    }
+
+    private Element createElementInDoc(Document targetDoc, Element elementToCreate)
+    {
+        QName qname = new QName(elementToCreate.getNamespaceURI(), elementToCreate.getLocalName(),
+                elementToCreate.getPrefix());
+
+        return XmlUtils.createElement(targetDoc, qname, elementToCreate, true);
+    }
+
+}

Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/SetRequestPutValue.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/SetRequestPutValue.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/SetRequestPutValue.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/SetRequestPutValue.java Sat Mar 24 06:24:32 2007
@@ -1,61 +1,64 @@
-/*=============================================================================*
- *  Copyright 2006 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.muse.ws.resource.transfer.put.impl;
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.ws.resource.basefaults.BaseFault;
-import org.apache.muse.ws.resource.properties.set.SetCapability;
-import org.apache.muse.ws.resource.properties.set.SetRequest;
-import org.apache.muse.ws.resource.transfer.put.PutValue;
-
-/**
- * WS-RT requests that get broken down into SetRequest components use this as
- * the PutValue
- * 
- * @author Mohammad Fakhar
- * 
- */
-
-public class SetRequestPutValue implements PutValue
-{
-    private SetRequest _setReq;
-
-    public Element execute(SetCapability setCapability) throws BaseFault
-    {
-        setCapability.setResourceProperties(_setReq);
-
-        return null;
-    }
-
-    public SetRequestPutValue(SetRequest req)
-    {
-        _setReq = req;
-    }
-
-    public SetRequest getSetReq()
-    {
-        return _setReq;
-    }
-
-    public void setSetReq(SetRequest setReq)
-    {
-        _setReq = setReq;
-    }
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.muse.ws.resource.transfer.put.impl;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.set.SetCapability;
+import org.apache.muse.ws.resource.properties.set.SetRequest;
+import org.apache.muse.ws.resource.transfer.put.PutValue;
+
+/**
+ * WS-RT requests that get broken down into SetRequest components use this as
+ * the PutValue
+ * 
+ * @author Mohammad Fakhar
+ * 
+ */
+
+public class SetRequestPutValue implements PutValue
+{
+    private SetRequest _setReq;
+
+    public Element execute(SetCapability setCapability) throws BaseFault
+    {
+        setCapability.setResourceProperties(_setReq);
+
+        return null;
+    }
+
+    public SetRequestPutValue(SetRequest req)
+    {
+        _setReq = req;
+    }
+
+    public SetRequest getSetReq()
+    {
+        return _setReq;
+    }
+
+    public void setSetReq(SetRequest setReq)
+    {
+        _setReq = setReq;
+    }
+
+}

Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/SimplePutCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/SimplePutCapability.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/SimplePutCapability.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/put/impl/SimplePutCapability.java Sat Mar 24 06:24:32 2007
@@ -1,192 +1,195 @@
-/*=============================================================================*
- *  Copyright 2006 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.muse.ws.resource.transfer.put.impl;
-
-import java.lang.reflect.Method;
-import java.util.Map;
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.core.routing.MessageHandler;
-import org.apache.muse.util.ReflectUtils;
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
-import org.apache.muse.ws.addressing.soap.SoapFault;
-import org.apache.muse.ws.metadata.WsxConstants;
-import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
-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.set.faults.InvalidModificationFault;
-import org.apache.muse.ws.resource.properties.set.impl.SimpleSetCapability;
-import org.apache.muse.ws.resource.transfer.ExpressionFactory;
-import org.apache.muse.ws.resource.transfer.faults.InvalidExpressionFault;
-import org.apache.muse.ws.resource.transfer.impl.SimpleExpressionFactory;
-import org.apache.muse.ws.resource.transfer.metadata.MetadataCapability;
-import org.apache.muse.ws.resource.transfer.metadata.impl.SimpleMetadataCapability;
-import org.apache.muse.ws.resource.transfer.put.PutFault;
-import org.apache.muse.ws.resource.transfer.put.PutValue;
-import org.apache.muse.ws.resource.transfer.put.ResourceValidationFault;
-import org.apache.muse.ws.resource.transfer.put.PutCapability;
-
-/**
- * This is Muse's default implementation of WS-RT Put capability. Muse delegates
- * to WS-RF Set capability to process WS-RT Puts on the resource.
- * 
- * For WS-RT Get, Muse entirely delegates to WSRF capabilities for processing;
- * however, WS-RT Put is more complicated because WSRF does not define
- * operations for inserting xml fragments in positions identified by query
- * dialects. The PutRequest and PutQNameRequest classes are key to understanding
- * how Muse solves this problem by breaking down a WS-RT Put request into
- * SetRequest that can be passed to the WS-RF Set capability for processing.
- * 
- * @author Mohammad Fakhar
- * 
- */
-
-public class SimplePutCapability extends AbstractWsResourceCapability implements PutCapability
-{
-
-	  //
-	  // Used to lookup all exception messages
-	  //
-	  private Messages _MESSAGES = MessagesFactory.get(SimplePutCapability.class);
-	
-    // the wsrf set capability to which processing is delegated
-    protected SimpleSetCapability wsrfSetCap = null;
-
-    // the wsrt metdata capability is used to figure out if a dialect is
-    // supported by
-    // this capability or not.
-    protected MetadataCapability wsrtMDCap = null;
-
-    // the expression factory can be plugged in via an initialization parameter
-    // to
-    // support dialects other than QNAME and xpath.
-    protected ExpressionFactory exprFactory = null;
-
-    // the initialization parameter that can be used to override Muse's
-    // default implementation of ExpressionFactory interface
-    public static final String EXPR_FACTORY_PARAM = "ExpressionFactory";
-
-    protected MessageHandler createPutHandler()
-    {
-        // resource properties are needed by the handler to break down the WS-RT
-        // Put request into SetRequestComponent objects that can be understood
-        // by wsrf set capability
-        ResourcePropertyCollection propCollection = getWsResource().getPropertyCollection();
-
-        MessageHandler handler = new PutHandler(propCollection, exprFactory, wsrtMDCap);
-
-        Method method = ReflectUtils.getFirstMethod(this.getClass(), "put");
-
-        handler.setMethod(method);
-
-        return handler;
-    }
-
-    public Element put(PutValue value) throws ResourceValidationFault, InvalidExpressionFault, SoapFault
-    {
-        try
-        {
-            Element result = value.execute(wsrfSetCap);
-            return result;
-        }
-        catch (InvalidModificationFault e)
-        {
-            throw new ResourceValidationFault(e);
-        }
-        catch (InvalidResourcePropertyQNameFault e)
-        {
-            // prop doesn't exist
-            throw new InvalidExpressionFault(e, false);
-        }
-        catch (Exception e)
-        {
-
-            throw new PutFault(e, _MESSAGES.get("PUTFAULT", new Object[] {e.getMessage()}));
-        }
-    }
-
-    public void initialize() throws SoapFault
-    {
-        super.initialize();
-
-        Map initParams = getInitializationParameters();
-        String exprFactParam = null;
-
-        if (initParams != null)
-            // get the expr factory parameter that indicates what expression
-            // factory to use.
-            // This can be used to plug in expression factories for custom
-            // dialects.
-            exprFactParam = (String)getInitializationParameters().get(EXPR_FACTORY_PARAM);
-
-        if (exprFactParam == null) // if no param passed, use defaut expression
-                                    // factory
-            exprFactory = new SimpleExpressionFactory();
-        else
-        {
-            Object factory = createClassInstance(exprFactParam);
-            if (!(factory instanceof ExpressionFactory))
-            {
-                throw new SoapFault(_MESSAGES.get("EXPRFACTCLASSINVALID", new Object[] {factory.getClass().getName()}));
-            }
-            exprFactory = (ExpressionFactory)factory;
-        }
-
-        wsrfSetCap = (SimpleSetCapability)getWsResource().getCapability(WsrpConstants.SET_CAPABILITY);
-        if (wsrfSetCap == null)
-        {
-            wsrfSetCap = new SimpleSetCapability();
-            wsrfSetCap.initialize();
-        }
-
-        wsrtMDCap = (MetadataCapability)getWsResource().getCapability(WsxConstants.GET_METADATA_CAPABILITY);
-        if (wsrtMDCap == null)
-        {
-            wsrtMDCap = new SimpleMetadataCapability();
-            wsrtMDCap.initialize();
-        }
-
-        setMessageHandler(createPutHandler());
-
-    }
-
-    private Object createClassInstance(String factoryParam) throws SoapFault
-    {
-        // get the class for factory from class loader
-        Class loadedClass = null;
-        Object factoryInstance = null;
-        try
-        {
-            loadedClass = Class.forName(factoryParam);
-            factoryInstance = loadedClass.newInstance();
-        }
-        catch (ClassNotFoundException e)
-        {
-            throw new SoapFault(_MESSAGES.get("EXPRFACTLOADERROR", new Object[] {factoryParam}));
-        }
-        catch (Exception e)
-        {
-            throw new SoapFault(_MESSAGES.get("EXPRFACTCREATEERROR", new Object[] {factoryParam, e.getMessage()}));
-        }
-
-        return factoryInstance;
-    }
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.muse.ws.resource.transfer.put.impl;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.core.routing.MessageHandler;
+import org.apache.muse.util.ReflectUtils;
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.metadata.WsxConstants;
+import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
+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.set.faults.InvalidModificationFault;
+import org.apache.muse.ws.resource.properties.set.impl.SimpleSetCapability;
+import org.apache.muse.ws.resource.transfer.ExpressionFactory;
+import org.apache.muse.ws.resource.transfer.faults.InvalidExpressionFault;
+import org.apache.muse.ws.resource.transfer.impl.SimpleExpressionFactory;
+import org.apache.muse.ws.resource.transfer.metadata.MetadataCapability;
+import org.apache.muse.ws.resource.transfer.metadata.impl.SimpleMetadataCapability;
+import org.apache.muse.ws.resource.transfer.put.PutFault;
+import org.apache.muse.ws.resource.transfer.put.PutValue;
+import org.apache.muse.ws.resource.transfer.put.ResourceValidationFault;
+import org.apache.muse.ws.resource.transfer.put.PutCapability;
+
+/**
+ * This is Muse's default implementation of WS-RT Put capability. Muse delegates
+ * to WS-RF Set capability to process WS-RT Puts on the resource.
+ * 
+ * For WS-RT Get, Muse entirely delegates to WSRF capabilities for processing;
+ * however, WS-RT Put is more complicated because WSRF does not define
+ * operations for inserting xml fragments in positions identified by query
+ * dialects. The PutRequest and PutQNameRequest classes are key to understanding
+ * how Muse solves this problem by breaking down a WS-RT Put request into
+ * SetRequest that can be passed to the WS-RF Set capability for processing.
+ * 
+ * @author Mohammad Fakhar
+ * 
+ */
+
+public class SimplePutCapability extends AbstractWsResourceCapability implements PutCapability
+{
+
+	  //
+	  // Used to lookup all exception messages
+	  //
+	  private Messages _MESSAGES = MessagesFactory.get(SimplePutCapability.class);
+	
+    // the wsrf set capability to which processing is delegated
+    protected SimpleSetCapability wsrfSetCap = null;
+
+    // the wsrt metdata capability is used to figure out if a dialect is
+    // supported by
+    // this capability or not.
+    protected MetadataCapability wsrtMDCap = null;
+
+    // the expression factory can be plugged in via an initialization parameter
+    // to
+    // support dialects other than QNAME and xpath.
+    protected ExpressionFactory exprFactory = null;
+
+    // the initialization parameter that can be used to override Muse's
+    // default implementation of ExpressionFactory interface
+    public static final String EXPR_FACTORY_PARAM = "ExpressionFactory";
+
+    protected MessageHandler createPutHandler()
+    {
+        // resource properties are needed by the handler to break down the WS-RT
+        // Put request into SetRequestComponent objects that can be understood
+        // by wsrf set capability
+        ResourcePropertyCollection propCollection = getWsResource().getPropertyCollection();
+
+        MessageHandler handler = new PutHandler(propCollection, exprFactory, wsrtMDCap);
+
+        Method method = ReflectUtils.getFirstMethod(this.getClass(), "put");
+
+        handler.setMethod(method);
+
+        return handler;
+    }
+
+    public Element put(PutValue value) throws ResourceValidationFault, InvalidExpressionFault, SoapFault
+    {
+        try
+        {
+            Element result = value.execute(wsrfSetCap);
+            return result;
+        }
+        catch (InvalidModificationFault e)
+        {
+            throw new ResourceValidationFault(e);
+        }
+        catch (InvalidResourcePropertyQNameFault e)
+        {
+            // prop doesn't exist
+            throw new InvalidExpressionFault(e, false);
+        }
+        catch (Exception e)
+        {
+
+            throw new PutFault(e, _MESSAGES.get("PUTFAULT", new Object[] {e.getMessage()}));
+        }
+    }
+
+    public void initialize() throws SoapFault
+    {
+        super.initialize();
+
+        Map initParams = getInitializationParameters();
+        String exprFactParam = null;
+
+        if (initParams != null)
+            // get the expr factory parameter that indicates what expression
+            // factory to use.
+            // This can be used to plug in expression factories for custom
+            // dialects.
+            exprFactParam = (String)getInitializationParameters().get(EXPR_FACTORY_PARAM);
+
+        if (exprFactParam == null) // if no param passed, use defaut expression
+                                    // factory
+            exprFactory = new SimpleExpressionFactory();
+        else
+        {
+            Object factory = createClassInstance(exprFactParam);
+            if (!(factory instanceof ExpressionFactory))
+            {
+                throw new SoapFault(_MESSAGES.get("EXPRFACTCLASSINVALID", new Object[] {factory.getClass().getName()}));
+            }
+            exprFactory = (ExpressionFactory)factory;
+        }
+
+        wsrfSetCap = (SimpleSetCapability)getWsResource().getCapability(WsrpConstants.SET_CAPABILITY);
+        if (wsrfSetCap == null)
+        {
+            wsrfSetCap = new SimpleSetCapability();
+            wsrfSetCap.initialize();
+        }
+
+        wsrtMDCap = (MetadataCapability)getWsResource().getCapability(WsxConstants.GET_METADATA_CAPABILITY);
+        if (wsrtMDCap == null)
+        {
+            wsrtMDCap = new SimpleMetadataCapability();
+            wsrtMDCap.initialize();
+        }
+
+        setMessageHandler(createPutHandler());
+
+    }
+
+    private Object createClassInstance(String factoryParam) throws SoapFault
+    {
+        // get the class for factory from class loader
+        Class loadedClass = null;
+        Object factoryInstance = null;
+        try
+        {
+            loadedClass = Class.forName(factoryParam);
+            factoryInstance = loadedClass.newInstance();
+        }
+        catch (ClassNotFoundException e)
+        {
+            throw new SoapFault(_MESSAGES.get("EXPRFACTLOADERROR", new Object[] {factoryParam}));
+        }
+        catch (Exception e)
+        {
+            throw new SoapFault(_MESSAGES.get("EXPRFACTCREATEERROR", new Object[] {factoryParam, e.getMessage()}));
+        }
+
+        return factoryInstance;
+    }
+}

Modified: webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/remote/AbstractWsrtResourceClient.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/remote/AbstractWsrtResourceClient.java?view=diff&rev=522026&r1=522025&r2=522026
==============================================================================
--- webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/remote/AbstractWsrtResourceClient.java (original)
+++ webservices/muse/trunk/modules/preview/muse-wsrt-impl/src/org/apache/muse/ws/resource/transfer/remote/AbstractWsrtResourceClient.java Sat Mar 24 06:24:32 2007
@@ -1,116 +1,119 @@
-/*=============================================================================*
- *  Copyright 2006 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.muse.ws.resource.transfer.remote;
-
-import java.net.URI;
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.core.AbstractResourceClient;
-import org.apache.muse.core.Environment;
-import org.apache.muse.ws.addressing.EndpointReference;
-import org.apache.muse.ws.addressing.soap.SoapClient;
-import org.apache.muse.ws.addressing.soap.SoapFault;
-import org.apache.muse.ws.addressing.soap.SoapUtils;
-import org.apache.muse.ws.resource.transfer.addressing.WsrtSoapClient;
-
-public class AbstractWsrtResourceClient extends AbstractResourceClient
-{
-    public AbstractWsrtResourceClient(EndpointReference destination)
-    {
-        super(destination);
-    }
-
-    public AbstractWsrtResourceClient(EndpointReference destination, EndpointReference source)
-    {
-        super(destination, source);
-    }
-
-    public AbstractWsrtResourceClient(EndpointReference destination, EndpointReference source, Environment environment)
-    {
-        super(destination, source, environment);
-    }
-
-    public AbstractWsrtResourceClient(EndpointReference destination, EndpointReference source, SoapClient soapClient)
-    {
-        super(destination, source, soapClient);
-    }
-
-    /**
-     * Invokes WS-RT, including the base WS-T, operations. 
-     * If the operation is not a base WS-T operation, the isWsrt
-     * boolean should be false.
-     * WSRT operations can return multiple elements in the body; there is no
-     * guarantee that the return value will always be wrapped by a single
-     * element. Therefore, this invoke operation returns the entire element[]
-     * from the operation, <br>
-     * <br>
-     * The parameters are wrapped in a SOAP envelope and sent to the destination
-     * using the proxy's SoapClient. If a JAX-RPC SOAPException is thrown, it is
-     * wrapped in a RemoteException; if a SOAP Fault or WS-BF BaseFault is
-     * returned, it is parsed and thrown as a BaseFault.
-     * 
-     * @return The SOAP Body from the response message, or null if there was no
-     *         response.
-     * 
-     */
-    public Element[] invokeWSRTOperation(URI action, Element soapBody, boolean isWSRT) 
-    throws SoapFault
-    {
-        SoapClient soap = null;
-        Element[] body = null;
-     
-        boolean trace = getSoapClient().isUsingTrace();
-        
-        if(isWSRT)
-         soap = getWsrtSoapClient(trace);
-        else
-         soap = getSoapClient();
-                
-        if(soapBody == null)
-         body = new Element[0];
-        else
-         body = new Element[] { soapBody };
-        
-        Element[] response = soap.send(getSource(), getDestination(), action.toString(), body);
-
-        //
-        // no response at all is still a valid response
-        //
-        if (response.length == 0)
-            return null;
-
-        //
-        // faults that aren't network or location-related will be packaged
-        // in the response's SOAP body, so we need to parse and check
-        //
-        if (SoapUtils.isFault(response[0]))
-            throw new SoapFault(response[0]);
-
-        return response;
-    }
-    
-    public SoapClient getWsrtSoapClient(boolean trace)
-    {
-    	SoapClient client = new WsrtSoapClient();
-    	client.setTrace(trace);
-    	
-    	return client;
-    }
-    
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.muse.ws.resource.transfer.remote;
+
+import java.net.URI;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.core.AbstractResourceClient;
+import org.apache.muse.core.Environment;
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.addressing.soap.SoapClient;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.addressing.soap.SoapUtils;
+import org.apache.muse.ws.resource.transfer.addressing.WsrtSoapClient;
+
+public class AbstractWsrtResourceClient extends AbstractResourceClient
+{
+    public AbstractWsrtResourceClient(EndpointReference destination)
+    {
+        super(destination);
+    }
+
+    public AbstractWsrtResourceClient(EndpointReference destination, EndpointReference source)
+    {
+        super(destination, source);
+    }
+
+    public AbstractWsrtResourceClient(EndpointReference destination, EndpointReference source, Environment environment)
+    {
+        super(destination, source, environment);
+    }
+
+    public AbstractWsrtResourceClient(EndpointReference destination, EndpointReference source, SoapClient soapClient)
+    {
+        super(destination, source, soapClient);
+    }
+
+    /**
+     * Invokes WS-RT, including the base WS-T, operations. 
+     * If the operation is not a base WS-T operation, the isWsrt
+     * boolean should be false.
+     * WSRT operations can return multiple elements in the body; there is no
+     * guarantee that the return value will always be wrapped by a single
+     * element. Therefore, this invoke operation returns the entire element[]
+     * from the operation, <br>
+     * <br>
+     * The parameters are wrapped in a SOAP envelope and sent to the destination
+     * using the proxy's SoapClient. If a JAX-RPC SOAPException is thrown, it is
+     * wrapped in a RemoteException; if a SOAP Fault or WS-BF BaseFault is
+     * returned, it is parsed and thrown as a BaseFault.
+     * 
+     * @return The SOAP Body from the response message, or null if there was no
+     *         response.
+     * 
+     */
+    public Element[] invokeWSRTOperation(URI action, Element soapBody, boolean isWSRT) 
+    throws SoapFault
+    {
+        SoapClient soap = null;
+        Element[] body = null;
+     
+        boolean trace = getSoapClient().isUsingTrace();
+        
+        if(isWSRT)
+         soap = getWsrtSoapClient(trace);
+        else
+         soap = getSoapClient();
+                
+        if(soapBody == null)
+         body = new Element[0];
+        else
+         body = new Element[] { soapBody };
+        
+        Element[] response = soap.send(getSource(), getDestination(), action.toString(), body);
+
+        //
+        // no response at all is still a valid response
+        //
+        if (response.length == 0)
+            return null;
+
+        //
+        // faults that aren't network or location-related will be packaged
+        // in the response's SOAP body, so we need to parse and check
+        //
+        if (SoapUtils.isFault(response[0]))
+            throw new SoapFault(response[0]);
+
+        return response;
+    }
+    
+    public SoapClient getWsrtSoapClient(boolean trace)
+    {
+    	SoapClient client = new WsrtSoapClient();
+    	client.setTrace(trace);
+    	
+    	return client;
+    }
+    
+}



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