ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r708805 [1/2] - in /webservices/sandesha/trunk/java/modules/persistence/src: main/java/org/apache/sandesha2/storage/jdbc/ resources/ test/java/org/apache/sandesha2/
Date Wed, 29 Oct 2008 06:41:11 GMT
Author: amilas
Date: Tue Oct 28 23:41:11 2008
New Revision: 708805

URL: http://svn.apache.org/viewvc?rev=708805&view=rev
Log:
reformatted to code to follow the tab based intent

Modified:
    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/module_config_axis2.xml
    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

Modified: 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=708805&r1=708804&r2=708805&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java (original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java Tue Oct 28 23:41:11 2008
@@ -30,61 +30,60 @@
  * 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)
-	{
+	public JDBCTransaction(PersistentStorageManager pmgr) {
 		log.debug("new JDBCTransaction");
 		try {
-		  this.pmgr = pmgr;
-		  dbConnection = pmgr.dbConnect();
-		  dbConnection.setAutoCommit(false);
+			this.pmgr = pmgr;
+			dbConnection = pmgr.dbConnect();
+			dbConnection.setAutoCommit(false);
 			dbConnection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
-		  active = true;
-		} catch (Exception ex) {}
+			active = true;
+		} catch (Exception ex) {
+		}
 	}
 
