ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chamikara Jayalath <chamikar...@gmail.com>
Subject Re: [Patch] RM Storage Impls
Date Mon, 29 Aug 2005 11:21:56 GMT
Done.

Chamikara


On 8/29/05, Sanka Samaranayake <ssanka@gmail.com> wrote:
> Dear Sandesha Comitters,
> 
> Please accept this patch which include some implementations for
> org.apache.sandesha2.storage package.
> 
> Thank you,
> Sanka
> 
> 
> 
> Index: storage/StorageManager.java
> ===================================================================
> --- storage/StorageManager.java (revision 264096)
> +++ storage/StorageManager.java (working copy)
> @@ -17,10 +17,48 @@
> 
>  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.StorageMapBean;
> +
>  /**
>   * @author
>   *
>   */
> -public class StorageManager {
> +public interface StorageManager {
> 
> +       public boolean createCreateSeq(CreateSeqBean bean);
> +
> +       public CreateSeqBean retriveCreateSeq(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);
> +
> +
>  }
> Index: storage/PermanentStorageMgr.java
> ===================================================================
> --- storage/PermanentStorageMgr.java    (revision 264096)
> +++ storage/PermanentStorageMgr.java    (working copy)
> @@ -17,10 +17,139 @@
> 
>  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.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) {
> +               return false;
> +       }
> +
> +       public CreateSeqBean retriveCreateSeq(String key) {
> +               // retrieve the appropriate tuple form the table
> +               // use that data to create and return the Bean
> +               return null;
> +       }
> +
> +       public boolean updataCreateSeq(CreateSeqBean bean) {
> +               // update the database using the data in bean
> +               return false;
> +       }
> +
> +       public boolean deleteCreateSeq(String key) {
> +               // delete the recored which is identified by this key..
> +               return false;
> +       }
> +
> +
> +       /* (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
> +               return false;
> +       }
> +       /* (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
> +               return false;
> +       }
> +       /* (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
> +               return false;
> +       }
> +       /* (non-Javadoc)
> +        * @see org.apache.sandesha2.storage.StorageManager#deleteNextMsgBean(java.lang.String)
> +        */
> +       public boolean deleteNextMsgBean(String key) {
> +               // TODO Auto-generated method stub
> +               return false;
> +       }
> +       /* (non-Javadoc)
> +        * @see org.apache.sandesha2.storage.StorageManager#deleteRetransmitterBean(java.lang.String)
> +        */
> +       public boolean deleteRetransmitterBean(String key) {
> +               // TODO Auto-generated method stub
> +               return false;
> +       }
> +       /* (non-Javadoc)
> +        * @see org.apache.sandesha2.storage.StorageManager#deleteStorageMapBean(java.lang.String)
> +        */
> +       public boolean deleteStorageMapBean(String key) {
> +               // TODO Auto-generated method stub
> +               return false;
> +       }
> +       /* (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;
> +       }
> +       /* (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
> +               return false;
> +       }
> +       /* (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
> +               return false;
> +       }
>  }
> Index: storage/StorageManagerFactory.java
> ===================================================================
> --- storage/StorageManagerFactory.java  (revision 264096)
> +++ storage/StorageManagerFactory.java  (working copy)
> @@ -22,6 +22,13 @@
>   *
>   */
>  public class StorageManagerFactory {
> -
> 
> +       public static StorageManager getInMemoryStorageManager() {
> +               return InMemoryStorageMgr.getInstance();
> +       }
> +
> +       public static StorageManager getPermanentStroageManager() {
> +               return PermanentStorageMgr.getInstance();
> +       }
> +
>  }
> 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 <ssanka@gmail.com>
> + */
> +public class SequencePropertyBean {
> +
> +       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)
> @@ -23,7 +23,45 @@
>   */
>  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,153 @@
> 
>  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.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();
> +
> +       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 retriveCreateSeq(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;
> +       }
> +       /* (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;
> +       }
> +       /* (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);
> +       }
> +       /* (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;
> +       }
>  }
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: sandesha-dev-help@ws.apache.org
> 
>

---------------------------------------------------------------------
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