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 [5/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/query/QueryResourceProperties.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/QueryResourceProperties.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/QueryResourceProperties.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/QueryResourceProperties.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,68 @@
+/*=============================================================================*
+ * 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.query;
+
+import org.w3c.dom.Node;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.query.faults.InvalidQueryExpressionFault;
+import org.apache.muse.ws.resource.properties.query.faults.QueryEvaluationErrorFault;
+import org.apache.muse.ws.resource.properties.query.faults.UnknownQueryExpressionDialectFault;
+
+/**
+ *
+ * QueryResourceProperties is ...
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface QueryResourceProperties
+{
+ /**
+ *
+ * Returns a set of DOM Nodes that correlates to the given query string.
+ *
+ * @param query
+ * The query expression to evaluate against the WS-RP document.
+ *
+ * @param dialect
+ * The name of the query language used for the query.
+ *
+ * @return The set of DOM Nodes that correlates to the given query string.
+ * These XML nodes may be entire property instances or just
+ * fragments of instances (sub-elements, text, etc.). There is no
+ * guarantee that all of the nodes have a similar structure or
+ * type. There may be further restrictions on the return value
+ * depending on which query language(s) is supported by the WS-RP
+ * implementation.
+ *
+ * @throws BaseFault
+ * <ul>
+ * <li>If the dialect (query language) is not supported by the
+ * implementation.</li>
+ * <li>If the query expression is invalid, or there was an error
+ * processing the results of the query.</li>
+ * </ul>
+ *
+ */
+ Node[] queryResourceProperties(String query, String dialect)
+ throws UnknownQueryExpressionDialectFault,
+ InvalidQueryExpressionFault,
+ QueryEvaluationErrorFault,
+ BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/InvalidQueryExpressionFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/InvalidQueryExpressionFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/InvalidQueryExpressionFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/InvalidQueryExpressionFault.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.query.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class InvalidQueryExpressionFault extends BaseFault
+{
+ private static final long serialVersionUID = -2208251219926993163L;
+
+ public InvalidQueryExpressionFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public InvalidQueryExpressionFault(String message)
+ {
+ super(WsrpConstants.INVALID_QUERY_QNAME, message);
+ }
+
+ public InvalidQueryExpressionFault(String message, Throwable cause)
+ {
+ super(WsrpConstants.INVALID_QUERY_QNAME, message, cause);
+ }
+
+ public InvalidQueryExpressionFault(Throwable cause)
+ {
+ super(WsrpConstants.INVALID_QUERY_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/QueryEvaluationErrorFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/QueryEvaluationErrorFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/QueryEvaluationErrorFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/QueryEvaluationErrorFault.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.query.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class QueryEvaluationErrorFault extends BaseFault
+{
+ private static final long serialVersionUID = 4578814819641364868L;
+
+ public QueryEvaluationErrorFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public QueryEvaluationErrorFault(String message)
+ {
+ super(WsrpConstants.QUERY_EVALUATION_ERROR_QNAME, message);
+ }
+
+ public QueryEvaluationErrorFault(String message, Throwable cause)
+ {
+ super(WsrpConstants.QUERY_EVALUATION_ERROR_QNAME, message, cause);
+ }
+
+ public QueryEvaluationErrorFault(Throwable cause)
+ {
+ super(WsrpConstants.QUERY_EVALUATION_ERROR_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/UnknownQueryExpressionDialectFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/UnknownQueryExpressionDialectFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/UnknownQueryExpressionDialectFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/faults/UnknownQueryExpressionDialectFault.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.query.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class UnknownQueryExpressionDialectFault extends BaseFault
+{
+ private static final long serialVersionUID = -1479735044591291531L;
+
+ public UnknownQueryExpressionDialectFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public UnknownQueryExpressionDialectFault(String message)
+ {
+ super(WsrpConstants.UNKNOWN_QUERY_DIALECT_QNAME, message);
+ }
+
+ public UnknownQueryExpressionDialectFault(String message, Throwable cause)
+ {
+ super(WsrpConstants.UNKNOWN_QUERY_DIALECT_QNAME, message, cause);
+ }
+
+ public UnknownQueryExpressionDialectFault(Throwable cause)
+ {
+ super(WsrpConstants.UNKNOWN_QUERY_DIALECT_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/Messages.properties?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/Messages.properties (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/Messages.properties Mon Jun 12 09:12:15 2006
@@ -0,0 +1,11 @@
+QueryEvaluationError = There was an error evaluating the query string 'XXX'; the original error was: XXX
+InvalidQueryDialect = The query dialect 'XXX' is not supported by this QueryResourceProperties implementation. The only valid dialects are: XXX
+NullDocument = The DOM Document needed to create the XML fragment is null.
+NullNodeList = The Node array containing the query results is null.
+NullNodeN = In the Node array, reference #XXX is null.
+NullQuery = The query string is null.
+NullDialect = The dialect string is null.
+NullRequestElement = The DOM Element with the request's SOAP body is null.
+NoQueryExpressionFound = The QueryResourceProperties element did not have a QueryExpression child element.
+NoDialectFound = The QueryExpression element did not have a 'dialect' attribute specifying the query language.
+NoQueryFound = The QueryExpression element did not contain a query string.
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/QueryRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/QueryRequest.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/QueryRequest.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/QueryRequest.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,129 @@
+/*=============================================================================*
+ * 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.query.impl;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.ws.resource.ext.faults.InvalidMessageFormatFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.util.xml.XmlUtils;
+
+/**
+ *
+ * QueryRequest is a serializer/deserializer for the WS-ResourceProperties
+ * QueryResourceProperties operation's request content.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class QueryRequest implements XmlSerializable
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(QueryRequest.class);
+
+ //
+ // The language of the query string
+ //
+ private String _dialect = null;
+
+ //
+ // The query to run against the WS-RP doc
+ //
+ private String _query = null;
+
+ public QueryRequest(String query, String dialect)
+ {
+ if (query == null)
+ throw new NullPointerException(_MESSAGES.get("NullQuery"));
+
+ if (dialect == null)
+ throw new NullPointerException(_MESSAGES.get("NullDialect"));
+
+ _query = query;
+ _dialect = dialect;
+ }
+
+ public QueryRequest(Element request)
+ throws InvalidMessageFormatFault
+ {
+ if (request == null)
+ throw new NullPointerException(_MESSAGES.get("NullRequestElement"));
+
+ Element expression =
+ XmlUtils.getElement(request, WsrpConstants.QUERY_EXPRESSION_QNAME);
+
+ if (expression == null)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NoQueryExpressionFound"));
+
+ _dialect = expression.getAttribute(WsrpConstants.DIALECT);
+
+ if (_dialect == null || _dialect.length() == 0)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NoDialectFound"));
+
+ _query = XmlUtils.extractText(expression);
+
+ if (_query == null)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NoQueryFound"));
+ }
+
+ public String getDialect()
+ {
+ return _dialect;
+ }
+
+ public String getQuery()
+ {
+ return _query;
+ }
+
+ 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.QUERY_QNAME);
+
+ Element query =
+ XmlUtils.createElement(doc, WsrpConstants.QUERY_EXPRESSION_QNAME);
+ root.appendChild(query);
+
+ query.setAttribute(WsrpConstants.DIALECT, getDialect());
+
+ Node text = doc.createTextNode(getQuery());
+ query.appendChild(text);
+
+ return root;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/QueryResponse.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/QueryResponse.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/QueryResponse.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/QueryResponse.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,116 @@
+/*=============================================================================*
+ * 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.query.impl;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+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.util.xml.XmlSerializable;
+import org.apache.muse.util.xml.XmlUtils;
+
+/**
+ *
+ * QueryResponse is a serializer/deserializer for the WS-ResourceProperties
+ * QueryResourceProperties operation's response content.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class QueryResponse implements XmlSerializable
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(QueryResponse.class);
+
+ //
+ // The collection of nodes from the WS-RP document that were retrieved
+ // from a QueryResourceProperties query. These nodes may be from any
+ // part of the document, and are not necessarily representative of whole
+ // property instances. The nodes may be anything from an entire WS-RP
+ // document to individual text nodes.
+ //
+ private Node[] _results = null;
+
+ public QueryResponse(Node[] results)
+ {
+ if (results == null)
+ throw new NullPointerException(_MESSAGES.get("NullNodeArray"));
+
+ for (int n = 0; n < results.length; ++n)
+ {
+ if (results[n] == null)
+ {
+ Object[] filler = { new Integer(n) };
+ throw new NullPointerException(_MESSAGES.get("NullNodeN", filler));
+ }
+ }
+
+ _results = results;
+ }
+
+ public Node getItem(int index)
+ {
+ return _results[index];
+ }
+
+ public Node[] getItems()
+ {
+ return _results;
+ }
+
+ public int getNumberOfItems()
+ {
+ return _results.length;
+ }
+
+ 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"));
+
+ QName qname = WsrpConstants.QUERY_RESPONSE_QNAME;
+ Element root = XmlUtils.createElement(doc, qname);
+
+ int length = getNumberOfItems();
+
+ for (int n = 0; n < length; ++n)
+ {
+ Node next = doc.importNode(getItem(n), true);
+ root.appendChild(next);
+ }
+
+ return root;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/SimpleQueryCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/SimpleQueryCapability.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/SimpleQueryCapability.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/SimpleQueryCapability.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,102 @@
+/*=============================================================================*
+ * 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.query.impl;
+
+import java.lang.reflect.Method;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+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.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
+import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
+import org.apache.muse.ws.resource.properties.query.QueryCapability;
+import org.apache.muse.ws.resource.properties.query.QueryExpression;
+import org.apache.muse.ws.resource.properties.query.QueryExpressionFactory;
+import org.apache.muse.ws.resource.properties.query.faults.InvalidQueryExpressionFault;
+import org.apache.muse.ws.resource.properties.query.faults.QueryEvaluationErrorFault;
+import org.apache.muse.ws.resource.properties.query.faults.UnknownQueryExpressionDialectFault;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+
+public class SimpleQueryCapability
+ extends AbstractWsResourceCapability implements QueryCapability
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(SimpleQueryCapability.class);
+
+ private QueryExpressionFactory _factory = null;
+
+ protected MessageHandler createQueryHandler()
+ {
+ MessageHandler handler = new QueryHandler();
+
+ Method method = ReflectUtils.getFirstMethod(getClass(), "queryResourceProperties");
+ handler.setMethod(method);
+
+ return handler;
+ }
+
+ protected QueryExpressionFactory createQueryExpressionFactory()
+ {
+ return new XPathQueryExpressionFactory();
+ }
+
+ public QueryExpressionFactory getQueryExpressionFactory()
+ {
+ return _factory;
+ }
+
+ public void setQueryExpressionFactory(QueryExpressionFactory factory)
+ {
+ _factory = factory;
+ }
+
+ public void initialize()
+ throws SoapFault
+ {
+ super.initialize();
+
+ _factory = createQueryExpressionFactory();
+
+ setMessageHandler(createQueryHandler());
+ }
+
+ public Node[] queryResourceProperties(String query, String dialect)
+ throws UnknownQueryExpressionDialectFault,
+ InvalidQueryExpressionFault,
+ QueryEvaluationErrorFault,
+ BaseFault
+ {
+ if (query == null)
+ throw new NullPointerException(_MESSAGES.get("NullQuery"));
+
+ ResourcePropertyCollection props = getWsResource().getPropertyCollection();
+ Element wsrpDoc = props.getResourcePropertyDocument();
+
+ QueryExpressionFactory factory = getQueryExpressionFactory();
+ QueryExpression evaluator = factory.newInstance(dialect);
+
+ return evaluator.evaluate(wsrpDoc, query);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/XPathQueryExpression.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/XPathQueryExpression.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/XPathQueryExpression.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/XPathQueryExpression.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.query.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.transform.TransformerException;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XPathUtils;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.resource.properties.query.QueryExpression;
+import org.apache.muse.ws.resource.properties.query.faults.QueryEvaluationErrorFault;
+
+public class XPathQueryExpression implements QueryExpression
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES =
+ MessagesFactory.get(XPathQueryExpression.class);
+
+ public String getDialect()
+ {
+ return XPathUtils.NAMESPACE_URI;
+ }
+
+ public Node[] evaluate(Element wsrpDoc, String query)
+ throws QueryEvaluationErrorFault
+ {
+ //
+ // we need to store all of the prefix/URI mappings in the instances
+ // and add them to the root node
+ //
+ // NOTE: This search is inefficient, as we'll do a lot of redundant
+ // searching. It is necessary only because WS-RP allows Insert
+ // to add multiple instances of a property with different
+ // values. One instance of a property might have an element
+ // (and a prefix/URI) that is not found in another instance;
+ // thus, we have to search all children.
+ //
+ Map namespacesByPrefix = new HashMap();
+
+ Element[] valuesXML = XmlUtils.getAllElements(wsrpDoc);
+
+ for (int n = 0; n < valuesXML.length; ++n)
+ {
+ //
+ // collect all of the prefix/URI mappings in the subtree
+ //
+ Map namespaces = XmlUtils.getAllNamespaces(valuesXML[n]);
+ namespacesByPrefix.putAll(namespaces);
+ }
+
+ //
+ // add the property's various namespaces to the root element
+ // so we can easily query them with XPath 1.0
+ //
+ // NOTE: We could write our own PrefixResolver, but it would
+ // be slower, and doesn't prevent the conflict of having
+ // two URIs (for two sibling nodes) with the same prefix,
+ // which is legal XML but will cause XPath to be mixfused.
+ //
+ // The small cost of adding one copy of the NS to the root
+ // makes for a much more efficient/correct system.
+ //
+
+ Iterator i = namespacesByPrefix.keySet().iterator();
+
+ while (i.hasNext())
+ {
+ String prefix = (String)i.next();
+ String namespace = (String)namespacesByPrefix.get(prefix);
+ XmlUtils.setNamespaceAttribute(wsrpDoc, prefix, namespace);
+ }
+
+ try
+ {
+ return XPathUtils.select(wsrpDoc, query);
+ }
+
+ catch (TransformerException error)
+ {
+ Object[] filler = { query, error.getMessage() };
+ throw new QueryEvaluationErrorFault(_MESSAGES.get("QueryEvaluationError", filler));
+ }
+ }
+}
+
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/XPathQueryExpressionFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/XPathQueryExpressionFactory.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/XPathQueryExpressionFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/query/impl/XPathQueryExpressionFactory.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,56 @@
+/*=============================================================================*
+ * 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.query.impl;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XPathUtils;
+import org.apache.muse.ws.resource.properties.query.QueryExpression;
+import org.apache.muse.ws.resource.properties.query.QueryExpressionFactory;
+import org.apache.muse.ws.resource.properties.query.faults.UnknownQueryExpressionDialectFault;
+
+
+public class XPathQueryExpressionFactory implements QueryExpressionFactory
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES =
+ MessagesFactory.get(XPathQueryExpressionFactory.class);
+
+ private static final QueryExpression _EVALUATOR = new XPathQueryExpression();
+
+ public boolean hasDialect(String dialect)
+ {
+ return dialect != null && dialect.equals(_EVALUATOR.getDialect());
+ }
+
+ public QueryExpression newInstance(String dialect)
+ throws UnknownQueryExpressionDialectFault
+ {
+ //
+ // this implementation only supports XPath queries
+ //
+ if (!hasDialect(dialect))
+ {
+ Object[] filler = { dialect, XPathUtils.NAMESPACE_URI };
+ throw new UnknownQueryExpressionDialectFault(_MESSAGES.get("UnknownQueryDialect", filler));
+ }
+
+ return _EVALUATOR;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/OpenPropertiesSchema.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/OpenPropertiesSchema.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/OpenPropertiesSchema.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/OpenPropertiesSchema.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,155 @@
+/*=============================================================================*
+ * 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.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.resource.WsResourceCapability;
+
+
+
+/**
+ *
+ * OpenPropertiesSchema is a {@linkplain ResourcePropertiesSchema ResourcePropertiesSchema}
+ * that has no restrictions on any of its properties - all operations are
+ * allowed, and no values have limits. This class is a singleton because a
+ * restriction-less schema is the same no matter what properties are defined.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public final class OpenPropertiesSchema implements ResourcePropertiesSchema
+{
+ //
+ // This schema is the same no matter what document it's applied to,
+ // so we only need one instance of it
+ //
+ private static final OpenPropertiesSchema _SINGLETON = new OpenPropertiesSchema();
+
+ /**
+ *
+ * Private constructor used to prevent instantiation.
+ *
+ */
+ private OpenPropertiesSchema()
+ {
+ //
+ // this constructor is only explicit so we can make it private
+ //
+ }
+
+ /**
+ *
+ * @return The singleton instance of this class.
+ *
+ */
+ public static OpenPropertiesSchema getInstance()
+ {
+ return _SINGLETON;
+ }
+
+ /**
+ *
+ * @return ResourcePropertiesSchema.UNBOUNDED
+ *
+ */
+ public int getMaxOccurs(QName property)
+ {
+ return UNBOUNDED;
+ }
+
+ /**
+ *
+ * @return zero (0)
+ *
+ */
+ public int getMinOccurs(QName property)
+ {
+ return 0;
+ }
+
+ /**
+ *
+ * @return An empty collection.
+ *
+ */
+ public Collection getPropertyNames()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ *
+ * @return null
+ *
+ */
+ public QName getPropertyTypeName(QName property)
+ {
+ return null;
+ }
+
+ /**
+ *
+ * @return true
+ *
+ */
+ public boolean hasProperty(QName property)
+ {
+ return true;
+ }
+
+ /**
+ *
+ * @return true
+ *
+ */
+ public boolean isMaxUnbounded(QName property)
+ {
+ return true;
+ }
+
+ /**
+ *
+ * @return true
+ *
+ */
+ public boolean isNillable(QName property)
+ {
+ return true;
+ }
+
+ public WsResourceCapability getCapability(QName property)
+ {
+ return null;
+ }
+
+ public boolean hasCapability(QName property)
+ {
+ return true;
+ }
+
+ public void setCapability(QName property, WsResourceCapability capability)
+ {
+ //
+ // no capability mapping is stored
+ //
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchema.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchema.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchema.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchema.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,118 @@
+/*=============================================================================*
+ * 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.schema;
+
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.resource.WsResourceCapability;
+
+/**
+ *
+ * ResourcePropertiesSchema represents the portion of an XML schema that
+ * defines a WS-RP document. Implementations of this interface provide a
+ * lookup service for property schema information.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface ResourcePropertiesSchema
+{
+ /**
+ *
+ * The unbounded value can be applied to the property's minimum or
+ * maximum setting. An unbounded minimum means that a property can
+ * have zero instances; an unbounded maximum means that a property
+ * can have unlimited instances.
+ *
+ */
+ final int UNBOUNDED = Integer.MAX_VALUE;
+
+ /**
+ *
+ * @param property
+ *
+ * @return The maximum number of occurrences for the given property, or
+ * UNBOUNDED if the property's "maxOccurs" is set to "unbounded".
+ *
+ */
+ int getMaxOccurs(QName property);
+
+ /**
+ *
+ *
+ * @param property
+ *
+ * @return The minimum number of occurrences for the given property.
+ *
+ */
+ int getMinOccurs(QName property);
+
+ /**
+ *
+ * @return The collection of property names defined in this schema.
+ *
+ */
+ Collection getPropertyNames();
+
+ /**
+ *
+ * @param property
+ *
+ * @return The qualified name of the property's type (set with the
+ * "type" attribute). If no type is specified, the method
+ * returns XsdUtils.ANY_TYPE_QNAME.
+ *
+ */
+ QName getPropertyTypeName(QName property);
+
+ /**
+ *
+ * @param property
+ *
+ * @return True is the schema has a property definition with the given name.
+ *
+ */
+ boolean hasProperty(QName property);
+
+ /**
+ *
+ * @param property
+ *
+ * @return True if getMaxOccurs(QName) returns UNBOUNDED.
+ *
+ */
+ boolean isMaxUnbounded(QName property);
+
+ /**
+ *
+ * @param property
+ *
+ * @return True if instances of the given property can be set to null,
+ * or empty elements (set with the "nillable" attribute).
+ *
+ */
+ boolean isNillable(QName property);
+
+ WsResourceCapability getCapability(QName property);
+
+ boolean hasCapability(QName property);
+
+ void setCapability(QName property, WsResourceCapability capability);
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchemaValidation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchemaValidation.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchemaValidation.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchemaValidation.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,90 @@
+/*=============================================================================*
+ * 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.schema;
+
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.resource.WsResourceCapability;
+
+
+public interface ResourcePropertiesSchemaValidation
+{
+ void addCapability(WsResourceCapability capability);
+
+ WsResourceCapability getCapability(QName qname);
+
+ /**
+ *
+ * @return The XSD for this WS-RP document.
+ *
+ */
+ ResourcePropertiesSchema getSchema();
+
+ Collection getPropertyNames();
+
+ /**
+ *
+ * @param qname
+ * The name of a resource property to search the schema for.
+ *
+ * @return True if there is a schema definition with the given name.
+ *
+ */
+ boolean hasPropertyDefinition(QName qname);
+
+ /**
+ *
+ * Applies the given XMLSchema definitions to this WS-RP document. This
+ * schema will be used for all subsequent validations, including calls
+ * to validateSchema() and SetResourceProperties-like operations.
+ * <br><br>
+ * Note that this method does <b>not</b> perform validation.
+ *
+ * @param schema
+ * The XSD properties definition for this WS-RP document.
+ *
+ * @see #validateSchema()
+ *
+ */
+ void setSchema(ResourcePropertiesSchema schema);
+
+ /**
+ *
+ * Iterates through every property in the WS-RP document's XMLSchema and
+ * verifies current document is valid. This method should be used
+ * sparingly, as it will validate every property; for cases such as
+ * SetResourceProperties, the implementation of the operations should
+ * validate the individual property being targeted, not the whole document.
+ *
+ * @throws SoapFault
+ * <ul>
+ * <li>If the number of instances of a property is below the
+ * required minimum.</li>
+ * <li>If the number of instances of a property is above the
+ * required maximum.</li>
+ * <li>If an instance of the property is null (the equivalent of
+ * an empty XML element) but the property is not nillable.</li>
+ * </ul>
+ * @throws SoapFault
+ *
+ */
+ void validateSchema()
+ throws SoapFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/faults/SchemaValidationErrorFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/faults/SchemaValidationErrorFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/faults/SchemaValidationErrorFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/faults/SchemaValidationErrorFault.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.schema.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.ext.WsrfExtConstants;
+
+public class SchemaValidationErrorFault extends BaseFault
+{
+ private static final long serialVersionUID = -6023235939977117785L;
+
+ public SchemaValidationErrorFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public SchemaValidationErrorFault(String message)
+ {
+ super(WsrfExtConstants.SCHEMA_VALIDATION_ERROR_QNAME, message);
+ }
+
+ public SchemaValidationErrorFault(String message, Throwable cause)
+ {
+ super(WsrfExtConstants.SCHEMA_VALIDATION_ERROR_QNAME, message, cause);
+ }
+
+ public SchemaValidationErrorFault(Throwable cause)
+ {
+ super(WsrfExtConstants.SCHEMA_VALIDATION_ERROR_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/impl/Messages.properties?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/impl/Messages.properties (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/impl/Messages.properties Mon Jun 12 09:12:15 2006
@@ -0,0 +1,43 @@
+NullQName = The QName reference is null.
+NullQNameArray = The QName array is null.
+NullTopic = The Topic reference is null.
+NullPropertyElement = The DOM Element with the WS-RP property definition is null.
+NullPropertiesElement = The DOM Element with the WS-ResourceProperties definition is null.
+NotAnElement = The DOM Element with the WS-ResourceProperties definition is not an xsd:element. A WS-RP definition must be an xsd:element.
+NoPropertiesName = The WS-ResourceProperties element has no name attribute. What is the name of the properties document?
+NoTypeDeclaration = The property 'XXX' has no definition in the WSDL's types section. A common error is that the property's QName has an invalid namespace URI.
+PropertyNotFound = The schema has no property with the name 'XXX'. Use the hasProperty method to determine if a property exists.
+NullDocument = The DOM Document is null.
+NullPCA = The PropertyChangeApprover is null.
+NullPCL = The PropertyChangeListener is null.
+NullPRL = The PropertyReadListener is null.
+QueryNotProperty = The query 'XXX' does not resolve to a property element. Deletion via query string can only be done if the query maps to complete property instances in the DOM; that is, all results must be child elements of the document's root node. Appropriate queries include '/*/MyName', '/*/MyName[@attr]', etc.
+EmptyDocument = The DOM Document that represents the WS-RP document is empty. The Document must be a valid XML document, which means it must have at least a root node.
+NullValuesArray = The array of property values is null. If you want to set properties to null, you still need a valid array - just add null value(s) to it.
+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.
+NullQuery = The query string is null. What are we looking for?
+NullDialect = The dialect is null. The only dialect supported by this implementation is XPath 1.0 (see XPathUtils for the full XPath 1.0 URI).
+NullMetadataDescriptor = The MetadataDescriptor is null.
+NullSchema = The ResourcePropertiesSchema is null. The properties document must have a schema, even if it has no constraints. If you want to place no schema constraints on your properties, you can rely on the default schema, which is an instance of OpenPropertiesSchema.
+EmptySetRequest = The SetResourceProperties request has no concrete set operations (Insert/Update/Delete). Each SetRequest must have at least one operation.
+BelowMinimumPotential = The property 'XXX' has a minOccurs value of XXX. If the deletion were performed, there would only be XXX instances of the property left, which is below the minimum.
+AboveMaximumPotential = The property 'XXX' has a maxOccurs value of XXX. If the insertion were performed, there would be XXX instances of the property left, which is above the maximum.
+BelowMinimum = The property 'XXX' has a minOccurs value of XXX, but there are only XXX instances in the document.
+AboveMaximum = The property 'XXX' has a maxOccurs value of XXX, but there are XXX instances in the document.
+NotNillable = The property 'XXX' is not nillable, but there is an instance of it with no child nodes (a null value).
+NoMetadata = The WS-RP collection has no metadata descriptor - you must set the metadata with setMetadata() before you can try to validate the properties. Use the EmptyMetadataDescriptor class if you want to avoid making metadata restrictions.
+NoSchema = The WS-RP collection has no XML Schema definition - you must set the schema with setSchema() before you can try to validate the properties. Use the OpenPropertiesSchema class if you want to avoid making schema restrictions.
+NullNLF = The NotificationListenerFactory is null.
+NoNLF = You are trying to create WS-N Topics for the resource properties, but no NotificationListenerFactory has been provided for the WS-RP container. You must call setNotificationListenerFactory() before you can create Topics (and accept subscriptions) for the resource properties.
+NullTopicPath = The Topic path expression is null.
+NoNotificationElement = The WS-N NotificationMessage does not have any message content in Element form. Property change notifications should be represented by (at the very least) a wsrp:ResourcePropertyValueChangeNotification element under the wsn:Message.
+InvalidNotification = The property change subscriber failed to parse the WS-N NotificationMessage. It found the element 'XXX' when looking for 'XXX'. Make sure the WS-RP change notifications are formatted according to the WS-RP spec.
+PropertyNotInSchema = There is no property named 'XXX' defined in the schema. A property should not have any operations or metadata applied to it if it is not in the WS-RP document.
+InvalidValue = The property 'XXX' has a value that is not valid according to its metadata. The invalid value is: XXX
+DeletingStaticValue = Could not delete a value for the property 'XXX' because it is static. The static value was: XXX
+NoExternalChanges = The metadata for property 'XXX' allows it to be changed, but not by other services. You cannot modify the value of this property via WS-RP SetResourceProperties.
+InsertOnly = The metadata for property 'XXX' only allows it to be inserted ('appended'), not updated or deleted.
+ReadOnly = The metadata for property 'XXX' makes it read-only. It cannot be modified in any way via WS-RP SetResourceProperties.
+NoInstancesToDelete = There are no instances of the property 'XXX', so it cannot be deleted.
+InvalidQueryDialect = The query dialect 'XXX' is not supported by this WS-RP implementation. The only valid dialect is 'XXX'.
+QueryEvaluationError = There was an error trying to evaluate the query 'XXX'. The original error was: XXX
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/impl/PropertySchemaDefinition.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/impl/PropertySchemaDefinition.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/impl/PropertySchemaDefinition.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/schema/impl/PropertySchemaDefinition.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,194 @@
+/*=============================================================================*
+ * 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.schema.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.util.xml.XsdUtils;
+import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.properties.schema.ResourcePropertiesSchema;
+import org.apache.muse.ws.wsdl.WsdlUtils;
+
+/**
+ *
+ * PropertySchemaDefinition is an internal class that represents one type
+ * definition in a WS-RP document definition. It holds all of the schema
+ * information for one resource property.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ * @see SimpleResourcePropertiesSchema
+ *
+ */
+
+class PropertySchemaDefinition
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES =
+ MessagesFactory.get(PropertySchemaDefinition.class);
+
+ private WsResourceCapability _capability = null;
+
+ //
+ // True if instances of the property can be set to null. The
+ // default is 'false'.
+ //
+ private boolean _isNillable = false;
+
+ //
+ // The maximum number of instances per properties document. The
+ // default is 1.
+ //
+ private int _max = 1;
+
+ //
+ // The minimum number of instances per properties document. The
+ // default is 1.
+ //
+ private int _min = 1;
+
+ //
+ // The name of the property
+ //
+ private QName _qname = null;
+
+ //
+ // The base type of the property
+ //
+ private QName _typeName = XsdUtils.ANY_TYPE_QNAME;
+
+ /**
+ *
+ * @param qname
+ * The name of the new property.
+ *
+ * @param definition
+ * The property's XML schema element (from the WS-RP document).
+ *
+ */
+ public PropertySchemaDefinition(QName qname, Element definition)
+ {
+ if (qname == null)
+ throw new NullPointerException(_MESSAGES.get("NullQName"));
+
+ if (definition == null)
+ throw new NullPointerException(_MESSAGES.get("NullPropertyElement"));
+
+ _qname = qname;
+
+ //
+ // property minimum - optional
+ //
+ String attr = definition.getAttribute(XsdUtils.MIN_OCCURS);
+
+ if (attr != null && attr.length() > 0)
+ _min = Integer.parseInt(attr);
+
+ //
+ // property maximum - optional
+ //
+ attr = definition.getAttribute(XsdUtils.MAX_OCCURS);
+
+ if (attr != null && attr.length() > 0)
+ {
+ boolean isUnbounded = attr.equals(XsdUtils.UNBOUNDED);
+
+ if (isUnbounded)
+ _max = ResourcePropertiesSchema.UNBOUNDED;
+
+ else
+ _max = Integer.parseInt(attr);
+ }
+
+ //
+ // finally, scan the whole wsdl:types for the type definition
+ //
+ Document doc = definition.getOwnerDocument();
+ Element typeDeclaration = WsdlUtils.getTypeDeclaration(doc, _qname);
+
+ if (typeDeclaration == null)
+ {
+ Object[] filler = { qname };
+ throw new RuntimeException(_MESSAGES.get("NoTypeDeclaration", filler));
+ }
+
+ //
+ // get the concrete/parent type of the property (if any)
+ //
+ attr = typeDeclaration.getAttribute(XsdUtils.TYPE);
+
+ if (attr != null && attr.length() > 0)
+ _typeName = XmlUtils.parseQName(attr, typeDeclaration);
+
+ //
+ // property's nillable setting - optional
+ //
+ attr = typeDeclaration.getAttribute(XsdUtils.NILLABLE);
+
+ if (attr != null && attr.length() > 0)
+ _isNillable = Boolean.valueOf(attr).booleanValue();
+ }
+
+ public int getMaxOccurs()
+ {
+ return _max;
+ }
+
+ public int getMinOccurs()
+ {
+ return _min;
+ }
+
+ public QName getPropertyName()
+ {
+ return _qname;
+ }
+
+ public QName getPropertyTypeName()
+ {
+ return _typeName;
+ }
+
+ public boolean isMaxUnbounded()
+ {
+ return getMaxOccurs() == ResourcePropertiesSchema.UNBOUNDED;
+ }
+
+ public boolean isNillable()
+ {
+ return _isNillable;
+ }
+
+ public WsResourceCapability getCapability()
+ {
+ return _capability;
+ }
+
+ public void setCapability(WsResourceCapability capability)
+ {
+ // FIXME: check for duplicate set
+ _capability = capability;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/PutResourcePropertyDocument.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/PutResourcePropertyDocument.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/PutResourcePropertyDocument.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/PutResourcePropertyDocument.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,27 @@
+/*=============================================================================*
+ * 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;
+
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.w3c.dom.Element;
+
+
+public interface PutResourcePropertyDocument
+{
+ Element putResourcePropertyDocument(Element wsrpDoc)
+ throws SoapFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetCapability.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetCapability.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetCapability.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,30 @@
+/*=============================================================================*
+ * 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;
+
+import org.apache.muse.ws.resource.WsResourceCapability;
+
+public interface SetCapability
+ extends WsResourceCapability,
+ PutResourcePropertyDocument,
+ SetResourceProperties
+{
+ //
+ // no additional methods - this is an aggregate of the
+ // "set" methods in WS-RP
+ //
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetOperationFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetOperationFactory.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetOperationFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetOperationFactory.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,90 @@
+/*=============================================================================*
+ * 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;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+public interface SetOperationFactory
+{
+ /**
+ *
+ * This is a convenience method that creates a new SetRequest object
+ * an populates it with a DeleteRequest for the given property.
+ *
+ * @param qname
+ * The name of the property to delete.
+ *
+ */
+ SetRequest createDelete(QName qname);
+
+ /**
+ *
+ * This is a convenience method that creates a new SetRequest 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.
+ *
+ */
+ SetRequest createInsert(QName qname, Object[] values);
+
+ /**
+ *
+ * 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>
+ *
+ */
+ SetRequest createSet(Element request)
+ throws BaseFault;
+
+ /**
+ *
+ * This is a convenience method that creates a new SetRequest object
+ * an populates it with a UpdateRequest for the given property.
+ *
+ * @param qname
+ * The name of the property to update.
+ *
+ * @param value
+ * The value that will be copied to each instance of the property.
+ *
+ */
+ SetRequest createUpdate(QName qname, Object[] values);
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetRequestComponent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetRequestComponent.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetRequestComponent.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetRequestComponent.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,49 @@
+/*=============================================================================*
+ * 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;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
+
+public interface SetRequestComponent extends XmlSerializable
+{
+ Element[] EMPTY_VALUES = new Element[0];
+
+ void execute(ResourcePropertyCollection props)
+ throws BaseFault;
+
+ int getNumberOfValues();
+
+ QName getPropertyName();
+
+ Object getSecurityToken();
+
+ Element getValue(int index);
+
+ Element[] getValues();
+
+ void setPropertyName(QName qname);
+
+ void setSecurityToken(Object securityToken);
+
+ void setValues(Object[] values);
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourceProperties.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourceProperties.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourceProperties.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourceProperties.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,87 @@
+/*=============================================================================*
+ * 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;
+
+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.faults.SetResourcePropertyRequestFailedFault;
+import org.apache.muse.ws.resource.properties.set.faults.UnableToModifyResourcePropertyFault;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+/**
+ *
+ * SetResourcePropertiesRequests breaks apart the WS-RP SetResourceProperties
+ * operation into a set of convenience methods. Each of the set operations
+ * { Insert, Update, Delete } now has its own method(s), allowing internal
+ * callers to perform modifications with much less plumbing code.
+ * <br><br>
+ * This interface also defines a security mechanism that can be used to limit
+ * the use of these methods to internal callers, and/or to differentiate
+ * between internal and external callers so that internal requests can have
+ * more freedom in their modifications. A resource may need to modify properties
+ * in a way that is not allowed from an external client; an example would be
+ * a read-only property such as "free disk space" which changes frequently
+ * but is not directly write-able by clients. It also allows users to define
+ * specialized methods for accessing certain properties and disallow access
+ * through the generic WS-RP methods.
+ * <br><br>
+ * The security token is meant to be a simple unique value that cannot be
+ * easily generated by an external caller; for many implementations, the use
+ * of a simple Object reference will suffice, since the JVM will never produce
+ * two references with the same address. If code is written that uses the
+ * security token version of these methods, the calls will not succeed unless
+ * the token matches the document's internal token.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ * @see org.apache.muse.ws.resource.properties.set.impl.AbstractSetRequestComponent
+ *
+ */
+
+public interface SetResourceProperties
+{
+ /**
+ *
+ * Modifies one or more property instances according to the definition
+ * of the three WS-RP write operations: Insert, Update, and Delete.
+ * The operations in the request are processed in order. There is no
+ * transaction support as part of basic WS-RP, so if one operation fails,
+ * the operations that were completed before it will remain intact.
+ *
+ *
+ * @param request
+ * The SetResourceProperties request that contains the individual
+ * operations { Insert, Update, Delete } to perform on the document.
+ *
+ * @throws SoapFault
+ * <ul>
+ * <li>If one of the individual set operations fails. Please
+ * review the different fault cases for each set operation in
+ * the SetResourcePropertiesRequests interface.</li>
+ * </ul>
+ * @throws SoapFault
+ *
+ * @see SetResourceProperties
+ *
+ */
+ void setResourceProperties(SetRequest request)
+ throws InvalidResourcePropertyQNameFault,
+ InvalidModificationFault,
+ SetResourcePropertyRequestFailedFault,
+ UnableToModifyResourcePropertyFault,
+ SoapFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesComponents.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesComponents.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesComponents.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesComponents.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,57 @@
+/*=============================================================================*
+ * 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;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+public interface SetResourcePropertiesComponents
+{
+ /**
+ *
+ * Removes <b>all</b> properties with the given name. Calling this method
+ * is the same as calling delete(QName, Object) with a valid security token.
+ *
+ * @throws BaseFault
+ *
+ */
+ void deleteResourceProperty(QName qname)
+ throws BaseFault;
+
+ /**
+ *
+ * Creates a new instance of the given property using the given value.
+ * Calling this method is the same as calling
+ * insert(QName, Object[], Object) with a valid security token.
+ *
+ */
+ void insertResourceProperty(QName qname, Object[] values)
+ throws BaseFault;
+
+ /**
+ *
+ * Updates <b>all</b> instances of the given property using the given
+ * values; all previous values will be removed in lieu of these new
+ * values. Calling this method is the same as calling
+ * update(QName, Object, Object) with a valid security token.
+ *
+ */
+ void updateResourceProperty(QName qname, Object[] values)
+ throws BaseFault;
+
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesPermissions.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesPermissions.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesPermissions.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesPermissions.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,138 @@
+/*=============================================================================*
+ * 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;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+public interface SetResourcePropertiesPermissions
+{
+ /**
+ *
+ * Removes <b>all</b> properties with the given name. This call will not
+ * complete if the given security token doesn't match the document's token
+ * <b>and</b> the caller is trying to delete an immutable property.
+ *
+ * @param qname
+ * The name of the property to delete.
+ *
+ * @param securityToken
+ * The token used to verify permission to call this method.
+ *
+ * @throws BaseFault
+ * <ul>
+ * <li>If there were zero instances of the property named.</li>
+ * <li>If performing the delete would result in the number of
+ * property instances being below the schema's minimum value.</li>
+ * <li>If the property is read-only or insert-only and the
+ * security token is not valid.</li>
+ * <li>If one of the PropertyChangeListeners assigned to this
+ * property throws an exception while reacting to the deletion.</li>
+ * </ul>
+ *
+ */
+ void deleteResourceProperty(QName qname, Object securityToken)
+ throws BaseFault;
+
+ /**
+ *
+ * Returns the security token that can be used by users of the WS-RP
+ * document to verify that they are internal callers with permission
+ * to circumvent published restrictions on property changes, etc. The
+ * security token system may be used to allow modification of read-only
+ * properties, modification to properties that are not supposed to be
+ * set with WS-RP's generic SetResourceProperties, and other special
+ * behavior.
+ * <br><br>
+ * The token should be given to internal components that will need
+ * special permissions, but it should not be used by components that
+ * are handling external requests directly.
+ *
+ * @return The valid security token for the WS-RP document.
+ *
+ * @see org.apache.muse.ws.resource.properties.set.impl.AbstractSetRequestComponent#getSecurityToken()
+ * @see org.apache.muse.ws.resource.properties.set.impl.AbstractSetRequestComponent#setSecurityToken(Object)
+ *
+ */
+ Object getSecurityToken();
+
+ /**
+ *
+ * Creates a new instance of the given property for each value specified
+ * in the array of values. This call will not complete if the given
+ * security token doesn't match the document's token <b>and</b> the
+ * caller is trying to insert an immutable property.
+ *
+ * @param qname
+ * The name of the property instances to create.
+ *
+ * @param values
+ * The set of values that will be assigned to the new property
+ * instances. Each value will be created once.
+ *
+ * @param securityToken
+ * The token used to verify permission to call this method.
+ *
+ * @throws BaseFault
+ * <ul>
+ * <li>If the property is not defined in the document's schema.</li>
+ * <li>If adding the new instances would create more than the
+ * maximum defined by the schema.</li>
+ * <li>If the property is read-only and the security token is not
+ * valid.</li>
+ * <li>If one of the PropertyChangeListeners assigned to this
+ * property throws an exception while reacting to the insertion.</li>
+ * <li>If the container tries to create or manipulate the Topic
+ * for the property and fails.</li>
+ * </ul>
+ *
+ */
+ void insertResourceProperty(QName qname, Object[] values, Object securityToken)
+ throws BaseFault;
+
+ /**
+ *
+ * Updates <b>all</b> instances of the given property using the given
+ * values; all previous values will be removed in lieu of these new
+ * values. This call will not complete if the given security token
+ * doesn't match the document's token <b>and</b> the caller is trying
+ * to update an immutable property.
+ *
+ * @param qname
+ * The name of the property to update.
+ *
+ * @param values
+ * The values to assign to the property.
+ *
+ * @param securityToken
+ * The token used to verify permission to call this method.
+ *
+ * @throws BaseFault
+ * <ul>
+ * <li>If the property is not defined in the document's schema.</li>
+ * <li>If a new value is null and the property is not nillable.</li>
+ * <li>If the property is read-only and the security token is not
+ * valid.</li>
+ * <li>If one of the PropertyChangeListeners assigned to this
+ * property throws an exception while reacting to the update.</li>
+ * </ul>
+ *
+ */
+ void updateResourceProperty(QName qname, Object[] values, Object securityToken)
+ throws BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/ext/SetResourcePropertiesExtensions.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/ext/SetResourcePropertiesExtensions.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/ext/SetResourcePropertiesExtensions.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/set/ext/SetResourcePropertiesExtensions.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,67 @@
+/*=============================================================================*
+ * 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.ext;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+/**
+ *
+ * SetResourcePropertiesExtensions is a collection of non-standard WS-RP
+ * extensions that is needed in order to perform common internal operations.
+ * The WS-RP spec does not provide a way to modify individual instances of
+ * a property; rather, operations like Update and Delete are required to
+ * change <b>all</b> instances of a property. This is an obstacle for many
+ * types of properties.
+ * <br><br>
+ * The methods in this interface should <b>not</b> be exposed to the outside
+ * world, only to internal callers who have permission to make modifications
+ * that standards-compliant clients would not be allowed to make.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface SetResourcePropertiesExtensions
+{
+ /**
+ *
+ * This is just a convenience method that will call
+ * insertOrUpdate(QName, Object[]) with a one-element array.
+ * @throws SoapFault
+ *
+ */
+ void insertOrUpdate(QName property, Object value)
+ throws SoapFault;
+
+ /**
+ *
+ * Checks to see if there is already an instance of the property, and if
+ * so, updates it with the given values; otherwise, it inserts the values.
+ * The former maps to update(QName, Object[]), the latter to
+ * insert(QName, Object[]). This method should be used when you want to
+ * override a default value for a property that may have already been set.
+ * <br><br>
+ * This method is <b>not</b> thread-safe in that there is a possibility
+ * that another WS-RP set request will happen in between the time the
+ * read test is done (to determine existence) and the set is done.
+ *
+ */
+ void insertOrUpdate(QName property, Object[] values)
+ throws SoapFault;
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org