-	public Connection getDbConnection()
-	{
+	public Connection getDbConnection() {
 		return dbConnection;
 	}
 
-	private void freeTransaction()
-	{
+	private void freeTransaction() {
 		try {
 			dbConnection.close();
 			pmgr.removeTransaction();
-		} catch (Exception ex) {}
+		} catch (Exception ex) {
+		}
 
 	}
 
-	public void commit()
-	{
+	public void commit() {
 		log.debug("commit JDBCTransaction");
 		try {
-		  dbConnection.commit();
-		  freeTransaction();
-		} catch (Exception ex) {}
+			dbConnection.commit();
+			freeTransaction();
+		} catch (Exception ex) {
+		}
 		active = false;
 	}
 
-	public void rollback()
-	{
+	public void rollback() {
 		log.debug("rollback JDBCTransaction");
 		try {
-			  dbConnection.rollback();
-			  freeTransaction();
-			} catch (Exception ex) {}
+			dbConnection.rollback();
+			freeTransaction();
+		} catch (Exception ex) {
+		}
 		active = false;
 	}
-		
-	public boolean isActive ()
-	{
+
+	public boolean isActive() {
 		return active;
 	}
-	
+
 }

Modified: 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=708805&r1=708804&r2=708805&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentBeanMgr.java (original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentBeanMgr.java Tue Oct 28 23:41:11 2008
@@ -32,37 +32,33 @@
 public class PersistentBeanMgr {
 	Log log = LogFactory.getLog(getClass());
 	PersistentStorageManager pmgr = null;
-	
-	public PersistentBeanMgr(PersistentStorageManager pmgr)
-	{
+
+	public PersistentBeanMgr(PersistentStorageManager pmgr) {
 		this.pmgr = pmgr;
 	}
 
-	public Connection getDbConnection()
-	{
+	public Connection getDbConnection() {
 		return pmgr.getDbConnection();
 	}
-	
+
 	protected Object getObject(ResultSet rs, String field)
-	 throws Exception
-	 {
+			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;
+		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;
+			throws Exception {
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		ObjectOutputStream oos = new ObjectOutputStream(baos);
+		oos.writeObject(obj);
+		oos.close();
+		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+		return bais;
 	}
 }

Modified: 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=708805&r1=708804&r2=708805&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java (original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java Tue Oct 28 23:41:11 2008
@@ -34,18 +34,16 @@
 
 public class PersistentInvokerBeanMgr extends PersistentBeanMgr implements InvokerBeanMgr {
 
-	public PersistentInvokerBeanMgr(PersistentStorageManager pmgr)
-	{
+	public PersistentInvokerBeanMgr(PersistentStorageManager pmgr) {
 		super(pmgr);
 	}
 
-	private String requestForModel(InvokerBean bean)
-	{
+	private String requestForModel(InvokerBean bean) {
 		StringBuilder sql = new StringBuilder(" select * from wsrm_invoker");
-		if ( bean == null ) return sql.toString();
+		if (bean == null) return sql.toString();
 		String op = " where";
 		String clause = bean.getMessageContextRefKey();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" message_context_ref_key='");
@@ -53,14 +51,14 @@
 			sql.append("'");
 		}
 		clause = bean.getSequenceID();
-		if ( clause != null ) {
+		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 ) { 
+		if ((bean.getFlags() & InvokerBean.MSG_NO_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" msg_no=");
@@ -68,22 +66,20 @@
 		}
 		return sql.toString();
 	}
-	
+
 	private InvokerBean getInvokerBean(ResultSet rs)
-	  throws Exception
-	{
+			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"));
+		invokerBean.setContext((Serializable) getObject(rs, "context"));
 		return invokerBean;
 	}
-	
+
 	public boolean delete(String key)
-	  throws SandeshaStorageException 
-	{
+			throws SandeshaStorageException {
 		try {
 			Statement stmt = getDbConnection().createStatement();
 			stmt.executeUpdate("delete from wsrm_invoker where message_context_ref_key='" + key + "'");
@@ -95,14 +91,13 @@
 	}
 
 	public List find(InvokerBean bean)
-	  throws SandeshaStorageException
-	{
+			throws SandeshaStorageException {
 		String sql = requestForModel(bean);
 		ArrayList<InvokerBean> lst = new ArrayList<InvokerBean>();
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
-			while ( rs.next() ) {
+			while (rs.next()) {
 				lst.add(getInvokerBean(rs));
 			}
 			rs.close();
@@ -112,35 +107,34 @@
 		}
 		return lst;
 	}
-	
+
 	public boolean insert(InvokerBean bean)
-	  throws SandeshaStorageException
-	{
+			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();
+			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
-	{
+			throws SandeshaStorageException {
 		InvokerBean invokerBean = null;
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_invoker where message_context_ref_key='" + key + "'");
-			if ( ! rs.next() ) return invokerBean;
+			if (! rs.next()) return invokerBean;
 			invokerBean = getInvokerBean(rs);
 			rs.close();
 			stmt.close();
@@ -151,51 +145,49 @@
 	}
 
 	public boolean update(InvokerBean bean)
-	  throws SandeshaStorageException
-	{
+			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();
+			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
-	{
+			throws SandeshaException {
 		String sql = requestForModel(bean);
 		InvokerBean result = null;
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
-			while ( rs.next() ) {
-				if ( result == null ) {
-				 result = getInvokerBean(rs);
+			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);
+					throw new SandeshaException(message);
 				}
 			}
 			rs.close();
 			stmt.close();
 		} catch (Exception ex) {
 			throw new SandeshaStorageException(ex);
-		}		
+		}
 		return result;
 	}
-			
+
 }

Modified: 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=708805&r1=708804&r2=708805&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java (original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java Tue Oct 28 23:41:11 2008
@@ -38,18 +38,16 @@
 
 public class PersistentRMDBeanMgr extends PersistentBeanMgr implements RMDBeanMgr {
 
-	public PersistentRMDBeanMgr(PersistentStorageManager pmgr)
-	{
+	public PersistentRMDBeanMgr(PersistentStorageManager pmgr) {
 		super(pmgr);
 	}
 
-	private String requestForModel(RMDBean bean)
-	{
+	private String requestForModel(RMDBean bean) {
 		StringBuilder sql = new StringBuilder(" select * from wsrm_rmd");
-		if ( bean == null ) return sql.toString();
+		if (bean == null) return sql.toString();
 		String op = " where";
 		String clause = bean.getSequenceID();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" sequence_id='");
@@ -57,7 +55,7 @@
 			sql.append("'");
 		}
 		EndpointReference epr = bean.getToEndpointReference();
-		if ( epr != null ) {
+		if (epr != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" to_epr_addr='");
@@ -65,7 +63,7 @@
 			sql.append("'");
 		}
 		epr = bean.getReplyToEndpointReference();
-		if ( epr != null ) {
+		if (epr != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" reply_to_epr_addr='");
@@ -73,7 +71,7 @@
 			sql.append("'");
 		}
 		epr = bean.getAcksToEndpointReference();
-		if ( epr != null ) {
+		if (epr != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" acks_to_epr_addr='");
@@ -81,7 +79,7 @@
 			sql.append("'");
 		}
 		clause = bean.getRMVersion();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" rm_version='");
@@ -89,7 +87,7 @@
 			sql.append("'");
 		}
 		clause = bean.getSecurityTokenData();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" security_token_data='");
@@ -97,7 +95,7 @@
 			sql.append("'");
 		}
 		clause = bean.getReferenceMessageKey();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" reference_message_key='");
@@ -105,7 +103,7 @@
 			sql.append("'");
 		}
 		clause = bean.getHighestInMessageId();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" highest_in_message_id='");
@@ -113,7 +111,7 @@
 			sql.append("'");
 		}
 		clause = bean.getLastInMessageId();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" last_in_message_id='");
@@ -121,7 +119,7 @@
 			sql.append("'");
 		}
 		clause = bean.getToAddress();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" to_address='");
@@ -129,7 +127,7 @@
 			sql.append("'");
 		}
 		clause = bean.getOutboundInternalSequence();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" outbound_internal_sequence='");
@@ -137,7 +135,7 @@
 			sql.append("'");
 		}
 		clause = bean.getOutboundInternalSequence();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" outbound_internal_sequence='");
