ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mckie...@apache.org
Subject svn commit: r706650 [1/3] - in /webservices/sandesha/trunk/java/modules/persistence: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/sandesha2/ src/main/java/org/apache/sandesha2/storage/ src/main/...
Date Tue, 21 Oct 2008 15:07:46 GMT
Author: mckierna
Date: Tue Oct 21 08:07:45 2008
New Revision: 706650

URL: http://svn.apache.org/viewvc?rev=706650&view=rev
Log:
JDBC persistent store - thanks Amila (see https://issues.apache.org/jira/browse/SANDESHA2-140)

Added:
    webservices/sandesha/trunk/java/modules/persistence/
    webservices/sandesha/trunk/java/modules/persistence/axis2.log
    webservices/sandesha/trunk/java/modules/persistence/derby.log
    webservices/sandesha/trunk/java/modules/persistence/pom.xml
    webservices/sandesha/trunk/java/modules/persistence/src/
    webservices/sandesha/trunk/java/modules/persistence/src/main/
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentBeanMgr.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentStorageManager.java
    webservices/sandesha/trunk/java/modules/persistence/src/resources/
    webservices/sandesha/trunk/java/modules/persistence/src/resources/ddl/
    webservices/sandesha/trunk/java/modules/persistence/src/resources/ddl/sandesha2-derby.ddl
    webservices/sandesha/trunk/java/modules/persistence/src/resources/ddl/sandesha2-mysql.ddl
    webservices/sandesha/trunk/java/modules/persistence/src/resources/module_config_axis2.xml
    webservices/sandesha/trunk/java/modules/persistence/src/test/
    webservices/sandesha/trunk/java/modules/persistence/src/test/java/
    webservices/sandesha/trunk/java/modules/persistence/src/test/java/org/
    webservices/sandesha/trunk/java/modules/persistence/src/test/java/org/apache/
    webservices/sandesha/trunk/java/modules/persistence/src/test/java/org/apache/sandesha2/
    webservices/sandesha/trunk/java/modules/persistence/src/test/java/org/apache/sandesha2/RMScenariosTest.java
    webservices/sandesha/trunk/java/modules/persistence/src/test/java/org/apache/sandesha2/SandeshaTestCase.java
    webservices/sandesha/trunk/java/modules/persistence/test-resources/
    webservices/sandesha/trunk/java/modules/persistence/test-resources/client_axis2.xml
    webservices/sandesha/trunk/java/modules/persistence/test-resources/commons-logging.properties
    webservices/sandesha/trunk/java/modules/persistence/test-resources/log4j.properties
    webservices/sandesha/trunk/java/modules/persistence/test-resources/sandesha2-test.properties
    webservices/sandesha/trunk/java/modules/persistence/test-resources/server_axis2.xml
    webservices/sandesha/trunk/java/modules/persistence/test.build.xml

Added: webservices/sandesha/trunk/java/modules/persistence/axis2.log
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/axis2.log?rev=706650&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/axis2.log (added)
+++ webservices/sandesha/trunk/java/modules/persistence/axis2.log Tue Oct 21 08:07:45 2008
@@ -0,0 +1,57 @@
+2008-10-21 13:15:03,671 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: addressing-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/modules/addressing-SNAPSHOT.mar
+2008-10-21 13:15:04,515 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: sandesha2-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/modules/sandesha2-SNAPSHOT.mar
+2008-10-21 13:15:04,625 [main] INFO  org.apache.axis2.deployment.ServiceDeployer  - Deploying Web service: RMSampleService.aar - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/services/RMSampleService.aar
+2008-10-21 13:15:04,656 [HttpListener-8060-1] INFO  org.apache.axis2.transport.http.server.DefaultConnectionListener  - Listening on port 8060
+2008-10-21 13:15:04,953 [main] INFO  org.apache.axis2.deployment.DeploymentEngine  - No services directory was found under C:\wsfp\pyxis\WAS_build\openSrc\sandeshaCommit\modules\persistence\target\repos\persistence-client.
+2008-10-21 13:15:05,000 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: addressing-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-client/modules/addressing-SNAPSHOT.mar
+2008-10-21 13:15:05,031 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: sandesha2 - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-client/modules/sandesha2-UnitTest.mar
+2008-10-21 13:15:05,031 [main] INFO  org.apache.sandesha2.storage.jdbc.PersistentStorageManager  - create PersistentStorageManager
+2008-10-21 13:15:05,046 [main] INFO  org.apache.sandesha2.storage.jdbc.PersistentStorageManager  - init PersistentStorageManager
+2008-10-21 13:15:28,546 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down connection listener
+2008-10-21 13:15:28,546 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down HTTP processors
+2008-10-21 13:15:31,562 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Force shut down HTTP processors
+2008-10-21 13:15:31,562 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - HTTP protocol handler shut down
+2008-10-21 13:15:31,968 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: addressing-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/modules/addressing-SNAPSHOT.mar
+2008-10-21 13:15:32,078 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: sandesha2-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/modules/sandesha2-SNAPSHOT.mar
+2008-10-21 13:15:32,171 [main] INFO  org.apache.axis2.deployment.ServiceDeployer  - Deploying Web service: RMSampleService.aar - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/services/RMSampleService.aar
+2008-10-21 13:15:32,171 [HttpListener-8060-1] INFO  org.apache.axis2.transport.http.server.DefaultConnectionListener  - Listening on port 8060
+2008-10-21 13:15:32,500 [main] INFO  org.apache.axis2.deployment.DeploymentEngine  - No services directory was found under C:\wsfp\pyxis\WAS_build\openSrc\sandeshaCommit\modules\persistence\target\repos\persistence-client.
+2008-10-21 13:15:32,546 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: addressing-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-client/modules/addressing-SNAPSHOT.mar
+2008-10-21 13:15:32,593 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: sandesha2 - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-client/modules/sandesha2-UnitTest.mar
+2008-10-21 13:15:32,593 [main] INFO  org.apache.sandesha2.storage.jdbc.PersistentStorageManager  - create PersistentStorageManager
+2008-10-21 13:15:32,593 [main] INFO  org.apache.sandesha2.storage.jdbc.PersistentStorageManager  - init PersistentStorageManager
+2008-10-21 13:15:32,625 [HttpListener-6060-1] INFO  org.apache.axis2.transport.http.server.DefaultConnectionListener  - Listening on port 6060
+2008-10-21 13:16:05,187 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down connection listener
+2008-10-21 13:16:05,187 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down HTTP processors
+2008-10-21 13:16:08,203 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Force shut down HTTP processors
+2008-10-21 13:16:08,203 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - HTTP protocol handler shut down
+2008-10-21 13:16:08,843 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down connection listener
+2008-10-21 13:16:08,843 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down HTTP processors
+2008-10-21 13:16:11,859 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Force shut down HTTP processors
+2008-10-21 13:16:11,859 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - HTTP protocol handler shut down
+2008-10-21 13:16:12,203 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: addressing-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/modules/addressing-SNAPSHOT.mar
+2008-10-21 13:16:12,359 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: sandesha2-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/modules/sandesha2-SNAPSHOT.mar
+2008-10-21 13:16:12,390 [main] INFO  org.apache.axis2.deployment.ServiceDeployer  - Deploying Web service: RMSampleService.aar - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/services/RMSampleService.aar
+2008-10-21 13:16:12,390 [HttpListener-8060-1] INFO  org.apache.axis2.transport.http.server.DefaultConnectionListener  - Listening on port 8060
+2008-10-21 13:16:12,687 [main] INFO  org.apache.axis2.deployment.DeploymentEngine  - No services directory was found under C:\wsfp\pyxis\WAS_build\openSrc\sandeshaCommit\modules\persistence\target\repos\persistence-client.
+2008-10-21 13:16:12,734 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: addressing-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-client/modules/addressing-SNAPSHOT.mar
+2008-10-21 13:16:12,750 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: sandesha2 - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-client/modules/sandesha2-UnitTest.mar
+2008-10-21 13:16:12,750 [main] INFO  org.apache.sandesha2.storage.jdbc.PersistentStorageManager  - create PersistentStorageManager
+2008-10-21 13:16:12,750 [main] INFO  org.apache.sandesha2.storage.jdbc.PersistentStorageManager  - init PersistentStorageManager
+2008-10-21 13:16:33,781 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down connection listener
+2008-10-21 13:16:33,781 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down HTTP processors
+2008-10-21 13:16:36,781 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Force shut down HTTP processors
+2008-10-21 13:16:36,781 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - HTTP protocol handler shut down
+2008-10-21 13:16:37,125 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: addressing-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/modules/addressing-SNAPSHOT.mar
+2008-10-21 13:16:37,203 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: sandesha2-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/modules/sandesha2-SNAPSHOT.mar
+2008-10-21 13:16:37,390 [main] INFO  org.apache.axis2.deployment.ServiceDeployer  - Deploying Web service: RMSampleService.aar - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-server/services/RMSampleService.aar
+2008-10-21 13:16:37,390 [HttpListener-8060-1] INFO  org.apache.axis2.transport.http.server.DefaultConnectionListener  - Listening on port 8060
+2008-10-21 13:16:37,703 [main] INFO  org.apache.axis2.deployment.DeploymentEngine  - No services directory was found under C:\wsfp\pyxis\WAS_build\openSrc\sandeshaCommit\modules\persistence\target\repos\persistence-client.
+2008-10-21 13:16:37,734 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: addressing-SNAPSHOT - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-client/modules/addressing-SNAPSHOT.mar
+2008-10-21 13:16:37,781 [main] INFO  org.apache.axis2.deployment.ModuleDeployer  - Deploying module: sandesha2 - file:/C:/wsfp/pyxis/WAS_build/openSrc/sandeshaCommit/modules/persistence/target/repos/persistence-client/modules/sandesha2-UnitTest.mar
+2008-10-21 13:16:37,781 [main] INFO  org.apache.sandesha2.storage.jdbc.PersistentStorageManager  - create PersistentStorageManager
+2008-10-21 13:16:37,781 [main] INFO  org.apache.sandesha2.storage.jdbc.PersistentStorageManager  - init PersistentStorageManager
+2008-10-21 13:17:00,000 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down connection listener
+2008-10-21 13:17:00,000 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Shut down HTTP processors
+2008-10-21 13:17:03,000 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - Force shut down HTTP processors
+2008-10-21 13:17:03,000 [main] INFO  org.apache.axis2.transport.http.server.SimpleHttpServer  - HTTP protocol handler shut down

Added: webservices/sandesha/trunk/java/modules/persistence/derby.log
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/derby.log?rev=706650&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/derby.log (added)
+++ webservices/sandesha/trunk/java/modules/persistence/derby.log Tue Oct 21 08:07:45 2008
@@ -0,0 +1,6 @@
+----------------------------------------------------------------
+2008-10-21 12:15:05.421 GMT:
+ Booting Derby version The Apache Software Foundation - Apache Derby - 10.3.2.1 - (599110): instance c013800d-011d-1f54-6a41-00000008f190
+on database directory C:\wsfp\pyxis\WAS_build\openSrc\sandeshaCommit\modules\persistence\target\derby\wsrm  
+
+Database Class Loader started - derby.database.classpath=''

Added: webservices/sandesha/trunk/java/modules/persistence/pom.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/pom.xml?rev=706650&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/pom.xml (added)
+++ webservices/sandesha/trunk/java/modules/persistence/pom.xml Tue Oct 21 08:07:45 2008
@@ -0,0 +1,120 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+		<groupId>org.apache.sandesha2</groupId>
+		<artifactId>sandesha2-parent</artifactId>
+        <version>SNAPSHOT</version>
+    </parent>
+	
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.sandesha2</groupId>
+    <artifactId>sandesha2-jdbc-storage</artifactId>
+    <packaging>jar</packaging>
+    <name>Sandesha2 - JDBC Persistent Storage</name>
+
+    <build>
+        <sourceDirectory>src/main/java</sourceDirectory>
+        <testSourceDirectory>src/test/java</testSourceDirectory>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+        <testResources>
+            <testResource>
+                <directory>test-resources</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                </includes>
+            </testResource>
+        </testResources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+			<plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.1</version>
+                <executions>
+                    <execution>
+                        <id>create_test_repos</id>
+                        <phase>process-test-resources</phase>
+                        <configuration>
+                            <tasks>
+								<ant antfile="test.build.xml" inheritAll="true" target="prepare">
+									<property name="sandesha2.version" value="${sandesha2.version}"/>
+									<property name="build.dir" value="${project.build.directory}"/>
+									<property name="local.repo" value="${settings.localRepository}"/>
+									<property name="addressing.version" value="${axis2.version}"/>
+									<property name="rampart.version" value="${rampart.version}"/>
+								</ant>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+			<plugin>
+    			<artifactId>maven-surefire-plugin</artifactId>
+    			<configuration>
+               		<includes>
+                 		<include>**/*Test.java</include>
+                	</includes>
+                	<forkMode>pertest</forkMode>
+                	<!--<argLine>-Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</argLine>-->
+    			</configuration>
+			</plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+
+    	<dependency>
+            <groupId>org.apache.sandesha2</groupId>
+            <artifactId>sandesha2-core</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+    	<dependency>
+            <groupId>org.apache.sandesha2</groupId>
+            <artifactId>sandesha2-policy</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+		<dependency>
+            <groupId>org.apache.sandesha2</groupId>
+            <artifactId>sandesha2-samples</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.13</version>
+        </dependency>
+	<dependency>
+    		<groupId>org.apache.derby</groupId>
+    		<artifactId>derby</artifactId>
+    		<version>10.3.2.1</version>
+	</dependency> 
+	<dependency>
+    		<groupId>org.apache.derby</groupId>
+    		<artifactId>derbytools</artifactId>
+    		<version>10.3.2.1</version>
+	</dependency> 
+
+    </dependencies>		
+
+</project>

Added: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java?rev=706650&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java (added)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java Tue Oct 21 08:07:45 2008
@@ -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.sandesha2.storage.jdbc;
+
+import java.sql.*;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.storage.Transaction;
+/*
+ * Each transaction has its own DataBase connection with autocommit set to false
+ * 
+ * As there is no method to "release" a transaction, connections are closed on
+ * commit or rollback.
+ */
+public class JDBCTransaction implements Transaction {
+	private PersistentStorageManager pmgr = null;
+	private Connection DbConnection = null;
+	private boolean active = false;
+	private Log log = LogFactory.getLog(getClass());
+	
+	public JDBCTransaction (PersistentStorageManager pmgr)
+	{
+		log.debug("new JDBCTransaction");
+		try {
+		  this.pmgr = pmgr;
+		  DbConnection = pmgr.dbConnect();
+		  DbConnection.setAutoCommit(false);
+		  active = true;
+		} catch (Exception ex) {}
+	}
+	
+	public Connection getDbConnection()
+	{
+		return DbConnection;
+	}
+	
+	private void freeTransaction()
+	{
+		try {
+			DbConnection.close();
+			pmgr.removeTransaction();
+		} catch (Exception ex) {}
+		
+	}
+		
+	public void commit()
+	{
+		log.debug("commit JDBCTransaction");
+		try {
+		  DbConnection.commit();
+		  freeTransaction();
+		} catch (Exception ex) {}
+		active = false;
+	}
+	
+	public void rollback()
+	{
+		log.debug("rollback JDBCTransaction");
+		try {
+			  DbConnection.rollback();
+			  freeTransaction();
+			} catch (Exception ex) {}
+		active = false;
+	}
+		
+	public boolean isActive ()
+	{
+		return active;
+	}
+	
+}

Added: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentBeanMgr.java?rev=706650&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentBeanMgr.java Tue Oct 21 08:07:45 2008
@@ -0,0 +1,68 @@
+/*
+ * 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.sandesha2.storage.jdbc;
+
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.sql.*;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class PersistentBeanMgr {
+	Log log = LogFactory.getLog(getClass());
+	PersistentStorageManager pmgr = null;
+	
+	public PersistentBeanMgr(PersistentStorageManager pmgr)
+	{
+		this.pmgr = pmgr;
+	}
+
+	public Connection getDbConnection()
+	{
+		return pmgr.getDbConnection();
+	}
+	
+	protected Object getObject(ResultSet rs, String field)
+	 throws Exception
+	 {
+		// MySQL JDBC connector returns a byte array 
+		// and Derby an EmbedBlob with :
+		// return rs.getObject(field);
+		// so
+		InputStream bs = rs.getBinaryStream(field);
+		if ( bs == null ) return null;
+		return (new ObjectInputStream(bs)).readObject();
+	 }
+	
+	protected ByteArrayInputStream serialize(Object obj)
+	  throws Exception
+	{
+	    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+	    ObjectOutputStream oos = new ObjectOutputStream(baos);
+	    oos.writeObject(obj);
+	    oos.close();
+	    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+	    return bais;
+	}
+}

Added: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java?rev=706650&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java Tue Oct 21 08:07:45 2008
@@ -0,0 +1,201 @@
+/*
+ * 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.sandesha2.storage.jdbc;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.ByteArrayInputStream;
+import java.io.Serializable;
+import java.sql.*;
+
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
+import org.apache.sandesha2.storage.beans.InvokerBean;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+public class PersistentInvokerBeanMgr extends PersistentBeanMgr implements InvokerBeanMgr {
+
+	public PersistentInvokerBeanMgr(PersistentStorageManager pmgr)
+	{
+		super(pmgr);
+	}
+
+	private String requestForModel(InvokerBean bean)
+	{
+		StringBuilder sql = new StringBuilder(" select * from wsrm_invoker");
+		if ( bean == null ) return sql.toString();
+		String op = " where";
+		String clause = bean.getMessageContextRefKey();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" message_context_ref_key='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getSequenceID();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" sequence_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		if ( (bean.getFlags() & InvokerBean.MSG_NO_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" msg_no=");
+			sql.append(bean.getMsgNo());
+		}
+		return sql.toString();
+	}
+	
+	private InvokerBean getInvokerBean(ResultSet rs)
+	  throws Exception
+	{
+		InvokerBean invokerBean = new InvokerBean();
+		invokerBean.setMessageContextRefKey(rs.getString("message_context_ref_key"));
+		invokerBean.setSequenceID(rs.getString("sequence_id"));
+		invokerBean.setMsgNo(rs.getLong("msg_no"));
+		invokerBean.setFlags(rs.getInt("flags"));
+		invokerBean.setContext((Serializable)getObject(rs,"context"));
+		return invokerBean;
+	}
+	
+	public boolean delete(String key)
+	  throws SandeshaStorageException 
+	{
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			stmt.executeUpdate("delete from wsrm_invoker where message_context_ref_key='" + key + "'");
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return true;
+	}
+
+	public List find(InvokerBean bean)
+	  throws SandeshaStorageException
+	{
+		String sql = requestForModel(bean);
+		ArrayList<InvokerBean> lst = new ArrayList<InvokerBean>();
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				lst.add(getInvokerBean(rs));
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return lst;
+	}
+	
+	public boolean insert(InvokerBean bean)
+	  throws SandeshaStorageException
+	{
+		try {
+	    	PreparedStatement pstmt = getDbConnection().prepareStatement("insert into wsrm_invoker(message_context_ref_key," +
+			"sequence_id,context,msg_no,flags)values(?,?,?,?,?)");
+		   	pstmt.setString(1,bean.getMessageContextRefKey());
+		   	pstmt.setString(2,bean.getSequenceID());
+		   	pstmt.setLong(4,bean.getMsgNo());
+		   	pstmt.setInt(5,bean.getFlags());
+		   	// Derby ne serialise pas avec setObject
+			 ByteArrayInputStream bais = serialize(bean.getContext());
+			 pstmt.setBinaryStream(3, bais, bais.available());
+		    pstmt.execute();
+		    pstmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return true;
+	}
+	public InvokerBean retrieve(String key)
+	  throws SandeshaStorageException
+	{
+		InvokerBean invokerBean = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery("select * from wsrm_invoker where message_context_ref_key='" + key + "'");
+			if ( ! rs.next() ) return invokerBean;
+			invokerBean = getInvokerBean(rs);
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return invokerBean;
+	}
+
+	public boolean update(InvokerBean bean)
+	  throws SandeshaStorageException
+	{
+		try {
+	    	PreparedStatement pstmt = getDbConnection().prepareStatement("update wsrm_invoker set " +
+			"sequence_id=?,context=?,msg_no=?,flags=? where message_context_ref_key='" + bean.getMessageContextRefKey() + "'" );
+		   	pstmt.setString(1,bean.getSequenceID());
+		   	pstmt.setLong(3,bean.getMsgNo());
+		   	pstmt.setInt(4,bean.getFlags());
+		   	// Derby ne serialise pas avec setObject
+			 ByteArrayInputStream bais = serialize(bean.getContext());
+			 pstmt.setBinaryStream(2, bais, bais.available());
+		    pstmt.execute();
+		    pstmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return true;
+	}
+	
+	public InvokerBean findUnique(InvokerBean bean)
+	  throws SandeshaException
+	{
+		String sql = requestForModel(bean);
+		InvokerBean result = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				if ( result == null ) {
+				 result = getInvokerBean(rs);
+				} else {
+					String message = SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.nonUniqueResult,
+							result.toString(),
+							getInvokerBean(rs).toString());
+					log.error(message);
+					throw new SandeshaException (message);
+				}
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}		
+		return result;
+	}
+			
+}

Added: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java?rev=706650&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java Tue Oct 21 08:07:45 2008
@@ -0,0 +1,443 @@
+/*
+ * 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.sandesha2.storage.jdbc;
+
+import java.io.ByteArrayInputStream;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Collection;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
+import org.apache.sandesha2.storage.beans.RMDBean;
+import org.apache.sandesha2.util.RangeString;
+
+public class PersistentRMDBeanMgr extends PersistentBeanMgr implements RMDBeanMgr {
+
+	public PersistentRMDBeanMgr(PersistentStorageManager pmgr)
+	{
+		super(pmgr);
+	}
+
+	private String requestForModel(RMDBean bean)
+	{
+		StringBuilder sql = new StringBuilder(" select * from wsrm_rmd");
+		if ( bean == null ) return sql.toString();
+		String op = " where";
+		String clause = bean.getSequenceID();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" sequence_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		EndpointReference epr = bean.getToEndpointReference();
+		if ( epr != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" to_epr_addr='");
+			sql.append(epr.getAddress());
+			sql.append("'");
+		}
+		epr = bean.getReplyToEndpointReference();
+		if ( epr != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" reply_to_epr_addr='");
+			sql.append(epr.getAddress());
+			sql.append("'");
+		}
+		epr = bean.getAcksToEndpointReference();
+		if ( epr != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" acks_to_epr_addr='");
+			sql.append(epr.getAddress());
+			sql.append("'");
+		}
+		clause = bean.getRMVersion();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" rm_version='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getSecurityTokenData();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" security_token_data='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getReferenceMessageKey();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" reference_message_key='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getHighestInMessageId();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" highest_in_message_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getLastInMessageId();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" last_in_message_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getToAddress();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" to_address='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getOutboundInternalSequence();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" outbound_internal_sequence='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getOutboundInternalSequence();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" outbound_internal_sequence='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		RangeString rs = bean.getServerCompletedMessages();
+		if ( rs != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" server_completed_messages='");
+			sql.append(rs.toString());
+			sql.append("'");
+		}
+		rs = bean.getOutOfOrderRanges();
+		if ( rs != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" outof_order_ranges='");
+			sql.append(rs.toString());
+			sql.append("'");
+		}
+		if ( (bean.getRmdFlags() & RMDBean.NEXT_MSG_NO_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" next_msgno_to_process=");
+			sql.append(bean.getNextMsgNoToProcess());
+		}
+		if ( (bean.getRmdFlags() & RMDBean.HIGHEST_IN_MSG_FLAG ) != 0 ) {  
+			sql.append(op);
+			op = " and ";
+			sql.append(" highest_in_message_number=");
+			sql.append(bean.getHighestInMessageNumber());
+		}
+		if ( (bean.getFlags() & RMDBean.LAST_ACTIVATED_TIME_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" last_activated_time=");
+			sql.append(bean.getLastActivatedTime());
+		}
+		if ( (bean.getFlags() & RMDBean.CLOSED_FLAG ) != 0 ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" closed=");
+			sql.append(bean.isClosed() ? 1:0);
+		}
+		if ( (bean.getFlags() &  RMDBean.TERMINATED_FLAG ) != 0 ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" terminated_flag=");
+			sql.append(bean.isTerminated() ? 1:0);
+		}
+		if ( (bean.getFlags() & RMDBean.POLLING_MODE_FLAG) != 0 ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" polling_mode=");
+			sql.append(bean.isPollingMode() ? 1:0);
+		}
+		if ( log.isDebugEnabled() ) log.debug("requestForModel " + sql.toString());
+		return sql.toString();
+	}
+	
+	private RMDBean getBean(ResultSet rs)
+	  throws Exception
+	{
+		RMDBean bean = new RMDBean();
+		bean.setSequenceID(rs.getString("sequence_id"));
+		
+		Object obj = getObject(rs,"to_epr");
+		if ( obj != null ) {
+			bean.setToEndpointReference((EndpointReference)obj);
+		}
+		obj = getObject(rs,"reply_to_epr");
+		if ( obj != null ) {
+			bean.setReplyToEndpointReference((EndpointReference)obj);
+		}
+		obj = getObject(rs,"acks_to_epr");
+		if ( obj != null ) {
+			bean.setAcksToEndpointReference((EndpointReference)obj);
+		}
+
+		bean.setRMVersion(rs.getString("rm_version"));
+		bean.setServiceName(rs.getString("service_name"));
+		bean.setSecurityTokenData(rs.getString("security_token_data"));
+		bean.setReferenceMessageKey(rs.getString("reference_message_key"));
+		bean.setHighestInMessageId(rs.getString("highest_in_message_id"));
+		bean.setLastInMessageId(rs.getString("last_in_message_id"));
+		bean.setToAddress(rs.getString("to_address"));
+		bean.setOutboundInternalSequence(rs.getString("outbound_internal_sequence"));
+		
+		bean.setOutOfOrderRanges(new RangeString(rs.getString("outof_order_ranges")));
+		bean.setServerCompletedMessages(new RangeString(rs.getString("server_completed_messages")));
+		
+		bean.setHighestInMessageNumber(rs.getLong("highest_in_message_number"));
+		bean.setNextMsgNoToProcess(rs.getLong("next_msgno_to_process"));
+		bean.setLastActivatedTime(rs.getLong("last_activated_time"));
+		
+		bean.setClosed(rs.getInt("closed")!= 0 ? true:false);
+		bean.setPollingMode(rs.getInt("polling_mode")!= 0 ? true:false);
+		bean.setTerminated(rs.getInt("terminated_flag")!= 0 ? true:false);
+		
+		bean.setFlags(rs.getInt("flags"));
+		bean.setRmdFlags(rs.getInt("rmd_flags"));
+		return bean;
+	}
+
+	public boolean delete(String sequenceID)
+	  throws SandeshaStorageException
+	{
+		if(log.isDebugEnabled()) log.debug("delete RMSBean sequenceID " + sequenceID);
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			stmt.executeUpdate("delete from wsrm_rmd where sequence_id='" + sequenceID + "'");
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return true;
+	}
+	
+	public List find(RMDBean bean)
+	  throws SandeshaStorageException
+	{
+		String sql = requestForModel(bean);
+		ArrayList<RMDBean> lst = new ArrayList<RMDBean>();
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				lst.add(getBean(rs));
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		if(log.isDebugEnabled()) log.debug("Exit find lst.size(): " + lst.size());
+		return lst;
+	}
+	
+	public boolean insert(RMDBean bean)
+	  throws SandeshaStorageException
+	{
+		log.debug("insert " + bean);
+		try {
+	    	PreparedStatement pstmt = getDbConnection().prepareStatement("insert into wsrm_rmd(" +
+	    			"sequence_id,to_epr_addr,to_epr,reply_to_epr_addr,reply_to_epr,acks_to_epr_addr," +
+	    			"acks_to_epr,rm_version,security_token_data," +
+	    			"last_activated_time,closed,terminated_flag,polling_mode,service_name," +
+	    			"flags,reference_message_key,highest_in_message_id,last_in_message_id," +
+	    			"server_completed_messages,outof_order_ranges,to_address," +
+	    			"outbound_internal_sequence,next_msgno_to_process,highest_in_message_number,rmd_flags" +
+	    			")values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+		   	pstmt.setString(1,bean.getSequenceID());
+		   	EndpointReference epr = bean.getToEndpointReference();
+		   	pstmt.setString(2,epr != null ? epr.getAddress():null);
+			// Derby don't serialize object in blob !
+			// pstmt.setObject(3, epr);
+			ByteArrayInputStream bais = serialize(epr);
+			pstmt.setBinaryStream(3, bais, bais.available());
+		   	epr = bean.getReplyToEndpointReference();
+		   	pstmt.setString(4,epr != null ? epr.getAddress():null);
+			bais = serialize(epr);
+			pstmt.setBinaryStream(5, bais, bais.available());
+		   	epr = bean.getAcksToEndpointReference();
+		   	pstmt.setString(6,epr != null ? epr.getAddress():null);
+			bais = serialize(epr);
+			pstmt.setBinaryStream(7, bais, bais.available());
+		   	pstmt.setString(8,bean.getRMVersion());
+		   	pstmt.setString(9,bean.getSecurityTokenData());
+		   	pstmt.setLong(10,bean.getLastActivatedTime());
+		   	pstmt.setInt(11,bean.isClosed() ? 1 : 0);
+		   	pstmt.setInt(12,bean.isTerminated() ? 1 : 0);
+		   	pstmt.setInt(13,bean.isPollingMode() ? 1 : 0);
+		   	pstmt.setString(14,bean.getServiceName());
+		   	pstmt.setInt(15,bean.getFlags());
+		   	pstmt.setString(16,bean.getReferenceMessageKey());
+		   	pstmt.setString(17,bean.getHighestInMessageId());
+		   	pstmt.setString(18,bean.getLastInMessageId());
+		   	RangeString trs = bean.getServerCompletedMessages();
+		   	pstmt.setString(19,trs == null ? null : trs.toString());
+		   	trs = bean.getOutOfOrderRanges();
+		   	pstmt.setString(20,trs == null ? null : trs.toString());
+		   	pstmt.setString(21,bean.getToAddress());
+		   	pstmt.setString(22,bean.getOutboundInternalSequence());
+		   	pstmt.setLong(23,bean.getNextMsgNoToProcess());
+		   	pstmt.setLong(24,bean.getHighestInMessageNumber());
+		   	pstmt.setInt(25,bean.getRmdFlags());
+		    pstmt.execute();
+		    pstmt.close();
+		} catch (Exception ex) {
+			log.debug("Insert Exception  ", ex);
+			throw new SandeshaStorageException(ex);
+		}
+		return true;
+	}
+	
+	public RMDBean retrieve(String sequenceID)
+	  throws SandeshaStorageException
+	{
+		RMDBean bean = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery("select * from wsrm_rmd where sequence_id='" + sequenceID + "'");
+			if ( ! rs.next() ) return bean;
+			bean = getBean(rs);
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return bean;
+	}
+	
+	public Collection retrieveAll()
+	  throws SandeshaStorageException
+	{
+		return find(null);
+	}
+	
+	public boolean update(RMDBean bean)
+	  throws SandeshaStorageException
+	{
+		log.debug("update " + bean);
+		try {
+	    	PreparedStatement pstmt = getDbConnection().prepareStatement("update wsrm_rmd set " +
+	    			"to_epr_addr=?,to_epr=?,reply_to_epr_addr=?,reply_to_epr=?,acks_to_epr_addr=?," +
+	    			"acks_to_epr=?,rm_version=?,security_token_data=?," +
+	    			"last_activated_time=?,closed=?,terminated_flag=?,polling_mode=?,service_name=?," +
+	    			"flags=?,reference_message_key=?,highest_in_message_id=?,last_in_message_id=?," +
+	    			"server_completed_messages=?,outof_order_ranges=?,to_address=?," +
+	    			"outbound_internal_sequence=?,next_msgno_to_process=?,highest_in_message_number=?,rmd_flags=?" +
+	    			" where sequence_id='" + bean.getSequenceID() + "'");
+		   	EndpointReference epr = bean.getToEndpointReference();
+		   	pstmt.setString(1,epr != null ? epr.getAddress():null);
+			// Derby don't serialize object in blob !
+			// pstmt.setObject(2, epr);
+			ByteArrayInputStream bais = serialize(epr);
+			pstmt.setBinaryStream(2, bais, bais.available());
+		   	epr = bean.getReplyToEndpointReference();
+		   	pstmt.setString(3,epr != null ? epr.getAddress():null);
+			bais = serialize(epr);
+			pstmt.setBinaryStream(4, bais, bais.available());
+		   	epr = bean.getAcksToEndpointReference();
+		   	pstmt.setString(5,epr != null ? epr.getAddress():null);
+			bais = serialize(epr);
+			pstmt.setBinaryStream(6, bais, bais.available());
+		   	pstmt.setString(7,bean.getRMVersion());
+		   	pstmt.setString(8,bean.getSecurityTokenData());
+		   	pstmt.setLong(9,bean.getLastActivatedTime());
+		   	pstmt.setInt(10,bean.isClosed() ? 1 : 0);
+		   	pstmt.setInt(11,bean.isTerminated() ? 1 : 0);
+		   	pstmt.setInt(12,bean.isPollingMode() ? 1 : 0);
+		   	pstmt.setString(13,bean.getServiceName());
+		   	pstmt.setInt(14,bean.getFlags());
+		   	pstmt.setString(15,bean.getReferenceMessageKey());
+		   	pstmt.setString(16,bean.getHighestInMessageId());
+		   	pstmt.setString(17,bean.getLastInMessageId());
+		   	RangeString rs = bean.getServerCompletedMessages();
+		   	pstmt.setString(18,rs != null ? rs.toString():null);
+		   	rs = bean.getOutOfOrderRanges();
+		   	pstmt.setString(19,rs != null ? rs.toString():null);
+		   	pstmt.setString(20,bean.getToAddress());
+		   	pstmt.setString(21,bean.getOutboundInternalSequence());
+		   	pstmt.setLong(22,bean.getNextMsgNoToProcess());
+		   	pstmt.setLong(23,bean.getHighestInMessageNumber());
+		   	pstmt.setInt(24,bean.getRmdFlags());
+		    pstmt.execute();
+		    pstmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return true;
+	}
+	
+	public RMDBean findUnique(RMDBean bean)
+	  throws SandeshaStorageException
+	{
+		String sql = requestForModel(bean);
+		RMDBean result = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				if ( result == null ) {
+				 result = getBean(rs);
+				} else {
+					String message = SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.nonUniqueResult,
+							result.toString(),
+							getBean(rs).toString());
+					log.error(message);
+					throw new SandeshaException (message);
+				}
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}		
+		return result;
+	}		
+}

Added: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java?rev=706650&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java Tue Oct 21 08:07:45 2008
@@ -0,0 +1,614 @@
+/*
+ * 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.sandesha2.storage.jdbc;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.sql.*;
+import java.io.ByteArrayInputStream;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beanmanagers.RMSBeanMgr;
+import org.apache.sandesha2.storage.beans.RMSBean;
+import org.apache.sandesha2.util.RangeString;
+
+public class PersistentRMSBeanMgr extends PersistentBeanMgr implements RMSBeanMgr {
+
+	public PersistentRMSBeanMgr(PersistentStorageManager pmgr)
+	{
+		super(pmgr);
+	}
+
+	private String requestForModel(RMSBean bean)
+	{
+		StringBuilder sql = new StringBuilder(" select * from wsrm_rms");
+		if ( bean == null ) return sql.toString();
+		String op = " where ";
+		String clause = bean.getSequenceID();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" sequence_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		EndpointReference epr = bean.getToEndpointReference();
+		if ( epr != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" to_epr_addr='");
+			sql.append(epr.getAddress());
+			sql.append("'");
+		}
+		epr = bean.getReplyToEndpointReference();
+		if ( epr != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" reply_to_epr_addr='");
+			sql.append(epr.getAddress());
+			sql.append("'");
+		}
+		epr = bean.getAcksToEndpointReference();
+		if ( epr != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" acks_to_epr_addr='");
+			sql.append(epr.getAddress());
+			sql.append("'");
+		}
+		clause = bean.getRMVersion();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" rm_version='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getSecurityTokenData();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" security_token_data='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getCreateSeqMsgID();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" create_seq_msg_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getInternalSequenceID();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" internal_sequence_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getCreateSequenceMsgStoreKey();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" create_sequence_msg_store_key='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getReferenceMessageStoreKey();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" create_sequence_msg_store_key='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getTransportTo();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" transport_to='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getOfferedEndPoint();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" offered_endpoint='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getOfferedSequence();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" offered_sequence='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getAnonymousUUID();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" anonymous_uuid='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		RangeString xrs = bean.getClientCompletedMessages();
+		if ( xrs != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" client_completed_messages='");
+			sql.append(xrs.toString());
+			sql.append("'");
+		}
+		if ( (bean.getRmsFlags() & RMSBean.LAST_SEND_ERROR_TIME_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" last_send_error_timestamp=");
+			sql.append(bean.getLastSendErrorTimestamp());
+		}
+		if ( (bean.getRmsFlags() & RMSBean.LAST_OUT_MSG_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" last_out_message=");
+			sql.append(bean.getLastOutMessage());
+		}
+		if ( (bean.getRmsFlags() & RMSBean.HIGHEST_OUT_MSG_FLAG ) != 0 ) {   
+			sql.append(op);
+			op = " and ";
+			sql.append(" highest_out_message_number=");
+			sql.append(bean.getHighestOutMessageNumber());
+		}
+		if ( (bean.getRmsFlags() & RMSBean.NEXT_MSG_NUM_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" next_message_number=");
+			sql.append(bean.getNextMessageNumber());
+		}
+		if ( (bean.getRmsFlags() & RMSBean.TERMINATE_ADDED_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" terminate_added=");
+			sql.append(bean.isTerminateAdded()?1:0);
+		}
+		if ( (bean.getRmsFlags() & RMSBean.TIMED_OUT_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" timed_out=");
+			sql.append(bean.isTimedOut()?1:0);
+		}
+		if ( (bean.getRmsFlags() & RMSBean.SEQ_CLOSED_CLIENT_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" sequence_closed_client=");
+			sql.append(bean.isSequenceClosedClient()?1:0);
+		}
+		if ( (bean.getRmsFlags() & RMSBean.TERM_PAUSER_FOR_CS ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" termination_pauser_for_cs=");
+			sql.append(bean.isTerminationPauserForCS()?1:0);
+		}
+		if ( (bean.getRmsFlags() & RMSBean.EXPECTED_REPLIES ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" expected_replies=");
+			sql.append(bean.getExpectedReplies());
+		}
+		if ( (bean.getRmsFlags() & RMSBean.SOAP_VERSION_FLAG) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" soap_version=");
+			sql.append(bean.getSoapVersion());
+		}
+		
+		if ( (bean.getFlags() & RMSBean.LAST_ACTIVATED_TIME_FLAG ) != 0 ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" last_activated_time=");
+			sql.append(bean.getLastActivatedTime());
+		}
+		if ( (bean.getFlags() & RMSBean.CLOSED_FLAG) != 0 ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" closed=");
+			sql.append(bean.isClosed() ? 1:0);
+		}
+		if ( (bean.getFlags() & RMSBean.TERMINATED_FLAG) != 0 ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" terminated_flag=");
+			sql.append(bean.isTerminated() ? 1:0);
+		}
+		if ( (bean.getFlags() & RMSBean.POLLING_MODE_FLAG) != 0 ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" polling_mode=");
+			sql.append(bean.isPollingMode() ? 1:0);
+		}
+		/* only for WSRM 1.0 ?
+		if ( (bean.getFlags() & 0x0010000) != 0 ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" replay_model=");
+			sql.append(bean.isReplayModel() ? 1:0);
+		} */
+		if ( log.isDebugEnabled() ) log.debug("requestForModel " + sql.toString());
+		return sql.toString();
+	}
+	
+	private RMSBean getBean(ResultSet rs)
+	  throws Exception
+	{
+		RMSBean bean = new RMSBean();
+		bean.setSequenceID(rs.getString("sequence_id"));
+
+		Object obj = getObject(rs,"to_epr");
+		if ( obj != null ) {
+			bean.setToEndpointReference((EndpointReference)obj);
+		}
+		obj = getObject(rs,"reply_to_epr");
+		if ( obj != null ) {
+			bean.setReplyToEndpointReference((EndpointReference)obj);
+		}
+		obj = getObject(rs,"acks_to_epr");
+		if ( obj != null ) {
+			bean.setAcksToEndpointReference((EndpointReference)obj);
+		}
+		
+		bean.setRMVersion(rs.getString("rm_version"));
+		bean.setServiceName(rs.getString("service_name"));
+		bean.setSecurityTokenData(rs.getString("security_token_data"));
+		bean.setCreateSeqMsgID(rs.getString("create_seq_msg_id"));
+		bean.setTransportTo(rs.getString("transport_to"));
+		bean.setOfferedEndPoint(rs.getString("offered_endpoint"));
+		bean.setOfferedSequence(rs.getString("offered_sequence"));
+		bean.setAnonymousUUID(rs.getString("anonymous_uuid"));
+		bean.setInternalSequenceID(rs.getString("internal_sequence_id"));
+		bean.setReferenceMessageStoreKey(rs.getString("reference_msg_store_key"));
+		bean.setCreateSequenceMsgStoreKey(rs.getString("create_sequence_msg_store_key"));
+		bean.setHighestOutRelatesTo(rs.getString("highest_out_relates_to"));
+
+		obj = getObject(rs,"last_send_error");
+		if ( obj != null ) bean.setLastSendError((Exception)obj);
+
+		bean.setClientCompletedMessages(new RangeString(rs.getString("client_completed_messages")));
+		
+		bean.setLastSendErrorTimestamp(rs.getLong("last_send_error_timestamp"));
+		bean.setLastOutMessage(rs.getLong("last_out_message"));
+		bean.setHighestOutMessageNumber(rs.getLong("highest_out_message_number"));
+		bean.setNextMessageNumber(rs.getLong("next_message_number"));
+		bean.setLastActivatedTime(rs.getLong("last_activated_time"));
+		bean.setExpectedReplies(rs.getLong("expected_replies"));
+		
+		bean.setClosed(rs.getInt("closed")!= 0 ? true:false);
+		bean.setPollingMode(rs.getInt("polling_mode")!= 0 ? true:false);
+		bean.setTerminated(rs.getInt("terminated_flag")!= 0 ? true:false);
+		bean.setTerminateAdded(rs.getInt("terminate_added")!= 0 ? true:false);
+		bean.setTimedOut(rs.getInt("timed_out")!= 0 ? true:false);
+		bean.setSequenceClosedClient(rs.getInt("sequence_closed_client")!= 0 ? true:false);
+		bean.setTerminationPauserForCS(rs.getInt("termination_pauser_for_cs")!= 0 ? true:false);
+		bean.setAvoidAutoTermination(rs.getInt("avoid_auto_termination")!= 0 ? true:false);
+		
+		bean.setSoapVersion(rs.getInt("soap_version"));
+		bean.setFlags(rs.getInt("flags"));
+		bean.setRmsFlags(rs.getInt("rms_flags"));
+		return bean;
+	}
+
+
+	public boolean delete(String msgId)
+	  throws SandeshaStorageException
+	{
+		if(log.isDebugEnabled()) log.debug("delete RMSBean msgId " + msgId);
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			stmt.executeUpdate("delete from wsrm_rms where create_seq_msg_id='" + msgId + "'");
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException("Exception in RMSBeanMgr delete", ex);
+		}
+		return true;
+	}
+	
+	public List find(RMSBean bean)
+	  throws SandeshaStorageException
+	{
+		String sql = requestForModel(bean);
+		ArrayList<RMSBean> lst = new ArrayList<RMSBean>();
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				lst.add(getBean(rs));
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException("Exception in RMSBeanMgr find : " + sql, ex);
+		}
+		return lst;
+	}
+
+	
+	public boolean insert(RMSBean bean)
+	  throws SandeshaStorageException
+	{
+		log.debug("insert RMSBean " + bean);
+		try {
+		    PreparedStatement pstmt = getDbConnection().prepareStatement("insert into wsrm_rms(" +
+		    		"create_seq_msg_id,sequence_id,to_epr_addr,to_epr,reply_to_epr_addr,reply_to_epr,acks_to_epr_addr,acks_to_epr,rm_version,security_token_data," +
+		    		"last_activated_time,closed,terminated_flag,polling_mode,service_name," +
+		    		"flags,id,internal_sequence_id,create_sequence_msg_store_key," +
+		    		"reference_msg_store_key,last_send_error,highest_out_relates_to," +
+		    		"client_completed_messages,transport_to,offered_endpoint,offered_sequence," +
+		    		"anonymous_uuid,last_send_error_timestamp,last_out_message,highest_out_message_number," +
+		    		"next_message_number,terminate_added,timed_out,sequence_closed_client," +
+		    		"expected_replies,soap_version,termination_pauser_for_cs,avoid_auto_termination," +
+		    		"rms_flags)values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+			 pstmt.setString(1,bean.getCreateSeqMsgID());
+			 pstmt.setString(2,bean.getSequenceID());
+			 EndpointReference epr = bean.getToEndpointReference();
+			 pstmt.setString(3,epr != null ? epr.getAddress():null);
+			 // Derby don't serialize object in blob !
+			 // pstmt.setObject(4, epr);
+			 ByteArrayInputStream bais = serialize(epr);
+			 pstmt.setBinaryStream(4, bais, bais.available());
+			 epr = bean.getReplyToEndpointReference();
+			 pstmt.setString(5,epr != null ? epr.getAddress():null);
+			 bais = serialize(epr);
+			 pstmt.setBinaryStream(6, bais, bais.available());
+			 epr = bean.getAcksToEndpointReference();
+			 pstmt.setString(7,epr != null ? epr.getAddress():null);
+			 bais = serialize(epr);
+			 pstmt.setBinaryStream(8, bais, bais.available());
+			 pstmt.setString(9,bean.getRMVersion());
+			 pstmt.setString(10,bean.getSecurityTokenData());
+			 pstmt.setLong(11,bean.getLastActivatedTime());
+			 pstmt.setInt(12,bean.isClosed() ? 1 : 0);
+			 pstmt.setInt(13,bean.isTerminated() ? 1 : 0);
+			 pstmt.setInt(14,bean.isPollingMode() ? 1 : 0);
+			 pstmt.setString(15,bean.getServiceName());
+			 pstmt.setInt(16,bean.getFlags());
+			 pstmt.setLong(17,bean.getId());
+			 pstmt.setString(18,bean.getInternalSequenceID());
+			 pstmt.setString(19,bean.getCreateSequenceMsgStoreKey());
+			 pstmt.setString(20,bean.getReferenceMessageStoreKey());
+			 bais = serialize(bean.getLastSendError());
+			 pstmt.setBinaryStream(21, bais, bais.available());
+			 pstmt.setString(22,bean.getHighestOutRelatesTo());
+			 RangeString rs = bean.getClientCompletedMessages();
+			 pstmt.setString(23,rs != null ? rs.toString():null);
+			 pstmt.setString(24,bean.getTransportTo());
+			 pstmt.setString(25,bean.getOfferedEndPoint());
+			 pstmt.setString(26,bean.getOfferedSequence());
+			 pstmt.setString(27,bean.getAnonymousUUID());
+			 pstmt.setLong(28,bean.getLastSendErrorTimestamp());
+			 pstmt.setLong(29,bean.getLastOutMessage());
+			 pstmt.setLong(30,bean.getHighestOutMessageNumber());
+			 pstmt.setLong(31,bean.getNextMessageNumber());
+			 pstmt.setInt(32,bean.isTerminateAdded() ? 1:0);
+			 pstmt.setInt(33,bean.isTimedOut() ? 1:0);
+			 pstmt.setInt(34,bean.isSequenceClosedClient() ? 1:0);
+			 pstmt.setLong(35,bean.getExpectedReplies());
+			 pstmt.setInt(36,bean.getSoapVersion());
+			 pstmt.setInt(37,bean.isTerminationPauserForCS() ? 1:0);
+			 pstmt.setInt(38,bean.isAvoidAutoTermination() ? 1:0);
+			 pstmt.setInt(39,bean.getRmsFlags());
+			 pstmt.execute();
+			 pstmt.close();
+		} catch (Exception ex) {
+			log.debug("Insert Exception  ", ex);
+			throw new SandeshaStorageException("Exception in RMSBeanMgr insert", ex);
+		}
+		return true;
+	}
+	
+	public RMSBean retrieve(String msgId)
+	  throws SandeshaStorageException
+	{
+		log.debug("Retrieve  msdId " + msgId);
+		RMSBean bean = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery("select * from wsrm_rms where create_seq_msg_id='" + msgId + "'");
+			if ( rs.next() ) bean = getBean(rs);
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			log.debug("Retrieve Exception  ", ex);
+			throw new SandeshaStorageException("Exception in RMSBeanMgr retrieve", ex);
+		}
+		log.debug("Retrieve  return " + bean);
+		return bean;
+	}
+	
+	public boolean update(RMSBean bean)
+	  throws SandeshaStorageException
+	{
+		if ( log.isDebugEnabled()) {
+		  log.debug("Update bean : " + bean);
+		}
+			try {
+		    	PreparedStatement pstmt = getDbConnection().prepareStatement("update wsrm_rms set " +
+		    			"sequence_id=?,to_epr_addr=?,to_epr=?,reply_to_epr_addr=?,reply_to_epr=?,acks_to_epr_addr=?,acks_to_epr=?,rm_version=?,security_token_data=?," +
+		    			"last_activated_time=?,closed=?,terminated_flag=?,polling_mode=?,service_name=?," +
+		    			"flags=?,id=?,internal_sequence_id=?,create_sequence_msg_store_key=?," +
+		    			"reference_msg_store_key=?,last_send_error=?,highest_out_relates_to=?," +
+		    			"client_completed_messages=?,transport_to=?,offered_endpoint=?,offered_sequence=?," +
+		    			"anonymous_uuid=?,last_send_error_timestamp=?,last_out_message=?,highest_out_message_number=?," +
+		    			"next_message_number=?,terminate_added=?,timed_out=?,sequence_closed_client=?," +
+		    			"expected_replies=?,soap_version=?,termination_pauser_for_cs=?,avoid_auto_termination=?," +
+		    			"rms_flags=?" +
+		    			" where create_seq_msg_id='" + bean.getCreateSeqMsgID() + "'");
+			   	pstmt.setString(1,bean.getSequenceID());
+			   	EndpointReference epr = bean.getToEndpointReference();
+			   	pstmt.setString(2,epr != null ? epr.getAddress():null);
+				 // Derby don't serialize object in blob !
+				 // pstmt.setObject(3, epr);
+				 ByteArrayInputStream bais = serialize(epr);
+				 pstmt.setBinaryStream(3, bais, bais.available());
+			   	epr = bean.getReplyToEndpointReference();
+			   	pstmt.setString(4,epr != null ? epr.getAddress():null);
+				 bais = serialize(epr);
+				 pstmt.setBinaryStream(5, bais, bais.available());
+			   	epr = bean.getAcksToEndpointReference();
+			   	pstmt.setString(6,epr != null ? epr.getAddress():null);
+				 bais = serialize(epr);
+				 pstmt.setBinaryStream(7, bais, bais.available());
+			   	pstmt.setString(8,bean.getRMVersion());
+			   	pstmt.setString(9,bean.getSecurityTokenData());
+			   	pstmt.setLong(10,bean.getLastActivatedTime());
+			   	pstmt.setInt(11,bean.isClosed() ? 1 : 0);
+			   	pstmt.setInt(12,bean.isTerminated() ? 1 : 0);
+			   	pstmt.setInt(13,bean.isPollingMode() ? 1 : 0);
+			   	pstmt.setString(14,bean.getServiceName());
+			   	pstmt.setInt(15,bean.getFlags());
+			   	pstmt.setLong(16,bean.getId());
+			   	pstmt.setString(17,bean.getInternalSequenceID());
+			   	pstmt.setString(18,bean.getCreateSequenceMsgStoreKey());
+			   	pstmt.setString(19,bean.getReferenceMessageStoreKey());
+				 bais = serialize(bean.getLastSendError());
+				 pstmt.setBinaryStream(20, bais, bais.available());
+			   	pstmt.setString(21,bean.getHighestOutRelatesTo());
+			   	RangeString rs = bean.getClientCompletedMessages();
+			   	pstmt.setString(22,rs != null ? rs.toString():null);
+			   	pstmt.setString(23,bean.getTransportTo());
+			   	pstmt.setString(24,bean.getOfferedEndPoint());
+			   	pstmt.setString(25,bean.getOfferedSequence());
+			   	pstmt.setString(26,bean.getAnonymousUUID());
+			   	pstmt.setLong(27,bean.getLastSendErrorTimestamp());
+			   	pstmt.setLong(28,bean.getLastOutMessage());
+			   	pstmt.setLong(29,bean.getHighestOutMessageNumber());
+			   	pstmt.setLong(30,bean.getNextMessageNumber());
+			   	pstmt.setInt(31,bean.isTerminateAdded() ? 1:0);
+			   	pstmt.setInt(32,bean.isTimedOut() ? 1:0);
+			   	pstmt.setInt(33,bean.isSequenceClosedClient() ? 1:0);
+			   	pstmt.setLong(34,bean.getExpectedReplies());
+			   	pstmt.setInt(35,bean.getSoapVersion());
+			   	pstmt.setInt(36,bean.isTerminationPauserForCS() ? 1:0);
+			   	pstmt.setInt(37,bean.isAvoidAutoTermination() ? 1:0);
+			   	pstmt.setInt(38,bean.getRmsFlags());
+			    pstmt.execute();
+			    pstmt.close();
+			} catch (Exception ex) {
+				log.error("Update Exception " + ex);
+				throw new SandeshaStorageException("Exception in RMSBeanMgr update", ex);
+			}
+			return true;
+		}
+	
+	public RMSBean findUnique(RMSBean bean)
+	  throws SandeshaStorageException
+	{
+		String sql = requestForModel(bean);
+		RMSBean result = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				if ( result == null ) {
+					result = getBean(rs);
+				} else {
+					String message = SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.nonUniqueResult,
+							result.toString(),
+							getBean(rs).toString());
+					log.error(message);
+					throw new SandeshaException (message);
+				}
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			log.error("Exception in findUnique " + ex);
+			throw new SandeshaStorageException("Exception in PersistentRMSBeanManager::findUnique", ex);
+		}		
+		log.debug("FindUnique RMSBean : " + result);
+		return result;
+	}
+
+    public RMSBean retrieveBySequenceID(String seqId) throws SandeshaStorageException {
+        RMSBean dummyBean = new RMSBean();
+        dummyBean.setSequenceID(seqId);
+        String sql = requestForModel(dummyBean);
+		RMSBean result = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				if ( result == null ) {
+					result = getBean(rs);
+				} else {
+					String message = SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.nonUniqueResult,
+							result.toString(),
+							getBean(rs).toString());
+					log.error(message);
+					throw new SandeshaException (message);
+				}
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			log.error("Exception in findUnique " + ex);
+			throw new SandeshaStorageException("Exception in PersistentRMSBeanManager::findUnique", ex);
+		}
+		log.debug("FindUnique RMSBean : " + result);
+		return result;
+    }
+
+    public RMSBean retrieveByInternalSequenceID(String internalSeqId) throws SandeshaStorageException {
+        RMSBean dummyBean = new RMSBean();
+        dummyBean.setInternalSequenceID(internalSeqId);
+        String sql = requestForModel(dummyBean);
+		RMSBean result = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				if ( result == null ) {
+					result = getBean(rs);
+				} else {
+					String message = SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.nonUniqueResult,
+							result.toString(),
+							getBean(rs).toString());
+					log.error(message);
+					throw new SandeshaException (message);
+				}
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			log.error("Exception in findUnique " + ex);
+			throw new SandeshaStorageException("Exception in PersistentRMSBeanManager::findUnique", ex);
+		}
+		log.debug("FindUnique RMSBean : " + result);
+		return result;
+    }
+}

