servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r583805 - in /incubator/servicemix/branches/servicemix-4.0: ./ apache-servicemix/ api/src/main/java/org/apache/servicemix/api/ bundles/ bundles/commons-logging/ bundles/log4j/ camel/src/main/java/org/apache/servicemix/camel/ core/src/main/j...
Date Thu, 11 Oct 2007 12:45:10 GMT
Author: gnodet
Date: Thu Oct 11 05:45:08 2007
New Revision: 583805

URL: http://svn.apache.org/viewvc?rev=583805&view=rev
Log:
Rename content to body in the messaging api to be more consistent with camel and avoid clashes with JBI api, switch to spring-osgi m3, use pax-logging-service, work on JBI runtime

Added:
    incubator/servicemix/branches/servicemix-4.0/jbi/deployer/
      - copied from r583310, incubator/servicemix/branches/servicemix-4.0/jbi/depoyer/
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/DeliveryChannelImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/FaultImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOnlyImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOptionalOutImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOutImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeFactoryImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/NormalizedMessageImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/RobustInOnlyImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/apache/
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/apache/servicemix/
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/apache/servicemix/jbi/
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/resources/
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/resources/log4j.properties
Removed:
    incubator/servicemix/branches/servicemix-4.0/bundles/commons-logging/
    incubator/servicemix/branches/servicemix-4.0/bundles/log4j/
    incubator/servicemix/branches/servicemix-4.0/jbi/depoyer/
Modified:
    incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml
    incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Exchange.java
    incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Message.java
    incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Pattern.java
    incubator/servicemix/branches/servicemix-4.0/bundles/pom.xml
    incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixExchange.java
    incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixMessage.java
    incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/ExchangeImpl.java
    incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/MessageImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/pom.xml
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/   (props changed)
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/pom.xml
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/ComponentRegistry.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java
    incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java
    incubator/servicemix/branches/servicemix-4.0/nmr/pom.xml
    incubator/servicemix/branches/servicemix-4.0/pom.xml

Modified: incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml (original)
+++ incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml Thu Oct 11 05:45:08 2007
@@ -139,16 +139,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.servicemix.bundles</groupId>
-      <artifactId>org.apache.servicemix.bundles.commons-logging</artifactId>
-      <version>1.1-4.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.servicemix.bundles</groupId>
-      <artifactId>org.apache.servicemix.bundles.log4j</artifactId>
-      <version>1.2.14-4.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.servicemix.bundles</groupId>
       <artifactId>org.apache.servicemix.bundles.aopalliance</artifactId>
       <version>1.0-4.0-SNAPSHOT</version>
     </dependency>
@@ -172,6 +162,16 @@
       <artifactId>geronimo-activation_1.1_spec</artifactId>
       <version>1.0.1-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.logging</groupId>
+      <artifactId>pax-logging-api</artifactId>
+      <version>0.9.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.logging</groupId>
+      <artifactId>pax-logging-service</artifactId>
+      <version>0.9.6</version>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
@@ -461,16 +461,16 @@
             </packagedFile>
             <packagedFile>
               <dependency>true</dependency>
-              <source>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-logging</source>
+              <source>org.ops4j.pax.logging:pax-logging-service</source>
               <destinationPath>
-                bundle/org.apache.servicemix.bundles.commons-logging-1.1-${project.version}.jar
+                bundle/org.ops4j.pax.logging.service.0.9.6.jar
               </destinationPath>
             </packagedFile>
             <packagedFile>
               <dependency>true</dependency>
-              <source>org.apache.servicemix.bundles:org.apache.servicemix.bundles.log4j</source>
+              <source>org.ops4j.pax.logging:pax-logging-api</source>
               <destinationPath>
-                bundle/org.apache.servicemix.bundles.log4j-1.2.14-${project.version}.jar
+                bundle/org.ops4j.pax.logging.api.0.9.6.jar
               </destinationPath>
             </packagedFile>
             <packagedFile>

Modified: incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Exchange.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Exchange.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Exchange.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Exchange.java Thu Oct 11 05:45:08 2007
@@ -162,6 +162,13 @@
      * @return the input message
      */
     Message getIn(boolean lazyCreate);
+
+    /**
+     * Set the inbound message.
+     *
+     * @param message the new inbound message
+     */
+    void setIn(Message message);
     
     /**
      * Obtains the outbound message, lazily creating one if none
@@ -183,6 +190,13 @@
     Message getOut(boolean lazyCreate);
 
     /**
+     * Set the outbound message.
+     *
+     * @param message the new outbound message
+     */
+    void setOut(Message message);
+
+    /**
      * Obtains the fault message, lazily creating one if none
      * has been associated with this exchange and if this exchange
      * supports a faut message. If you want to inspect this property
@@ -202,6 +216,13 @@
     Message getFault(boolean lazyCreate);
 
     /**
+     * Set the fault message.
+     *
+     * @param message the new fault message
+     */
+    void setFault(Message message);
+
+    /**
      * Obtains the given message, lazily creating one if none
      * has been associated with this exchange and if this exchange
      * supports a faut message. If you want to inspect this property
@@ -222,6 +243,14 @@
      * @return the given message
      */
     Message getMessage(Type type, boolean lazyCreate);
