Diff
Modified: trunk/components/base/src/main/java/org/servicemix/components/groovy/GroovyMarshaler.java (685 => 686)
--- trunk/components/base/src/main/java/org/servicemix/components/groovy/GroovyMarshaler.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/components/base/src/main/java/org/servicemix/components/groovy/GroovyMarshaler.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -17,8 +17,8 @@
**/
package org.servicemix.components.groovy;
-import org.servicemix.client.Marshaler;
-import org.servicemix.client.DefaultMarshaler;
+import org.servicemix.jbi.messaging.DefaultMarshaler;
+import org.servicemix.jbi.messaging.Marshaler;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.NormalizedMessage;
Modified: trunk/components/base/src/main/java/org/servicemix/components/mule/MuleMarshaler.java (685 => 686)
--- trunk/components/base/src/main/java/org/servicemix/components/mule/MuleMarshaler.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/components/base/src/main/java/org/servicemix/components/mule/MuleMarshaler.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -20,8 +20,8 @@
import org.mule.impl.MuleMessage;
import org.mule.umo.UMOEvent;
import org.mule.umo.UMOMessage;
-import org.servicemix.client.Marshaler;
import org.servicemix.components.util.MarshalerSupport;
+import org.servicemix.jbi.messaging.Marshaler;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.NormalizedMessage;
Deleted: trunk/core/src/main/java/org/servicemix/client/DefaultMarshaler.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/client/DefaultMarshaler.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/client/DefaultMarshaler.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -1,97 +0,0 @@
-/**
- *
- * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
- *
- * 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.servicemix.client;
-
-import org.servicemix.jbi.jaxp.StringSource;
-import org.w3c.dom.Node;
-
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-
-/**
- * Default implementation of [EMAIL PROTECTED] Marshaler} which will pass through String
- * objects as XML content, DOM objects or Stream objects, otherwise the payload
- * is stored in a message property.
- *
- * @version $Revision$
- */
-public class DefaultMarshaler implements Marshaler {
-
- private Marshaler parent;
-
- public DefaultMarshaler() {
- }
-
- public DefaultMarshaler(Marshaler parent) {
- this.parent = parent;
- }
-
- public Marshaler getParent() {
- return parent;
- }
-
- public void marshal(MessageExchange exchange, NormalizedMessage message, Object body) throws MessagingException {
- if (body instanceof Source) {
- message.setContent((Source) body);
- }
- else {
- message.setProperty(BODY, body);
- Source content = asContent(message, body);
- message.setContent(content);
- }
- }
-
- public Object unmarshal(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
- Object answer = message.getProperty(BODY);
- if (answer == null) {
- if (parent != null) {
- answer = parent.unmarshal(exchange, message);
- }
- if (answer == null) {
- answer = defaultUnmarshal(exchange, message);
- }
- }
- return answer;
- }
-
- protected Object defaultUnmarshal(MessageExchange exchange, NormalizedMessage message) {
- Source content = message.getContent();
- if (content instanceof DOMSource) {
- DOMSource source = (DOMSource) content;
- return source.getNode();
- }
- return content;
- }
-
- protected Source asContent(NormalizedMessage message, Object body) {
- if (body instanceof Source) {
- return (Source) body;
- }
- else if (body instanceof String) {
- // lets assume String is the XML to send
- return new StringSource((String) body);
- }
- else if (body instanceof Node) {
- return new DOMSource((Node) body);
- }
- return null;
- }
-}
Modified: trunk/core/src/main/java/org/servicemix/client/DefaultServiceMixClient.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/client/DefaultServiceMixClient.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/client/DefaultServiceMixClient.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -22,6 +22,8 @@
import org.servicemix.jbi.NoOutMessageAvailableException;
import org.servicemix.jbi.container.ActivationSpec;
import org.servicemix.jbi.container.JBIContainer;
+import org.servicemix.jbi.messaging.DefaultMarshaler;
+import org.servicemix.jbi.messaging.Marshaler;
import org.servicemix.jbi.resolver.EndpointFilter;
import org.servicemix.jbi.resolver.EndpointResolver;
import org.servicemix.jbi.resolver.ExternalInterfaceNameEndpointResolver;
Deleted: trunk/core/src/main/java/org/servicemix/client/Marshaler.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/client/Marshaler.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/client/Marshaler.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -1,58 +0,0 @@
-/**
- *
- * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
- *
- * 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.servicemix.client;
-
-import javax.jbi.messaging.InOptionalOut;
-import javax.jbi.messaging.InOut;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-
-/**
- * A plugin strategy which marshals an Object into and out of a JBI message
- *
- * @version $Revision$
- */
-public interface Marshaler {
-
- /**
- * The key on the message to store the message body which cannot be marshalled into or out of XML easily
- * or to provide a cache of the object representation of the object.
- */
- String BODY = "org.servicemix.body";
-
- /**
- * Marshals the payload into the normalized message, typically as the content
- * property.
- *
- * @param exchange the message exchange in which to marshal
- * @param message the message in which to marshal
- * @param body the body of the message as a POJO
- */
- void marshal(MessageExchange exchange, NormalizedMessage message, Object body) throws MessagingException;
-
- /**
- * Unmarshals the response out of the normalized message.
- *
- * @param exchange the message exchange, which is an [EMAIL PROTECTED] InOut} or [EMAIL PROTECTED] InOptionalOut}
- * @param message the output message
- * @return the unmarshaled body object, extracted from the message
- * @throws MessagingException
- */
- Object unmarshal(MessageExchange exchange, NormalizedMessage message) throws MessagingException;
-}
Modified: trunk/core/src/main/java/org/servicemix/client/ServiceMixClientFacade.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/client/ServiceMixClientFacade.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/client/ServiceMixClientFacade.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -22,6 +22,8 @@
import org.servicemix.jbi.NoOutMessageAvailableException;
import org.servicemix.jbi.container.ActivationSpec;
import org.servicemix.jbi.container.JBIContainer;
+import org.servicemix.jbi.messaging.DefaultMarshaler;
+import org.servicemix.jbi.messaging.Marshaler;
import org.servicemix.jbi.resolver.EndpointFilter;
import org.servicemix.jbi.resolver.EndpointResolver;
import org.servicemix.jbi.resolver.ExternalInterfaceNameEndpointResolver;
Modified: trunk/core/src/main/java/org/servicemix/components/util/PojoSupport.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/components/util/PojoSupport.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/components/util/PojoSupport.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -20,10 +20,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.servicemix.JavaSource;
-import org.servicemix.client.Marshaler;
import org.servicemix.jbi.FaultException;
import org.servicemix.jbi.NotInitialisedYetException;
import org.servicemix.jbi.management.BaseLifeCycle;
+import org.servicemix.jbi.messaging.Marshaler;
import org.servicemix.jbi.messaging.MessageExchangeImpl;
import org.servicemix.jbi.messaging.NormalizedMessageImpl;
Modified: trunk/core/src/main/java/org/servicemix/components/util/xstream/XStreamMarshaler.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/components/util/xstream/XStreamMarshaler.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/components/util/xstream/XStreamMarshaler.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -22,10 +22,10 @@
import com.thoughtworks.xstream.io.xml.DomWriter;
import org.logicblaze.lingo.LingoInvocation;
-import org.servicemix.client.DefaultMarshaler;
-import org.servicemix.client.Marshaler;
import org.servicemix.jbi.jaxp.SourceTransformer;
import org.servicemix.jbi.jaxp.StringSource;
+import org.servicemix.jbi.messaging.DefaultMarshaler;
+import org.servicemix.jbi.messaging.Marshaler;
import org.w3c.dom.Document;
import javax.jbi.messaging.MessageExchange;
Modified: trunk/core/src/main/java/org/servicemix/jbi/container/ActivationSpec.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/jbi/container/ActivationSpec.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/jbi/container/ActivationSpec.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -17,7 +17,7 @@
**/
package org.servicemix.jbi.container;
-import org.servicemix.client.Marshaler;
+import org.servicemix.jbi.messaging.Marshaler;
import org.servicemix.jbi.resolver.EndpointChooser;
import org.servicemix.jbi.resolver.EndpointResolver;
import org.servicemix.jbi.resolver.InterfaceNameEndpointResolver;
Deleted: trunk/core/src/main/java/org/servicemix/jbi/messaging/AckHelper.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/jbi/messaging/AckHelper.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/jbi/messaging/AckHelper.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -1,83 +0,0 @@
-/*
- * Copyright 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.
- */
-/**
- * Copyright 2005 RAJD Consultancy Ltd. All rights reserved.
- */
-
-package org.servicemix.jbi.messaging;
-
-/**
- * AckHelper - helper class used by Delivery channel for monitoring process status *
- *
- * @version $Revision$
- */
-class AckHelper {
- protected MessageExchangeImpl messageExchange;
- protected Object lock = new Object();
- protected boolean notified;
-
- /**
- * Construct a receipt holder
- * @param me
- */
- public AckHelper(MessageExchangeImpl me) {
- this.messageExchange = me;
- }
-
- /**
- * @return the MessageExchangeImpl
- */
- public MessageExchangeImpl getMessageExchange(){
- return messageExchange;
- }
-
- /**
- * Set the Receipt for this holder
- */
- public void done() {
- synchronized (lock) {
- notified = true;
- lock.notify();
- }
- }
-
- /**
- * @return true if acked
- */
- public boolean isAcked() {
- return isAcked(0);
- }
-
- /**
- * wait upto <Code>timeout</Code> timeout ms to get a receipt
- *
- * @param timeout
- * @return true if acked
- */
- public boolean isAcked(long timeout) {
- synchronized (lock) {
- if (!notified) {
- try {
- lock.wait(timeout);
- }
- catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- return notified;
- }
-}
Copied: trunk/core/src/main/java/org/servicemix/jbi/messaging/DefaultMarshaler.java (from rev 684, trunk/core/src/main/java/org/servicemix/client/DefaultMarshaler.java) (684 => 686)
--- trunk/core/src/main/java/org/servicemix/client/DefaultMarshaler.java 2005-10-27 08:06:36 UTC (rev 684)
+++ trunk/core/src/main/java/org/servicemix/jbi/messaging/DefaultMarshaler.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -0,0 +1,97 @@
+/**
+ *
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ *
+ * 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.servicemix.jbi.messaging;
+
+import org.servicemix.jbi.jaxp.StringSource;
+import org.w3c.dom.Node;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+
+/**
+ * Default implementation of [EMAIL PROTECTED] Marshaler} which will pass through String
+ * objects as XML content, DOM objects or Stream objects, otherwise the payload
+ * is stored in a message property.
+ *
+ * @version $Revision$
+ */
+public class DefaultMarshaler implements Marshaler {
+
+ private Marshaler parent;
+
+ public DefaultMarshaler() {
+ }
+
+ public DefaultMarshaler(Marshaler parent) {
+ this.parent = parent;
+ }
+
+ public Marshaler getParent() {
+ return parent;
+ }
+
+ public void marshal(MessageExchange exchange, NormalizedMessage message, Object body) throws MessagingException {
+ if (body instanceof Source) {
+ message.setContent((Source) body);
+ }
+ else {
+ message.setProperty(BODY, body);
+ Source content = asContent(message, body);
+ message.setContent(content);
+ }
+ }
+
+ public Object unmarshal(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
+ Object answer = message.getProperty(BODY);
+ if (answer == null) {
+ if (parent != null) {
+ answer = parent.unmarshal(exchange, message);
+ }
+ if (answer == null) {
+ answer = defaultUnmarshal(exchange, message);
+ }
+ }
+ return answer;
+ }
+
+ protected Object defaultUnmarshal(MessageExchange exchange, NormalizedMessage message) {
+ Source content = message.getContent();
+ if (content instanceof DOMSource) {
+ DOMSource source = (DOMSource) content;
+ return source.getNode();
+ }
+ return content;
+ }
+
+ protected Source asContent(NormalizedMessage message, Object body) {
+ if (body instanceof Source) {
+ return (Source) body;
+ }
+ else if (body instanceof String) {
+ // lets assume String is the XML to send
+ return new StringSource((String) body);
+ }
+ else if (body instanceof Node) {
+ return new DOMSource((Node) body);
+ }
+ return null;
+ }
+}
Deleted: trunk/core/src/main/java/org/servicemix/jbi/messaging/ExchangePacketListener.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/jbi/messaging/ExchangePacketListener.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/jbi/messaging/ExchangePacketListener.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -1,36 +0,0 @@
-/**
-* <a href="" The open source ESB</a>
-*
-* Copyright 2005 RAJD Consultancy Ltd
-*
-* 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.servicemix.jbi.messaging;
-
-
-/**
- * DeliveryChannel implementation
- *
- * @version $Revision$
- */
-public interface ExchangePacketListener {
-
- /**
- * Called when an ExchangePacket is ready for processing
- * @param packet
- */
- public void onExchangePacket(ExchangePacket packet);
-}
\ No newline at end of file
Added: trunk/core/src/main/java/org/servicemix/jbi/messaging/Marshaler.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/jbi/messaging/Marshaler.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/jbi/messaging/Marshaler.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -0,0 +1,58 @@
+/**
+ *
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ *
+ * 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.servicemix.jbi.messaging;
+
+import javax.jbi.messaging.InOptionalOut;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+
+/**
+ * A plugin strategy which marshals an Object into and out of a JBI message
+ *
+ * @version $Revision$
+ */
+public interface Marshaler {
+
+ /**
+ * The key on the message to store the message body which cannot be marshalled into or out of XML easily
+ * or to provide a cache of the object representation of the object.
+ */
+ String BODY = "org.servicemix.body";
+
+ /**
+ * Marshals the payload into the normalized message, typically as the content
+ * property.
+ *
+ * @param exchange the message exchange in which to marshal
+ * @param message the message in which to marshal
+ * @param body the body of the message as a POJO
+ */
+ void marshal(MessageExchange exchange, NormalizedMessage message, Object body) throws MessagingException;
+
+ /**
+ * Unmarshals the response out of the normalized message.
+ *
+ * @param exchange the message exchange, which is an [EMAIL PROTECTED] InOut} or [EMAIL PROTECTED] InOptionalOut}
+ * @param message the output message
+ * @return the unmarshaled body object, extracted from the message
+ * @throws MessagingException
+ */
+ Object unmarshal(MessageExchange exchange, NormalizedMessage message) throws MessagingException;
+}
Modified: trunk/core/src/main/java/org/servicemix/jbi/messaging/MessageExchangeFactoryImpl.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/jbi/messaging/MessageExchangeFactoryImpl.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/jbi/messaging/MessageExchangeFactoryImpl.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -20,7 +20,6 @@
package org.servicemix.jbi.messaging;
import org.activemq.util.IdGenerator;
-import org.servicemix.client.Marshaler;
import org.servicemix.jbi.framework.ComponentContextImpl;
import javax.jbi.messaging.InOnly;
Modified: trunk/core/src/main/java/org/servicemix/jbi/messaging/MessageExchangeImpl.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/jbi/messaging/MessageExchangeImpl.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/jbi/messaging/MessageExchangeImpl.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -20,8 +20,6 @@
package org.servicemix.jbi.messaging;
import org.servicemix.JbiConstants;
-import org.servicemix.client.DefaultMarshaler;
-import org.servicemix.client.Marshaler;
import org.servicemix.jbi.container.ActivationSpec;
import org.servicemix.jbi.framework.ComponentContextImpl;
import org.servicemix.jbi.framework.ComponentNameSpace;
Modified: trunk/core/src/main/java/org/servicemix/jbi/messaging/NormalizedMessageImpl.java (685 => 686)
--- trunk/core/src/main/java/org/servicemix/jbi/messaging/NormalizedMessageImpl.java 2005-10-27 08:08:52 UTC (rev 685)
+++ trunk/core/src/main/java/org/servicemix/jbi/messaging/NormalizedMessageImpl.java 2005-10-27 08:37:45 UTC (rev 686)
@@ -21,7 +21,6 @@
import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
-import org.servicemix.client.Marshaler;
import org.servicemix.jbi.jaxp.SourceTransformer;
import org.servicemix.jbi.jaxp.StringSource;