Commit in servicemix/ws/jaxws/wsrm on MAIN
maven.xml+16added 1.1
project.xml+108added 1.1
.project+18added 1.1
project.properties+20added 1.1
.classpath+42added 1.1
.cvsignore+3added 1.1
src/main/java/org/servicemix/ws/rm/SimpleReliableMessagingDestination.java+182added 1.1
                                  /Sequence.java+43added 1.1
                                  /NonPersistentSequenceStore.java+55added 1.1
                                  /SoapFault.java+29added 1.1
                                  /SequenceStore.java+37added 1.1
+553
11 added files
Added a first cut of the WS-RM code using JAX-WS

servicemix/ws/jaxws/wsrm
maven.xml added at 1.1
diff -N maven.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ maven.xml	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,16 @@
+<project default="default" xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven">
+
+  <goal name="default">
+    <attainGoal name="clean" />
+    <attainGoal name="jar:install" />
+  </goal>
+
+  <goal name="setclasspath">
+    <path id="test.classpath">
+      <pathelement path="${maven.build.dest}"/>
+      <pathelement path="target/classes"/>
+      <pathelement path="target/test-classes"/>
+      <path refid="maven.dependency.classpath"/>
+    </path>
+  </goal>
+</project>

servicemix/ws/jaxws/wsrm
project.xml added at 1.1
diff -N project.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ project.xml	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+  <pomVersion>3</pomVersion>
+  <extend>${basedir}/../../../project.xml</extend>
+
+  <name>ServiceMix :: WS-ReliableMessaging</name>
+  <id>servicemix-wsrm</id>
+  <description>
+        ServiceMix implementation of WS ReliableMessaging
+  </description>
+
+  <package>*</package>
+
+ <packageGroups>
+    <packageGroup>
+      <title>WS-ReliableMessaging Implementation</title>
+      <packages>org.servicemix.ws</packages>
+    </packageGroup>
+  </packageGroups>
+
+
+  <siteDirectory>/home/projects/servicemix/public_html/maven/ws/jaxws/wsrm</siteDirectory>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>servicemix</artifactId>
+      <version>1.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>mx4j</groupId>
+      <artifactId>mx4j-jmx</artifactId>
+      <version>2.1.1</version>
+    </dependency>
+
+    <dependency>
+      <groupId>activemq</groupId>
+      <artifactId>activemq</artifactId>
+      <version>3.1-M6</version>
+    </dependency>
+    <dependency>
+      <groupId>geronimo-spec</groupId>
+      <artifactId>geronimo-spec-j2ee</artifactId>
+      <version>1.4-rc4</version>
+    </dependency>
+
+
+    <!-- WS POJOs -->
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>servicemix-wspojo</artifactId>
+      <version>${pom.currentVersion}</version>
+    </dependency>
+
+    <!-- For JAX-WS: only required for Java 5, will be part of Java 6 -->
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jsr181-api</artifactId>
+      <version>20050818</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxws-api</artifactId>
+      <version>20050818</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxws-rt</artifactId>
+      <version>20050818</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>20050818</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxb-impl</artifactId>
+      <version>20050818</version>
+    </dependency>
+    <dependency>
+      <id>stax+api</id>
+      <version>1.0</version>
+    </dependency>
+
+    <!-- optional ActiveSOAP component -->
+    <dependency>
+      <id>activesoap</id>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+
+
+  <build>
+    <resources>
+      <resource>
+          <directory>src/main/resources</directory>
+        <includes>
+          <include>**/*.xml</include>
+          <include>**/*.properties</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+
+</project>

servicemix/ws/jaxws/wsrm
.project added at 1.1
diff -N .project
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .project	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<projectDescription>
+  <name>servicemix-wsrm</name>
+  <comment>ServiceMix implementation of WS ReliableMessaging</comment>
+  <projects>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+      <arguments>
+      </arguments>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

servicemix/ws/jaxws/wsrm
project.properties added at 1.1
diff -N project.properties
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ project.properties	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,20 @@
+# -------------------------------------------------------------------
+# Build Properties
+# -------------------------------------------------------------------
+maven.multiproject.type=jar
+
+maven.compile.source=1.5
+maven.compile.target=1.5
+maven.test.source=1.5
+maven.compile.deprecation=true
+maven.compile.debug=true
+maven.compile.optimize=true
+
+maven.javadoc.source=1.5
+maven.javadoc.additionalparam = -linksource
+
+maven.javadoc.links=\
+http://download.java.net/jdk6/docs/api/,\
+http://java.sun.com/j2ee/1.5/docs/api/,\
+http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent,\
+http://jakarta.apache.org/commons/logging/apidocs
\ No newline at end of file

