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/06/12 18:12:21 UTC
svn commit: r413698 [6/7] - in /webservices/muse/trunk/modules/muse-wsrf:
specs/ src/org/apache/muse/ws/resource/
src/org/apache/muse/ws/resource/basefaults/
src/org/apache/muse/ws/resource/ext/
src/org/apache/muse/ws/resource/ext/faults/ src/org/apach...
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/InvalidModificationFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/InvalidModificationFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/InvalidModificationFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/InvalidModificationFault.java Mon Jun 12 09:12:15 2006
@@ -0,0 +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.properties.set.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class InvalidModificationFault extends BaseFault
+{
+ private static final long serialVersionUID = -322440717755308354L;
+
+ public InvalidModificationFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public InvalidModificationFault(String message)
+ {
+ super(WsrpConstants.INVALID_MODIFICATION_QNAME, message);
+ }
+
+ public InvalidModificationFault(String message, Throwable cause)
+ {
+ super(WsrpConstants.INVALID_MODIFICATION_QNAME, message, cause);
+ }
+
+ public InvalidModificationFault(Throwable cause)
+ {
+ super(WsrpConstants.INVALID_MODIFICATION_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/SetResourcePropertyRequestFailedFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/SetResourcePropertyRequestFailedFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/SetResourcePropertyRequestFailedFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/SetResourcePropertyRequestFailedFault.java Mon Jun 12 09:12:15 2006
@@ -0,0 +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.properties.set.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class SetResourcePropertyRequestFailedFault extends BaseFault
+{
+ private static final long serialVersionUID = 2505691715009677115L;
+
+ public SetResourcePropertyRequestFailedFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public SetResourcePropertyRequestFailedFault(String message)
+ {
+ super(WsrpConstants.SET_RP_FAILED_QNAME, message);
+ }
+
+ public SetResourcePropertyRequestFailedFault(String message, Throwable cause)
+ {
+ super(WsrpConstants.SET_RP_FAILED_QNAME, message, cause);
+ }
+
+ public SetResourcePropertyRequestFailedFault(Throwable cause)
+ {
+ super(WsrpConstants.SET_RP_FAILED_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/UnableToModifyResourcePropertyFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/UnableToModifyResourcePropertyFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/UnableToModifyResourcePropertyFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/faults/UnableToModifyResourcePropertyFault.java Mon Jun 12 09:12:15 2006
@@ -0,0 +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.properties.set.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class UnableToModifyResourcePropertyFault extends BaseFault
+{
+ private static final long serialVersionUID = 7530628873576034625L;
+
+ public UnableToModifyResourcePropertyFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public UnableToModifyResourcePropertyFault(String message)
+ {
+ super(WsrpConstants.UNABLE_TO_MODIFY_QNAME, message);
+ }
+
+ public UnableToModifyResourcePropertyFault(String message, Throwable cause)
+ {
+ super(WsrpConstants.UNABLE_TO_MODIFY_QNAME, message, cause);
+ }
+
+ public UnableToModifyResourcePropertyFault(Throwable cause)
+ {
+ super(WsrpConstants.UNABLE_TO_MODIFY_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/AbstractSetRequestComponent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/AbstractSetRequestComponent.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/AbstractSetRequestComponent.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/AbstractSetRequestComponent.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,154 @@
+/*=============================================================================*
+ * 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.properties.set.impl;
+
+import javax.xml.namespace.QName;
+
+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.XmlUtils;
+import org.apache.muse.ws.resource.properties.impl.WsrpUtils;
+import org.apache.muse.ws.resource.properties.set.SetRequestComponent;
+
+/**
+ *
+ * AbstractSetRequestComponent is a the base class for the WS-ResourceProperties
+ * QueryResourceProperties operations. It provides the basic creation and
+ * execution mechanisms, as well as security.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public abstract class AbstractSetRequestComponent implements SetRequestComponent
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES =
+ MessagesFactory.get(AbstractSetRequestComponent.class);
+
+ //
+ // The name of the property to modify
+ //
+ private QName _qname = null;
+
+ //
+ // The token that the WS-RP container can use to determine if this
+ // request was created from within the touchpoint instance or by
+ // an external request. The default is a unique, non-null token that
+ // will not map to any WS-RP container.
+ //
+ private Object _securityToken = new Object();
+
+ //
+ // The values (instances) of the property to use during modification
+ //
+ private Element[] _valuesXML = null;
+
+ public int getNumberOfValues()
+ {
+ return _valuesXML.length;
+ }
+
+ public QName getPropertyName()
+ {
+ return _qname;
+ }
+
+ public Object getSecurityToken()
+ {
+ return _securityToken;
+ }
+
+ public Element getValue(int index)
+ {
+ return _valuesXML[index];
+ }
+
+ public Element[] getValues()
+ {
+ return _valuesXML;
+ }
+
+ public final void setPropertyName(QName qname)
+ {
+ if (qname == null)
+ throw new NullPointerException(_MESSAGES.get("NullQName"));
+
+ _qname = qname;
+ }
+
+ public final void setSecurityToken(Object securityToken)
+ {
+ _securityToken = securityToken;
+ }
+
+ public final void setValues(Object[] values)
+ {
+ if (values == null)
+ throw new NullPointerException(_MESSAGES.get("NullValueArray"));
+
+ if (values.length == 0)
+ {
+ _valuesXML = EMPTY_VALUES;
+ return;
+ }
+
+ QName qname = getPropertyName();
+
+ int firstNonNull = -1;
+
+ for (int n = 0; n < values.length && firstNonNull < 0; ++n)
+ if (values[n] != null)
+ firstNonNull = n;
+
+ if (firstNonNull < 0)
+ {
+ firstNonNull = 0;
+ Element xml = XmlUtils.createElement(qname);
+
+ for (int n = 0; n < values.length; ++n)
+ values[n] = xml;
+ }
+
+ Class type = values[firstNonNull].getClass();
+
+ if (Element.class.isAssignableFrom(type))
+ {
+ _valuesXML = new Element[values.length];
+
+ for (int n = 0; n < values.length; ++n)
+ _valuesXML[n] = XmlUtils.createElement(qname, values[n]);
+ }
+
+ else
+ {
+ try
+ {
+ _valuesXML = WsrpUtils.convertToElements(values, type, qname);
+ }
+
+ catch (Throwable error)
+ {
+ throw new RuntimeException(error.getMessage(), error);
+ }
+ }
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/InsertRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/InsertRequest.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/InsertRequest.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/InsertRequest.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,145 @@
+/*=============================================================================*
+ * 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.properties.set.impl;
+
+import javax.xml.namespace.QName;
+
+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.XmlUtils;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.ext.faults.InvalidMessageFormatFault;
+import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+/**
+ *
+ * InsertRequest is a serializer/deserializer for the WS-ResourceProperties
+ * Insert operation, which is part of SetResourceProperties.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class InsertRequest extends AbstractSetRequestComponent
+{
+ //
+ // The name of this SetResourceProperties operation
+ //
+ public static final String OPERATION = "Insert";
+
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(InsertRequest.class);
+
+ public InsertRequest(QName qname)
+ {
+ this(qname, 1);
+ }
+
+ public InsertRequest(QName qname, int numberOfCopies)
+ {
+ this(qname, new Object[numberOfCopies]);
+ }
+
+ public InsertRequest(QName qname, Object value)
+ {
+ this(qname, new Object[]{ value });
+ }
+
+ public InsertRequest(QName qname, Object[] values)
+ {
+ if (qname == null)
+ throw new NullPointerException(_MESSAGES.get("NullQName"));
+
+ if (values == null)
+ throw new NullPointerException(_MESSAGES.get("NullValueArray"));
+
+ if (values.length == 0)
+ throw new IllegalArgumentException(_MESSAGES.get("EmptyValuesArray"));
+
+ setPropertyName(qname);
+ setValues(values);
+ }
+
+ public InsertRequest(Element request)
+ throws BaseFault
+ {
+ if (request == null)
+ throw new NullPointerException(_MESSAGES.get("NullRequestElement"));
+
+ Element[] children = XmlUtils.getAllElements(request);
+
+ if (children.length == 0)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NoPropertiesFoundInsert"));
+
+ //
+ // the WS-RP spec says that in an Insert request with multiple
+ // elements, all elements MUST have the same qualified name
+ //
+
+ QName firstQName = XmlUtils.getElementQName(children[0]);
+
+ Element[] matches = XmlUtils.getElements(request, firstQName);
+
+ if (matches.length != children.length)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NamesNotEqualInsert"));
+
+ setPropertyName(firstQName);
+ setValues(children);
+ }
+
+ public void execute(ResourcePropertyCollection properties)
+ throws BaseFault
+ {
+ if (properties == null)
+ throw new NullPointerException(_MESSAGES.get("NullProperties"));
+
+ properties.insertResourceProperty(getPropertyName(), getValues(), getSecurityToken());
+ }
+
+ public String toString()
+ {
+ return XmlUtils.toString(toXML(), false);
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document doc)
+ {
+ if (doc == null)
+ throw new NullPointerException(_MESSAGES.get("NullDocument"));
+
+ Element root = XmlUtils.createElement(doc, WsrpConstants.INSERT_QNAME);
+ Element[] values = getValues();
+
+ for (int n = 0; n < values.length; ++n)
+ {
+ Element next = (Element)doc.importNode(values[n], true);
+ root.appendChild(next);
+ }
+
+ return root;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/Messages.properties?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/Messages.properties (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/Messages.properties Mon Jun 12 09:12:15 2006
@@ -0,0 +1,15 @@
+NullValue = The property value is null.
+NullValueArray = The array holding the property values is null.
+EmptyValuesArray = The array of property values is null. If you want to set properties to null, you still need a non-empty array - just add null value(s) to it.
+NoPropertiesFoundInsert = The Insert request element did not include any property instances. An Insert operation must specify at least one property.
+NamesNotEqualInsert = The Insert request contained property instances that do not have the same QName. The WS-RP spec requires that all properties added with an Insert operation be of the same name.
+NoPropertiesFoundUpdate = The Update request element did not include a property instance (value). An Update operation must specify a property instance that can be used to modify (update) all of the current properties with the same name.
+EmptySetRequestBuilt = Could not serialize SetResourceProperties request to XML because it is empty - there are no concrete 'set' operations in the request. Valid SetRequests can be built using the SetRequest.add method.
+EmptySetRequest = The SetResourceProperties request had no concrete 'set' operations. The WS-RP spec requires that the request have at least one Insert/Delete/Update operation.
+NullQuery = The query string is null.
+NullDialect = The dialect string is null.
+NoQueryExpressionFound = The QueryResourceProperties request does not have a QueryExpression element; this element must be present in order to get the query string and dialect for the request.
+NoQueryFound = The QueryExpression element in the QueryResourceProperties request did not contain a query string. What is the query to run?
+NoDialectFound = The QueryExpression element in the QueryResourceProperties request did not have a dialect attribute. What is the language of the query being run?
+NullNodeList = The DOM NodeList with the results of the QueryResourceProperties query is null.
+InvalidSet = The SetResourceProperties request contained an invalid operation, 'XXX'. The only valid operations are Insert, Update, and Delete.
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SetHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SetHandler.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SetHandler.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SetHandler.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,59 @@
+/*=============================================================================*
+ * 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.properties.set.impl;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.core.routing.AbstractMessageHandler;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+import org.apache.muse.ws.resource.properties.set.SetOperationFactory;
+
+/**
+ *
+ * SetHandler is the parser for the WS-ResourceProperties
+ * SetResourceProperties operation.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ * @see org.apache.muse.ws.resource.properties.set.SetResourceProperties
+ *
+ */
+
+public class SetHandler extends AbstractMessageHandler
+{
+ //
+ // Used to parse all different types of SetResourceProperties
+ //
+ private static final SetOperationFactory _FACTORY = new SimpleSetOperationFactory();
+
+ public SetHandler()
+ {
+ super(WsrpConstants.SET_QNAME);
+ }
+
+ public Object[] fromXML(Element xml)
+ throws SoapFault
+ {
+ return new Object[]{ _FACTORY.createSet(xml) };
+ }
+
+ public Element toXML(Object result)
+ {
+ return WsrpConstants.SET_RESPONSE.toXML();
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SetResponse.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SetResponse.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SetResponse.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SetResponse.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,58 @@
+/*=============================================================================*
+ * 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.properties.set.impl;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.util.xml.XmlUtils;
+
+/**
+ *
+ * SetResponse is a serializer/deserializer for the WS-ResourceProperties
+ * SetResourceProperties operation's response content.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SetResponse implements XmlSerializable
+{
+ private static Element _xml = null;
+
+ static
+ {
+ _xml = XmlUtils.createElement(XmlUtils.EMPTY_DOC, WsrpConstants.SET_RESPONSE_QNAME);
+ }
+
+ public String toString()
+ {
+ return XmlUtils.toString(toXML(), false);
+ }
+
+ public Element toXML()
+ {
+ return _xml;
+ }
+
+ public Element toXML(Document doc)
+ {
+ return (Element)doc.importNode(_xml, true);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetCapability.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetCapability.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetCapability.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,62 @@
+/*=============================================================================*
+ * 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.properties.set.impl;
+
+import java.lang.reflect.Method;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.core.routing.MessageHandler;
+import org.apache.muse.util.ReflectUtils;
+import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
+import org.apache.muse.ws.resource.properties.set.SetCapability;
+import org.apache.muse.ws.resource.properties.set.SetRequest;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+public class SimpleSetCapability
+ extends AbstractWsResourceCapability implements SetCapability
+{
+ protected MessageHandler createSetHandler()
+ {
+ MessageHandler handler = new SetHandler();
+
+ Method method = ReflectUtils.getFirstMethod(getClass(), "setResourceProperties");
+ handler.setMethod(method);
+
+ return handler;
+ }
+
+ public void initialize()
+ throws SoapFault
+ {
+ super.initialize();
+
+ setMessageHandler(createSetHandler());
+ }
+
+ public Element putResourcePropertyDocument(Element wsrpDoc)
+ throws SoapFault
+ {
+ return getWsResource().getPropertyCollection().putResourcePropertyDocument(wsrpDoc);
+ }
+
+ public void setResourceProperties(SetRequest request)
+ throws SoapFault
+ {
+ getWsResource().getPropertyCollection().setResourceProperties(request);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetOperationFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetOperationFactory.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetOperationFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetOperationFactory.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,171 @@
+/*=============================================================================*
+ * 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.properties.set.impl;
+
+import javax.xml.namespace.QName;
+
+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.XmlUtils;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.ext.faults.InvalidMessageFormatFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+import org.apache.muse.ws.resource.properties.set.SetOperationFactory;
+import org.apache.muse.ws.resource.properties.set.SetRequest;
+import org.apache.muse.ws.resource.properties.set.SetRequestComponent;
+
+/**
+ *
+ * SimpleSetOperationFactory provides an API for constructing and parsing WS-RP
+ * SetResourceProperties requests, including the Insert, Delete,
+ * and Update operations. There are convenience methods for creating
+ * outbound requests with each operation type as well as a factory
+ * method for parsing inbound XML into executables.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleSetOperationFactory implements SetOperationFactory
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(SimpleSetOperationFactory.class);
+
+ /**
+ *
+ * This is a convenience method that creates a new SimpleSetRequest object
+ * an populates it with a DeleteRequest for the given property.
+ *
+ * @param qname
+ * The name of the property to delete.
+ *
+ */
+ public SetRequest createDelete(QName qname)
+ {
+ SetRequest set = new SimpleSetRequest();
+ set.addRequestComponent(new DeleteRequest(qname));
+ return set;
+ }
+
+ /**
+ *
+ * This is a convenience method that creates a new SimpleSetRequest object
+ * an populates it with a InsertRequest for the given property.
+ *
+ * @param qname
+ * The name of the property to insert.
+ *
+ * @param values
+ * The initial values for each instance of the property. This
+ * array should not be null, nor empty.
+ *
+ */
+ public SetRequest createInsert(QName qname, Object[] values)
+ {
+ SetRequest set = new SimpleSetRequest();
+ set.addRequestComponent(new InsertRequest(qname, values));
+ return set;
+ }
+
+ /**
+ *
+ * Parses the given XML fragment according to the WS-RP spec for
+ * SetResourceProperties requests.
+ *
+ * @param request
+ * An XML fragment containing a SetResourceProperties request.
+ *
+ * @return A SimpleSetRequest that contains one AbstractSetRequestComponent for each
+ * operation defined in the request. This object can be used
+ * to execute the request against a WS-RP container.
+ *
+ * @throws BaseFault
+ * <ul>
+ * <li>If the request is empty (contains no operations).</li>
+ * <li>If one of the operation types is invalid (only Insert,
+ * Delete, and Update are allowed).</li>
+ * <li>If one of the operations is not properly formatted.</li>
+ * </ul>
+ *
+ */
+ public SetRequest createSet(Element request)
+ throws BaseFault
+ {
+ if (request == null)
+ throw new NullPointerException(_MESSAGES.get("NullRequestElement"));
+
+ Element[] children =
+ XmlUtils.getAllElements(request, WsrpConstants.NAMESPACE_URI);
+
+ if (children.length == 0)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("EmptySetRequest"));
+
+ SetRequest set = new SimpleSetRequest();
+
+ //
+ // build the different types of sets from XML
+ //
+ for (int n = 0; n < children.length; ++n)
+ {
+ String type = children[n].getLocalName();
+
+ SetRequestComponent operation = null;
+
+ if (type.equals(DeleteRequest.OPERATION))
+ operation = new DeleteRequest(children[n]);
+
+ else if (type.equals(InsertRequest.OPERATION))
+ operation = new InsertRequest(children[n]);
+
+ else if (type.equals(UpdateRequest.OPERATION))
+ operation = new UpdateRequest(children[n]);
+
+ else
+ {
+ Object[] filler = { type };
+ throw new InvalidMessageFormatFault(_MESSAGES.get("InvalidSet", filler));
+ }
+
+ set.addRequestComponent(operation);
+ }
+
+ return set;
+ }
+
+ /**
+ *
+ * This is a convenience method that creates a new SimpleSetRequest object
+ * an populates it with a UpdateRequest for the given property.
+ *
+ * @param qname
+ * The name of the property to update.
+ *
+ * @param values
+ * The values that will be copied to each instance of the property.
+ *
+ */
+ public SetRequest createUpdate(QName qname, Object[] values)
+ {
+ SetRequest set = new SimpleSetRequest();
+ set.addRequestComponent(new UpdateRequest(qname, values));
+ return set;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetRequest.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetRequest.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetRequest.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,109 @@
+/*=============================================================================*
+ * 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.properties.set.impl;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+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.ws.resource.properties.WsrpConstants;
+import org.apache.muse.ws.resource.properties.set.SetRequest;
+import org.apache.muse.ws.resource.properties.set.SetRequestComponent;
+import org.apache.muse.util.xml.XmlUtils;
+
+/**
+ *
+ * SimpleSetRequest is a simple container that represents the WS-ResourceProperties
+ * SetResourceProperties operation's request content. It may contain one or
+ * more executable {@linkplain AbstractSetRequestComponent SetRequestComponents}.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleSetRequest implements SetRequest
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(SimpleSetRequest.class);
+
+ //
+ // The individual operations that insert, update, delete, etc.
+ //
+ private List _operations = new LinkedList();
+
+ public void addRequestComponent(SetRequestComponent operation)
+ {
+ if (operation == null)
+ throw new NullPointerException(_MESSAGES.get("NullSetRequestComponent"));
+
+ _operations.add(operation);
+ }
+
+ public List getRequestComponents()
+ {
+ return Collections.unmodifiableList(_operations);
+ }
+
+ public String toString()
+ {
+ return XmlUtils.toString(toXML(), false);
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document doc)
+ {
+ if (doc == null)
+ throw new NullPointerException(_MESSAGES.get("NullDocument"));
+
+ Element root = XmlUtils.createElement(doc, WsrpConstants.SET_QNAME);
+
+ //
+ // the SetResourceProperties XML is an aggregate of the XML for
+ // the concrete set operations (insert/delete/update/etc)
+ //
+ List ops = getRequestComponents();
+
+ //
+ // can't have empty set requests
+ //
+ if (ops.isEmpty())
+ throw new IllegalStateException(_MESSAGES.get("EmptySetRequestBuilt"));
+
+ Iterator i = ops.iterator();
+
+ while (i.hasNext())
+ {
+ AbstractSetRequestComponent next = (AbstractSetRequestComponent)i.next();
+ Element nextXML = next.toXML(doc);
+ root.appendChild(nextXML);
+ }
+
+ return root;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/UpdateRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/UpdateRequest.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/UpdateRequest.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/impl/UpdateRequest.java Mon Jun 12 09:12:15 2006
@@ -0,0 +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.properties.set.impl;
+
+import javax.xml.namespace.QName;
+
+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.XmlUtils;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.ext.faults.InvalidMessageFormatFault;
+import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+/**
+ *
+ * UpdateRequest is a serializer/deserializer for the WS-ResourceProperties
+ * Update operation, which is part of SetResourceProperties.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class UpdateRequest extends AbstractSetRequestComponent
+{
+ //
+ // The name of this SetResourceProperties operation
+ //
+ public static final String OPERATION = "Update";
+
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(UpdateRequest.class);
+
+ public UpdateRequest(QName qname, Object value)
+ {
+ this(qname, new Object[]{ value });
+ }
+
+ public UpdateRequest(QName qname, Object[] values)
+ {
+ if (qname == null)
+ throw new NullPointerException(_MESSAGES.get("NullQName"));
+
+ setPropertyName(qname);
+ setValues(values);
+ }
+
+ public UpdateRequest(Element request)
+ throws BaseFault
+ {
+ if (request == null)
+ throw new NullPointerException(_MESSAGES.get("NullRequestElement"));
+
+ Element[] properties = XmlUtils.getAllElements(request);
+
+ if (properties.length == 0)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NoPropertiesFoundUpdate"));
+
+ setPropertyName(XmlUtils.getElementQName(properties[0]));
+ setValues(properties);
+ }
+
+ public void execute(ResourcePropertyCollection properties)
+ throws BaseFault
+ {
+ if (properties == null)
+ throw new NullPointerException(_MESSAGES.get("NullProperties"));
+
+ Object[] values = getValues();
+
+ properties.updateResourceProperty(getPropertyName(), values, getSecurityToken());
+ }
+
+ public String toString()
+ {
+ return XmlUtils.toString(toXML(), false);
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document doc)
+ {
+ if (doc == null)
+ throw new NullPointerException(_MESSAGES.get("NullDocument"));
+
+ Element root = XmlUtils.createElement(doc, WsrpConstants.UPDATE_QNAME);
+ Element[] values = getValues();
+
+ for (int n = 0; n < values.length; ++n)
+ {
+ Element next = (Element)doc.importNode(values[n], true);
+ root.appendChild(next);
+ }
+
+ return root;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/remote/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/remote/Messages.properties?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/remote/Messages.properties (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/remote/Messages.properties Mon Jun 12 09:12:15 2006
@@ -0,0 +1,4 @@
+NullDestinationEPR = The proxy's destination EPR is null. Where are we going to send requests?
+NullSourceEPR = The proxy's source EPR is null. What is the caller's EPR?
+NullSoapClient = The SoapClient is null. How are we going to send requests?
+NullProxyHandler = The ProxyHandler is null. How are we going to send requests?
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/remote/WsResourceClient.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/remote/WsResourceClient.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/remote/WsResourceClient.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/remote/WsResourceClient.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,212 @@
+/*=============================================================================*
+ * 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.remote;
+
+import java.net.URI;
+import java.text.ParseException;
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.muse.core.AbstractResourceClient;
+import org.apache.muse.core.Environment;
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.resource.lifetime.WsrlConstants;
+import org.apache.muse.ws.resource.lifetime.impl.SetTerminationTime;
+import org.apache.muse.ws.resource.lifetime.impl.SetTerminationTimeResponse;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+import org.apache.muse.ws.resource.properties.get.impl.GetMultipleRequest;
+import org.apache.muse.ws.resource.properties.get.impl.GetRequest;
+import org.apache.muse.ws.resource.properties.impl.WsrpUtils;
+import org.apache.muse.ws.resource.properties.query.impl.QueryRequest;
+import org.apache.muse.ws.resource.properties.set.SetOperationFactory;
+import org.apache.muse.ws.resource.properties.set.SetRequest;
+import org.apache.muse.ws.resource.properties.set.impl.SimpleSetOperationFactory;
+import org.apache.muse.ws.addressing.soap.SoapClient;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.util.xml.XmlUtils;
+
+/**
+ *
+ * WsResourceClient is a web service proxy that allows users to invoke standard
+ * WSRF operations without writing any XML plumbing code. This class includes
+ * all of the operations from WSRL and WSRP, but this does <b>not</b> mean that
+ * all Muse resource types implement all WSRL and WSRP operations. It is more
+ * convenient to have one proxy class since all WSRL and WSRP operations are
+ * defined as separate capabilities (which would result in one proxy per
+ * operation); if users need more detailed information about what operations
+ * are supported by a resource, they can use the WS-MetadataExchange client
+ * and/or the Muse ResourceInspector tool.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class WsResourceClient extends AbstractResourceClient
+{
+ private static final SetOperationFactory _SET_FACTORY = new SimpleSetOperationFactory();
+
+ public WsResourceClient(EndpointReference destination)
+ {
+ super(destination);
+ }
+
+ public WsResourceClient(EndpointReference destination,
+ EndpointReference source)
+ {
+ super(destination, source);
+ }
+
+ public WsResourceClient(EndpointReference destination,
+ EndpointReference source,
+ Environment environment)
+ {
+ super(destination, source, environment);
+ }
+
+ public WsResourceClient(EndpointReference destination,
+ EndpointReference source,
+ SoapClient soapClient)
+ {
+ super(destination, source, soapClient);
+ }
+
+ public void deleteResourceProperty(QName qname)
+ throws SoapFault
+ {
+ SetRequest set = _SET_FACTORY.createDelete(qname);
+ setResourceProperties(set);
+ }
+
+ public void destroy()
+ throws SoapFault
+ {
+ URI action = URI.create(WsrlConstants.DESTROY_URI);
+ Element body = XmlUtils.createElement(WsrlConstants.DESTROY_QNAME);
+
+ invoke(action, body);
+ }
+
+ public Element[] getMultipleResourceProperties(QName[] qnames)
+ throws SoapFault
+ {
+ GetMultipleRequest get = new GetMultipleRequest(qnames);
+ URI action = URI.create(WsrpConstants.GET_MULTIPLE_PROPERTIES_URI);
+
+ Element response = invoke(action, get.toXML());
+
+ return XmlUtils.getAllElements(response);
+ }
+
+ public Element[] getResourceProperty(QName qname)
+ throws SoapFault
+ {
+ GetRequest get = new GetRequest(qname);
+ URI action = URI.create(WsrpConstants.GET_RESOURCE_PROPERTY_URI);
+
+ Element response = invoke(action, get.toXML());
+
+ return XmlUtils.getAllElements(response);
+ }
+
+ public Element getResourcePropertyDocument()
+ throws SoapFault
+ {
+ Element request = XmlUtils.createElement(WsrpConstants.GET_DOCUMENT_QNAME);
+ URI action = URI.create(WsrpConstants.GET_RP_DOCUMENT_URI);
+
+ Element response = invoke(action, request);
+
+ return XmlUtils.getFirstElement(response);
+ }
+
+ public Element putResourcePropertyDocument(Element wsrpDoc)
+ throws SoapFault
+ {
+ Element request = XmlUtils.createElement(XmlUtils.EMPTY_DOC, WsrpConstants.PUT_DOCUMENT_QNAME, wsrpDoc, false);
+ URI action = URI.create(WsrpConstants.PUT_RP_DOCUMENT_URI);
+
+ Element response = invoke(action, request);
+
+ return XmlUtils.getFirstElement(response);
+ }
+
+ public Object getPropertyAsObject(QName qname, Class type)
+ throws SoapFault
+ {
+ Element[] properties = getResourceProperty(qname);
+ return WsrpUtils.convertToObjects(properties, type);
+ }
+
+ public void insertResourceProperty(QName qname, Object[] values)
+ throws SoapFault
+ {
+ SetRequest set = _SET_FACTORY.createInsert(qname, values);
+ setResourceProperties(set);
+ }
+
+ public Node[] queryResourceProperties(String query, String dialect)
+ throws SoapFault
+ {
+ QueryRequest request = new QueryRequest(query, dialect);
+ URI action = URI.create(WsrpConstants.QUERY_RESOURCE_PROPERTIES_URI);
+
+ Element response = invoke(action, request.toXML());
+
+ NodeList children = response.getChildNodes();
+ return XmlUtils.convertToArray(children);
+ }
+
+ public void setResourceProperties(SetRequest request)
+ throws SoapFault
+ {
+ URI action = URI.create(WsrpConstants.SET_RESOURCE_PROPERTIES_URI);
+ invoke(action, request.toXML());
+ }
+
+ public Date setTerminationTime(Date time)
+ throws SoapFault
+ {
+ SetTerminationTime set = new SetTerminationTime(time);
+ URI action = URI.create(WsrlConstants.SET_TERMINATION_URI);
+
+ Element response = invoke(action, set.toXML());
+
+ try
+ {
+ SetTerminationTimeResponse setResponse =
+ new SetTerminationTimeResponse(response);
+ return setResponse.getTerminationTime();
+ }
+
+ catch (ParseException error)
+ {
+ throw new SoapFault(error.getMessage(), error);
+ }
+ }
+
+ public void updateResourceProperty(QName qname, Object[] values)
+ throws SoapFault
+ {
+ SetRequest set = _SET_FACTORY.createUpdate(qname, values);
+ setResourceProperties(set);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/Entry.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/Entry.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/Entry.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/Entry.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,106 @@
+/*=============================================================================*
+ * 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.sg;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.resource.WsResource;
+import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.addressing.EndpointReference;
+
+/**
+ *
+ * Entry is an interface for WS-ServiceGroup Entry resources. Such resources
+ * represent a relationship between a resource and the service group of which
+ * it is a member; the modification or destruction of these resources
+ * represents a change in the resource's membership in a service group.
+ * Changes in the service group members do not necessarily affect membership.
+ * <br><br>
+ * Muse represents all WS-SG entries at WS-RF (implied) resources. They
+ * are accessible through a unique endpoint and can be destroyed via WS-RL.
+ * Users who want to create service groups but don't want to expose them to
+ * external components should use the <b>private</b> tag in their resource
+ * definition in muse.xml.
+ * <br><br>
+ * If you want to add the WSDM ServiceGroup capability to a participant
+ * resource, use the {@linkplain ServiceGroup ServiceGroup} interface.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface Entry extends WsResourceCapability, XmlSerializable
+{
+ QName[] PROPERTIES = new QName[]{
+ WssgConstants.CONTENT_QNAME,
+ WssgConstants.MEMBER_EPR_QNAME,
+ WssgConstants.SG_EPR_QNAME
+ };
+
+ /**
+ *
+ * @return The values of resource the properties (Element[]) that are
+ * found in the service group's MembershipContentRules and which are
+ * defined by the member service. The list may be empty if
+ * there were no membership rules. The values returned are
+ * <b>not</b> guaranteed to be current - they may include a
+ * snapshot of the values from when the entry was created. If
+ * you are unsure of the mutability of these values, you should
+ * ask the member resource directly.
+ *
+ */
+ Element getContent()
+ throws BaseFault;
+
+ /**
+ *
+ * @return The EPR for the service group member this entry represents.
+ *
+ */
+ EndpointReference getMemberEPR()
+ throws BaseFault;
+
+ /**
+ *
+ * @return The EPR for the service group to which this entry belongs.
+ *
+ */
+ EndpointReference getServiceGroupEPR()
+ throws BaseFault;
+
+ /**
+ *
+ * @param member
+ * A proxy for the service group member this entry represents.
+ *
+ */
+ void setMemberEPR(EndpointReference memberEPR)
+ throws BaseFault;
+
+ /**
+ *
+ * @param owner
+ * A reference for the service group to which this entry belongs.
+ *
+ */
+ void setServiceGroup(WsResource serviceGroup)
+ throws BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/MembershipContentRule.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/MembershipContentRule.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/MembershipContentRule.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/MembershipContentRule.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,45 @@
+/*=============================================================================*
+ * 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.sg;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.addressing.EndpointReference;
+
+public interface MembershipContentRule extends XmlSerializable
+{
+ QName[] getContentElements();
+
+ QName getMemberInterface();
+
+ /**
+ *
+ * @param epr
+ * The EPR for the resource against which this membership content
+ * rule will be evaluated.
+ *
+ * @return True if the given resource's WS-RP document matches the rules
+ * in the MCR.
+ *
+ */
+ boolean isMatch(EndpointReference epr);
+
+ void setContentElements(QName[] content);
+
+ void setMemberInterface(QName portType);
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/ServiceGroup.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/ServiceGroup.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/ServiceGroup.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/ServiceGroup.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,123 @@
+/*=============================================================================*
+ * 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.sg;
+
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.resource.WsResource;
+import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.faults.AddRefusedFault;
+import org.apache.muse.ws.resource.sg.faults.ContentCreationFailedFault;
+import org.apache.muse.ws.resource.sg.faults.UnsupportedMemberInterfaceFault;
+
+/**
+ *
+ * ServiceGroup is an internal representation of the WSDM ServiceGroup
+ * capability. It provides access to the one property (Entry) along
+ * with methods for creating, destroying, and querying entries. The
+ * Add operation is exposed here; the other methods are for internal
+ * entry management and should not be made public.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface ServiceGroup extends WsResourceCapability
+{
+ QName[] PROPERTIES = new QName[]{
+ WssgConstants.ENTRY_QNAME,
+ WssgConstants.CONTENT_RULE_QNAME,
+ };
+
+ /**
+ *
+ * Creates a new Entry resource and adds it to the touchpoint's
+ * ResourceManager and the ServiceGroup's WS-RP container.
+ *
+ * @param memberEPR
+ * The EPR of the resource that the Entry will represent.
+ *
+ * @param termination
+ * The initial termination time for the Entry. This may be null
+ * if the Entry is not scheduled for destruction.
+ *
+ * @return The newly-created (and stored) Entry.
+ *
+ * @throws BaseFault
+ * <ul>
+ * <li>If there was an error during the initialization of the
+ * Entry resource instance.</li>
+ * <li>If there was an error inserting into the ServiceGroup's
+ * WS-RP container.</li>
+ * </ul>
+ *
+ */
+ WsResource addEntry(EndpointReference memberEPR,
+ Element content,
+ Date termination)
+ throws AddRefusedFault,
+ ContentCreationFailedFault,
+ UnsupportedMemberInterfaceFault,
+ BaseFault;
+
+ QName[] getContentElements()
+ throws BaseFault;
+
+ WsResource[] getEntry()
+ throws BaseFault;
+
+ WsResource getEntry(EndpointReference memberEPR)
+ throws BaseFault;
+
+ MembershipContentRule[] getMembershipContentRule()
+ throws BaseFault;
+
+ /**
+ *
+ * @param epr
+ * The EPR for the resource against which all the service group's
+ * membership content rules should be evaluated.
+ *
+ * @return True if the given resource's WS-RP document matches all of
+ * the service group's membership rules and can be safely added
+ * to the service group.
+ *
+ */
+ boolean isMatch(EndpointReference epr)
+ throws BaseFault;
+
+ /**
+ *
+ * Deletes the Entry from the ServiceGroup's WS-RP container.
+ *
+ * @param entry
+ *
+ * @throws BaseFault
+ * <ul>
+ * <li>If the entry has already been removed.</li>
+ * </ul>
+ *
+ */
+ void removeEntry(WsResource entry)
+ throws BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/ServiceGroupRegistration.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/ServiceGroupRegistration.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/ServiceGroupRegistration.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/ServiceGroupRegistration.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,38 @@
+/*=============================================================================*
+ * 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.sg;
+
+import java.util.Date;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.faults.AddRefusedFault;
+import org.apache.muse.ws.resource.sg.faults.ContentCreationFailedFault;
+import org.apache.muse.ws.resource.sg.faults.UnsupportedMemberInterfaceFault;
+
+
+public interface ServiceGroupRegistration extends WsResourceCapability
+{
+ EndpointReference add(EndpointReference memberEPR, Element content, Date terminationTime)
+ throws AddRefusedFault,
+ ContentCreationFailedFault,
+ UnsupportedMemberInterfaceFault,
+ BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/WssgConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/WssgConstants.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/WssgConstants.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/WssgConstants.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,177 @@
+/*=============================================================================*
+ * 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.sg;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * WssgConstants is a collection of properties that is useful when programming
+ * against the WS-ServiceGroups spec. This class uses WS-SG v1.2, draft 02.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class WssgConstants
+{
+ public static final String NAMESPACE_URI = "http://docs.oasis-open.org/wsrf/sg-2";
+
+ public static final String WSDL_NAMESPACE_URI = "http://docs.oasis-open.org/wsrf/sgw-2";
+
+ public static final String PREFIX = "wsrf-sg";
+
+ public static final String WSDL_PREFIX = "wsrf-sgw";
+
+ public static final String SERVICE_GROUP_URI = WSDL_NAMESPACE_URI + "/ServiceGroup";
+
+ public static final String SERVICE_GROUP_REG_URI = WSDL_NAMESPACE_URI + "/ServiceGroupRegistration";
+
+ public static final String ENTRY_URI = WSDL_NAMESPACE_URI + "/ServiceGroupEntry";
+
+ /**
+ *
+ * The WS-A Action URI of the Add operation.
+ *
+ */
+ public static final String ADD_URI = NAMESPACE_URI + "/Add";
+
+ public static final QName ADD_QNAME =
+ new QName(NAMESPACE_URI, "Add", PREFIX);
+
+ public static final QName ADD_RESPONSE_QNAME =
+ new QName(NAMESPACE_URI, "AddResponse", PREFIX);
+
+ public static final QName CONTENT_CREATION_FAILED_QNAME =
+ new QName(NAMESPACE_URI, "ContentCreationFailedFault", PREFIX);
+
+ public static final QName UNSUPPORTED_MEMBER_INTERFACE_QNAME =
+ new QName(NAMESPACE_URI, "UnsupportedMemberInterfaceFault", PREFIX);
+
+ public static final QName ADD_REFUSED_QNAME =
+ new QName(NAMESPACE_URI, "AddRefusedFault", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:SimpleMembershipContentRule property.
+ *
+ */
+ public static final QName CONTENT_RULE_QNAME =
+ new QName(NAMESPACE_URI, "MembershipContentRule", PREFIX);
+
+ public static final String MEMBERSHIP_INTERFACE = "MembershipInterface";
+
+ public static final String CONTENT_ELEMENTS = "ContentElements";
+
+ public static final QName INIT_TERMINATION_QNAME =
+ new QName(NAMESPACE_URI, "InitialTerminationTime", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:MemberEPR property.
+ *
+ */
+ public static final QName MEMBER_EPR_QNAME =
+ new QName(NAMESPACE_URI, "MemberEPR", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:ServiceGroupEPR property.
+ *
+ */
+ public static final QName SG_EPR_QNAME =
+ new QName(NAMESPACE_URI, "ServiceGroupEPR", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:Content property.
+ *
+ */
+ public static final QName CONTENT_QNAME =
+ new QName(NAMESPACE_URI, "Content", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:Entry property.
+ *
+ */
+ public static final QName ENTRY_QNAME =
+ new QName(NAMESPACE_URI, "Entry", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:CurrentTime return value.
+ *
+ */
+ public static final QName CURRENT_TIME_QNAME =
+ new QName(NAMESPACE_URI, "CurrentTime", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:TerminationTime return value.
+ *
+ */
+ public static final QName TERMINATION_TIME_QNAME =
+ new QName(NAMESPACE_URI, "TerminationTime", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:ServiceGroupEntryReference return value.
+ *
+ */
+ public static final QName SG_ENTRY_REFERENCE_QNAME =
+ new QName(NAMESPACE_URI, "ServiceGroupEntryReference", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:ServiceGroupEntryEPR property.
+ *
+ */
+ public static final QName SG_ENTRY_EPR_QNAME =
+ new QName(NAMESPACE_URI, "ServiceGroupEntryEPR", PREFIX);
+
+ /**
+ *
+ * The name of the wssg:MemberServiceEPR property.
+ *
+ */
+ public static final QName MEMBER_SERVICE_EPR_QNAME =
+ new QName(NAMESPACE_URI, "MemberServiceEPR", PREFIX);
+
+ /**
+ *
+ * The name of the WS-SG entry addition event.
+ *
+ */
+ public static final QName ENTRY_ADDITION_QNAME =
+ new QName(NAMESPACE_URI, "EntryAdditionNotification", PREFIX);
+
+ /**
+ *
+ * The name of the WS-SG entry destruction event.
+ *
+ */
+ public static final QName ENTRY_REMOVAL_QNAME =
+ new QName(NAMESPACE_URI, "EntryRemovalNotification", PREFIX);
+
+ /**
+ *
+ * The name of the WS-N Topic for WS-SG lifecycle events.
+ *
+ */
+ public static final String MODIFICATION_TOPIC_NAME = "ServiceGroupModification";
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/AddRefusedFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/AddRefusedFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/AddRefusedFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/AddRefusedFault.java Mon Jun 12 09:12:15 2006
@@ -0,0 +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.sg.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.WssgConstants;
+
+public class AddRefusedFault extends BaseFault
+{
+ private static final long serialVersionUID = -5069068147595306686L;
+
+ public AddRefusedFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public AddRefusedFault(String message)
+ {
+ super(WssgConstants.ADD_REFUSED_QNAME, message);
+ }
+
+ public AddRefusedFault(String message, Throwable cause)
+ {
+ super(WssgConstants.ADD_REFUSED_QNAME, message, cause);
+ }
+
+ public AddRefusedFault(Throwable cause)
+ {
+ super(WssgConstants.ADD_REFUSED_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/ContentCreationFailedFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/ContentCreationFailedFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/ContentCreationFailedFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/ContentCreationFailedFault.java Mon Jun 12 09:12:15 2006
@@ -0,0 +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.sg.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.WssgConstants;
+
+public class ContentCreationFailedFault extends BaseFault
+{
+ private static final long serialVersionUID = 5271763331503613580L;
+
+ public ContentCreationFailedFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public ContentCreationFailedFault(String message)
+ {
+ super(WssgConstants.CONTENT_CREATION_FAILED_QNAME, message);
+ }
+
+ public ContentCreationFailedFault(String message, Throwable cause)
+ {
+ super(WssgConstants.CONTENT_CREATION_FAILED_QNAME, message, cause);
+ }
+
+ public ContentCreationFailedFault(Throwable cause)
+ {
+ super(WssgConstants.CONTENT_CREATION_FAILED_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/UnsupportedMemberInterfaceFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/UnsupportedMemberInterfaceFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/UnsupportedMemberInterfaceFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/faults/UnsupportedMemberInterfaceFault.java Mon Jun 12 09:12:15 2006
@@ -0,0 +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.sg.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.WssgConstants;
+
+public class UnsupportedMemberInterfaceFault extends BaseFault
+{
+ private static final long serialVersionUID = -6827344709676009932L;
+
+ public UnsupportedMemberInterfaceFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public UnsupportedMemberInterfaceFault(String message)
+ {
+ super(WssgConstants.UNSUPPORTED_MEMBER_INTERFACE_QNAME, message);
+ }
+
+ public UnsupportedMemberInterfaceFault(String message, Throwable cause)
+ {
+ super(WssgConstants.UNSUPPORTED_MEMBER_INTERFACE_QNAME, message, cause);
+ }
+
+ public UnsupportedMemberInterfaceFault(Throwable cause)
+ {
+ super(WssgConstants.UNSUPPORTED_MEMBER_INTERFACE_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/impl/AddHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/impl/AddHandler.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/impl/AddHandler.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/impl/AddHandler.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,53 @@
+/*=============================================================================*
+ * 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.sg.impl;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.core.routing.AbstractMessageHandler;
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.resource.sg.WssgConstants;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+/**
+ *
+ * AddHandler is the parser for the WS-ServiceGroup Add operation.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class AddHandler extends AbstractMessageHandler
+{
+ public AddHandler()
+ {
+ super(WssgConstants.ADD_QNAME);
+ }
+
+ public Object[] fromXML(Element xml)
+ throws SoapFault
+ {
+ AddRequest add = new AddRequest(xml);
+ return new Object[]{ add.getMemberEPR(), add.getTerminationTime() };
+ }
+
+ public Element toXML(Object result)
+ {
+ AddResponse response = new AddResponse((EndpointReference)result);
+ return response.toXML();
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/impl/AddRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/impl/AddRequest.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/impl/AddRequest.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/sg/impl/AddRequest.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,157 @@
+/*=============================================================================*
+ * 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.sg.impl;
+
+import java.text.ParseException;
+import java.util.Date;
+
+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.ws.addressing.EndpointReference;
+import org.apache.muse.ws.resource.ext.faults.InvalidMessageFormatFault;
+import org.apache.muse.ws.resource.remote.WsResourceClient;
+import org.apache.muse.ws.resource.sg.WssgConstants;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.util.xml.XmlUtils;
+
+/**
+ *
+ * AddRequest is a serializer/deserializer for the WS-ServiceGroup Add
+ * operation's request content.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class AddRequest implements XmlSerializable
+{
+ private static Messages _MESSAGES = MessagesFactory.get(AddRequest.class);
+
+ private Element _content = null;
+
+ private EndpointReference _memberEPR = null;
+
+ private Date _termination = null;
+
+ public AddRequest(Element xml)
+ throws InvalidMessageFormatFault
+ {
+ if (xml == null)
+ throw new NullPointerException(_MESSAGES.get("NullElement"));
+
+ Element eprXML = XmlUtils.getElement(xml, WssgConstants.MEMBER_EPR_QNAME);
+
+ if (eprXML == null)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NoMemberEPR"));
+
+ try
+ {
+ _memberEPR = new EndpointReference(eprXML);
+ }
+
+ catch (SoapFault error)
+ {
+ throw new InvalidMessageFormatFault(error);
+ }
+
+ _content = XmlUtils.getElement(xml, WssgConstants.CONTENT_QNAME);
+
+ Element timeXML = XmlUtils.getElement(xml, WssgConstants.INIT_TERMINATION_QNAME);
+
+ try
+ {
+ if (timeXML != null)
+ _termination = XmlUtils.getDate(timeXML);
+ }
+
+ catch (ParseException error)
+ {
+ throw new InvalidMessageFormatFault(error);
+ }
+ }
+
+ public AddRequest(EndpointReference memberEPR, Date termination)
+ {
+ if (memberEPR == null)
+ throw new NullPointerException(_MESSAGES.get("NullMemberEPR"));
+
+ _memberEPR = memberEPR;
+ _termination = termination;
+ }
+
+ public EndpointReference getMemberEPR()
+ {
+ return _memberEPR;
+ }
+
+ public Element getContent()
+ {
+ return _content;
+ }
+
+ public Date getTerminationTime()
+ {
+ return _termination;
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document factory)
+ {
+ if (factory == null)
+ throw new NullPointerException(_MESSAGES.get("NullDocument"));
+
+ Element root = XmlUtils.createElement(factory, WssgConstants.ADD_QNAME);
+
+ EndpointReference epr = getMemberEPR();
+ XmlUtils.setElement(root, WssgConstants.MEMBER_EPR_QNAME, epr.toXML());
+
+ WsResourceClient member = new WsResourceClient(epr);
+ Element content = getContent();
+
+ try
+ {
+ if (content != null)
+ {
+ Element[] results = member.getResourceProperty(WssgConstants.CONTENT_QNAME);
+ content = results[0];
+ }
+ }
+
+ catch (SoapFault error)
+ {
+ throw new RuntimeException(error.getMessage(), error);
+ }
+
+ content = (Element)factory.importNode(content, true);
+ root.appendChild(content);
+
+ Date time = getTerminationTime();
+
+ if (time != null)
+ XmlUtils.setElement(root, WssgConstants.INIT_TERMINATION_QNAME, time);
+
+ return root;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org