Dear Sandesha Committers,
Please accept this patch which contains In Memory Storage support for
Sandesha2
Thanks you,
Sanka
Index: storage/StorageManager.java
===================================================================
--- storage/StorageManager.java (revision 264096)
+++ storage/StorageManager.java (working copy)
@@ -17,10 +17,55 @@
package org.apache.sandesha2.storage;
+import org.apache.sandesha2.storage.beans.CreateSeqBean;
+import org.apache.sandesha2.storage.beans.NextMsgBean;
+import org.apache.sandesha2.storage.beans.RetransmitterBean;
+import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+import org.apache.sandesha2.storage.beans.StorageMapBean;
+
/**
* @author
*
*/
-public class StorageManager {
+public interface StorageManager {
+ public boolean createCreateSeq(CreateSeqBean bean);
+
+ public CreateSeqBean retrieveCreateSeq(String key);
+
+ public boolean updateCreateSeq(CreateSeqBean bean);
+
+ public boolean deleteCreateSeq(String key);
+
+ public boolean createNextMsg(NextMsgBean bean);
+
+ public NextMsgBean retrieveNextMsgBean(String key);
+
+ public boolean updateNextMsgBean(NextMsgBean bean);
+
+ public boolean deleteNextMsgBean(String key);
+
+ public boolean createRetransmitterBean(RetransmitterBean bean);
+
+ public RetransmitterBean retrieveRetransmitterBean(String key);
+
+ public boolean updateRetransmitterBean(RetransmitterBean bean);
+
+ public boolean deleteRetransmitterBean(String key);
+
+ public boolean createStorageMapBean(StorageMapBean bean);
+
+ public StorageMapBean retrieveStorageMapBean(String key);
+
+ public boolean updateStorageMapBean(StorageMapBean bean);
+
+ public boolean deleteStorageMapBean(String key);
+
+ public boolean createSequencePropertyBean(SequencePropertyBean bean);
+
+ public SequencePropertyBean retrieveSequencePropertyBean(String key);
+
+ public boolean updateSequencePropertyBean(SequencePropertyBean bean);
+
+ public boolean deleteSequencePropertyBean(String key);
}
Index: storage/beanmanagers/RetransmitterBeanMgr.java
===================================================================
--- storage/beanmanagers/RetransmitterBeanMgr.java (revision 264096)
+++ storage/beanmanagers/RetransmitterBeanMgr.java (working copy)
@@ -17,27 +17,41 @@
package org.apache.sandesha2.storage.beanmanagers;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.StorageManagerFactory;
import org.apache.sandesha2.storage.beans.RMBean;
+import org.apache.sandesha2.storage.beans.RetransmitterBean;
/**
* @author
*
*/
public class RetransmitterBeanMgr implements CRUD {
-
- public boolean create(RMBean object) {
- return false;
+
+ private StorageManager storageMgr;
+
+ public RetransmitterBeanMgr(int storageType) {
+ storageMgr =
StorageManagerFactory.getStorageManager(storageType);
}
+ public boolean create(RMBean bean) {
+ if (!(bean instanceof RetransmitterBean)) {
+ throw new IllegalArgumentException();
+ }
+ return storageMgr.createRetransmitterBean((RetransmitterBean)
bean);
+ }
- public boolean delete(String primaryKey) {
- return false;
+ public boolean delete(String key) {
+ return storageMgr.deleteRetransmitterBean(key);
}
- public RMBean retrieve(String primaryKey) {
- return null;
+ public RMBean retrieve(String key) {
+ return storageMgr.retrieveRetransmitterBean(key);
}
public boolean update(RMBean bean) {
- return false;
+ if (!(bean instanceof RetransmitterBean)) {
+ throw new IllegalArgumentException();
+ }
+ return storageMgr.updateRetransmitterBean((RetransmitterBean)
bean);
}
}
Index: storage/beanmanagers/NextMsgBeanMgr.java
===================================================================
--- storage/beanmanagers/NextMsgBeanMgr.java (revision 264096)
+++ storage/beanmanagers/NextMsgBeanMgr.java (working copy)
@@ -17,6 +17,9 @@
package org.apache.sandesha2.storage.beanmanagers;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.StorageManagerFactory;
+import org.apache.sandesha2.storage.beans.NextMsgBean;
import org.apache.sandesha2.storage.beans.RMBean;
/**
@@ -24,20 +27,32 @@
*
*/
public class NextMsgBeanMgr implements CRUD {
+
+ private StorageManager storageMgr;
+
+ public NextMsgBeanMgr(int storageType) {
+ storageMgr =
StorageManagerFactory.getStorageManager(storageType);
+ }
- public boolean create(RMBean object) {
- return false;
+ public boolean create(RMBean bean) {
+ if (!(bean instanceof NextMsgBean)) {
+ throw new IllegalArgumentException();
+ }
+ return storageMgr.createNextMsg((NextMsgBean) bean);
}
- public boolean delete(String primaryKey) {
- return false;
+ public boolean delete(String key) {
+ return storageMgr.deleteNextMsgBean(key);
}
- public RMBean retrieve(String primaryKey) {
- return null;
+ public RMBean retrieve(String key) {
+ return storageMgr.retrieveNextMsgBean(key);
}
public boolean update(RMBean bean) {
- return false;
+ if (!(bean instanceof NextMsgBean)) {
+ throw new IllegalArgumentException();
+ }
+ return storageMgr.updateNextMsgBean((NextMsgBean) bean);
}
}
Index: storage/beanmanagers/CreateSeqBeanMgr.java
===================================================================
--- storage/beanmanagers/CreateSeqBeanMgr.java (revision 264096)
+++ storage/beanmanagers/CreateSeqBeanMgr.java (working copy)
@@ -17,6 +17,9 @@
package org.apache.sandesha2.storage.beanmanagers;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.StorageManagerFactory;
+import org.apache.sandesha2.storage.beans.CreateSeqBean;
import org.apache.sandesha2.storage.beans.RMBean;
/**
@@ -24,25 +27,29 @@
*
*/
public class CreateSeqBeanMgr implements CRUD {
-
- private CreateSeqBeanMgr instance;
- private void CreateSeqBeanMgr (){
-
+ private StorageManager storageMgr;
+
+ public CreateSeqBeanMgr(int storageType) {
+ storageMgr =
StorageManagerFactory.getStorageManager(storageType);
}
- public boolean create(RMBean object) {
- return false;
+
+ public boolean create(RMBean bean) {
+ if (!(bean instanceof CreateSeqBean)) {
+ throw new IllegalArgumentException("argument should be
CreateSeqBean type");
+ }
+ return storageMgr.createCreateSeq((CreateSeqBean) bean);
}
- public boolean delete(String primaryKey) {
- return false;
+ public boolean delete(String key) {
+ return storageMgr.deleteCreateSeq(key);
}
- public RMBean retrieve(String primaryKey) {
- return null;
+ public RMBean retrieve(String key) {
+ return storageMgr.retrieveCreateSeq(key);
}
public boolean update(RMBean bean) {
- return false;
+ return storageMgr.updateCreateSeq((CreateSeqBean) bean);
}
}
Index: storage/beanmanagers/SequencePropertyBeanMgr.java
===================================================================
--- storage/beanmanagers/SequencePropertyBeanMgr.java (revision 0)
+++ storage/beanmanagers/SequencePropertyBeanMgr.java (revision 0)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.sandesha2.storage.beanmanagers;
+
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.StorageManagerFactory;
+import org.apache.sandesha2.storage.beans.RMBean;
+import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+
+/**
+ * @author Sanka Samaranayake <[EMAIL PROTECTED]>
+ */
+public class SequencePropertyBeanMgr implements CRUD {
+
+ private StorageManager storageMgr;
+
+ public SequencePropertyBeanMgr(int storageType){
+ storageMgr =
StorageManagerFactory.getStorageManager(storageType);
+ }
+
+ public boolean create(RMBean key) {
+ if (!(key instanceof SequencePropertyBean)) {
+ throw new IllegalArgumentException();
+ }
+ return
storageMgr.createSequencePropertyBean((SequencePropertyBean) key);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.beanmanagers.CRUD#retrieve(java.lang.String)
+ */
+ public RMBean retrieve(String key) {
+ return storageMgr.retrieveSequencePropertyBean(key);
+ }
+
+ public RMBean retrieve(String sequenceId, String name) {
+ return retrieve(sequenceId + name);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.beanmanagers.CRUD#update(org.apache.sandesha2.storage.beans.RMBean)
+ */
+ public boolean update(RMBean bean) {
+ if (!(bean instanceof SequencePropertyBean)) {
+ throw new IllegalArgumentException();
+ }
+ return
storageMgr.updateSequencePropertyBean((SequencePropertyBean) bean);
+ }
+
+ public boolean delete(String key) {
+ return storageMgr.deleteSequencePropertyBean(key);
+ }
+
+}
Index: storage/beanmanagers/CRUD.java
===================================================================
--- storage/beanmanagers/CRUD.java (revision 264096)
+++ storage/beanmanagers/CRUD.java (working copy)
@@ -24,11 +24,13 @@
*
*/
public interface CRUD {
+ public static final int IN_MEMORY_STORAGE_TYPE = 1;
+ public static final int PERSISTANT_STORAGE_TYPE = 2;
+
+ public boolean create (RMBean object);
+ public RMBean retrieve (String primaryKey);
+ public boolean update (RMBean bean);
+ public boolean delete (String primaryKey);
- boolean create (RMBean object);
- RMBean retrieve (String primaryKey);
- boolean update (RMBean bean);
- boolean delete (String primaryKey);
-
}
Index: storage/beanmanagers/StorageMapBeanMgr.java
===================================================================
--- storage/beanmanagers/StorageMapBeanMgr.java (revision 264096)
+++ storage/beanmanagers/StorageMapBeanMgr.java (working copy)
@@ -17,27 +17,41 @@
package org.apache.sandesha2.storage.beanmanagers;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.StorageManagerFactory;
import org.apache.sandesha2.storage.beans.RMBean;
+import org.apache.sandesha2.storage.beans.StorageMapBean;
/**
* @author
*
*/
public class StorageMapBeanMgr implements CRUD {
+ private StorageManager storageMgr;
+
+ public StorageMapBeanMgr(int storageType) {
+ storageMgr =
StorageManagerFactory.getStorageManager(storageType);
+ }
public boolean create(RMBean object) {
- return false;
+ if (!(object instanceof StorageMapBean)) {
+ throw new IllegalArgumentException();
+ }
+ return storageMgr.createStorageMapBean((StorageMapBean) object);
}
public boolean delete(String primaryKey) {
- return false;
+ return storageMgr.deleteStorageMapBean(primaryKey);
}
-
+
public RMBean retrieve(String primaryKey) {
- return null;
+ return storageMgr.retrieveStorageMapBean(primaryKey);
}
public boolean update(RMBean bean) {
- return false;
+ if (!(bean instanceof StorageMapBean)) {
+ throw new IllegalArgumentException();
+ }
+ return storageMgr.updateStorageMapBean((StorageMapBean) bean);
}
}
Index: storage/PermanentStorageMgr.java
===================================================================
--- storage/PermanentStorageMgr.java (revision 264096)
+++ storage/PermanentStorageMgr.java (working copy)
@@ -17,10 +17,159 @@
package org.apache.sandesha2.storage;
+import org.apache.sandesha2.storage.beans.CreateSeqBean;
+import org.apache.sandesha2.storage.beans.NextMsgBean;
+import org.apache.sandesha2.storage.beans.RetransmitterBean;
+import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+import org.apache.sandesha2.storage.beans.StorageMapBean;
+
/**
* @author
*
*/
-public class PermanentStorageMgr {
-
+public class PermanentStorageMgr implements StorageManager {
+
+ private static PermanentStorageMgr self;
+
+ private PermanentStorageMgr() {
+ }
+
+ synchronized static PermanentStorageMgr getInstance() {
+ if (self == null) {
+ self = new PermanentStorageMgr();
+ }
+ return self;
+ }
+
+ public boolean createCreateSeq(CreateSeqBean bean) {
+ // TODO
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+
+ public CreateSeqBean retrieveCreateSeq(String key) {
+ // retrieve the appropriate tuple form the table
+ // use that data to create and return the Bean
+ // TODO
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+
+ public boolean updataCreateSeq(CreateSeqBean bean) {
+ // update the database using the data in bean
+ // TODO
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+
+ public boolean deleteCreateSeq(String key) {
+ // delete the recored which is identified by this key..
+ // TODO
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#createNextMsg(org.apache.sandesha2.storage.beans.NextMsgBean)
+ */
+ public boolean createNextMsg(NextMsgBean bean) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#createRetransmitterBean(org.apache.sandesha2.storage.beans.RetransmitterBean)
+ */
+ public boolean createRetransmitterBean(RetransmitterBean bean) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#createStorageMapBean(org.apache.sandesha2.storage.beans.StorageMapBean)
+ */
+ public boolean createStorageMapBean(StorageMapBean bean) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+ public boolean createSequencePropertyBean(SequencePropertyBean bean) {
+ // TODO
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#deleteNextMsgBean(java.lang.String)
+ */
+ public boolean deleteNextMsgBean(String key) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#deleteRetransmitterBean(java.lang.String)
+ */
+ public boolean deleteRetransmitterBean(String key) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#deleteStorageMapBean(java.lang.String)
+ */
+ public boolean deleteStorageMapBean(String key) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ public boolean deleteSequencePropertyBean(String key) {
+ throw new UnsupportedOperationException("not yet implemented ");
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#retrieveNextMsgBean(java.lang.String)
+ */
+ public NextMsgBean retrieveNextMsgBean(String key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#retrieveRetransmitterBean(java.lang.String)
+ */
+ public RetransmitterBean retrieveRetransmitterBean(String key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#retrieveStorageMapBean(java.lang.String)
+ */
+ public StorageMapBean retrieveStorageMapBean(String key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ public SequencePropertyBean retrieveSequencePropertyBean(String key) {
+ throw new UnsupportedOperationException("not yet implemented");
+
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#updateCreateSeq(org.apache.sandesha2.storage.beans.CreateSeqBean)
+ */
+ public boolean updateCreateSeq(CreateSeqBean bean) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#updateNextMsgBean(org.apache.sandesha2.storage.beans.NextMsgBean)
+ */
+ public boolean updateNextMsgBean(NextMsgBean bean) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#updateRetransmitterBean(java.lang.String)
+ */
+ public boolean updateRetransmitterBean(RetransmitterBean bean) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#updateStorageMapBean(org.apache.sandesha2.storage.beans.StorageMapBean)
+ */
+ public boolean updateStorageMapBean(StorageMapBean bean) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+ public boolean updateSequencePropertyBean(SequencePropertyBean bean) {
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+
}
Index: storage/StorageManagerFactory.java
===================================================================
--- storage/StorageManagerFactory.java (revision 264096)
+++ storage/StorageManagerFactory.java (working copy)
@@ -22,6 +22,17 @@
*
*/
public class StorageManagerFactory {
-
+ public static final int IN_MEMORY_STORAGE_TYPE = 1;
+ public static final int PERSISTANT_STORAGE_TYPE = 2;
+
+ public static StorageManager getStorageManager(int storageType) {
+ if (storageType == IN_MEMORY_STORAGE_TYPE) {
+ return InMemoryStorageMgr.getInstance();
+ } else if (storageType == PERSISTANT_STORAGE_TYPE) {
+ return PermanentStorageMgr.getInstance();
+ } else {
+ throw new IllegalArgumentException("invalid storage
type");
+ }
+ }
}
Index: storage/beans/CreateSeqBean.java
===================================================================
--- storage/beans/CreateSeqBean.java (revision 264096)
+++ storage/beans/CreateSeqBean.java (working copy)
@@ -23,7 +23,31 @@
*/
public class CreateSeqBean implements RMBean {
+ private String CreateSeqMsgId;
+ private String SequenceId;
- String CreateSeqMsgId;
- String SequenceId;
+ /**
+ * @return Returns the createSeqMsgId.
+ */
+ public String getCreateSeqMsgId() {
+ return CreateSeqMsgId;
+ }
+ /**
+ * @param createSeqMsgId The createSeqMsgId to set.
+ */
+ public void setCreateSeqMsgId(String createSeqMsgId) {
+ CreateSeqMsgId = createSeqMsgId;
+ }
+ /**
+ * @return Returns the sequenceId.
+ */
+ public String getSequenceId() {
+ return SequenceId;
+ }
+ /**
+ * @param sequenceId The sequenceId to set.
+ */
+ public void setSequenceId(String sequenceId) {
+ SequenceId = sequenceId;
+ }
}
Index: storage/beans/SequencePropertyBean.java
===================================================================
--- storage/beans/SequencePropertyBean.java (revision 0)
+++ storage/beans/SequencePropertyBean.java (revision 0)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.sandesha2.storage.beans;
+
+/**
+ * @author Sanka Samaranayake <[EMAIL PROTECTED]>
+ */
+public class SequencePropertyBean implements RMBean{
+
+ private String sequenceId;
+ private String name;
+ private String value;
+
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return Returns the sequenceId.
+ */
+ public String getSequenceId() {
+ return sequenceId;
+ }
+ /**
+ * @param sequenceId The sequenceId to set.
+ */
+ public void setSequenceId(String sequenceId) {
+ this.sequenceId = sequenceId;
+ }
+ /**
+ * @return Returns the value.
+ */
+ public String getValue() {
+ return value;
+ }
+ /**
+ * @param value The value to set.
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
Index: storage/beans/StorageMapBean.java
===================================================================
--- storage/beans/StorageMapBean.java (revision 264096)
+++ storage/beans/StorageMapBean.java (working copy)
@@ -18,12 +18,50 @@
package org.apache.sandesha2.storage.beans;
/**
- * @author
+ * @author
*
*/
public class StorageMapBean implements RMBean {
- String Key;
- int MsgNo;
- String sequenceId;
+ private String Key;
+ private int MsgNo;
+ private String sequenceId;
+
+
+ /**
+ * @return Returns the key.
+ */
+ public String getKey() {
+ return Key;
+ }
+ /**
+ * @param key The key to set.
+ */
+ public void setKey(String key) {
+ Key = key;
+ }
+ /**
+ * @return Returns the msgNo.
+ */
+ public int getMsgNo() {
+ return MsgNo;
+ }
+ /**
+ * @param msgNo The msgNo to set.
+ */
+ public void setMsgNo(int msgNo) {
+ MsgNo = msgNo;
+ }
+ /**
+ * @return Returns the sequenceId.
+ */
+ public String getSequenceId() {
+ return sequenceId;
+ }
+ /**
+ * @param sequenceId The sequenceId to set.
+ */
+ public void setSequenceId(String sequenceId) {
+ this.sequenceId = sequenceId;
+ }
}
Index: storage/beans/RetransmitterBean.java
===================================================================
--- storage/beans/RetransmitterBean.java (revision 264096)
+++ storage/beans/RetransmitterBean.java (working copy)
@@ -23,10 +23,71 @@
*/
public class RetransmitterBean implements RMBean{
- String MessageId;
- String Key;
- String LastSentTime;
- boolean Send;
- String CreateSeqMsgId;
+ private String MessageId;
+ private String Key;
+ private String LastSentTime;
+ private boolean Send;
+ private String CreateSeqMsgId;
+
+ /**
+ * @return Returns the createSeqMsgId.
+ */
+ public String getCreateSeqMsgId() {
+ return CreateSeqMsgId;
+ }
+ /**
+ * @param createSeqMsgId The createSeqMsgId to set.
+ */
+ public void setCreateSeqMsgId(String createSeqMsgId) {
+ CreateSeqMsgId = createSeqMsgId;
+ }
+ /**
+ * @return Returns the key.
+ */
+ public String getKey() {
+ return Key;
+ }
+ /**
+ * @param key The key to set.
+ */
+ public void setKey(String key) {
+ Key = key;
+ }
+ /**
+ * @return Returns the lastSentTime.
+ */
+ public String getLastSentTime() {
+ return LastSentTime;
+ }
+ /**
+ * @param lastSentTime The lastSentTime to set.
+ */
+ public void setLastSentTime(String lastSentTime) {
+ LastSentTime = lastSentTime;
+ }
+ /**
+ * @return Returns the messageId.
+ */
+ public String getMessageId() {
+ return MessageId;
+ }
+ /**
+ * @param messageId The messageId to set.
+ */
+ public void setMessageId(String messageId) {
+ MessageId = messageId;
+ }
+ /**
+ * @return Returns the send.
+ */
+ public boolean isSend() {
+ return Send;
+ }
+ /**
+ * @param send The send to set.
+ */
+ public void setSend(boolean send) {
+ Send = send;
+ }
}
Index: storage/beans/NextMsgBean.java
===================================================================
--- storage/beans/NextMsgBean.java (revision 264096)
+++ storage/beans/NextMsgBean.java (working copy)
@@ -22,8 +22,33 @@
*
*/
public class NextMsgBean implements RMBean {
-
- String SequenceId;
- String NextMsgNoToProcess;
+ private String SequenceId;
+ private String NextMsgNoToProcess;
+
+
+ /**
+ * @return Returns the nextMsgNoToProcess.
+ */
+ public String getNextMsgNoToProcess() {
+ return NextMsgNoToProcess;
+ }
+ /**
+ * @param nextMsgNoToProcess The nextMsgNoToProcess to set.
+ */
+ public void setNextMsgNoToProcess(String nextMsgNoToProcess) {
+ NextMsgNoToProcess = nextMsgNoToProcess;
+ }
+ /**
+ * @return Returns the sequenceId.
+ */
+ public String getSequenceId() {
+ return SequenceId;
+ }
+ /**
+ * @param sequenceId The sequenceId to set.
+ */
+ public void setSequenceId(String sequenceId) {
+ SequenceId = sequenceId;
+ }
}
Index: storage/InMemoryStorageMgr.java
===================================================================
--- storage/InMemoryStorageMgr.java (revision 264096)
+++ storage/InMemoryStorageMgr.java (working copy)
@@ -17,10 +17,175 @@
package org.apache.sandesha2.storage;
+import java.awt.Stroke;
+import java.util.HashMap;
+import java.util.Hashtable;
+
+import org.apache.sandesha2.storage.beans.CreateSeqBean;
+import org.apache.sandesha2.storage.beans.NextMsgBean;
+import org.apache.sandesha2.storage.beans.RetransmitterBean;
+import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+import org.apache.sandesha2.storage.beans.StorageMapBean;
+
/**
* @author
*
*/
-public class InMemoryStorageMgr {
+public class InMemoryStorageMgr implements StorageManager {
+
+ private static InMemoryStorageMgr self;
+
+ Hashtable createSeqTable = new Hashtable(),
+ nextMsgTable = new Hashtable(),
+ retransmitterBeanTable = new Hashtable(),
+ storageMapBeanTable = new Hashtable(),
+ sequencePropertyBeanTable = new Hashtable();
+
+ private InMemoryStorageMgr() {
+ }
+ synchronized static InMemoryStorageMgr getInstance() {
+ if (self == null) {
+ self = new InMemoryStorageMgr();
+ }
+ return self;
+ }
+
+ public boolean createCreateSeq(CreateSeqBean bean) {
+ createSeqTable.put(bean.getCreateSeqMsgId(), bean);
+ return true;
+ }
+
+ public boolean deleteCreateSeq(String key) {
+ createSeqTable.remove(key);
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#retriveCreateSeq(java.lang.String)
+ */
+ public CreateSeqBean retrieveCreateSeq(String key) {
+ if (createSeqTable.containsKey(key)) {
+ return (CreateSeqBean) createSeqTable.get(key);
+ } else {
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#updataCreateSeq(org.apache.sandesha2.storage.beans.CreateSeqBean)
+ */
+ public boolean updataCreateSeq(CreateSeqBean bean) {
+ createSeqTable.put(bean.getSequenceId(), bean);
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#createNextMsg(org.apache.sandesha2.storage.beans.NextMsgBean)
+ */
+ public boolean createNextMsg(NextMsgBean bean) {
+ nextMsgTable.put(bean.getSequenceId(), bean);
+ return true;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#createRetransmitterBean(org.apache.sandesha2.storage.beans.RetransmitterBean)
+ */
+ public boolean createRetransmitterBean(RetransmitterBean bean) {
+ retransmitterBeanTable.put(bean.getMessageId(), bean);
+ return true;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#createStorageMapBean(org.apache.sandesha2.storage.beans.StorageMapBean)
+ */
+ public boolean createStorageMapBean(StorageMapBean bean) {
+ storageMapBeanTable.put(bean.getKey(), bean);
+ return true;
+ }
+
+ public boolean createSequencePropertyBean(SequencePropertyBean bean) {
+ sequencePropertyBeanTable.put(bean.getSequenceId() +
bean.getName(), bean);
+ return true;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#deleteNextMsgBean(java.lang.String)
+ */
+ public boolean deleteNextMsgBean(String key) {
+ nextMsgTable.remove(key);
+ return true;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#deleteRetransmitterBean(java.lang.String)
+ */
+ public boolean deleteRetransmitterBean(String key) {
+ retransmitterBeanTable.remove(key);
+ return true;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#deleteStorageMapBean(java.lang.String)
+ */
+ public boolean deleteStorageMapBean(String key) {
+ storageMapBeanTable.remove(key);
+ return true;
+ }
+
+ public boolean deleteSequencePropertyBean(String key) {
+ sequencePropertyBeanTable.remove(key);
+ return true;
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#retrieveNextMsgBean(java.lang.String)
+ */
+ public NextMsgBean retrieveNextMsgBean(String key) {
+ return (NextMsgBean) nextMsgTable.get(key);
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#retrieveRetransmitterBean(java.lang.String)
+ */
+ public RetransmitterBean retrieveRetransmitterBean(String key) {
+ return (RetransmitterBean) retransmitterBeanTable.get(key);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#retrieveStorageMapBean(java.lang.String)
+ */
+ public StorageMapBean retrieveStorageMapBean(String key) {
+ return (StorageMapBean) storageMapBeanTable.get(key);
+ }
+
+ public SequencePropertyBean retrieveSequencePropertyBean(String key) {
+ return (SequencePropertyBean)
sequencePropertyBeanTable.get(key);
+ }
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#updateCreateSeq(org.apache.sandesha2.storage.beans.CreateSeqBean)
+ */
+ public boolean updateCreateSeq(CreateSeqBean bean) {
+ createSeqTable.put(bean.getCreateSeqMsgId(), bean);
+ return true;
+ }
+
+ public boolean updateNextMsgBean(NextMsgBean bean) {
+ nextMsgTable.put(bean.getSequenceId(), bean);
+ return true;
+ }
+
+ public boolean updateRetransmitterBean(RetransmitterBean bean) {
+ retransmitterBeanTable.put(bean.getMessageId(), bean);
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.sandesha2.storage.StorageManager#updateStorageMapBean(org.apache.sandesha2.storage.beans.StorageMapBean)
+ */
+ public boolean updateStorageMapBean(StorageMapBean bean) {
+ storageMapBeanTable.put(bean.getKey(), bean);
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean updateSequencePropertyBean(SequencePropertyBean bean) {
+ sequencePropertyBeanTable.put(bean.getSequenceId(), bean);
+ return true;
+
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]