camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r562166 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/component/bean/ camel-core/src/main/java/org/apache/camel/component/pojo/ camel-core/src/main/java/org/apache/camel/component/pojo/timer/ camel-core/src/main/java...
Date Thu, 02 Aug 2007 16:18:32 GMT
Author: jstrachan
Date: Thu Aug  2 09:18:30 2007
New Revision: 562166

URL: http://svn.apache.org/viewvc?view=rev&rev=562166
Log:
more refactoring of the pojo & bean components to remove a fair bit of code and simplify things

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java   (contents, props changed)
      - copied, changed from r562013, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java   (contents, props changed)
      - copied, changed from r562072, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoInvocation.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/CamelInvocationHandler.java
      - copied, changed from r562072, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/CamelInvocationHandler.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/NoBeanAvailableException.java   (contents, props changed)
      - copied, changed from r562013, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/NoPojoAvailableException.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java   (contents, props changed)
      - copied, changed from r562084, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/package.html
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteTest.java
Removed:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/CamelInvocationHandler.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/NoPojoAvailableException.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoInvocation.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/package.html
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/timer/
    activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/component/
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/AmbiguousMethodCallException.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java
    activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/pojo
    activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/timer
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
    activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java
    activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java
    activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java
    activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiProducer.java
    activemq/camel/trunk/components/camel-rmi/src/test/java/org/apache/camel/component/rmi/RmiRouteTest.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/AmbiguousMethodCallException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/AmbiguousMethodCallException.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/AmbiguousMethodCallException.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/AmbiguousMethodCallException.java Thu Aug  2 09:18:30 2007
@@ -16,15 +16,15 @@
  */
 package org.apache.camel.component.bean;
 
-import org.apache.camel.Exchange;
 import org.apache.camel.CamelExchangeException;
+import org.apache.camel.Exchange;
 
 import java.util.List;
 
 /**
  * An exception thrown if an attempted method invocation resulted in an ambiguous method
  * such that multiple methods match the inbound message exchange
- * 
+ *
  * @version $Revision: $
  */
 public class AmbiguousMethodCallException extends CamelExchangeException {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanComponent.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanComponent.java Thu Aug  2 09:18:30 2007
@@ -63,11 +63,11 @@
         return new ProcessorEndpoint(uri, this, processor);
     }
 
