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/16 00:17:07 UTC

svn commit: r414694 [3/7] - in /webservices/muse/trunk/modules/muse-wsrf: ./ src-api/ src-api/org/ src-api/org/apache/ src-api/org/apache/muse/ src-api/org/apache/muse/ws/ src-api/org/apache/muse/ws/resource/ src-api/org/apache/muse/ws/resource/basefau...

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchemaValidation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchemaValidation.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchemaValidation.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/schema/ResourcePropertiesSchemaValidation.java Thu Jun 15 15:16:59 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-api/org/apache/muse/ws/resource/properties/schema/faults/SchemaValidationErrorFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/schema/faults/SchemaValidationErrorFault.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/schema/faults/SchemaValidationErrorFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/schema/faults/SchemaValidationErrorFault.java Thu Jun 15 15:16:59 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-api/org/apache/muse/ws/resource/properties/set/PutResourcePropertyDocument.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/PutResourcePropertyDocument.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/PutResourcePropertyDocument.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/PutResourcePropertyDocument.java Thu Jun 15 15:16:59 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-api/org/apache/muse/ws/resource/properties/set/SetCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetCapability.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetCapability.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetCapability.java Thu Jun 15 15:16:59 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-api/org/apache/muse/ws/resource/properties/set/SetOperationFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetOperationFactory.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetOperationFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetOperationFactory.java Thu Jun 15 15:16:59 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-api/org/apache/muse/ws/resource/properties/set/SetRequest.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetRequest.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetRequest.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetRequest.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,28 @@
+/*=============================================================================*
+ *  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 java.util.List;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+public interface SetRequest extends XmlSerializable
+{
+    void addRequestComponent(SetRequestComponent operation);
+
+    List getRequestComponents();
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetRequestComponent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetRequestComponent.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetRequestComponent.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetRequestComponent.java Thu Jun 15 15:16:59 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-api/org/apache/muse/ws/resource/properties/set/SetResourceProperties.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetResourceProperties.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetResourceProperties.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetResourceProperties.java Thu Jun 15 15:16:59 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-api/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesComponents.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesComponents.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesComponents.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesComponents.java Thu Jun 15 15:16:59 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-api/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesPermissions.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesPermissions.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesPermissions.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/SetResourcePropertiesPermissions.java Thu Jun 15 15:16:59 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-api/org/apache/muse/ws/resource/properties/set/ext/SetResourcePropertiesExtensions.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/ext/SetResourcePropertiesExtensions.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/ext/SetResourcePropertiesExtensions.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/ext/SetResourcePropertiesExtensions.java Thu Jun 15 15:16:59 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;
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/InvalidModificationFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/InvalidModificationFault.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/InvalidModificationFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/InvalidModificationFault.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,47 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.properties.set.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class InvalidModificationFault extends BaseFault
+{
+    private static final long serialVersionUID = -322440717755308354L;
+
+    public InvalidModificationFault(Element xml)
+    {
+        super(xml);
+    }
+
+    public InvalidModificationFault(String message)
+    {
+        super(WsrpConstants.INVALID_MODIFICATION_QNAME, message);
+    }
+
+    public InvalidModificationFault(String message, Throwable cause)
+    {
+        super(WsrpConstants.INVALID_MODIFICATION_QNAME, message, cause);
+    }
+
+    public InvalidModificationFault(Throwable cause)
+    {
+        super(WsrpConstants.INVALID_MODIFICATION_QNAME, cause);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/SetResourcePropertyRequestFailedFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/SetResourcePropertyRequestFailedFault.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/SetResourcePropertyRequestFailedFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/SetResourcePropertyRequestFailedFault.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,47 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.properties.set.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class SetResourcePropertyRequestFailedFault extends BaseFault
+{
+    private static final long serialVersionUID = 2505691715009677115L;
+
+    public SetResourcePropertyRequestFailedFault(Element xml)
+    {
+        super(xml);
+    }
+
+    public SetResourcePropertyRequestFailedFault(String message)
+    {
+        super(WsrpConstants.SET_RP_FAILED_QNAME, message);
+    }
+
+    public SetResourcePropertyRequestFailedFault(String message, Throwable cause)
+    {
+        super(WsrpConstants.SET_RP_FAILED_QNAME, message, cause);
+    }
+
+    public SetResourcePropertyRequestFailedFault(Throwable cause)
+    {
+        super(WsrpConstants.SET_RP_FAILED_QNAME, cause);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/UnableToModifyResourcePropertyFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/UnableToModifyResourcePropertyFault.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/UnableToModifyResourcePropertyFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/properties/set/faults/UnableToModifyResourcePropertyFault.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,47 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.properties.set.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+
+public class UnableToModifyResourcePropertyFault extends BaseFault
+{
+    private static final long serialVersionUID = 7530628873576034625L;
+
+    public UnableToModifyResourcePropertyFault(Element xml)
+    {
+        super(xml);
+    }
+
+    public UnableToModifyResourcePropertyFault(String message)
+    {
+        super(WsrpConstants.UNABLE_TO_MODIFY_QNAME, message);
+    }
+
+    public UnableToModifyResourcePropertyFault(String message, Throwable cause)
+    {
+        super(WsrpConstants.UNABLE_TO_MODIFY_QNAME, message, cause);
+    }
+
+    public UnableToModifyResourcePropertyFault(Throwable cause)
+    {
+        super(WsrpConstants.UNABLE_TO_MODIFY_QNAME, cause);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/Entry.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/Entry.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/Entry.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/Entry.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,106 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.sg;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.resource.WsResource;
+import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.addressing.EndpointReference;
+
+/**
+ *
+ * Entry is an interface for WS-ServiceGroup Entry resources. Such resources 
+ * represent a relationship between a resource and the service group of which 
+ * it is a member; the modification or destruction of these resources 
+ * represents a change in the resource's membership in a service group. 
+ * Changes in the service group members do not necessarily affect membership.
+ * <br><br>
+ * Muse represents all WS-SG entries at WS-RF (implied) resources. They 
+ * are accessible through a unique endpoint and can be destroyed via WS-RL. 
+ * Users who want to create service groups but don't want to expose them to 
+ * external components should use the <b>private</b> tag in their resource 
+ * definition in muse.xml.
+ * <br><br>
+ * If you want to add the WSDM ServiceGroup capability to a participant 
+ * resource, use the {@linkplain ServiceGroup ServiceGroup} interface.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface Entry extends WsResourceCapability, XmlSerializable
+{
+    QName[] PROPERTIES = new QName[]{
+        WssgConstants.CONTENT_QNAME, 
+        WssgConstants.MEMBER_EPR_QNAME, 
+        WssgConstants.SG_EPR_QNAME
+    };
+    
+    /**
+     * 
+     * @return The values of resource the properties (Element[]) that are 
+     *         found in the service group's MembershipContentRules and which are 
+     *         defined by the member service. The list may be empty if 
+     *         there were no membership rules. The values returned are 
+     *         <b>not</b> guaranteed to be current - they may include a 
+     *         snapshot of the values from when the entry was created. If 
+     *         you are unsure of the mutability of these values, you should 
+     *         ask the member resource directly.
+     *
+     */
+    Element getContent()
+        throws BaseFault;
+    
+    /**
+     * 
+     * @return The EPR for the service group member this entry represents.
+     * 
+     */
+    EndpointReference getMemberEPR()
+        throws BaseFault;
+    
+    /**
+     * 
+     * @return The EPR for the service group to which this entry belongs.
+     * 
+     */    
+    EndpointReference getServiceGroupEPR()
+        throws BaseFault;
+    
+    /**
+     * 
+     * @param member
+     *        A proxy for the service group member this entry represents.
+     * 
+     */
+    void setMemberEPR(EndpointReference memberEPR)
+        throws BaseFault;
+    
+    /**
+     * 
+     * @param owner
+     *        A reference for the service group to which this entry belongs.
+     * 
+     */    
+    void setServiceGroup(WsResource serviceGroup)
+        throws BaseFault;
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/MembershipContentRule.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/MembershipContentRule.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/MembershipContentRule.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/MembershipContentRule.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,45 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.sg;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.addressing.EndpointReference;
+
+public interface MembershipContentRule extends XmlSerializable
+{
+    QName[] getContentElements();
+
+    QName getMemberInterface();
+
+    /**
+     * 
+     * @param epr
+     *        The EPR for the resource against which this membership content 
+     *        rule will be evaluated.
+     * 
+     * @return True if the given resource's WS-RP document matches the rules 
+     *         in the MCR.
+     *
+     */
+    boolean isMatch(EndpointReference epr);
+
+    void setContentElements(QName[] content);
+
+    void setMemberInterface(QName portType);
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/ServiceGroup.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/ServiceGroup.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/ServiceGroup.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/ServiceGroup.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,123 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.sg;
+
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.resource.WsResource;
+import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.faults.AddRefusedFault;
+import org.apache.muse.ws.resource.sg.faults.ContentCreationFailedFault;
+import org.apache.muse.ws.resource.sg.faults.UnsupportedMemberInterfaceFault;
+
+/**
+ * 
+ * ServiceGroup is an internal representation of the WSDM ServiceGroup 
+ * capability. It provides access to the one property (Entry) along 
+ * with methods for creating, destroying, and querying entries. The 
+ * Add operation is exposed here; the other methods are for internal 
+ * entry management and should not be made public.
+ * 
+ * @author Dan Jemiolo (danj)
+ * 
+ */
+
+public interface ServiceGroup extends WsResourceCapability
+{
+    QName[] PROPERTIES = new QName[]{
+        WssgConstants.ENTRY_QNAME, 
+        WssgConstants.CONTENT_RULE_QNAME, 
+    };
+    
+    /**
+     * 
+     * Creates a new Entry resource and adds it to the touchpoint's 
+     * ResourceManager and the ServiceGroup's WS-RP container.
+     * 
+     * @param memberEPR
+     *        The EPR of the resource that the Entry will represent.
+     * 
+     * @param termination
+     *        The initial termination time for the Entry. This may be null 
+     *        if the Entry is not scheduled for destruction.
+     * 
+     * @return The newly-created (and stored) Entry.
+     * 
+     * @throws BaseFault
+     *         <ul>
+     *         <li>If there was an error during the initialization of the 
+     *         Entry resource instance.</li>
+     *         <li>If there was an error inserting into the ServiceGroup's 
+     *         WS-RP container.</li>
+     *         </ul>
+     *
+     */
+    WsResource addEntry(EndpointReference memberEPR, 
+                        Element content, 
+                        Date termination)
+        throws AddRefusedFault, 
+               ContentCreationFailedFault, 
+               UnsupportedMemberInterfaceFault, 
+               BaseFault;
+    
+    QName[] getContentElements()
+        throws BaseFault;
+    
+    WsResource[] getEntry()
+        throws BaseFault;
+    
+    WsResource getEntry(EndpointReference memberEPR)
+        throws BaseFault;
+    
+    MembershipContentRule[] getMembershipContentRule()
+        throws BaseFault;
+    
+    /**
+     * 
+     * @param epr
+     *        The EPR for the resource against which all the service group's 
+     *        membership content rules should be evaluated.
+     * 
+     * @return True if the given resource's WS-RP document matches all of 
+     *         the service group's membership rules and can be safely added 
+     *         to the service group.
+     *
+     */
+    boolean isMatch(EndpointReference epr)
+        throws BaseFault;
+        
+    /**
+     * 
+     * Deletes the Entry from the ServiceGroup's WS-RP container.
+     *
+     * @param entry
+     * 
+     * @throws BaseFault
+     *         <ul>
+     *         <li>If the entry has already been removed.</li>
+     *         </ul>
+     *
+     */
+    void removeEntry(WsResource entry)
+        throws BaseFault;
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/ServiceGroupRegistration.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/ServiceGroupRegistration.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/ServiceGroupRegistration.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/ServiceGroupRegistration.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,38 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.sg;
+
+import java.util.Date;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.faults.AddRefusedFault;
+import org.apache.muse.ws.resource.sg.faults.ContentCreationFailedFault;
+import org.apache.muse.ws.resource.sg.faults.UnsupportedMemberInterfaceFault;
+
+
+public interface ServiceGroupRegistration extends WsResourceCapability
+{
+    EndpointReference add(EndpointReference memberEPR, Element content, Date terminationTime)
+        throws AddRefusedFault, 
+               ContentCreationFailedFault, 
+               UnsupportedMemberInterfaceFault, 
+               BaseFault;
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/WssgConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/WssgConstants.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/WssgConstants.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/WssgConstants.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,177 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.sg;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * WssgConstants is a collection of properties that is useful when programming 
+ * against the WS-ServiceGroups spec. This class uses WS-SG v1.2, draft 02.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class WssgConstants
+{
+    public static final String NAMESPACE_URI = "http://docs.oasis-open.org/wsrf/sg-2";
+
+    public static final String WSDL_NAMESPACE_URI = "http://docs.oasis-open.org/wsrf/sgw-2";
+    
+    public static final String PREFIX = "wsrf-sg";
+    
+    public static final String WSDL_PREFIX = "wsrf-sgw";
+    
+    public static final String SERVICE_GROUP_URI = WSDL_NAMESPACE_URI + "/ServiceGroup";
+    
+    public static final String SERVICE_GROUP_REG_URI = WSDL_NAMESPACE_URI + "/ServiceGroupRegistration";
+    
+    public static final String ENTRY_URI = WSDL_NAMESPACE_URI + "/ServiceGroupEntry";
+    
+    /**
+     * 
+     * The WS-A Action URI of the Add operation.
+     * 
+     */
+    public static final String ADD_URI = NAMESPACE_URI + "/Add";
+    
+    public static final QName ADD_QNAME = 
+        new QName(NAMESPACE_URI, "Add", PREFIX); 
+    
+    public static final QName ADD_RESPONSE_QNAME = 
+        new QName(NAMESPACE_URI, "AddResponse", PREFIX);
+    
+    public static final QName CONTENT_CREATION_FAILED_QNAME = 
+        new QName(NAMESPACE_URI, "ContentCreationFailedFault", PREFIX);
+    
+    public static final QName UNSUPPORTED_MEMBER_INTERFACE_QNAME = 
+        new QName(NAMESPACE_URI, "UnsupportedMemberInterfaceFault", PREFIX);
+    
+    public static final QName ADD_REFUSED_QNAME = 
+        new QName(NAMESPACE_URI, "AddRefusedFault", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:SimpleMembershipContentRule property.
+     * 
+     */
+    public static final QName CONTENT_RULE_QNAME = 
+        new QName(NAMESPACE_URI, "MembershipContentRule", PREFIX);
+    
+    public static final String MEMBERSHIP_INTERFACE = "MembershipInterface";
+    
+    public static final String CONTENT_ELEMENTS = "ContentElements";
+    
+    public static final QName INIT_TERMINATION_QNAME = 
+        new QName(NAMESPACE_URI, "InitialTerminationTime", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:MemberEPR property.
+     * 
+     */
+    public static final QName MEMBER_EPR_QNAME = 
+        new QName(NAMESPACE_URI, "MemberEPR", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:ServiceGroupEPR property.
+     * 
+     */
+    public static final QName SG_EPR_QNAME = 
+        new QName(NAMESPACE_URI, "ServiceGroupEPR", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:Content property.
+     * 
+     */
+    public static final QName CONTENT_QNAME = 
+        new QName(NAMESPACE_URI, "Content", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:Entry property.
+     * 
+     */
+    public static final QName ENTRY_QNAME = 
+        new QName(NAMESPACE_URI, "Entry", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:CurrentTime return value.
+     * 
+     */
+    public static final QName CURRENT_TIME_QNAME = 
+        new QName(NAMESPACE_URI, "CurrentTime", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:TerminationTime return value.
+     * 
+     */
+    public static final QName TERMINATION_TIME_QNAME = 
+        new QName(NAMESPACE_URI, "TerminationTime", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:ServiceGroupEntryReference return value.
+     * 
+     */
+    public static final QName SG_ENTRY_REFERENCE_QNAME = 
+        new QName(NAMESPACE_URI, "ServiceGroupEntryReference", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:ServiceGroupEntryEPR property.
+     * 
+     */
+    public static final QName SG_ENTRY_EPR_QNAME = 
+        new QName(NAMESPACE_URI, "ServiceGroupEntryEPR", PREFIX);
+    
+    /**
+     * 
+     * The name of the wssg:MemberServiceEPR property.
+     * 
+     */
+    public static final QName MEMBER_SERVICE_EPR_QNAME = 
+        new QName(NAMESPACE_URI, "MemberServiceEPR", PREFIX);
+    
+    /**
+     * 
+     * The name of the WS-SG entry addition event.
+     * 
+     */
+    public static final QName ENTRY_ADDITION_QNAME = 
+        new QName(NAMESPACE_URI, "EntryAdditionNotification", PREFIX);
+    
+    /**
+     * 
+     * The name of the WS-SG entry destruction event.
+     * 
+     */
+    public static final QName ENTRY_REMOVAL_QNAME = 
+        new QName(NAMESPACE_URI, "EntryRemovalNotification", PREFIX);
+    
+    /**
+     * 
+     * The name of the WS-N Topic for WS-SG lifecycle events.
+     * 
+     */
+    public static final String MODIFICATION_TOPIC_NAME = "ServiceGroupModification";
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/AddRefusedFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/AddRefusedFault.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/AddRefusedFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/AddRefusedFault.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,47 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.sg.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.WssgConstants;
+
+public class AddRefusedFault extends BaseFault
+{
+    private static final long serialVersionUID = -5069068147595306686L;
+
+    public AddRefusedFault(Element xml)
+    {
+        super(xml);
+    }
+
+    public AddRefusedFault(String message)
+    {
+        super(WssgConstants.ADD_REFUSED_QNAME, message);
+    }
+
+    public AddRefusedFault(String message, Throwable cause)
+    {
+        super(WssgConstants.ADD_REFUSED_QNAME, message, cause);
+    }
+
+    public AddRefusedFault(Throwable cause)
+    {
+        super(WssgConstants.ADD_REFUSED_QNAME, cause);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/ContentCreationFailedFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/ContentCreationFailedFault.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/ContentCreationFailedFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/ContentCreationFailedFault.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,47 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.sg.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.WssgConstants;
+
+public class ContentCreationFailedFault extends BaseFault
+{
+    private static final long serialVersionUID = 5271763331503613580L;
+
+    public ContentCreationFailedFault(Element xml)
+    {
+        super(xml);
+    }
+
+    public ContentCreationFailedFault(String message)
+    {
+        super(WssgConstants.CONTENT_CREATION_FAILED_QNAME, message);
+    }
+
+    public ContentCreationFailedFault(String message, Throwable cause)
+    {
+        super(WssgConstants.CONTENT_CREATION_FAILED_QNAME, message, cause);
+    }
+
+    public ContentCreationFailedFault(Throwable cause)
+    {
+        super(WssgConstants.CONTENT_CREATION_FAILED_QNAME, cause);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/UnsupportedMemberInterfaceFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/UnsupportedMemberInterfaceFault.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/UnsupportedMemberInterfaceFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-api/org/apache/muse/ws/resource/sg/faults/UnsupportedMemberInterfaceFault.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,47 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.resource.sg.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.sg.WssgConstants;
+
+public class UnsupportedMemberInterfaceFault extends BaseFault
+{
+    private static final long serialVersionUID = -6827344709676009932L;
+
+    public UnsupportedMemberInterfaceFault(Element xml)
+    {
+        super(xml);
+    }
+
+    public UnsupportedMemberInterfaceFault(String message)
+    {
+        super(WssgConstants.UNSUPPORTED_MEMBER_INTERFACE_QNAME, message);
+    }
+
+    public UnsupportedMemberInterfaceFault(String message, Throwable cause)
+    {
+        super(WssgConstants.UNSUPPORTED_MEMBER_INTERFACE_QNAME, message, cause);
+    }
+
+    public UnsupportedMemberInterfaceFault(Throwable cause)
+    {
+        super(WssgConstants.UNSUPPORTED_MEMBER_INTERFACE_QNAME, cause);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-impl/org/apache/muse/ws/resource/impl/AbstractWsResourceCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-impl/org/apache/muse/ws/resource/impl/AbstractWsResourceCapability.java?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-impl/org/apache/muse/ws/resource/impl/AbstractWsResourceCapability.java (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-impl/org/apache/muse/ws/resource/impl/AbstractWsResourceCapability.java Thu Jun 15 15:16:59 2006
@@ -0,0 +1,389 @@
+/*=============================================================================*
+ *  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.impl;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.core.AbstractCapability;
+import org.apache.muse.core.Resource;
+import org.apache.muse.core.serializer.Serializer;
+import org.apache.muse.core.serializer.SerializerRegistry;
+import org.apache.muse.util.ReflectUtils;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.resource.WsResource;
+import org.apache.muse.ws.resource.WsResourceCapability;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+import org.apache.muse.ws.resource.basefaults.WsbfUtils;
+import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
+
+/**
+ * 
+ * AbstractWsResourceCapability is a foundation for user-defined capabilities 
+ * for WSRF-based resources. It builds on the utilities of its 
+ * {@linkplain AbstractCapability parent class} by providing the plumbing 
+ * code needed to map WSRP requests to getter/setter methods in the 
+ * concrete capability class. For example, it provides the logic needed to 
+ * map a WSRP GetResourceProperty request for property myns:Widget to 
+ * the getWidget() method in the concrete class (if getWidget() is not 
+ * defined, a fault is thrown at initialization time).
+ * <br><br>
+ * This class allows users to implement their capabilities' properties 
+ * using simple getter/setter logic (like a traditional Java bean) or 
+ * more complicated APIs, but they do not have to worry about the XML and 
+ * spec restrictions that are needed to implement WSRP operations. The 
+ * combination of the getter/setter methods and the WSRP document schema 
+ * gives this class everything it needs to transform Java beans into the 
+ * foundation for WSRP.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+public abstract class AbstractWsResourceCapability 
+    extends AbstractCapability implements WsResourceCapability
+{
+    private static final QName[] _NO_PROPERTIES = new QName[0];
+
+    private static final Element[] _NO_VALUES = new Element[0];
+    
+    //
+    // the Java getXXX methods for all resource properties
+    //
+    private Map _gettersByQName = new HashMap();
+    
+    //
+    // the Java setXXX methods for all resource properties THAT 
+    // PROVIDE WRITE ACCESS
+    //
+    private Map _settersByQName = new HashMap();
+    
+    protected void createGettersAndSetters(QName propertyName)
+    {
+        Class theClass = getClass();
+        
+        //
+        // get the local name of the property - namespace is not 
+        // referenced in the Java method name
+        //
+        String name = propertyName.getLocalPart();
+        name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
+        
+        String getName = "get" + name;
+        String setName = "set" + name;
+        
+        //
+        // find the getXXX method, which must have zero params and 
+        // a non-void return type
+        //
+        
+        Method getMethod = null;
+        
+        try
+        {
+            getMethod = theClass.getMethod(getName, new Class[0]);
+        }
+        
+        catch (Exception error)
+        {
+            throw new RuntimeException("No getter named " + getName + " with zero parameters.");
+        }
+        
+        //
+        // make sure getter isn't returning void
+        //
+        if (getMethod.getReturnType() == void.class)
+            throw new RuntimeException("Getters cannot have a return type of void.");
+        
+        _gettersByQName.put(propertyName, getMethod);
+        
+        //
+        // find the setXXX method, which must take on param and 
+        // can have any return type (will be ignored by this class)
+        //
+        
+        Method setMethod = ReflectUtils.getFirstMethod(theClass, setName);
+        
+        if (setMethod != null)
+        {
+            Class[] paramTypes = setMethod.getParameterTypes();
+            
+            //
+            // the setXXX method has to have one parameter - for the 
+            // parameter value
+            //
+            if (paramTypes.length != 1)
+                throw new RuntimeException("Setters can only have one parameter");
+            
+            _settersByQName.put(propertyName, setMethod);
+        }
+    }
+    
+    public void deleteProperty(QName propertyQName) 
+        throws BaseFault
+    {
+        Method method = getSetter(propertyQName);
+        invokeMethod(method, new Object[]{ null });
+    }
+    
+    protected Method getGetter(QName propertyQName)
+    {
+        return (Method)_gettersByQName.get(propertyQName);
+    }
+    
+    public Element[] getProperty(QName propertyQName) 
+        throws BaseFault
+    {
+        Method method = getGetter(propertyQName);
+        Object result = invokeMethod(method, null);
+        return getPropertyElements(propertyQName, result);
+    }
+    
+    /**
+     * 
+     * @param name
+     * @param value
+     * 
+     * @return The XML representation of the resource property value(s).
+     *
+     */
+    protected Element[] getPropertyElements(QName name, Object value)
+        throws BaseFault
+    {
+        //
+        // in this case, we have to determine if there IS a property 
+        // and it's null, or there is no property
+        //
+        if (value == null)
+        {
+            ResourcePropertyCollection props = getWsResource().getPropertyCollection();
+            
+            //
+            // property is nillable - we say it exists. not 100% accurate, 
+            // but as close as we're going to get
+            //
+            if (props.getSchema().isNillable(name))
+                return new Element[]{ XmlUtils.createElement(name) };
+            
+            //
+            // not nillable - must not exist
+            //
+            return _NO_VALUES;
+        }
+        
+        //
+        // in all other cases, we determine the type of the property 
+        // values and use that to serialize into XML
+        //
+        Object[] values = null;
+        Class type = null;
+        
+        if (value.getClass().isArray())
+        {
+            values = (Object[])value;
+            type = ReflectUtils.getClassFromArrayClass(value.getClass());
+        }
+        
+        else
+        {
+            values = new Object[]{ value };
+            type = value.getClass();
+        }
+        
+        Element[] properties = new Element[values.length];
+        
+        SerializerRegistry registry = SerializerRegistry.getInstance();
+        Serializer ser = registry.getSerializer(type);
+        
+        for (int n = 0; n < values.length; ++n)
+            properties[n] = serializeValue(ser, values[n], name);
+        
+        return properties;
+    }
+    
+    /**
+     * 
+     * <b>NOTE:</b> All capability authors should remember to override 
+     * this method if their capability defines <b>any</b> resource properties.
+     * 
+     */
+    public QName[] getPropertyNames()
+    {
+        return _NO_PROPERTIES;
+    }
+    
+    protected Method getSetter(QName propertyQName)
+    {
+        return (Method)_settersByQName.get(propertyQName);
+    }
+    
+    public WsResource getWsResource()
+    {
+        return (WsResource)getResource();
+    }
+    
+    /**
+     * 
+     * {@inheritDoc}
+     * <br><br>
+     * AbstractWsResourceCapability continues the initialization process 
+     * by inspecting the concrete class to find all of the getters (and, 
+     * if applicable, setters) for its resource properties. It then 
+     * registers itself with the resource's WSRP collection so that read 
+     * and write requests for its properties are delegated to it.
+     * 
+     */
+    public void initialize() 
+        throws SoapFault
+    {
+        super.initialize();
+        
+        QName[] propertyNames = getPropertyNames();
+        
+        //
+        // make sure we have appropriate getter/setter methods
+        //
+        for (int n = 0; n < propertyNames.length; ++n)
+            createGettersAndSetters(propertyNames[n]);
+        
+        //
+        // tell WSRP container about us - all read/write requests for 
+        // our properties will now be sent to us
+        //
+        ResourcePropertyCollection props = getWsResource().getPropertyCollection();
+        props.addCapability(this);
+    }
+
+    public void insertProperty(QName propertyQName, Element[] values) 
+        throws BaseFault
+    {
+        Element[] current = getProperty(propertyQName);
+        Element[] all = new Element[current.length + values.length];
+        System.arraycopy(current, 0, all, 0, current.length);
+        System.arraycopy(values, 0, all, current.length, values.length);
+        
+        updateProperty(propertyQName, all);
+    }
+
+    protected Object invokeMethod(Method method, Object[] params)
+        throws BaseFault
+    {
+        Object result = null;
+        
+        try
+        {
+            result = method.invoke(this, params);
+        }
+        
+        catch (Throwable error)
+        {
+            Throwable cause = error.getCause();
+            
+            if (cause != null)
+                error = cause;
+            
+            throw WsbfUtils.convertToFault(error);
+        }
+        
+        return result;
+    }
+
+    private Object deserializeValue(Serializer ser, Element value)
+        throws BaseFault
+    {
+        try
+        {
+            return ser.fromXML(value);
+        }
+        
+        catch (SoapFault error)
+        {
+            throw WsbfUtils.convertToFault(error);
+        }
+    }
+
+    private Element serializeValue(Serializer ser, Object value, QName name)
+        throws BaseFault
+    {
+        try
+        {
+            return ser.toXML(value, name);
+        }
+        
+        catch (SoapFault error)
+        {
+            throw WsbfUtils.convertToFault(error);
+        }
+    }
+
+    public void setResource(Resource resource)
+    {
+        Class theClass = resource.getClass();
+        
+        //
+        // sanity check - only ws-resources should use ws-rp
+        //
+        if (!WsResource.class.isAssignableFrom(theClass))
+            throw new RuntimeException(theClass + " is not a WsResource");
+        
+        super.setResource(resource);
+    }
+    
+    public void updateProperty(QName propertyQName, Element[] values) 
+        throws BaseFault
+    {
+        Method method = getSetter(propertyQName);
+        
+        if (method == null) // FIXME: message
+            throw new RuntimeException("No setter for " + propertyQName);
+        
+        Class[] paramTypes = method.getParameterTypes();
+        boolean isArray = paramTypes[0].isArray();
+        
+        Object[] params = new Object[1];
+        
+        //
+        // convert all values into POJOs before calling the setXXX method
+        //
+        SerializerRegistry registry = SerializerRegistry.getInstance();
+        
+        if (isArray)
+        {
+            Class theClass = ReflectUtils.getClassFromArrayClass(paramTypes[0]);
+            Serializer ser = registry.getSerializer(theClass);
+            
+            params[0] = Array.newInstance(theClass, values.length);
+            
+            for (int n = 0; n < values.length; ++n)
+                Array.set(params[0], n, deserializeValue(ser, values[n]));
+        }
+        
+        else
+        {
+            Serializer ser = registry.getSerializer(paramTypes[0]);
+            params[0] = deserializeValue(ser, values[0]);
+        }
+        
+        invokeMethod(method, params);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsrf/src-impl/org/apache/muse/ws/resource/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf/src-impl/org/apache/muse/ws/resource/impl/Messages.properties?rev=414694&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf/src-impl/org/apache/muse/ws/resource/impl/Messages.properties (added)
+++ webservices/muse/trunk/modules/muse-wsrf/src-impl/org/apache/muse/ws/resource/impl/Messages.properties Thu Jun 15 15:16:59 2006
@@ -0,0 +1,36 @@
+NullResource = The owner resource is null.
+NullEnvironment = The Environment is null. The resource's Environment reference is needed in order to get information about the underlying system in a platform-independent way.
+NoEnvironment = The resource's environment must be set with setEnvironment() before it can be initialized (via initialize()). Make sure that a concrete Environment reference is provided right after the resource is instantiated.
+NullLogger = The Logger is null. A resource must have a log, even if it is printing to the console.
+NoLogger = The resource's log must be set with setLog() before it can be initialized (via initialize()). Make sure that a java.util.Logger reference is provided right after the resource is instantiated.
+NullSoapClient = The SoapClient is null. The touchpoint must have a valid way to make SOAP requests.
+NullResourceManager = The ResourceManager is null.
+NullFactoryCollection = The Collection of ResourceDefinition references is null. A touchpoint must have at least one resource type (factory) to instantiate.
+EmptyFactoryCollection = The Collection of ResourceDefinition references is empty. A touchpoint must have at least one resource type (factory) to instantiate.
+NoConstructionName = The ResourceType capability cannot be initialized until the resource's "construction name" is set with setConstructionName(). This name is the value defined in muse.xml under /touchpoint/resource/instance/name, and it will be used to set the actp:Name property. Make sure your instantiation code includes a call to setConstructionName().
+ConstructionNameExists = The resource's construction name has already been set with setConstructionName().
+NullConstructionName = The construction name is null.
+NullEndpointURL = The endpoint URL string is null. What is the resource type's unique endpoint value?
+NullOperationsMap = The OperationsMap collection is null.
+NoOperationsMap = The resource's operations (OperationsMap) must be set with setOperations() before you can try to lookup or invoke a resource's exposed operations. This collection allows the resource class to determine which of its methods should be exposed to the outside world.
+NullOperationName = The Operation name being searched for is null.
+NoPropertiesDefinition = The WS-RP definition identified in the WSDL portType's wsrp:ResourceProperties attribute could not be found. Check the name/namespace and sure the they map to one of the type definitions in the WSDL.
+MethodNotFound = There is no method 'XXX' in XXX or any of its sub-components (capabilities, delegates, beans, etc.). Make sure the method name is typed correctly in muse.xml, and that the resource class specified is correct.
+EndpointNotFound = No resource definition was found for endpoint 'XXX'. The valid endpoints for this touchpoint (as described in muse.xml) are: XXX
+NoInvoker = The resource's Invoker has not been constructed.
+NullClassLoader = The ClassLoader is null. If you don't want to specify your own ClassLoader, use the default constructor, it will use the class' ClassLoader.
+EndpointExists = There is already a resource type bound to the endpoint 'XXX'. You must provide a unique endpoint identifier for each resource type.
+NoDataResource = The resource 'XXX' does not exist or is not in the classpath.
+CreateDocFailed = The XML document 'XXX' could not be loaded. The original error was: XXX
+NoMetadataFound = The resource's WSDL portType definition does not have a wsrmd:metadataDescriptorLocation attribute, so no RMD file is associated with the resource type. The resource will not apply any restrictions on the WS-RP document other than what is defined in the schema.
+ResourceInitialized = The resource instance was successfully initialized.
+ResourceAlreadyDestroyed = The resource has already been destroyed. Make sure other resources do not hold stale references to it.
+NoFactory = A resource must have its ResourceDefinition set with setResourceDefinition() before it can be initialized.
+NullFactory = The ResourceDefinition is null.
+ActionNotSupported = The resource type at 'XXX' does not define an operation for the wsa:Action 'XXX'. Make sure the operation is described in muse.xml before the touchpoint is deployed.
+NullLogFileName = The log file name is null.
+NullClass = The Class is null.
+ResourceDestroyed = The resource was destroyed successfully.
+ExistingResourceEPR = The unique EPR of this resource instance (object) has already been set - once a resource has an identifying EPR, it cannot be changed over its lifetime.
+NoRemoteCreate = The resource type at this endpoint cannot be instantiated by remote clients - all instances are (or have been) created through internal mechanisms. If this type is deployed with a service group, you can browse the group's wssg:Entry property to see what instances are already available.
+NoRequestContext = There was no context data for the current request. Every request for a touchpoint operation should have access to context data that allows the runtime to find the target EPR (resource). Make sure your service code uses Environment.addContext().



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