@@ -145,7 +143,7 @@
 			sql.append("'");
 		}
 		RangeString rs = bean.getServerCompletedMessages();
-		if ( rs != null ) {
+		if (rs != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" server_completed_messages='");
@@ -153,70 +151,69 @@
 			sql.append("'");
 		}
 		rs = bean.getOutOfOrderRanges();
-		if ( rs != null ) {
+		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 ) { 
+		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 ) {  
+		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 ) { 
+		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 ) {
+		if ((bean.getFlags() & RMDBean.CLOSED_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" closed=");
-			sql.append(bean.isClosed() ? 1:0);
+			sql.append(bean.isClosed() ? 1 : 0);
 		}
-		if ( (bean.getFlags() &  RMDBean.TERMINATED_FLAG ) != 0 ) {
+		if ((bean.getFlags() & RMDBean.TERMINATED_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" terminated_flag=");
-			sql.append(bean.isTerminated() ? 1:0);
+			sql.append(bean.isTerminated() ? 1 : 0);
 		}
-		if ( (bean.getFlags() & RMDBean.POLLING_MODE_FLAG) != 0 ) {
+		if ((bean.getFlags() & RMDBean.POLLING_MODE_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" polling_mode=");
-			sql.append(bean.isPollingMode() ? 1:0);
+			sql.append(bean.isPollingMode() ? 1 : 0);
 		}
-		if ( log.isDebugEnabled() ) log.debug("requestForModel " + sql.toString());
+		if (log.isDebugEnabled()) log.debug("requestForModel " + sql.toString());
 		return sql.toString();
 	}
-	
+
 	private RMDBean getBean(ResultSet rs)
-	  throws Exception
-	{
+			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);
+
+		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"));
@@ -227,27 +224,26 @@
 		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.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);
+			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 + "'");
@@ -257,16 +253,15 @@
 		}
 		return true;
 	}
-	
+
 	public List find(RMDBean bean)
-	  throws SandeshaStorageException
-	{
+			throws SandeshaStorageException {
 		String sql = requestForModel(bean);
 		ArrayList<RMDBean> lst = new ArrayList<RMDBean>();
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
-			while ( rs.next() ) {
+			while (rs.next()) {
 				lst.add(getBean(rs));
 			}
 			rs.close();
@@ -274,75 +269,73 @@
 		} catch (Exception ex) {
 			throw new SandeshaStorageException(ex);
 		}
-		if(log.isDebugEnabled()) log.debug("Exit find lst.size(): " + lst.size());
+		if (log.isDebugEnabled()) log.debug("Exit find lst.size(): " + lst.size());
 		return lst;
 	}
-	
+
 	public boolean insert(RMDBean bean)
-	  throws SandeshaStorageException
-	{
+			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);
+			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);
+			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);
+			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();
+			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
-	{
+			throws SandeshaStorageException {
 		RMDBean bean = null;
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_rmd where sequence_id='" + sequenceID + "'");
-			if ( ! rs.next() ) return bean;
+			if (! rs.next()) return bean;
 			bean = getBean(rs);
 			rs.close();
 			stmt.close();
@@ -351,93 +344,90 @@
 		}
 		return bean;
 	}
-	
+
 	public Collection retrieveAll()