-    public Object getBean(String remaining) {
+    public Object getBean(String remaining) throws NoBeanAvailableException {
         Registry registry = getCamelContext().getRegistry();
         Object bean = registry.lookup(remaining);
         if (bean == null) {
-            throw new IllegalArgumentException("No such bean: " + remaining + " in registry: " + registry);
+            throw new NoBeanAvailableException(remaining);
         }
         return bean;
     }

Copied: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java (from r562013, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java?view=diff&rev=562166&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java&r1=562013&p2=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java Thu Aug  2 09:18:30 2007
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.pojo;
+package org.apache.camel.component.bean;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
@@ -23,22 +23,22 @@
 /**
  * @version $Revision: 519901 $
  */
-public class PojoExchange extends DefaultExchange {
+public class BeanExchange extends DefaultExchange {
 
-    public PojoExchange(CamelContext context) {
+    public BeanExchange(CamelContext context) {
         super(context);
     }
 
-    public PojoInvocation getInvocation() {
-        return getIn().getBody(PojoInvocation.class);
+    public BeanInvocation getInvocation() {
+        return getIn().getBody(BeanInvocation.class);
     }
 
-    public void setInvocation(PojoInvocation invocation) {
+    public void setInvocation(BeanInvocation invocation) {
         getIn().setBody(invocation);
     }
 
     @Override
     public Exchange newInstance() {
-        return new PojoExchange(getContext());
+        return new BeanExchange(getContext());
     }
 }

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java Thu Aug  2 09:18:30 2007
@@ -32,10 +32,10 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.Arrays;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
@@ -63,6 +63,7 @@
             }
         }
     }
+
     public Class getType() {
         return type;
     }
@@ -70,7 +71,7 @@
     public MethodInvocation createInvocation(Method method, Object pojo, Exchange exchange) throws RuntimeCamelException {
         MethodInfo methodInfo = introspect(type, method);
         if (methodInfo != null) {
-        return methodInfo.createMethodInvocation(pojo, exchange);
+            return methodInfo.createMethodInvocation(pojo, exchange);
         }
         return null;
     }
@@ -168,7 +169,7 @@
      * Lets try choose one of the available methods to invoke if we can match
      * the message body to the body parameter
      *
-     * @param pojo the bean to invoke a method on
+     * @param pojo     the bean to invoke a method on
      * @param exchange the message exchange
      * @return the method to invoke or null if no definitive method could be matched
      */
@@ -222,7 +223,6 @@
         }
         return null;
     }
-
 
 
     /**

Copied: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java (from r562072, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoInvocation.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java?view=diff&rev=562166&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoInvocation.java&r1=562072&p2=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoInvocation.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java Thu Aug  2 09:18:30 2007
@@ -14,36 +14,36 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.pojo;
+package org.apache.camel.component.bean;
 
 import org.apache.camel.Exchange;
 
-import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 
-public class PojoInvocation {
+public class BeanInvocation {
 
-	private final Object proxy;
-	private final Method method;
-	private final Object[] args;
-
-	public PojoInvocation(Object proxy, Method method, Object[] args) {
-		this.proxy = proxy;
-		this.method = method;
-		this.args = args;
-	}
-
-	public Object[] getArgs() {
-		return args;
-	}
-
-	public Method getMethod() {
-		return method;
-	}
-
-	public Object getProxy() {
-		return proxy;
-	}
+    private final Object proxy;
+    private final Method method;
+    private final Object[] args;
+
+    public BeanInvocation(Object proxy, Method method, Object[] args) {
+        this.proxy = proxy;
+        this.method = method;
+        this.args = args;
+    }
+
+    public Object[] getArgs() {
+        return args;
+    }
+
+    public Method getMethod() {
+        return method;
+    }
+
+    public Object getProxy() {
+        return proxy;
+    }
 
     /**
      * This causes us to invoke the endpoint Pojo using reflection.

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java Thu Aug  2 09:18:30 2007
@@ -19,7 +19,6 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
-import org.apache.camel.component.pojo.PojoInvocation;
 import org.apache.camel.util.ObjectHelper;
 import static org.apache.camel.util.ObjectHelper.isNullOrBlank;
 import org.apache.commons.logging.Log;
@@ -61,9 +60,9 @@
             log.debug(">>>> invoking method for: " + exchange);
         }
         Message in = exchange.getIn();
-        PojoInvocation pojoInvoke = in.getBody(PojoInvocation.class);
-        if (pojoInvoke != null) {
-            pojoInvoke.invoke(pojo, exchange);
+        BeanInvocation beanInvoke = in.getBody(BeanInvocation.class);
+        if (beanInvoke != null) {
+            beanInvoke.invoke(pojo, exchange);
             return;
         }
 

Copied: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/CamelInvocationHandler.java (from r562072, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/CamelInvocationHandler.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/CamelInvocationHandler.java?view=diff&rev=562166&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/CamelInvocationHandler.java&r1=562072&p2=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/CamelInvocationHandler.java&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/CamelInvocationHandler.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/CamelInvocationHandler.java Thu Aug  2 09:18:30 2007
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.pojo;
+package org.apache.camel.component.bean;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.Producer;
@@ -39,8 +39,8 @@
     }
 
     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-        PojoInvocation invocation = new PojoInvocation(proxy, method, args);
-        PojoExchange exchange = new PojoExchange(endpoint.getContext());
+        BeanInvocation invocation = new BeanInvocation(proxy, method, args);
+        BeanExchange exchange = new BeanExchange(endpoint.getContext());
         exchange.setInvocation(invocation);
 
         producer.process(exchange);

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java Thu Aug  2 09:18:30 2007
@@ -23,8 +23,8 @@
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.List;
 import java.util.Arrays;
+import java.util.List;
 
 /**
  * @version $Revision: $
@@ -107,7 +107,7 @@
     public boolean hasBodyParameter() {
         return !bodyParameters.isEmpty();
     }
-    
+
     protected Object invoke(Method mth, Object pojo, Object[] arguments, Exchange exchange) throws IllegalAccessException, InvocationTargetException {
         return mth.invoke(pojo, arguments);
     }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java Thu Aug  2 09:18:30 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.camel.component.bean;
 
-import java.lang.reflect.Method;
 import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Method;
 
 /**
  * @version $Revision: $

Copied: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/NoBeanAvailableException.java (from r562013, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/NoPojoAvailableException.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/NoBeanAvailableException.java?view=diff&rev=562166&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/NoPojoAvailableException.java&r1=562013&p2=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/NoBeanAvailableException.java&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/NoPojoAvailableException.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/NoBeanAvailableException.java Thu Aug  2 09:18:30 2007
@@ -15,22 +15,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.pojo;
+package org.apache.camel.component.bean;
 
 import org.apache.camel.CamelException;
 
 /**
  * @version $Revision: 1.1 $
  */
-public class NoPojoAvailableException extends CamelException {
-    private final PojoEndpoint endpoint;
+public class NoBeanAvailableException extends CamelException {
+    private final String name;
 
-    public NoPojoAvailableException(PojoEndpoint endpoint) {
-        super("No POJO available for endpoint: " + endpoint);
-        this.endpoint = endpoint;
+    public NoBeanAvailableException(String name) {
+        super("No bean available for endpoint: " + name);
+        this.name = name;
     }
 
-    public PojoEndpoint getEndpoint() {
-        return endpoint;
+    public String getName() {
+        return name;
     }
 }

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/NoBeanAvailableException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java (from r562084, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java?view=diff&rev=562166&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java&r1=562084&p2=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java Thu Aug  2 09:18:30 2007
@@ -14,64 +14,59 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.pojo;
+package org.apache.camel.component.bean;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.Producer;
-import org.apache.camel.component.bean.BeanComponent;
 
 import java.lang.reflect.Proxy;
 
 /**
- * Represents the component that manages {@link PojoEndpoint}.  It holds the
- * list of named pojos that queue endpoints reference.
+ * A helper class for creating proxies which delegate to Camel
  *
  * @version $Revision: 519973 $
  */
-public class PojoComponent extends BeanComponent {
-
-/*
-
-    @Override
-    protected Endpoint<PojoExchange> createEndpoint(String uri, final String remaining, Map parameters) throws Exception {
-        return new PojoEndpoint(uri, this, remaining);
-    }
-*/
+public class ProxyHelper {
 
     /**
      * Creates a Proxy which sends PojoExchange to the endpoint.
-     * @throws Exception 
+     *
+     * @throws Exception
      */
     public static Object createProxy(final Endpoint endpoint, ClassLoader cl, Class interfaces[]) throws Exception {
-    	final Producer producer = endpoint.createProducer();
+        final Producer producer = endpoint.createProducer();
         return Proxy.newProxyInstance(cl, interfaces, new CamelInvocationHandler(endpoint, producer));
     }
-    
+
     /**
      * Creates a Proxy which sends PojoExchange to the endpoint.
-     * @throws Exception 
+     *
+     * @throws Exception
      */
     public static Object createProxy(Endpoint endpoint, Class interfaces[]) throws Exception {
-    	if( interfaces.length < 1 ) {
-    		throw new IllegalArgumentException("You must provide at least 1 interface class.");
-    	}
+        if (interfaces.length < 1) {
+            throw new IllegalArgumentException("You must provide at least 1 interface class.");
+        }
         return createProxy(endpoint, interfaces[0].getClassLoader(), interfaces);
-    }    
+    }
+
     /**
      * Creates a Proxy which sends PojoExchange to the endpoint.
-     * @throws Exception 
+     *
+     * @throws Exception
      */
     @SuppressWarnings("unchecked")
-	public static <T> T createProxy(Endpoint endpoint, ClassLoader cl, Class<T> interfaceClass) throws Exception {
+    public static <T> T createProxy(Endpoint endpoint, ClassLoader cl, Class<T> interfaceClass) throws Exception {
         return (T) createProxy(endpoint, cl, new Class[]{interfaceClass});
     }
-    
+
     /**
      * Creates a Proxy which sends PojoExchange to the endpoint.
-     * @throws Exception 
+     *
+     * @throws Exception
      */
     @SuppressWarnings("unchecked")
-	public static <T> T createProxy(Endpoint endpoint, Class<T> interfaceClass) throws Exception {
+    public static <T> T createProxy(Endpoint endpoint, Class<T> interfaceClass) throws Exception {
         return (T) createProxy(endpoint, new Class[]{interfaceClass});
     }
 

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java?view=auto&rev=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java Thu Aug  2 09:18:30 2007
@@ -0,0 +1,47 @@
+/*
+ * 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.camel.component.timer;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.component.bean.BeanExchange;
+import org.apache.camel.impl.DefaultComponent;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * Represents the component that manages {@link TimerEndpoint}.  It holds the
+ * list of {@link TimerConsumer} objects that are started.
+ *
+ * @version $Revision: 519973 $
+ */
+public class TimerComponent extends DefaultComponent<BeanExchange> {
+    protected final ArrayList<TimerConsumer> timers = new ArrayList<TimerConsumer>();
+
+    boolean addConsumer(TimerConsumer consumer) {
+        return timers.add(consumer);
+    }
+
+    boolean removeConsumer(TimerConsumer consumer) {
+        return timers.remove(consumer);
+    }
+
+    @Override
+    protected Endpoint<BeanExchange> createEndpoint(String uri, String remaining, Map parameters) throws Exception {
+        return new TimerEndpoint(uri, this, remaining);
+    }
+}

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java?view=auto&rev=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java Thu Aug  2 09:18:30 2007
@@ -0,0 +1,125 @@
+/**
+ *
+ * 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.camel.component.timer;
+
+import org.apache.camel.Processor;
+import org.apache.camel.component.bean.BeanExchange;
+import org.apache.camel.component.bean.BeanInvocation;
+import org.apache.camel.impl.DefaultConsumer;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * @version $Revision: 523047 $
+ */
+public class TimerConsumer extends DefaultConsumer<BeanExchange> implements InvocationHandler {
+
+    private final TimerEndpoint endpoint;
+    private Timer timer;
+
+
+    public TimerConsumer(TimerEndpoint endpoint, Processor processor) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        TimerComponent component = endpoint.getComponent();
+        component.addConsumer(this);
+        timer = createTimerAndTask();
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        if (timer != null) {
+            timer.cancel();
+        }
+        TimerComponent component = endpoint.getComponent();
+        component.removeConsumer(this);
+    }
+
+    private Timer createTimerAndTask() {
+
+        final Runnable proxy = createProxy();
+        TimerTask task = new TimerTask() {
+            @Override
+            public void run() {
+                proxy.run();
+            }
+        };
+
+        Timer result = new Timer(endpoint.getTimerName(), endpoint.isDaemon());
+        if (endpoint.isFixedRate()) {
+            if (endpoint.getTime() != null) {
+                result.scheduleAtFixedRate(task, endpoint.getTime(), endpoint.getPeriod());
+            }
+            else {
+                result.scheduleAtFixedRate(task, endpoint.getDelay(), endpoint.getPeriod());
+            }
+        }
+        else {
+            if (endpoint.getTime() != null) {
+                if (endpoint.getPeriod() >= 0) {
+                    result.schedule(task, endpoint.getTime(), endpoint.getPeriod());
+                }
+                else {
+                    result.schedule(task, endpoint.getTime());
+                }
+            }
+            else {
+                if (endpoint.getPeriod() >= 0) {
+                    result.schedule(task, endpoint.getDelay(), endpoint.getPeriod());
+                }
+                else {
+                    result.schedule(task, endpoint.getDelay());
+                }
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Creates a Proxy which generates the inbound PojoExchanges
+     */
+    public Runnable createProxy() {
+        return (Runnable) Proxy.newProxyInstance(Runnable.class.getClassLoader(), new Class[]{Runnable.class}, this);
+    }
+
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        if (!isStarted()) {
+            throw new IllegalStateException("The endpoint is not active: " + getEndpoint().getEndpointUri());
+        }
+        BeanInvocation invocation = new BeanInvocation(proxy, method, args);
+        BeanExchange exchange = getEndpoint().createExchange();
+        exchange.setInvocation(invocation);
+        getProcessor().process(exchange);
+        Throwable fault = exchange.getException();
+        if (fault != null) {
+            throw new InvocationTargetException(fault);
+        }
+        return exchange.getOut().getBody();
+    }
+
+
+}

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java?view=auto&rev=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java Thu Aug  2 09:18:30 2007
@@ -0,0 +1,125 @@
+/*
+ * 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.camel.component.timer;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.bean.BeanExchange;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.URISupport;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * Represents a timer endpoint that can generate periodic inbound PojoExchanges.
+ *
+ * @version $Revision: 519973 $
+ */
+public class TimerEndpoint extends DefaultEndpoint<BeanExchange> {
+
+    private final TimerComponent component;
+    private final String timerName;
+    private Date time;
+    private long period = -1;
+    private long delay = -1;
+    private boolean fixedRate;
+    private boolean daemon = true;
+
+
+    public TimerEndpoint(String fullURI, TimerComponent component, String timerPartURI) throws URISyntaxException {
+        super(fullURI, component);
+        this.component = component;
+
+        // Use a URI to extract query so they can be set as properties on the endpoint.
+        URI u = new URI(timerPartURI);
+        Map options = URISupport.parseParamters(u);
+        IntrospectionSupport.setProperties(this, options);
+        this.timerName = u.getPath();
+
+    }
+
+    public Producer<BeanExchange> createProducer() throws Exception {
+        throw new RuntimeCamelException("Cannot produce to a TimerEndpoint: " + getEndpointUri());
+    }
+
+    public Consumer<BeanExchange> createConsumer(Processor processor) throws Exception {
+        return new TimerConsumer(this, processor);
+    }
+
+    public BeanExchange createExchange() {
+        return new BeanExchange(getContext());
+    }
+
+    public TimerComponent getComponent() {
+        return component;
+    }
+
+    public String getTimerName() {
+        return timerName;
+    }
+
+    public boolean isDaemon() {
+        return daemon;
+    }
+
+    public void setDaemon(boolean daemon) {
+        this.daemon = daemon;
+    }
+
+    public long getDelay() {
+        return delay;
+    }
+
+    public void setDelay(long delay) {
+        this.delay = delay;
+    }
+
+    public boolean isFixedRate() {
+        return fixedRate;
+    }
+
+    public void setFixedRate(boolean fixedRate) {
+        this.fixedRate = fixedRate;
+    }
+
+    public long getPeriod() {
+        return period;
+    }
+
+    public void setPeriod(long period) {
+        this.period = period;
+    }
+
+    public Date getTime() {
+        return time;
+    }
+
+    public void setTime(Date time) {
+        this.time = time;
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+}

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/package.html
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/package.html?view=auto&rev=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/package.html (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/package.html Thu Aug  2 09:18:30 2007
@@ -0,0 +1,26 @@
+<!--
+    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.
+-->
+<html>
+<head>
+</head>
+<body>
+
+The <a href="http://activemq.apache.org/camel/timer.html">Timer Component</a> extends the POJO component to provide a
+simple timer
+
+</body>
+</html>

Modified: activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/pojo
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/pojo?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/pojo (original)
+++ activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/pojo Thu Aug  2 09:18:30 2007
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-class=org.apache.camel.component.pojo.PojoComponent
\ No newline at end of file
+class=org.apache.camel.component.bean.BeanComponent
\ No newline at end of file

Modified: activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/timer
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/timer?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/timer (original)
+++ activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/timer Thu Aug  2 09:18:30 2007
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-class=org.apache.camel.component.pojo.timer.TimerComponent
+class=org.apache.camel.component.timer.TimerComponent

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java Thu Aug  2 09:18:30 2007
@@ -21,6 +21,7 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.component.bean.ProxyHelper;
 import org.apache.camel.util.jndi.JndiContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
@@ -53,7 +54,7 @@
         
         // START SNIPPET: invoke
         Endpoint endpoint = camelContext.getEndpoint("direct:hello");
-        ISay proxy = PojoComponent.createProxy(endpoint, ISay.class);
+        ISay proxy = ProxyHelper.createProxy(endpoint, ISay.class);
         String rc = proxy.say();
         assertEquals("Good Bye!", rc);
         // END SNIPPET: invoke

Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteTest.java?view=auto&rev=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteTest.java (added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteTest.java Thu Aug  2 09:18:30 2007
@@ -0,0 +1,64 @@
+/**
+ *
+ * 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.camel.component.timer;
+
+import junit.framework.TestCase;
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.util.jndi.JndiContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * @version $Revision: 520220 $
+ */
+public class TimerRouteTest extends TestCase {
+    private static final transient Log log = LogFactory.getLog(TimerRouteTest.class);
+
+    public void testPojoRoutes() throws Exception {
+        final AtomicInteger hitCount = new AtomicInteger();
+
+        JndiContext context = new JndiContext();
+        context.bind("bar", new Runnable() {
+            public void run() {
+                log.debug("hit");
+                hitCount.incrementAndGet();
+            }
+        });
+
+        CamelContext camelContext = new DefaultCamelContext(context);
+
+        // lets add some routes
+        camelContext.addRoutes(new RouteBuilder() {
+            public void configure() {
+                from("timer://foo?fixedRate=true&delay=0&period=500").to("pojo:bar");
+            }
+        });
+
+        camelContext.start();
+
+        // now lets wait for the timer to fire a few times.
+        Thread.sleep(1000 * 2);
+        assertTrue("", hitCount.get() >= 3);
+
+        camelContext.stop();
+    }
+}

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java Thu Aug  2 09:18:30 2007
@@ -18,9 +18,8 @@
 package org.apache.camel.impl;
 
 import junit.framework.TestCase;
-
 import org.apache.camel.Component;
-import org.apache.camel.component.pojo.PojoComponent;
+import org.apache.camel.component.bean.BeanComponent;
 
 /**
  * @version $Revision: 525634 $
@@ -29,15 +28,15 @@
 
 	public void testAutoCreateComponentsOn() {
 		DefaultCamelContext ctx = new DefaultCamelContext();
-		Component component = ctx.getComponent("pojo");
+		Component component = ctx.getComponent("bean");
 		assertNotNull(component);
-		assertEquals(component.getClass(), PojoComponent.class);
+		assertEquals(component.getClass(), BeanComponent.class);
 	}
 	
 	public void testAutoCreateComponentsOff() {
 		DefaultCamelContext ctx = new DefaultCamelContext();
 		ctx.setAutoCreateComponents(false);
-		Component component = ctx.getComponent("pojo");
+		Component component = ctx.getComponent("bean");
 		assertNull(component);		
 	}
 	

Modified: activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java (original)
+++ activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java Thu Aug  2 09:18:30 2007
@@ -21,13 +21,13 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.component.pojo.PojoExchange;
+import org.apache.camel.component.bean.BeanExchange;
 import org.apache.camel.impl.DefaultComponent;
 
 /**
  * @version $Revision:520964 $
  */
-public class RmiComponent extends DefaultComponent<PojoExchange> {
+public class RmiComponent extends DefaultComponent<BeanExchange> {
 
 	public RmiComponent() {
 	}
@@ -37,7 +37,7 @@
 	}
 
 	@Override
-	protected Endpoint<PojoExchange> createEndpoint(String uri,
+	protected Endpoint<BeanExchange> createEndpoint(String uri,
 			String remaining, Map parameters) throws Exception {
 		return new RmiEndpoint(uri, this);
 	}

Modified: activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java (original)
+++ activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java Thu Aug  2 09:18:30 2007
@@ -27,8 +27,8 @@
 
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
-import org.apache.camel.component.pojo.PojoExchange;
-import org.apache.camel.component.pojo.PojoInvocation;
+import org.apache.camel.component.bean.BeanExchange;
+import org.apache.camel.component.bean.BeanInvocation;
 import org.apache.camel.impl.DefaultConsumer;
 
 /**
@@ -36,7 +36,7 @@
  *
  * @version $Revision: 533758 $
  */
-public class RmiConsumer extends DefaultConsumer<PojoExchange> implements InvocationHandler {
+public class RmiConsumer extends DefaultConsumer<BeanExchange> implements InvocationHandler {
 
 	private final RmiEndpoint endpoint;
 	private Remote stub;
@@ -86,8 +86,8 @@
         if (!isStarted()) {
             throw new IllegalStateException("The endpoint is not active: " + getEndpoint().getEndpointUri());
         }
-        PojoInvocation invocation = new PojoInvocation(proxy, method, args);
-        PojoExchange exchange = getEndpoint().createExchange();
+        BeanInvocation invocation = new BeanInvocation(proxy, method, args);
+        BeanExchange exchange = getEndpoint().createExchange();
         exchange.setInvocation(invocation);
         getProcessor().process(exchange);
         Throwable fault = exchange.getException();

Modified: activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java Thu Aug  2 09:18:30 2007
@@ -16,6 +16,13 @@
  */
 package org.apache.camel.component.rmi;
 
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.bean.BeanExchange;
+import org.apache.camel.impl.DefaultEndpoint;
+
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.rmi.RemoteException;
@@ -24,17 +31,10 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.component.pojo.PojoExchange;
-import org.apache.camel.impl.DefaultEndpoint;
-
 /**
  * @version $Revision:520964 $
  */
-public class RmiEndpoint extends DefaultEndpoint<PojoExchange> {
+public class RmiEndpoint extends DefaultEndpoint<BeanExchange> {
 
 	private List<Class> remoteInterfaces;
 	private ClassLoader classLoader;
@@ -50,17 +50,17 @@
 		return false;
 	}
 
-	public PojoExchange createExchange() {
-		return new PojoExchange(getContext());
+	public BeanExchange createExchange() {
+		return new BeanExchange(getContext());
 	}
 
-	public Consumer<PojoExchange> createConsumer(Processor processor) throws Exception {
+	public Consumer<BeanExchange> createConsumer(Processor processor) throws Exception {
 		if( remoteInterfaces == null || remoteInterfaces.size()==0 )
 			throw new RuntimeCamelException("To create an RMI consumer, the RMI endpoint's remoteInterfaces property must be be configured.");
 		return new RmiConsumer(this, processor);
 	}
 
-	public Producer<PojoExchange> createProducer() throws Exception {
+	public Producer<BeanExchange> createProducer() throws Exception {
 		return new RmiProducer(this);
 	}
 

Modified: activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiProducer.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiProducer.java (original)
+++ activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiProducer.java Thu Aug  2 09:18:30 2007
@@ -17,17 +17,17 @@
  */
 package org.apache.camel.component.rmi;
 
+import org.apache.camel.Exchange;
+import org.apache.camel.component.bean.BeanProcessor;
+import org.apache.camel.component.bean.DefaultMethodInvocationStrategy;
+import org.apache.camel.impl.DefaultProducer;
+
 import java.rmi.AccessException;
 import java.rmi.NotBoundException;
 import java.rmi.Remote;
 import java.rmi.RemoteException;
 import java.rmi.registry.Registry;
 
-import org.apache.camel.component.pojo.PojoEndpoint;
-import org.apache.camel.component.pojo.PojoExchange;
-import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.Exchange;
-
 /**
  * @version $Revision: 533076 $
  */
@@ -35,16 +35,19 @@
 
 	private final RmiEndpoint endpoint;
 	private Remote remote;
+    private BeanProcessor beanProcessor;
 
-	public RmiProducer(RmiEndpoint endpoint) throws AccessException, RemoteException, NotBoundException {
+    public RmiProducer(RmiEndpoint endpoint) throws AccessException, RemoteException, NotBoundException {
 		super(endpoint);
 		this.endpoint = endpoint;
 	}
 
-	public void process(Exchange exchange) throws AccessException, RemoteException, NotBoundException {
-        PojoExchange pojoExchange = endpoint.toExchangeType(exchange);
-        PojoEndpoint.invoke(getRemote(), pojoExchange);
-        exchange.copyFrom(pojoExchange);
+	public void process(Exchange exchange) throws Exception {
+        if (beanProcessor == null) {
+            // TODO pull the invocation strategy out of the context?
+            beanProcessor = new BeanProcessor(getRemote(), new DefaultMethodInvocationStrategy());
+        }
+        beanProcessor.process(exchange);
     }
 
 	public Remote getRemote() throws AccessException, RemoteException, NotBoundException {

Modified: activemq/camel/trunk/components/camel-rmi/src/test/java/org/apache/camel/component/rmi/RmiRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rmi/src/test/java/org/apache/camel/component/rmi/RmiRouteTest.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/components/camel-rmi/src/test/java/org/apache/camel/component/rmi/RmiRouteTest.java (original)
+++ activemq/camel/trunk/components/camel-rmi/src/test/java/org/apache/camel/component/rmi/RmiRouteTest.java Thu Aug  2 09:18:30 2007
@@ -21,7 +21,7 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.pojo.PojoComponent;
+import org.apache.camel.component.bean.ProxyHelper;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.util.jndi.JndiContext;
 
@@ -67,7 +67,7 @@
         
         // START SNIPPET: invoke
         Endpoint endpoint = camelContext.getEndpoint("direct:hello");
-        ISay proxy = PojoComponent.createProxy(endpoint, ISay.class);
+        ISay proxy = ProxyHelper.createProxy(endpoint, ISay.class);
         String rc = proxy.say();
         assertEquals("Good Bye!", rc);
         // END SNIPPET: invoke

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java?view=diff&rev=562166&r1=562165&r2=562166
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java Thu Aug  2 09:18:30 2007
@@ -19,7 +19,7 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.component.pojo.PojoComponent;
+import org.apache.camel.component.bean.ProxyHelper;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.remoting.support.UrlBasedRemoteAccessor;
 
@@ -48,7 +48,7 @@
                 }
             }
 
-            this.serviceProxy = PojoComponent.createProxy(endpoint, getServiceInterface());
+            this.serviceProxy = ProxyHelper.createProxy(endpoint, getServiceInterface());
         }
         catch (Exception e) {
             throw new IllegalArgumentException(e);



Mime
View raw message