You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2005/11/02 06:58:32 UTC
svn commit: r330193 [2/2] - in
/webservices/sandesha/trunk/src/org/apache/sandesha2: ./ handlers/
msgprocessors/ storage/ storage/beanmanagers/ storage/beans/
storage/inmemory/ storage/persistent/ util/ workers/
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageMapBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageMapBeanMgr.java?rev=330193&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageMapBeanMgr.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageMapBeanMgr.java Tue Nov 1 21:56:42 2005
@@ -0,0 +1,109 @@
+/*
+ * 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.inmemory;
+
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.apache.axis2.context.AbstractContext;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.sandesha2.Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.beanmanagers.StorageMapBeanMgr;
+import org.apache.sandesha2.storage.beans.CreateSeqBean;
+import org.apache.sandesha2.storage.beans.StorageMapBean;
+
+/**
+ * @author Chamikara Jayalath <ch...@wso2.com>
+ * @author Sanka Samaranayake <ss...@gmail.com>
+ */
+public class InMemoryStorageMapBeanMgr implements StorageMapBeanMgr {
+ private Hashtable table = null;
+
+ /**
+ *
+ */
+ public InMemoryStorageMapBeanMgr(AbstractContext context) {
+ Object obj = context.getProperty(Constants.BeanMAPs.STORAGE_MAP);
+ if (obj != null) {
+ table = (Hashtable) obj;
+ } else {
+ table = new Hashtable();
+ context.setProperty(Constants.BeanMAPs.STORAGE_MAP, table);
+ }
+ }
+
+ public boolean insert(StorageMapBean bean) {
+ table.put(bean.getKey(), bean);
+ return true;
+ }
+
+ public boolean delete(String key) {
+ return table.remove(key) != null;
+ }
+
+ public StorageMapBean retrieve(String key) {
+ return (StorageMapBean) table.get(key);
+ }
+
+ public ResultSet find(String query) {
+ throw new UnsupportedOperationException("selectRS() is not implemented");
+ }
+
+ public Collection find(StorageMapBean bean) {
+ ArrayList beans = new ArrayList();
+ Iterator iterator = table.values().iterator();
+
+ StorageMapBean temp = new StorageMapBean();
+ while (iterator.hasNext()) {
+ temp = (StorageMapBean) iterator.next();
+ boolean select = true;
+ /*
+ * if ((temp.getKey() != null &&
+ * bean.getKey().equals(temp.getKey())) && (bean.getMsgNo() != -1 &&
+ * bean.getMsgNo() == temp.getMsgNo()) && (bean.getSequenceId() !=
+ * null && bean.getSequenceId().equals(temp.getSequenceId()))) {
+ */
+
+ //}
+ if (bean.getKey() != null && !bean.getKey().equals(temp.getKey()))
+ select = false;
+
+ if (bean.getMsgNo() != 0 && bean.getMsgNo() != temp.getMsgNo())
+ select = false;
+
+ if (bean.getSequenceId() != null
+ && !bean.getSequenceId().equals(temp.getSequenceId()))
+ select = false;
+
+ if (select)
+ beans.add(temp);
+ }
+ return beans;
+ }
+
+ public boolean update(StorageMapBean bean) {
+ if (!table.contains(bean))
+ return false;
+
+ return table.put(bean.getKey(), bean) != null;
+ }
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java?rev=330193&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java Tue Nov 1 21:56:42 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright 1999-2004 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.inmemory;
+
+import org.apache.sandesha2.storage.Transaction;
+
+public class InMemoryTransaction implements Transaction {
+
+ public void commit () {
+
+ }
+
+ public void rollback () {
+
+ }
+
+}
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentCreateSeqBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentCreateSeqBeanMgr.java?rev=330193&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentCreateSeqBeanMgr.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentCreateSeqBeanMgr.java Tue Nov 1 21:56:42 2005
@@ -0,0 +1,22 @@
+/*
+ * Copyright 1999-2004 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.persistent;
+
+public class PersistentCreateSeqBeanMgr {
+
+}
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentNextMsgBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentNextMsgBeanMgr.java?rev=330193&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentNextMsgBeanMgr.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentNextMsgBeanMgr.java Tue Nov 1 21:56:42 2005
@@ -0,0 +1,22 @@
+/*
+ * Copyright 1999-2004 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.persistent;
+
+public class PersistentNextMsgBeanMgr {
+
+}
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentRetransmitterBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentRetransmitterBeanMgr.java?rev=330193&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentRetransmitterBeanMgr.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentRetransmitterBeanMgr.java Tue Nov 1 21:56:42 2005
@@ -0,0 +1,22 @@
+/*
+ * Copyright 1999-2004 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.persistent;
+
+public class PersistentRetransmitterBeanMgr {
+
+}
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentSequencePropertyBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentSequencePropertyBeanMgr.java?rev=330193&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentSequencePropertyBeanMgr.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentSequencePropertyBeanMgr.java Tue Nov 1 21:56:42 2005
@@ -0,0 +1,22 @@
+/*
+ * Copyright 1999-2004 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.persistent;
+
+public class PersistentSequencePropertyBeanMgr {
+
+}
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentStorageManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentStorageManager.java?rev=330193&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentStorageManager.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentStorageManager.java Tue Nov 1 21:56:42 2005
@@ -0,0 +1,22 @@
+/*
+ * Copyright 1999-2004 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.persistent;
+
+public class PersistentStorageManager {
+
+}
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentStorageMapBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentStorageMapBeanMgr.java?rev=330193&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentStorageMapBeanMgr.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/PersistentStorageMapBeanMgr.java Tue Nov 1 21:56:42 2005
@@ -0,0 +1,22 @@
+/*
+ * Copyright 1999-2004 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.persistent;
+
+public class PersistentStorageMapBeanMgr {
+
+}
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/TransactionImpl.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/TransactionImpl.java?rev=330193&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/TransactionImpl.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/persistent/TransactionImpl.java Tue Nov 1 21:56:42 2005
@@ -0,0 +1,22 @@
+/*
+ * Copyright 1999-2004 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.persistent;
+
+public class TransactionImpl {
+
+}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java?rev=330193&r1=330192&r2=330193&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java Tue Nov 1 21:56:42 2005
@@ -1,3 +1,20 @@
+/*
+ * Copyright 1999-2004 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.util;
import java.math.BigInteger;
@@ -33,17 +50,19 @@
import org.apache.sandesha2.Constants.SOAPVersion;
import org.apache.sandesha2.Constants.SequenceProperties;
import org.apache.sandesha2.Constants.WSRM;
-import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
+import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.StorageMapBeanMgr;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+import org.apache.sandesha2.storage.inmemory.InMemoryNextMsgBeanMgr;
+import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
+import org.apache.sandesha2.storage.inmemory.InMemoryStorageMapBeanMgr;
import org.apache.sandesha2.wsrm.FaultCode;
import org.apache.sandesha2.wsrm.SequenceFault;
/**
* @author Sanka
- * @author Chamikara
*/
public class FaultMgr {
@@ -127,8 +146,8 @@
public RMMsgContext checkSequenceMsg(MessageContext msgCtx)
throws SandeshaException {
- NextMsgBeanMgr mgr =
- AbstractBeanMgrFactory.getInstance(msgCtx).getNextMsgBeanMgr();
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(msgCtx.getSystemContext());
+ NextMsgBeanMgr mgr = storageManager.getNextMsgBeanMgr();
SOAPEnvelope envelope = msgCtx.getEnvelope();
OMElement element = envelope.getHeader().getFirstChildWithName(
@@ -167,12 +186,15 @@
*/
public RMMsgContext checkSequenceAcknowledgementMsg(MessageContext msgCtx)
throws SandeshaException {
+
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(msgCtx.getSystemContext());
+
NextMsgBeanMgr mgr
- = AbstractBeanMgrFactory.getInstance(msgCtx).getNextMsgBeanMgr();
+ = storageManager.getNextMsgBeanMgr();
StorageMapBeanMgr smgr
- = AbstractBeanMgrFactory.getInstance(msgCtx).getStorageMapBeanMgr();
+ = storageManager.getStorageMapBeanMgr();
SequencePropertyBeanMgr propertyBeanMgr
- = AbstractBeanMgrFactory.getInstance(msgCtx).getSequencePropretyBeanMgr();
+ = storageManager.getSequencePropretyBeanMgr();
SOAPEnvelope envelope = msgCtx.getEnvelope();
// this is a SequenceAcknowledgement message
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java?rev=330193&r1=330192&r2=330193&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java Tue Nov 1 21:56:42 2005
@@ -55,9 +55,10 @@
import org.apache.sandesha2.Constants.WSA;
import org.apache.sandesha2.Constants.WSRM;
import org.apache.sandesha2.msgreceivers.RMMessageReceiver;
-import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
+import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
import org.apache.sandesha2.wsrm.Accept;
import org.apache.sandesha2.wsrm.AckRequested;
import org.apache.sandesha2.wsrm.AcknowledgementRange;
@@ -94,7 +95,8 @@
if (context == null)
throw new SandeshaException("Configuration Context is null");
- SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory.getInstance(context).getSequencePropretyBeanMgr();
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
MessageContext createSeqmsgContext;
try {
//creating by copying common contents. (this will not set contexts
@@ -366,8 +368,8 @@
ConfigurationContext ctx = applicationMsg.getMessageContext()
.getSystemContext();
- SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory
- .getInstance(ctx).getSequencePropretyBeanMgr();
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(ctx);
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
SequencePropertyBean seqBean = seqPropMgr.retrieve(sequenceId,
Constants.SequenceProperties.RECEIVED_MESSAGES);
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java?rev=330193&r1=330192&r2=330193&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java Tue Nov 1 21:56:42 2005
@@ -18,6 +18,7 @@
import java.awt.datatransfer.StringSelection;
import java.io.InputStream;
+import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -56,6 +57,7 @@
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.msgreceivers.RMMessageReceiver;
+import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.workers.InOrderInvoker;
import org.apache.sandesha2.workers.Sender;
import org.apache.sandesha2.wsrm.AcknowledgementRange;
@@ -68,7 +70,7 @@
public class SandeshaUtil {
private static Hashtable storedMsgContexts = new Hashtable();
-
+ private static StorageManager storageManager = null;
private static Sender sender = new Sender();
private static InOrderInvoker invoker = new InOrderInvoker ();
@@ -453,5 +455,30 @@
public static String getServerSideInternalSeqIdFromIncomingSeqId (String incomingSequenceId) {
String internalSequenceId = incomingSequenceId;
return internalSequenceId;
+ }
+
+ public static StorageManager getSandeshaStorageManager (ConfigurationContext context) throws SandeshaException {
+ String srotageManagerClassStr = Constants.STORAGE_MANAGER_IMPL;
+
+ if (storageManager!=null)
+ return storageManager;
+
+ try {
+ Class c = Class.forName(srotageManagerClassStr);
+ Class configContextClass = Class.forName(context.getClass().getName());
+ Constructor constructor = c.getConstructor(new Class[]{configContextClass});
+ Object obj = constructor.newInstance(new Object[] {context});
+
+ if (obj==null || !(obj instanceof StorageManager))
+ throw new SandeshaException ("StorageManager must implement org.apache.sandeshat.storage.StorageManager");
+
+ StorageManager mgr = (StorageManager) obj;
+ storageManager = mgr;
+ return storageManager;
+
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ throw new SandeshaException (e.getMessage());
+ }
}
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java?rev=330193&r1=330192&r2=330193&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java Tue Nov 1 21:56:42 2005
@@ -23,11 +23,13 @@
import org.apache.sandesha2.Constants.SequenceProperties;
import org.apache.sandesha2.Constants.WSA;
import org.apache.sandesha2.handlers.SandeshaInHandler;
-import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
+import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beans.NextMsgBean;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+import org.apache.sandesha2.storage.inmemory.InMemoryNextMsgBeanMgr;
+import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
import org.apache.sandesha2.wsrm.AcksTo;
import org.apache.sandesha2.wsrm.CreateSequence;
@@ -41,7 +43,7 @@
public static String setupNewSequence(RMMsgContext createSequenceMsg) throws AxisFault {
// SequencePropertyBean seqPropBean = new SequencePropertyBean
// (sequenceId,Constants.SEQ_PROPERTY_RECEIVED_MESSAGES,"");
- // SequencePropertyBeanMgr beanMgr = new SequencePropertyBeanMgr
+ // InMemorySequencePropertyBeanMgr beanMgr = new InMemorySequencePropertyBeanMgr
// (Constants.DEFAULT_STORAGE_TYPE);
// beanMgr.create(seqPropBean);
@@ -68,8 +70,15 @@
if (acksTo == null)
throw new AxisFault("AcksTo is null");
- SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory
- .getInstance(context).getSequencePropretyBeanMgr();
+ StorageManager storageManager = null;
+
+ try {
+ storageManager = SandeshaUtil.getSandeshaStorageManager(createSequenceMsg.getMessageContext().getSystemContext());
+ } catch (SandeshaException e) {
+ e.printStackTrace();
+ }
+
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
//TODO - recheck following
//incoming To - reply address of response messages
@@ -88,8 +97,7 @@
seqPropMgr.insert(replyToBean);
seqPropMgr.insert(acksToBean);
- NextMsgBeanMgr nextMsgMgr = AbstractBeanMgrFactory.getInstance(context)
- .getNextMsgBeanMgr();
+ NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();
nextMsgMgr.insert(new NextMsgBean(sequenceId, 1)); // 1 will be the next
// message to invoke
//this will apply for only in-order invocations.
@@ -104,7 +112,10 @@
public static void setupNewClientSequence (MessageContext firstAplicationMsgCtx, String tempSequenceId) throws SandeshaException {
AbstractContext context = firstAplicationMsgCtx.getSystemContext();
- SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory.getInstance(context).getSequencePropretyBeanMgr();
+
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(firstAplicationMsgCtx.getSystemContext());
+
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
EndpointReference toEPR = firstAplicationMsgCtx.getTo();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java?rev=330193&r1=330192&r2=330193&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java Tue Nov 1 21:56:42 2005
@@ -32,13 +32,16 @@
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.Constants.MessageParts;
import org.apache.sandesha2.Constants.SequenceProperties;
-import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
+import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.StorageMapBeanMgr;
import org.apache.sandesha2.storage.beans.NextMsgBean;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
import org.apache.sandesha2.storage.beans.StorageMapBean;
+import org.apache.sandesha2.storage.inmemory.InMemoryNextMsgBeanMgr;
+import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
+import org.apache.sandesha2.storage.inmemory.InMemoryStorageMapBeanMgr;
import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.sandesha2.wsrm.Sequence;
@@ -88,14 +91,13 @@
try {
- NextMsgBeanMgr nextMsgMgr = AbstractBeanMgrFactory.getInstance(
- context).getNextMsgBeanMgr();
+
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
+ NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();
- StorageMapBeanMgr storageMapMgr = AbstractBeanMgrFactory
- .getInstance(context).getStorageMapBeanMgr();
+ StorageMapBeanMgr storageMapMgr = storageManager.getStorageMapBeanMgr();
- SequencePropertyBeanMgr sequencePropMgr = AbstractBeanMgrFactory
- .getInstance(context).getSequencePropretyBeanMgr();
+ SequencePropertyBeanMgr sequencePropMgr = storageManager.getSequencePropretyBeanMgr();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java?rev=330193&r1=330192&r2=330193&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Tue Nov 1 21:56:42 2005
@@ -47,9 +47,10 @@
import org.apache.sandesha2.Constants.MessageTypes;
import org.apache.sandesha2.client.SandeshaMepClient;
import org.apache.sandesha2.msgreceivers.RMMessageReceiver;
-import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
+import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
import org.apache.sandesha2.storage.beans.RetransmitterBean;
+import org.apache.sandesha2.storage.inmemory.InMemoryRetransmitterBeanMgr;
import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.sandesha2.wsrm.Sequence;
@@ -85,8 +86,16 @@
return;
}
- RetransmitterBeanMgr mgr = AbstractBeanMgrFactory.getInstance(
- context).getRetransmitterBeanMgr();
+ StorageManager storageManager = null;
+
+ try {
+ storageManager = SandeshaUtil.getSandeshaStorageManager(context);
+ } catch (SandeshaException e4) {
+ e4.printStackTrace();
+ return;
+ }
+
+ RetransmitterBeanMgr mgr = storageManager.getRetransmitterBeanMgr();
Collection coll = mgr.findMsgsToSend();
Iterator iter = coll.iterator();
while (iter.hasNext()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org