-	  throws SandeshaStorageException
-	{
+			throws SandeshaStorageException {
 		return find(null);
 	}
-	
+
 	public boolean update(RMDBean bean)
-	  throws SandeshaStorageException
-	{
+			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);
+			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);
+			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);
+			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();
+			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
-	{
+			throws SandeshaStorageException {
 		String sql = requestForModel(bean);
 		RMDBean result = null;
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
-			while ( rs.next() ) {
-				if ( result == null ) {
-				 result = getBean(rs);
+			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);
+					throw new SandeshaException(message);
 				}
 			}
 			rs.close();
 			stmt.close();
 		} catch (Exception ex) {
 			throw new SandeshaStorageException(ex);
-		}		
+		}
 		return result;
-	}		
+	}
 }

Modified: 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=708805&r1=708804&r2=708805&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java (original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java Tue Oct 28 23:41:11 2008
@@ -35,18 +35,16 @@
 
 public class PersistentRMSBeanMgr extends PersistentBeanMgr implements RMSBeanMgr {
 
-	public PersistentRMSBeanMgr(PersistentStorageManager pmgr)
-	{
+	public PersistentRMSBeanMgr(PersistentStorageManager pmgr) {
 		super(pmgr);
 	}
 
-	private String requestForModel(RMSBean bean)
-	{
+	private String requestForModel(RMSBean bean) {
 		StringBuilder sql = new StringBuilder(" select * from wsrm_rms");
-		if ( bean == null ) return sql.toString();
+		if (bean == null) return sql.toString();
 		String op = " where ";
 		String clause = bean.getSequenceID();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" sequence_id='");
@@ -54,7 +52,7 @@
 			sql.append("'");
 		}
 		EndpointReference epr = bean.getToEndpointReference();
-		if ( epr != null ) {
+		if (epr != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" to_epr_addr='");
@@ -62,7 +60,7 @@
 			sql.append("'");
 		}
 		epr = bean.getReplyToEndpointReference();
-		if ( epr != null ) {
+		if (epr != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" reply_to_epr_addr='");
@@ -70,7 +68,7 @@
 			sql.append("'");
 		}
 		epr = bean.getAcksToEndpointReference();
-		if ( epr != null ) {
+		if (epr != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" acks_to_epr_addr='");
@@ -78,7 +76,7 @@
 			sql.append("'");
 		}
 		clause = bean.getRMVersion();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" rm_version='");
@@ -86,7 +84,7 @@
 			sql.append("'");
 		}
 		clause = bean.getSecurityTokenData();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" security_token_data='");
@@ -94,7 +92,7 @@
 			sql.append("'");
 		}
 		clause = bean.getCreateSeqMsgID();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" create_seq_msg_id='");
@@ -102,7 +100,7 @@
 			sql.append("'");
 		}
 		clause = bean.getInternalSequenceID();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" internal_sequence_id='");
@@ -110,7 +108,7 @@
 			sql.append("'");
 		}
 		clause = bean.getCreateSequenceMsgStoreKey();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" create_sequence_msg_store_key='");
@@ -118,7 +116,7 @@
 			sql.append("'");
 		}
 		clause = bean.getReferenceMessageStoreKey();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" create_sequence_msg_store_key='");
@@ -126,7 +124,7 @@
 			sql.append("'");
 		}
 		clause = bean.getTransportTo();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" transport_to='");
@@ -134,7 +132,7 @@
 			sql.append("'");
 		}
 		clause = bean.getOfferedEndPoint();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" offered_endpoint='");
@@ -142,7 +140,7 @@
 			sql.append("'");
 		}
 		clause = bean.getOfferedSequence();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" offered_sequence='");
@@ -150,7 +148,7 @@
 			sql.append("'");
 		}
 		clause = bean.getAnonymousUUID();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" anonymous_uuid='");
@@ -158,97 +156,97 @@
 			sql.append("'");
 		}
 		RangeString xrs = bean.getClientCompletedMessages();
-		if ( xrs != null ) {
+		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 ) { 
+		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 ) { 
+		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 ) {   
+		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 ) { 
+		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 ) { 
+		if ((bean.getRmsFlags() & RMSBean.TERMINATE_ADDED_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" terminate_added=");
-			sql.append(bean.isTerminateAdded()?1:0);
+			sql.append(bean.isTerminateAdded() ? 1 : 0);
 		}
-		if ( (bean.getRmsFlags() & RMSBean.TIMED_OUT_FLAG ) != 0 ) { 
+		if ((bean.getRmsFlags() & RMSBean.TIMED_OUT_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" timed_out=");
-			sql.append(bean.isTimedOut()?1:0);
+			sql.append(bean.isTimedOut() ? 1 : 0);
 		}
-		if ( (bean.getRmsFlags() & RMSBean.SEQ_CLOSED_CLIENT_FLAG ) != 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);
+			sql.append(bean.isSequenceClosedClient() ? 1 : 0);
 		}
-		if ( (bean.getRmsFlags() & RMSBean.TERM_PAUSER_FOR_CS ) != 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);
+			sql.append(bean.isTerminationPauserForCS() ? 1 : 0);
 		}