+
+    /**
+     * Set the message.
+     *
+     * @param type the type of the message to set
+     * @param message the new inbound message
+     */
+    void setMessage(Type type, Message message);
 
     /**
      * Obtains the error of this exchange

Modified: incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Message.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Message.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Message.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Message.java Thu Oct 11 05:45:08 2007
@@ -135,33 +135,33 @@
     Map<String, Object> getAttachments();
 
     /**
-     * Returns the content of the message in its default format.
+     * Returns the body of the message in its default format.
      *
-     * @return the main content of this message
+     * @return the main body of this message
      */
-    Object getContent();
+    Object getBody();
 
     /**
-     * Returns the content as the specified type.
+     * Returns the body as the specified type.
      *
-     * @param type the type in which the content is to be transformed
-     * @return the transformed content
+     * @param type the type in which the body is to be transformed
+     * @return the transformed body
      */
-    <T> T getContent(Class<T> type);
+    <T> T getBody(Class<T> type);
 
     /**
-     * Set the content of the message.
+     * Set the body of the message.
      *
-     * @param content the content of the message
+     * @param body the body of the message
      */
-    void setContent(Object content);
+    void setBody(Object body);
 
     /**
-     * Set the content of the message.
+     * Set the body of the message.
      *
-     * @param content the content of the message
+     * @param body the body of the message
      */
-    <T> void setContent(Object content, Class<T> type);
+    <T> void setBody(Object body, Class<T> type);
 
     /**
      * Get the mime content type describing the content of the message

Modified: incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Pattern.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Pattern.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Pattern.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/api/src/main/java/org/apache/servicemix/api/Pattern.java Thu Oct 11 05:45:08 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.servicemix.api;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Pattern of the exchange
  * 
@@ -23,8 +26,49 @@
  * @since 4.0
  */
 public enum Pattern {
+
     InOnly,
     RobustInOnly,
     InOut,
-    InOptionalOut,
+    InOptionalOut;
+
+
+    protected static final Map<String, Pattern> map = new HashMap<String, Pattern>();
+
+    /**
+     * Returns the WSDL URI for this message exchange pattern
+     *
+     * @return the WSDL URI for this message exchange pattern
+     */
+    public String getWsdlUri() {
+        switch (this) {
+            case InOnly:
+                return "http://www.w3.org/ns/wsdl/in-only";
+            case InOptionalOut:
+                return "http://www.w3.org/ns/wsdl/in-optional-out";
+            case InOut:
+                return "http://www.w3.org/ns/wsdl/in-out";
+            case RobustInOnly:
+                return "http://www.w3.org/ns/wsdl/robust-in-only";
+            default:
+                throw new IllegalArgumentException("Unknown message exchange pattern: " + this);
+        }
+    }
+
+    /**
+     * Converts the WSDL URI into a {@link Pattern} instance
+     */
+    public static Pattern fromWsdlUri(String wsdlUri) {
+        return map.get(wsdlUri);
+    }
+
+    static {
+        for (Pattern mep : values()) {
+            String uri = mep.getWsdlUri();
+            map.put(uri, mep);
+            String name = uri.substring(uri.lastIndexOf('/') + 1);
+            map.put("http://www.w3.org/2004/08/wsdl/" + name, mep);
+            map.put("http://www.w3.org/2006/01/wsdl/" + name, mep);
+        }
+    }
 }

Modified: incubator/servicemix/branches/servicemix-4.0/bundles/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/bundles/pom.xml?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/bundles/pom.xml (original)
+++ incubator/servicemix/branches/servicemix-4.0/bundles/pom.xml Thu Oct 11 05:45:08 2007
@@ -34,12 +34,10 @@
   <name>ServiceMix OSGI Common Bundles</name>
 
   <modules>
-    <module>commons-logging</module>
     <module>aopalliance</module>
     <module>jaxb-api</module>
     <module>jaxb-impl</module>
 	<module>httpcore</module>
-	<module>log4j</module>
   </modules>
 
   <properties>

Modified: incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixExchange.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixExchange.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixExchange.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixExchange.java Thu Oct 11 05:45:08 2007
@@ -123,4 +123,8 @@
     public void setExchangeId(String id) {
         //To change body of implemented methods use File | Settings | File Templates.
     }
+
+    public void setUnitOfWork(UnitOfWork unitOfWork) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
 }

Modified: incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixMessage.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixMessage.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixMessage.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/camel/src/main/java/org/apache/servicemix/camel/ServiceMixMessage.java Thu Oct 11 05:45:08 2007
@@ -86,19 +86,19 @@
     }
 
     public Object getBody() {
-        return message.getContent();
+        return message.getBody();
     }
 
     public <T> T getBody(Class<T> type) {
-        return message.getContent(type);
+        return message.getBody(type);
     }
 
     public void setBody(Object content) {
-        message.setContent(content);
+        message.setBody(content);
     }
 
     public <T> void setBody(Object content, Class<T> type) {
-        message.setContent(content, type);
+        message.setBody(content, type);
     }
 
     public Message copy() {

Modified: incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/ExchangeImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/ExchangeImpl.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/ExchangeImpl.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/ExchangeImpl.java Thu Oct 11 05:45:08 2007
@@ -237,6 +237,10 @@
         return this.in;
     }
 
