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 [3/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/metadata/ResourcePropertiesMetadataValidation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/ResourcePropertiesMetadataValidation.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/ResourcePropertiesMetadataValidation.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/ResourcePropertiesMetadataValidation.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,80 @@
+/*=============================================================================*
+ * 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.metadata;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+public interface ResourcePropertiesMetadataValidation
+{
+ /**
+ *
+ * Takes the RMD that has been provided through setMetadata() and creates
+ * listeners that will enforce it. This method only needs to be called
+ * once after setMetadata() is called. After this method is called, any
+ * attempt to modify the WS-RP container in a way that is incompatible
+ * with the RMD will fail.
+ *
+ */
+ void applyMetadata()
+ throws BaseFault;
+
+ /**
+ *
+ * @return The RMD for this WS-RP document.
+ *
+ */
+ MetadataDescriptor getMetadata();
+
+ /**
+ *
+ * Provides the given WS-RMD MetadataDescriptor to this WS-RP document.
+ * This metadata will be used for all subsequent validations, including
+ * calls to validateMetadata() and SetResourceProperties-like operations.
+ * <br><br>
+ * Note that this method does <b>not</b> perform validation and it does
+ * <b>not</b> create listeners to do so in the future. To do these things,
+ * use validateMetadata and applyMetadata, respectively.
+ *
+ * @param metadata
+ * The WS-RMD metadata for this WS-RP document.
+ *
+ * @see #applyMetadata()
+ * @see #validateMetadata()
+ *
+ */
+ void setMetadata(MetadataDescriptor metadata);
+
+ /**
+ *
+ * Iterates through every property in the WS-RMD metadata and verifies
+ * that the current WS-RP 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 BaseFault
+ * <ul>
+ * <li>If there is a property in the WS-RMD document that is not
+ * in the schema.</li>
+ * <li>If the WS-RMD defines a set of valid values for a property
+ * and one of the current values is not included in that set.</li>
+ * </ul>
+ *
+ */
+ void validateMetadata()
+ throws BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/RmdFileFilter.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/RmdFileFilter.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/RmdFileFilter.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/RmdFileFilter.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,44 @@
+/*=============================================================================*
+ * 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.metadata;
+
+import java.io.File;
+import java.io.FileFilter;
+
+/**
+ *
+ * RmdFileFilter is a file filter used to find RMD files (*.rmd).
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class RmdFileFilter implements FileFilter
+{
+ /**
+ *
+ * @return True if the file is a "regular" file (not a directory) and
+ * has a name that ends with <em>.rmd</em>. The comparison is
+ * case-insensitive.
+ *
+ */
+ public boolean accept(File file)
+ {
+ String name = file.getName().toLowerCase();
+ return file.isFile() && name.endsWith(".rmd");
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/WsrmdConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/WsrmdConstants.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/WsrmdConstants.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/WsrmdConstants.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,88 @@
+/*=============================================================================*
+ * 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.metadata;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * WsrmdConstants is a collection of properties that are useful when programming
+ * against the WS-ResourceMetadata spec. This class uses WS-RMD v1.0, draft 01.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class WsrmdConstants
+{
+ /**
+ *
+ * The current WS-RMD namespace URI - v1.0 draft 01.
+ *
+ */
+ public static final String NAMESPACE_URI =
+ "http://docs.oasis-open.org/wsrf/2004/10/wsrf-WS-ResourceMetadataDescriptor-1.0-draft-01.xsd";
+
+ public static final String PREFIX = "wsrmd";
+
+ //
+ // Elements for RMD definitions
+ //
+
+ public static final QName DESCRIPTOR_QNAME =
+ new QName(NAMESPACE_URI, "MetadataDescriptor", PREFIX);
+
+ public static final QName DESCRIPTOR_ATTR_QNAME =
+ new QName(NAMESPACE_URI, "metadataDescriptor", PREFIX);
+
+ public static final QName LOCATION_ATTR_QNAME =
+ new QName(NAMESPACE_URI, "metadataDescriptorLocation", PREFIX);
+
+ public static final String NAME = "name";
+
+ public static final QName PROPERTY_QNAME =
+ new QName(NAMESPACE_URI, "Property", PREFIX);
+
+ //
+ // Attributes for wsrmd:Property definitions
+ //
+
+ public static final String MODIFIABILITY = "modifiability";
+ public static final String READ_ONLY = "read-only";
+ public static final String READ_WRITE = "read-write";
+
+ public static final String MUTABILITY = "mutability";
+ public static final String APPENDABLE = "appendable";
+ public static final String CONSTANT = "constant";
+ public static final String MUTABLE = "mutable";
+
+ public static final String PATH = "path";
+
+ public static final String SUBSCRIBABILITY = "subscribability";
+
+ public static final QName STATIC_VALUES_QNAME =
+ new QName(NAMESPACE_URI, "StaticValues", PREFIX);
+
+ public static final QName VALID_VALUES_QNAME =
+ new QName(NAMESPACE_URI, "ValidValues", PREFIX);
+
+ public static final QName VALID_RANGE_QNAME =
+ new QName(NAMESPACE_URI, "ValidValueRange", PREFIX);
+
+ public static final String LOWER_BOUND = "lowerBound";
+ public static final String UPPER_BOUND = "upperBound";
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/InsertOnlyApprover.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/InsertOnlyApprover.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/InsertOnlyApprover.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/InsertOnlyApprover.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,78 @@
+/*=============================================================================*
+ * 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.metadata.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.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.listeners.AbstractChangeApprover;
+import org.apache.muse.ws.resource.properties.listeners.PropertyChangeApprover;
+import org.apache.muse.ws.resource.properties.set.faults.UnableToModifyResourcePropertyFault;
+
+/**
+ *
+ * InsertOnlyApprover is a
+ * {@linkplain PropertyChangeApprover PropertyChangeApprover} that throws an
+ * exception if a request tries to perform a WS-RP Delete or Update on a
+ * property. In this case, the property is not immutable (since we can insert
+ * new instances of it), but the property <em>instances</em> are.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class InsertOnlyApprover extends AbstractChangeApprover
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(InsertOnlyApprover.class);
+
+ /**
+ *
+ * @see AbstractChangeApprover#AbstractChangeApprover(QName)
+ *
+ */
+ public InsertOnlyApprover(QName qname)
+ {
+ super(qname);
+ }
+
+ /**
+ *
+ * Throws an exception if the first parameter is not null (signifying
+ * an update or deletion of an existing property).
+ *
+ */
+ public void validateChange(Element oldValue, Element newValue, Object token)
+ throws BaseFault
+ {
+ //
+ // if an old value exists, it means we're updating that old value
+ // or deleting it - BAD
+ //
+ if (oldValue != null)
+ {
+ Object[] filler = { getPropertyName() };
+ throw new UnableToModifyResourcePropertyFault(_MESSAGES.get("InsertOnly", filler));
+ }
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/Messages.properties?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/Messages.properties (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/Messages.properties Mon Jun 12 09:12:15 2006
@@ -0,0 +1,14 @@
+NullPropertyElement = The DOM Element with the property definition is null.
+NoPropertyPath = There is a wsrmd:Property in the RMD that has no path attribute. This attribute is required to map the property to one defined in the WS-ResourceProperties schema; the attribute value should be the qualified name of one of those properties.
+ConstantButNotReadOnly = The wsrmd:Property with path 'XXX' is constant but not read-only - this is impossible. If a value is constant, it cannot be written to, so the modifiability of the property must be read-only.
+InvalidModifiability = The wsrmd:Property with the path 'XXX' has an invalid modifiability attribute value: XXX. The accepted modifiability values are 'read-only' and 'read-write'.
+InvalidMutability = The wsrmd:Property with the path 'XXX' has an invalid mutability attribute value: XXX. The accepted mutability values are 'constant', 'appendable', and 'mutable'.
+NullMetadataDocument = The DOM Document with the contents of the .rmd file is null.
+NoTargetNS = The resource metadata document (.rmd file) does not have the required targetNamespace attribute in its root element.
+NullMetadataDescriptor = The MetadataDescriptor is null.
+EmptyTargetNS = The target namespace string passed to setTargetNamespace() is null or empty. Make sure that the target namespace is a valid URI string and is defined in the root element of the RMD.
+NullDescriptorElement = The DOM Element with the MetadataDescriptor definition is null.
+NoDescriptorName = There is a wsrmd:MetadataDescriptor in the RMD that has no name attribute. This attribute is an xsd:NCName that uniquely identifies the descriptor.
+UndefinedProperty = There is no wsrmd:Property defined with the path 'XXX'. You cannot read metadata for a property that does not exist. Use the hasProperty method to determine if a property name is valid.
+NullPropertyMetadata = The PropertyMetadata reference is null.
+NoExternalChanges = The property 'XXX' is not writeable by remote clients. Its value may change over the lifetime of the resource, but it may only be modified by internal components.
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/PropertyMetadata.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/PropertyMetadata.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/PropertyMetadata.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/PropertyMetadata.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,409 @@
+/*=============================================================================*
+ * 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.metadata.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+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.metadata.WsrmdConstants;
+
+/**
+ *
+ * PropertyMetadata is an internal class that represents one metadata
+ * definition (for one resource property) in a WS-RMD document definition.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ * @see SimpleMetadataDescriptor
+ *
+ */
+
+class PropertyMetadata
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(PropertyMetadata.class);
+
+ //
+ // Modifiability values
+ //
+ public static final int READ_ONLY = 1;
+ public static final int READ_WRITE = 2;
+
+ //
+ // Mutability values
+ //
+ public static final int APPENDABLE = 3;
+ public static final int CONSTANT = 4;
+ public static final int MUTABLE = 5;
+
+ //
+ // extra (non-standard) metadata values defined by the application
+ //
+ private Map _extendedMetadata = null;
+
+ //
+ // The subscribability of the property. The default is true.
+ //
+ private boolean _isSubscribable = true;
+
+ //
+ // The modifiability rule for the property. The default is read-write.
+ //
+ private int _modifiability = READ_WRITE;
+
+ //
+ // The mutability rule for this property. The default is mutable.
+ //
+ private int _mutability = MUTABLE;
+
+ //
+ // The name of the property being defined
+ //
+ private QName _qname = null;
+
+ //
+ // The static values for this property - all instances of the resource
+ // should have these values for the property after initialization. The
+ // values CANNOT be deleted, even if the property is read-write/mutable.
+ //
+ private Set _staticValues = null;
+
+ //
+ // The valid values for this property - if this is empty, all values
+ // are allowed
+ //
+ private Set _validValues = null;
+
+ //
+ // The lower-bound of the valid value range (or null, if there is no
+ // value range). This is in string form, and must be converted to the
+ // appropriate data type by the caller.
+ //
+ private String _valueLowerBound = null;
+
+ //
+ // The upper-bound of the valid value range (or null, if there is no
+ // value range). This is in string form, and must be converted to the
+ // appropriate data type by the caller.
+ //
+ private String _valueUpperBound = null;
+
+ /**
+ *
+ * Creates a new metadata definition from the given XML.
+ *
+ * @param property
+ * The property's metadata definition, in XML form.
+ *
+ */
+ public PropertyMetadata(Element property)
+ {
+ if (property == null)
+ throw new NullPointerException(_MESSAGES.get("NullPropertyElement"));
+
+ //
+ // the path QName maps to a WS-RP property definition
+ //
+ String path = property.getAttribute(WsrmdConstants.PATH);
+
+ if (path == null || path.length() == 0)
+ throw new RuntimeException(_MESSAGES.get("NoPropertyPath"));
+
+ _qname = XmlUtils.parseQName(path, property);
+
+ _modifiability = parseModifiability(property);
+ _mutability = parseMutability(property);
+ _isSubscribable = parseSubscribability(property);
+
+ //
+ // make sure constant properties are also read-only!
+ //
+ if ((_mutability == CONSTANT) && (_modifiability != READ_ONLY))
+ {
+ Object[] filler = { path };
+ String message = _MESSAGES.get("ConstantButNotReadOnly", filler);
+ throw new IllegalStateException(message);
+ }
+
+ //
+ // static value set (optional)
+ //
+ _staticValues = parseStaticValues(property);
+
+ //
+ // valid value set (optional)
+ //
+ _validValues = parseValidValues(property);
+
+ //
+ // valid value range (optional)
+ //
+ Element rangeXML =
+ XmlUtils.getElement(property, WsrmdConstants.VALID_RANGE_QNAME);
+
+ if (rangeXML != null)
+ {
+ _valueLowerBound = rangeXML.getAttribute(WsrmdConstants.LOWER_BOUND);
+ _valueUpperBound = rangeXML.getAttribute(WsrmdConstants.UPPER_BOUND);
+
+ //
+ // for consistency, if there was no bound, we want the value
+ // to be null
+ //
+ if (_valueLowerBound != null && _valueLowerBound.length() == 0)
+ _valueLowerBound = null;
+
+ if (_valueUpperBound != null && _valueUpperBound.length() == 0)
+ _valueUpperBound = null;
+ }
+
+ _extendedMetadata = parseExtendedMetadata(property);
+ }
+
+ public String getExtendedMetadata(QName elementName)
+ {
+ return (String)_extendedMetadata.get(elementName);
+ }
+
+ public String getLowerBound()
+ {
+ return _valueLowerBound;
+ }
+
+ public int getModifiability()
+ {
+ return _modifiability;
+ }
+
+ public int getMutability()
+ {
+ return _mutability;
+ }
+
+ public QName getPropertyName()
+ {
+ return _qname;
+ }
+
+ public Collection getStaticValues()
+ {
+ return Collections.unmodifiableSet(_staticValues);
+ }
+
+ public String getUpperBound()
+ {
+ return _valueUpperBound;
+ }
+
+ public Collection getValidValues()
+ {
+ return Collections.unmodifiableSet(_validValues);
+ }
+
+ private boolean isElementInSet(Set setOfValues, Object value)
+ {
+ //
+ // complex type values will be XML fragments. in order to have
+ // a simple equality check, we create an XML instance of the
+ // value being tested and compare it to the XML fragments in the
+ // value set:
+ //
+
+ //
+ // 1. create XML instance of the value being tested. for complex
+ // types, the value is already XML; for simple types we build:
+ //
+ // <PropertyName>value</PropertyName>
+ //
+ Element valueXML = null;
+
+ if (value instanceof Element)
+ valueXML = (Element)value;
+
+ else
+ {
+ QName qname = getPropertyName();
+ valueXML = XmlUtils.createElement(XmlUtils.EMPTY_DOC, qname, value);
+ }
+
+ //
+ // 2. compare the XML fragments
+ //
+ Iterator i = setOfValues.iterator();
+
+ while (i.hasNext())
+ {
+ Element next = (Element)i.next();
+
+ if (XmlUtils.equals(next, valueXML))
+ return true;
+ }
+
+ //
+ // 3. no matches - invalid
+ //
+ return false;
+ }
+
+ public boolean isStaticValue(Object value)
+ {
+ return isElementInSet(_staticValues, value);
+ }
+
+ public boolean isSubscribable()
+ {
+ return _isSubscribable;
+ }
+
+ public boolean isValidValue(Object value)
+ {
+ //
+ // if no valid values were specified, it means ANY value is ok
+ //
+ if (_validValues.isEmpty())
+ return true;
+
+ return isElementInSet(_validValues, value);
+ }
+
+ private Set parseElementSet(Element property, QName qname)
+ {
+ Set values = new HashSet();
+
+ Element valuesXML = XmlUtils.getElement(property, qname);
+
+ if (valuesXML != null)
+ {
+ //
+ // we store the values as XML fragments - we will need
+ // these to do simple validation later. converting the
+ // values to non-XML would serve no purpose, and would
+ // require much more complexity
+ //
+ Element[] children = XmlUtils.getAllElements(valuesXML);
+
+ for (int n = 0; n < children.length; ++n)
+ values.add(children[n]);
+ }
+
+ return values;
+ }
+
+ private Map parseExtendedMetadata(Element property)
+ {
+ Map extended = new HashMap();
+
+ Element[] children = XmlUtils.getAllElements(property);
+
+ for (int n = 0; n < children.length; ++n)
+ {
+ QName qname = XmlUtils.getElementQName(children[n]);
+
+ if (!qname.equals(WsrmdConstants.VALID_VALUES_QNAME) &&
+ !qname.equals(WsrmdConstants.VALID_RANGE_QNAME) &&
+ !qname.equals(WsrmdConstants.STATIC_VALUES_QNAME))
+ {
+ String value = XmlUtils.extractText(children[n]);
+ extended.put(qname, value);
+ }
+ }
+
+ return extended;
+ }
+
+ private int parseModifiability(Element property)
+ {
+ String value = property.getAttribute(WsrmdConstants.MODIFIABILITY);
+
+ //
+ // default value is 'read-write'
+ //
+ if (value == null || value.length() == 0)
+ return READ_WRITE;
+
+ if (value.equals(WsrmdConstants.READ_ONLY))
+ return READ_ONLY;
+
+ else if (value.equals(WsrmdConstants.READ_WRITE))
+ return READ_WRITE;
+
+ String path = property.getAttribute(WsrmdConstants.PATH);
+ Object[] filler = { path, value };
+ throw new RuntimeException(_MESSAGES.get("InvalidModifiability", filler));
+ }
+
+ private int parseMutability(Element property)
+ {
+ String value = property.getAttribute(WsrmdConstants.MUTABILITY);
+
+ //
+ // default value is 'mutable'
+ //
+ if (value == null || value.length() == 0)
+ return MUTABLE;
+
+ if (value.equals(WsrmdConstants.APPENDABLE))
+ return APPENDABLE;
+
+ else if (value.equals(WsrmdConstants.CONSTANT))
+ return CONSTANT;
+
+ else if (value.equals(WsrmdConstants.MUTABLE))
+ return MUTABLE;
+
+ String path = property.getAttribute(WsrmdConstants.PATH);
+ Object[] filler = { path, value };
+ throw new RuntimeException(_MESSAGES.get("InvalidMutability", filler));
+ }
+
+ private Set parseStaticValues(Element property)
+ {
+ return parseElementSet(property, WsrmdConstants.STATIC_VALUES_QNAME);
+ }
+
+ private boolean parseSubscribability(Element property)
+ {
+ String value = property.getAttribute(WsrmdConstants.SUBSCRIBABILITY);
+
+ //
+ // default value is 'true'
+ //
+ if (value == null || value.length() == 0)
+ return true;
+
+ return Boolean.valueOf(value).booleanValue();
+ }
+
+ private Set parseValidValues(Element property)
+ {
+ return parseElementSet(property, WsrmdConstants.VALID_VALUES_QNAME);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/ReadOnlyApprover.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/ReadOnlyApprover.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/ReadOnlyApprover.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/ReadOnlyApprover.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,71 @@
+/*=============================================================================*
+ * 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.metadata.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.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.listeners.AbstractChangeApprover;
+import org.apache.muse.ws.resource.properties.listeners.PropertyChangeApprover;
+import org.apache.muse.ws.resource.properties.set.faults.UnableToModifyResourcePropertyFault;
+
+/**
+ *
+ * ReadOnlyApprover is a {@linkplain PropertyChangeApprover PropertyChangeApprover}
+ * that prevents modifications to read-only properties. It throws an exception for
+ * any and all attempts to change a property.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class ReadOnlyApprover extends AbstractChangeApprover
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(ReadOnlyApprover.class);
+
+ /**
+ *
+ * @see AbstractChangeApprover#AbstractChangeApprover(QName)
+ *
+ */
+ public ReadOnlyApprover(QName qname)
+ {
+ super(qname);
+ }
+
+ /**
+ *
+ * <b>Always</b> throws an exception - <b>no</b> changes are allowed for
+ * read-only properties.
+ *
+ */
+ public void validateChange(Element oldValue, Element newValue, Object token)
+ throws BaseFault
+ {
+ //
+ // any change = BAD
+ //
+ throw new UnableToModifyResourcePropertyFault(_MESSAGES.get("ReadOnly", new Object[]{ getPropertyName() }));
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/SimpleMetadataDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/SimpleMetadataDescriptor.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/SimpleMetadataDescriptor.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/SimpleMetadataDescriptor.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,226 @@
+/*=============================================================================*
+ * 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.metadata.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+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.ws.resource.metadata.MetadataDescriptor;
+import org.apache.muse.ws.resource.metadata.WsrmdConstants;
+import org.apache.muse.ws.resource.properties.impl.WsrpUtils;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.util.xml.XmlUtils;
+
+/**
+ *
+ * SimpleMetadataDescriptor is Muse's default implementation of the RMD
+ * parsing and evaluation stage. It stores a simple lookup table of property
+ * names and metadata.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleMetadataDescriptor implements MetadataDescriptor
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(SimpleMetadataDescriptor.class);
+
+ //
+ // The (unique) name of the descriptor - this maps to the name attribute
+ // in the XML definition
+ //
+ private String _name = null;
+
+ //
+ // All of the wsrmd:Property definitions, according to paths (a QName)
+ //
+ private Map _propertiesByQName = new HashMap();
+
+ /**
+ *
+ * Creates a new RMD metadata descriptor from the given XML definition.
+ *
+ * @param xml
+ * The XML representation of the descriptor.
+ *
+ */
+ public SimpleMetadataDescriptor(Element xml)
+ {
+ if (xml == null)
+ throw new NullPointerException(_MESSAGES.get("NullDescriptorElement"));
+
+ //
+ // the (unique) name - this is required
+ //
+ _name = xml.getAttribute(WsrmdConstants.NAME);
+
+ if (_name == null || _name.length() == 0)
+ throw new RuntimeException(_MESSAGES.get("NoDescriptorName"));
+
+ //
+ // parse all properties (there may be zero)
+ //
+ Element[] properties = XmlUtils.getElements(xml, WsrmdConstants.PROPERTY_QNAME);
+
+ for (int n = 0; n < properties.length; ++n)
+ {
+ PropertyMetadata metadata = new PropertyMetadata(properties[n]);
+ _propertiesByQName.put(metadata.getPropertyName(), metadata);
+ }
+ }
+
+ public boolean canDelete(QName propertyQName)
+ {
+ //
+ // deletion requires mutability (AND isReadOnlyExternal() == false)
+ //
+ PropertyMetadata property = getProperty(propertyQName);
+ return property.getMutability() == PropertyMetadata.MUTABLE;
+ }
+
+ public boolean canInsert(QName propertyQName)
+ {
+ //
+ // insert requires write permission and partial mutability (AND
+ // isReadOnlyExternal() == false)
+ //
+ int mutability = getProperty(propertyQName).getMutability();
+
+ return mutability == PropertyMetadata.APPENDABLE ||
+ mutability == PropertyMetadata.MUTABLE;
+ }
+
+ public boolean canSubscribe(QName propertyQName)
+ {
+ return getProperty(propertyQName).isSubscribable();
+ }
+
+ public boolean canUpdate(QName propertyQName)
+ {
+ //
+ // update requires write permission and full mutability (AND
+ // isReadOnlyExternal() == false)
+ //
+ PropertyMetadata property = getProperty(propertyQName);
+ return property.getMutability() == PropertyMetadata.MUTABLE;
+ }
+
+ private Object convertToObjects(Collection values, Class type)
+ throws SoapFault
+ {
+ Element[] asArray = new Element[values.size()];
+ asArray = (Element[])values.toArray(asArray);
+
+ return WsrpUtils.convertToObjects(asArray, type);
+ }
+
+ public String getExtendedMetadata(QName propertyQName, QName elementName)
+ {
+ return getProperty(propertyQName).getExtendedMetadata(elementName);
+ }
+
+ public String getLowerBound(QName propertyQName)
+ {
+ return getProperty(propertyQName).getLowerBound();
+ }
+
+ public String getName()
+ {
+ return _name;
+ }
+
+ private PropertyMetadata getProperty(QName propertyQName)
+ {
+ PropertyMetadata property =
+ (PropertyMetadata)_propertiesByQName.get(propertyQName);
+
+ if (property == null)
+ {
+ Object[] filler = { propertyQName };
+ throw new RuntimeException(_MESSAGES.get("UndefinedProperty", filler));
+ }
+
+ return property;
+ }
+
+ public Collection getPropertyNames()
+ {
+ return Collections.unmodifiableSet(_propertiesByQName.keySet());
+ }
+
+ public Collection getStaticValues(QName propertyQName)
+ {
+ return getProperty(propertyQName).getStaticValues();
+ }
+
+ public Object getStaticValues(QName propertyQName, Class javaType)
+ throws SoapFault
+ {
+ Collection values = getProperty(propertyQName).getStaticValues();
+ return convertToObjects(values, javaType);
+ }
+
+ public String getUpperBound(QName propertyQName)
+ {
+ return getProperty(propertyQName).getUpperBound();
+ }
+
+ public Collection getValidValues(QName propertyQName)
+ {
+ return getProperty(propertyQName).getValidValues();
+ }
+
+ public Object getValidValues(QName propertyQName, Class javaType)
+ throws SoapFault
+ {
+ Collection values = getProperty(propertyQName).getValidValues();
+ return convertToObjects(values, javaType);
+ }
+
+ public boolean hasProperty(QName propertyQName)
+ {
+ return _propertiesByQName.containsKey(propertyQName);
+ }
+
+ public boolean isReadOnlyExternal(QName propertyQName)
+ {
+ PropertyMetadata property = getProperty(propertyQName);
+ return property.getModifiability() == PropertyMetadata.READ_ONLY;
+ }
+
+ public boolean isStaticValue(QName propertyQName, Object value)
+ {
+ return getProperty(propertyQName).isStaticValue(value);
+ }
+
+ public boolean isValidValue(QName propertyQName, Object value)
+ {
+ PropertyMetadata property = getProperty(propertyQName);
+ return property.isValidValue(value);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/StaticValuesApprover.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/StaticValuesApprover.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/StaticValuesApprover.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/metadata/impl/StaticValuesApprover.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,103 @@
+/*=============================================================================*
+ * 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.metadata.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.metadata.MetadataDescriptor;
+import org.apache.muse.ws.resource.properties.listeners.AbstractChangeApprover;
+import org.apache.muse.ws.resource.properties.listeners.PropertyChangeApprover;
+import org.apache.muse.ws.resource.properties.set.faults.UnableToModifyResourcePropertyFault;
+
+/**
+ *
+ * StaticValuesApprover is a
+ * {@linkplain PropertyChangeApprover PropertyChangeApprover} that throws an
+ * exception if a caller tries to delete a property instance whose value is
+ * defined in the WS-RMD document's StaticValues section. If a property's
+ * metadata defines static values, those values must be in the WS-RP document
+ * for the entire resource lifecycle.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class StaticValuesApprover extends AbstractChangeApprover
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES =
+ MessagesFactory.get(StaticValuesApprover.class);
+
+ //
+ // The RMD with the static values of the properties
+ //
+ private MetadataDescriptor _metadata = null;
+
+ /**
+ *
+ * Creates a new approver for the property with the given name and RMD.
+ *
+ * @param qname
+ * The QName of the property to monitor.
+ *
+ * @param metadata
+ * The RMD descriptor with the metadata for the property.
+ *
+ * @see AbstractChangeApprover#AbstractChangeApprover(QName)
+ *
+ */
+ public StaticValuesApprover(QName qname, MetadataDescriptor metadata)
+ {
+ super(qname);
+
+ if (metadata == null)
+ throw new NullPointerException(_MESSAGES.get("NullMetadataDescriptor"));
+
+ _metadata = metadata;
+ }
+
+ /**
+ *
+ * Throws an exception if the second parameter is null (signifying a
+ * deletion) and the current property value is one of the static values
+ * defined in the RMD.
+ *
+ */
+ public void validateChange(Element oldValue, Element newValue, Object token)
+ throws BaseFault
+ {
+ QName qname = getPropertyName();
+
+ //
+ // IF we're deleting AND the value is a StaticValue, disallow it
+ //
+ if ((oldValue != null && newValue == null) &&
+ _metadata.isStaticValue(qname, oldValue))
+ {
+ Object[] filler = { qname, XmlUtils.toString(oldValue, false) };
+ throw new UnableToModifyResourcePropertyFault(_MESSAGES.get("DeletingStaticValue", filler));
+ }
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/ResourcePropertyCollection.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/ResourcePropertyCollection.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/ResourcePropertyCollection.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/ResourcePropertyCollection.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,72 @@
+/*=============================================================================*
+ * 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;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.resource.metadata.ResourcePropertiesMetadataValidation;
+import org.apache.muse.ws.resource.properties.get.GetMultipleResourceProperties;
+import org.apache.muse.ws.resource.properties.get.GetResourceProperty;
+import org.apache.muse.ws.resource.properties.get.GetResourcePropertyDocument;
+import org.apache.muse.ws.resource.properties.get.ext.GetResourcePropertyExtensions;
+import org.apache.muse.ws.resource.properties.listeners.ResourcePropertyListeners;
+import org.apache.muse.ws.resource.properties.schema.ResourcePropertiesSchemaValidation;
+import org.apache.muse.ws.resource.properties.set.PutResourcePropertyDocument;
+import org.apache.muse.ws.resource.properties.set.SetResourceProperties;
+import org.apache.muse.ws.resource.properties.set.SetResourcePropertiesComponents;
+import org.apache.muse.ws.resource.properties.set.SetResourcePropertiesPermissions;
+import org.apache.muse.ws.resource.properties.set.ext.SetResourcePropertiesExtensions;
+
+/**
+ *
+ * ResourcePropertyCollection is the WSRP-based state model that is used by
+ * all WS-resources. It does not imply or require the use of any WSRP
+ * capabilities for remote clients; users must specify said capabilities
+ * in muse.xml (with the <capability/> tag) if they want to do this.
+ * <br><br>
+ * The ResourcePropertyCollection provides a single, generic interface for
+ * reading and writing resource properties that are spread across disparate
+ * Capability objects. Read and write requests will be delegated to the
+ * appropriate {@linkplain org.apache.muse.ws.resource.WsResourceCapability capabilities}
+ * after all schema and metadata validation is done. This interface also implies
+ * the use of various listeners, which allow users to hook into the read and
+ * write requests at various points to respond to them with their own code.
+ * The crux of the ResourcePropertyCollection's role, then, is the administrative
+ * and plumbing tasks necessary to read, write, validate, and report on
+ * resource properties, but not the actual storage of the properties themselves.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+public interface ResourcePropertyCollection
+ extends GetMultipleResourceProperties,
+ GetResourceProperty,
+ GetResourcePropertyExtensions,
+ GetResourcePropertyDocument,
+ PutResourcePropertyDocument,
+ SetResourceProperties,
+ SetResourcePropertiesComponents,
+ SetResourcePropertiesExtensions,
+ SetResourcePropertiesPermissions,
+ ResourcePropertyListeners,
+ ResourcePropertiesMetadataValidation,
+ ResourcePropertiesSchemaValidation,
+ XmlSerializable
+{
+ //
+ // no additional methods - this is an aggregate type
+ //
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/WsrpConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/WsrpConstants.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/WsrpConstants.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/WsrpConstants.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,231 @@
+/*=============================================================================*
+ * 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;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.resource.properties.set.impl.SetResponse;
+
+/**
+*
+* WsrpConstants is a collection of properties and methods that is useful when
+* programming against the WS-ResourceProperties spec. This class uses
+* WS-RP v1.2.
+*
+* @author Dan Jemiolo (danj)
+*
+*/
+
+public class WsrpConstants
+{
+ public static final String NAMESPACE_URI = "http://docs.oasis-open.org/wsrf/rp-2";
+
+ public static final String WSDL_NAMESPACE_URI = "http://docs.oasis-open.org/wsrf/rpw-2";
+
+ public static final String PREFIX = "wsrf-rp";
+
+ public static final String WSDL_PREFIX = "wsrf-rpw";
+
+ public static final String GET_CAPABILITY = WSDL_NAMESPACE_URI + "/Get";
+
+ public static final String SET_CAPABILITY = WSDL_NAMESPACE_URI + "/Set";
+
+ public static final String QUERY_CAPABILITY = WSDL_NAMESPACE_URI + "/Query";
+
+ /**
+ *
+ * A default root element name for WS-RP documents.
+ *
+ */
+ public static final QName DEFAULT_DOCUMENT_QNAME =
+ new QName(NAMESPACE_URI, "ResourceProperties", PREFIX);
+
+ /**
+ *
+ * The standard WS-RP TopicSpace name.
+ *
+ */
+ public static final String TOPIC_SPACE_NAME = "ResourcePropertiesTopicSpace";
+
+ /**
+ *
+ * The WS-A Action URI for the GetResourceProperty operation.
+ *
+ */
+ public static final String GET_RESOURCE_PROPERTY_URI =
+ WSDL_NAMESPACE_URI + "/GetResourceProperty/GetResourcePropertyRequest";
+
+ /**
+ *
+ * The WS-A Action URI for the GetResourcePropertyDocument operation.
+ *
+ */
+ public static final String GET_RP_DOCUMENT_URI =
+ WSDL_NAMESPACE_URI + "/GetResourcePropertyDocument/GetResourcePropertyDocumentRequest";
+
+ /**
+ *
+ * The WS-A Action URI for the PutResourcePropertyDocument operation.
+ *
+ */
+ public static final String PUT_RP_DOCUMENT_URI =
+ WSDL_NAMESPACE_URI + "/PutResourcePropertyDocument/PutResourcePropertyDocumentRequest";
+
+ /**
+ *
+ * The WS-A Action URI for the GetMultipleResourceProperties operation.
+ *
+ */
+ public static final String GET_MULTIPLE_PROPERTIES_URI =
+ WSDL_NAMESPACE_URI + "/GetMultipleResourceProperties/GetMultipleResourcePropertiesRequest";
+
+ /**
+ *
+ * The WS-A Action URI for the QueryResourceProperties operation.
+ *
+ */
+ public static final String QUERY_RESOURCE_PROPERTIES_URI =
+ WSDL_NAMESPACE_URI + "/QueryResourceProperties/QueryResourcePropertiesRequest";
+
+ /**
+ *
+ * The WS-A Action URI for the SetResourceProperties operation.
+ *
+ */
+ public static final String SET_RESOURCE_PROPERTIES_URI =
+ WSDL_NAMESPACE_URI + "/SetResourceProperties/SetResourcePropertiesRequest";
+
+ /**
+ *
+ * The WS-RP attribute for WSDL portTypes.
+ *
+ */
+ public static final String RESOURCE_PROPERTIES = "ResourceProperties";
+
+ public static final QName GET_QNAME =
+ new QName(NAMESPACE_URI, "GetResourceProperty", PREFIX);
+
+ public static final QName GET_RESPONSE_QNAME =
+ new QName(NAMESPACE_URI, "GetResourcePropertyResponse", PREFIX);
+
+ public static final QName INVALID_PROPERTY_QNAME =
+ new QName(WSDL_NAMESPACE_URI, "InvalidResourcePropertyQNameFault", WSDL_PREFIX);
+
+ public static final QName GET_MULTIPLE_QNAME =
+ new QName(NAMESPACE_URI, "GetMultipleResourceProperties", PREFIX);
+
+ public static final QName GET_MULTIPLE_RESPONSE_QNAME =
+ new QName(NAMESPACE_URI, "GetMultipleResourcePropertiesResponse", PREFIX);
+
+ public static final QName PROPERTY_QNAME =
+ new QName(NAMESPACE_URI, "ResourceProperty", PREFIX);
+
+ public static final QName GET_DOCUMENT_QNAME =
+ new QName(NAMESPACE_URI, "GetResourcePropertyDocument", PREFIX);
+
+ public static final QName GET_DOCUMENT_RESPONSE_QNAME =
+ new QName(NAMESPACE_URI, "GetResourcePropertyDocumentResponse", PREFIX);
+
+ public static final QName QUERY_QNAME =
+ new QName(NAMESPACE_URI, "QueryResourceProperties", PREFIX);
+
+ public static final QName QUERY_EXPRESSION_QNAME =
+ new QName(NAMESPACE_URI, "QueryExpression", PREFIX);
+
+ public static final QName QUERY_DIALECT_QNAME =
+ new QName(NAMESPACE_URI, "QueryExpressionDialect", PREFIX);
+
+ public static final String DIALECT = "Dialect";
+
+ public static final QName QUERY_RESPONSE_QNAME =
+ new QName(NAMESPACE_URI, "QueryResourcePropertiesResponse", PREFIX);
+
+ public static final QName UNKNOWN_QUERY_DIALECT_QNAME =
+ new QName(WSDL_NAMESPACE_URI, "UnknownQueryExpressionDialectFault", WSDL_PREFIX);
+
+ public static final QName INVALID_QUERY_QNAME =
+ new QName(WSDL_NAMESPACE_URI, "InvalidQueryExpressionFault", WSDL_PREFIX);
+
+ public static final QName QUERY_EVALUATION_ERROR_QNAME =
+ new QName(WSDL_NAMESPACE_URI, "QueryEvaluationErrorFault", WSDL_PREFIX);
+
+ public static final QName PUT_DOCUMENT_QNAME =
+ new QName(NAMESPACE_URI, "PutResourcePropertyDocument", PREFIX);
+
+ public static final QName SET_QNAME =
+ new QName(NAMESPACE_URI, "SetResourceProperties", PREFIX);
+
+ public static final QName SET_RESPONSE_QNAME =
+ new QName(NAMESPACE_URI, "SetResourcePropertiesResponse", PREFIX);
+
+ public static final QName DELETE_QNAME =
+ new QName(NAMESPACE_URI, "Delete", PREFIX);
+
+ public static final QName INSERT_QNAME =
+ new QName(NAMESPACE_URI, "Insert", PREFIX);
+
+ public static final QName UPDATE_QNAME =
+ new QName(NAMESPACE_URI, "Update", PREFIX);
+
+ public static final String RESOURCE_PROPERTY = "resourceProperty";
+
+ public static final QName INVALID_MODIFICATION_QNAME =
+ new QName(WSDL_NAMESPACE_URI, "InvalidModificationFault", WSDL_PREFIX);
+
+ public static final QName UNABLE_TO_MODIFY_QNAME =
+ new QName(WSDL_NAMESPACE_URI, "UnableToModifyResourcePropertyFault", WSDL_PREFIX);
+
+ public static final QName SET_RP_FAILED_QNAME =
+ new QName(WSDL_NAMESPACE_URI, "SetResourcePropertyRequestFailedFault", WSDL_PREFIX);
+
+ //
+ // below are the semi-standard WS-RP/WS-N change notification elements
+ //
+
+ /**
+ *
+ * WS-RP/WS-N change notification - old value element name.
+ *
+ */
+ public static final QName OLD_VALUE_QNAME =
+ new QName(NAMESPACE_URI, "OldValue", PREFIX);
+
+ /**
+ *
+ * WS-RP/WS-N change notification - new value element name.
+ *
+ */
+ public static final QName NEW_VALUE_QNAME =
+ new QName(NAMESPACE_URI, "NewValue", PREFIX);
+
+ /**
+ *
+ * WS-RP/WS-N change notification - root element name.
+ *
+ */
+ public static final QName NOTIFICATION_QNAME =
+ new QName(NAMESPACE_URI, "ResourcePropertyValueChangeNotification", PREFIX);
+
+
+ /**
+ *
+ * The wsrp:SetResourcePropertiesResponse content is always the same,
+ * so we can share one instance of SetResponse among all components.
+ *
+ */
+ public static final SetResponse SET_RESPONSE = new SetResponse();
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetCapability.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetCapability.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetCapability.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,32 @@
+/*=============================================================================*
+ * 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.get;
+
+import org.apache.muse.ws.resource.WsResourceCapability;
+
+
+public interface GetCapability
+ extends WsResourceCapability,
+ GetMultipleResourceProperties,
+ GetResourceProperty,
+ GetResourcePropertyDocument
+{
+ //
+ // no additional methods - this is an aggregate of all of the
+ // "get" operations from WS-RP
+ //
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetMultipleResourceProperties.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetMultipleResourceProperties.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetMultipleResourceProperties.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetMultipleResourceProperties.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,60 @@
+/*=============================================================================*
+ * 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.get;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
+
+/**
+ *
+ * GetMultipleResourceProperties is ...
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface GetMultipleResourceProperties
+{
+ /**
+ *
+ * Returns zero or more instances of the given properties.
+ *
+ * @param qnames
+ * The names of the properties to find.
+ *
+ * @return An array of DOM Elements, where each Element is an instance
+ * of one of the properties named. The Elements will be ordered
+ * such that all properties with the same name are grouped
+ * together, with Group #1 = QName #1, Group #2 = QName #2, etc.
+ * There is no guarantee that the Elements are the internal data
+ * structures used by the WS-RP document.
+ *
+ * @throws BaseFault
+ * <ul>
+ * <li>If one of the properties is undefined in the document's
+ * schema. This is <b>not</b> the same as finding zero instances
+ * of a defined property.</li>
+ * </ul>
+ *
+ */
+ Element[] getMultipleResourceProperties(QName[] qnames)
+ throws InvalidResourcePropertyQNameFault, BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetResourceProperty.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetResourceProperty.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetResourceProperty.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetResourceProperty.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.get;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
+
+/**
+ *
+ * GetResourceProperty is ...
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface GetResourceProperty
+{
+ /**
+ *
+ * Returns zero or more instances of the given property.
+ *
+ * @param qname
+ * The name of the property to find.
+ *
+ * @return An array of DOM Elements, where each Element is an instance
+ * of the property named. There is no guarantee that the Elements
+ * are the internal data structures used by the WS-RP document.
+ *
+ * @throws InvalidResourcePropertyQNameFault
+ * <ul>
+ * <li>If the property is undefined in the document's schema. This
+ * is <b>not</b> the same as finding zero instances of a defined
+ * property.</li>
+ * </ul>
+ *
+ */
+ Element[] getResourceProperty(QName qname)
+ throws InvalidResourcePropertyQNameFault, BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetResourcePropertyDocument.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetResourcePropertyDocument.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetResourcePropertyDocument.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/GetResourcePropertyDocument.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,35 @@
+/*=============================================================================*
+ * 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.get;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+/**
+ *
+ * GetResourcePropertyDocument is ...
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface GetResourcePropertyDocument
+{
+ Element getResourcePropertyDocument()
+ throws BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/ext/GetResourcePropertyExtensions.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/ext/GetResourcePropertyExtensions.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/ext/GetResourcePropertyExtensions.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/ext/GetResourcePropertyExtensions.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.get.ext;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.get.faults.InvalidResourcePropertyQNameFault;
+
+/**
+ *
+ * GetResourcePropertyExtensions is a collection of convenience methods that
+ * can be added onto a WS-RP implementation.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface GetResourcePropertyExtensions
+{
+ /**
+ *
+ * Returns zero or more instances of the given property, deserialized
+ * into instances of the given type. This method differs from
+ * getResourceProperty(QName) in that it returns POJOs rather than XML.
+ *
+ * @param qname
+ * The name of the property to find.
+ *
+ * @param type
+ * The type of the property instances returned by this method.
+ * Every object in the returned array can be cast to this type.
+ *
+ * @return An array of objects, where each object is an instance of the
+ * property named. There is no guarantee that the objects are
+ * the internal data structures used by the WS-RP document. The
+ * objects should be the POJO equivalent of the Elements returned
+ * by getResourceProperty(QName).
+ *
+ * @throws BaseFault
+ * <ul>
+ * <li>If the property is undefined in the document's schema. This
+ * is <b>not</b> the same as finding zero instances of a defined
+ * property.</li>
+ * <li>If there is an error creating instances of the given type
+ * using the property values found.</li>
+ * </ul>
+ *
+ * @see org.apache.muse.ws.resource.properties.get.GetResourceProperty
+ *
+ */
+ Object getPropertyAsObject(QName qname, Class type)
+ throws InvalidResourcePropertyQNameFault, BaseFault;
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/faults/InvalidResourcePropertyQNameFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/faults/InvalidResourcePropertyQNameFault.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/faults/InvalidResourcePropertyQNameFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/faults/InvalidResourcePropertyQNameFault.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.get.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class InvalidResourcePropertyQNameFault extends BaseFault
+{
+ private static final long serialVersionUID = -1609554523949920531L;
+
+ public InvalidResourcePropertyQNameFault(Element xml)
+ {
+ super(xml);
+ }
+
+ public InvalidResourcePropertyQNameFault(String message)
+ {
+ super(WsrpConstants.INVALID_PROPERTY_QNAME, message);
+ }
+
+ public InvalidResourcePropertyQNameFault(String message, Throwable cause)
+ {
+ super(WsrpConstants.INVALID_PROPERTY_QNAME, message, cause);
+ }
+
+ public InvalidResourcePropertyQNameFault(Throwable cause)
+ {
+ super(WsrpConstants.INVALID_PROPERTY_QNAME, cause);
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetHandler.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetHandler.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetHandler.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.properties.get.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;
+
+/**
+ *
+ * GetHandler is the parser for the WS-ResourceProperties GetResourceProperty
+ * operation.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class GetHandler extends AbstractMessageHandler
+{
+ public GetHandler()
+ {
+ super(WsrpConstants.GET_QNAME);
+ }
+
+ public Object[] fromXML(Element xml)
+ throws SoapFault
+ {
+ GetRequest request = new GetRequest(xml);
+ return new Object[]{ request.getQName() };
+ }
+
+ public Element toXML(Object result)
+ {
+ GetResponse get = new GetResponse((Element[])result);
+ return get.toXML();
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleHandler.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleHandler.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleHandler.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.properties.get.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;
+
+/**
+ *
+ * GetMultipleHandler is the parser for the WS-ResourceProperties
+ * GetMultipleResourceProperties operation.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class GetMultipleHandler extends AbstractMessageHandler
+{
+ public GetMultipleHandler()
+ {
+ super(WsrpConstants.GET_MULTIPLE_QNAME);
+ }
+
+ public Object[] fromXML(Element xml)
+ throws SoapFault
+ {
+ GetMultipleRequest request = new GetMultipleRequest(xml);
+ return new Object[]{ request.getQNames() };
+ }
+
+ public Element toXML(Object result)
+ {
+ GetMultipleResponse get = new GetMultipleResponse((Element[])result);
+ return get.toXML();
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleRequest.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleRequest.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleRequest.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,132 @@
+/*=============================================================================*
+ * 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.get.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.XmlSerializable;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.resource.ext.faults.InvalidMessageFormatFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+/**
+ *
+ * GetMultipleRequest is a serializer/deserializer for the WS-ResourceProperties
+ * GetMultipleResourceProperties operation's request content.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class GetMultipleRequest implements XmlSerializable
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(GetMultipleRequest.class);
+
+ //
+ // The names of the properties to retrieve
+ //
+ private QName[] _qnames = null;
+
+ public GetMultipleRequest(QName[] qnames)
+ {
+ if (qnames == null)
+ throw new NullPointerException(_MESSAGES.get("NullQNameArray"));
+
+ for (int n = 0; n < qnames.length; ++n)
+ {
+ if (qnames[n] == null)
+ {
+ Object[] filler = { new Integer(n) };
+ throw new NullPointerException(_MESSAGES.get("NullQNameN", filler));
+ }
+ }
+
+ _qnames = qnames;
+ }
+
+ public GetMultipleRequest(Element request)
+ throws InvalidMessageFormatFault
+ {
+ if (request == null)
+ throw new NullPointerException(_MESSAGES.get("NullRequestElement"));
+
+ //
+ // load the property QNames from the ResourceProperty elements...
+ //
+ QName qname = WsrpConstants.PROPERTY_QNAME;
+ Element[] properties = XmlUtils.getElements(request, qname);
+
+ if (properties.length == 0)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NoPropertiesInGet"));
+
+ _qnames = new QName[properties.length];
+
+ for (int n = 0; n < properties.length; ++n)
+ {
+ _qnames[n] = XmlUtils.getQName(properties[n]);
+
+ if (_qnames[n] == null)
+ {
+ Object[] filler = { new Integer(n) };
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NullPropertyN", filler));
+ }
+ }
+ }
+
+ public QName[] getQNames()
+ {
+ return _qnames;
+ }
+
+ 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.GET_MULTIPLE_QNAME;
+ Element root = XmlUtils.createElement(doc, qname);
+
+ qname = WsrpConstants.PROPERTY_QNAME;
+ QName[] qnames = getQNames();
+
+ for (int n = 0; n < qnames.length; ++n)
+ {
+ Element property = XmlUtils.createElement(doc, qname, qnames[n]);
+ root.appendChild(property);
+ }
+
+ return root;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleResponse.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleResponse.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleResponse.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleResponse.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.get.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;
+
+/**
+ *
+ * GetMultipleResponse is a serializer/deserializer for the WS-ResourceProperties
+ * GetMultipleResourceProperties operation's response content.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class GetMultipleResponse implements XmlSerializable
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(GetMultipleResponse.class);
+
+ //
+ // The property instances retrieved for a GetMultipleResourceProperties
+ // request. This may be empty.
+ //
+ private Element[] _properties = null;
+
+ public GetMultipleResponse(Element[] properties)
+ {
+ if (properties == null)
+ throw new NullPointerException(_MESSAGES.get("NullElementArray"));
+
+ for (int n = 0; n < properties.length; ++n)
+ {
+ if (properties[n] == null)
+ {
+ Object[] filler = { new Integer(n) };
+ throw new NullPointerException(_MESSAGES.get("NullInstanceN", filler));
+ }
+ }
+
+ _properties = properties;
+ }
+
+ public int getNumberOfProperties()
+ {
+ return _properties.length;
+ }
+
+ public Element[] getProperties()
+ {
+ return _properties;
+ }
+
+ public Element getProperty(int index)
+ {
+ return _properties[index];
+ }
+
+ public QName getPropertyName(int index)
+ {
+ return XmlUtils.getElementQName(getProperty(index));
+ }
+
+ public boolean isEmpty()
+ {
+ return _properties.length == 0;
+ }
+
+ public String toString()
+ {
+ return XmlUtils.toString(toXML(), false);
+ }
+
+ public Element toXML()
+ {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document doc)
+ {
+ QName qname = WsrpConstants.GET_MULTIPLE_RESPONSE_QNAME;
+ Element root = XmlUtils.createElement(doc, qname);
+
+ for (int n = 0; n < _properties.length; ++n)
+ {
+ Node property = doc.importNode(_properties[n], true);
+ root.appendChild(property);
+ }
+
+ return root;
+ }
+}
Added: webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetRequest.java?rev=413698&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetRequest.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src/org/apache/muse/ws/resource/properties/get/impl/GetRequest.java Mon Jun 12 09:12:15 2006
@@ -0,0 +1,94 @@
+/*=============================================================================*
+ * 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.get.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.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;
+
+/**
+ *
+ * GetRequest is a serializer/deserializer for the WS-ResourceProperties
+ * GetResourceProperty operation's request content.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class GetRequest implements XmlSerializable
+{
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(GetRequest.class);
+
+ //
+ // The name of the property to retrieve
+ //
+ private QName _qname = null;
+
+ public GetRequest(QName qname)
+ {
+ if (qname == null)
+ throw new NullPointerException(_MESSAGES.get("NullQName"));
+
+ _qname = qname;
+ }
+
+ public GetRequest(Element request)
+ throws InvalidMessageFormatFault
+ {
+ if (request == null)
+ throw new NullPointerException(_MESSAGES.get("NullRequestElement"));
+
+ _qname = XmlUtils.getQName(request);
+
+ if (_qname == null)
+ throw new InvalidMessageFormatFault(_MESSAGES.get("NullGetProperty"));
+ }
+
+ public QName getQName()
+ {
+ return _qname;
+ }
+
+ 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"));
+
+ return XmlUtils.createElement(doc, WsrpConstants.GET_QNAME, getQName());
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org