diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceMessenger.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceMessenger.java index d5c87e8a51f9a3f9e601e1552e5df45e719e4379..ae080c4dee1e15574017df1e308f32d6d5d68395 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceMessenger.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceMessenger.java @@ -27,12 +27,12 @@ import java.io.Serializable; public interface IServiceMessenger { /** - * Send a message to the client. + * Send a message to the counter part. */ public void send(Serializable message); /** - * Receive a message from the client. + * Receive a message from the counter part. */ public <T extends Serializable> T receive(Class<T> messageClass); } diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationDTO.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationDTO.java index 2625dee55a369c0fe2a90475bdfa5747ff24beb9..8da289af36246747e1b4b8d687f15eafd40cba1a 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationDTO.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationDTO.java @@ -31,7 +31,7 @@ public class ServiceConversationDTO implements Serializable private int clientTimeoutInMillis; - ServiceConversationDTO(String serviceConversationId, int clientTimeout) + public ServiceConversationDTO(String serviceConversationId, int clientTimeout) { this.serviceConversationId = serviceConversationId; this.clientTimeoutInMillis = clientTimeout; diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ClientMessenger.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ClientMessenger.java similarity index 92% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/ClientMessenger.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ClientMessenger.java index 85e592882f41af59b2dcf4e0f59d9fe3a533aec9..5d4366a2f1f7b28c65017eeed11eec9fed1215aa 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ClientMessenger.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ClientMessenger.java @@ -14,12 +14,16 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.client; import java.io.Serializable; import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; import ch.systemsx.cisd.base.exceptions.TimeoutExceptionUnchecked; +import ch.systemsx.cisd.common.serviceconversation.IServiceMessageTransport; +import ch.systemsx.cisd.common.serviceconversation.ServiceConversationDTO; +import ch.systemsx.cisd.common.serviceconversation.ServiceMessage; +import ch.systemsx.cisd.common.serviceconversation.UnexpectedMessagePayloadException; /** * A class that a client can use to receive messages from a service. diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ClientResponseMessageMultiplexer.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ClientResponseMessageMultiplexer.java similarity index 90% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/ClientResponseMessageMultiplexer.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ClientResponseMessageMultiplexer.java index 0c0c387ca8d78a0df1f09261e71045b68a082d08..710497410447e6bb2610516355ca1500b194b265 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ClientResponseMessageMultiplexer.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ClientResponseMessageMultiplexer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.client; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -23,6 +23,9 @@ import org.apache.log4j.Logger; import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogFactory; +import ch.systemsx.cisd.common.serviceconversation.IServiceMessageTransport; +import ch.systemsx.cisd.common.serviceconversation.ServiceMessage; +import ch.systemsx.cisd.common.serviceconversation.UnknownServiceConversationException; /** * A client-side multiplexer for incoming messages from the server. diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ClientResponseMessageQueue.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ClientResponseMessageQueue.java similarity index 88% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/ClientResponseMessageQueue.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ClientResponseMessageQueue.java index f6098f3f8c58cc96f28010556611103cf1468de8..170a0573ad5dd271d657d47d37a5c52ecaa7c35e 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ClientResponseMessageQueue.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ClientResponseMessageQueue.java @@ -14,12 +14,15 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.client; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import ch.systemsx.cisd.common.serviceconversation.IServiceMessageTransport; +import ch.systemsx.cisd.common.serviceconversation.ServiceMessage; + /** * A class that holds a queue for response messages to a client. * diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IRemoteServiceConversationServer.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/IRemoteServiceConversationServer.java similarity index 88% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/IRemoteServiceConversationServer.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/client/IRemoteServiceConversationServer.java index b4d6cab3a504d2f698e7b4f1d0ebdb8021fbfc8d..135049bd8c4e76aa051c8b7e4737ab3205237cb1 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IRemoteServiceConversationServer.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/IRemoteServiceConversationServer.java @@ -14,7 +14,9 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.client; + +import ch.systemsx.cisd.common.serviceconversation.ServiceConversationDTO; /** * A remote role for starting a service conversation. diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceConversation.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/IServiceConversation.java similarity index 86% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceConversation.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/client/IServiceConversation.java index 515c28acfb3d386aa22926f98c680ac5b730c311..8000c00bcc93c95c4d0706cad645a484d000e3ef 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceConversation.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/IServiceConversation.java @@ -14,17 +14,19 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.client; import java.io.Closeable; import java.io.Serializable; +import ch.systemsx.cisd.common.serviceconversation.IServiceMessenger; + /** * The service conversation. * * @author Bernd Rinn */ -public interface IServiceConversation extends Closeable +public interface IServiceConversation extends IServiceMessenger, Closeable { /** * Returns the service conversation id. diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationClient.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ServiceConversationClient.java similarity index 91% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationClient.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ServiceConversationClient.java index 04806349334ecd34318a2ffe14938ad8fc50f391..c55e4b827c1f103f2a4a0d3dfa9292acc8fc0ba0 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationClient.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ServiceConversationClient.java @@ -14,7 +14,10 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.client; + +import ch.systemsx.cisd.common.serviceconversation.IServiceMessageTransport; +import ch.systemsx.cisd.common.serviceconversation.ServiceConversationDTO; /** * The client for the service conversations. diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceExecutionException.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ServiceExecutionException.java similarity index 97% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceExecutionException.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ServiceExecutionException.java index 1e30cb466fcb75a2fc37ef411cf260138c8d4f5e..5a1ae4f8a7e6f53481316654474ebb4f7eda1342 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceExecutionException.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/client/ServiceExecutionException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.client; import java.io.PrintStream; import java.io.PrintWriter; diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/BidirectionalServiceMessenger.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/BidirectionalServiceMessenger.java similarity index 92% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/BidirectionalServiceMessenger.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/server/BidirectionalServiceMessenger.java index aefd3d89d54b71fc14d61314e322c28d4741cf3c..b9b2d29d3be275252f5c0019ab3a81c0c8419f65 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/BidirectionalServiceMessenger.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/BidirectionalServiceMessenger.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.server; import java.io.Serializable; import java.util.concurrent.BlockingQueue; @@ -25,6 +25,10 @@ import java.util.concurrent.atomic.AtomicBoolean; import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; import ch.systemsx.cisd.base.exceptions.InterruptedExceptionUnchecked; import ch.systemsx.cisd.base.exceptions.TimeoutExceptionUnchecked; +import ch.systemsx.cisd.common.serviceconversation.IServiceMessageTransport; +import ch.systemsx.cisd.common.serviceconversation.IServiceMessenger; +import ch.systemsx.cisd.common.serviceconversation.ServiceMessage; +import ch.systemsx.cisd.common.serviceconversation.UnexpectedMessagePayloadException; /** * A bidirectional messenger on the server side. diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IService.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/IService.java similarity index 87% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/IService.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/server/IService.java index 04013cd0720fc2aaa4875ff401216e64c7afe21b..95daeca3854d8610ba2e0ec1f5907ecdd3fc94f7 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IService.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/IService.java @@ -14,7 +14,9 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.server; + +import ch.systemsx.cisd.common.serviceconversation.IServiceMessenger; /** * The interface for a service that can participate in a service conversation. diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceFactory.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/IServiceFactory.java similarity index 94% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceFactory.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/server/IServiceFactory.java index 5aaef6c070f50d1b566546ef303efb2bf1b4ace4..5856028a6b531387ec62f635cd15281a2b6da96f 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/IServiceFactory.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/IServiceFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.server; /** * A factory for services. diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationRecord.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/ServiceConversationRecord.java similarity index 95% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationRecord.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/server/ServiceConversationRecord.java index 005fa10b77369ad529c7891ba5572abdd89d3af8..39b00605654ff4c403ae74cc12e346da9c4fa0cf 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationRecord.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/ServiceConversationRecord.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.server; import ch.systemsx.cisd.common.concurrent.ITerminableFuture; diff --git a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationServer.java b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/ServiceConversationServer.java similarity index 93% rename from common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationServer.java rename to common/source/java/ch/systemsx/cisd/common/serviceconversation/server/ServiceConversationServer.java index 0c505cf453d51d8a961662b897fddcabee209c6a..636fab0a38eb7088e0da848caf5ac247ca0d602f 100644 --- a/common/source/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationServer.java +++ b/common/source/java/ch/systemsx/cisd/common/serviceconversation/server/ServiceConversationServer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.systemsx.cisd.common.serviceconversation; +package ch.systemsx.cisd.common.serviceconversation.server; import java.util.Map; import java.util.Random; @@ -33,6 +33,12 @@ import ch.systemsx.cisd.common.concurrent.TerminableCallable.ICallable; import ch.systemsx.cisd.common.concurrent.TerminableCallable.IStoppableExecutor; import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogFactory; +import ch.systemsx.cisd.common.serviceconversation.IServiceMessageTransport; +import ch.systemsx.cisd.common.serviceconversation.ServiceConversationDTO; +import ch.systemsx.cisd.common.serviceconversation.ServiceMessage; +import ch.systemsx.cisd.common.serviceconversation.UnknownClientException; +import ch.systemsx.cisd.common.serviceconversation.UnknownServiceTypeException; +import ch.systemsx.cisd.common.serviceconversation.client.ServiceExecutionException; /** * A collection of service conversations. @@ -169,7 +175,9 @@ public class ServiceConversationServer final IServiceMessageTransport responseMessenger = responseMessageMap.get(clientId); if (responseMessenger == null) { - throw new UnknownClientException(clientId); + final UnknownClientException ex = new UnknownClientException(clientId); + operationLog.error(ex.getMessage()); + throw ex; } final IService serviceInstance = serviceFactory.create(); final String serviceConversationId = diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationTest.java index 695fbbe8b95b20347b966e95e1968cdf9e4dd39d..3974928f92576536d92423b72836bc91dc625886 100644 --- a/common/sourceTest/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationTest.java +++ b/common/sourceTest/java/ch/systemsx/cisd/common/serviceconversation/ServiceConversationTest.java @@ -32,6 +32,13 @@ import ch.systemsx.cisd.base.exceptions.InterruptedExceptionUnchecked; import ch.systemsx.cisd.base.exceptions.TimeoutExceptionUnchecked; import ch.systemsx.cisd.common.concurrent.ConcurrencyUtilities; import ch.systemsx.cisd.common.logging.LogInitializer; +import ch.systemsx.cisd.common.serviceconversation.client.IRemoteServiceConversationServer; +import ch.systemsx.cisd.common.serviceconversation.client.IServiceConversation; +import ch.systemsx.cisd.common.serviceconversation.client.ServiceConversationClient; +import ch.systemsx.cisd.common.serviceconversation.client.ServiceExecutionException; +import ch.systemsx.cisd.common.serviceconversation.server.IService; +import ch.systemsx.cisd.common.serviceconversation.server.IServiceFactory; +import ch.systemsx.cisd.common.serviceconversation.server.ServiceConversationServer; /** * Test cases for the {@Link ServiceConversationCollection} class.