+    public void setIn(Message message) {
+        this.in = message;
+    }
+
     /**
      * Obtains the output message
      *
@@ -256,6 +260,10 @@
         return this.out;
     }
 
+    public void setOut(Message message) {
+        this.out = message;
+    }
+
     /**
      * Obtains the fault message
      *
@@ -274,6 +282,10 @@
         return this.fault;
     }
 
+    public void setFault(Message message) {
+        this.fault = message;
+    }
+
     /**
      * Obtains the message of the given type
      *
@@ -289,6 +301,15 @@
             case In: return getIn(lazyCreate);
             case Out: return getOut(lazyCreate);
             case Fault: return getFault(lazyCreate);
+            default: throw new IllegalArgumentException();
+        }
+    }
+
+    public void setMessage(Type type, Message message) {
+        switch (type) {
+            case In: setIn(message);
+            case Out: setOut(message);
+            case Fault: setFault(message);
             default: throw new IllegalArgumentException();
         }
     }

Modified: incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/MessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/MessageImpl.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/MessageImpl.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/core/src/main/java/org/apache/servicemix/core/MessageImpl.java Thu Oct 11 05:45:08 2007
@@ -33,7 +33,7 @@
 	 */
 	private static final long serialVersionUID = -8621182821298293687L;
 
-	private Object content;
+	private Object body;
     private String contentType;
     private String contentEncoding;
     private Map<String, Object> headers;
@@ -43,60 +43,60 @@
     }
 
     /**
-     * Returns the content of the message in its default format.
+     * Returns the body of the message in its default format.
      *
-     * @return the main content of this message
+     * @return the main body of this message
      */