-		if ( (bean.getRmsFlags() & RMSBean.EXPECTED_REPLIES ) != 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 ) { 
+		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 ) {
+
+		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 ) {
+		if ((bean.getFlags() & RMSBean.CLOSED_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" closed=");
-			sql.append(bean.isClosed() ? 1:0);
+			sql.append(bean.isClosed() ? 1 : 0);
 		}
-		if ( (bean.getFlags() & RMSBean.TERMINATED_FLAG) != 0 ) {
+		if ((bean.getFlags() & RMSBean.TERMINATED_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" terminated_flag=");
-			sql.append(bean.isTerminated() ? 1:0);
+			sql.append(bean.isTerminated() ? 1 : 0);
 		}
-		if ( (bean.getFlags() & RMSBean.POLLING_MODE_FLAG) != 0 ) {
+		if ((bean.getFlags() & RMSBean.POLLING_MODE_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" polling_mode=");
-			sql.append(bean.isPollingMode() ? 1:0);
+			sql.append(bean.isPollingMode() ? 1 : 0);
 		}
 		/* only for WSRM 1.0 ?
 		if ( (bean.getFlags() & 0x0010000) != 0 ) {
@@ -257,29 +255,28 @@
 			sql.append(" replay_model=");
 			sql.append(bean.isReplayModel() ? 1:0);
 		} */
-		if ( log.isDebugEnabled() ) log.debug("requestForModel " + sql.toString());
+		if (log.isDebugEnabled()) log.debug("requestForModel " + sql.toString());
 		return sql.toString();
 	}
-	
+
 	private RMSBean getBean(ResultSet rs)
-	  throws Exception
-	{
-        RMSBean bean = new RMSBean();
+			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);
+		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"));
@@ -293,27 +290,27 @@
 		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);
+		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.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"));
@@ -322,9 +319,8 @@
 
 
 	public boolean delete(String msgId)
-	  throws SandeshaStorageException
-	{
-        if(log.isDebugEnabled()) log.debug("delete RMSBean msgId " + 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 + "'");
@@ -334,16 +330,15 @@
 		}
 		return true;
 	}
-	
+
 	public List find(RMSBean bean)
