You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2008/11/12 09:17:22 UTC

svn commit: r713308 - in /activemq/camel/branches/camel-1.x: ./ components/camel-cxf/src/test/java/org/apache/camel/component/cxf/ components/camel-sql/ components/camel-sql/src/main/java/org/apache/camel/component/sql/

Author: davsclaus
Date: Wed Nov 12 00:17:19 2008
New Revision: 713308

URL: http://svn.apache.org/viewvc?rev=713308&view=rev
Log:
Merged revisions 713290 via svnmerge from 
https://svn.apache.org/repos/asf/activemq/camel/trunk

........
  r713290 | davsclaus | 2008-11-12 08:35:48 +0100 (on, 12 nov 2008) | 1 line
  
  CAMEL-1063: Added dataSourceRef option to lookup DS in registry
........

Modified:
    activemq/camel/branches/camel-1.x/   (props changed)
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTestSupport.java   (props changed)
    activemq/camel/branches/camel-1.x/components/camel-sql/pom.xml
    activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
    activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlEndpoint.java

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 12 00:17:19 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713273,713292
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713273,713290,713292

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Propchange: activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTestSupport.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 12 00:17:19 2008
@@ -1 +1 @@
-/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTestSupport.java:713292
+/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTestSupport.java:713290,713292

Modified: activemq/camel/branches/camel-1.x/components/camel-sql/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-sql/pom.xml?rev=713308&r1=713307&r2=713308&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-sql/pom.xml (original)
+++ activemq/camel/branches/camel-1.x/components/camel-sql/pom.xml Wed Nov 12 00:17:19 2008
@@ -67,6 +67,11 @@
 			<artifactId>junit</artifactId>
 			<scope>test</scope>
 		</dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>test</scope>
+        </dependency>
 	    <dependency>
 	      <groupId>hsqldb</groupId>
 	      <artifactId>hsqldb</artifactId>

Modified: activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java?rev=713308&r1=713307&r2=713308&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java (original)
+++ activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java Wed Nov 12 00:17:19 2008
@@ -28,7 +28,6 @@
  * @version $Revision:520964 $
  */
 public class SqlComponent extends DefaultComponent {
-
     private DataSource dataSource;
 
     public SqlComponent() {
@@ -39,12 +38,20 @@
     }
 
     @Override
-    protected Endpoint createEndpoint(String uri, String remaining, Map parameters)
-        throws Exception {
+    protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
+        String dataSourceRef = getAndRemoveParameter(parameters, "dataSourceRef", String.class);
+        if (dataSourceRef != null) {
+            dataSource = getCamelContext().getRegistry().lookup(dataSourceRef, DataSource.class);
+            if (dataSource == null) {
+                throw new IllegalArgumentException("DataSource " + dataSourceRef + " not found in registry");
+            }
+        }
+        
         return new SqlEndpoint(uri, remaining.replaceAll("#", "?"), this, dataSource, parameters);
     }
 
     public void setDataSource(DataSource dataSource) {
         this.dataSource = dataSource;
     }
+
 }

Modified: activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlEndpoint.java?rev=713308&r1=713307&r2=713308&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlEndpoint.java (original)
+++ activemq/camel/branches/camel-1.x/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlEndpoint.java Wed Nov 12 00:17:19 2008
@@ -32,13 +32,9 @@
  * SQL Endpoint. Endpoint URI should contain valid SQL statement, but instead of
  * question marks (that are parameter placeholders), sharp signs should be used.
  * This is because in camel question mark has other meaning.
- *
- * @author romkal
  */
 public class SqlEndpoint extends DefaultEndpoint {
-
     private JdbcTemplate jdbcTemplate;
-
     private String query;
 
     public SqlEndpoint(String uri, String query, Component component, DataSource dataSource, Map parameters) throws Exception {
@@ -55,7 +51,7 @@
     }
     
     public Consumer createConsumer(Processor processor) throws Exception {
-        throw new UnsupportedOperationException("Not yet implemented");
+        throw new UnsupportedOperationException("Not implemented");
     }
 
     public Producer createProducer() throws Exception {