servicemix/ws/jaxws/wsrm
.classpath added at 1.1
diff -N .classpath
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .classpath	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<classpath>
+  <classpathentry excluding="" kind="src" path="src/main/java">
+  </classpathentry>
+  <classpathentry output="target/test-classes" kind="src" path="src/test/java">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar">
+  </classpathentry>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/servicemix/jars/servicemix-1.0.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/mx4j/jars/mx4j-jmx-2.1.1.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/activemq/jars/activemq-3.1-M6.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-j2ee-1.4-rc4.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/servicemix/jars/servicemix-wspojo-1.1-SNAPSHOT.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/servicemix/jars/jsr181-api-20050818.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/servicemix/jars/jaxws-api-20050818.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/servicemix/jars/jaxws-rt-20050818.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/servicemix/jars/jaxb-api-20050818.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/servicemix/jars/jaxb-impl-20050818.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/stax/jars/stax-api-1.0.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/activesoap/jars/activesoap-1.0-SNAPSHOT.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.3.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/concurrent/jars/concurrent-1.3.4.jar">
+  </classpathentry>
+  <classpathentry kind="output" path="bin">
+  </classpathentry>
+</classpath>
\ No newline at end of file

servicemix/ws/jaxws/wsrm
.cvsignore added at 1.1
diff -N .cvsignore
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .cvsignore	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,3 @@
+target
+.settings
+bin

