summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message')
-rw-r--r--sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java182
-rw-r--r--sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java31
-rw-r--r--sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java40
-rw-r--r--sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java249
4 files changed, 502 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java b/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java
new file mode 100644
index 0000000000..e316050511
--- /dev/null
+++ b/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java
@@ -0,0 +1,182 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * 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.tuscany.core.message;
+
+import java.util.Map;
+
+import org.apache.tuscany.core.addressing.EndpointReference;
+import org.apache.tuscany.core.invocation.MessageChannel;
+import org.apache.tuscany.core.invocation.TargetInvoker;
+
+/**
+ * Represents a request, response, or exception for an invocation
+ */
+public interface Message {
+
+ /**
+ * Return any message headers associated with the invocation.
+ */
+ Map<String, Object> getHeaders();
+
+ /**
+ * Returns the body of the message, which will be the payload or parameters
+ * associated with the invocation
+ * FIXME what is different w/ getPayload()?
+ */
+ Object getBody();
+
+ /**
+ * Sets the body of the message.
+ */
+ void setBody(Object body);
+
+ /**
+ * Returns true if the message is a request message
+ * FIXME is this still used?
+ */
+ boolean isRequest();
+
+ /**
+ * Returns true if the message is an inbound message
+ * FIXME is this still used?
+ */
+ boolean isResponse();
+
+ /**
+ * Sets the To header
+ * FIXME Javadoc
+ */
+ void setTo(EndpointReference to);
+
+ /**
+ * Returns the To header
+ * FIXME Javadoc
+ */
+ EndpointReference getTo();
+
+ /**
+ * Sets the From header
+ * FIXME Javadoc
+ */
+ void setFrom(EndpointReference from);
+
+ /**
+ * Returns the From header
+ * FIXME Javadoc
+ */
+ EndpointReference getFrom();
+
+ /**
+ * Sets the message ID
+ */
+ void setMessageID(String messageID);
+
+ /**
+ * Returns the message ID
+ */
+ String getMessageID();
+
+ /**
+ * Sets the Action header
+ * FIXME Javadoc
+ */
+ void setAction(String action);
+
+ /**
+ * Returns the Action header
+ * FIXME Javadoc
+ */
+ String getAction();
+
+ /**
+ * Sets the ReplyTo header
+ * FIXME Javadoc
+ */
+ void setReplyTo(EndpointReference replyTo);
+
+ /**
+ * Returns the ReplyTo header
+ * FIXME Javadoc
+ */
+ EndpointReference getReplyTo();
+
+ /**
+ * Sets the RelatesTo header
+ * FIXME Javadoc
+ */
+ void setRelatesTo(String relatesTo);
+
+ /**
+ * Returns the RelatesTo header
+ * FIXME Javadoc
+ */
+ String getRelatesTo();
+
+ /**
+ * Sets the FaultTo header
+ * FIXME Javadoc
+ */
+ void setFaultTo(EndpointReference faultTo);
+
+ /**
+ * Returns the FaultTo header
+ * FIXME Javadoc
+ */
+ EndpointReference getFaultTo();
+
+ /**
+ * Sets the EndpointReference header
+ * FIXME Javadoc
+ */
+ void setEndpointReference(EndpointReference endpointReference);
+
+ /**
+ * Returns the EndpointReference header
+ * FIXME Javadoc
+ */
+ EndpointReference getEndpointReference();
+
+ /**
+ * Sets the operation name
+ * FIXME Javadoc
+ */
+ void setOperationName(String operationName);
+
+ /**
+ * Returns the operation name
+ * FIXME Javadoc
+ */
+ String getOperationName();
+
+ /**
+ * Returns the callback channel
+ * FIXME Javadoc
+ */
+ MessageChannel getCallbackChannel();
+
+ /**
+ * Returns the related callback message
+ * FIXME Javadoc
+ */
+ Message getRelatedCallbackMessage();
+
+ //ADDED
+ public void setTargetInvoker(TargetInvoker invoker);
+
+ public TargetInvoker getTargetInvoker();
+
+} // Message
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java b/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java
new file mode 100644
index 0000000000..74b0e85848
--- /dev/null
+++ b/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java
@@ -0,0 +1,31 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * 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.tuscany.core.message;
+
+/**
+ * The <b>Factory</b> for messages
+ *
+ * @see org.apache.tuscany.core.message.Message
+ */
+public interface MessageFactory {
+
+ /**
+ * Returns a new message.
+ */
+ Message createMessage();
+
+} // MessageFactory
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java b/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java
new file mode 100644
index 0000000000..43787bbe67
--- /dev/null
+++ b/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * 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.tuscany.core.message.impl;
+
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.message.MessageFactory;
+
+/**
+ * The default message factory
+ *
+ * @version $Rev$ $Date$
+ */
+public class MessageFactoryImpl implements MessageFactory {
+
+ /**
+ * Constructor
+ */
+ public MessageFactoryImpl() {
+ super();
+ }
+
+ public Message createMessage() {
+ return new MessageImpl();
+ }
+
+}
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java b/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java
new file mode 100644
index 0000000000..b67c7e227e
--- /dev/null
+++ b/sca-java-1.x/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java
@@ -0,0 +1,249 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * 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.tuscany.core.message.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.core.addressing.EndpointReference;
+import org.apache.tuscany.core.invocation.MessageChannel;
+import org.apache.tuscany.core.invocation.TargetInvoker;
+import org.apache.tuscany.core.message.Message;
+
+/**
+ */
+public class MessageImpl implements Message, MessageChannel {
+
+ private String action;
+ private Object body;
+ private EndpointReference endpointReference;
+ private EndpointReference faultTo;
+ private EndpointReference from;
+ private Map<String, Object> headers;
+ private String messageID;
+ private String operationName;
+ private Message relatedCallbackMessage;
+ private String relatesTo;
+ private EndpointReference replyTo;
+ private TargetInvoker invoker;
+ private EndpointReference to;
+
+ /**
+ * Constructor
+ */
+ protected MessageImpl() {
+ super();
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getAction()
+ */
+ public String getAction() {
+ return action;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getBody()
+ */
+ public Object getBody() {
+ return body;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getEndpointReference()
+ */
+ public EndpointReference getEndpointReference() {
+ return endpointReference;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getFaultTo()
+ */
+ public EndpointReference getFaultTo() {
+ return faultTo;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getFrom()
+ */
+ public EndpointReference getFrom() {
+ return from;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getHeaders()
+ */
+ public Map<String, Object> getHeaders() {
+ if (headers==null)
+ headers=new HashMap<String, Object>();
+ return headers;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getMessageID()
+ */
+ public String getMessageID() {
+ return messageID;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getOperationName()
+ */
+ public String getOperationName() {
+ return operationName;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getRelatesTo()
+ */
+ public String getRelatesTo() {
+ return relatesTo;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getReplyTo()
+ */
+ public EndpointReference getReplyTo() {
+ return replyTo;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getTo()
+ */
+ public EndpointReference getTo() {
+ return to;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#isRequest()
+ */
+ public boolean isRequest() {
+ return relatesTo==null;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#isResponse()
+ */
+ public boolean isResponse() {
+ return relatesTo!=null;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setAction(java.lang.String)
+ */
+ public void setAction(String action) {
+ this.action=action;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setBody(java.lang.Object)
+ */
+ public void setBody(Object body) {
+ this.body=body;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setEndpointReference(org.apache.tuscany.core.client.runtime.addressing.sdo.EndpointReference)
+ */
+ public void setEndpointReference(EndpointReference endpointReference) {
+ this.endpointReference=endpointReference;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setFaultTo(org.apache.tuscany.core.client.runtime.addressing.sdo.EndpointReference)
+ */
+ public void setFaultTo(EndpointReference faultTo) {
+ this.faultTo=faultTo;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setFrom(org.apache.tuscany.core.client.runtime.addressing.sdo.EndpointReference)
+ */
+ public void setFrom(EndpointReference from) {
+ this.from=from;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setMessageID(java.lang.String)
+ */
+ public void setMessageID(String messageID) {
+ this.messageID=messageID;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setOperationName(java.lang.String)
+ */
+ public void setOperationName(String operationName) {
+ this.operationName=operationName;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setRelatesTo(java.lang.String)
+ */
+ public void setRelatesTo(String relatesTo) {
+ this.relatesTo=relatesTo;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setReplyTo(org.apache.tuscany.core.client.runtime.addressing.sdo.EndpointReference)
+ */
+ public void setReplyTo(EndpointReference replyTo) {
+ this.replyTo=replyTo;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setTo(org.apache.tuscany.core.client.runtime.addressing.sdo.EndpointReference)
+ */
+ public void setTo(EndpointReference to) {
+ this.to=to;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getCallbackChannel()
+ */
+ public MessageChannel getCallbackChannel() {
+ return this;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.invocation.MessageChannel#send(org.apache.tuscany.core.message.Message)
+ */
+ public void send(Message message) {
+ relatedCallbackMessage = message;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getRelatedCallbackMessage()
+ */
+ public Message getRelatedCallbackMessage() {
+ return relatedCallbackMessage;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#setTargetInvoker(org.apache.tuscany.core.invocation.TargetInvoker)
+ */
+ public void setTargetInvoker(TargetInvoker invoker){
+ this.invoker = invoker;
+ }
+
+ /**
+ * @see org.apache.tuscany.core.message.Message#getTargetInvoker()
+ */
+ public TargetInvoker getTargetInvoker(){
+ return invoker;
+ }
+}