You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2006/06/15 07:51:24 UTC
svn commit: r414476 [7/15] - in /webservices/sandesha/trunk: ./ c/ config/
interop/ java/ java/config/ java/interop/ java/interop/conf/
java/interop/src/ java/interop/src/org/ java/interop/src/org/apache/
java/interop/src/org/apache/sandesha2/ java/int...
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/MessageTypesToDropProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/MessageTypesToDropProcessor.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/MessageTypesToDropProcessor.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/MessageTypesToDropProcessor.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,52 @@
+package org.apache.sandesha2.policy.processors;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.policy.PolicyEngineData;
+import org.apache.sandesha2.policy.RMPolicyToken;
+import org.apache.sandesha2.policy.RMProcessorContext;
+
+public class MessageTypesToDropProcessor {
+ private boolean initializedMessageTypesToDrop = false;
+
+ private Log logger = LogFactory.getLog(this.getClass().getName());
+
+ public void initializeMessageTypesToDrop(RMPolicyToken spt)
+ throws NoSuchMethodException {
+
+ }
+
+ public Object doMessageTypesToDrop(RMProcessorContext rmpc) {
+ RMPolicyToken rmpt = rmpc.readCurrentRMToken();
+ switch (rmpc.getAction()) {
+
+ case RMProcessorContext.START:
+ if (!initializedMessageTypesToDrop) {
+ try {
+ initializeMessageTypesToDrop(rmpt);
+ initializedMessageTypesToDrop = true;
+ } catch (NoSuchMethodException e) {
+ logger
+ .error(
+ "Exception occured in initializeMessageTypesToDrop",
+ e);
+ return new Boolean(false);
+ }
+ }
+ logger.debug(rmpt.getTokenName());
+
+ case RMProcessorContext.COMMIT:
+
+ // ////////////////////
+ PolicyEngineData ped = rmpc.readCurrentPolicyEngineData();
+ String text = rmpc.getAssertion().getStrValue();
+ ped.setMessageTypesToDrop(text);
+ // ////////////////////
+
+ break;
+ case RMProcessorContext.ABORT:
+ break;
+ }
+ return new Boolean(true);
+ }
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/RetransmissionItervalProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/RetransmissionItervalProcessor.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/RetransmissionItervalProcessor.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/RetransmissionItervalProcessor.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,49 @@
+package org.apache.sandesha2.policy.processors;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.policy.PolicyEngineData;
+import org.apache.sandesha2.policy.RMPolicyToken;
+import org.apache.sandesha2.policy.RMProcessorContext;
+
+public class RetransmissionItervalProcessor {
+ private boolean initializedRetransmissionInterval = false;
+
+ private Log logger = LogFactory.getLog(this.getClass().getName());
+
+ public void initializeRetranmissionIterval(RMPolicyToken spt)
+ throws NoSuchMethodException {
+ logger.debug("RetransmissionIntervalProcessor:initializeRetransmissionInterval");;
+
+ }
+
+ public Object doRetransmissionInterval(RMProcessorContext rmpc) {
+ RMPolicyToken rmpt = rmpc.readCurrentRMToken();
+ switch (rmpc.getAction()) {
+
+ case RMProcessorContext.START:
+ if (!initializedRetransmissionInterval) {
+ try {
+ initializeRetranmissionIterval(rmpt);
+ initializedRetransmissionInterval = true;
+ } catch (NoSuchMethodException e) {
+ logger.error("Exception in initializeRetransmissionInterval", e);
+ return new Boolean(false);
+ }
+ }
+
+ case RMProcessorContext.COMMIT:
+
+ // //////////////////
+ PolicyEngineData ped = rmpc.readCurrentPolicyEngineData();
+ String text = rmpc.getAssertion().getStrValue();
+ ped.setRetransmissionInterval(Long.parseLong(text));
+ // /////////////////
+
+ break;
+ case RMProcessorContext.ABORT:
+ break;
+ }
+ return new Boolean(true);
+ }
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/StorageManagersProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/StorageManagersProcessor.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/StorageManagersProcessor.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/policy/processors/StorageManagersProcessor.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,88 @@
+package org.apache.sandesha2.policy.processors;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.policy.PolicyEngineData;
+import org.apache.sandesha2.policy.RMPolicy;
+import org.apache.sandesha2.policy.RMPolicyToken;
+import org.apache.sandesha2.policy.RMProcessorContext;
+
+public class StorageManagersProcessor {
+ private boolean initializedStorageManager = false;
+
+ private Log logger = LogFactory.getLog(this.getClass().getName());
+
+ public void initializeStorageManager(RMPolicyToken rmpt)
+ throws NoSuchMethodException {
+// RMPolicyToken tmpRpt = RMPolicy.storageManager.copy();
+// tmpRpt.setProcessTokenMethod(this);
+// rmpt.setChildToken(tmpRpt);
+
+ RMPolicyToken tmpRpt = RMPolicy.inMemoryStorageManager.copy();
+ tmpRpt.setProcessTokenMethod(this);
+ rmpt.setChildToken(tmpRpt);
+
+ tmpRpt = RMPolicy.permanentStorageManager.copy();
+ tmpRpt.setProcessTokenMethod(this);
+ rmpt.setChildToken(tmpRpt);
+
+ }
+
+ public Object doStorageManagers(RMProcessorContext rmpc) {
+ RMPolicyToken rmpt = rmpc.readCurrentRMToken();
+ switch (rmpc.getAction()) {
+
+ case RMProcessorContext.START:
+ if (!initializedStorageManager) {
+ try {
+ initializeStorageManager(rmpt);
+ initializedStorageManager = true;
+ } catch (NoSuchMethodException e) {
+ logger.error(
+ "Exception occured in initializeStorageManager", e);
+ return new Boolean(false);
+ }
+ }
+ logger.debug(rmpt.getTokenName());
+
+ case RMProcessorContext.COMMIT:
+ break;
+ case RMProcessorContext.ABORT:
+ break;
+ }
+ return new Boolean(true);
+ }
+
+// public Object doStorageManager(RMProcessorContext rmpc) {
+// PolicyEngineData ped = rmpc.readCurrentPolicyEngineData();
+// String cls = rmpc.getAssertion().getStrValue();
+//
+// if (cls != null && !cls.trim().equals("")) {
+// ped.setStorageManager(cls.trim());
+// }
+//
+// return new Boolean(true);
+// }
+
+ public Object doInMemoryStorageManager(RMProcessorContext rmpc) {
+ PolicyEngineData ped = rmpc.readCurrentPolicyEngineData();
+ String cls = rmpc.getAssertion().getStrValue();
+
+ if (cls != null && !cls.trim().equals("")) {
+ ped.setInMemoryStorageManager(cls.trim());
+ }
+
+ return new Boolean(true);
+ }
+
+ public Object doPermanentStorageManager(RMProcessorContext spc) {
+ PolicyEngineData ped = spc.readCurrentPolicyEngineData();
+ String cls = spc.getAssertion().getStrValue();
+
+ if (cls != null && !cls.trim().equals("")) {
+ ped.setPermanentStorageManager(cls.trim());
+ }
+
+ return new Boolean(true);
+ }
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/SandeshaStorageException.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/SandeshaStorageException.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/SandeshaStorageException.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/SandeshaStorageException.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+import org.apache.sandesha2.SandeshaException;
+
+/**
+ * To easily track exceptions happening in the storage area.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ */
+
+public class SandeshaStorageException extends SandeshaException {
+ public SandeshaStorageException (String message) {
+ super (message);
+ }
+
+ public SandeshaStorageException (Exception e) {
+ super (e);
+ }
+
+ public SandeshaStorageException (String m,Exception e) {
+ super (m,e);
+ }
+
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/StorageManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/StorageManager.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/StorageManager.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/StorageManager.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,75 @@
+/*
+ * 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;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisModule;
+import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
+
+/**
+ * Storage managers should extend this.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public abstract class StorageManager {
+
+ private ConfigurationContext context;
+
+ public StorageManager(ConfigurationContext context) {
+ this.context = context;
+ }
+
+ public ConfigurationContext getContext() {
+ return context;
+ }
+
+ public void setContext(ConfigurationContext context) {
+ if (context != null)
+ this.context = context;
+ }
+
+ public abstract void initStorage (AxisModule moduleDesc) throws SandeshaStorageException;
+
+ public abstract Transaction getTransaction();
+
+ public abstract CreateSeqBeanMgr getCreateSeqBeanMgr();
+
+ public abstract NextMsgBeanMgr getNextMsgBeanMgr();
+
+ public abstract SenderBeanMgr getRetransmitterBeanMgr();
+
+ public abstract SequencePropertyBeanMgr getSequencePropretyBeanMgr();
+
+ public abstract InvokerBeanMgr getStorageMapBeanMgr();
+
+ public abstract void storeMessageContext (String storageKey,MessageContext msgContext) throws SandeshaStorageException;
+
+ public abstract void updateMessageContext (String storageKey,MessageContext msgContext) throws SandeshaStorageException;
+
+ public abstract MessageContext retrieveMessageContext (String storageKey, ConfigurationContext configContext) throws SandeshaStorageException;
+
+ public abstract void removeMessageContext (String storageKey) throws SandeshaStorageException;
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/Transaction.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/Transaction.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/Transaction.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/Transaction.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * Transaction implementations should extend this.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public interface Transaction {
+
+ public void commit ();
+
+ public void rollback ();
+
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/CreateSeqBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/CreateSeqBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/CreateSeqBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/CreateSeqBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,48 @@
+/*
+ * 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.beanmanagers;
+
+import java.util.Collection;
+
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beans.CreateSeqBean;
+
+/**
+ * This is used to manage CreateSequence beans.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+
+public interface CreateSeqBeanMgr extends RMBeanManager {
+
+ public boolean insert(CreateSeqBean bean) throws SandeshaStorageException;
+
+ public boolean delete(String msgId) throws SandeshaStorageException;
+
+ public CreateSeqBean retrieve(String msgId) throws SandeshaStorageException;
+
+ public boolean update(CreateSeqBean bean) throws SandeshaStorageException;
+
+ public Collection find(CreateSeqBean bean) throws SandeshaStorageException;
+
+ public CreateSeqBean findUnique (CreateSeqBean bean) throws SandeshaException;
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/InvokerBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/InvokerBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/InvokerBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/InvokerBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,47 @@
+/*
+ * 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.beanmanagers;
+
+import java.util.Collection;
+
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beans.InvokerBean;
+
+/**
+ * Used to manage invoker beans.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public interface InvokerBeanMgr extends RMBeanManager {
+
+ public boolean insert(InvokerBean bean) throws SandeshaStorageException;
+
+ public boolean delete(String key) throws SandeshaStorageException;
+
+ public InvokerBean retrieve(String key) throws SandeshaStorageException;
+
+ public Collection find(InvokerBean bean) throws SandeshaStorageException;
+
+ public InvokerBean findUnique (InvokerBean bean) throws SandeshaException;
+
+ public boolean update(InvokerBean bean) throws SandeshaStorageException;
+
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/NextMsgBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/NextMsgBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/NextMsgBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/NextMsgBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,48 @@
+/*
+ * 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.beanmanagers;
+
+import java.util.Collection;
+
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beans.NextMsgBean;
+
+/**
+ * Used to manage NextMsg beans.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public interface NextMsgBeanMgr extends RMBeanManager {
+
+ public boolean delete(String sequenceId) throws SandeshaStorageException;
+
+ public NextMsgBean retrieve(String sequenceId) throws SandeshaStorageException;
+
+ public boolean insert(NextMsgBean bean) throws SandeshaStorageException;
+
+ public Collection find(NextMsgBean bean) throws SandeshaStorageException;
+
+ public boolean update(NextMsgBean bean) throws SandeshaStorageException;
+
+ public NextMsgBean findUnique (NextMsgBean bean) throws SandeshaException;
+
+ public Collection retrieveAll();
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/RMBeanManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/RMBeanManager.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/RMBeanManager.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/RMBeanManager.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,29 @@
+/*
+ * 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.beanmanagers;
+
+/**
+ *
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public interface RMBeanManager {
+
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/SenderBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/SenderBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/SenderBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/SenderBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,52 @@
+/*
+ * 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.beanmanagers;
+
+import java.util.Collection;
+
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beans.SenderBean;
+
+/**
+ * Used to manage Sender beans.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public interface SenderBeanMgr extends RMBeanManager {
+
+ public boolean delete(String MessageId) throws SandeshaStorageException ;
+
+ public SenderBean retrieve(String MessageId) throws SandeshaStorageException;
+
+ public boolean insert(SenderBean bean) throws SandeshaStorageException;
+
+ public Collection find(SenderBean bean) throws SandeshaStorageException;
+
+ public Collection find(String internalSequenceID) throws SandeshaStorageException;
+
+ public SenderBean findUnique (SenderBean bean) throws SandeshaException;
+
+ public SenderBean getNextMsgToSend() throws SandeshaStorageException;
+
+ public boolean update(SenderBean bean) throws SandeshaStorageException;
+
+ public SenderBean retrieveFromMessageRefKey (String messageContextRefKey);
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/SequencePropertyBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/SequencePropertyBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/SequencePropertyBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beanmanagers/SequencePropertyBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,50 @@
+/*
+ * 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.beanmanagers;
+
+import java.util.Collection;
+
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+
+/**
+ * Used to manage Sequence Property beans.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public interface SequencePropertyBeanMgr extends RMBeanManager {
+
+ public boolean delete(String sequenceId, String name) throws SandeshaStorageException;
+
+ public SequencePropertyBean retrieve(String sequenceId, String name) throws SandeshaStorageException;
+
+ public boolean insert(SequencePropertyBean bean) throws SandeshaStorageException;
+
+ public Collection find(SequencePropertyBean bean) throws SandeshaStorageException;
+
+ public SequencePropertyBean findUnique (SequencePropertyBean bean) throws SandeshaException;
+
+ public boolean update(SequencePropertyBean bean) throws SandeshaStorageException;
+
+ public boolean updateOrInsert(SequencePropertyBean bean) throws SandeshaStorageException;
+
+ public Collection retrieveAll ();
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/CreateSeqBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/CreateSeqBean.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/CreateSeqBean.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/CreateSeqBean.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,85 @@
+/*
+ * 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.beans;
+
+/**
+ * This bean is used at the sending side (of both server and client)
+ * There is on object of this for each sequence.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class CreateSeqBean extends RMBean {
+
+ /**
+ * Comment for <code>internalSequenceID</code>
+ * This property is a unique identifier that can be used to identify the messages of a certain sequence.
+ * This is specially used by the sending side, since sequence id is not available in the begining.
+ * For the client side, indernal sequence id is a concantination of wsa:To and SEQUENCE_KEY (SEQUENCE_KEY can be set as a property).
+ * For the server side, this is the sequenceId of the incoming sequence.
+ */
+ private String internalSequenceID;
+
+ /**
+ * Comment for <code>createSeqMsgID</code>
+ * This is the message ID of the create sequence message.
+ */
+ private String createSeqMsgID;
+
+ /**
+ * Comment for <code>sequenceID</code>
+ * This is the actual Sequence ID of the sequence.
+ */
+ private String sequenceID;
+
+ public CreateSeqBean() {
+ }
+
+ public CreateSeqBean(String internalSeqID, String CreateSeqMsgID,
+ String sequenceID) {
+ this.internalSequenceID = internalSeqID;
+ this.createSeqMsgID = CreateSeqMsgID;
+ this.sequenceID = sequenceID;
+ }
+
+ public String getCreateSeqMsgID() {
+ return createSeqMsgID;
+ }
+
+ public void setCreateSeqMsgID(String createSeqMsgID) {
+ this.createSeqMsgID = createSeqMsgID;
+ }
+
+ public String getSequenceID() {
+ return sequenceID;
+ }
+
+ public void setSequenceID(String sequenceID) {
+ this.sequenceID = sequenceID;
+ }
+
+ public String getInternalSequenceID() {
+ return internalSequenceID;
+ }
+
+ public void setInternalSequenceID(String internalSequenceID) {
+ this.internalSequenceID = internalSequenceID;
+ }
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/InvokerBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/InvokerBean.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/InvokerBean.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/InvokerBean.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,118 @@
+/*
+ * 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.beans;
+
+/**
+ * This bean is used at the receiving side (of both server and client)
+ * There is one object for each application message to be invoked.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class InvokerBean extends RMBean {
+
+ /**
+ * Comment for <code>messageContextRefKey</code>
+ *
+ * This is the messageContextRefKey that is obtained after saving a message context in a storage.
+ */
+ private String messageContextRefKey;
+
+ /**
+ * Comment for <code>msgNo</code>
+ * The message number of the message.
+ */
+ private long msgNo;
+
+ /**
+ * Comment for <code>sequenceID</code>
+ * The sequence ID of the sequence the message belong to.
+ */
+ private String sequenceID;
+
+ /**
+ * Comment for <code>invoked</code>
+ * Weather the message has been invoked by the invoker.
+ */
+ private boolean invoked = false;
+
+
+ public InvokerBean() {
+
+ }
+
+ public InvokerBean(String key, long msgNo, String sequenceId) {
+ this.messageContextRefKey = key;
+ this.msgNo = msgNo;
+ this.sequenceID = sequenceId;
+ }
+
+ /**
+ * @return Returns the messageContextRefKey.
+ */
+ public String getMessageContextRefKey() {
+ return messageContextRefKey;
+ }
+
+ /**
+ * @param messageContextRefKey
+ * The messageContextRefKey to set.
+ */
+ public void setMessageContextRefKey(String messageContextRefKey) {
+ this.messageContextRefKey = messageContextRefKey;
+ }
+
+ /**
+ * @return Returns the msgNo.
+ */
+ public long getMsgNo() {
+ return msgNo;
+ }
+
+ /**
+ * @param msgNo
+ * The msgNo to set.
+ */
+ public void setMsgNo(long msgNo) {
+ this.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;
+ }
+
+ public boolean isInvoked() {
+ return invoked;
+ }
+
+ public void setInvoked(boolean invoked) {
+ this.invoked = invoked;
+ }
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/NextMsgBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/NextMsgBean.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/NextMsgBean.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/NextMsgBean.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,80 @@
+/*
+ * 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.beans;
+
+/**
+ * This bean is used at the receiving side (of both server and client)
+ * There is one entry for each sequence.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class NextMsgBean extends RMBean {
+
+ /**
+ * Comment for <code>sequenceID</code>
+ * The sequenceID of the representing sequence.
+ */
+ private String sequenceID;
+
+ /**
+ * Comment for <code>nextMsgNoToProcess</code>
+ * The next message to be invoked of the representing sequence.
+ */
+ private long nextMsgNoToProcess;
+
+ public NextMsgBean() {
+
+ }
+
+ public NextMsgBean(String sequenceID, long nextNsgNo) {
+ this.sequenceID = sequenceID;
+ this.nextMsgNoToProcess = nextNsgNo;
+ }
+
+ /**
+ * @return Returns the nextMsgNoToProcess.
+ */
+ public long getNextMsgNoToProcess() {
+ return nextMsgNoToProcess;
+ }
+
+ /**
+ * @param nextMsgNoToProcess
+ * The nextMsgNoToProcess to set.
+ */
+ public void setNextMsgNoToProcess(long nextMsgNoToProcess) {
+ this.nextMsgNoToProcess = nextMsgNoToProcess;
+ }
+
+ /**
+ * @return Returns the sequenceId.
+ */
+ public String getSequenceID() {
+ return sequenceID;
+ }
+
+ /**
+ * @param sequenceId
+ * The sequenceId to set.
+ */
+ public void setSequenceID(String sequenceID) {
+ this.sequenceID = sequenceID;
+ }
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMBean.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMBean.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMBean.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,39 @@
+/*
+ * 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.beans;
+
+import java.io.Serializable;
+
+/**
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public abstract class RMBean implements Serializable {
+
+ private long id;
+
+
+ public long getId() {
+ return id;
+ }
+
+ protected void setId(long id) {
+ this.id = id;
+ }
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SenderBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SenderBean.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SenderBean.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SenderBean.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,188 @@
+/*
+ * 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.beans;
+
+/**
+ * This bean is used at the sending side (of both server and client)
+ * There is one eatry for each message to be sent.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class SenderBean extends RMBean {
+
+ /**
+ * Comment for <code>messageID</code>
+ * The message id of the representing message.
+ *
+ */
+ private String messageID;
+
+ /**
+ * Comment for <code>messageContextRefKey</code>
+ * Key retrieved by the storage mechanism after storing the message.
+ */
+ private String messageContextRefKey;
+
+ /**
+ * Comment for <code>send</code>
+ * The sender will not send the message unless this property is true.
+ */
+ private boolean send;
+
+ /**
+ * Comment for <code>internalSequenceID</code>
+ * Please see the comment of CreateSeqBean.
+ */
+ private String internalSequenceID;
+
+ /**
+ * Comment for <code>sentCount</code>
+ * The number of times current message has been sent.
+ */
+ private int sentCount = 0;
+
+ /**
+ * Comment for <code>messageNumber</code>
+ * The message number of the current message.
+ */
+ private long messageNumber = 0;
+
+ /**
+ * Comment for <code>reSend</code>
+ * If this property if false. The message has to be sent only once. The entry has to be deleted after sending.
+ */
+ private boolean reSend = true;
+
+ /**
+ * Comment for <code>timeToSend</code>
+ * Message has to be sent only after this time.
+ */
+ private long timeToSend = 0;
+
+ /**
+ * Comment for <code>messageType</code>
+ * The type of the current message.
+ * Possible types are given in Sandesha2Constants.MessageTypes interface.
+ */
+ private int messageType =0;
+
+ /**
+ * The sequenceID of the sequence this message belong to.
+ * this may be null for some messages (e.g. create sequence);
+ */
+ //TODO fill this property correctly
+ private String sequenceID;
+
+ public SenderBean() {
+
+ }
+
+ public SenderBean(String messageID, String key,
+ boolean send,long timeToSend, String internalSequenceID, long messageNumber) {
+ this.messageID = messageID;
+ this.messageContextRefKey = key;
+ //this.LastSentTime = lastSentTime;
+ this.timeToSend = timeToSend;
+ this.send = send;
+ this.internalSequenceID = internalSequenceID;
+ this.messageNumber = messageNumber;
+ }
+
+ public String getMessageContextRefKey() {
+ return messageContextRefKey;
+ }
+
+ public void setMessageContextRefKey(String messageContextRefKey) {
+ this.messageContextRefKey = messageContextRefKey;
+ }
+
+ public String getMessageID() {
+ return messageID;
+ }
+
+ public void setMessageID(String messageID) {
+ this.messageID = messageID;
+ }
+
+ public boolean isSend() {
+ return send;
+ }
+
+ public void setSend(boolean send) {
+ this.send = send;
+ }
+
+ public String getInternalSequenceID() {
+ return internalSequenceID;
+ }
+
+ public void setInternalSequenceID(String internalSequenceId) {
+ this.internalSequenceID = internalSequenceId;
+ }
+
+ public int getSentCount() {
+ return sentCount;
+ }
+
+ public void setSentCount(int sentCount) {
+ this.sentCount = sentCount;
+ }
+
+ public long getMessageNumber() {
+ return messageNumber;
+ }
+
+ public void setMessageNumber(long messageNumber) {
+ this.messageNumber = messageNumber;
+ }
+
+ public boolean isReSend() {
+ return reSend;
+ }
+
+ public void setReSend(boolean reSend) {
+ this.reSend = reSend;
+ }
+
+ public long getTimeToSend() {
+ return timeToSend;
+ }
+
+ public void setTimeToSend(long timeToSend) {
+ this.timeToSend = timeToSend;
+ }
+
+
+ public int getMessageType() {
+ return messageType;
+ }
+
+ public void setMessageType(int messagetype) {
+ this.messageType = messagetype;
+ }
+
+ public String getSequenceID() {
+ return sequenceID;
+ }
+
+ public void setSequenceID(String sequenceID) {
+ this.sequenceID = sequenceID;
+ }
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SequencePropertyBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SequencePropertyBean.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SequencePropertyBean.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/SequencePropertyBean.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+/**
+ * This bean is used to store properties of a certain sequence.
+ * Used by both sending and receiving sides.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class SequencePropertyBean extends RMBean {
+
+ /**
+ * Comment for <code>sequenceID</code>
+ * Sequence ID of the sequence this property belong to.
+ */
+ private String sequenceID;
+
+ /**
+ * Comment for <code>name</code>
+ * The name of the property. Possible names are given in the Sandesha2Constants.SequenceProperties interface.
+ */
+ private String name;
+
+ /**
+ * Comment for <code>value</code>
+ * The value of the property.
+ */
+ private String value;
+
+ public SequencePropertyBean(String seqID, String propertyName, String value) {
+ this.sequenceID = seqID;
+ this.name = propertyName;
+ this.value = value;
+ }
+
+ public SequencePropertyBean() {
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getSequenceID() {
+ return sequenceID;
+ }
+
+ public void setSequenceID(String sequenceID) {
+ this.sequenceID = sequenceID;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryCreateSeqBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryCreateSeqBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryCreateSeqBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryCreateSeqBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,127 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
+import org.apache.sandesha2.storage.beans.CreateSeqBean;
+
+/**
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class InMemoryCreateSeqBeanMgr implements CreateSeqBeanMgr {
+
+ private static final Log log = LogFactory.getLog(InMemoryCreateSeqBeanMgr.class);
+ private Hashtable table = null;
+
+
+ public InMemoryCreateSeqBeanMgr(AbstractContext context) {
+ Object obj = context.getProperty(Sandesha2Constants.BeanMAPs.CREATE_SEQUECE);
+ if (obj != null) {
+ table = (Hashtable) obj;
+ } else {
+ table = new Hashtable();
+ context.setProperty(Sandesha2Constants.BeanMAPs.CREATE_SEQUECE, table);
+ }
+ }
+
+ public synchronized boolean insert(CreateSeqBean bean) {
+ table.put(bean.getCreateSeqMsgID(), bean);
+ return true;
+ }
+
+ public synchronized boolean delete(String msgId) {
+ return table.remove(msgId) != null;
+ }
+
+ public synchronized CreateSeqBean retrieve(String msgId) {
+ return (CreateSeqBean) table.get(msgId);
+ }
+
+ public synchronized boolean update(CreateSeqBean bean) {
+ if (table.get(bean.getCreateSeqMsgID())==null)
+ return false;
+
+ return table.put(bean.getCreateSeqMsgID(), bean) != null;
+ }
+
+ public synchronized Collection find(CreateSeqBean bean) {
+ ArrayList beans = new ArrayList();
+ if (bean == null)
+ return beans;
+
+ Iterator iterator = table.values().iterator();
+
+ CreateSeqBean temp;
+ while (iterator.hasNext()) {
+ temp = (CreateSeqBean) iterator.next();
+
+ boolean equal = true;
+
+ if (bean.getCreateSeqMsgID() != null
+ && !bean.getCreateSeqMsgID().equals(
+ temp.getCreateSeqMsgID()))
+ equal = false;
+
+ if (bean.getSequenceID() != null
+ && !bean.getSequenceID().equals(temp.getSequenceID()))
+ equal = false;
+
+ if (bean.getInternalSequenceID() != null
+ && !bean.getInternalSequenceID().equals(
+ temp.getInternalSequenceID()))
+ equal = false;
+
+ if (equal)
+ beans.add(temp);
+
+ }
+ return beans;
+ }
+
+ public synchronized ResultSet find(String query) {
+ throw new UnsupportedOperationException("selectRS() is not supported");
+ }
+
+ public synchronized CreateSeqBean findUnique (CreateSeqBean bean) throws SandeshaException {
+ Collection coll = find(bean);
+ if (coll.size()>1) {
+ String message = "Non-Unique result";
+ log.error(message);
+ throw new SandeshaException (message);
+ }
+
+ Iterator iter = coll.iterator();
+ if (iter.hasNext())
+ return (CreateSeqBean) iter.next();
+ else
+ return null;
+ }
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,120 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
+import org.apache.sandesha2.storage.beans.InvokerBean;
+
+/**
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class InMemoryInvokerBeanMgr implements InvokerBeanMgr {
+
+ private static final Log log = LogFactory.getLog(InMemoryInvokerBeanMgr.class);
+ private Hashtable table = null;
+
+ public InMemoryInvokerBeanMgr(AbstractContext context) {
+ Object obj = context.getProperty(Sandesha2Constants.BeanMAPs.STORAGE_MAP);
+ if (obj != null) {
+ table = (Hashtable) obj;
+ } else {
+ table = new Hashtable();
+ context.setProperty(Sandesha2Constants.BeanMAPs.STORAGE_MAP, table);
+ }
+ }
+
+ public synchronized boolean insert(InvokerBean bean) {
+ table.put(bean.getMessageContextRefKey(), bean);
+ return true;
+ }
+
+ public synchronized boolean delete(String key) {
+ return table.remove(key) != null;
+ }
+
+ public synchronized InvokerBean retrieve(String key) {
+ return (InvokerBean) table.get(key);
+ }
+
+ public synchronized ResultSet find(String query) {
+ throw new UnsupportedOperationException("selectRS() is not implemented");
+ }
+
+ public synchronized Collection find(InvokerBean bean) {
+ ArrayList beans = new ArrayList();
+ Iterator iterator = table.values().iterator();
+
+ InvokerBean temp = new InvokerBean();
+ while (iterator.hasNext()) {
+ temp = (InvokerBean) iterator.next();
+ boolean select = true;
+
+ if (bean.getMessageContextRefKey() != null && !bean.getMessageContextRefKey().equals(temp.getMessageContextRefKey()))
+ select = false;
+
+ if (bean.getMsgNo() != 0 && bean.getMsgNo() != temp.getMsgNo())
+ select = false;
+
+ if (bean.getSequenceID() != null
+ && !bean.getSequenceID().equals(temp.getSequenceID()))
+ select = false;
+
+ if (bean.isInvoked()!=temp.isInvoked())
+ select = false;
+
+ if (select)
+ beans.add(temp);
+ }
+ return beans;
+ }
+
+ public synchronized boolean update(InvokerBean bean) {
+ if (table.get(bean.getMessageContextRefKey())==null)
+ return false;
+
+ return table.put(bean.getMessageContextRefKey(), bean) != null;
+ }
+
+ public synchronized InvokerBean findUnique (InvokerBean bean) throws SandeshaException {
+ Collection coll = find(bean);
+ if (coll.size()>1) {
+ String message = "Non-Unique result";
+ log.error(message);
+ throw new SandeshaException (message);
+ }
+
+ Iterator iter = coll.iterator();
+ if (iter.hasNext())
+ return (InvokerBean) iter.next();
+ else
+ return null;
+ }
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryNextMsgBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryNextMsgBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryNextMsgBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryNextMsgBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,125 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
+import org.apache.sandesha2.storage.beans.NextMsgBean;
+
+/**
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class InMemoryNextMsgBeanMgr implements NextMsgBeanMgr {
+
+ private static final Log log = LogFactory.getLog(InMemoryNextMsgBeanMgr.class);
+ private Hashtable table = null;
+
+ public InMemoryNextMsgBeanMgr(AbstractContext context) {
+ Object obj = context.getProperty(Sandesha2Constants.BeanMAPs.NEXT_MESSAGE);
+
+ if (obj != null) {
+ table = (Hashtable) obj;
+ } else {
+ table = new Hashtable();
+ context.setProperty(Sandesha2Constants.BeanMAPs.NEXT_MESSAGE, table);
+ }
+ }
+
+ public synchronized boolean delete(String sequenceId) {
+ return table.remove(sequenceId) != null;
+ }
+
+ public synchronized NextMsgBean retrieve(String sequenceId) {
+ return (NextMsgBean) table.get(sequenceId);
+ }
+
+ public synchronized boolean insert(NextMsgBean bean) {
+ table.put(bean.getSequenceID(), bean);
+ return true;
+ }
+
+ public synchronized ResultSet find(String query) {
+ throw new UnsupportedOperationException("selectRS() is not supported");
+ }
+
+ public synchronized Collection find(NextMsgBean bean) {
+ ArrayList beans = new ArrayList();
+ Iterator iterator = table.values().iterator();
+
+ if (bean == null)
+ return beans;
+
+ NextMsgBean temp;
+ while (iterator.hasNext()) {
+ temp = (NextMsgBean) iterator.next();
+
+ boolean equal = true;
+
+ if (bean.getNextMsgNoToProcess() > 0
+ && bean.getNextMsgNoToProcess() != temp
+ .getNextMsgNoToProcess())
+ equal = false;
+
+ if (bean.getSequenceID() != null
+ && !bean.getSequenceID().equals(temp.getSequenceID()))
+ equal = false;
+
+ if (equal)
+ beans.add(temp);
+
+ }
+ return beans;
+ }
+
+ public synchronized boolean update(NextMsgBean bean) {
+ if (table.get(bean.getSequenceID())==null)
+ return false;
+
+ return table.put(bean.getSequenceID(), bean) != null;
+ }
+
+ public synchronized Collection retrieveAll() {
+ return table.values();
+ }
+
+ public synchronized NextMsgBean findUnique(NextMsgBean bean) throws SandeshaException {
+ Collection coll = find(bean);
+ if (coll.size()>1) {
+ String message = "Non-Unique result";
+ log.error(message);
+ throw new SandeshaException (message);
+ }
+
+ Iterator iter = coll.iterator();
+ if (iter.hasNext())
+ return (NextMsgBean) iter.next();
+ else
+ return null;
+ }
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,241 @@
+/*
+ * 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.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.apache.axis2.context.AbstractContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+import org.apache.sandesha2.storage.beans.SenderBean;
+
+/**
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class InMemorySenderBeanMgr implements SenderBeanMgr {
+
+ private static final Log log = LogFactory.getLog(InMemorySenderBeanMgr.class);
+ private Hashtable table = null;
+
+ public InMemorySenderBeanMgr(AbstractContext context) {
+ Object obj = context.getProperty(Sandesha2Constants.BeanMAPs.RETRANSMITTER);
+ if (obj != null) {
+ table = (Hashtable) obj;
+ } else {
+ table = new Hashtable();
+ context.setProperty(Sandesha2Constants.BeanMAPs.RETRANSMITTER, table);
+ }
+ }
+
+ public synchronized boolean delete(String MessageId) {
+ return table.remove(MessageId) != null;
+ }
+
+ public synchronized SenderBean retrieve(String MessageId) {
+ return (SenderBean) table.get(MessageId);
+ }
+
+ public synchronized boolean insert(SenderBean bean) throws SandeshaStorageException {
+ if (bean.getMessageID() == null)
+ throw new SandeshaStorageException("Key (MessageId) is null. Cant insert.");
+ table.put(bean.getMessageID(), bean);
+ return true;
+ }
+
+ public synchronized Collection find(String internalSequenceID) {
+
+ ArrayList arrayList = new ArrayList ();
+ if (internalSequenceID==null || "".equals(internalSequenceID))
+ return arrayList;
+
+ Iterator iterator = table.keySet().iterator();
+
+ while (iterator.hasNext()) {
+ SenderBean senderBean = (SenderBean) table.get(iterator.next());
+ if (internalSequenceID.equals(senderBean.getInternalSequenceID()))
+ arrayList.add(senderBean);
+ }
+
+ return arrayList;
+ }
+
+ public synchronized Collection find(SenderBean bean) {
+ ArrayList beans = new ArrayList();
+ Iterator iterator = ((Hashtable) table).values().iterator();
+
+ SenderBean temp;
+ while (iterator.hasNext()) {
+
+ temp = (SenderBean) iterator.next();
+
+ boolean add = true;
+
+ if (bean.getMessageContextRefKey() != null && !bean.getMessageContextRefKey().equals(temp.getMessageContextRefKey()))
+ add = false;
+
+ if (bean.getTimeToSend() > 0
+ && bean.getTimeToSend() != temp.getTimeToSend())
+ add = false;
+
+ if (bean.getMessageID() != null
+ && !bean.getMessageID().equals(temp.getMessageID()))
+ add = false;
+
+ if (bean.getInternalSequenceID() != null
+ && !bean.getInternalSequenceID().equals(
+ temp.getInternalSequenceID()))
+ add = false;
+
+ if (bean.getMessageNumber() > 0
+ && bean.getMessageNumber() != temp.getMessageNumber())
+ add = false;
+
+ if (bean.getMessageType() != Sandesha2Constants.MessageTypes.UNKNOWN
+ && bean.getMessageType() != temp.getMessageType())
+ add = false;
+
+ if (bean.isSend() != temp.isSend())
+ add = false;
+
+ if (bean.isReSend() != temp.isReSend())
+ add = false;
+
+ if (add)
+ beans.add(temp);
+ }
+
+ return beans;
+ }
+
+ public synchronized SenderBean getNextMsgToSend() {
+ Iterator iterator = table.keySet().iterator();
+
+ long lowestAppMsgNo = 0;
+ while (iterator.hasNext()) {
+ Object key = iterator.next();
+ SenderBean temp = (SenderBean) table.get(key);
+ if (temp.isSend()) {
+ long timeToSend = temp.getTimeToSend();
+ long timeNow = System.currentTimeMillis();
+ if ((timeNow >= timeToSend)) {
+ if (temp.getMessageType()==Sandesha2Constants.MessageTypes.APPLICATION) {
+ long msgNo = temp.getMessageNumber();
+ if (lowestAppMsgNo==0) {
+ lowestAppMsgNo=msgNo;
+ }else {
+ if (msgNo<lowestAppMsgNo)
+ lowestAppMsgNo = msgNo;
+ }
+ }
+ }
+ }
+ }
+
+ iterator = table.keySet().iterator();
+ while (iterator.hasNext()) {
+ Object key = iterator.next();
+ SenderBean temp = (SenderBean) table.get(key);
+
+ if (temp.isSend()) {
+
+ long timeToSend = temp.getTimeToSend();
+ long timeNow = System.currentTimeMillis();
+ if ((timeNow >= timeToSend)) {
+ boolean valid = false;
+ if (temp.getMessageType()==Sandesha2Constants.MessageTypes.APPLICATION) {
+ if (temp.getMessageNumber()==lowestAppMsgNo)
+ valid = true;
+ }else {
+ valid = true;
+ }
+
+ if (valid) {
+ updateNextSendingTime (temp);
+ return temp;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private void updateNextSendingTime (SenderBean bean) {
+
+ }
+
+ private synchronized ArrayList findBeansWithMsgNo(ArrayList list, long msgNo) {
+ ArrayList beans = new ArrayList();
+
+ Iterator it = list.iterator();
+ while (it.hasNext()) {
+ SenderBean bean = (SenderBean) it.next();
+ if (bean.getMessageNumber() == msgNo)
+ beans.add(bean);
+ }
+
+ return beans;
+ }
+
+ public synchronized boolean update(SenderBean bean) {
+ if (table.get(bean.getMessageID())==null)
+ return false;
+
+ return true; //No need to update. Being a reference does the job.
+ }
+
+ public synchronized SenderBean findUnique(SenderBean bean) throws SandeshaException {
+ Collection coll = find(bean);
+ if (coll.size()>1) {
+ String message = "Non-Unique result";
+ log.error(message);
+ throw new SandeshaException (message);
+ }
+
+ Iterator iter = coll.iterator();
+ if (iter.hasNext())
+ return (SenderBean) iter.next();
+ else
+ return null;
+ }
+
+ public synchronized SenderBean retrieveFromMessageRefKey(String messageContextRefKey) {
+
+ Iterator iter = table.keySet().iterator();
+ while (iter.hasNext()) {
+ Object key = iter.next();
+ SenderBean bean = (SenderBean) table.get(key);
+ if (bean.getMessageContextRefKey().equals(messageContextRefKey)) {
+ return bean;
+ }
+ }
+
+ return null;
+ }
+
+
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,156 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
+import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+
+/**
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class InMemorySequencePropertyBeanMgr implements SequencePropertyBeanMgr {
+
+ private static final Log log = LogFactory.getLog(InMemorySequencePropertyBeanMgr.class);
+ private Hashtable table = null;
+
+ public InMemorySequencePropertyBeanMgr(AbstractContext context) {
+ Object obj = context.getProperty(Sandesha2Constants.BeanMAPs.SEQUENCE_PROPERTY);
+ if (obj != null) {
+ table = (Hashtable) obj;
+ } else {
+ table = new Hashtable();
+ context.setProperty(Sandesha2Constants.BeanMAPs.SEQUENCE_PROPERTY, table);
+ }
+ }
+
+ public synchronized boolean delete(String sequenceId, String name) {
+
+ SequencePropertyBean bean = retrieve( sequenceId,name);
+
+ return table.remove(sequenceId + ":" + name) != null;
+ }
+
+ public synchronized SequencePropertyBean retrieve(String sequenceId, String name) {
+ return (SequencePropertyBean) table.get(sequenceId + ":" + name);
+ }
+
+ public synchronized boolean insert(SequencePropertyBean bean) {
+ table.put(bean.getSequenceID() + ":" + bean.getName(), bean);
+ return true;
+ }
+
+ public synchronized ResultSet find(String query) {
+ throw new UnsupportedOperationException("selectRS() is not supported");
+ }
+
+ public synchronized Collection find(SequencePropertyBean bean) {
+ ArrayList beans = new ArrayList();
+
+ if (bean == null)
+ return beans;
+
+ Iterator iterator = table.values().iterator();
+ SequencePropertyBean temp;
+
+ while (iterator.hasNext()) {
+ temp = (SequencePropertyBean) iterator.next();
+
+ boolean equal = true;
+
+ if (bean.getSequenceID() != null
+ && !bean.getSequenceID().equals(temp.getSequenceID()))
+ equal = false;
+
+ if (bean.getName() != null
+ && !bean.getName().equals(temp.getName()))
+ equal = false;
+
+ if (bean.getValue() != null
+ && !bean.getValue().equals(temp.getValue()))
+ equal = false;
+
+ if (equal)
+ beans.add(temp);
+
+ }
+ return beans;
+ }
+
+ public synchronized boolean update(SequencePropertyBean bean) {
+
+ if (table.get(getId(bean))==null)
+ return false;
+
+ return table.put(getId(bean), bean) != null;
+
+ }
+
+ public synchronized boolean updateOrInsert(SequencePropertyBean bean) {
+
+ if (table.get(getId(bean))==null)
+ table.put(getId(bean), bean);
+
+ return table.put(getId(bean), bean) != null;
+
+ }
+
+ private String getId(SequencePropertyBean bean) {
+ return bean.getSequenceID() + ":" + bean.getName();
+ }
+
+ public synchronized SequencePropertyBean findUnique(SequencePropertyBean bean) throws SandeshaException {
+ Collection coll = find(bean);
+ if (coll.size()>1) {
+ String message = "Non-Unique result";
+ log.error(message);
+ throw new SandeshaException (message);
+ }
+
+ Iterator iter = coll.iterator();
+ if (iter.hasNext())
+ return (SequencePropertyBean) iter.next();
+ else
+ return null;
+ }
+
+ public synchronized Collection retrieveAll() {
+ Collection coll = new ArrayList();
+
+ Iterator keys = table.keySet().iterator();
+ while (keys.hasNext()) {
+ Object key = keys.next();
+ coll.add(table.get(key));
+ }
+
+ return coll;
+ }
+
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,160 @@
+/*
+ * 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.util.HashMap;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.Transaction;
+import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+/**
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class InMemoryStorageManager extends StorageManager {
+
+ private static InMemoryStorageManager instance = null;
+ private final String MESSAGE_MAP_KEY = "Sandesha2MessageMap";
+ private CreateSeqBeanMgr createSeqBeanMgr = null;
+ private NextMsgBeanMgr nextMsgBeanMgr = null;
+ private SequencePropertyBeanMgr sequencePropertyBeanMgr = null;
+ private SenderBeanMgr senderBeanMgr = null;
+ private InvokerBeanMgr invokerBeanMgr = null;
+
+ public InMemoryStorageManager(ConfigurationContext context) {
+ super(context);
+
+ this.createSeqBeanMgr = new InMemoryCreateSeqBeanMgr (context);
+ this.nextMsgBeanMgr = new InMemoryNextMsgBeanMgr (context);
+ this.senderBeanMgr = new InMemorySenderBeanMgr (context);
+ this.invokerBeanMgr = new InMemoryInvokerBeanMgr (context);
+ this.sequencePropertyBeanMgr = new InMemorySequencePropertyBeanMgr (context);
+ }
+
+ public Transaction getTransaction() {
+ return new InMemoryTransaction();
+ }
+
+ public CreateSeqBeanMgr getCreateSeqBeanMgr() {
+ return createSeqBeanMgr;
+ }
+
+ public NextMsgBeanMgr getNextMsgBeanMgr() {
+ return nextMsgBeanMgr;
+ }
+
+ public SenderBeanMgr getRetransmitterBeanMgr() {
+ return senderBeanMgr;
+ }
+
+ public SequencePropertyBeanMgr getSequencePropretyBeanMgr() {
+ return sequencePropertyBeanMgr;
+ }
+
+ public InvokerBeanMgr getStorageMapBeanMgr() {
+ return invokerBeanMgr;
+ }
+
+ public void init(ConfigurationContext context) {
+ setContext(context);
+ }
+
+ public static InMemoryStorageManager getInstance(
+ ConfigurationContext context) {
+ if (instance == null)
+ instance = new InMemoryStorageManager(context);
+
+ return instance;
+ }
+
+ public MessageContext retrieveMessageContext(String key,ConfigurationContext context) {
+ HashMap storageMap = (HashMap) getContext().getProperty(MESSAGE_MAP_KEY);
+ if (storageMap==null)
+ return null;
+
+ return (MessageContext) storageMap.get(key);
+ }
+
+ public void storeMessageContext(String key,MessageContext msgContext) {
+ HashMap storageMap = (HashMap) getContext().getProperty(MESSAGE_MAP_KEY);
+
+ if (storageMap==null) {
+ storageMap = new HashMap ();
+ getContext().setProperty(MESSAGE_MAP_KEY,storageMap);
+ }
+
+ if (key==null)
+ key = SandeshaUtil.getUUID();
+
+ storageMap.put(key,msgContext);
+
+ }
+
+ public void updateMessageContext(String key,MessageContext msgContext) throws SandeshaStorageException {
+ HashMap storageMap = (HashMap) getContext().getProperty(MESSAGE_MAP_KEY);
+
+ if (storageMap==null) {
+ throw new SandeshaStorageException ("Storage Map not present");
+ }
+
+ Object oldEntry = storageMap.get(key);
+ if (oldEntry==null)
+ throw new SandeshaStorageException ("Entry is not present for updating");
+
+ storeMessageContext(key,msgContext);
+ }
+
+ public void removeMessageContext(String key) throws SandeshaStorageException {
+ HashMap storageMap = (HashMap) getContext().getProperty(MESSAGE_MAP_KEY);
+
+ if (storageMap==null) {
+ return;
+ }
+
+ Object entry = storageMap.get(key);
+ if (entry!=null)
+ storageMap.remove(key);
+ }
+
+ public void initStorage (AxisModule moduleDesc) {
+
+ }
+
+ public SOAPEnvelope retrieveSOAPEnvelope(String key) throws SandeshaStorageException {
+ // TODO no real value
+ return null;
+ }
+
+ public void storeSOAPEnvelope(SOAPEnvelope envelope, String key) throws SandeshaStorageException {
+ // TODO no real value
+ }
+
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+/**
+ * This class does nothing special. Just to be consistent with the transaction
+ * based behavious of other 'Persistant' StorageManager implementations.
+ *
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ * @author Sanka Samaranayaka <ss...@gmail.com>
+ */
+
+public class InMemoryTransaction implements Transaction {
+
+ public void commit() {
+
+ }
+
+ public void rollback() {
+
+ }
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportOutDesc.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportOutDesc.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportOutDesc.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportOutDesc.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,16 @@
+package org.apache.sandesha2.transport;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.description.TransportOutDescription;
+
+public class Sandesha2TransportOutDesc extends TransportOutDescription {
+
+ public Sandesha2TransportOutDesc() {
+ super (new QName ("Sandesha2TransportOutDesc"));
+ this.setSender(new Sandesha2TransportSender ());
+ }
+
+
+
+}
Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java?rev=414476&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java (added)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java Wed Jun 14 22:51:15 2006
@@ -0,0 +1,70 @@
+package org.apache.sandesha2.transport;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class Sandesha2TransportSender implements TransportSender {
+
+ public void cleanup(MessageContext msgContext) throws AxisFault {
+
+ }
+
+ public void stop() {
+
+ }
+
+ public void invoke(MessageContext msgContext) throws AxisFault {
+
+ //setting the correct transport sender.
+ TransportOutDescription transportOut = (TransportOutDescription) msgContext.getProperty(Sandesha2Constants.ORIGINAL_TRANSPORT_OUT_DESC);
+
+ if (transportOut==null)
+ throw new SandeshaException ("Original transport sender is not present");
+
+ msgContext.setTransportOut(transportOut);
+
+ String key = (String) msgContext.getProperty(Sandesha2Constants.MESSAGE_STORE_KEY);
+
+ if (key==null)
+ throw new SandeshaException ("Cant store message without the storage key");
+
+ ConfigurationContext configurationContext = msgContext.getConfigurationContext();
+ AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
+
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,axisConfiguration);
+
+ msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING,Sandesha2Constants.VALUE_TRUE);
+
+ storageManager.updateMessageContext(key,msgContext);
+
+
+ }
+
+ //Below methods are not used
+ public void cleanUp(MessageContext msgContext) throws AxisFault {}
+
+ public void init(ConfigurationContext confContext, TransportOutDescription transportOut) throws AxisFault {}
+
+ public void cleanup() throws AxisFault {}
+
+ public HandlerDescription getHandlerDesc() {return null;}
+
+ public QName getName() { return null;}
+
+ public Parameter getParameter(String name) { return null; }
+
+ public void init(HandlerDescription handlerdesc) {}
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org