You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2007/04/19 19:53:56 UTC

svn commit: r530499 - in /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct: DirectComponent.java DirectEndpoint.java

Author: chirino
Date: Thu Apr 19 10:53:55 2007
New Revision: 530499

URL: http://svn.apache.org/viewvc?view=rev&rev=530499
Log:
Better endpoint configuration

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java?view=diff&rev=530499&r1=530498&r2=530499
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java Thu Apr 19 10:53:55 2007
@@ -16,12 +16,17 @@
  */
 package org.apache.camel.component.direct;
 
+import java.net.URI;
+import java.util.Map;
 import java.util.concurrent.ScheduledExecutorService;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
+import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.URISupport;
 
 /**
  * Represents the component that manages {@link DirectEndpoint}.  It holds the 
@@ -43,7 +48,16 @@
 	}
 
 	public Endpoint<E> resolveEndpoint(String uri) throws Exception {
-		return new DirectEndpoint<E>(uri,this);
+
+        ObjectHelper.notNull(getCamelContext(), "camelContext");        
+        URI u = new URI(uri);
+        Map parameters = URISupport.parseParamters(u);
+
+        Endpoint<E> endpoint = new DirectEndpoint<E>(uri,this);
+        if (parameters != null) {
+            IntrospectionSupport.setProperties(endpoint, parameters);
+        }
+        return endpoint;
 	}
 
 	public void setCamelContext(CamelContext context) {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java?view=diff&rev=530499&r1=530498&r2=530499
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java Thu Apr 19 10:53:55 2007
@@ -38,7 +38,7 @@
 
 	private final CopyOnWriteArrayList<DefaultConsumer<E>> consumers = new CopyOnWriteArrayList<DefaultConsumer<E>>();
 	
-	boolean allowMutlipleConsumers=true;	
+	boolean allowMultipleConsumers=true;	
 	
     public DirectEndpoint(String uri, DirectComponent<E> component) {
         super(uri, component);
@@ -62,7 +62,7 @@
 		DefaultConsumer<E> consumer = new DefaultConsumer<E>(this, processor) {
 			@Override
 			public void start() throws Exception {
-				if( !allowMutlipleConsumers && !consumers.isEmpty() )
+				if( !allowMultipleConsumers && !consumers.isEmpty() )
 					throw new IllegalStateException("Endpoint "+getEndpointUri()+" only allows 1 active consumer but you attempted to start a 2nd consumer.");
 				
 				consumers.add(this);
@@ -85,11 +85,11 @@
         return (E) new DefaultExchange(getContext());
     }
 
-	public boolean isAllowMutlipleConsumers() {
-		return allowMutlipleConsumers;
+	public boolean isAllowMultipleConsumers() {
+		return allowMultipleConsumers;
 	}
-	public void setAllowMutlipleConsumers(boolean allowMutlipleConsumers) {
-		this.allowMutlipleConsumers = allowMutlipleConsumers;
+	public void setAllowMultipleConsumers(boolean allowMutlipleConsumers) {
+		this.allowMultipleConsumers = allowMutlipleConsumers;
 	}