Added: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java?rev=706650&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java Tue Oct 21 08:07:45 2008
@@ -0,0 +1,410 @@
+/*
+ * 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.sandesha2.storage.jdbc;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+import org.apache.sandesha2.storage.beans.SenderBean;
+
+/**
+ * Manages Sender Beans
+ */
+public class PersistentSenderBeanMgr extends PersistentBeanMgr implements SenderBeanMgr {
+
+	public PersistentSenderBeanMgr(PersistentStorageManager pmgr)
+	{
+		super(pmgr);
+	}
+	
+	private String requestForModel(SenderBean bean)
+	{
+		StringBuilder sql = new StringBuilder("select * from wsrm_sender");
+		if ( bean == null ) return sql.toString();
+		String op = " where ";
+		String clause = bean.getSequenceID();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" sequence_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getMessageID();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" message_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getMessageContextRefKey();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" message_context_ref_key='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getInternalSequenceID();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" internal_sequence_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getToAddress();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" to_address='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		clause = bean.getInboundSequenceId();
+		if ( clause != null ) {
+			sql.append(op);
+			op = " and ";
+			sql.append(" inbound_sequence_id='");
+			sql.append(clause);
+			sql.append("'");
+		}
+		
+		if ( (bean.getFlags() & SenderBean.SEND_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" send=");
+			sql.append(bean.isSend() ? 1:0);
+		}
+		if ( (bean.getFlags() & SenderBean.SEND_COUNT_FLAG ) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" sent_count=");
+			sql.append(bean.getSentCount());
+		}
+		if ( (bean.getFlags() & 0x00000100) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" message_number=");
+			sql.append(bean.getMessageNumber());
+		}
+		if ( (bean.getFlags() & 0x00001000) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" resend=");
+			sql.append(bean.isReSend() ? 1:0);
+		}
+		if ( (bean.getFlags() & 0x00010000) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" time_to_send<=");
+			sql.append(bean.getTimeToSend());
+		}
+		if ( (bean.getFlags() & 0x00100000) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" message_type=");
+			sql.append(bean.getMessageType());
+		}
+		if ( (bean.getFlags() & 0x01000000) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" last_message=");
+			sql.append(bean.isLastMessage() ? 1:0);
+		}
+		if ( (bean.getFlags() & 0x10000000) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" inbound_message_number=");
+			sql.append(bean.getInboundMessageNumber());
+		}
+		if ( (bean.getFlags() & 0x00000002) != 0 ) { 
+			sql.append(op);
+			op = " and ";
+			sql.append(" transport_available=");
+			sql.append(bean.isTransportAvailable() ? 1:0);
+		}
+		log.debug("requestForModel " + sql.toString());
+		return sql.toString();
+	}
+	
+	private SenderBean getBean(ResultSet rs)
+	  throws Exception
+	{
+		SenderBean bean = new SenderBean();
+		bean.setMessageID(rs.getString("message_id"));
+		bean.setMessageContextRefKey(rs.getString("message_context_ref_key"));
+		bean.setSequenceID(rs.getString("sequence_id"));
+		bean.setInternalSequenceID(rs.getString("internal_sequence_id"));
+		bean.setToAddress(rs.getString("to_address"));
+		bean.setInboundSequenceId(rs.getString("inbound_sequence_id"));
+				
+		bean.setMessageNumber(rs.getLong("message_number"));
+		bean.setTimeToSend(rs.getLong("time_to_send"));
+		bean.setInboundMessageNumber(rs.getLong("inbound_message_number"));
+		
+		bean.setSend(rs.getInt("send")!= 0 ? true:false);
+		bean.setReSend(rs.getInt("resend")!= 0 ? true:false);
+		bean.setLastMessage(rs.getInt("last_message")!= 0 ? true:false);
+		bean.setTransportAvailable(rs.getInt("transport_available")!= 0 ? true:false);
+		
+		bean.setSentCount(rs.getInt("sent_count"));
+		bean.setMessageType(rs.getInt("message_type"));
+		bean.setFlags(rs.getInt("flags"));
+		return bean;
+	}
+
+	public boolean delete(String messageID)
+	  throws SandeshaStorageException
+	{
+		if ( log.isDebugEnabled() ) log.debug("Delete MsgID " + messageID);
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			stmt.executeUpdate("delete from wsrm_sender where message_id='" + messageID + "'");
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return true;
+	}
+	
+	public List find(SenderBean bean)
+	  throws SandeshaStorageException
+	{
+		String sql = requestForModel(bean);
+		ArrayList<SenderBean> lst = new ArrayList<SenderBean>();
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				lst.add(getBean(rs));
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return lst;
+	}
+
+	
+	public List find(String internalSequenceId)
+	  throws SandeshaStorageException
+		{
+			ArrayList<SenderBean> lst = new ArrayList<SenderBean>();
+			try {
+				Statement stmt = getDbConnection().createStatement();
+				ResultSet rs = stmt.executeQuery("select * from wsrm_sender where internal_sequence_id='" +
+						internalSequenceId + "'");
+				while ( rs.next() ) {
+					lst.add(getBean(rs));
+				}
+				rs.close();
+				stmt.close();
+			} catch (Exception ex) {
+				throw new SandeshaStorageException(ex);
+			}
+			return lst;
+		}
+	
+	public SenderBean getNextMsgToSend(String sequenceId)
+	  throws SandeshaStorageException
+	{
+	  SenderBean result = null;
+	  try {
+		Statement stmt = getDbConnection().createStatement();
+		String sql = "select * from wsrm_sender where sequence_id";
+		if ( sequenceId == null ) sql += " is null ";
+		else sql += "='" + sequenceId + "' ";
+		sql += "and transport_available=1 and send=1";
+		log.debug("getNextMsgToSend " + sql);
+		ResultSet rs = stmt.executeQuery(sql);
+		long timeNow = System.currentTimeMillis();
+		log.debug("getNextMsgToSend timeNow " + timeNow);
+		while (rs.next()) {
+			if ( timeNow >= rs.getLong("time_to_send") ) {
+			  result = getBean(rs);
+			  break;
+			}
+		}
+		rs.close();
+		stmt.close();
+	  } catch (Exception ex) {
+			log.error("getNextMsgToSend Exception" + ex);
+			throw new SandeshaStorageException(ex);
+	  }
+	  if(log.isDebugEnabled()) log.debug("Exit getNextMessageToSend " + result);
+	  return result;
+	}
+	
+	public boolean insert(SenderBean bean)
+	  throws SandeshaStorageException
+	{
+		if ( log.isDebugEnabled() ) log.debug("Insert " + bean);
+		try {
+		    PreparedStatement pstmt = getDbConnection().prepareStatement("insert into wsrm_sender(" +
+		    		"message_id, message_context_ref_key, internal_sequence_id, sequence_id," +
+		    		"to_address, inbound_sequence_id, send, sent_count, message_number, resend," +
+		    		"time_to_send, message_type, last_message, inbound_message_number, transport_available," +
+		    		"flags)values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+			 pstmt.setString(1,bean.getMessageID());
+			 pstmt.setString(2,bean.getMessageContextRefKey());
+			 pstmt.setString(3,bean.getInternalSequenceID());
+			 pstmt.setString(4,bean.getSequenceID());
+			 pstmt.setString(5,bean.getToAddress());
+			 pstmt.setString(6,bean.getInboundSequenceId());
+			 pstmt.setInt(7,bean.isSend() ? 1 : 0);
+			 pstmt.setInt(8,bean.getSentCount());
+			 pstmt.setLong(9,bean.getMessageNumber());
+			 pstmt.setInt(10,bean.isReSend() ? 1 : 0);
+			 pstmt.setLong(11,bean.getTimeToSend());
+			 pstmt.setInt(12,bean.getMessageType());
+			 pstmt.setInt(13,bean.isLastMessage() ? 1 : 0);
+			 pstmt.setLong(14,bean.getInboundMessageNumber());
+			 pstmt.setInt(15,bean.isTransportAvailable() ? 1 : 0);
+			 pstmt.setInt(16,bean.getFlags());
+			 pstmt.execute();
+			 pstmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return true;
+	}
+	
+	public SenderBean retrieve(String messageID)
+	  throws SandeshaStorageException
+	{
+		SenderBean bean = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery("select * from wsrm_sender where message_id='" + messageID + "'");
+			if ( ! rs.next() ) return bean;
+			bean = getBean(rs);
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}
+		return bean;
+	}
+	
+	public boolean update(SenderBean bean)
+	  throws SandeshaStorageException
+	{
+		if ( log.isDebugEnabled() ) log.debug("Update " + bean);
+		try {
+		    PreparedStatement pstmt = getDbConnection().prepareStatement("update wsrm_sender set " +
+		    		"message_context_ref_key=?, internal_sequence_id=?, sequence_id=?," +
+		    		"to_address=?, inbound_sequence_id=?, send=?, sent_count=?, message_number=?, resend=?," +
+		    		"time_to_send=?, message_type=?, last_message=?, inbound_message_number=?, transport_available=?," +
+		    		"flags=? where message_id='" + bean.getMessageID() + "'");
+			 pstmt.setString(1,bean.getMessageContextRefKey());
+			 pstmt.setString(2,bean.getInternalSequenceID());
+			 pstmt.setString(3,bean.getSequenceID());
+			 pstmt.setString(4,bean.getToAddress());
+			 pstmt.setString(5,bean.getInboundSequenceId());
+			 pstmt.setInt(6,bean.isSend() ? 1 : 0);
+			 pstmt.setInt(7,bean.getSentCount());
+			 pstmt.setLong(8,bean.getMessageNumber());
+			 pstmt.setInt(9,bean.isReSend() ? 1 : 0);
+			 pstmt.setLong(10,bean.getTimeToSend());
+			 pstmt.setInt(11,bean.getMessageType());
+			 pstmt.setInt(12,bean.isLastMessage() ? 1 : 0);
+			 pstmt.setLong(13,bean.getInboundMessageNumber());
+			 pstmt.setInt(14,bean.isTransportAvailable() ? 1 : 0);
+			 pstmt.setInt(15,bean.getFlags());
+			 pstmt.execute();
+			 pstmt.close();
+		} catch (Exception ex) {
+			log.error("Update Exception " + ex);
+			throw new SandeshaStorageException(ex);
+		}
+		return true;
+	}
+	
+	public SenderBean findUnique(SenderBean bean)
+	  throws SandeshaStorageException
+	{
+		String sql = requestForModel(bean);
+		SenderBean result = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery(sql);
+			while ( rs.next() ) {
+				if ( result == null ) {
+					result = getBean(rs);
+				} else {
+					String message = SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.nonUniqueResult,
+							result.toString(),
+							getBean(rs).toString());
+					log.error(message);
+					throw new SandeshaException (message);
+				}
+			}
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			throw new SandeshaStorageException(ex);
+		}		
+		return result;
+	}
+
+	public SenderBean retrieveFromMessageRefKey(String messageContextRefKey)
+	{
+		SenderBean bean = null;
+		try {
+			Statement stmt = getDbConnection().createStatement();
+			ResultSet rs = stmt.executeQuery("select * from wsrm_sender where message_context_ref_key='" + messageContextRefKey + "'");
+			if ( ! rs.next() ) return bean;
+			bean = getBean(rs);
+			rs.close();
+			stmt.close();
+		} catch (Exception ex) {
+			return null;
+		}
+		return bean;
+	}
+
+    public SenderBean retrieve(String sequnceId, long messageNumber) throws SandeshaStorageException {
+        SenderBean bean = null;
+        try {
+            Statement stmt = getDbConnection().createStatement();
+            ResultSet rs = stmt.executeQuery("select * from wsrm_sender where sequence_id='" + sequnceId + "' " +
+                    " and message_number=" + messageNumber);
+            if (! rs.next()) return bean;
+            bean = getBean(rs);
+            rs.close();
+            stmt.close();
+        } catch (Exception ex) {
+            return null;
+        }
+        return bean;
+    }
+}



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


Mime
View raw message