servicemix/ws/jaxws/wsrm/src/main/java/org/servicemix/ws/rm
SimpleReliableMessagingDestination.java added at 1.1
diff -N SimpleReliableMessagingDestination.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SimpleReliableMessagingDestination.java	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,182 @@
+/**
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ * 
+ **/
+package org.servicemix.ws.rm;
+
+import org.servicemix.wspojo.rm.SequenceAbsractPortType;
+import org.xmlsoap.schemas.ws._2005._02.rm.AckRequestedType;
+import org.xmlsoap.schemas.ws._2005._02.rm.CreateSequenceResponseType;
+import org.xmlsoap.schemas.ws._2005._02.rm.CreateSequenceType;
+import org.xmlsoap.schemas.ws._2005._02.rm.Expires;
+import org.xmlsoap.schemas.ws._2005._02.rm.Identifier;
+import org.xmlsoap.schemas.ws._2005._02.rm.SequenceAcknowledgement;
+import org.xmlsoap.schemas.ws._2005._02.rm.SequenceType;
+import org.xmlsoap.schemas.ws._2005._02.rm.TerminateSequenceType;
+import org.xmlsoap.schemas.ws._2005._02.rm.SequenceAcknowledgement.AcknowledgementRange;
+
+import java.math.BigInteger;
+
+/**
+ * Default implementation of the WS-RM endpoint for managing sequences.
+ * 
+ * @version $Revision$
+ */
+public class SimpleReliableMessagingDestination implements SequenceAbsractPortType {
+
+    SequenceStore sequenceStore = new NonPersistentSequenceStore();
+    private static final BigInteger MAX_INTEGER = new BigInteger("" + Integer.MAX_VALUE);
+
+
+    public SequenceAcknowledgement assertValid(SequenceType sequence) {
+        Identifier identifier = sequence.getIdentifier();
+        Sequence s = sequenceStore.retrieve(identifier);
+
+        if (s == null) {
+            throw new SoapFault("The value of wsrm:Identifier is not a known Sequence identifier", "Sender",
+                    "wsrm:UnknownSequence", identifier.toString());
+        }
+
+        // Is the message number out of range?
+        BigInteger value = sequence.getMessageNumber();
+        if (value.compareTo(BigInteger.ZERO) <= 0 || value.compareTo(MAX_INTEGER) > 0) {
+
+            // We must terminate the sequence now.
+            sequenceStore.delete(identifier);
+
+            throw new SoapFault("The maximum value for wsrm:MessageNumber has been exceeded", "Sender",
+                    "wsrm:MessageNumberRollover", identifier.toString());
+        }
+
+        int intValue = value.intValue();
+
+        // If we received the last message, then check to see if the message
+        // being
+        // processed exceeds it's sequence.
+        if (s.lastMessageNumber > 0 && intValue > s.lastMessageNumber) {
+            throw new SoapFault(
+                    "The value for wsrm:MessageNumber exceeds the value of the MessageNumber  accompanying a LastMessage element in this Sequence.",
+                    "Sender", "wsrm:LastMessageNumberExceeded", identifier.toString());
+        }
+
+        // Is this message comming out of order??
+        if (intValue != s.lastMessageAcked + 1) {
+            // This implementation is really simple and just drops out of order
+            // messages.
+
+            SequenceAcknowledgement acknowledgement = new SequenceAcknowledgement();
+            acknowledgement.setIdentifier(identifier);
+            if (s.lastMessageAcked > 0) {
+                AcknowledgementRange range = new AcknowledgementRange();
+                range.setLower(BigInteger.ONE);
+                range.setUpper(new BigInteger("" + s.lastMessageAcked));
+                acknowledgement.getAcknowledgementRange().add(range);
+            }
+            return acknowledgement;
+        }
+
+        return null;
+    }
+
+    public SequenceAcknowledgement acknowledge(SequenceType sequence) {
+        Identifier identifier = sequence.getIdentifier();
+
+        // We might need something like a retrieve for update so that
+        // we can lock this record across a cluster
+        Sequence s = sequenceStore.retrieve(identifier);
+
+        int value = sequence.getMessageNumber().intValue();
+        s.lastMessageAcked = value;
+        if (sequence.getLastMessage() != null) {
+            s.lastMessageNumber = value;
+        }
+
+        sequenceStore.update(s);
+
+        SequenceAcknowledgement acknowledgement = new SequenceAcknowledgement();
+        acknowledgement.setIdentifier(sequence.getIdentifier());
+        AcknowledgementRange range = new AcknowledgementRange();
+        range.setLower(BigInteger.ONE);
+        range.setUpper(new BigInteger("" + s.lastMessageAcked));
+        acknowledgement.getAcknowledgementRange().add(range);
+        return acknowledgement;
+    }
+
+    public SequenceAcknowledgement acknowledgeRequested(AckRequestedType sequence) {
+        Identifier identifier = sequence.getIdentifier();
+        Sequence s = sequenceStore.retrieve(identifier);
+
+        if (s == null) {
+            throw new SoapFault("The value of wsrm:Identifier is not a known Sequence identifier", "Sender",
+                    "wsrm:UnknownSequence", sequence.getIdentifier().toString());
+        }
+
+        SequenceAcknowledgement acknowledgement = new SequenceAcknowledgement();
+        acknowledgement.setIdentifier(sequence.getIdentifier());
+        if (s.lastMessageAcked > 0) {
+            AcknowledgementRange range = new AcknowledgementRange();
+            range.setLower(BigInteger.ONE);
+            range.setUpper(new BigInteger("" + s.lastMessageAcked));
+            acknowledgement.getAcknowledgementRange().add(range);
+        }
+        return acknowledgement;
+    }
+
+    // SequenceAbsractPortType interface
+    // -------------------------------------------------------------------------
+    public CreateSequenceResponseType createSequence(CreateSequenceType createSequence) {
+        Sequence s = new Sequence();
+        s.acksTo = createSequence.getAcksTo();
+        if (createSequence.getExpires() != null) {
+            s.expires = convertToLocalTime(createSequence.getExpires());
+        }
+        sequenceStore.create(s);
+
+        CreateSequenceResponseType response = new CreateSequenceResponseType();
+        response.setIdentifier(s.getIdentifier());
+        if (s.expires != 0) {
+            response.setExpires(convertToDuration(s.expires));
+        }
+        return response;
+    }
+
+    public void terminateSequence(TerminateSequenceType terminateSequence) {
+        sequenceStore.delete(terminateSequence.getIdentifier());
+    }
+
+    // Implementation methods
+    // -------------------------------------------------------------------------
+    /**
+     * TODO: Need to implement these to support expiring subscriptions
+     * 
+     * @param expires
+     * @return
+     */
+    private Expires convertToDuration(long expires) {
+        return null;
+    }
+
+    /**
+     * TODO: Need to implement these to support expiring subscriptions
+     * 
+     * @param expires
+     * @return
+     */
+    private long convertToLocalTime(Expires expires) {
+        return 0;
+    }
+
+}