-	  throws SandeshaStorageException
-	{
-        String sql = requestForModel(bean);
+			throws SandeshaStorageException {
+		String sql = requestForModel(bean);
 		ArrayList<RMSBean> lst = new ArrayList<RMSBean>();
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
-			while ( rs.next() ) {
+			while (rs.next()) {
 				lst.add(getBean(rs));
 			}
 			rs.close();
@@ -354,89 +349,87 @@
 		return lst;
 	}
 
-	
+
 	public boolean insert(RMSBean bean)
-	  throws SandeshaStorageException
-	{
-        log.debug("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();
+			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);
+			throws SandeshaStorageException {
+		log.debug("Retrieve  msdId " + msgId);
 		RMSBean bean = null;
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_rms where create_seq_msg_id='" + msgId + "'");
-			if ( rs.next() ) bean = getBean(rs);
+			if (rs.next()) bean = getBean(rs);
 			rs.close();
 			stmt.close();
 		} catch (Exception ex) {
@@ -446,92 +439,90 @@
 		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;
+			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);
+			throws SandeshaStorageException {
+		String sql = requestForModel(bean);
 		RMSBean result = null;
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
-			while ( rs.next() ) {
-				if ( result == null ) {
+			while (rs.next()) {
+				if (result == null) {
 					result = getBean(rs);
 				} else {
 					String message = SandeshaMessageHelper.getMessage(
@@ -539,7 +530,7 @@
 							result.toString(),
 							getBean(rs).toString());
 					log.error(message);
-					throw new SandeshaException (message);
+					throw new SandeshaException(message);
 				}
 			}
 			rs.close();
@@ -547,22 +538,22 @@
 		} 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);
+	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.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
 
-            while ( rs.next() ) {
-				if ( result == null ) {
+			while (rs.next()) {
+				if (result == null) {
 					result = getBean(rs);
 				} else {
 					String message = SandeshaMessageHelper.getMessage(
@@ -570,7 +561,7 @@
 							result.toString(),
 							getBean(rs).toString());
 					log.error(message);
-					throw new SandeshaException (message);
+					throw new SandeshaException(message);
 				}
 			}
 			rs.close();
@@ -581,18 +572,18 @@
 		}
 		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);
+	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.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
-			while ( rs.next() ) {
-				if ( result == null ) {
+			while (rs.next()) {
+				if (result == null) {
 					result = getBean(rs);
 				} else {
 					String message = SandeshaMessageHelper.getMessage(
@@ -600,7 +591,7 @@
 							result.toString(),
 							getBean(rs).toString());
 					log.error(message);
-					throw new SandeshaException (message);
+					throw new SandeshaException(message);
 				}
 			}
 			rs.close();
@@ -611,5 +602,5 @@
 		}
 		log.debug("FindUnique RMSBean : " + result);
 		return result;
-    }
+	}
 }

Modified: 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=708805&r1=708804&r2=708805&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java (original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java Tue Oct 28 23:41:11 2008
@@ -37,18 +37,16 @@
  */
 public class PersistentSenderBeanMgr extends PersistentBeanMgr implements SenderBeanMgr {
 
-	public PersistentSenderBeanMgr(PersistentStorageManager pmgr)
-	{
+	public PersistentSenderBeanMgr(PersistentStorageManager pmgr) {
 		super(pmgr);
 	}
 
-	private String requestForModel(SenderBean bean)
-	{
+	private String requestForModel(SenderBean bean) {
 		StringBuilder sql = new StringBuilder("select * from wsrm_sender");
-		if ( bean == null ) return sql.toString();
+		if (bean == null) return sql.toString();
 		String op = " where ";
 		String clause = bean.getSequenceID();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" sequence_id='");
@@ -56,7 +54,7 @@
 			sql.append("'");
 		}
 		clause = bean.getMessageID();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" message_id='");
@@ -64,7 +62,7 @@
 			sql.append("'");
 		}
 		clause = bean.getMessageContextRefKey();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" message_context_ref_key='");
@@ -72,7 +70,7 @@
 			sql.append("'");
 		}
 		clause = bean.getInternalSequenceID();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" internal_sequence_id='");
@@ -80,7 +78,7 @@
 			sql.append("'");
 		}
 		clause = bean.getToAddress();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" to_address='");
@@ -88,7 +86,7 @@
 			sql.append("'");
 		}
 		clause = bean.getInboundSequenceId();
-		if ( clause != null ) {
+		if (clause != null) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" inbound_sequence_id='");
@@ -96,67 +94,66 @@
 			sql.append("'");
 		}
 
-		if ( (bean.getFlags() & SenderBean.SEND_FLAG ) != 0 ) {
+		if ((bean.getFlags() & SenderBean.SEND_FLAG) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" send=");
-			sql.append(bean.isSend() ? 1:0);
+			sql.append(bean.isSend() ? 1 : 0);
 		}
-		if ( (bean.getFlags() & SenderBean.SEND_COUNT_FLAG ) != 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 ) {
+		if ((bean.getFlags() & 0x00000100) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" message_number=");
 			sql.append(bean.getMessageNumber());
 		}
-		if ( (bean.getFlags() & 0x00001000) != 0 ) {
+		if ((bean.getFlags() & 0x00001000) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" resend=");
-			sql.append(bean.isReSend() ? 1:0);
+			sql.append(bean.isReSend() ? 1 : 0);
 		}
-		if ( (bean.getFlags() & 0x00010000) != 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 ) {
+		if ((bean.getFlags() & 0x00100000) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" message_type=");
 			sql.append(bean.getMessageType());
 		}
-		if ( (bean.getFlags() & 0x01000000) != 0 ) {
+		if ((bean.getFlags() & 0x01000000) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" last_message=");
-			sql.append(bean.isLastMessage() ? 1:0);
+			sql.append(bean.isLastMessage() ? 1 : 0);
 		}
-		if ( (bean.getFlags() & 0x10000000) != 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 ) {
+		if ((bean.getFlags() & 0x00000002) != 0) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" transport_available=");
-			sql.append(bean.isTransportAvailable() ? 1:0);
+			sql.append(bean.isTransportAvailable() ? 1 : 0);
 		}
 		log.debug("requestForModel " + sql.toString());
 		return sql.toString();
 	}
 
 	private SenderBean getBean(ResultSet rs)
