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:20:09 UTC

svn commit: r414696 [2/7] - in /webservices/muse/trunk/modules: muse-wsdm-muws-adv/ muse-wsdm-muws-adv/src-api/ muse-wsdm-muws-adv/src-api/org/ muse-wsdm-muws-adv/src-api/org/apache/ muse-wsdm-muws-adv/src-api/org/apache/muse/ muse-wsdm-muws-adv/src-ap...

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/Participant.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/Participant.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/Participant.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/Participant.java Thu Jun 15 15:19:57 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.dm.muws;
+
+import java.net.URI;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.addressing.EndpointReference;
+
+public interface Participant extends XmlSerializable
+{
+    /**
+     * 
+     * @return The participant's EPR.
+     *
+     */
+    EndpointReference getManageabilityReference();
+
+    /**
+     * 
+     * @return The participant's MUWS ResourceId.
+     * 
+     * @see org.apache.muse.ws.dm.muws.Identity#getResourceId()
+     *
+     */
+    URI getResourceId();
+
+    /**
+     * 
+     * @return The URI identifying the role of the participant in its 
+     *         relationship.
+     *
+     */
+    URI getRole();
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/RelationshipResource.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/RelationshipResource.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/RelationshipResource.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/RelationshipResource.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,97 @@
+/*=============================================================================*
+ *  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.dm.muws;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+/**
+ *
+ * RelationshipResource is the interface that describes WSDM relationships as 
+ * WS-RF implied resources. It is used by {@linkplain RelationshipResource RelationshipResource} 
+ * to define the complete relationship resource type. Read the introduction to 
+ * the {@linkplain RelationshipResource RelationshipResource} class for more information about 
+ * how Muse exposes relationship resources.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface RelationshipResource 
+    extends ManageabilityCapability, XmlSerializable
+{
+    QName[] PROPERTIES = new QName[]{
+        MuwsConstants.NAME_QNAME, 
+        MuwsConstants.TYPE_QNAME, 
+        MuwsConstants.PARTICIPANT_QNAME 
+    };
+    
+    /**
+     * 
+     * @return A descriptive name for this relationship.
+     *
+     */
+    String getName()
+        throws BaseFault;
+
+    /**
+     * 
+     * @return The type of this relationship, as defined by an XSD.
+     *
+     */
+    RelationshipType getType()
+        throws BaseFault;
+
+    /**
+     * 
+     * @return The participants in this relationship. The array will have 
+     *         a length of at least 2.
+     *
+     */
+    Participant[] getParticipant()
+        throws BaseFault;
+
+    /**
+     * 
+     * @param name
+     *        A descriptive name for this relationship.
+     *
+     */
+    void setName(String name)
+        throws BaseFault;
+
+    /**
+     * 
+     * @param type
+     *        The type of this relationship, as defined by an XSD.
+     *
+     */
+    void setType(RelationshipType type)
+        throws BaseFault;
+
+    /**
+     * 
+     * @param participants
+     *        The participants in this relationship. The array must have 
+     *         a length of at least 2.
+     *
+     */
+    void setParticipant(Participant[] participants)
+        throws BaseFault;
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/RelationshipType.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/RelationshipType.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/RelationshipType.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/RelationshipType.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,26 @@
+/*=============================================================================*
+ *  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.dm.muws;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+public interface RelationshipType extends XmlSerializable
+{
+    QName[] getValues();
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/Relationships.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/Relationships.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/Relationships.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/Relationships.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,116 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.resource.WsResource;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+/**
+ * 
+ * Relationships is an internal representation of the WSDM Relationships 
+ * capability. It provides access to the one property (RelationshipResource) along 
+ * with methods for creating, destroying, and querying relationships. The 
+ * QueryRelationshipsByType operation is exposed here; the other methods 
+ * are for internal relationship management and should not be made public.
+ * 
+ * @author Dan Jemiolo (danj)
+ * 
+ */
+
+public interface Relationships extends ManageabilityCapability 
+{
+    QName[] PROPERTIES = new QName[]{
+        MuwsConstants.RELATIONSHIP_QNAME
+    };
+    
+    /**
+     * 
+     * Creates a new RelationshipResource resource with the given values, adds it 
+     * to the touchpoint's ResourceManager and the owner resource's WS-RP 
+     * container, and returns it to the caller.
+     * 
+     * @param name
+     *        The descriptive name of the new relationship.
+     * 
+     * @param type
+     *        The XSD-defined type of the new relationship.
+     * 
+     * @param participants
+     *        The participant resources for the relationship. The array 
+     *        must have a length of at least 2.
+     * 
+     * @return The newly-created (and stored) RelationshipResource.
+     * 
+     * @throws BaseFault
+     *         <ul>
+     *         <li>If there was an error during the initialization of the 
+     *         RelationshipResource resource instance.</li>
+     *         <li>If there was an error inserting into the participant's 
+     *         WS-RP container.</li>
+     *         </ul>
+     *
+     */
+    WsResource addRelationship(String name, RelationshipType type, Participant[] participants)
+        throws BaseFault;
+    
+    WsResource[] getRelationship()
+        throws BaseFault;
+
+    /**
+     * 
+     * This method is defined by MUWS Part 2 in order to optimize the 
+     * query of a resource property that will often have a large number 
+     * of instances, making XPath-like queries and catch-all Get requests 
+     * a performance bottleneck. The functional equivalent of this call 
+     * would be WS-RP QueryResourceProperties with an XPath query that 
+     * tries to match the value of the muws-p2:Type.
+     * 
+     * @param types
+     *        The names of the types of relationships that should be 
+     *        returned by the query processor.
+     * 
+     * @return An array of proxies that can be used to manipulate the 
+     *         relationship resources that match the query. The array 
+     *         may be empty.
+     * 
+     * @throws BaseFault
+     *         <ul>
+     *         <li>If the relationship lookup fails because of WS-RP error.</li>
+     *         </ul>
+     *
+     */
+    WsResource[] queryRelationshipsByType(QName[] types)
+        throws BaseFault;
+    
+    /**
+     * 
+     * Deletes the RelationshipResource from the owner's WS-RP container.
+     *
+     * @param relationship
+     * 
+     * @throws BaseFault
+     *         <ul>
+     *         <li>If the relationship has already been removed or the 
+     *         owner is otherwise not a participant to the relationship.</li>
+     *         </ul>
+     *
+     */
+    void removeRelationship(WsResource relationship)
+        throws BaseFault;
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/State.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/State.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/State.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/State.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,92 @@
+/*=============================================================================*
+ *  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.dm.muws;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+/**
+ *
+ * This is an internal representation of the State capability. It defines 
+ * two properties, both of which are recommended by MUWS: State and 
+ * SimpleStateTransition. These are the resource's current state and the record 
+ * of its last state change, respectively. The values of the state types is 
+ * an implementation detail (unlike 
+ * {@linkplain OperationalStatus OperationalStatus}, which provides an 
+ * enumeration of status values).
+ * 
+ * @author Dan Jemiolo (danj)
+ * 
+ */
+
+public interface State extends ManageabilityCapability
+{
+    QName[] PROPERTIES = new QName[]{
+        MuwsConstants.STATE_QNAME, 
+        MuwsConstants.TRANSITION_QNAME 
+    };
+    
+    /**
+     * 
+     * @return The current state of the owning resource; state types may 
+     *         have subtypes, and these values should be considered when 
+     *         evaluating the state.
+     *
+     * @throws BaseFault
+     *         <ul>
+     *         <li>If there is a WS-RP-based error.</li>
+     *         </ul>
+     * 
+     */
+    StateType getState()
+        throws BaseFault;
+    
+    /**
+     * 
+     * @return The record of the last state change experienced by the 
+     *         owning resource.
+     *
+     * @throws BaseFault
+     *         <ul>
+     *         <li>If there is a WS-RP-based error.</li>
+     *         </ul>
+     * 
+     */
+    StateTransition getStateTransition()
+        throws BaseFault;
+    
+    /**
+     * 
+     * @param state
+     *        The current state of the owning resource; this state may have 
+     *        subtypes. Changing the State will alter the SimpleStateTransition 
+     *        property as well.
+     * 
+     * @throws BaseFault
+     *         <ul>
+     *         <li>If the state type is not a valid value (as specified in 
+     *         the resource's RMD).</li>
+     *         <li>If the state-to-state transition is not allowed.</li>
+     *         <li>If the State or SimpleStateTransition properties could not 
+     *         be modified.</li>
+     *         </ul>
+     *
+     */
+    void setState(StateType state)
+        throws BaseFault;
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/StateTransition.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/StateTransition.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/StateTransition.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/StateTransition.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,46 @@
+/*=============================================================================*
+ *  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.dm.muws;
+
+import java.util.Date;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+public interface StateTransition extends XmlSerializable
+{
+    /**
+     * 
+     * @return The state the resource entered during the transition.
+     *
+     */
+    StateType getEnteredState();
+
+    /**
+     * 
+     * @return The state the resource left during the transition. This is 
+     *         null if there was no previous state.
+     *
+     */
+    StateType getPreviousState();
+
+    /**
+     * 
+     * @return The time that the transition occurred.
+     *
+     */
+    Date getTransitionTime();
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/StateType.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/StateType.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/StateType.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/StateType.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,26 @@
+/*=============================================================================*
+ *  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.dm.muws;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.xml.XmlSerializable;
+
+public interface StateType extends XmlSerializable
+{
+    QName[] getValues();
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/ext/MuwsExtConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/ext/MuwsExtConstants.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/ext/MuwsExtConstants.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/ext/MuwsExtConstants.java Thu Jun 15 15:19:57 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.dm.muws.ext;
+
+import javax.xml.namespace.QName;
+
+public class MuwsExtConstants
+{
+    public static final String NAMESPACE_URI = "http://ws.apache.org/muse/wsdm/muws";
+    
+    public static final String PREFIX = "muse-muws";
+    
+    public static final QName RELATIONSHIP_CREATION_FAILED_QNAME = 
+        new QName(NAMESPACE_URI, "RelationshipCreationFailedFault", PREFIX);
+    
+    public static final QName MATCHES_QNAME = 
+        new QName(NAMESPACE_URI, "Matches", PREFIX);
+    
+    public static final QName MATCHES_RESPONSE_QNAME = 
+        new QName(NAMESPACE_URI, "MatchesResponse", PREFIX);
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/ext/faults/RelationshipCreationFailedFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/ext/faults/RelationshipCreationFailedFault.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/ext/faults/RelationshipCreationFailedFault.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-api/org/apache/muse/ws/dm/muws/ext/faults/RelationshipCreationFailedFault.java Thu Jun 15 15:19:57 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.dm.muws.ext.faults;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.dm.muws.ext.MuwsExtConstants;
+import org.apache.muse.ws.resource.basefaults.BaseFault;
+
+public class RelationshipCreationFailedFault extends BaseFault
+{
+    private static final long serialVersionUID = 1789154473637685082L;
+
+    public RelationshipCreationFailedFault(Element xml)
+    {
+        super(xml);
+    }
+
+    public RelationshipCreationFailedFault(String message)
+    {
+        super(MuwsExtConstants.RELATIONSHIP_CREATION_FAILED_QNAME, message);
+    }
+
+    public RelationshipCreationFailedFault(String message, Throwable cause)
+    {
+        super(MuwsExtConstants.RELATIONSHIP_CREATION_FAILED_QNAME, message, cause);
+    }
+
+    public RelationshipCreationFailedFault(Throwable cause)
+    {
+        super(MuwsExtConstants.RELATIONSHIP_CREATION_FAILED_QNAME, cause);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AbstractManageabilityCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AbstractManageabilityCapability.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AbstractManageabilityCapability.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AbstractManageabilityCapability.java Thu Jun 15 15:19:57 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.dm.muws.impl;
+
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.dm.muws.ManageabilityCapability;
+import org.apache.muse.ws.dm.muws.ManageabilityCharacteristics;
+import org.apache.muse.ws.dm.muws.MuwsConstants;
+import org.apache.muse.ws.resource.WsResource;
+import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
+
+public abstract class AbstractManageabilityCapability 
+    extends AbstractWsResourceCapability implements ManageabilityCapability
+{    
+    public void initializeCompleted() 
+        throws SoapFault
+    {
+        super.initializeCompleted();
+        
+        //
+        // add the capability URI to the ManageabilityCharacteristics list
+        //
+        WsResource resource = getWsResource();
+        ManageabilityCharacteristics mc = 
+            (ManageabilityCharacteristics)resource.getCapability(MuwsConstants.CHARACTERISTICS_URI);
+        
+        if (mc != null)
+            mc.addManageabilityCapability(getCapabilityURI());
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AllMatch.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AllMatch.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AllMatch.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AllMatch.java Thu Jun 15 15:19:57 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.dm.muws.impl;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.dm.muws.Match;
+import org.apache.muse.ws.dm.muws.MuwsConstants;
+import org.apache.muse.ws.resource.WsResource;
+
+/**
+ *
+ * AllMatch is a {@linkplain ComplexMatch ComplexMatch} that acts as a 
+ * conditional AND (&&) on all subexpressions.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class AllMatch extends ComplexMatch
+{
+    public AllMatch(WsResource owner, Element xml)
+    {
+        super(owner, xml);
+    }
+    
+    public AllMatch(WsResource owner)
+    {
+        super(owner);
+    }
+
+    protected QName getRootQName()
+    {
+        return MuwsConstants.MATCH_ALL_QNAME;
+    }
+    
+    /**
+     *
+     * @return True if all subexpressions defined by the Match evaluate to 
+     *         'true'. This is the same as combining them in a logical AND.
+     *
+     */
+    public boolean matches(EndpointReference epr)
+        throws SoapFault
+    {
+        Iterator i = getMatches().iterator();
+        
+        while (i.hasNext())
+        {
+            Match next = (Match)i.next();
+            
+            if (!next.matches(epr))
+                return false;
+        }
+        
+        return true;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AnyMatch.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AnyMatch.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AnyMatch.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/AnyMatch.java Thu Jun 15 15:19:57 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.dm.muws.impl;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.dm.muws.Match;
+import org.apache.muse.ws.dm.muws.MuwsConstants;
+import org.apache.muse.ws.resource.WsResource;
+
+/**
+ *
+ * AnyMatch is a {@linkplain ComplexMatch ComplexMatch} that acts as a 
+ * conditional OR (||) on all subexpressions.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class AnyMatch extends ComplexMatch
+{
+    public AnyMatch(WsResource resource, Element xml)
+    {
+        super(resource, xml);
+    }
+    
+    public AnyMatch(WsResource resource)
+    {
+        super(resource);
+    }
+    
+    protected QName getRootQName()
+    {
+        return MuwsConstants.MATCH_ANY_QNAME;
+    }
+    
+    /**
+     *
+     * @return True if any of the subexpressions defined by the Match evaluate 
+     *         to 'true'. This is the same as combining them in a logical OR.
+     *
+     */
+    public boolean matches(EndpointReference epr)
+        throws SoapFault
+    {
+        Iterator i = getMatches().iterator();
+        
+        while (i.hasNext())
+        {
+            Match next = (Match)i.next();
+            
+            if (next.matches(epr))
+                return true;
+        }
+        
+        return false;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/ComplexMatch.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/ComplexMatch.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/ComplexMatch.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/ComplexMatch.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,170 @@
+/*=============================================================================*
+ *  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.dm.muws.impl;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.dm.muws.Match;
+import org.apache.muse.ws.resource.WsResource;
+
+/**
+ *
+ * ComplexMatch is an abstract class for any pbm:Match that supports 
+ * subexpressions (sub-Matches). It provides all of the collection operations 
+ * needed to store and evaluate the subexpressions but provides no default 
+ * implementation for matches(Resource). Concrete subclasses must define how 
+ * the Match's subexpressions are combined to evaluate another resource. 
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public abstract class ComplexMatch implements Match
+{
+    //
+    // Used to lookup all exception messages
+    //
+    private static Messages _MESSAGES = MessagesFactory.get(ComplexMatch.class);
+    //
+    // All sub-matches (children) of this match
+    //
+    private List _matches = new LinkedList();
+    
+    //
+    // The local resource that is defining this correlation
+    //
+    private WsResource _resource = null;
+
+    /**
+     * 
+     * @param resource
+     *        The resource that is defining the CorrelatableProperties 
+     *        capability and thus, this correlation expression.
+     * 
+     * @param xml
+     *        The DOM Element representing the simple pbm:Match.
+     *
+     */
+    public ComplexMatch(WsResource resource, Element xml)
+    {
+        if (resource == null)
+            throw new NullPointerException(_MESSAGES.get("NullOwner"));
+
+        if (xml == null)
+            throw new NullPointerException(_MESSAGES.get("NullMatchElement"));
+        
+        _resource = resource;
+        
+        //
+        // parse all sub-elements as sub-Matches
+        //
+        Element[] children = XmlUtils.getAllElements(xml);
+        
+        if (children.length == 0)
+            throw new RuntimeException(_MESSAGES.get("NoChildrenFound"));
+        
+        MatchFactory factory = MatchFactory.getInstance();
+        
+        for (int n = 0; n < children.length; ++n)
+        {
+            Match next = factory.createMatch(_resource, children[n]);
+            _matches.add(next);
+        }
+    }
+    
+    /**
+     * 
+     * @param resource
+     *        The resource that is defining the CorrelatableProperties 
+     *        capability and thus, this correlation expression.
+     *
+     */
+    public ComplexMatch(WsResource resource)
+    {
+        if (resource == null)
+            throw new NullPointerException(_MESSAGES.get("NullOwner"));
+        
+        _resource = resource;
+    }
+    
+    public void addMatch(Match child)
+    {
+        if (child == null)
+            throw new NullPointerException(_MESSAGES.get("NullMatch"));
+        
+        _matches.add(child);
+    }
+    
+    public List getMatches()
+    {
+        return Collections.unmodifiableList(_matches);
+    }
+    
+    public WsResource getWsResource()
+    {
+        return _resource;
+    }
+    
+    protected abstract QName getRootQName();
+    
+    public void removeMatch(Match child)
+    {
+        if (child == null)
+            throw new NullPointerException(_MESSAGES.get("NullMatch"));
+        
+        _matches.remove(child);
+    }
+    
+    public Element toXML()
+    {
+        return toXML(XmlUtils.EMPTY_DOC);
+    }
+    
+    public Element toXML(Document doc)
+    {
+        if (doc == null)
+            throw new NullPointerException(_MESSAGES.get("NullDocument"));
+        
+        Element root = XmlUtils.createElement(doc, getRootQName());
+        
+        List matches = getMatches();
+        
+        if (matches.isEmpty())
+            throw new RuntimeException(_MESSAGES.get("NoChildrenFound"));
+        
+        Iterator i = matches.iterator();
+        
+        while (i.hasNext())
+        {
+            Match next = (Match)i.next();
+            root.appendChild(next.toXML(doc));
+        }
+        
+        return root;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MatchCorrelation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MatchCorrelation.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MatchCorrelation.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MatchCorrelation.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,202 @@
+/*=============================================================================*
+ *  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.dm.muws.impl;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.dm.muws.Correlation;
+import org.apache.muse.ws.dm.muws.Match;
+import org.apache.muse.ws.dm.muws.MuwsConstants;
+import org.apache.muse.ws.resource.WsResource;
+
+/**
+ *
+ * MatchCorrelation represents correlation expressions formatted with the 
+ * MUWS Simple Property Boolean Match (PBM) schema. PBM allows the user to 
+ * declare fairly complex conditionals for evaluating two resources for 
+ * equality. Each MatchCorrelation will contain one or more instances of 
+ * {@linkplain Match Match}.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class MatchCorrelation implements Correlation, Match
+{
+    //
+    // Used to lookup all exception messages
+    //
+    private static Messages _MESSAGES = 
+        MessagesFactory.get(MatchCorrelation.class);
+    
+    private boolean _hasNegativeAssertion = false;
+    
+    //
+    // A complete Correlation based on PBM is really like a pbm:MatchAll, so 
+    // we use that as the container for all the Correlation's Matches. The 
+    // only tweak is that we cannot show the pbm:MatchAll root element when 
+    // we serialize the Correlation (a CorrelatableProperties instance can 
+    // have multiple Matches under its root element).
+    //
+    private AllMatch _root = null;
+    
+    /**
+     * 
+     * @param resource
+     *        The resource that is defining the CorrelatableProperties 
+     *        capability and, thus, this correlation.
+     * 
+     * @param xml
+     *        The DOM Element representing an instance of CorrelatableProperties 
+     *        that uses the PBM dialect (is defined by Matches).
+     *
+     */
+    public MatchCorrelation(WsResource resource, Element xml)
+    {
+        if (resource == null)
+            throw new NullPointerException(_MESSAGES.get("NullOwner"));
+        
+        if (xml == null)
+            throw new NullPointerException(_MESSAGES.get("NullCPElement"));
+        
+        _root = new AllMatch(resource, xml);
+
+        //
+        // get the (optional) NegativeAssertionPossible value
+        //
+        String negative = xml.getAttribute(MuwsConstants.NEGATIVE);
+        
+        if (negative != null && negative.length() > 0)
+            _hasNegativeAssertion = Boolean.valueOf(negative).booleanValue();
+    }
+    
+    /**
+     * 
+     * This is a convenience constructor that calls this(Resource, boolean) 
+     * with a 'false' second parameter.
+     * 
+     * @see #MatchCorrelation(WsResource, boolean)
+     *
+     */
+    public MatchCorrelation(WsResource resource)
+    {
+        this(resource, false);
+    }
+    
+    /**
+     * 
+     * @param resource
+     *        The resource that is defining the CorrelatableProperties 
+     *        capability and, thus, this correlation.
+     * 
+     * @param negativeAssertion
+     *        True if this correlation guarantees that a false match equates 
+     *        to two resources being different.
+     *
+     */
+    public MatchCorrelation(WsResource resource, boolean negativeAssertion)
+    {
+        if (resource == null)
+            throw new NullPointerException(_MESSAGES.get("NullOwner"));
+                
+        _root = new AllMatch(resource);
+        _hasNegativeAssertion = negativeAssertion;
+    }
+    
+    public String getDialect()
+    {
+        return MuwsConstants.PBM_URI;
+    }
+    
+    public WsResource getWsResource()
+    {
+        return _root.getWsResource();
+    }
+
+    public boolean hasNegativeAssertion()
+    {
+        return _hasNegativeAssertion;
+    }
+
+    public boolean matches(EndpointReference epr)
+        throws SoapFault
+    {
+        if (epr == null)
+            throw new NullPointerException(_MESSAGES.get("NullRemoteResource"));
+        
+        return _root.matches(epr);
+    }
+
+    public void addMatch(Match child)
+    {
+        if (child == null)
+            throw new NullPointerException(_MESSAGES.get("NullMatch"));
+        
+        _root.addMatch(child);
+    }
+
+    public List getMatches()
+    {
+        return _root.getMatches();
+    }
+
+    public void removeMatch(Match child)
+    {
+        if (child == null)
+            throw new NullPointerException(_MESSAGES.get("NullMatch"));
+        
+        _root.removeMatch(child);
+    }
+
+    public Element toXML()
+    {
+        return toXML(XmlUtils.EMPTY_DOC);
+    }
+
+    public Element toXML(Document doc)
+    {
+        if (doc == null)
+            throw new NullPointerException(_MESSAGES.get("NullDocument"));
+        
+        QName qname = MuwsConstants.CORRELATABLE_QNAME;
+        Element rootXML = XmlUtils.createElement(doc, qname);
+        
+        rootXML.setAttribute(MuwsConstants.DIALECT, getDialect());
+        
+        String negative = Boolean.toString(hasNegativeAssertion());
+        rootXML.setAttribute(MuwsConstants.NEGATIVE, negative);
+        
+        Element matchXML = _root.toXML(doc);
+        
+        //
+        // CorrelatableProperties doesn't have one "root" Match, so we 
+        // have to remove the pbm:MatchAll element that is containing 
+        // all of our Matches
+        //
+        return (Element)XmlUtils.moveSubTree(matchXML, rootXML);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MatchFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MatchFactory.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MatchFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MatchFactory.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,112 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.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.dm.muws.Match;
+import org.apache.muse.ws.dm.muws.MuwsConstants;
+import org.apache.muse.ws.resource.WsResource;
+
+/**
+ *
+ * MatchFactory is a device for creating pbm:Match expressions from their 
+ * XML definitions without having to deal with concrete pbm:Match types.
+ * Because this factory has no state and the PBM types are finite, the 
+ * class is exposed as a singleton.
+ * 
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class MatchFactory
+{
+    //
+    // Used to lookup all exception messages
+    //
+    private static Messages _MESSAGES = 
+        MessagesFactory.get(MatchFactory.class);
+    
+    private static final MatchFactory _SINGLETON = new MatchFactory();
+    
+    /**
+     * 
+     * The default constructor is made private to prevent instantiation. All 
+     * users should use the singleton instance.
+     *
+     */
+    private MatchFactory()
+    {
+        //
+        // this only exists so we can make it private
+        //
+    }
+    
+    /**
+     * 
+     * @param resource
+     *        The resource that is defining the CorrelatableProperties 
+     *        capability and thus, this correlation expression.
+     * 
+     * @param xml
+     *        The DOM Element representing the simple pbm:Match.
+     * 
+     * @return A Match, which may have one or more sub-Matches inside it.
+     *
+     */
+    public Match createMatch(WsResource resource, Element xml)
+    {
+        if (resource == null)
+            throw new NullPointerException(_MESSAGES.get("NullOwner"));
+        
+        if (xml == null)
+            throw new NullPointerException(_MESSAGES.get("NullCPElement"));
+        
+        QName qname = XmlUtils.getElementQName(xml);
+        
+        //
+        // no table - there are only three PBM types allowed
+        //
+        
+        if (qname.equals(MuwsConstants.MATCH_QNAME))
+            return new SimpleMatch(resource, xml);
+        
+        else if (qname.equals(MuwsConstants.MATCH_ALL_QNAME))
+            return new AllMatch(resource, xml);
+        
+        else if (qname.equals(MuwsConstants.MATCH_ANY_QNAME))
+            return new AnyMatch(resource, xml);
+        
+        String message = _MESSAGES.get("InvalidMatch", new Object[]{ qname });
+        throw new IllegalArgumentException(message);
+    }
+    
+    /**
+     * 
+     * @return The singleton instance of this class.
+     *
+     */
+    public static MatchFactory getInstance()
+    {
+        return _SINGLETON;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/Messages.properties?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/Messages.properties (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/Messages.properties Thu Jun 15 15:19:57 2006
@@ -0,0 +1,55 @@
+NullDocument = The DOM Document is null.
+NullQNameArray = The array of QNames is null.
+NullRelationshipArray = The array of Relationships is null.
+NoRequestedTypes = The message did not contain any muws-p2:RequestedType elements - there must be at least one muws-p2:RequestedType in each call to muws-p2:QueryRelationshipsByType
+NullStateName = The StateType name is null.
+NullCorrelation = The Correlation is null.
+NullRemoteResource = The remote Resource is null - which resource are we comparing against?
+NullMatch = The Match reference is null.
+NullDocument = The DOM Document is null.
+NullCPElement = The DOM Element representing the CorrelatableProperties is null.
+InvalidDialect = The CorrelatableProperties dialect specified is not supported by this implementation: XXX
+NoChildMatches = This is a simple Match, meaning you cannot add sub-Matches to it. Only MatchAny and MatchAll can have sub-Matches.
+NoChildrenFound = This Match has no child elements. Complex Matches (MatchAny or MatchAll) must have at least one child Match element.
+NullOwner = The owner Resource is null. Which resource is defining the correlation expression?
+NullQName = The property QName is null.
+NullMatchElement = The DOM Element representing the pbm:Match is null.
+NullState = The StateType is null.
+NullSTElement = The DOM Element representing the StateTransition is null.
+NoTransitionTime = The StateTransition XML does not include a Time attribute. All transitions must have a valid time.
+NoEnteredState = The StateTransition XML does not include an EnteredState state value. All transitions must have a valid EnteredState.
+NullXPath = The XPath expression string is null.
+InvalidMatch = The Element provided did not describe a valid pbm:Match type: XXX
+InvalidState = The state value 'XXX' is not a valid muws-p2:State for this resource type. The valid muws-p2:State values are: XXX
+NoCapabilityURI = Resource types do not have a single capability URI - this method can only be called on concrete capability classes, not resources that use them.
+NullRelationshipTypeName = The name of the relationship type is null.
+NullMetricName = The Metric name is null.
+NullProperties = The WS-RP collection that the Metric belongs to is null.
+NotReadOnly = The property 'XXX' has incorrect metadata for a metric. Properties that are metrics must have a mutability value of 'mutable' and a modifiability value of 'read-only'.
+InvalidIntervalDef = The property 'XXX' has a muws-p2:TimeScope of 'Interval', but it does not define a muws-p2:CalculationInterval value in its metadata. Interval metrics must define an interval!
+InvalidChangeType = The muws-p2:ChangeType value 'XXX' is invalid - it must be 'Counter', 'Gauge', or 'Unknown'.
+InvalidGatheringTime = The muws-p2:GatheringTime value 'XXX' is invalid - it must be 'OnChange', 'OnDemand', 'Periodic', or 'Unknown'.
+InvalidTimeScope = The muws-p2:TimeScope value 'XXX' is invalid - it must be 'Interval', 'PointInTime', or 'SinceReset'.
+ResetNotAllowed = The metric 'XXX' is a PointInTime metric, so it cannot be reset.
+NoParticipantEPR = The Participant XML does not have a muws-p1:ManageabilityEndpointReference element. All participants must have an EPR.
+NoParticipantID = The Participant XML does not have a muws-p1:ResourceId. All participants must have a ResourceId.
+NoParticpantRole = The Participant XML does not have a muws-p2:Role. All participants must have a role.
+NullParticipantElement = The DOM Element representing the Participant is null.
+InvalidParticipantURI = The Participant value 'XXX' is not a valid URI; the original error was; XXX
+NullParticipantEPR = The Participant's EPR is null.
+NullParticipantID = The Participant's ResourceId is null.
+NullParticipantRole = The Participant's Role is null.
+NullParticipantResource = The Participant Resource is null.
+NoRemoteResourceID = The remote participant resource does not have an instance of the muws-p1:ResourceId property. All participants must have a ResourceId.
+ResourceIDFailed = The remote request to retrieve the participant's muws-p1:ResourceId failed; the most likely cause is that the resource does not define this property at all. The original error was: XXX
+NoRelationshipTypeElement = The Relationship XML does not have a muws-p2:RelationshipType element. All relationships must have a relationship type.
+NullParticipants = The Participant array is null.
+NullRelationshipType = The RelationshipType is null.
+NoRelationshipType = There is no RelationshipType defined - you must set the type with the setType() method before initializing the relationship resource.
+NoParticipants = There is no Participant array defined - you must set the participants with the setParticipants() method before initializing the relationship resource.
+NullRelationship = The Relationship is null.
+NullQueryTypes = The array of relationship types to query is null.
+EmptyQueryTypes = The array of relationship types to query is empty.
+NoRelationshipEndpoint = There is no resource that implements the MUWS Relationship portType defined in touchpoint.xml. In order to use and manage relationships, a touchpoint must expose a resource of type com.ibm.ws.dm.muws.Relationship (or a sub-type); this resource will represent all new relationships created between the resource and other participants.
+FoundRelationshipEndpoint = Successfully found the Relationship endpoint at 'XXX' with resource name 'XXX'. All Relationship resources will be managed by this endpoint.
+DuplicateCapability = The resource at XXX is trying to re-define the capability 'XXX'. The ManageabilityCharacteristics capability has already defined the following capability URIs: XXX

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricDecorationProvider.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricDecorationProvider.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricDecorationProvider.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricDecorationProvider.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,91 @@
+/*=============================================================================*
+ *  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.dm.muws.impl;
+
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.dm.muws.Metric;
+import org.apache.muse.ws.dm.muws.MuwsConstants;
+import org.apache.muse.ws.resource.properties.listeners.PropertyReadListener;
+import org.apache.muse.util.xml.XsdUtils;
+
+/**
+ *
+ * MetricDecorationProvider is a simple property listener that adds the standard 
+ * WSDM MetricAttributes attributes to a property's XML definition. This 
+ * listener is invoked just before the property's XML is returned to a client 
+ * during a WS-RP read. It takes the metric's metadata and adds it to the XML 
+ * being returned without modifying the WS-RP collection itself.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class MetricDecorationProvider implements PropertyReadListener
+{
+    private Metric _metric = null;
+    
+    public MetricDecorationProvider(Metric metric)
+    {
+        _metric = metric;
+    }
+
+    public QName getPropertyName()
+    {
+        return _metric.getName();
+    }
+
+    public Element[] readRequested(Element[] properties)
+    {
+        for (int n = 0; n < properties.length; ++n)
+        {
+            //
+            // there are three possible attributes: LastUpdated, ResetAt, Duration
+            //
+            Date lastUpdate = _metric.getLastUpdated();
+            Date reset = _metric.getResetAt();
+            String duration = _metric.getDuration();
+            
+            //
+            // this listener doesn't have to do any validation to see what 
+            // attributes should be used - that is the job of Metric. all 
+            // we do here is add the values if they exist
+            //
+            
+            if (lastUpdate != null)
+            {
+                String timeString = XsdUtils.getLocalTimeString(lastUpdate);
+                properties[n].setAttribute(MuwsConstants.LAST_UPDATED, timeString);
+            }
+            
+            if (reset != null)
+            {
+                String timeString = XsdUtils.getLocalTimeString(reset);
+                properties[n].setAttribute(MuwsConstants.RESET_AT, timeString);
+            }
+            
+            if (duration != null)
+                properties[n].setAttribute(MuwsConstants.DURATION, duration);
+        }
+        
+        return properties;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricOnDemandListener.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricOnDemandListener.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricOnDemandListener.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricOnDemandListener.java Thu Jun 15 15:19:57 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.dm.muws.impl;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.dm.muws.Metric;
+import org.apache.muse.ws.resource.properties.listeners.PropertyReadListener;
+
+/**
+ *
+ * MetricOnDemandListener is a simple property listener that makes sure an 
+ * OnDemand metric's timestamps are updated for each property read that 
+ * occurs. Because OnDemand metrics are collected on a need-to-know basis, 
+ * we must update metric metadata to reflect new values even if they didn't 
+ * come from a property insert/update/etc.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class MetricOnDemandListener implements PropertyReadListener
+{
+    private Metric _metric = null;
+    
+    public MetricOnDemandListener(Metric metric)
+    {
+        _metric = metric;
+    }
+
+    public QName getPropertyName()
+    {
+        return _metric.getName();
+    }
+
+    public Element[] readRequested(Element[] properties)
+    {
+        //
+        // tell the metric to update its timestamps
+        //
+        _metric.update();
+        return properties;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricUpdateListener.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricUpdateListener.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricUpdateListener.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/MetricUpdateListener.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,58 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.impl;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.dm.muws.Metric;
+import org.apache.muse.ws.resource.properties.listeners.PropertyChangeListener;
+
+/**
+ *
+ * MetricUpdateListener is a simple property listener that pings the SimpleMetric 
+ * data structure to record a timestamp for the metric update. This timestamp 
+ * update is important because it affects the value(s) of the metric attributes 
+ * that decorate a property's definition.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class MetricUpdateListener implements PropertyChangeListener
+{
+    private Metric _metric = null;
+    
+    public MetricUpdateListener(Metric metric)
+    {
+        _metric = metric;
+    }
+
+    public QName getPropertyName()
+    {
+        return _metric.getName();
+    }
+
+    public void propertyChanged(Element oldValue, Element newValue)
+    {
+        //
+        // tell the metric to update its timestamps
+        //
+        _metric.update();
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationships.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationships.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationships.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationships.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,100 @@
+/*=============================================================================*
+ *  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.dm.muws.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.addressing.soap.SoapFault;
+import org.apache.muse.ws.dm.muws.MuwsConstants;
+
+/**
+ *
+ * QueryRelationships is a serializer/deserializer for the MUWS (Part 2) 
+ * QueryRelationshipsByType operation's request content.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class QueryRelationships implements XmlSerializable
+{
+    private static Messages _MESSAGES = MessagesFactory.get(QueryRelationships.class);
+    
+    private QName[] _types = null;
+    
+    public QueryRelationships(Element xml)
+        throws SoapFault
+    {
+        Element[] children = XmlUtils.getElements(xml, MuwsConstants.REQUESTED_TYPE_QNAME);
+        
+        if (children.length == 0)
+            throw new SoapFault(_MESSAGES.get("NoRequestedTypes"));
+        
+        _types = new QName[children.length];
+        
+        for (int n = 0; n < children.length; ++n)
+            _types[n] = XmlUtils.getQName(children[n]);
+    }
+    
+    public QueryRelationships(QName[] types)
+    {
+        if (types == null)
+            throw new NullPointerException(_MESSAGES.get("NullQNameArray"));
+        
+        if (types.length == 0)
+            throw new IllegalArgumentException(_MESSAGES.get("NoRequestedTypes"));
+        
+        _types = types;
+    }
+    
+    public QName[] getTypes()
+    {
+        return _types;
+    }
+
+    public Element toXML()
+    {
+        return toXML(XmlUtils.EMPTY_DOC);
+    }
+
+    public Element toXML(Document factory)
+    {
+        if (factory == null)
+            throw new NullPointerException(_MESSAGES.get("NullDocument"));
+        
+        QName qname = MuwsConstants.QUERY_RELATIONSHIPS_QNAME;
+        Element root = XmlUtils.createElement(factory, qname);
+        
+        QName[] types = getTypes();
+        qname = MuwsConstants.REQUESTED_TYPE_QNAME;
+        
+        for (int n = 0; n < types.length; ++n)
+        {
+            Element next = XmlUtils.createElement(factory, qname, types[n]);
+            root.appendChild(next);
+        }
+        
+        return root;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsHandler.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsHandler.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsHandler.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,58 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.dm.muws.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.dm.muws.MuwsConstants;
+import org.apache.muse.ws.dm.muws.RelationshipResource;
+
+/**
+ *
+ * QueryRelationshipsHandler is the parser for the MUWS (Part 2) 
+ * QueryRelationshipsByType operation.
+ *
+ * @author Dan Jemiolo (danj)
+ * 
+ * @see org.apache.muse.ws.dm.muws.Relationships
+ *
+ */
+
+public class QueryRelationshipsHandler extends AbstractMessageHandler
+{
+    public QueryRelationshipsHandler()
+    {
+        super(MuwsConstants.QUERY_RELATIONSHIPS_QNAME);
+    }
+
+    public Object[] fromXML(Element xml) 
+        throws SoapFault
+    {
+        QueryRelationships query = new QueryRelationships(xml);
+        return new Object[]{ query.getTypes() };
+    }
+
+    public Element toXML(Object result)
+    {
+        QueryRelationshipsResponse response = 
+            new QueryRelationshipsResponse((RelationshipResource[])result);
+        return response.toXML();
+    }
+
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsResponse.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsResponse.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsResponse.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsResponse.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,105 @@
+/*=============================================================================*
+ *  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.dm.muws.impl;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XmlSerializable;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.dm.muws.MuwsConstants;
+import org.apache.muse.ws.dm.muws.RelationshipResource;
+import org.apache.muse.ws.resource.remote.WsResourceClient;
+
+/**
+ *
+ * QueryRelationshipsResponse is a serializer/deserializer for the 
+ * MUWS (Part 2) QueryRelationshipsByType operation's response content.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class QueryRelationshipsResponse implements XmlSerializable
+{
+    private static Messages _MESSAGES = MessagesFactory.get(QueryRelationshipsResponse.class);
+    
+    private Element[] _relationshipsXML = null;
+    
+    public QueryRelationshipsResponse(Element xml)
+    {
+        _relationshipsXML = XmlUtils.getElements(xml, MuwsConstants.RELATIONSHIP_QNAME);
+    }
+    
+    public QueryRelationshipsResponse(RelationshipResource[] matches)
+    {
+        if (matches == null)
+            throw new NullPointerException(_MESSAGES.get("NullRelationshipArray"));
+        
+        _relationshipsXML = new Element[matches.length];
+        
+        for (int n = 0; n < matches.length; ++n)
+            _relationshipsXML[n] = matches[n].toXML();
+    }
+    
+    public WsResourceClient[] getRelationshipClients() 
+        throws SoapFault
+    {
+        Element[] xml = getRelationshipXML();
+        WsResourceClient[] clients = new WsResourceClient[xml.length];
+        
+        for (int n = 0; n < xml.length; ++n)
+        {
+            Element eprXML = XmlUtils.getElement(xml[n], MuwsConstants.ACCESS_EPR_QNAME);
+            EndpointReference epr = new EndpointReference(eprXML);
+            clients[n] = new WsResourceClient(epr);
+        }
+        
+        return clients;
+    }
+    
+    public Element[] getRelationshipXML()
+    {
+        return _relationshipsXML;
+    }
+
+    public Element toXML()
+    {
+        return toXML(org.apache.muse.util.xml.XmlUtils.EMPTY_DOC);
+    }
+
+    public Element toXML(Document factory)
+    {
+        if (factory == null)
+            throw new NullPointerException(_MESSAGES.get("NullDocument"));
+        
+        Element root = org.apache.muse.util.xml.XmlUtils.createElement(factory, MuwsConstants.QUERY_RESPONSE_QNAME);
+        Element[] relationships = getRelationshipXML();
+        
+        for (int n = 0; n < relationships.length; ++n)
+        {
+            relationships[n] = (Element)factory.importNode(relationships[n], true);
+            root.appendChild(relationships[n]);
+        }
+        
+        return root;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleConfiguration.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleConfiguration.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleConfiguration.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,36 @@
+/*=============================================================================*
+ *  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.dm.muws.impl;
+
+import org.apache.muse.ws.dm.muws.Configuration;
+
+/**
+ *
+ * SimpleConfiguration is Muse's default implementation of the WSDM 
+ * Configuration capability.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleConfiguration 
+    extends AbstractManageabilityCapability implements Configuration
+{
+    //
+    // no specified implementation details
+    //
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleCorrelatableProperties.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleCorrelatableProperties.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleCorrelatableProperties.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleCorrelatableProperties.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,92 @@
+/*=============================================================================*
+ *  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.dm.muws.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.dm.muws.CorrelatableProperties;
+import org.apache.muse.ws.dm.muws.Correlation;
+
+/**
+ *
+ * SimpleCorrelatableProperties is Muse's default implementation of the 
+ * WSDM CorrelatableProperties capability. It stores all CorrelatableProperties 
+ * instances in the WS-RP container, which means that all evaluation of the 
+ * correlation expressions must begin with a WS-RP read; this is not very 
+ * efficient, but is more robust than keeping a cached copy of the POJOs. 
+ * This implementation is dialect-independent, meaning it can work with any 
+ * correlation expressions so long as they are provided through 
+ * {@linkplain Correlation Correlation}.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleCorrelatableProperties 
+    extends AbstractManageabilityCapability implements CorrelatableProperties
+{
+    //
+    // Used to lookup all exception messages
+    //
+    private static Messages _MESSAGES = 
+        MessagesFactory.get(SimpleCorrelatableProperties.class);
+    
+    private Collection _correlations = new ArrayList();
+    
+    public QName[] getPropertyNames()
+    {
+        return PROPERTIES;
+    }
+    
+    public void addCorrelation(Correlation expression)
+    {
+        if (expression == null)
+            throw new NullPointerException(_MESSAGES.get("NullCorrelation"));
+        
+        _correlations.add(expression);
+    }
+
+    public Correlation[] getCorrelatableProperties()
+    {
+        Correlation[] array = new Correlation[_correlations.size()];
+        return (Correlation[])_correlations.toArray(array);
+    }
+    
+    public boolean matches(EndpointReference epr) 
+        throws SoapFault
+    {
+        Iterator i = _correlations.iterator();
+        
+        while (i.hasNext())
+        {
+            Correlation next = (Correlation)i.next();
+            
+            if (!next.matches(epr))
+                return false;
+        }
+        
+        return true;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleCorrelationFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleCorrelationFactory.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleCorrelationFactory.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleCorrelationFactory.java Thu Jun 15 15:19:57 2006
@@ -0,0 +1,76 @@
+/*=============================================================================*
+ *  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.dm.muws.impl;
+
+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.XPathUtils;
+import org.apache.muse.ws.dm.muws.Correlation;
+import org.apache.muse.ws.dm.muws.CorrelationFactory;
+import org.apache.muse.ws.dm.muws.MuwsConstants;
+import org.apache.muse.ws.resource.WsResource;
+
+/**
+ *
+ * SimpleCorrelationFactory is a device for creating correlation expressions 
+ * for all of the built-in dialects supported by WSDM CorrelatableProperties. 
+ * Currently, the two dialects are XPath 1.0 and WSDM's Property Boolean Match.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleCorrelationFactory implements CorrelationFactory
+{
+    //
+    // Used to lookup all exception messages
+    //
+    private static Messages _MESSAGES = 
+        MessagesFactory.get(SimpleCorrelationFactory.class);
+    
+    public boolean hasDialect(String dialect)
+    {
+        return XPathUtils.NAMESPACE_URI.equals(dialect) || 
+               MuwsConstants.PBM_URI.equals(dialect);
+    }
+
+    public Correlation newInstance(WsResource resource, Element xml)
+    {
+        if (xml == null)
+            throw new NullPointerException(_MESSAGES.get("NullCPElement"));
+        
+        String dialect = xml.getAttribute(MuwsConstants.DIALECT);
+        
+        if (!hasDialect(dialect))
+        {
+            Object[] filler = { dialect };
+            String message = _MESSAGES.get("InvalidDialect", filler);
+            throw new IllegalArgumentException(message);
+        }
+        
+        //
+        // no need for a table - we only have two types
+        //
+        
+        if (XPathUtils.NAMESPACE_URI.equals(dialect))
+            return new XPathCorrelation(resource, xml);
+        
+        return new MatchCorrelation(resource, xml);
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleDescription.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleDescription.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleDescription.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleDescription.java Thu Jun 15 15:19:57 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.dm.muws.impl;
+
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.ws.dm.muws.Description;
+
+/**
+ *
+ * SimpleDescription is Muse's default implementation of the WSDM 
+ * Description capability. It initializes the capability's properties 
+ * and provides convenience methods for accessing them from internal 
+ * components.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleDescription 
+    extends AbstractManageabilityCapability implements Description
+{    
+    private String[] _captions = null;
+    
+    private String[] _descriptions = null;
+    
+    private String _version = null;
+    
+    public QName[] getPropertyNames()
+    {
+        return PROPERTIES;
+    }
+    
+    public synchronized String[] getCaption()
+    {
+        return _captions;
+    }
+    
+    public synchronized String[] getDescription()
+    {
+        return _descriptions;
+    }
+    
+    public synchronized String getVersion()
+    {
+        return _version;
+    }
+    
+    public synchronized void setCaption(String[] captions)
+    {
+        _captions = captions;
+    }
+    
+    public synchronized void setDescription(String[] descriptions)
+    {
+        _descriptions = descriptions;
+    }
+    
+    public synchronized void setVersion(String version)
+    {
+        _version = version;
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleIdentity.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleIdentity.java?rev=414696&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleIdentity.java (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws/src-impl/org/apache/muse/ws/dm/muws/impl/SimpleIdentity.java Thu Jun 15 15:19:57 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.dm.muws.impl;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.util.uuid.RandomUuidFactory;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.dm.muws.Identity;
+
+/**
+ *
+ * SimpleIdentity is Muse's default implementation of the WSDM Identity 
+ * capability. It initializes the property value(s) and provides convenience 
+ * methods for accessing those properties.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleIdentity 
+    extends AbstractManageabilityCapability implements Identity
+{
+    //
+    // Cache of the (read-only) ResourceId property
+    //
+    private URI _resourceID = null;
+    
+    public QName[] getPropertyNames()
+    {
+        return PROPERTIES;
+    }
+        
+    /**
+     * 
+     * Creates the static ResourceId property using a random UUID.
+     *
+     */
+    public void initialize()
+        throws SoapFault
+    {
+        super.initialize();
+        
+        _resourceID = RandomUuidFactory.getInstance().createUUID();
+    }
+    
+    public URI getResourceId()
+    {
+       return _resourceID;
+    }
+}



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