servicemix/ws/jaxws/wsrm/src/main/java/org/servicemix/ws/rm
Sequence.java added at 1.1
diff -N Sequence.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Sequence.java	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,43 @@
+/**
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ * 
+ **/
+package org.servicemix.ws.rm;
+
+import org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType;
+import org.xmlsoap.schemas.ws._2005._02.rm.Identifier;
+
+/**
+ * A POJO representing the sequence state
+ * 
+ * @version $Revision$
+ */
+public class Sequence {
+
+    private Identifier identifier;
+    public EndpointReferenceType acksTo;
+    public long expires;
+    
+    public int lastMessageAcked=0;
+    public int lastMessageNumber=0;
+    public Identifier getIdentifier() {
+        return identifier;
+    }
+    public void setIdentifier(Identifier identifier) {
+        this.identifier = identifier;
+    }
+
+}

servicemix/ws/jaxws/wsrm/src/main/java/org/servicemix/ws/rm
NonPersistentSequenceStore.java added at 1.1
diff -N NonPersistentSequenceStore.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ NonPersistentSequenceStore.java	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,55 @@
+/**
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ * 
+ **/
+package org.servicemix.ws.rm;
+
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+
+import org.activemq.util.IdGenerator;
+import org.xmlsoap.schemas.ws._2005._02.rm.Identifier;
+
+/**
+ * A simple implementation of the [EMAIL PROTECTED] SequenceStore} which doesn not persist messages
+ * but is usesful for testing.
+ * 
+ * @version $Revision$
+ */
+public class NonPersistentSequenceStore implements SequenceStore {
+
+    private final IdGenerator idGenerator = new IdGenerator();
+    private final ConcurrentHashMap sequences = new ConcurrentHashMap();
+    
+    public void create(Sequence s) {
+        String id = idGenerator.generateId();
+        Identifier identifier = new Identifier();
+        identifier.setValue(id);
+        s.setIdentifier(identifier);
+        sequences.put(id,s);
+    }
+
+    public void delete(Identifier identifier) {
+        sequences.remove(identifier.getValue());
+    }
+
+    public Sequence retrieve(Identifier identifier) {
+        return (Sequence) sequences.get(identifier.getValue());
+    }
+
+    public void update(Sequence s) {
+        sequences.put(s.getIdentifier().getValue(), s);
+    }
+}

servicemix/ws/jaxws/wsrm/src/main/java/org/servicemix/ws/rm
SoapFault.java added at 1.1
diff -N SoapFault.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SoapFault.java	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,29 @@
+package org.servicemix.ws.rm;
+
+
+public class SoapFault extends RuntimeException {
+    
+    private static final long serialVersionUID = 1L;
+    
+    private String code;
+    private String subCode;
+    private String detail;
+    
+    public SoapFault(String reason, String code, String subCode, String detail) {
+        super(reason);
+        this.code = code;
+        this.subCode = subCode;
+        this.detail = detail;
+    }
+    
+    public String getCode() {
+        return code;
+    }
+    public String getDetail() {
+        return detail;
+    }
+    public String getSubCode() {
+        return subCode;
+    }
+    
+}

servicemix/ws/jaxws/wsrm/src/main/java/org/servicemix/ws/rm
SequenceStore.java added at 1.1
diff -N SequenceStore.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SequenceStore.java	2 Sep 2005 11:57:10 -0000	1.1
@@ -0,0 +1,37 @@
+/**
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ * 
+ **/
+package org.servicemix.ws.rm;
+
+import org.xmlsoap.schemas.ws._2005._02.rm.Identifier;
+
+/**
+ * Defines simple crud ops to access persistence Sequences.
+ * 
+ * @version $Revision$
+ */
+public interface SequenceStore {
+
+    void create(Sequence s);
+
+    Sequence retrieve(Identifier identifier);
+    
+    void update(Sequence s);
+
+    void delete(Identifier identifier);
+
+}
CVSspam 0.2.8



Reply via email to