-	  throws Exception
-	{
+			throws Exception {
 		SenderBean bean = new SenderBean();
 		bean.setMessageID(rs.getString("message_id"));
 		bean.setMessageContextRefKey(rs.getString("message_context_ref_key"));
@@ -169,10 +166,10 @@
 		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.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"));
@@ -181,9 +178,8 @@
 	}
 
 	public boolean delete(String messageID)
-	  throws SandeshaStorageException
-	{
-		if ( log.isDebugEnabled() ) log.debug("Delete MsgID " + 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 + "'");
@@ -195,14 +191,13 @@
 	}
 
 	public List find(SenderBean bean)
-	  throws SandeshaStorageException
-	{
+			throws SandeshaStorageException {
 		String sql = requestForModel(bean);
 		ArrayList<SenderBean> lst = new ArrayList<SenderBean>();
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
-			while ( rs.next() ) {
+			while (rs.next()) {
 				lst.add(getBean(rs));
 			}
 			rs.close();
@@ -215,82 +210,79 @@
 
 
 	public List find(String internalSequenceId)
-	  throws SandeshaStorageException
-		{
-			ArrayList<SenderBean> lst = new ArrayList<SenderBean>();
-			try {
-				Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
-				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);
+			throws SandeshaStorageException {
+		ArrayList<SenderBean> lst = new ArrayList<SenderBean>();
+		try {
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+			ResultSet rs = stmt.executeQuery("select * from wsrm_sender where internal_sequence_id='" +
+					internalSequenceId + "'");
+			while (rs.next()) {
+				lst.add(getBean(rs));
 			}
-			return lst;
+			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;
+			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) {
+			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;
+		}
+		if (log.isDebugEnabled()) log.debug("Exit getNextMessageToSend " + result);
+		return result;
 	}
 
 	public boolean insert(SenderBean bean)
-	  throws SandeshaStorageException
-	{
-		if ( log.isDebugEnabled() ) log.debug("Insert " + 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();
+			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);
 		}
@@ -298,13 +290,12 @@
 	}
 
 	public SenderBean retrieve(String messageID)
-	  throws SandeshaStorageException
-	{
+			throws SandeshaStorageException {
 		SenderBean bean = null;
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_sender where message_id='" + messageID + "'");
-			if ( ! rs.next() ) return bean;
+			if (! rs.next()) return bean;
 			bean = getBean(rs);
 			rs.close();
 			stmt.close();
@@ -315,32 +306,31 @@
 	}
 
 	public boolean update(SenderBean bean)
-	  throws SandeshaStorageException
-	{
-		if ( log.isDebugEnabled() ) log.debug("Update " + 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();
+			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);
@@ -349,15 +339,14 @@
 	}
 
 	public SenderBean findUnique(SenderBean bean)
-	  throws SandeshaStorageException
-	{
+			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 ) {
+			while (rs.next()) {
+				if (result == null) {
 					result = getBean(rs);
 				} else {
 					String message = SandeshaMessageHelper.getMessage(
@@ -365,7 +354,7 @@
 							result.toString(),
 							getBean(rs).toString());
 					log.error(message);
-					throw new SandeshaException (message);
+					throw new SandeshaException(message);
 				}
 			}
 			rs.close();
@@ -376,13 +365,12 @@
 		return result;
 	}
 
-	public SenderBean retrieveFromMessageRefKey(String messageContextRefKey)
-	{
+	public SenderBean retrieveFromMessageRefKey(String messageContextRefKey) {
 		SenderBean bean = null;
 		try {
 			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_sender where message_context_ref_key='" + messageContextRefKey + "'");
-			if ( ! rs.next() ) return bean;
+			if (! rs.next()) return bean;
 			bean = getBean(rs);
 			rs.close();
 			stmt.close();
@@ -392,19 +380,19 @@
 		return bean;
 	}
 
-    public SenderBean retrieve(String sequnceId, long messageNumber) throws SandeshaStorageException {
-        SenderBean bean = null;
-        try {
-            Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
-            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;
-    }
+	public SenderBean retrieve(String sequnceId, long messageNumber) throws SandeshaStorageException {
+		SenderBean bean = null;
+		try {
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+			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