cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r464918 [1/2] - in /incubator/cxf/trunk/rt: frontend/simple/ ws/rm/ ws/rm/src/main/java/org/apache/cxf/ws/rm/ ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/
Date Tue, 17 Oct 2006 12:42:33 GMT
Author: andreasmyth
Date: Tue Oct 17 05:42:32 2006
New Revision: 464918

URL: http://svn.apache.org/viewvc?view=rev&rev=464918
Log:
[JIRA CXF-138] (part of): 
Enabled interceptor to be used on multiple endpoints.
Built service model for RM protocol messages. 
Removed dependency on cxf-rt-xml-binding from cxf-rt-frontend-simple.

Added:
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMEndpoint.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceService.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImplTest.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/ProxyTest.java   (with props)
Modified:
    incubator/cxf/trunk/rt/frontend/simple/pom.xml
    incubator/cxf/trunk/rt/ws/rm/pom.xml
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractEndpoint.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Destination.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Proxy.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Source.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SourceSequenceImpl.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImplTest.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/SourceSequenceImplTest.java

Modified: incubator/cxf/trunk/rt/frontend/simple/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/pom.xml?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/pom.xml (original)
+++ incubator/cxf/trunk/rt/frontend/simple/pom.xml Tue Oct 17 05:42:32 2006
@@ -76,12 +76,6 @@
 
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-bindings-xml</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-local</artifactId>
             <version>${project.version}</version>
             <optional>true</optional>

Modified: incubator/cxf/trunk/rt/ws/rm/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/pom.xml?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/pom.xml (original)
+++ incubator/cxf/trunk/rt/ws/rm/pom.xml Tue Oct 17 05:42:32 2006
@@ -46,6 +46,16 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-simple</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-ws-policy</artifactId>
             <version>${project.version}</version>
         </dependency>
@@ -146,16 +156,6 @@
                         <version>${project.version}</version>
                     </dependency>
                 </dependencies>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>${compiler.version}</version>
-                <configuration>
-                    <source>${java.source.version}</source>
-                    <target>${java.source.version}</target>
-                    <fork>${compile.forked}</fork>
-                </configuration>
             </plugin>
         </plugins>
     </build>

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java Tue Oct 17 05:42:32 2006
@@ -53,21 +53,5 @@
     /**
      * @return the expiry data of this sequence
      */