-    public Object getContent() {
-        return content;
+    public Object getBody() {
+        return body;
     }
 
     /**
-     * Returns the content as the specified type.
+     * Returns the body as the specified type.
      *
-     * @param type the type in which the content is to be transformed
-     * @return the transformed content
+     * @param type the type in which the body is to be transformed
+     * @return the transformed body
      */
-    public <T> T getContent(Class<T> type) {
+    public <T> T getBody(Class<T> type) {
         // TODO: use converters
-        if (type.isInstance(content)) {
-            return (T) content;
+        if (type.isInstance(body)) {
+            return (T) body;
         }
         return null;
     }
 
     /**
-     * Set the content of the message.
+     * Set the body of the message.
      *
-     * @param content the content of the message
+     * @param body the body of the message
      */
-    public void setContent(Object content) {
-        this.content = content;
+    public void setBody(Object body) {
+        this.body = body;
     }
 
     /**
-     * Set the content of the message.
+     * Set the body of the message.
      *
-     * @param content the content of the message
+     * @param content the body of the message
      */
-    public <T> void setContent(Object content, Class<T> type) {
+    public <T> void setBody(Object content, Class<T> type) {
         // TODO: use converters
-        this.content = content;
+        this.body = content;
     }
 
     /**
-     * Get the mime content type describing the content of the message
+     * Get the mime body type describing the body of the message
      *
-     * @return the mime content type
+     * @return the mime body type
      */
     public String getContentType() {
         return contentType;
     }
 
     /**
-     * Set the mime content type describing the content of the message
+     * Set the mime body type describing the body of the message
      *
-     * @param type the mime content type
+     * @param type the mime body type
      */
     public void setContentType(String type) {
         this.contentType = type;
@@ -269,14 +269,14 @@
      * @return the map of attachments
      */
     public Map<String, Object> getAttachments() {
-        if (attachments != null) {
+        if (attachments == null) {
             attachments = new HashMap<String, Object>();
         }
         return attachments;
     }
 
     /**
-     * Make sure that all streams contained in the content and in
+     * Make sure that all streams contained in the body and in
      * attachments are transformed to re-readable sources.
      * This method will be called by the framework when persisting
      * the message or when displaying it.
@@ -293,7 +293,7 @@
      * @param msg the message to copy from
      */
     public void copyFrom(Message msg) {
-        content = msg.getContent();
+        body = msg.getBody();
         if (!msg.getHeaders().isEmpty()) {
             headers = new HashMap<String, Object>();
             for (Map.Entry<String, Object> e : msg.getHeaders().entrySet()) {

Modified: incubator/servicemix/branches/servicemix-4.0/jbi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/pom.xml?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/pom.xml (original)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/pom.xml Thu Oct 11 05:45:08 2007
@@ -35,6 +35,7 @@
 
   <modules>
     <module>runtime</module>
+    <module>osgi</module>
   </modules>
 
 </project>

Propchange: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 11 05:45:08 2007
@@ -0,0 +1 @@
+target

Modified: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/pom.xml?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/pom.xml (original)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/pom.xml Thu Oct 11 05:45:08 2007
@@ -44,6 +44,30 @@
       <artifactId>servicemix-jbi</artifactId>
       <version>3.1.2</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-eip</artifactId>
+      <version>3.1.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-core</artifactId>
+      <version>3.1.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.13</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

Modified: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/ComponentRegistry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/ComponentRegistry.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/ComponentRegistry.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/ComponentRegistry.java Thu Oct 11 05:45:08 2007
@@ -20,6 +20,12 @@
 
 import javax.jbi.component.Component;
 
+/**
+ * Registry of JBI components.
+ *
+ * This registry will usually be populated by an OSGi service listener
+ * configured via spring-osgi.
+ */
 public interface ComponentRegistry extends ServiceRegistry<Component>  {
 
 }

Modified: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java Thu Oct 11 05:45:08 2007
@@ -16,23 +16,33 @@
  */
 package org.apache.servicemix.jbi.runtime.impl;
 
-import org.apache.servicemix.api.NMR;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Document;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.logging.Logger;
 
-import javax.jbi.component.ComponentContext;
-import javax.jbi.component.Component;
-import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.jbi.JBIException;
+import javax.jbi.component.Component;
+import javax.jbi.component.ComponentContext;
 import javax.jbi.management.MBeanNames;
 import javax.jbi.messaging.DeliveryChannel;
 import javax.jbi.messaging.MessagingException;
-import javax.xml.namespace.QName;
+import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.management.MBeanServer;
 import javax.naming.InitialContext;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+
+import org.apache.servicemix.api.Channel;
+import org.apache.servicemix.api.Endpoint;
+import org.apache.servicemix.api.Exchange;
+import org.apache.servicemix.api.NMR;
 
 /**
  * Created by IntelliJ IDEA.
@@ -43,22 +53,43 @@
  */
 public class ComponentContextImpl implements ComponentContext {
 
+    public int DEFAULT_QUEUE_CAPACITY = 100;
+
     private NMR nmr;
     private Component component;
     private Map<String,?> properties;
+    private BlockingQueue<Exchange> queue;
+    private DeliveryChannel dc;
+    private List<EndpointImpl> endpoints;
+    private Channel channel;
 
     public ComponentContextImpl(NMR nmr, Component component, Map<String,?> properties) {
         this.nmr = nmr;
         this.component = component;
         this.properties = properties;
-    }
-
-    public ServiceEndpoint activateEndpoint(QName serviceName, String endpointName) throws JBIException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void deactivateEndpoint(ServiceEndpoint endpoint) throws JBIException {
-        //To change body of implemented methods use File | Settings | File Templates.
+        this.channel = nmr.createChannel();
+        this.queue = new ArrayBlockingQueue<Exchange>(DEFAULT_QUEUE_CAPACITY);
+        this.dc = new DeliveryChannelImpl(channel, queue);
+        this.endpoints = new ArrayList<EndpointImpl>();
+    }
+
+    public synchronized ServiceEndpoint activateEndpoint(QName serviceName, String endpointName) throws JBIException {
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Endpoint.NAME, serviceName.toString() + ":" + endpointName);
+        props.put(Endpoint.SERVICE_NAME, serviceName);
+        props.put(Endpoint.ENDPOINT_NAME, endpointName);
+        EndpointImpl endpoint = new EndpointImpl();
+        endpoint.setQueue(queue);
+        endpoint.setServiceName(serviceName);
+        endpoint.setEndpointName(endpointName);
+        nmr.getEndpointRegistry().register(endpoint,  props);
+        return endpoint;
+    }
+
+    public synchronized void deactivateEndpoint(ServiceEndpoint endpoint) throws JBIException {
+        EndpointImpl ep = (EndpointImpl) endpoint;
+        nmr.getEndpointRegistry().register(ep, null);
+        endpoints.remove(ep);
     }
 
     public void registerExternalEndpoint(ServiceEndpoint externalEndpoint) throws JBIException {
@@ -78,7 +109,7 @@
     }
 
     public DeliveryChannel getDeliveryChannel() throws MessagingException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return dc;
     }
 
     public ServiceEndpoint getEndpoint(QName service, String name) {

Modified: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java Thu Oct 11 05:45:08 2007
@@ -67,4 +67,11 @@
         }
     }
 
+    public NMR getNmr() {
+        return nmr;
+    }
+
+    public void setNmr(NMR nmr) {
+        this.nmr = nmr;
+    }
 }

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/DeliveryChannelImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/DeliveryChannelImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/DeliveryChannelImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/DeliveryChannelImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.api.Channel;
+import org.apache.servicemix.api.Exchange;
+
+/**
+ * Implementation of the DeliveryChannel.
+ *
+ */
+public class DeliveryChannelImpl implements DeliveryChannel {
+
+    /** Mutable boolean indicating if the channe has been closed */
+    private final AtomicBoolean closed;
+
+    /** Holds exchanges to be polled by the component */
+    private final BlockingQueue<Exchange> queue;
+
+    /** The underlying Channel */
+    private final Channel channel;
+
+    public DeliveryChannelImpl(Channel channel, BlockingQueue<Exchange> queue) {
+        this.channel = channel;
+        this.queue = queue;
+        this.closed = new AtomicBoolean(false);
+    }
+
+    public void close() throws MessagingException {
+        // TODO process everything
+        channel.close();
+        closed.set(true);
+    }
+
+    public MessageExchangeFactory createExchangeFactory() {
+        return new MessageExchangeFactoryImpl(closed);
+    }
+
+    public MessageExchangeFactory createExchangeFactory(QName interfaceName) {
+        MessageExchangeFactoryImpl factory = new MessageExchangeFactoryImpl(closed);
+        factory.setInterfaceName(interfaceName);
+        return factory;
+    }
+
+    public MessageExchangeFactory createExchangeFactoryForService(QName serviceName) {
+        MessageExchangeFactoryImpl factory = new MessageExchangeFactoryImpl(closed);
+        factory.setServiceName(serviceName);
+        return factory;
+    }
+
+    public MessageExchangeFactory createExchangeFactory(ServiceEndpoint endpoint) {
+        MessageExchangeFactoryImpl factory = new MessageExchangeFactoryImpl(closed);
+        factory.setEndpoint(endpoint);
+        return factory;
+    }
+
+    public MessageExchange accept() throws MessagingException {
+        try {
+            Exchange exchange = queue.take();
+            if (exchange == null) {
+                return null;
+            }
+            return new MessageExchangeImpl(exchange);
+        } catch (InterruptedException e) {
+            throw new MessagingException(e);
+        }
+    }
+
+    public MessageExchange accept(long timeout) throws MessagingException {
+        try {
+            Exchange exchange = queue.poll(timeout, TimeUnit.MILLISECONDS);
+            if (exchange == null) {
+                return null;
+            }
+            return new MessageExchangeImpl(exchange);
+        } catch (InterruptedException e) {
+            throw new MessagingException(e);
+        }
+    }
+
+    public void send(MessageExchange exchange) throws MessagingException {
+        assert exchange != null;
+        channel.send(((MessageExchangeImpl) exchange).getInternalExchange());
+    }
+
+    public boolean sendSync(MessageExchange exchange) throws MessagingException {
+        assert exchange != null;
+        return channel.sendSync(((MessageExchangeImpl) exchange).getInternalExchange());
+    }
+
+    public boolean sendSync(MessageExchange exchange, long timeout) throws MessagingException {
+        assert exchange != null;
+        return channel.sendSync(((MessageExchangeImpl) exchange).getInternalExchange(), timeout);
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import org.apache.servicemix.api.Channel;
+import org.apache.servicemix.api.Endpoint;
+import org.apache.servicemix.api.Exchange;
+import org.w3c.dom.DocumentFragment;
+
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+import java.util.Queue;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 5, 2007
+ * Time: 11:08:00 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class EndpointImpl implements Endpoint, ServiceEndpoint {
+
+    private Channel channel;
+    private Queue<Exchange> queue;
+    private QName serviceName;
+    private String endpointName;
+
+    public EndpointImpl() {
+    }
+
+    public void process(Exchange exchange) {
+        if (exchange.getProperty(ServiceEndpoint.class) == null) {
+            exchange.setProperty(ServiceEndpoint.class, this);
+        }
+        queue.offer(exchange);
+    }
+
+    public DocumentFragment getAsReference(QName operationName) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public QName[] getInterfaces() {
+        return new QName[0];  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Channel getChannel() {
+        return channel;
+    }
+
+    public void setChannel(Channel channel) {
+        this.channel = channel;
+    }
+
+    public Queue<Exchange> getQueue() {
+        return queue;
+    }
+
+    public void setQueue(Queue<Exchange> queue) {
+        this.queue = queue;
+    }
+
+    public QName getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(QName serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public String getEndpointName() {
+        return endpointName;
+    }
+
+    public void setEndpointName(String endpointName) {
+        this.endpointName = endpointName;
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/FaultImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/FaultImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/FaultImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/FaultImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import org.apache.servicemix.api.Message;
+
+import javax.jbi.messaging.Fault;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 5, 2007
+ * Time: 5:19:40 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class FaultImpl extends NormalizedMessageImpl implements Fault {
+
+    public FaultImpl(Message message) {
+        super(message);
+    }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOnlyImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOnlyImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOnlyImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOnlyImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import org.apache.servicemix.api.Exchange;
+
+import javax.jbi.messaging.InOnly;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 5, 2007
+ * Time: 5:20:12 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class InOnlyImpl extends MessageExchangeImpl implements InOnly {
+
+    public InOnlyImpl(Exchange exchange) {
+        super(exchange);
+    }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOptionalOutImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOptionalOutImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOptionalOutImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOptionalOutImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import org.apache.servicemix.api.Exchange;
+
+import javax.jbi.messaging.InOptionalOut;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 5, 2007
+ * Time: 5:40:22 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class InOptionalOutImpl extends MessageExchangeImpl implements InOptionalOut {
+
+    public InOptionalOutImpl(Exchange exchange) {
+        super(exchange);
+    }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOutImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOutImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOutImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/InOutImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import org.apache.servicemix.api.Exchange;
+
+import javax.jbi.messaging.InOut;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 5, 2007
+ * Time: 5:36:34 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class InOutImpl extends MessageExchangeImpl implements InOut {
+
+    public InOutImpl(Exchange exchange) {
+        super(exchange);
+    }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeFactoryImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeFactoryImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeFactoryImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,242 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import java.net.URI;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.InOptionalOut;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.RobustInOnly;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.api.Pattern;
+import org.apache.servicemix.core.ExchangeImpl;
+
+/**
+ * Resolver for URI patterns
+ *
+ * @version $Revision: 564607 $
+ */
+public class MessageExchangeFactoryImpl implements MessageExchangeFactory {
+
+    private QName interfaceName;
+
+    private QName serviceName;
+
+    private QName operationName;
+
+    private ServiceEndpoint endpoint;
+
+    private AtomicBoolean closed;
+
+    /**
+     * Constructor for a factory
+     *
+     * @param closed indicates if the delivery channel has been closed
+     */
+    public MessageExchangeFactoryImpl(AtomicBoolean closed) {
+        this.closed = closed;
+    }
+
+    protected void checkNotClosed() throws MessagingException {
+        if (closed.get()) {
+            throw new MessagingException("DeliveryChannel has been closed.");
+        }
+    }
+
+    /**
+     * Create an exchange from the specified pattern
+     *
+     * @param pattern the MEP URI
+     * @return MessageExchange
+     * @throws MessagingException
+     */
+    public MessageExchange createExchange(URI pattern) throws MessagingException {
+        checkNotClosed();
+        MessageExchange result = null;
+        if (pattern != null) {
+            Pattern p = Pattern.fromWsdlUri(pattern.toString());
+            if (p == Pattern.InOnly) {
+                result = createInOnlyExchange();
+            } else if (p == Pattern.InOut) {
+                result = createInOutExchange();
+            } else if (p == Pattern.InOptionalOut) {
+                result = createInOptionalOutExchange();
+            } else if (p == Pattern.RobustInOnly) {
+                result = createRobustInOnlyExchange();
+            }
+        }
+        if (result == null) {
+            throw new MessagingException("Do not understand pattern: " + pattern);
+        }
+        return result;
+    }
+
+    /**
+     * create InOnly exchange
+     *
+     * @return InOnly exchange
+     * @throws MessagingException
+     */
+    public InOnly createInOnlyExchange() throws MessagingException {
+        checkNotClosed();
+        InOnlyImpl result = new InOnlyImpl(new ExchangeImpl(Pattern.InOnly));
+        setDefaults(result);
+        return result;
+    }
+
+    /**
+     * create RobustInOnly exchange
+     *
+     * @return RobsutInOnly exchange
+     * @throws MessagingException
+     */
+    public RobustInOnly createRobustInOnlyExchange() throws MessagingException {
+        checkNotClosed();
+        RobustInOnlyImpl result = new RobustInOnlyImpl(new ExchangeImpl(Pattern.RobustInOnly));
+        setDefaults(result);
+        return result;
+    }
+
+    /**
+     * create InOut Exchange
+     *
+     * @return InOut exchange
+     * @throws MessagingException
+     */
+    public InOut createInOutExchange() throws MessagingException {
+        checkNotClosed();
+        InOutImpl result = new InOutImpl(new ExchangeImpl(Pattern.InOut));
+        setDefaults(result);
+        return result;
+    }
+
+    /**
+     * create InOptionalOut exchange
+     *
+     * @return InOptionalOut exchange
+     * @throws MessagingException
+     */
+    public InOptionalOut createInOptionalOutExchange() throws MessagingException {
+        checkNotClosed();
+        InOptionalOutImpl result = new InOptionalOutImpl(new ExchangeImpl(Pattern.InOptionalOut));
+        setDefaults(result);
+        return result;
+    }
+
+    /**
+     * Create an exchange that points at an endpoint that conforms to the
+     * declared capabilities, requirements, and policies of both the consumer
+     * and the provider.
+     *
+     * @param svcName the service name
+     * @param opName
+     *            the WSDL name of the operation to be performed
+     * @return a message exchange that is initialized with given interfaceName,
+     *         operationName, and the endpoint decided upon by JBI.
+     * @throws MessagingException
+     */
+    public MessageExchange createExchange(QName svcName, QName opName) throws MessagingException {
+        // TODO: look for the operation in the wsdl and infer the MEP
+        checkNotClosed();
+        InOptionalOutImpl me = new InOptionalOutImpl(new ExchangeImpl(Pattern.InOptionalOut));
+        setDefaults(me);
+        me.setService(svcName);
+        me.setOperation(opName);
+        return me;
+    }
+
+    /**
+     * @return endpoint
+     */
+    public ServiceEndpoint getEndpoint() {
+        return endpoint;
+    }
+
+    /**
+     * set endpoint
+     *
+     * @param endpoint The endpoint to set
+     */
+    public void setEndpoint(ServiceEndpoint endpoint) {
+        this.endpoint = endpoint;
+    }
+
+    /**
+     * @return interface name
+     */
+    public QName getInterfaceName() {
+        return interfaceName;
+    }
+
+    /**
+     * set interface name
+     *
+     * @param interfaceName The interfaceName to set
+     */
+    public void setInterfaceName(QName interfaceName) {
+        this.interfaceName = interfaceName;
+    }
+
+    /**
+     * @return service name
+     */
+    public QName getServiceName() {
+        return serviceName;
+    }
+
+    /**
+     * set service name
+     *
+     * @param serviceName The serviceName to set
+     */
+    public void setServiceName(QName serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    /**
+     * @return Returns the operationName.
+     */
+    public QName getOperationName() {
+        return operationName;
+    }
+
+    /**
+     * @param operationName
+     *            The operationName to set.
+     */
+    public void setOperationName(QName operationName) {
+        this.operationName = operationName;
+    }
+
+    protected void setDefaults(MessageExchangeImpl exchange) {
+        exchange.setOperation(getOperationName());
+        if (endpoint != null) {
+            exchange.setEndpoint(getEndpoint());
+        } else {
+            exchange.setService(serviceName);
+            exchange.setInterfaceName(interfaceName);
+        }
+    }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/MessageExchangeImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import org.apache.servicemix.api.Exchange;
+import org.apache.servicemix.api.Message;
+import org.apache.servicemix.api.Pattern;
+import org.apache.servicemix.api.Status;
+import org.apache.servicemix.core.MessageImpl;
+
+import javax.jbi.messaging.*;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+import java.net.URI;
+import java.util.Set;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 5, 2007
+ * Time: 2:21:25 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class MessageExchangeImpl implements MessageExchange  {
+
+    private final Exchange exchange;
+
+    public MessageExchangeImpl(Exchange exchange) {
+        this.exchange = exchange;
+    }
+
+    public Exchange getInternalExchange() {
+            return exchange;
+    }
+
+    public String getExchangeId() {
+        return exchange.getId();
+    }
+
+    public URI getPattern() {
+        return URI.create(exchange.getPattern().getWsdlUri());
+    }
+
+    public MessageExchange.Role getRole() {
+        return exchange.getRole() == org.apache.servicemix.api.Role.Consumer ? MessageExchange.Role.CONSUMER : MessageExchange.Role.PROVIDER;
+    }
+
+    public ExchangeStatus getStatus() {
+        if (exchange.getStatus() == Status.Active) {
+            return ExchangeStatus.ACTIVE;
+        } else if (exchange.getStatus() == Status.Done) {
+            return ExchangeStatus.DONE;
+        } else if (exchange.getStatus() == Status.Error) {
+            return ExchangeStatus.ERROR;
+        } else {
+            throw new IllegalStateException();
+        }
+    }
+
+    public void setStatus(ExchangeStatus status) {
+        if (status == ExchangeStatus.ACTIVE) {
+            exchange.setStatus(Status.Active);
+        } else if (status == ExchangeStatus.DONE) {
+            exchange.setStatus(Status.Done);
+        } else if (status == ExchangeStatus.ERROR) {
+            exchange.setStatus(Status.Error);
+        } else {
+            throw new IllegalStateException();
+        }
+
+    }
+
+    public QName getOperation() {
+        return exchange.getOperation();
+    }
+
+    public void setOperation(QName qName) {
+        exchange.setOperation(qName);
+    }
+
+    public Object getProperty(String s) {
+        return exchange.getProperty(s);
+    }
+
+    public void setProperty(String s, Object o) {
+        exchange.setProperty(s, o);
+    }
+
+    public Set getPropertyNames() {
+        return exchange.getProperties().keySet();
+    }
+
+    public NormalizedMessage createMessage() throws MessagingException {
+        return new NormalizedMessageImpl(new MessageImpl());
+    }
+
+    public NormalizedMessage getMessage(String name) {
+        if ("in".equalsIgnoreCase(name)) {
+            return getInMessage();
+        } else if ("out".equalsIgnoreCase(name)) {
+            return getOutMessage();
+        } else if ("fault".equalsIgnoreCase(name)) {
+            return getFault();
+        } else {
+            throw new IllegalStateException();
+        }
+    }
+
+    public void setMessage(NormalizedMessage msg, String name) throws MessagingException {
+        if ("in".equalsIgnoreCase(name)) {
+            setInMessage(msg);
+        } else if ("out".equalsIgnoreCase(name)) {
+            setOutMessage(msg);
+        } else if ("fault".equalsIgnoreCase(name)) {
+            setFault((Fault) msg);
+        } else {
+            throw new IllegalStateException();
+        }
+    }
+
+    public NormalizedMessage getInMessage() {
+        Message msg = exchange.getIn(false);
+        if (msg == null) {
+            return null;
+        } else {
+            return new NormalizedMessageImpl(msg);
+        }
+    }
+
+    public void setInMessage(NormalizedMessage message) throws MessagingException {
+        NormalizedMessageImpl msg = (NormalizedMessageImpl) message;
+        exchange.setIn(msg.getInternalMessage());
+    }
+
+    public NormalizedMessage getOutMessage() {
+        Message msg = exchange.getOut(false);
+        if (msg == null) {
+            return null;
+        } else {
+            return new NormalizedMessageImpl(msg);
+        }
+    }
+
+    public void setOutMessage(NormalizedMessage message) throws MessagingException {
+        NormalizedMessageImpl msg = (NormalizedMessageImpl) message;
+        exchange.setOut(msg.getInternalMessage());
+    }
+
+    public Fault createFault() throws MessagingException {
+        return new FaultImpl(new MessageImpl());
+    }
+
+    public Fault getFault() {
+        Message msg = exchange.getFault(false);
+        if (msg == null) {
+            return null;
+        } else {
+            return new FaultImpl(msg);
+        }
+    }
+
+    public void setFault(Fault message) throws MessagingException {
+        FaultImpl msg = (FaultImpl) message;
+        exchange.setFault(msg.getInternalMessage());
+    }
+
+    public Exception getError() {
+        return exchange.getError();
+    }
+
+    public void setError(Exception e) {
+        exchange.setError(e);
+    }
+
+    public void setEndpoint(ServiceEndpoint endpoint) {
+        exchange.setProperty("javax.jbi.ServiceEndpoint", endpoint);
+    }
+
+    public void setService(QName service) {
+        exchange.setProperty("javax.jbi.ServiceeName", service);
+    }
+
+    public void setInterfaceName(QName interfaceName) {
+        exchange.setProperty("javax.jbi.InterfaceName", interfaceName);
+    }
+
+    public ServiceEndpoint getEndpoint() {
+        return exchange.getProperty("javax.jbi.ServiceEndpoint", ServiceEndpoint.class);
+    }
+
+    public QName getInterfaceName() {
+        return exchange.getProperty("javax.jbi.InterfaceName", QName.class);
+    }
+
+    public QName getService() {
+        return exchange.getProperty("javax.jbi.ServiceName", QName.class);
+    }
+
+    public boolean isTransacted() {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/NormalizedMessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/NormalizedMessageImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/NormalizedMessageImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/NormalizedMessageImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import org.apache.servicemix.api.Message;
+import org.apache.servicemix.core.MessageImpl;
+
+import javax.jbi.messaging.NormalizedMessage;
+import javax.jbi.messaging.MessagingException;
+import javax.activation.DataHandler;
+import javax.xml.transform.Source;
+import javax.security.auth.Subject;
+import java.util.Set;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 5, 2007
+ * Time: 4:11:22 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class NormalizedMessageImpl implements NormalizedMessage {
+
+    private Message message;
+
+    public NormalizedMessageImpl(Message message) {
+        assert message != null : "Encapsulated message should never be null!";
+        this.message = message;
+    }
+
+    public Message getInternalMessage() {
+        return message;
+    }
+
+    public void addAttachment(String id, DataHandler content) throws MessagingException {
+        message.addAttachment(id, content);
+    }
+
+    public Source getContent() {
+        return message.getBody(Source.class);
+    }
+
+    public DataHandler getAttachment(String id) {
+        Object attachment = message.getAttachment(id);
+        if (attachment == null || attachment instanceof DataHandler) {
+            return (DataHandler) attachment;
+        } else {
+            DataHandler dh = new DataHandler(attachment, null);
+            return dh;
+        }
+    }
+
+    public Set getAttachmentNames() {
+        return message.getAttachments().keySet();
+    }
+
+    public void removeAttachment(String id) throws MessagingException {
+        message.removeAttachment(id);
+    }
+
+    public void setContent(Source content) throws MessagingException {
+        message.setBody(content);
+    }
+
+    public void setProperty(String name, Object value) {
+        message.setHeader(name, value);
+    }
+
+    public void setSecuritySubject(Subject subject) {
+        message.setHeader(Subject.class, subject);
+    }
+
+    public Set getPropertyNames() {
+        return message.getHeaders().keySet();
+    }
+
+    public Object getProperty(String name) {
+        return message.getHeader(name);
+    }
+
+    public Subject getSecuritySubject() {
+        return message.getHeader(Subject.class);
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/RobustInOnlyImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/RobustInOnlyImpl.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/RobustInOnlyImpl.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/RobustInOnlyImpl.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime.impl;
+
+import org.apache.servicemix.api.Exchange;
+
+import javax.jbi.messaging.RobustInOnly;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 5, 2007
+ * Time: 5:33:16 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class RobustInOnlyImpl extends MessageExchangeImpl implements RobustInOnly {
+
+    public RobustInOnlyImpl(Exchange exchange) {
+        super(exchange);
+    }
+    
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java Thu Oct 11 05:45:08 2007
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.jbi.runtime;
+
+import org.apache.servicemix.api.Channel;
+import org.apache.servicemix.api.Exchange;
+import org.apache.servicemix.api.Pattern;
+import org.apache.servicemix.api.Endpoint;
+import org.apache.servicemix.api.service.ServiceHelper;
+import org.apache.servicemix.core.ServiceMix;
+import org.apache.servicemix.eip.EIPComponent;
+import org.apache.servicemix.eip.EIPEndpoint;
+import org.apache.servicemix.eip.patterns.WireTap;
+import org.apache.servicemix.eip.support.ExchangeTarget;
+import org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl;
+import org.junit.Test;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 5, 2007
+ * Time: 1:31:44 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class IntegrationTest {
+
+    @Test
+    public void testJbiComponent() throws Exception {
+        ServiceMix smx = new ServiceMix();
+        smx.init();
+        ComponentRegistryImpl reg = new ComponentRegistryImpl();
+        reg.setNmr(smx);
+
+        EIPComponent eip = new EIPComponent();
+        WireTap ep = new WireTap();
+        ep.setService(new QName("uri:foo", "bar"));
+        ep.setEndpoint("ep");
+        ep.setTarget(new ExchangeTarget());
+        ep.getTarget().setService(new QName("target"));
+        eip.setEndpoints(new EIPEndpoint[] { ep });
+        reg.register(eip, null);
+
+        Channel channel = smx.createChannel();
+        Exchange e = channel.createExchange(Pattern.InOnly);
+        e.getIn().setBody("<hello/>");
+        e.setTarget(smx.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, "{uri:foo}bar:ep")));
+        channel.sendSync(e);
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/resources/log4j.properties?rev=583805&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/resources/log4j.properties (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/runtime/src/test/resources/log4j.properties Thu Oct 11 05:45:08 2007
@@ -0,0 +1,42 @@
+# 
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+#
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=DEBUG, stdout
+
+log4j.logger.org.springframework=INFO
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.spring=WARN
+log4j.logger.org.apache.activemq.store.journal=INFO
+log4j.logger.org.activeio.journal=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/servicemix-test.log
+log4j.appender.out.append=true

Modified: incubator/servicemix/branches/servicemix-4.0/nmr/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/nmr/pom.xml?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/nmr/pom.xml (original)
+++ incubator/servicemix/branches/servicemix-4.0/nmr/pom.xml Thu Oct 11 05:45:08 2007
@@ -83,9 +83,6 @@
           <instructions>
             <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
             <Import-Package></Import-Package>
-            <!--
-            <Export-Package>${pom.artifactId}</Export-Package>
-        -->
             <DynamicImport-Package>*</DynamicImport-Package>
           </instructions>
         </configuration>

Modified: incubator/servicemix/branches/servicemix-4.0/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/pom.xml?rev=583805&r1=583804&r2=583805&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/pom.xml (original)
+++ incubator/servicemix/branches/servicemix-4.0/pom.xml Thu Oct 11 05:45:08 2007
@@ -63,7 +63,7 @@
 	<junit.version>4.4</junit.version>
 	<felix.version>1.0.0</felix.version>
 	<camel.version>1.1-SNAPSHOT</camel.version>
-	<spring.osgi.version>1.0-m3-SNAPSHOT</spring.osgi.version>
+	<spring.osgi.version>1.0-m3</spring.osgi.version>
 	<spring.version>2.1-m4</spring.version>
 	<commons.logging.version>1.1</commons.logging.version>
   </properties>
@@ -74,6 +74,12 @@
       <id>i21-s3-maven-repo</id>
       <name>i21 S3 milestone repo</name>
       <url>http://s3.amazonaws.com/maven.springframework.org/milestone</url>
+    </repository>
+	<!-- OPS4J repository -->
+    <repository>
+      <id>ops4j-repo</id>
+      <name>OPS4J repo</name>
+      <url>http://repository.ops4j.org/maven2</url>
     </repository>
     <!-- Spring external dependencies -->
     <repository>



Mime
View raw message