You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ge...@apache.org on 2008/08/29 11:44:07 UTC
svn commit: r690162 - in
/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix:
./ client/ components/util/ jbi/messaging/
Author: gertv
Date: Fri Aug 29 02:44:07 2008
New Revision: 690162
URL: http://svn.apache.org/viewvc?rev=690162&view=rev
Log:
SM-1455: Deprecating code moved to servicemix-utils in servicemix-core
Modified:
servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/JavaSource.java
servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/MessageExchangeListener.java
servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultNamespaceContext.java
servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/Message.java
servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/MessageHelper.java
servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DefaultMarshaler.java
servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/NormalizedMessageImpl.java
servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/PojoMarshaler.java
Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/JavaSource.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/JavaSource.java?rev=690162&r1=690161&r2=690162&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/JavaSource.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/JavaSource.java Fri Aug 29 02:44:07 2008
@@ -16,23 +16,12 @@
*/
package org.apache.servicemix;
-import javax.xml.transform.Source;
-
/**
* Represents an API to a JAXP {@link Source} which is capable of holding on to a POJO
*
* @version $Revision$
+ * @deprecated
*/
-public interface JavaSource extends Source {
-
- /**
- * Returns the POJO equivalent of the Source
- */
- Object getObject();
-
- /**
- * Sets the POJO equivalent of the Source
- */
- void setObject(Object object);
+public interface JavaSource extends org.apache.servicemix.jbi.jaxp.JavaSource {
}
Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/MessageExchangeListener.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/MessageExchangeListener.java?rev=690162&r1=690161&r2=690162&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/MessageExchangeListener.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/MessageExchangeListener.java Fri Aug 29 02:44:07 2008
@@ -23,10 +23,11 @@
* If a Component implements this interface, MessageExchange will be delivered directly to the listener
* asynchronously rather than using the usual asynchronous delivery with a thread used up per consuming
* component.
- *
+ *
* @version $Revision$
+ * @deprecated
*/
-public interface MessageExchangeListener {
+public interface MessageExchangeListener extends org.apache.servicemix.jbi.listener.MessageExchangeListener {
/**
* MessageExchange passed directly to the listener instead of being queued
Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultNamespaceContext.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultNamespaceContext.java?rev=690162&r1=690161&r2=690162&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultNamespaceContext.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultNamespaceContext.java Fri Aug 29 02:44:07 2008
@@ -16,80 +16,25 @@
*/
package org.apache.servicemix.client;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
import javax.xml.namespace.NamespaceContext;
-import javax.xml.xpath.XPathFactory;
/**
* An implementation of {@link NamespaceContext} which uses a simple Map where
* the keys are the prefixes and the values are the URIs
*
* @version $Revision: $
+ * @deprecated
*/
-public class DefaultNamespaceContext implements NamespaceContext {
-
- private final Map map;
- private final NamespaceContext parent;
+public class DefaultNamespaceContext extends org.apache.servicemix.jbi.jaxp.DefaultNamespaceContext {
public DefaultNamespaceContext() {
- this.map = new HashMap();
- XPathFactory factory = XPathFactory.newInstance();
- this.parent = factory.newXPath().getNamespaceContext();
+ super();
}
public DefaultNamespaceContext(NamespaceContext parent, Map map) {
- this.parent = parent;
- this.map = map;
- }
-
- /**
- * A helper method to make it easy to create newly populated instances
- */
- public DefaultNamespaceContext add(String prefix, String uri) {
- map.put(prefix, uri);
- return this;
+ super(parent, map);
}
- public String getNamespaceURI(String prefix) {
- String answer = (String) map.get(prefix);
- if (answer == null && parent != null) {
- return parent.getNamespaceURI(prefix);
- }
- return answer;
- }
-
- public String getPrefix(String namespaceURI) {
- for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- if (namespaceURI.equals(entry.getValue())) {
- return (String) entry.getKey();
- }
- }
- if (parent != null) {
- return parent.getPrefix(namespaceURI);
- }
- return null;
- }
-
- public Iterator getPrefixes(String namespaceURI) {
- Set set = new HashSet();
- for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- if (namespaceURI.equals(entry.getValue())) {
- set.add(entry.getKey());
- }
- }
- if (parent != null) {
- Iterator iter = parent.getPrefixes(namespaceURI);
- while (iter.hasNext()) {
- set.add(iter.next());
- }
- }
- return set.iterator();
- }
}
Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/Message.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/Message.java?rev=690162&r1=690161&r2=690162&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/Message.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/Message.java Fri Aug 29 02:44:07 2008
@@ -19,16 +19,18 @@
import javax.jbi.messaging.Fault;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.servicemix.jbi.messaging.PojoMarshaler;
/**
- * An extension of the standard {@link NormalizedMessage} which allows you to
+ * An extension of the standard {@link javax.jbi.messaging.NormalizedMessage} which allows you to
* work directly with message bodies as POJOs ignoring the XML stuff or passing a binary
* message around as a ByteBuffer or byte[]
*
* @version $Revision: 359151 $
+ * @deprecated
*/
-public interface Message extends NormalizedMessage {
+public interface Message extends org.apache.servicemix.jbi.api.Message {
/**
* Returns the body as a POJO. Depending on the implementation this could be
@@ -40,6 +42,11 @@
* Sets the body as a POJO
*/
void setBody(Object body) throws MessagingException;
+
+ /**
+ *
+ */
+ Object getBody(PojoMarshaler marshaler) throws MessagingException;
/**
* Returns the message exchange
Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/MessageHelper.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/MessageHelper.java?rev=690162&r1=690161&r2=690162&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/MessageHelper.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/MessageHelper.java Fri Aug 29 02:44:07 2008
@@ -28,6 +28,7 @@
* Some helper methods for working with messages
*
* @version $Revision: $
+ * @deprecated
*/
public final class MessageHelper {
Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DefaultMarshaler.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DefaultMarshaler.java?rev=690162&r1=690161&r2=690162&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DefaultMarshaler.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DefaultMarshaler.java Fri Aug 29 02:44:07 2008
@@ -16,15 +16,7 @@
*/
package org.apache.servicemix.jbi.messaging;
-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;
-
-import org.w3c.dom.Node;
-
-import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.jbi.marshaler.PojoMarshaler;
/**
* Default implementation of {@link PojoMarshaler} which will pass through
@@ -32,63 +24,17 @@
* payload is stored in a message property.
*
* @version $Revision$
+ * @deprecated
*/
-public class DefaultMarshaler implements PojoMarshaler {
-
- private PojoMarshaler parent;
-
+public class DefaultMarshaler extends org.apache.servicemix.jbi.marshaler.DefaultMarshaler
+ implements org.apache.servicemix.jbi.messaging.PojoMarshaler {
+
public DefaultMarshaler() {
+ super();
}
public DefaultMarshaler(PojoMarshaler parent) {
- this.parent = parent;
- }
-
- public PojoMarshaler getParent() {
- return parent;
- }
+ super(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: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/NormalizedMessageImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/NormalizedMessageImpl.java?rev=690162&r1=690161&r2=690162&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/NormalizedMessageImpl.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/NormalizedMessageImpl.java Fri Aug 29 02:44:07 2008
@@ -240,6 +240,10 @@
public Object getBody(PojoMarshaler marshaler) throws MessagingException {
return marshaler.unmarshal(exchange, this);
}
+
+ public Object getBody(org.apache.servicemix.jbi.marshaler.PojoMarshaler marshaler) throws MessagingException {
+ return marshaler.unmarshal(exchange, this);
+ }
public void setBody(Object body) throws MessagingException {
this.body = body;
Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/PojoMarshaler.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/PojoMarshaler.java?rev=690162&r1=690161&r2=690162&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/PojoMarshaler.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/PojoMarshaler.java Fri Aug 29 02:44:07 2008
@@ -16,49 +16,14 @@
*/
package org.apache.servicemix.jbi.messaging;
-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.
* This interface is used by the ServiceMixClient to marshal POJOs into and out
* of JBI messages.
*
* @version $Revision$
+ * @deprecated
*/
-public interface PojoMarshaler {
-
- /**
- * The key on the message to store the message body which cannot be
- * marshaled into or out of XML easily or to provide a cache of the object
- * representation of the object.
- */
- String BODY = "org.apache.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;
+public interface PojoMarshaler extends org.apache.servicemix.jbi.marshaler.PojoMarshaler {
- /**
- * Unmarshals the response out of the normalized message.
- *
- * @param exchange
- * the message exchange, which is an {@link InOut} or
- * {@link 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;
}