-    Date getExpiry();
-    
-    /**
-     * Returns true if a last message had been sent for this sequence and if all
-     * messages for this sequence have been acknowledged.
-     * 
-     * @return true if all messages have been acknowledged.
-     */
-    // boolean allAcknowledged();
-
-    /**
-     * Used by the RM source to cache received acknowledgements for this
-     * sequence.
-     * 
-     * @param acknowledgement an acknowledgement for this sequence
-     */
-    // void setAcknowledged(SequenceAcknowledgement acknowledgment);
+    Date getExpires();
 }

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractEndpoint.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractEndpoint.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractEndpoint.java Tue Oct 17 05:42:32 2006
@@ -19,31 +19,49 @@
 
 package org.apache.cxf.ws.rm.impl;
 
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.ws.rm.Identifier;
 
 public class AbstractEndpoint {
     
-    private final RMInterceptor interceptor;
-    private final Endpoint endpoint;
+    private final RMEndpoint reliableEndpoint;
+    
+    protected AbstractEndpoint(RMEndpoint rme) {
+        reliableEndpoint = rme;
+    }
     
-    protected AbstractEndpoint(RMInterceptor h, Endpoint e) {
-        interceptor = h;
-        endpoint = e;
+    public QName getName() {
+        return reliableEndpoint.getName();
     }
     
+    /** 
+     * @return Returns the reliableEndpoint.
+     */
+    public RMEndpoint getReliableEndpoint() {
+        return reliableEndpoint;
+    }
+
     /**
      * @return Returns the interceptor.
      */
     public RMInterceptor getInterceptor() {
-        return interceptor;
+        return reliableEndpoint.getInterceptor();
     }
     
     /**
      * @return Returns the endpoint.
      */
     public Endpoint getEndpoint() {
-        return endpoint;
+        return reliableEndpoint.getEndpoint();
+    }
+    
+    /**
+     * @return Returns the proxy.
+     */
+    public Proxy getProxy() {
+        return reliableEndpoint.getProxy();
     }
 
     /**

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java Tue Oct 17 05:42:32 2006
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.ws.rm.impl;
 
-
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.addressing.AddressingProperties;
@@ -55,47 +54,54 @@
     }
 
     /**
-    * Determine if current messaging role is that of requestor.
-    *
-    * @param message the current Message
-    * @return true iff the current messaging role is that of requestor
-    */
+     * Determine if current messaging role is that of requestor.
+     * 
+     * @param message the current Message
+     * @return true iff the current messaging role is that of requestor
+     */
     public static boolean isRequestor(Message message) {
         return org.apache.cxf.ws.addressing.ContextUtils.isRequestor(message);
     }
-    
+
+    /**
+     * Determine if message is currently being processed on server side.
+     * 
+     * @param message the current Message
+     * @return true iff message is currently being processed on server side
+     */
+    public static boolean isServerSide(Message message) {
+        // TODO
+        return false;
+    }
+
     /**
      * Retrieves the addressing properties from the current message.
      * 
      * @param message the current message
      * @param isProviderContext true if the binding provider request context
-     * available to the client application as opposed to the message context
-     * visible to handlers
+     *            available to the client application as opposed to the message
+     *            context visible to handlers
      * @param isOutbound true iff the message is outbound
      * @return the current addressing properties
      */
-    public static AddressingProperties retrieveMAPs(
-                                                        Message message, 
-                                                        boolean isProviderContext,
-                                                        boolean isOutbound) {
-        return org.apache.cxf.ws.addressing.ContextUtils
-            .retrieveMAPs(message, isProviderContext, isOutbound);
+    public static AddressingPropertiesImpl retrieveMAPs(Message message, boolean isProviderContext,
+                                                    boolean isOutbound) {
+        return org.apache.cxf.ws.addressing.ContextUtils.retrieveMAPs(message, isProviderContext, isOutbound);
     }
-    
+
     /**
      * Ensures the appropriate version of WS-Addressing is used.
      * 
      * @param maps the addressing properties
      */
     public static void ensureExposedVersion(AddressingProperties maps) {
-        ((AddressingPropertiesImpl)maps)
-            .exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
+        ((AddressingPropertiesImpl)maps).exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
     }
-    
+
     /**
-     * Returns the endpoint of this message, i.e. the client endpoint
-     * if the current messaging role is that of requestor, or the server
-     * endpoint otherwise.
+     * Returns the endpoint of this message, i.e. the client endpoint if the
+     * current messaging role is that of requestor, or the server endpoint
+     * otherwise.
      * 
      * @param message the current Message
      * @return the endpoint
@@ -107,6 +113,5 @@
             return null;
         }
     }
-    
-    
+
 }

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Destination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Destination.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Destination.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Destination.java Tue Oct 17 05:42:32 2006
@@ -28,7 +28,6 @@
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.ws.rm.DestinationSequence;
 import org.apache.cxf.ws.rm.Identifier;
@@ -41,13 +40,12 @@
 
     private static final Logger LOG = LogUtils.getL7dLogger(Destination.class);
     
-  
     private Map<String, DestinationSequenceImpl> map;
     
-    Destination(RMInterceptor interceptor, Endpoint endpoint) {
-        super(interceptor, endpoint);
+    Destination(RMEndpoint reliableEndpoint) {
+        super(reliableEndpoint);
         map = new HashMap<String, DestinationSequenceImpl>();    
-    }
+    }  
     
     public DestinationSequence getSequence(Identifier id) {        
         return map.get(id.getValue());
@@ -75,10 +73,6 @@
             store.removeDestinationSequence(seq.getIdentifier());
         }
     }
-    
-    public Collection<DestinationSequence> getAllSequences() {  
-        return CastUtils.cast(map.values());
-    }
   
    /**
     * Acknowledges receipt of a message. If the message is the last in the sequence, 
@@ -108,7 +102,7 @@
                 if (!(seq.getAcksTo().getAddress().getValue().equals(replyToAddress)
                     || seq.canPiggybackAckOnPartialResponse())) {
                     try {
-                        getInterceptor().getProxy().acknowledge(seq);
+                        getProxy().acknowledge(seq);
                     } catch (IOException ex) {
                         Message msg = new Message("SEQ_ACK_SEND_EXC", LOG, seq);
                         LOG.log(Level.SEVERE, msg.toString(), ex);
@@ -119,6 +113,10 @@
             SequenceFaultFactory sff = new SequenceFaultFactory();
             throw sff.createUnknownSequenceFault(sequenceType.getIdentifier());
         }
+    }
+    
+    Collection<DestinationSequenceImpl> getAllSequences() {  
+        return CastUtils.cast(map.values());
     }
     
     DestinationSequenceImpl getSequenceImpl(Identifier sid) {

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java Tue Oct 17 05:42:32 2006
@@ -157,13 +157,7 @@
      * @see org.apache.cxf.ws.rm.DestinationSequence#getEndpointIdentifier()
      */
     public String getEndpointIdentifier() {
-        // TODO
-        /*
-        if (null != destination) {
-            return destination.getHandler().getConfigurationHelper().getEndpointId();
-        }
-        */
-        return null;
+        return destination.getName().toString();
     }
 
     /* (non-Javadoc)
@@ -315,8 +309,9 @@
 
         public void run() {
             DestinationSequenceImpl.this.scheduleImmediateAcknowledgement();
-            try {
-                destination.getInterceptor().getProxy().acknowledge(DestinationSequenceImpl.this);
+            try {                
+                RMEndpoint rme = destination.getReliableEndpoint();
+                rme.getProxy().acknowledge(DestinationSequenceImpl.this);
             } catch (IOException ex) {
                 Message msg = new Message("SEQ_ACK_SEND_EXC", LOG, DestinationSequenceImpl.this);
                 LOG.log(Level.SEVERE, msg.toString(), ex);

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Proxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Proxy.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Proxy.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Proxy.java Tue Oct 17 05:42:32 2006
@@ -20,12 +20,67 @@
 package org.apache.cxf.ws.rm.impl;
 
 import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
+import org.apache.cxf.ws.addressing.RelatesToType;
+import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType;
 import org.apache.cxf.ws.rm.DestinationSequence;
 
+ 
 /**
  * 
  */
-public interface Proxy {
+public class Proxy {
+
+    private static final Logger LOG = Logger.getLogger(Proxy.class.getName());
+
+    private RMEndpoint reliableEndpoint;
+    private Service service;
+    
+    Proxy(Bus bus, RMEndpoint rme) {
+        reliableEndpoint = rme;
+        buildService(bus);
+    }
+   
+    RMEndpoint getReliableEndpoint() {
+        return reliableEndpoint;
+    }
+    
+    Source getSource() {
+        return reliableEndpoint.getSource();
+    }
+
+    Service getService() {
+        return service;
+    }
+    
+    void acknowledge(DestinationSequence ds) throws IOException {
+        
+    }
+    
+    void createSequence(org.apache.cxf.ws.addressing.EndpointReferenceType to, 
+                        EndpointReferenceType acksTo, 
+                        RelatesToType relatesTo) throws IOException {
+        service.getServiceInfo();    
+    }
 
-    void acknowledge(DestinationSequence ds) throws IOException;
+    final void buildService(Bus bus) {
+        ReflectionServiceFactoryBean serviceFactory = new ReflectionServiceFactoryBean();
+        try {
+            serviceFactory.setDataBinding(new JAXBDataBinding(SequenceService.class));
+        } catch (JAXBException ex) {
+            LOG.log(Level.SEVERE, "Failed to build service.", ex);
+        }
+        serviceFactory.setBus(bus);
+        serviceFactory.setServiceClass(SequenceService.class);
+        // that's the default: serviceFactory.setWrapped(true);
+        service = serviceFactory.create();
+    }
 }

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMEndpoint.java?view=auto&rev=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMEndpoint.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMEndpoint.java Tue Oct 17 05:42:32 2006
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.ws.rm.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.endpoint.Endpoint;
+
+public class RMEndpoint {
+    
+    private final RMInterceptor interceptor;
+    private final Endpoint endpoint;
+    private Source source;
+    private Destination destination;
+    private Proxy proxy;
+    
+    public RMEndpoint(RMInterceptor i, Endpoint e) {
+        interceptor = i;
+        endpoint = e;
+        source = new Source(this);
+        destination = new Destination(this);
+        proxy = new Proxy(interceptor.getBus(), this);
+    }
+    
+    public QName getName() {
+        return endpoint.getEndpointInfo().getName();
+    }
+      
+    /**
+     * @return Returns the endpoint.
+     */
+    public Endpoint getEndpoint() {
+        return endpoint;
+    }
+
+    /**
+     * @return Returns the interceptor.
+     */
+    public RMInterceptor getInterceptor() {
+        return interceptor;
+    }
+
+    /** 
+     * @return Returns the destination.
+     */
+    public Destination getDestination() {
+        return destination;
+    }
+    
+    /**
+     * @param destination The destination to set.
+     */
+    public void setDestination(Destination destination) {
+        this.destination = destination;
+    }
+    
+    /**
+     * @return Returns the proxy.
+     */
+    public Proxy getProxy() {
+        return proxy;
+    }
+    
+    /**
+     * @param proxy The proxy to set.
+     */
+    public void setProxy(Proxy proxy) {
+        this.proxy = proxy;
+    }
+    
+    /** 
+     * @return Returns the source.
+     */
+    public Source getSource() {
+        return source;
+    }
+    
+    /**
+     * @param source The source to set.
+     */
+    public void setSource(Source source) {
+        this.source = source;
+    } 
+    
+    
+    
+}

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMEndpoint.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java Tue Oct 17 05:42:32 2006
@@ -19,8 +19,11 @@
 
 package org.apache.cxf.ws.rm.impl;
 
+import java.io.IOException;
 import java.math.BigInteger;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.Timer;
@@ -29,6 +32,7 @@
 
 import javax.annotation.PostConstruct;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
@@ -38,9 +42,15 @@
 import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.MAPAggregator;
+import org.apache.cxf.ws.addressing.RelatesToType;
+import org.apache.cxf.ws.addressing.VersionTransformer;
+import org.apache.cxf.ws.addressing.v200408.AttributedURI;
+import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType;
 import org.apache.cxf.ws.rm.Identifier;
 import org.apache.cxf.ws.rm.RMContextUtils;
 import org.apache.cxf.ws.rm.RetransmissionQueue;
+import org.apache.cxf.ws.rm.SequenceAcknowledgement;
+import org.apache.cxf.ws.rm.SequenceFault;
 import org.apache.cxf.ws.rm.interceptor.DeliveryAssuranceType;
 import org.apache.cxf.ws.rm.interceptor.DestinationPolicyType;
 import org.apache.cxf.ws.rm.interceptor.RMInterceptorConfigBean;
@@ -59,39 +69,43 @@
 public class RMInterceptor extends RMInterceptorConfigBean implements PhaseInterceptor<Message> {
 
     private static final Logger LOG = LogUtils.getL7dLogger(RMInterceptor.class);
-      
+
+    private Bus bus;      
     private RMStore store;
     private RetransmissionQueue retransmissionQueue;
-    private Timer timer;
-    private Proxy proxy;
+
+    private Timer timer = new Timer();    
     private Set<String> after = Collections.singleton(MAPAggregator.class.getName());
-    private Map<Endpoint, Source> sources;
-    private Map<Endpoint, Destination> destinations;
+    private Map<Endpoint, RMEndpoint> reliableEndpoints =
+        new HashMap<Endpoint, RMEndpoint>();
+       
+    public Bus getBus() {
+        return bus;
+    }
+
+    public void setBus(Bus b) {
+        bus = b;
+    }
     
     public RMStore getStore() {
         return store;
     }
 
-    public void setStore(RMStore store) {
-        this.store = store;
+    public void setStore(RMStore s) {
+        store = s;
     }
     
     public RetransmissionQueue getRetransmissionQueue() {
         return retransmissionQueue;
     }
 
-    public void setRetransmissionQueue(RetransmissionQueue retransmissionQueue) {
-        this.retransmissionQueue = retransmissionQueue;
+    public void setRetransmissionQueue(RetransmissionQueue rq) {
+        retransmissionQueue = rq;
     }
     
     public Timer getTimer() {
         return timer;
-    }
-    
-    public Proxy getProxy() {
-        return proxy;
-    }
-   
+    }   
     
     // PhaseInterceptor interface
 
@@ -112,29 +126,42 @@
     }
 
     public void handleMessage(Message msg) throws Fault {
-        if (ContextUtils.isOutbound(msg)) {
-            handleOutbound(msg, false);        
-        } else {
-            handleInbound(msg, false);
+        try {
+            if (ContextUtils.isOutbound(msg)) {
+                handleOutbound(msg, true);
+            } else {
+                handleInbound(msg, true);
+            }
+        } catch (SequenceFault ex) {
+            LOG.log(Level.SEVERE, "SequenceFault", ex);
+            throw new Fault(ex);
         }
     }
     
     public void handleFault(Message msg) {
-        if (ContextUtils.isOutbound(msg)) {
-            handleOutbound(msg, true);        
-        } else {
-            handleInbound(msg, true);
+        try {
+            if (ContextUtils.isOutbound(msg)) {
+                handleOutbound(msg, true);
+            } else {
+                handleInbound(msg, true);
+            }
+        } catch (SequenceFault ex) {
+            LOG.log(Level.SEVERE, "SequenceFault", ex);
         }
     }
     
+    
     // rm logic
     
-    void handleOutbound(Message message, boolean isFault) {
+    void handleOutbound(Message message, boolean isFault) throws SequenceFault {
         LOG.entering(getClass().getName(), "handleOutbound");
        
         AddressingProperties maps =
             ContextUtils.retrieveMAPs(message, false, true);
         ContextUtils.ensureExposedVersion(maps);
+        
+        Source source = getSource(message);
+        Destination destination = getDestination(message);
 
         String action = null;
         if (maps != null && null != maps.getAction()) {
@@ -168,12 +195,66 @@
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.fine("inbound sequence: " + (null == inSeqId ? "null" : inSeqId.getValue()));
             }
+            
+            // get the current sequence, requesting the creation of a new one if necessary
+            
+            SourceSequenceImpl seq = getSequence(inSeqId, message, maps);
+            assert null != seq;
+
+            // increase message number and store a sequence type object in
+            // context
+
+            seq.nextMessageNumber(inSeqId, inMessageNumber);
+            rmpsOut.setSequence(seq);
+
+            // if this was the last message in the sequence, reset the
+            // current sequence so that a new one will be created next 
+            // time the handler is invoked
+
+            if (seq.isLastMessage()) {
+                source.setCurrent(null);
+            }
+            
+            /*
+            if (!(isServerSide() && BindingContextUtils.isOnewayTransport(context))) {
+
+                if (!ContextUtils.isRequestor(message)) {
+                    assert null != inSeqId;
+                }
+                
+                // get the current sequence, requesting the creation of a new one if necessary
+                
+                SourceSequence seq = getSequence(inSeqId, context, maps);
+                assert null != seq;
+
+                // increase message number and store a sequence type object in
+                // context
+
+                seq.nextMessageNumber(inSeqId, inMessageNumber);
+                rmpsOut.setSequence(seq);
+
+                // if this was the last message in the sequence, reset the
+                // current sequence so that a new one will be created next 
+                // time the handler is invoked
+
+                if (seq.isLastMessage()) {
+                    source.setCurrent(null);
+                }
+            }
+            */
         }
         
-        if (1 < 0) {
-            System.out.println(inMessageNumber);
-        }
+        System.out.println(inMessageNumber);
         
+        // add Acknowledgements (to application messages or explicitly 
+        // created Acknowledgement messages only)
+
+        if (isApplicationMessage 
+            || RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)) {
+            AttributedURI to = VersionTransformer.convert(maps.getTo());
+            assert null != to;
+            addAcknowledgements(destination, rmpsOut, inSeqId, to);
+        }     
     }
     
     void handleInbound(Message message, boolean isFault) {
@@ -211,31 +292,31 @@
         }
     }
     
-    
-    synchronized Source getSource(Message message) {
+    synchronized RMEndpoint getReliableEndpoint(Message message) {
         Endpoint endpoint = ContextUtils.getEndpoint(message);
-        Source source = sources.get(endpoint);
-        if (null == source) {
-            source = new Source(this, endpoint);
-            sources.put(endpoint, source);
-        }
-        return source;
+        RMEndpoint rme = reliableEndpoints.get(endpoint);
+        if (null == rme) {
+            rme = new RMEndpoint(this, endpoint);
+            reliableEndpoints.put(endpoint, rme);
+        }
+        return rme;
     }
     
-    synchronized Destination  getDestination(Message message) {
-        Endpoint endpoint = ContextUtils.getEndpoint(message);
-        Destination destination = destinations.get(endpoint);
-        if (null == destination) {
-            destination = new Destination(this, endpoint);
-            destinations.put(endpoint, destination);
+    Destination getDestination(Message message) {
+        RMEndpoint rme = getReliableEndpoint(message);
+        if (null != rme) {
+            return rme.getDestination();
         }
-        return destination;
+        return null;
     }
     
-    synchronized Destination getDestination(Source source) {
-        return destinations.get(source.getEndpoint());
+    Source getSource(Message message) {
+        RMEndpoint rme = getReliableEndpoint(message);
+        if (null != rme) {
+            return rme.getSource();
+        }
+        return null;
     }
-   
     
     boolean isAplicationMessage(String action) {
         if (RMUtils.getRMConstants().getCreateSequenceAction().equals(action)
@@ -248,381 +329,13 @@
         }
         return true;
     }
-
-
-    /*
-    private static final Logger LOG = LogUtils.getL7dLogger(RMHandler.class);
-    private static Map<BindingBase, RMHandler> handlers;
-
-    private RMSource source;
-    private RMDestination destination;
-    
-    private RMProxy proxy;
-    private RMServant servant;
-    private ConfigurationHelper configurationHelper;
-    private PersistenceManager persistenceManager;
-    private Timer timer;
-    private boolean busLifeCycleListenesRegistered;
-      
-    @Resource(name = JAXWSConstants.BUS_PROPERTY) private Bus bus;
-    @Resource(name = JAXWSConstants.CLIENT_BINDING_PROPERTY) private ClientBinding clientBinding;
-    @Resource(name = JAXWSConstants.SERVER_BINDING_PROPERTY) private ServerBinding serverBinding;
-    @Resource(name = JAXWSConstants.CLIENT_TRANSPORT_PROPERTY) private ClientTransport clientTransport;
-    @Resource(name = JAXWSConstants.SERVER_TRANSPORT_PROPERTY) private ServerTransport serverTransport;
-
-    public RMHandler() {        
-        proxy = new RMProxy(this);
-        servant = new RMServant();
-    }
-    
-    @PostConstruct
-    protected synchronized void initialise() {
-        /*
-        getHandlerMap().put(getBinding(), this);
-        
-        if (null == configurationHelper) {
-            configurationHelper = new ConfigurationHelper(getBinding(), null == clientBinding);
-        } 
-        
-        if (null == getSource()) {
-            source = new RMSource(this);            
-        }
-        
-        if (null == destination) {
-            destination = new RMDestination(this);
-        }
-        
-        if (null == timer) {
-            timer = new Timer();
-        }
-        
-        if (!busLifeCycleListenerRegistered) {
-            getBinding().getBus().getLifeCycleManager()
-                .registerLifeCycleListener(new RMBusLifeCycleListener(getSource()));
-            busLifeCycleListenerRegistered = true;
-        }
-    }
-
-    public static Map<BindingBase, RMHandler> getHandlerMap() {
-        if (null == handlers) {
-            handlers = new HashMap<BindingBase, RMHandler>();
-        }
-        return handlers;
-    }
-
-
-    public void close(MessageContext context) {
-        // TODO commit transaction
-    }
-
-    public boolean handleFault(LogicalMessageContext context) {
-        return handle(context);
-    }
-
-    public boolean handleMessage(LogicalMessageContext context) {
-        return handle(context);
-    }
-    
-    public PersistenceManager getPersistenceManager() {
-        return persistenceManager;
-    }
-    
-    public void setPersistenceManager(PersistenceManager pm) {
-        persistenceManager = pm;
-    }
-
-    public RMStore getStore() {
-        if (null != persistenceManager) {
-            return persistenceManager.getStore();
-        }
-        return null;
-    }
-
-    public Timer getTimer() {
-        return timer;
-    }
-    
-    public Bus getBus() {
-        return bus;
-    }
-    
-    public Transport getTransport() {
-        return null == clientTransport ? serverTransport : clientTransport;
-    }
-
-    public ClientTransport getClientTransport() {
-        return clientTransport;
-    }
-
-    public ServerTransport getServerTransport() {
-        return serverTransport;
-    }
-
-    public ClientBinding getClientBinding() {
-        return clientBinding;
-    }
-
-    public ServerBinding getServerBinding() {
-        return serverBinding;
-    }
-
-    public boolean isServerSide() {
-        return null != serverBinding;
-    }
-
-    public AbstractBindingBase getBinding() {
-        if (null != clientBinding) {
-            return (AbstractBindingBase)clientBinding;
-        }
-        return (AbstractBindingBase)serverBinding;
-    }
-
-    public RMProxy getProxy() {
-        return proxy;
-    }
-    
-    public RMServant getServant() {
-        return servant;
-    }
-    
-    public RMSource getSource() {
-        return source;        
-    }
-    
-    public RMDestination getDestination() {
-        return destination;
-    }
-
-    protected void open(LogicalMessageContext context) {
-        // TODO begin transaction
-    }
-
-    protected boolean handle(LogicalMessageContext context) {
-        try {
-            if (ContextUtils.isOutbound(context)) {
-                handleOutbound(context);
-            } else {
-                handleInbound(context);
-            }
-        } catch (SequenceFault sf) {
-            LOG.log(Level.SEVERE, "SequenceFault", sf);
-        }
-        return true;
-    }
-
-    protected void handleOutbound(LogicalMessageContext context) throws SequenceFault {
-        LOG.entering(getClass().getName(), "handleOutbound");
-        AddressingPropertiesImpl maps =
-            ContextUtils.retrieveMAPs(context, false, true);
-      
-        // ensure the appropriate version of WS-Addressing is used       
-        maps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
-
-        String action = null;
-        if (maps != null && null != maps.getAction()) {
-            action = maps.getAction().getValue();
-        }
-
-        // nothing to do if this is a CreateSequence, TerminateSequence or
-        // SequenceInfo request
-
-        if (LOG.isLoggable(Level.FINE)) {
-            LOG.fine("Action: " + action);
-        }
-
-        boolean isApplicationMessage = true;
-        
-        if (RMUtils.getRMConstants().getCreateSequenceAction().equals(action)
-            || RMUtils.getRMConstants().getCreateSequenceResponseAction().equals(action)
-            || RMUtils.getRMConstants().getTerminateSequenceAction().equals(action)
-            || RMUtils.getRMConstants().getLastMessageAction().equals(action)
-            || RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)
-            || RMUtils.getRMConstants().getSequenceInfoAction().equals(action)) {
-            isApplicationMessage = false;
-        }
-        
-        RMPropertiesImpl rmpsOut = (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(context, true);
-        if (null == rmpsOut) {
-            rmpsOut = new RMPropertiesImpl();
-            RMContextUtils.storeRMProperties(context, rmpsOut, true);
-        }
-        
-        RMPropertiesImpl rmpsIn = null;
-        Identifier inSeqId = null;
-        BigInteger inMessageNumber = null;
-        
-        if (isApplicationMessage) {
-                        
-            rmpsIn = (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(context, false);
-            
-            if (null != rmpsIn && null != rmpsIn.getSequence()) {
-                inSeqId = rmpsIn.getSequence().getIdentifier();
-                inMessageNumber = rmpsIn.getSequence().getMessageNumber();
-            }
-            if (LOG.isLoggable(Level.FINE)) {
-                LOG.fine("inbound sequence: " + (null == inSeqId ? "null" : inSeqId.getValue()));
-            }
-
-            // not for partial responses to oneway requests
-
-            if (!(isServerSide() && BindingContextUtils.isOnewayTransport(context))) {
-
-                if (!ContextUtils.isRequestor(context)) {
-                    assert null != inSeqId;
-                }
-                
-                // get the current sequence, requesting the creation of a new one if necessary
-                
-                SourceSequence seq = getSequence(inSeqId, context, maps);
-                assert null != seq;
-
-                // increase message number and store a sequence type object in
-                // context
-
-                seq.nextMessageNumber(inSeqId, inMessageNumber);
-                rmpsOut.setSequence(seq);
-
-                // if this was the last message in the sequence, reset the
-                // current sequence so that a new one will be created next 
-                // time the handler is invoked
-
-                if (seq.isLastMessage()) {
-                    source.setCurrent(null);
-                }
-            }
-        }
-        
-        // add Acknowledgements (to application messages or explicitly 
-        // created Acknowledgement messages only)
-
-        if (isApplicationMessage 
-            || RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)) {
-            AttributedURI to = VersionTransformer.convert(maps.getTo());
-            assert null != to;
-            addAcknowledgements(rmpsOut, inSeqId, to);
-        }
-
-        // indicate to the binding that a response is expected from the transport although
-        // the web method is a oneway method
-
-        if (BindingContextUtils.isOnewayMethod(context)
-            || RMUtils.getRMConstants().getLastMessageAction().equals(action)) {
-            context.put(OutputStreamMessageContext.ONEWAY_MESSAGE_TF, Boolean.FALSE);
-        }
-    }
-
-    protected void handleInbound(LogicalMessageContext context) throws SequenceFault {
-
-        LOG.entering(getClass().getName(), "handleInbound");
-        RMProperties rmps = RMContextUtils.retrieveRMProperties(context, false);
-        
-        final AddressingPropertiesImpl maps = ContextUtils.retrieveMAPs(context, false, false);
-        assert null != maps;
-
-        String action = null;
-        if (null != maps.getAction()) {
-            action = maps.getAction().getValue();
-        }
-
-        if (LOG.isLoggable(Level.FINE)) {
-            LOG.fine("Action: " + action);
-        }
-
-        if (RMUtils.getRMConstants().getCreateSequenceResponseAction().equals(action)) {
-            Object[] parameters = (Object[])context.get(ObjectMessageContext.METHOD_PARAMETERS);
-            CreateSequenceResponseType csr = (CreateSequenceResponseType)parameters[0];
-            getServant().createSequenceResponse(getSource(), 
-                                                csr,
-                                                getProxy().getOfferedIdentifier());
-
-            return;
-        } else if (RMUtils.getRMConstants().getCreateSequenceAction().equals(action)) {
-            Object[] parameters = (Object[])context.get(ObjectMessageContext.METHOD_PARAMETERS);
-            CreateSequenceType cs = (CreateSequenceType)parameters[0];
-
-            final CreateSequenceResponseType csr =
-                getServant().createSequence(getDestination(), cs, maps);
-            
-            Runnable response = new Runnable() {
-                public void run() {
-                    try {
-                        getProxy().createSequenceResponse(maps, csr);
-                    } catch (IOException ex) {
-                        ex.printStackTrace();
-                    } catch (SequenceFault sf) {
-                        sf.printStackTrace();
-                    }
-                }
-            };
-            getBinding().getBus().getWorkQueueManager().getAutomaticWorkQueue().execute(response);
     
-            return;
-        } else if (RMUtils.getRMConstants().getTerminateSequenceAction().equals(action)) {
-            Object[] parameters = (Object[])context.get(ObjectMessageContext.METHOD_PARAMETERS);
-            TerminateSequenceType cs = (TerminateSequenceType)parameters[0];
-
-            getServant().terminateSequence(getDestination(), cs.getIdentifier());
-        }
-        
-        // for application AND out of band messages
+    void addAcknowledgements(Destination destination, 
+                             RMPropertiesImpl rmpsOut, 
+                             Identifier inSeqId, 
+                             AttributedURI to) {
 
-        if (null != rmps) {            
-            
-            processAcknowledgments(rmps);
-
-            processAcknowledgmentRequests(rmps);  
-            
-            processSequence(rmps, maps);
-            
-            processDeliveryAssurance(rmps);
-        }
-    }
-
-    void processAcknowledgments(RMProperties rmps) {
-        Collection<SequenceAcknowledgement> acks = rmps.getAcks();
-        if (null != acks) {
-            for (SequenceAcknowledgement ack : acks) {
-                getSource().setAcknowledged(ack);
-            }
-        }
-    }
-
-    void processSequence(RMProperties rmps, AddressingProperties maps) throws SequenceFault {
-        SequenceType s = rmps.getSequence();
-        if (null == s) {
-            return;
-        }  
-
-        getDestination().acknowledge(s, 
-            null == maps.getReplyTo() ? null : maps.getReplyTo().getAddress().getValue());
-    }
-
-    void processAcknowledgmentRequests(RMProperties rmps) {
-        Collection<AckRequestedType> requested = rmps.getAcksRequested();
-        if (null != requested) {
-            for (AckRequestedType ar : requested) {
-                DestinationSequence seq = getDestination().getSequence(ar.getIdentifier());
-                if (null != seq) {
-                    seq.scheduleImmediateAcknowledgement();
-                } else {
-                    LOG.severe("No such sequence.");
-                }
-            }
-        }
-    }
-    
-    boolean processDeliveryAssurance(RMProperties rmps) {
-        SequenceType s = rmps.getSequence();
-        if (null == s) {
-            return true;
-        }  
-        DestinationSequence ds = destination.getSequence(s.getIdentifier());
-        return ds.applyDeliveryAssurance(s.getMessageNumber());       
-    }
-
-    void addAcknowledgements(RMPropertiesImpl rmpsOut, Identifier inSeqId, AttributedURI to) {
-
-        for (DestinationSequence seq : getDestination().getAllSequences()) {
+        for (DestinationSequenceImpl seq : destination.getAllSequences()) {
             if (seq.sendAcknowledgement()
                 && ((seq.getAcksTo().getAddress().getValue().equals(RMUtils.getAddressingConstants()
                     .getAnonymousURI()) && AbstractSequenceImpl.identifierEquals(seq.getIdentifier(), 
@@ -650,27 +363,32 @@
         }
     }
     
-    private SourceSequence getSequence(Identifier inSeqId, 
-                                 LogicalMessageContext context, 
-                                 AddressingPropertiesImpl maps) throws SequenceFault {
-        SourceSequence seq = getSource().getCurrent(inSeqId);
+    SourceSequenceImpl getSequence(Identifier inSeqId, Message message, AddressingProperties maps)
+        throws SequenceFault {
 
+        Source source = getSource(message);
+        SourceSequenceImpl seq = source.getCurrent(inSeqId);
         if (null == seq) {
             // TODO: better error handling
             org.apache.cxf.ws.addressing.EndpointReferenceType to = null;
             try {
                 EndpointReferenceType acksTo = null;
                 RelatesToType relatesTo = null;
-                if (isServerSide()) {
-                    AddressingPropertiesImpl inMaps = ContextUtils
-                        .retrieveMAPs(context, false, false);
-                    inMaps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
-                    acksTo = RMUtils.createReference(inMaps.getTo().getValue());
-                    to = inMaps.getReplyTo();    
-                    getServant().setUnattachedIdentifier(inSeqId);
-                    relatesTo = ContextUtils.WSA_OBJECT_FACTORY.createRelatesToType();
-                    DestinationSequence inSeq = getDestination().getSequence(inSeqId);
-                    relatesTo.setValue(inSeq != null ? inSeq.getCorrelationID() : null);
+                if (ContextUtils.isServerSide(message)) {
+                    /*
+                     * AddressingPropertiesImpl inMaps = ContextUtils
+                     * .retrieveMAPs(message, false, false);
+                     * inMaps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
+                     * acksTo =
+                     * RMUtils.createReference(inMaps.getTo().getValue()); to =
+                     * inMaps.getReplyTo();
+                     * getServant().setUnattachedIdentifier(inSeqId); relatesTo =
+                     * ContextUtils.WSA_OBJECT_FACTORY.createRelatesToType();
+                     * DestinationSequence inSeq =
+                     * getDestination().getSequence(inSeqId);
+                     * relatesTo.setValue(inSeq != null ?
+                     * inSeq.getCorrelationID() : null);
+                     */
                 } else {
                     acksTo = VersionTransformer.convert(maps.getReplyTo());
                     // for oneways
@@ -679,17 +397,174 @@
                     }
                 }
 
-                getProxy().createSequence(getSource(), to, acksTo, relatesTo);
+                source.getProxy().createSequence(to, acksTo, relatesTo);
             } catch (IOException ex) {
                 ex.printStackTrace();
             }
 
-            seq = getSource().awaitCurrent(inSeqId);
+            seq = source.awaitCurrent(inSeqId);
             seq.setTarget(to);
         }
-        
+
         return seq;
     }
+
+
+
+    /*
+     * private static final Logger LOG = LogUtils.getL7dLogger(RMHandler.class);
+     * private static Map<BindingBase, RMHandler> handlers; private RMSource
+     * source; private RMDestination destination; private RMProxy proxy; private
+     * RMServant servant; private ConfigurationHelper configurationHelper;
+     * private PersistenceManager persistenceManager; private Timer timer;
+     * private boolean busLifeCycleListenesRegistered; @Resource(name =
+     * JAXWSConstants.BUS_PROPERTY) private Bus bus; @Resource(name =
+     * JAXWSConstants.CLIENT_BINDING_PROPERTY) private ClientBinding
+     * clientBinding; @Resource(name = JAXWSConstants.SERVER_BINDING_PROPERTY)
+     * private ServerBinding serverBinding; @Resource(name =
+     * JAXWSConstants.CLIENT_TRANSPORT_PROPERTY) private ClientTransport
+     * clientTransport; @Resource(name =
+     * JAXWSConstants.SERVER_TRANSPORT_PROPERTY) private ServerTransport
+     * serverTransport; public RMHandler() { proxy = new RMProxy(this); servant =
+     * new RMServant(); } @PostConstruct protected synchronized void
+     * initialise() { /* getHandlerMap().put(getBinding(), this); if (null ==
+     * configurationHelper) { configurationHelper = new
+     * ConfigurationHelper(getBinding(), null == clientBinding); } if (null ==
+     * getSource()) { source = new RMSource(this); } if (null == destination) {
+     * destination = new RMDestination(this); } if (null == timer) { timer = new
+     * Timer(); } if (!busLifeCycleListenerRegistered) {
+     * getBinding().getBus().getLifeCycleManager()
+     * .registerLifeCycleListener(new RMBusLifeCycleListener(getSource()));
+     * busLifeCycleListenerRegistered = true; } } public static Map<BindingBase,
+     * RMHandler> getHandlerMap() { if (null == handlers) { handlers = new
+     * HashMap<BindingBase, RMHandler>(); } return handlers; } public void
+     * close(MessageContext context) { // TODO commit transaction } public
+     * boolean handleFault(LogicalMessageContext context) { return
+     * handle(context); } public boolean handleMessage(LogicalMessageContext
+     * context) { return handle(context); } public PersistenceManager
+     * getPersistenceManager() { return persistenceManager; } public void
+     * setPersistenceManager(PersistenceManager pm) { persistenceManager = pm; }
+     * public RMStore getStore() { if (null != persistenceManager) { return
+     * persistenceManager.getStore(); } return null; } public Timer getTimer() {
+     * return timer; } public Bus getBus() { return bus; } public Transport
+     * getTransport() { return null == clientTransport ? serverTransport :
+     * clientTransport; } public ClientTransport getClientTransport() { return
+     * clientTransport; } public ServerTransport getServerTransport() { return
+     * serverTransport; } public ClientBinding getClientBinding() { return
+     * clientBinding; } public ServerBinding getServerBinding() { return
+     * serverBinding; } public boolean isServerSide() { return null !=
+     * serverBinding; } public AbstractBindingBase getBinding() { if (null !=
+     * clientBinding) { return (AbstractBindingBase)clientBinding; } return
+     * (AbstractBindingBase)serverBinding; } public RMProxy getProxy() { return
+     * proxy; } public RMServant getServant() { return servant; } public
+     * RMSource getSource() { return source; } public RMDestination
+     * getDestination() { return destination; } protected void
+     * open(LogicalMessageContext context) { // TODO begin transaction }
+     * protected boolean handle(LogicalMessageContext context) { try { if
+     * (ContextUtils.isOutbound(context)) { handleOutbound(context); } else {
+     * handleInbound(context); } } catch (SequenceFault sf) {
+     * LOG.log(Level.SEVERE, "SequenceFault", sf); } return true; } protected
+     * void handleOutbound(LogicalMessageContext context) throws SequenceFault {
+     * LOG.entering(getClass().getName(), "handleOutbound");
+     * AddressingPropertiesImpl maps = ContextUtils.retrieveMAPs(context, false,
+     * true); // ensure the appropriate version of WS-Addressing is used
+     * maps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME); String
+     * action = null; if (maps != null && null != maps.getAction()) { action =
+     * maps.getAction().getValue(); } // nothing to do if this is a
+     * CreateSequence, TerminateSequence or // SequenceInfo request if
+     * (LOG.isLoggable(Level.FINE)) { LOG.fine("Action: " + action); } boolean
+     * isApplicationMessage = true; if
+     * (RMUtils.getRMConstants().getCreateSequenceAction().equals(action) ||
+     * RMUtils.getRMConstants().getCreateSequenceResponseAction().equals(action) ||
+     * RMUtils.getRMConstants().getTerminateSequenceAction().equals(action) ||
+     * RMUtils.getRMConstants().getLastMessageAction().equals(action) ||
+     * RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action) ||
+     * RMUtils.getRMConstants().getSequenceInfoAction().equals(action)) {
+     * isApplicationMessage = false; } RMPropertiesImpl rmpsOut =
+     * (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(context, true); if
+     * (null == rmpsOut) { rmpsOut = new RMPropertiesImpl();
+     * RMContextUtils.storeRMProperties(context, rmpsOut, true); }
+     * RMPropertiesImpl rmpsIn = null; Identifier inSeqId = null; BigInteger
+     * inMessageNumber = null; if (isApplicationMessage) { rmpsIn =
+     * (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(context, false); if
+     * (null != rmpsIn && null != rmpsIn.getSequence()) { inSeqId =
+     * rmpsIn.getSequence().getIdentifier(); inMessageNumber =
+     * rmpsIn.getSequence().getMessageNumber(); } if
+     * (LOG.isLoggable(Level.FINE)) { LOG.fine("inbound sequence: " + (null ==
+     * inSeqId ? "null" : inSeqId.getValue())); } // not for partial responses
+     * to oneway requests if (!(isServerSide() &&
+     * BindingContextUtils.isOnewayTransport(context))) { if
+     * (!ContextUtils.isRequestor(context)) { assert null != inSeqId; } // get
+     * the current sequence, requesting the creation of a new one if necessary
+     * SourceSequence seq = getSequence(inSeqId, context, maps); assert null !=
+     * seq; // increase message number and store a sequence type object in //
+     * context seq.nextMessageNumber(inSeqId, inMessageNumber);
+     * rmpsOut.setSequence(seq); // if this was the last message in the
+     * sequence, reset the // current sequence so that a new one will be created
+     * next // time the handler is invoked if (seq.isLastMessage()) {
+     * source.setCurrent(null); } } } // add Acknowledgements (to application
+     * messages or explicitly // created Acknowledgement messages only) if
+     * (isApplicationMessage ||
+     * RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)) {
+     * AttributedURI to = VersionTransformer.convert(maps.getTo()); assert null !=
+     * to; addAcknowledgements(rmpsOut, inSeqId, to); } // indicate to the
+     * binding that a response is expected from the transport although // the
+     * web method is a oneway method if
+     * (BindingContextUtils.isOnewayMethod(context) ||
+     * RMUtils.getRMConstants().getLastMessageAction().equals(action)) {
+     * context.put(OutputStreamMessageContext.ONEWAY_MESSAGE_TF, Boolean.FALSE); } }
+     * protected void handleInbound(LogicalMessageContext context) throws
+     * SequenceFault { LOG.entering(getClass().getName(), "handleInbound");
+     * RMProperties rmps = RMContextUtils.retrieveRMProperties(context, false);
+     * final AddressingPropertiesImpl maps = ContextUtils.retrieveMAPs(context,
+     * false, false); assert null != maps; String action = null; if (null !=
+     * maps.getAction()) { action = maps.getAction().getValue(); } if
+     * (LOG.isLoggable(Level.FINE)) { LOG.fine("Action: " + action); } if
+     * (RMUtils.getRMConstants().getCreateSequenceResponseAction().equals(action)) {
+     * Object[] parameters =
+     * (Object[])context.get(ObjectMessageContext.METHOD_PARAMETERS);
+     * CreateSequenceResponseType csr =
+     * (CreateSequenceResponseType)parameters[0];
+     * getServant().createSequenceResponse(getSource(), csr,
+     * getProxy().getOfferedIdentifier()); return; } else if
+     * (RMUtils.getRMConstants().getCreateSequenceAction().equals(action)) {
+     * Object[] parameters =
+     * (Object[])context.get(ObjectMessageContext.METHOD_PARAMETERS);
+     * CreateSequenceType cs = (CreateSequenceType)parameters[0]; final
+     * CreateSequenceResponseType csr =
+     * getServant().createSequence(getDestination(), cs, maps); Runnable
+     * response = new Runnable() { public void run() { try {
+     * getProxy().createSequenceResponse(maps, csr); } catch (IOException ex) {
+     * ex.printStackTrace(); } catch (SequenceFault sf) { sf.printStackTrace(); } } };
+     * getBinding().getBus().getWorkQueueManager().getAutomaticWorkQueue().execute(response);
+     * return; } else if
+     * (RMUtils.getRMConstants().getTerminateSequenceAction().equals(action)) {
+     * Object[] parameters =
+     * (Object[])context.get(ObjectMessageContext.METHOD_PARAMETERS);
+     * TerminateSequenceType cs = (TerminateSequenceType)parameters[0];
+     * getServant().terminateSequence(getDestination(), cs.getIdentifier()); } //
+     * for application AND out of band messages if (null != rmps) {
+     * processAcknowledgments(rmps); processAcknowledgmentRequests(rmps);
+     * processSequence(rmps, maps); processDeliveryAssurance(rmps); } } void
+     * processAcknowledgments(RMProperties rmps) { Collection<SequenceAcknowledgement>
+     * acks = rmps.getAcks(); if (null != acks) { for (SequenceAcknowledgement
+     * ack : acks) { getSource().setAcknowledged(ack); } } } void
+     * processSequence(RMProperties rmps, AddressingProperties maps) throws
+     * SequenceFault { SequenceType s = rmps.getSequence(); if (null == s) {
+     * return; } getDestination().acknowledge(s, null == maps.getReplyTo() ?
+     * null : maps.getReplyTo().getAddress().getValue()); } void
+     * processAcknowledgmentRequests(RMProperties rmps) { Collection<AckRequestedType>
+     * requested = rmps.getAcksRequested(); if (null != requested) { for
+     * (AckRequestedType ar : requested) { DestinationSequence seq =
+     * getDestination().getSequence(ar.getIdentifier()); if (null != seq) {
+     * seq.scheduleImmediateAcknowledgement(); } else { LOG.severe("No such
+     * sequence."); } } } } boolean processDeliveryAssurance(RMProperties rmps) {
+     * SequenceType s = rmps.getSequence(); if (null == s) { return true; }
+     * DestinationSequence ds = destination.getSequence(s.getIdentifier());
+     * return ds.applyDeliveryAssurance(s.getMessageNumber()); }
+     */
+
+    /*
    
     protected void setInitialised(ConfigurationHelper ch,
                                   RMSource s,

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceService.java?view=auto&rev=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceService.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceService.java Tue Oct 17 05:42:32 2006
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.ws.rm.impl;
+
+
+import org.apache.cxf.ws.rm.CreateSequenceResponseType;
+import org.apache.cxf.ws.rm.CreateSequenceType;
+import org.apache.cxf.ws.rm.SequenceFault;
+import org.apache.cxf.ws.rm.TerminateSequenceType;
+
+
+
+
+public interface SequenceService {
+    void createSequence(CreateSequenceType create) throws SequenceFault;
+    void createSequenceResponse(CreateSequenceResponseType response) throws SequenceFault;
+    void terminateSequence(TerminateSequenceType terminate) throws SequenceFault;
+}

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Source.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Source.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Source.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Source.java Tue Oct 17 05:42:32 2006
@@ -27,7 +27,6 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
-import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.ws.rm.Identifier;
 import org.apache.cxf.ws.rm.SequenceAcknowledgement;
@@ -44,8 +43,8 @@
     private Condition sequenceCreationCondition;
     private boolean sequenceCreationNotified;
 
-    Source(RMInterceptor interceptor, Endpoint endpoint) {
-        super(interceptor, endpoint);
+    Source(RMEndpoint reliableEndpoint) {
+        super(reliableEndpoint);
         map = new HashMap<String, SourceSequenceImpl>();
         current = new HashMap<String, SourceSequenceImpl>();
              
@@ -53,6 +52,8 @@
         sequenceCreationCondition = sequenceCreationLock.newCondition();
     }
     
+    
+    
     public SourceSequence getSequence(Identifier id) {        
         return map.get(id.getValue());
     }
@@ -152,7 +153,7 @@
      * 
      * @return the current sequence.
      */
-    SourceSequence getCurrent(Identifier i) {        
+    SourceSequenceImpl getCurrent(Identifier i) {        
         sequenceCreationLock.lock();
         try {
             return getAssociatedSequence(i);
@@ -168,7 +169,7 @@
      * @return the associated sequence
      * @pre the sequenceCreationLock is already held
      */
-    SourceSequence getAssociatedSequence(Identifier i) {        
+    SourceSequenceImpl getAssociatedSequence(Identifier i) {        
         return current.get(i == null ? REQUESTOR_SEQUENCE_ID : i.getValue());
     }
     
@@ -178,10 +179,10 @@
      * @param i the sequence identifier
      * @return
      */
-    SourceSequence awaitCurrent(Identifier i) {
+    SourceSequenceImpl awaitCurrent(Identifier i) {
         sequenceCreationLock.lock();
         try {
-            SourceSequence seq = getAssociatedSequence(i);
+            SourceSequenceImpl seq = getAssociatedSequence(i);
             while (seq == null) {
                 while (!sequenceCreationNotified) {
                     try {

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SourceSequenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SourceSequenceImpl.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SourceSequenceImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SourceSequenceImpl.java Tue Oct 17 05:42:32 2006
@@ -80,13 +80,7 @@
      * @see org.apache.cxf.ws.rm.SourceSequence#getEndpointIdentifier()
      */
     public String getEndpointIdentifier() {
-        // TODO
-        /*
-        if (null != source) {
-            return source.getHandler().getConfigurationHelper().getEndpointId();
-        }
-        */
-        return null;
+        return source.getName().toString();
     }
 
     /* (non-Javadoc)
@@ -106,12 +100,11 @@
     /* (non-Javadoc)
      * @see org.apache.cxf.ws.rm.SourceSequence#getExpiry()
      */
-    public Date getExpiry() {
-        // TODO Auto-generated method stub
-        return null;
+    public Date getExpires() {
+        return expires;
     }
     
-    // end RMSourceSequence interface
+    // end SourceSequence interface
     
     /**
      * Returns true if a last message had been sent for this sequence and if all
@@ -265,8 +258,7 @@
         // that included this sequence as an offer 
 
         if (null != inSeqId && null != inMsgNumber) {
-            RMInterceptor interceptor = source.getInterceptor();
-            Destination destination = interceptor.getDestination(source);
+            Destination destination = source.getReliableEndpoint().getDestination();
             DestinationSequenceImpl inSeq = null;
             if (null != destination) {
                 inSeq = destination.getSequenceImpl(inSeqId);

Added: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImplTest.java?view=auto&rev=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImplTest.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImplTest.java Tue Oct 17 05:42:32 2006
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.ws.rm.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.ws.rm.Identifier;
+import org.apache.cxf.ws.rm.ObjectFactory;
+
+public class AbstractSequenceImplTest extends TestCase {
+
+    public void testIdentifierEquals() {
+        Identifier id1 = null;
+        Identifier id2 = null;   
+        assertTrue(AbstractSequenceImpl.identifierEquals(id1, id2));
+        
+        ObjectFactory factory = new ObjectFactory();
+        id1 = factory.createIdentifier();
+        id1.setValue("seq1"); 
+        assertTrue(!AbstractSequenceImpl.identifierEquals(id1, id2));
+        
+        id2 = factory.createIdentifier();
+        id2.setValue("seq2"); 
+        assertTrue(!AbstractSequenceImpl.identifierEquals(id1, id2));
+        
+        id2.setValue("seq1");
+        assertTrue(AbstractSequenceImpl.identifierEquals(id1, id2));
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImplTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImplTest.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImplTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImplTest.java Tue Oct 17 05:42:32 2006
@@ -24,6 +24,8 @@
 import java.util.List;
 import java.util.Timer;
 
+import javax.xml.namespace.QName;
+
 
 import junit.framework.TestCase;
 
@@ -39,12 +41,9 @@
 import org.apache.cxf.ws.rm.policy.RMAssertion;
 import org.apache.cxf.ws.rm.policy.RMAssertion.AcknowledgementInterval;
 import org.apache.cxf.ws.rm.policy.RMAssertion.BaseRetransmissionInterval;
+import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.classextension.EasyMock.createNiceControl;
-
 public class DestinationSequenceImplTest extends TestCase {
 
     private IMocksControl control;
@@ -58,7 +57,7 @@
     private DestinationPolicyType dp;
  
     public void setUp() {
-        control = createNiceControl();
+        control = EasyMock.createNiceControl();
         factory = new ObjectFactory();
         
         ref = control.createMock(EndpointReferenceType.class);                
@@ -123,21 +122,14 @@
     }
     
     public void testGetEndpointIdentifier() {
-        /*
-        destination.getHandler();
-        expectLastCall().andReturn(handler);
-        handler.getConfigurationHelper();
-        expectLastCall().andReturn(configurationHelper);
-        configurationHelper.getEndpointId();
-        expectLastCall().andReturn("abc.xyz");
+        setUpDestination();
+        QName qn = new QName("abc", "xyz");
+        EasyMock.expect(destination.getName()).andReturn(qn);
         control.replay();
         
         DestinationSequenceImpl seq = new DestinationSequenceImpl(id, ref, destination);
-        seq.setDestination(destination);
-        assertEquals("abc.xyz", seq.getEndpointIdentifier());
-   
+        assertEquals("Unexpected endpoint identifier", "{abc}xyz", seq.getEndpointIdentifier());
         control.verify();
-        */
     }
     
     public void testGetAcknowledgementAsStream() throws SequenceFault {
@@ -337,15 +329,16 @@
     }
     
     public void testAcknowledgeDeferred() throws SequenceFault, IOException {
-        setUpDestination(true);
+        Timer timer = new Timer();
+        setUpDestination(timer);
         
         DestinationSequenceImpl seq = new DestinationSequenceImpl(id, ref, destination);
-        
+        RMEndpoint rme = control.createMock(RMEndpoint.class);
+        EasyMock.expect(destination.getReliableEndpoint()).andReturn(rme).anyTimes();
         Proxy proxy = control.createMock(Proxy.class);
-        interceptor.getProxy();
-        expectLastCall().andReturn(proxy);
+        EasyMock.expect(rme.getProxy()).andReturn(proxy).anyTimes();        
         proxy.acknowledge(seq);
-        expectLastCall();
+        EasyMock.expectLastCall();
         
         control.replay();
         
@@ -393,10 +386,10 @@
         SequenceAcknowledgement ack = control.createMock(SequenceAcknowledgement.class);
         List<AcknowledgementRange> ranges = new ArrayList<AcknowledgementRange>();
         AcknowledgementRange r = control.createMock(AcknowledgementRange.class);
-        expect(ack.getAcknowledgementRange()).andReturn(ranges);
+        EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges);
         DeliveryAssuranceType da = control.createMock(DeliveryAssuranceType.class);
-        expect(interceptor.getDeliveryAssurance()).andReturn(da);
-        expect(da.isSetAtMostOnce()).andReturn(true);                    
+        EasyMock.expect(interceptor.getDeliveryAssurance()).andReturn(da);
+        EasyMock.expect(da.isSetAtMostOnce()).andReturn(true);                    
         
         control.replay();        
         DestinationSequenceImpl ds = new DestinationSequenceImpl(id, ref, null, ack);
@@ -406,12 +399,12 @@
         
         control.reset();
         ranges.add(r);
-        expect(destination.getInterceptor()).andReturn(interceptor);
-        expect(interceptor.getDeliveryAssurance()).andReturn(da);
-        expect(da.isSetAtMostOnce()).andReturn(true);            
-        expect(ack.getAcknowledgementRange()).andReturn(ranges);
-        expect(r.getLower()).andReturn(new BigInteger("5"));
-        expect(r.getUpper()).andReturn(new BigInteger("15"));
+        EasyMock.expect(destination.getInterceptor()).andReturn(interceptor);
+        EasyMock.expect(interceptor.getDeliveryAssurance()).andReturn(da);
+        EasyMock.expect(da.isSetAtMostOnce()).andReturn(true);            
+        EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges);
+        EasyMock.expect(r.getLower()).andReturn(new BigInteger("5"));
+        EasyMock.expect(r.getUpper()).andReturn(new BigInteger("15"));
         control.replay();        
         assertTrue("message has not yet been delivered", !ds.applyDeliveryAssurance(mn));
         control.verify();
@@ -424,18 +417,18 @@
         BigInteger mn = BigInteger.TEN;
         
         DeliveryAssuranceType da = control.createMock(DeliveryAssuranceType.class);
-        expect(interceptor.getDeliveryAssurance()).andReturn(da).anyTimes();
-        expect(da.isSetAtMostOnce()).andReturn(false);
-        expect(da.isSetAtLeastOnce()).andReturn(true);
-        expect(da.isSetInOrder()).andReturn(true); 
+        EasyMock.expect(interceptor.getDeliveryAssurance()).andReturn(da).anyTimes();
+        EasyMock.expect(da.isSetAtMostOnce()).andReturn(false);
+        EasyMock.expect(da.isSetAtLeastOnce()).andReturn(true);
+        EasyMock.expect(da.isSetInOrder()).andReturn(true); 
         
         SequenceAcknowledgement ack = control.createMock(SequenceAcknowledgement.class);
         List<AcknowledgementRange> ranges = new ArrayList<AcknowledgementRange>();
         AcknowledgementRange r = control.createMock(AcknowledgementRange.class);
         ranges.add(r);
-        expect(ack.getAcknowledgementRange()).andReturn(ranges).times(3);
-        expect(r.getLower()).andReturn(BigInteger.ONE);
-        expect(r.getUpper()).andReturn(new BigInteger("15"));
+        EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges).times(3);
+        EasyMock.expect(r.getLower()).andReturn(BigInteger.ONE);
+        EasyMock.expect(r.getUpper()).andReturn(new BigInteger("15"));
         
         control.replay(); 
         
@@ -449,10 +442,10 @@
         setUpDestination();
         
         DeliveryAssuranceType da = control.createMock(DeliveryAssuranceType.class);
-        expect(interceptor.getDeliveryAssurance()).andReturn(da).anyTimes();
-        expect(da.isSetAtMostOnce()).andReturn(false).anyTimes();
-        expect(da.isSetAtLeastOnce()).andReturn(true).anyTimes();
-        expect(da.isSetInOrder()).andReturn(true).anyTimes(); 
+        EasyMock.expect(interceptor.getDeliveryAssurance()).andReturn(da).anyTimes();
+        EasyMock.expect(da.isSetAtMostOnce()).andReturn(false).anyTimes();
+        EasyMock.expect(da.isSetAtLeastOnce()).andReturn(true).anyTimes();
+        EasyMock.expect(da.isSetInOrder()).andReturn(true).anyTimes(); 
         
         SequenceAcknowledgement ack = factory.createSequenceAcknowledgement();
         List<AcknowledgementRange> ranges = new ArrayList<AcknowledgementRange>();
@@ -512,7 +505,7 @@
         SequenceAcknowledgement ack = control.createMock(SequenceAcknowledgement.class);
         List<AcknowledgementRange> ranges = new ArrayList<AcknowledgementRange>();
         AcknowledgementRange r = control.createMock(AcknowledgementRange.class);
-        expect(ack.getAcknowledgementRange()).andReturn(ranges);
+        EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges);
         control.replay();
         DestinationSequenceImpl ds = new DestinationSequenceImpl(id, ref, null, ack);
         ds.setDestination(destination);
@@ -521,41 +514,41 @@
         
         control.reset();
         ranges.add(r);
-        expect(ack.getAcknowledgementRange()).andReturn(ranges).times(2);
-        expect(r.getLower()).andReturn(BigInteger.TEN);
+        EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges).times(2);
+        EasyMock.expect(r.getLower()).andReturn(BigInteger.TEN);
         control.replay();
         assertTrue("all predecessors acknowledged", !ds.allPredecessorsAcknowledged(BigInteger.TEN));
         control.verify();
         
         control.reset();
-        expect(ack.getAcknowledgementRange()).andReturn(ranges).times(3);
-        expect(r.getLower()).andReturn(BigInteger.ONE);
-        expect(r.getUpper()).andReturn(new BigInteger("5"));
+        EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges).times(3);
+        EasyMock.expect(r.getLower()).andReturn(BigInteger.ONE);
+        EasyMock.expect(r.getUpper()).andReturn(new BigInteger("5"));
         control.replay();
         assertTrue("all predecessors acknowledged", !ds.allPredecessorsAcknowledged(BigInteger.TEN));
         control.verify();
         
         control.reset();
-        expect(ack.getAcknowledgementRange()).andReturn(ranges).times(3);
-        expect(r.getLower()).andReturn(BigInteger.ONE);
-        expect(r.getUpper()).andReturn(BigInteger.TEN);
+        EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges).times(3);
+        EasyMock.expect(r.getLower()).andReturn(BigInteger.ONE);
+        EasyMock.expect(r.getUpper()).andReturn(BigInteger.TEN);
         control.replay();
         assertTrue("not all predecessors acknowledged", ds.allPredecessorsAcknowledged(BigInteger.TEN));
         control.verify();
         
         ranges.add(r);
         control.reset();
-        expect(ack.getAcknowledgementRange()).andReturn(ranges);
+        EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges);
         control.replay();
         assertTrue("all predecessors acknowledged", !ds.allPredecessorsAcknowledged(BigInteger.TEN));
         control.verify();
     }
     
     private void setUpDestination() {
-        setUpDestination(false);
+        setUpDestination(null);
     }
     
-    private void setUpDestination(boolean withTimer) {
+    private void setUpDestination(Timer timer) {
         
         interceptor = control.createMock(RMInterceptor.class);
 
@@ -573,22 +566,15 @@
         bri.setMilliseconds(new BigInteger("3000"));
         rma.setBaseRetransmissionInterval(bri);  
 
-        interceptor.getRMAssertion();
-        expectLastCall().andReturn(rma).anyTimes();
-        interceptor.getDestinationPolicy();
-        expectLastCall().andReturn(dp).anyTimes();
-        
-        interceptor.getStore();
-        expectLastCall().andReturn(null).anyTimes();
+        EasyMock.expect(interceptor.getRMAssertion()).andReturn(rma).anyTimes();
+        EasyMock.expect(interceptor.getDestinationPolicy()).andReturn(dp).anyTimes();
+        EasyMock.expect(interceptor.getStore()).andReturn(null).anyTimes();
         
         destination = control.createMock(Destination.class);
-        destination.getInterceptor();
-        expectLastCall().andReturn(interceptor).anyTimes();
+        EasyMock.expect(destination.getInterceptor()).andReturn(interceptor).anyTimes();
         
-        if (withTimer) {
-            Timer timer = new Timer();
-            interceptor.getTimer();
-            expectLastCall().andReturn(timer).anyTimes();
+        if (null != timer) {
+            EasyMock.expect(interceptor.getTimer()).andReturn(timer).anyTimes();
         }
 
     }

Added: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/ProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/ProxyTest.java?view=auto&rev=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/ProxyTest.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/ProxyTest.java Tue Oct 17 05:42:32 2006
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.ws.rm.impl;
+
+
+import java.util.List;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.cxf.CXFBusFactory;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+
+public class ProxyTest extends TestCase {
+
+    public void testConstruction() {
+        Bus bus = new CXFBusFactory().createBus();
+        IMocksControl control = EasyMock.createNiceControl();
+        RMEndpoint rme = control.createMock(RMEndpoint.class);
+        Proxy proxy = new Proxy(bus, rme);
+        Service service = proxy.getService();
+        ServiceInfo si = service.getServiceInfo();
+        assertNotNull("service info is null", si);
+
+        InterfaceInfo intf = si.getInterface();
+        
+        assertEquals(3, intf.getOperations().size());
+        
+        String ns = si.getName().getNamespaceURI();
+        OperationInfo opi = intf.getOperation(new QName(ns, "createSequence"));
+        assertEquals("createSequence", opi.getInput().getName().getLocalPart());
+        
+        List<MessagePartInfo> messageParts = opi.getInput().getMessageParts();
+        assertEquals(1, messageParts.size());
+        MessagePartInfo mpi = messageParts.get(0);
+        System.out.println("name of first part of input message: " + mpi.getName().getLocalPart());
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/ProxyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/ProxyTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java?view=diff&rev=464918&r1=464917&r2=464918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java Tue Oct 17 05:42:32 2006
@@ -30,12 +30,34 @@
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.ws.addressing.MAPAggregator;
+import org.apache.cxf.ws.rm.RetransmissionQueue;
 import org.apache.cxf.ws.rm.interceptor.SequenceTerminationPolicyType;
 import org.apache.cxf.ws.rm.interceptor.SourcePolicyType;
+import org.apache.cxf.ws.rm.persistence.RMStore;
 import org.apache.cxf.ws.rm.policy.RMAssertion;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
 
 public class RMInterceptorTest extends TestCase {
    
+    public void testAccessors() {
+        RMInterceptor rmi = new RMInterceptor();
+        assertNull(rmi.getStore());
+        assertNull(rmi.getRetransmissionQueue());
+        assertNotNull(rmi.getTimer());
+        
+        IMocksControl control = EasyMock.createNiceControl();
+        RMStore store = control.createMock(RMStore.class);
+        RetransmissionQueue queue = control.createMock(RetransmissionQueue.class);
+        
+        rmi.setStore(store);
+        rmi.setRetransmissionQueue(queue);
+        assertSame(store, rmi.getStore());
+        assertSame(queue, rmi.getRetransmissionQueue());
+  
+        
+        
+    }
     
     public void testInitialisation() {
         RMInterceptor rmi = new RMInterceptor();
@@ -80,9 +102,13 @@
         chain.add(map);
         Iterator it = chain.iterator();
         assertSame("Unexpected order.", map, it.next());
-        assertSame("Unexpected order.", rmi, it.next());
-        
-        
-        
+        assertSame("Unexpected order.", rmi, it.next());                      
+    }    
+    
+    public void testAddAcknowledgement() {
+        // MInterceptor rmi = new RMInterceptor();
+        IMocksControl control = EasyMock.createNiceControl();
+        control.createMock(Source.class);
+         
     }
 }



Mime
View raw message