cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r454689 [1/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/phase/ common/common/src/main/java/org/apache/cxf/jaxb/ common/metacode/src/main/resources/schemas/wsdl/ rt/ws/rm/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ r...
Date Tue, 10 Oct 2006 10:48:16 GMT
Author: andreasmyth
Date: Tue Oct 10 03:48:13 2006
New Revision: 454689

URL: http://svn.apache.org/viewvc?view=rev&rev=454689
Log:
[JIRA CXF-138] Start of logical RM interceptor.
[JIRA CXF-141] Completely decoupled default value handling from config bean generation in xjc plugins. Cfg bean getters to reuse body of default getter and distinguish between default and injected value.

Added:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java   (with props)
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/Messages.properties   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImpl.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Messages.properties   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Names.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMConstantsImpl.java   (with props)
    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/RMInterceptor.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceMonitor.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-interceptor.xsd   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-policy.xjb   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/test/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java   (with props)
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    incubator/cxf/trunk/common/metacode/src/main/resources/schemas/wsdl/addressing.xjb
    incubator/cxf/trunk/rt/ws/rm/pom.xml
    incubator/cxf/trunk/tools/xjc/cfg-test/pom.xml
    incubator/cxf/trunk/tools/xjc/cfg-test/src/test/java/org/apache/cxf/xjc/cfg/ConfigurableBeansPluginTest.java
    incubator/cxf/trunk/tools/xjc/cfg-test/src/test/resources/schemas/configuration/foo.xsd
    incubator/cxf/trunk/tools/xjc/cfg/src/main/java/org/apache/cxf/xjc/cfg/ConfigurableBeansPlugin.java
    incubator/cxf/trunk/tools/xjc/dv-test/pom.xml
    incubator/cxf/trunk/tools/xjc/dv-test/src/test/java/org/apache/cxf/xjc/dv/DefaultValueTest.java
    incubator/cxf/trunk/tools/xjc/dv-test/src/test/resources/schemas/configuration/foo.xsd
    incubator/cxf/trunk/tools/xjc/dv/pom.xml
    incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?view=diff&rev=454689&r1=454688&r2=454689
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Tue Oct 10 03:48:13 2006
@@ -85,7 +85,7 @@
 
     @SuppressWarnings("unchecked")
     public void add(Interceptor i) {
-        AbstractPhaseInterceptor pi = (AbstractPhaseInterceptor)i;
+        PhaseInterceptor pi = (PhaseInterceptor)i;
 
         if (LOG.isLoggable(Level.FINE)) {
             LOG.fine("Adding interceptor " + i + " to phase " + pi.getPhase());
@@ -182,7 +182,7 @@
     }
     
 
-    protected void insertInterceptor(List<Interceptor> intercs, AbstractPhaseInterceptor interc) {
+    protected void insertInterceptor(List<Interceptor> intercs, PhaseInterceptor interc) {
         if (intercs.size() == 0) {
             intercs.add(interc);
             return;

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java Tue Oct 10 03:48:13 2006
@@ -0,0 +1,54 @@
+/**
+ * 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.jaxb;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.Duration;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+/**
+ * Utility class to construct javax.xml.datatype.Duration objects.
+ *
+ */
+public final class DatatypeFactory {
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(DatatypeFactory.class);
+    
+    /**
+     * prevents instantiation
+     *
+     */
+    private DatatypeFactory() {
+        
+    }
+
+    public static Duration createDuration(String s) {
+        try {
+            return javax.xml.datatype.DatatypeFactory.newInstance().newDuration(s);
+        } catch (DatatypeConfigurationException ex) {
+            LogUtils.log(LOG, Level.SEVERE, "DATATYPE_FACTORY_INSTANTIATION_EXC", ex);
+        }
+        return null;
+    }
+}

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/Messages.properties?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/Messages.properties (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/Messages.properties Tue Oct 10 03:48:13 2006
@@ -0,0 +1 @@
+DATATYPE_FACTORY_INSTANTIATION_EXC = Failed to create DatatypeFactory.
\ No newline at end of file

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/cxf/trunk/common/metacode/src/main/resources/schemas/wsdl/addressing.xjb
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/metacode/src/main/resources/schemas/wsdl/addressing.xjb?view=diff&rev=454689&r1=454688&r2=454689
==============================================================================
--- incubator/cxf/trunk/common/metacode/src/main/resources/schemas/wsdl/addressing.xjb (original)
+++ incubator/cxf/trunk/common/metacode/src/main/resources/schemas/wsdl/addressing.xjb Tue Oct 10 03:48:13 2006
@@ -1,3 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  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.
+-->
 <jaxb:bindings version="1.0" 
   xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
   xmlns:xs="http://www.w3.org/2001/XMLSchema" 

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=454689&r1=454688&r2=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/pom.xml (original)
+++ incubator/cxf/trunk/rt/ws/rm/pom.xml Tue Oct 10 03:48:13 2006
@@ -41,10 +41,25 @@
         </dependency> 
         <dependency>
             <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-policy</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-ws-addr</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <!--
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-common-utilities</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
@@ -56,22 +71,14 @@
             <scope>test</scope>
         </dependency>
 
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
+        <!--
+
         <dependency>
             <groupId>javax.xml.ws</groupId>
             <artifactId>jaxws-api</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-common-utilities</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-bindings-soap</artifactId>
             <version>${project.version}</version>
         </dependency>
@@ -107,8 +114,13 @@
                                 </deleteDirs>
                             </xsdOption>
                             <xsdOption>
-                                <xsd>${basedir}/src/main/resources/schemas/configuration/wsrm-policy.xsd</xsd>
-                                    <packagename>org.apache.cxf.ws.rm.policy</packagename>
+                                <xsd>${basedir}/src/main/resources/schemas/configuration/wsrm-interceptor.xsd</xsd>
+                                <bindingFile>${basedir}/src/main/resources/schemas/configuration/wsrm-policy.xjb</bindingFile>
+                                <extension>true</extension>
+                                <extensionArgs>
+                                    <extensionArg>-Xdv</extensionArg>
+                                    <extensionArg>-Xcfg</extensionArg>
+                                </extensionArgs>`
                                 </xsdOption>
                             </xsdOptions>
                         </configuration>
@@ -134,6 +146,16 @@
                         <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>

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImpl.java?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImpl.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/AbstractSequenceImpl.java Tue Oct 10 03:48:13 2006
@@ -0,0 +1,81 @@
+/**
+ * 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.math.BigInteger;
+
+import org.apache.cxf.ws.rm.Identifier;
+import org.apache.cxf.ws.rm.SequenceAcknowledgement;
+import org.apache.cxf.ws.rm.SequenceAcknowledgement.AcknowledgementRange;
+
+
+public abstract class AbstractSequenceImpl {
+    
+    protected final Identifier id;
+    protected SequenceAcknowledgement acked;
+    
+    protected AbstractSequenceImpl(Identifier i) {
+        id = i;
+    }
+    
+    /**
+     * @return the sequence identifier
+     */
+    public Identifier getIdentifier() {
+        return id;
+    }
+    
+    public String toString() {
+        return id.getValue();
+    }
+    
+    public boolean equals(Object other) {
+        if (other == this) {
+            return true;            
+        }
+        if (other instanceof AbstractSequenceImpl) {
+            AbstractSequenceImpl otherSeq = (AbstractSequenceImpl)other;
+            return otherSeq.getIdentifier().getValue().equals(getIdentifier().getValue());
+        }        
+        return false;
+    }
+    
+    public int hashCode() {
+        return getIdentifier().getValue().hashCode();
+    }
+    
+    static boolean identifierEquals(Identifier id1, Identifier id2) {
+        if (null == id1) {
+            return null == id2;
+        } else {
+            return null != id2 && id1.getValue().equals(id2.getValue());
+        }
+    }
+    
+    public synchronized boolean isAcknowledged(BigInteger m) {
+        for (AcknowledgementRange r : acked.getAcknowledgementRange()) {
+            if (m.subtract(r.getLower()).signum() >= 0 && r.getUpper().subtract(m).signum() >= 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+   
+}

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

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

Added: 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=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java Tue Oct 10 03:48:13 2006
@@ -0,0 +1,60 @@
+/**
+ * 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.UUID;
+
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+
+/**
+ * Holder for utility methods relating to contexts.
+ */
+public final class ContextUtils {
+
+    /**
+     * Used to fabricate a Uniform Resource Name from a UUID string
+     */
+    private static final String URN_UUID = "urn:uuid:";
+
+    /**
+     * Prevents instantiation.
+     */
+    private ContextUtils() {
+    }
+
+    /**
+     * @return a generated UUID
+     */
+    static String generateUUID() {
+        return URN_UUID + UUID.randomUUID();
+    }
+
+    /**
+     * Determine if message is outbound.
+     * 
+     * @param message the current Message
+     * @return true iff the message direction is outbound
+     */
+    static boolean isOutbound(Message message) {
+        Exchange exchange = message.getExchange();
+        return message != null && exchange != null && message == exchange.getOutMessage();
+    }
+}

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

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

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Messages.properties?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Messages.properties (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Messages.properties Tue Oct 10 03:48:13 2006
@@ -0,0 +1,16 @@
+RM_INVOCATION_FAILED = Invocation of RM protocol operation failed.
+SEQ_TERMINATION_FAILURE = Failed to terminate sequence {0}.
+
+STANDALONE_ANON_ACKS_NOT_SUPPORTED = It is not possible to send out-of-band acknowledgment to the anonymous address.\nAn acknowledgement will be piggybacked on the next response. 
+
+POLICY_PROVIDER_CREATION_EXC = Failed to create provider for RM assertion.
+POLICY_REFERENCE_RESOLUTION_EXC = Policy reference {0} cannot be resolved.
+UNKNOWN_SEQUENCE_EXC = Unknown sequence {0}.
+LAST_MESSAGE_NUMBER_EXCEEDED_EXC = Last message number exceeded in sequence {0}.
+LAST_MESSAGE_SEND_EXC = Failed to send an last message for sequence {0}.
+SEQ_ACK_SEND_EXC = Failed to send an acknowledgment for sequence {0}.
+ACK_REQUESTED_SEND_EXC = Failed to send a sequence acknowledgment request.
+RMASSERTION_UNMARSHAL_EXC = Failed to unmarshal RMAssertion element.
+
+MESSAGE_ALREADY_DELIVERED = Message with number {0} in sequence {1} has already been delivered.
+

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

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

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Names.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Names.java?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Names.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Names.java Tue Oct 10 03:48:13 2006
@@ -0,0 +1,128 @@
+/**
+ * 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.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Holder for WS-RM names (of headers, namespaces etc.).
+ */
+public final class Names {
+   
+    static final String WSRM_NAMESPACE_NAME = 
+        "http://schemas.xmlsoap.org/ws/2005/02/rm";
+    
+    static final String WSRMP_NAMESPACE_NAME = 
+        "http://schemas.xmlsoap.org/ws/2005/02/rm/policy";
+    
+    static final String WSA_NAMESPACE_NAME = 
+        "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+    
+    static final String WSRM_NAMESPACE_PREFIX = "wsrm";
+    
+    static final String WSRM_WSDL_NAMESPACE_NAME = 
+        WSRM_NAMESPACE_NAME + "/wsdl";
+    
+    static final String CELTIX_WSRM_NAMESPACE_NAME = 
+        "http://celtix.objectweb.org/ws/rm";
+    
+    static final String CELTIX_WSRM_WSDL_NAMESPACE_NAME = 
+        CELTIX_WSRM_NAMESPACE_NAME + "/wsdl";
+    
+    static final String WSRM_CREATE_SEQUENCE_ACTION =
+        WSRM_NAMESPACE_NAME + "/CreateSequence";
+    
+    static final String WSRM_CREATE_SEQUENCE_RESPONSE_ACTION =
+        WSRM_NAMESPACE_NAME + "/CreateSequenceResponse";
+    
+    static final String WSRM_TERMINATE_SEQUENCE_ACTION =
+        WSRM_NAMESPACE_NAME + "/TerminateSequence";
+    
+    static final String WSRM_LAST_MESSAGE_ACTION =
+        WSRM_NAMESPACE_NAME + "/LastMessage";
+    
+    static final String WSRM_SEQUENCE_ACKNOWLEDGMENT_ACTION =
+        WSRM_NAMESPACE_NAME + "/SequenceAcknowledgement";
+    
+    static final String WSRM_SEQUENCE_INFO_ACTION =
+        CELTIX_WSRM_NAMESPACE_NAME + "/SequenceInfo";
+    
+    static final String WSRM_UNKNOWN_SEQUENCE_FAULT_CODE =
+        "UnknownSequence";
+    
+    static final String WSRM_SEQUENCE_TERMINATED_FAULT_CODE =
+        "SequenceTerminated";
+    
+    static final String WSRM_INVALID_ACKNOWLEDGMENT_FAULT_CODE =
+        "InvalidAcknowledgement";
+    
+    static final String WSRM_MESSAGE_NUMBER_ROLLOVER_FAULT_CODE =
+        "MessageNumberRollover";
+    
+    static final String WSRM_CREATE_SEQUENCE_REFUSED_FAULT_CODE =
+        "CreateSequenceRefused";
+    
+    static final String WSRM_LAST_MESSAGE_NUMBER_EXCEEDED_FAULT_CODE =
+        "LastMessageNumberExceeded";
+    
+    static final String WSRM_SEQUENCE_NAME =
+        "Sequence";
+    
+    static final QName WSRM_SEQUENCE_QNAME =
+        new QName(WSRM_NAMESPACE_NAME, WSRM_SEQUENCE_NAME);
+    
+    static final String WSRM_SEQUENCE_ACK_NAME =
+        "SequenceAcknowledgement";
+    
+    static final QName WSRM_SEQUENCE_ACK_QNAME =
+        new QName(WSRM_NAMESPACE_NAME, WSRM_SEQUENCE_ACK_NAME);
+    
+    static final String WSRM_ACK_REQUESTED_NAME =
+        "AckRequested";
+    
+    static final QName WSRM_ACK_REQUESTED_QNAME =
+        new QName(WSRM_NAMESPACE_NAME, WSRM_ACK_REQUESTED_NAME);
+    
+    static final String WSA_ANONYMOUS_ADDRESS = 
+        WSA_NAMESPACE_NAME + "/anonymous";
+    static final String WSA_NONE_ADDRESS =
+        WSA_NAMESPACE_NAME + "/none";
+    
+    
+    /**
+     * The set of headers understood by the protocol binding.
+     */
+    static final Set<QName> HEADERS;
+    static {
+        Set<QName> headers = new HashSet<QName>();
+        headers.add(WSRM_SEQUENCE_QNAME);
+        headers.add(WSRM_SEQUENCE_ACK_QNAME);
+        headers.add(WSRM_ACK_REQUESTED_QNAME);
+        HEADERS = Collections.unmodifiableSet(headers);
+    }
+    
+    private Names() {
+    }
+}

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

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

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMConstantsImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMConstantsImpl.java?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMConstantsImpl.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMConstantsImpl.java Tue Oct 10 03:48:13 2006
@@ -0,0 +1,97 @@
+/**
+ * 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.ws.rm.RMConstants;
+
+/**
+ * Encapsulation of version-specific WS-RM constants.
+ */
+public class RMConstantsImpl implements RMConstants {
+
+    RMConstantsImpl() {
+    }
+    
+    public String getNamespaceURI() {
+        return Names.WSRM_NAMESPACE_NAME;
+    }
+     
+    public String getRMPolicyNamespaceURI() {
+        return Names.WSRMP_NAMESPACE_NAME;
+    }
+
+
+
+    public String getWSDLNamespaceURI() {
+        return Names.WSRM_WSDL_NAMESPACE_NAME;
+    }
+    
+    public String getCreateSequenceAction() {
+        return Names.WSRM_CREATE_SEQUENCE_ACTION;
+    }
+
+    public String getCreateSequenceResponseAction() {
+        return Names.WSRM_CREATE_SEQUENCE_RESPONSE_ACTION;
+    }
+    
+    public String getTerminateSequenceAction() {
+        return Names.WSRM_TERMINATE_SEQUENCE_ACTION;
+    }
+    
+    public String getLastMessageAction() {
+        return Names.WSRM_LAST_MESSAGE_ACTION;
+    }
+    
+    public String getSequenceAcknowledgmentAction() {
+        return Names.WSRM_SEQUENCE_ACKNOWLEDGMENT_ACTION;
+    }
+    
+    public String getSequenceInfoAction() {
+        return Names.WSRM_SEQUENCE_INFO_ACTION;
+    }
+    
+    public QName getUnknownSequenceFaultCode() {
+        return new QName(Names.WSRM_NAMESPACE_NAME, Names.WSRM_UNKNOWN_SEQUENCE_FAULT_CODE);
+    }
+        
+    public QName getSequenceTerminatedFaultCode() {
+        return new QName(Names.WSRM_NAMESPACE_NAME, Names.WSRM_SEQUENCE_TERMINATED_FAULT_CODE);
+    }
+        
+    public QName getInvalidAcknowledgmentFaultCode() {
+        return new QName(Names.WSRM_NAMESPACE_NAME, Names.WSRM_INVALID_ACKNOWLEDGMENT_FAULT_CODE);
+    }
+  
+    public QName getMessageNumberRolloverFaultCode() {
+        return new QName(Names.WSRM_NAMESPACE_NAME, Names.WSRM_MESSAGE_NUMBER_ROLLOVER_FAULT_CODE);
+    }
+    
+    public QName getCreateSequenceRefusedFaultCode() {
+        return new QName(Names.WSRM_NAMESPACE_NAME, Names.WSRM_CREATE_SEQUENCE_REFUSED_FAULT_CODE);
+    }
+    
+    public QName getLastMessageNumberExceededFaultCode() {
+        return new QName(Names.WSRM_NAMESPACE_NAME, Names.WSRM_LAST_MESSAGE_NUMBER_EXCEEDED_FAULT_CODE);
+    }
+    
+}

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

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

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=454689
==============================================================================
--- 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 10 03:48:13 2006
@@ -0,0 +1,47 @@
+/**
+ * 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.Identifier;
+
+public class RMEndpoint {
+    
+    private RMInterceptor handler;
+    
+    protected RMEndpoint(RMInterceptor h) {
+        handler = h;
+    }
+        
+    public RMInterceptor getHandler() {
+        return handler;
+    }
+    
+    /**
+     * Generates and returns a new sequence identifier.
+     * 
+     * @return the sequence identifier.
+     */
+    public Identifier generateSequenceIdentifier() {
+        String sequenceID = ContextUtils.generateUUID();
+        Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
+        sid.setValue(sequenceID);        
+        return sid;
+    }
+}

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

Added: 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=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java Tue Oct 10 03:48:13 2006
@@ -0,0 +1,597 @@
+/**
+ * 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.math.BigInteger;
+import java.util.Collections;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptor;
+import org.apache.cxf.ws.addressing.MAPAggregator;
+import org.apache.cxf.ws.rm.interceptor.DeliveryAssuranceType;
+import org.apache.cxf.ws.rm.interceptor.DestinationPolicyType;
+import org.apache.cxf.ws.rm.interceptor.RMInterceptorConfigBean;
+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.apache.cxf.ws.rm.policy.RMAssertion.BaseRetransmissionInterval;
+
+/**
+ * Interceptor resposible for implementing exchange of RM protocol messages,
+ * aggregating the RM metadata in the application message and processing the 
+ * RM metadata contained in incoming application messages.
+ * The same interceptor can be used on multiple endpoints.
+ *
+ */
+public class RMInterceptor extends RMInterceptorConfigBean implements PhaseInterceptor<Message> {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(RMInterceptor.class);
+      
+    private RMStore store;
+    private Set<String> after = Collections.singleton(MAPAggregator.class.getName());
+    
+    public RMStore getStore() {
+        return store;
+    }
+
+    public void setStore(RMStore store) {
+        this.store = store;
+    }
+    
+    // PhaseInterceptor interface
+    
+    public Set<String> getAfter() {
+        return after;
+    }
+
+    public Set<String> getBefore() {
+        return CastUtils.cast(Collections.EMPTY_SET);
+    }
+
+    public String getId() {
+        return RMInterceptor.class.getName();
+    }
+
+    public String getPhase() {
+        return Phase.PRE_LOGICAL;
+    }
+
+    
+    public void handleMessage(Message msg) throws Fault {
+        if (ContextUtils.isOutbound(msg)) {
+            handleOutbound(msg, false);        
+        } else {
+            handleInbound(msg, false);
+        }
+    }
+    
+    public void handleFault(Message msg) {
+        if (ContextUtils.isOutbound(msg)) {
+            handleOutbound(msg, true);        
+        } else {
+            handleInbound(msg, true);
+        }
+    }
+    
+    void handleOutbound(Message message, boolean isFault) {
+        LOG.entering(getClass().getName(), "handleOutbound");
+    }
+    
+    void handleInbound(Message message, boolean isFault) {
+        LOG.entering(getClass().getName(), "handleInbound");
+    }
+    
+    @PostConstruct
+    void initialise() {
+        if (!isSetRMAssertion()) {
+            org.apache.cxf.ws.rm.policy.ObjectFactory factory = 
+                new org.apache.cxf.ws.rm.policy.ObjectFactory();
+            RMAssertion rma = factory.createRMAssertion();
+            BaseRetransmissionInterval bri = factory.createRMAssertionBaseRetransmissionInterval();
+            bri.setMilliseconds(new BigInteger("3000"));
+            rma.setBaseRetransmissionInterval(bri);
+            rma.setExponentialBackoff(factory.createRMAssertionExponentialBackoff());
+            setRMAssertion(rma);
+        }
+        org.apache.cxf.ws.rm.interceptor.ObjectFactory factory = 
+            new org.apache.cxf.ws.rm.interceptor.ObjectFactory();
+        if (!isSetDeliveryAssurance()) {
+            DeliveryAssuranceType da = factory.createDeliveryAssuranceType();
+            da.setAtLeastOnce(factory.createDeliveryAssuranceTypeAtLeastOnce());
+            setDeliveryAssurance(da);
+        }
+        if (!isSetSourcePolicy()) {
+            SourcePolicyType sp = factory.createSourcePolicyType();
+            sp.setSequenceTerminationPolicy(factory.createSequenceTerminationPolicyType());
+            setSourcePolicy(sp);
+        }
+        if (!isSetDestinationPolicy()) {
+            DestinationPolicyType dp = factory.createDestinationPolicyType();
+            dp.setAcksPolicy(factory.createAcksPolicyType());
+            setDestinationPolicy(dp);
+        }
+    }
+
+
+    /*
+    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());       
+    }
+
+    void addAcknowledgements(RMPropertiesImpl rmpsOut, Identifier inSeqId, AttributedURI to) {
+
+        for (DestinationSequence seq : getDestination().getAllSequences()) {
+            if (seq.sendAcknowledgement()
+                && ((seq.getAcksTo().getAddress().getValue().equals(RMUtils.getAddressingConstants()
+                    .getAnonymousURI()) && AbstractSequenceImpl.identifierEquals(seq.getIdentifier(), 
+                                                                                inSeqId))
+                    || to.getValue().equals(seq.getAcksTo().getAddress().getValue()))) {
+                rmpsOut.addAck(seq);
+            } else if (LOG.isLoggable(Level.FINE)) {
+                if (!seq.sendAcknowledgement()) {
+                    LOG.fine("no need to add an acknowledgements for sequence "
+                             + seq.getIdentifier().getValue());
+                } else {
+                    LOG.fine("sequences acksTo (" + seq.getAcksTo().getAddress().getValue()
+                             + ") does not match to (" + to.getValue() + ")");
+                }
+            }
+        }
+
+        if (LOG.isLoggable(Level.FINE)) {
+            Collection<SequenceAcknowledgement> acks = rmpsOut.getAcks();
+            if (null == acks) {
+                LOG.fine("No acknowledgements added");
+            } else {
+                LOG.fine("Added " + acks.size() + " acknowledgements.");
+            }
+        }
+    }
+    
+    private SourceSequence getSequence(Identifier inSeqId, 
+                                 LogicalMessageContext context, 
+                                 AddressingPropertiesImpl maps) throws SequenceFault {
+        SourceSequence seq = getSource().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);
+                } else {
+                    acksTo = VersionTransformer.convert(maps.getReplyTo());
+                    // for oneways
+                    if (Names.WSA_NONE_ADDRESS.equals(acksTo.getAddress().getValue())) {
+                        acksTo = RMUtils.createReference(Names.WSA_ANONYMOUS_ADDRESS);
+                    }
+                }
+
+                getProxy().createSequence(getSource(), to, acksTo, relatesTo);
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+
+            seq = getSource().awaitCurrent(inSeqId);
+            seq.setTarget(to);
+        }
+        
+        return seq;
+    }
+   
+    protected void setInitialised(ConfigurationHelper ch,
+                                  RMSource s,
+                                  RMDestination d,
+                                  Timer t,
+                                  boolean registered
+                                  ) {
+        configurationHelper = ch;
+        source = s;
+        destination = d;
+        timer = t;
+        busLifeCycleListenerRegistered = registered;
+        initialise();
+    }
+    */
+    
+}

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

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

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java Tue Oct 10 03:48:13 2006
@@ -0,0 +1,89 @@
+/**
+ * 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.addressing.AddressingConstants;
+import org.apache.cxf.ws.addressing.AddressingConstantsImpl;
+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.policy.PolicyConstants;
+import org.apache.cxf.ws.policy.PolicyConstantsImpl;
+import org.apache.cxf.ws.rm.RMConstants;
+// import org.apache.cxf.ws.rm.persistence.PersistenceUtils;
+
+public final class RMUtils {
+   
+    private static final org.apache.cxf.ws.addressing.v200408.ObjectFactory WSA_FACTORY;
+    private static final org.apache.cxf.ws.rm.ObjectFactory WSRM_FACTORY;
+    private static final RMConstants WSRM_CONSTANTS;
+    private static final AddressingConstants WSA_CONSTANTS; 
+    private static final PolicyConstants WSP_CONSTANTS;
+    // private static final PersistenceUtils WSRM_PERSISTENCE_UTILS;
+    
+    static {
+        WSA_FACTORY = new org.apache.cxf.ws.addressing.v200408.ObjectFactory();
+        WSRM_FACTORY = new org.apache.cxf.ws.rm.ObjectFactory();
+        WSRM_CONSTANTS = new RMConstantsImpl();        
+        WSA_CONSTANTS = new AddressingConstantsImpl();
+        WSP_CONSTANTS = new PolicyConstantsImpl();
+        // WSRM_PERSISTENCE_UTILS = new PersistenceUtils();       
+    }
+    
+    protected RMUtils() {        
+    }
+    
+    public static org.apache.cxf.ws.addressing.v200408.ObjectFactory getWSAFactory() {
+        return WSA_FACTORY;
+    }
+    
+    public static org.apache.cxf.ws.rm.ObjectFactory getWSRMFactory() {
+        return WSRM_FACTORY;
+    }
+    
+    public static RMConstants getRMConstants() {
+        return WSRM_CONSTANTS;
+    }
+    
+    public static AddressingConstants getAddressingConstants() {
+        return WSA_CONSTANTS;
+    }
+    
+    public static PolicyConstants getPolicyConstants() {
+        return WSP_CONSTANTS;
+    }
+    
+    /*
+    public static PersistenceUtils getPersistenceUtils() {
+        return WSRM_PERSISTENCE_UTILS;
+    }
+    */
+    
+    public static EndpointReferenceType createReference(String address) {
+        EndpointReferenceType ref = 
+            VersionTransformer.Names200408.WSA_OBJECT_FACTORY.createEndpointReferenceType();
+        AttributedURI value =
+            VersionTransformer.Names200408.WSA_OBJECT_FACTORY.createAttributedURI();
+        value.setValue(address);
+        ref.setAddress(value);
+        return ref;
+    }
+}

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

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

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceMonitor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceMonitor.java?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceMonitor.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceMonitor.java Tue Oct 10 03:48:13 2006
@@ -0,0 +1,70 @@
+/**
+ * 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.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+public class SequenceMonitor {
+
+    private static final long DEFAULT_MONITOR_INTERVAL = 60000L;
+    private static final Logger LOG = LogUtils.getL7dLogger(SequenceMonitor.class);
+    private long monitorInterval = DEFAULT_MONITOR_INTERVAL;
+    private long firstCheck;
+    private List<Long> receiveTimes = new ArrayList<Long>();
+
+    public void acknowledgeMessage() {
+        long now = System.currentTimeMillis();
+        if (0 == firstCheck) {
+            firstCheck = now + monitorInterval;
+        }
+        receiveTimes.add(new Long(now));
+    }
+
+    public int getMPM() {
+        long now = System.currentTimeMillis();
+        int mpm = 0;
+        if (firstCheck > 0 && now >= firstCheck) {
+            long threshold = now - monitorInterval;
+            while (!receiveTimes.isEmpty()) {
+                if (receiveTimes.get(0).longValue() <= threshold) {
+                    receiveTimes.remove(0);
+                } else {
+                    break;
+                }
+            }
+            mpm = receiveTimes.size();
+        } 
+        
+        return mpm;
+    }
+    
+    protected void setMonitorInterval(long i) {
+        if (receiveTimes.size() == 0) {
+            firstCheck = 0;
+            monitorInterval = i;
+        } else {
+            LOG.warning("Cannot change monitor interval at this point.");
+        }
+    }
+}

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

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

Added: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-interceptor.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-interceptor.xsd?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-interceptor.xsd (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-interceptor.xsd Tue Oct 10 03:48:13 2006
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+
+<xs:schema targetNamespace="http://cxf.apache.org/ws/rm/interceptor" 
+           xmlns:tns="http://cxf.apache.org/ws/rm/interceptor"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+           xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" 
+           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+           xmlns:cfg="http://cxf.apache.org/configuration/cfg"
+           elementFormDefault="qualified" 
+           attributeFormDefault="unqualified"
+           jaxb:extensionBindingPrefixes="cfg"
+           jaxb:version="2.0">
+
+    <xs:import namespace="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" schemaLocation="wsrm-policy.xsd"/>
+
+    <xs:complexType name="SourcePolicyType">
+        <xs:annotation>
+            <xs:documentation>RM source configuration properties. 
+            Used for configuring an RM source.
+            </xs:documentation>
+        </xs:annotation>
+        
+       <xs:sequence>  
+            <xs:element name="sequenceTerminationPolicy" type="tns:SequenceTerminationPolicyType" minOccurs="0"/>
+       </xs:sequence>
+        
+        <xs:attribute name="sequenceExpiration" type="xs:duration" use="optional" default="PT0S">
+            <xs:annotation>
+                <xs:documentation>
+                    Preferred lifetime of a sequence - included in createSequence 
+                    requests issued by an RM source. 
+                    A default of PT0S means that the sequence should never expire.
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute>
+        <xs:attribute name="acksTo" type="xs:string" use="optional">
+            <xs:annotation>
+                <xs:documentation>
+                    Address to which sequence acknowledgements should be sent. 
+                    If this attribute is not set, defaults to the anonymous address.
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute>
+        <xs:attribute name="includeOffer" type="xs:boolean" use="optional" default="true">
+            <xs:annotation>
+                <xs:documentation>
+                    Indicates if an RM source should include an offer for an inbound sequence
+                    when issuing a createSequence request.
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute>
+        <xs:attribute name="offeredSequenceExpiration" type="xs:duration" use="optional" default="PT0S">
+            <xs:annotation>
+                <xs:documentation>
+                    The lifetime of an offered inbound sequence.
+                    A default of PT0S means that the sequence never expires.
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute>
+    </xs:complexType>
+    
+    <xs:complexType name="DestinationPolicyType">
+        <xs:annotation>
+            <xs:documentation>RM destination configuration properties. 
+            Used for configuring an RM destination.
+            </xs:documentation>
+        </xs:annotation>
+
+        <xs:sequence>  
+            <xs:element name="acksPolicy" type="tns:AcksPolicyType" minOccurs="0"/>
+        </xs:sequence>
+        
+        <xs:attribute name="sequenceExpiration" type="xs:duration" use="optional" default="PT0S">
+            <xs:annotation>
+                <xs:documentation>
+                    Preferred lifetime of a sequence - can be lower than the duration
+                    requested by the RM source in a CreateSequence request. 
+                    A default of PT0S means that the sequence should never expire.
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute>
+        
+        <xs:attribute name="acceptOffers" type="xs:boolean" use="optional" default="true">
+            <xs:annotation>
+                <xs:documentation>
+                    Indicates if an RM destination should accept inbound sequence offers.
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute>
+        
+    </xs:complexType>
+
+    <xs:complexType name="SequenceTerminationPolicyType">    
+        <xs:attribute name="maxLength" type="xs:unsignedLong" use="optional" default="0">
+            <xs:annotation>
+                <xs:documentation>
+                    The maximum length of a sequence. 
+                    A value of 0 means the sequence length is unbound.
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute> 
+        <xs:attribute name="maxRanges" type="xs:int" use="optional" default="0">
+            <xs:annotation>
+                <xs:documentation>
+                    The maximum number of acknowledgment ranges tolerated in sequence
+                    acknowledgment. When this value is exceeded the sequence
+                    will be terminated. 
+                    A value of 0 means sequence termination does not depend on
+                    the number of acknowledgment ranges.
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute>
+        <xs:attribute name="maxUnacknowledged" type="xs:int" use="optional" default="0">
+            <xs:annotation>
+                <xs:documentation>
+                    The maximum number of unacknowledged messages that can accrue within per
+                    sequence before the sequence is terminated.
+                    A value of 0 means sequence termination does not depend on
+                    the number of unacknowledgment messages.
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute>
+        <xs:attribute name="terminateOnShutdown" type="xs:boolean" use ="optional" default="false">
+        <xs:annotation>
+                <xs:documentation>
+                    Specifies if sequences should be terminated when the bus is shutdown.
+                    If set to true, and no last message had been sent for a sequence,
+                    an out of band LastMessage will be issued (in response to which 
+                    a sequence acknowledgment will be sent). If a last message had already been
+                    sent, an acknowledgment is requested instead. 
+                    If, after processing these acknowledgement, all messages have been acknowledged,
+                    an attempt is then made to terminates these sequences.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+    </xs:complexType>
+    
+    <xs:complexType name="AcksPolicyType">    
+        <xs:attribute name="intraMessageThreshold" type="xs:int" use="optional" default="10">
+            <xs:annotation>
+                <xs:documentation>
+                    Restricts the deferred sending of acknowledgments to the case where the stream of incoming 
+                    messages is steady, i.e. the number of messages for one destination per minute stays above the 
+                    specified threshold (only effective if the AcknowledgmentInterval specified in the
+                    RMAssertion is greater 0).
+                </xs:documentation>
+            </xs:annotation>      
+        </xs:attribute> 
+    </xs:complexType>
+    
+    <xs:complexType name="DeliveryAssuranceType">
+        <xs:sequence>
+            <xs:element name="AtMostOnce" minOccurs="0">
+                <xs:complexType>
+                    <xs:sequence/>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="AtLeastOnce" minOccurs="0">
+                <xs:complexType>
+                    <xs:sequence/>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="InOrder" minOccurs="0">
+                <xs:complexType>
+                    <xs:sequence/>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+
+ 
+    <xs:element name="deliveryAssurance" type="tns:DeliveryAssuranceType"/>
+    <xs:element name="sourcePolicy" type="tns:SourcePolicyType"/>
+    <xs:element name="destinationPolicy" type="tns:DestinationPolicyType"/>
+
+    <xs:complexType name="RMInterceptorConfigBean">        
+        <xs:annotation>
+            <xs:appinfo>                
+                <cfg:configurable/>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element ref="wsrmp:RMAssertion" minOccurs="0"/>
+            <xs:element ref="tns:deliveryAssurance" minOccurs="0"/>
+            <xs:element ref="tns:sourcePolicy" minOccurs="0"/>
+            <xs:element ref="tns:destinationPolicy" minOccurs="0"/>
+        </xs:sequence>
+    </xs:complexType>
+
+ </xs:schema>

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-interceptor.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-interceptor.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-interceptor.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-policy.xjb
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-policy.xjb?view=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-policy.xjb (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-policy.xjb Tue Oct 10 03:48:13 2006
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  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.
+-->
+<jaxb:bindings version="1.0" 
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" 
+  jaxb:extensionBindingPrefixes="xjc">
+    <jaxb:bindings schemaLocation="wsrm-policy.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.ws.rm.policy"/>
+        </jaxb:schemaBindings>
+        <jaxb:globalBindings generateIsSetMethod="true"/>
+    </jaxb:bindings>
+</jaxb:bindings>

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-policy.xjb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-policy.xjb
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-policy.xjb
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 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=auto&rev=454689
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java Tue Oct 10 03:48:13 2006
@@ -0,0 +1,88 @@
+/**
+ * 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.math.BigInteger;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+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.interceptor.SequenceTerminationPolicyType;
+import org.apache.cxf.ws.rm.interceptor.SourcePolicyType;
+import org.apache.cxf.ws.rm.policy.RMAssertion;
+
+public class RMInterceptorTest extends TestCase {
+   
+    
+    public void testInitialisation() {
+        RMInterceptor rmi = new RMInterceptor();
+        assertTrue("RMAssertion is set.", !rmi.isSetRMAssertion());
+        assertTrue("sourcePolicy is set.", !rmi.isSetSourcePolicy());
+        assertTrue("destinationPolicy is set.", !rmi.isSetDestinationPolicy());
+        assertTrue("deliveryAssirance is set.", !rmi.isSetDeliveryAssurance());
+        
+        rmi.initialise();
+        
+        assertTrue("RMAssertion is not set.", rmi.isSetRMAssertion());
+        assertTrue("sourcePolicy is not set.", rmi.isSetSourcePolicy());
+        assertTrue("destinationPolicy is not set.", rmi.isSetDestinationPolicy());
+        assertTrue("deliveryAssirance is not set.", rmi.isSetDeliveryAssurance());
+        
+        RMAssertion rma = rmi.getRMAssertion();
+        assertTrue(rma.isSetExponentialBackoff());
+        assertEquals(3000L, rma.getBaseRetransmissionInterval().getMilliseconds().longValue());
+        assertTrue(!rma.isSetAcknowledgementInterval());
+        assertTrue(!rma.isSetInactivityTimeout());   
+        
+        SourcePolicyType sp = rmi.getSourcePolicy();
+        assertEquals(0, sp.getSequenceExpiration().getTimeInMillis(new Date()));
+        assertEquals(0, sp.getOfferedSequenceExpiration().getTimeInMillis(new Date()));
+        assertNull(sp.getAcksTo());
+        assertTrue(sp.isIncludeOffer());
+        SequenceTerminationPolicyType stp = sp.getSequenceTerminationPolicy();
+        assertEquals(0, stp.getMaxRanges());
+        assertEquals(0, stp.getMaxUnacknowledged());
+        assertTrue(!stp.isTerminateOnShutdown());
+        assertEquals(BigInteger.ZERO, stp.getMaxLength());
+   
+    }
+    
+    public void testOrdering() {
+        Phase p = new Phase(Phase.PRE_LOGICAL, 1);
+        PhaseInterceptorChain chain = 
+            new PhaseInterceptorChain(Collections.singletonList(p));
+        MAPAggregator map = new MAPAggregator();
+        RMInterceptor rmi = new RMInterceptor();        
+        chain.add(rmi);
+        chain.add(map);
+        Iterator it = chain.iterator();
+        assertSame("Unexpected order.", map, it.next());
+        assertSame("Unexpected order.", rmi, it.next());
+        
+        
+        
+    }
+}

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

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

Modified: incubator/cxf/trunk/tools/xjc/cfg-test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/xjc/cfg-test/pom.xml?view=diff&rev=454689&r1=454688&r2=454689
==============================================================================
--- incubator/cxf/trunk/tools/xjc/cfg-test/pom.xml (original)
+++ incubator/cxf/trunk/tools/xjc/cfg-test/pom.xml Tue Oct 10 03:48:13 2006
@@ -85,7 +85,7 @@
                             <schemaDirectory>${basedir}/src/test/resources/schemas/configuration</schemaDirectory>
                             <includeSchema>*.xsd</includeSchema>
                             <extension>true</extension> 
-                            <args>-Xcfg</args>
+                            <args>-Xdv -Xcfg</args>
                         </configuration>
                         <goals>
                             <goal>generate</goal>

Modified: incubator/cxf/trunk/tools/xjc/cfg-test/src/test/java/org/apache/cxf/xjc/cfg/ConfigurableBeansPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/xjc/cfg-test/src/test/java/org/apache/cxf/xjc/cfg/ConfigurableBeansPluginTest.java?view=diff&rev=454689&r1=454688&r2=454689
==============================================================================
--- incubator/cxf/trunk/tools/xjc/cfg-test/src/test/java/org/apache/cxf/xjc/cfg/ConfigurableBeansPluginTest.java (original)
+++ incubator/cxf/trunk/tools/xjc/cfg-test/src/test/java/org/apache/cxf/xjc/cfg/ConfigurableBeansPluginTest.java Tue Oct 10 03:48:13 2006
@@ -75,7 +75,8 @@
         providers.add(provider);
         foo.setFallbackProviders(providers);
         assertEquals(BigInteger.TEN, foo.getIntegerAttrNoDefault());
-        assertEquals(new BigInteger("111"), foo.getIntegerAttr());
+        assertEquals(BigInteger.TEN, foo.getIntegerAttr());
+        foo.setFallbackProviders(null);
         providers = foo.getOverwriteProviders();
         assertNull(providers); 
         providers = new ArrayList<ConfigurationProvider>();
@@ -102,7 +103,7 @@
         foo.setChangedProperty(null);        
         foo.setIntegerElem(null);
         assertEquals("integerElem", foo.getChangedProperty());
-        assertNull(foo.getIntegerElem());
+        assertEquals(new BigInteger("11"), foo.getIntegerElem());
         
     }
     
@@ -114,11 +115,11 @@
         assertEquals("Unexpected value for attribute integerAttr",
                      new BigInteger("111"), foo.getIntegerAttr());
         assertEquals("Unexpected value for attribute intAttr",
-                     new Integer(112), foo.getIntAttr());
+                     112, foo.getIntAttr());
         assertEquals("Unexpected value for attribute longAttr",
-                     new Long(113L), foo.getLongAttr());
+                     113L, foo.getLongAttr());
         assertEquals("Unexpected value for attribute shortAttr",
-                     new Short((short)114), foo.getShortAttr());
+                     114, foo.getShortAttr());
         assertEquals("Unexpected value for attribute decimalAttr",
                      new BigDecimal("115"), foo.getDecimalAttr());
         assertEquals("Unexpected value for attribute floatAttr",
@@ -126,7 +127,7 @@
         assertEquals("Unexpected value for attribute doubleAttr",
                      new Double(117D), foo.getDoubleAttr());
         assertEquals("Unexpected value for attribute byteAttr",
-                     new Byte((byte)118), foo.getByteAttr());
+                     118, foo.getByteAttr());
         
         byte[] expected = DatatypeConverter.parseBase64Binary("wxyz");
         byte[] effective = foo.getBase64BinaryAttr();
@@ -150,11 +151,17 @@
                      "schema", qn.getLocalPart());
        
         assertEquals("Unexpected value for attribute unsignedIntAttr",
-                     new Long(119L), foo.getUnsignedIntAttr());
+                     119L, foo.getUnsignedIntAttr());
         assertEquals("Unexpected value for attribute unsignedShortAttr",
-                     new Integer(120), foo.getUnsignedShortAttr());
+                     120, foo.getUnsignedShortAttr());
         assertEquals("Unexpected value for attribute unsignedByteAttr",
-                     new Short((short)121), foo.getUnsignedByteAttr());
+                     121, foo.getUnsignedByteAttr());
+        
+        assertEquals("Unexpected value for attribute durationAttr",
+                     3, foo.getDurationAttr().getSeconds());
+        assertEquals("Unexpected value for attribute durationAttr",
+                     0, foo.getDurationAttr().getHours());
+        
     }
     
     /**
@@ -196,6 +203,8 @@
                      foo.getUnsignedShortAttrNoDefault());
         assertNull("Unexpected value for attribute unsignedByteAttrNoDefault",
                      foo.getUnsignedByteAttrNoDefault());
+        assertNull("Unexpected value for attribute durationAttrNoDefault",
+                   foo.getDurationAttrNoDefault());
     }
     
     private void assertDefaultElementValues(Foo foo) {
@@ -247,6 +256,11 @@
                      new Integer(20), foo.getUnsignedShortElem());
         assertEquals("Unexpected value for element unsignedByteElem",
                      new Short((short)21), foo.getUnsignedByteElem());
+        
+        assertEquals("Unexpected value for element durationElem",
+                     0, foo.getDurationElem().getSeconds());
+        assertEquals("Unexpected value for element durationElem",
+                     3, foo.getDurationElem().getHours());
     }
     
     static class FooBean extends Foo {



Mime
View raw message