You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2013/10/21 13:20:32 UTC
git commit: CAMEL-6877: Fixed the example camel-examples-etl being
broken as well as polished it's codebase.
Updated Branches:
refs/heads/master dabc2dbaa -> ad6024b68
CAMEL-6877: Fixed the example camel-examples-etl being broken as well as polished it's codebase.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ad6024b6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ad6024b6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ad6024b6
Branch: refs/heads/master
Commit: ad6024b68d3b98fec423eaa22ac28b468c2a4a67
Parents: dabc2db
Author: Babak Vahdat <bv...@apache.org>
Authored: Mon Oct 21 13:20:22 2013 +0200
Committer: Babak Vahdat <bv...@apache.org>
Committed: Mon Oct 21 13:20:22 2013 +0200
----------------------------------------------------------------------
.../apache/camel/component/jpa/JpaProducer.java | 4 +-
.../camel/component/jpa/JpaUseMergeTest.java | 2 +-
examples/camel-example-etl/pom.xml | 177 +++----------------
.../camel/example/etl/CustomerEntity.java | 13 +-
.../camel/example/etl/CustomerTransformer.java | 47 +++--
.../org/apache/camel/example/etl/EtlRoutes.java | 1 -
.../src/main/resources/META-INF/persistence.xml | 31 ++++
.../resources/META-INF/spring/camel-context.xml | 50 ++++++
.../src/main/resources/log4j.properties | 32 +---
.../eclipselink/META-INF/persistence.xml | 34 ----
.../META-INF/spring/camel-context.xml | 54 ------
.../src/profiles/eclipselink/log4j.properties | 36 ----
.../profiles/hibernate/META-INF/persistence.xml | 26 ---
.../hibernate/META-INF/spring/camel-context.xml | 62 -------
.../src/profiles/hibernate/log4j.properties | 36 ----
.../profiles/openjpa/META-INF/persistence.xml | 27 ---
.../openjpa/META-INF/spring/camel-context.xml | 55 ------
.../camel/example/etl/IntegrationTest.java | 4 +-
18 files changed, 161 insertions(+), 530 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java
index 80cd486..cf78d26 100644
--- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java
+++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java
@@ -51,6 +51,8 @@ public class JpaProducer extends DefaultProducer {
}
public void process(final Exchange exchange) {
+ exchange.getIn().setHeader(JpaConstants.ENTITYMANAGER, entityManager);
+
final Object values = expression.evaluate(exchange, Object.class);
if (values != null) {
transactionTemplate.execute(new TransactionCallback<Object>() {
@@ -98,8 +100,6 @@ public class JpaProducer extends DefaultProducer {
}
});
}
-
- exchange.getIn().setHeader(JpaConstants.ENTITYMANAGER, entityManager);
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java
index 100f1f3..a509730 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java
@@ -50,7 +50,7 @@ public class JpaUseMergeTest extends AbstractJpaMethodTest {
assertEntitiesInDatabase(1, Customer.class.getName());
assertEntitiesInDatabase(1, Address.class.getName());
- // do detach the persisted entity first before modifying it, as we intend to merge it later on below
+ // do detach the persisted entity first before modifying it as we intend to merge it later on below
entityManager.detach(customer);
customer.setName("Max Mustermann");
customer.getAddress().setAddressLine1("Musterstr. 1");
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/pom.xml b/examples/camel-example-etl/pom.xml
index 667e896..918eea1 100755
--- a/examples/camel-example-etl/pom.xml
+++ b/examples/camel-example-etl/pom.xml
@@ -53,12 +53,13 @@
<artifactId>camel-juel</artifactId>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>${openjpa-version}</version>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
</dependency>
<!-- lets use log4j -->
@@ -66,23 +67,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jta_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- </dependency>
<!-- testing -->
<dependency>
@@ -117,6 +101,29 @@
</execution>
</executions>
</plugin>
+
+ <!-- Will enhance classes as we run in a non JEE env -->
+ <plugin>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-maven-plugin</artifactId>
+ <version>${openjpa-version}</version>
+ <configuration>
+ <persistenceXmlFile>${project.basedir}/src/main/resources/META-INF/persistence.xml</persistenceXmlFile>
+ <includes>org/apache/camel/example/etl/*Entity.class</includes>
+ <addDefaultConstructor>true</addDefaultConstructor>
+ <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>enhancer</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
<!-- Allows the example to be run via 'mvn camel:run' -->
<plugin>
<groupId>org.apache.camel</groupId>
@@ -136,132 +143,4 @@
</plugins>
</build>
- <profiles>
- <!-- Hibernate - Derby -->
- <profile>
- <id>hibernate</id>
- <properties>
- <camel.osgi.import.additional>
- org.apache.derby.*,
- org.hibernate.ejb
- </camel.osgi.import.additional>
- </properties>
- <build>
- <resources>
- <resource>
- <directory>${basedir}/src/profiles/hibernate</directory>
- </resource>
- <resource>
- <directory>${basedir}/src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- </dependency>
- </dependencies>
- </profile>
-
- <!-- OpenJPA - Derby -->
- <profile>
- <id>openjpa</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <resources>
- <resource>
- <directory>${basedir}/src/profiles/openjpa</directory>
- </resource>
- <resource>
- <directory>${basedir}/src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
- <!-- Will enhance classes as we run in a non J2EE 5 env -->
- <plugins>
- <plugin>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-maven-plugin</artifactId>
- <version>${openjpa-version}</version>
- <configuration>
- <persistenceXmlFile>${project.basedir}/src/profiles/openjpa/META-INF/persistence.xml</persistenceXmlFile>
- <includes>org/apache/camel/example/etl/*Entity.class</includes>
- <addDefaultConstructor>true</addDefaultConstructor>
- <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
- </configuration>
- <executions>
- <execution>
- <id>enhancer</id>
- <phase>process-classes</phase>
- <goals>
- <goal>enhance</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa</artifactId>
- <version>${openjpa-version}</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>${commons-logging-version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- <properties>
- <camel.osgi.import.additional>
- org.apache.derby.*
- </camel.osgi.import.additional>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-persistence-jdbc</artifactId>
- </dependency>
- </dependencies>
- </profile>
-
- <!-- EclipseLink - Derby -->
- <profile>
- <id>eclipselink</id>
- <build>
- <resources>
- <resource>
- <directory>${basedir}/src/profiles/eclipselink</directory>
- </resource>
- <resource>
- <directory>${basedir}/src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
- </build>
- <properties>
- <camel.osgi.import.additional>
- org.apache.derby.*
- </camel.osgi.import.additional>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>eclipselink</artifactId>
- <version>2.3.2</version>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <id>Eclipse</id>
- <url>http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo</url>
- </repository>
- </repositories>
- </profile>
- </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java b/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java
index 9965cc0..efc72c5 100644
--- a/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java
+++ b/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java
@@ -19,6 +19,7 @@ package org.apache.camel.example.etl;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.NamedQuery;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -29,9 +30,10 @@ import javax.xml.bind.annotation.XmlRootElement;
*
* @version
*/
-@Entity(name = "customer")
+@Entity
@XmlRootElement(name = "customer")
@XmlAccessorType(XmlAccessType.FIELD)
+@NamedQuery(name = "findCustomerByUsername", query = "SELECT c FROM CustomerEntity c WHERE c.userName = :userName")
public class CustomerEntity {
@XmlAttribute
private Long id;
@@ -43,10 +45,6 @@ public class CustomerEntity {
private String zip;
private String phone;
- public String toString() {
- return "Customer[userName: " + getUserName() + " firstName: " + getFirstName() + " surname: " + getSurname() + "]";
- }
-
@Id
@GeneratedValue
public Long getId() {
@@ -112,4 +110,9 @@ public class CustomerEntity {
public void setZip(String zip) {
this.zip = zip;
}
+
+ public String toString() {
+ return "Customer[userName: " + getUserName() + " firstName: " + getFirstName() + " surname: " + getSurname() + "]";
+ }
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java b/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java
index 5603609..05cc3fb 100644
--- a/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java
+++ b/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java
@@ -18,12 +18,18 @@ package org.apache.camel.example.etl;
import java.util.List;
+import javax.persistence.EntityManager;
+
import org.apache.camel.Converter;
import org.apache.camel.Exchange;
-import org.apache.camel.util.CastUtils;
+import org.apache.camel.component.jpa.JpaConstants;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.orm.jpa.JpaTemplate;
+
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallback;
+import org.springframework.transaction.support.TransactionTemplate;
/**
* A Message Transformer of an XML document to a Customer entity bean
@@ -39,15 +45,14 @@ public class CustomerTransformer {
/**
* A transformation method to convert a person document into a customer
* entity
- * @throws Exception
*/
@Converter
public CustomerEntity toCustomer(PersonDocument doc, Exchange exchange) throws Exception {
- JpaTemplate template = exchange.getIn().getHeader("CamelJpaTemplate", JpaTemplate.class);
+ EntityManager entityManager = exchange.getIn().getHeader(JpaConstants.ENTITYMANAGER, EntityManager.class);
+ TransactionTemplate transactionTemplate = exchange.getContext().getRegistry().lookupByNameAndType("transactionTemplate", TransactionTemplate.class);
-
String user = doc.getUser();
- CustomerEntity customer = findCustomerByName(template, user);
+ CustomerEntity customer = findCustomerByName(transactionTemplate, entityManager, user);
// let's convert information from the document into the entity bean
customer.setUserName(user);
@@ -55,23 +60,31 @@ public class CustomerTransformer {
customer.setSurname(doc.getLastName());
customer.setCity(doc.getCity());
- LOG.debug("Created object customer: " + customer);
+ LOG.info("Created object customer: {}", customer);
return customer;
}
/**
* Finds a customer for the given username
*/
- protected CustomerEntity findCustomerByName(JpaTemplate template, String user) throws Exception {
- List<CustomerEntity> list = CastUtils.cast(template.find("select x from customer"
- + " x where x.userName = ?1", user));
- if (list.isEmpty()) {
- CustomerEntity answer = new CustomerEntity();
- answer.setUserName(user);
- return answer;
- } else {
- return list.get(0);
- }
+ protected CustomerEntity findCustomerByName(TransactionTemplate transactionTemplate, final EntityManager entityManager, final String userName) throws Exception {
+ return transactionTemplate.execute(new TransactionCallback<CustomerEntity>() {
+ public CustomerEntity doInTransaction(TransactionStatus status) {
+ entityManager.joinTransaction();
+ List<CustomerEntity> list = entityManager.createNamedQuery("findCustomerByUsername", CustomerEntity.class).setParameter("userName", userName).getResultList();
+ CustomerEntity answer;
+ if (list.isEmpty()) {
+ answer = new CustomerEntity();
+ answer.setUserName(userName);
+ LOG.info("Created a new CustomerEntity {} as no matching persisted entity found.", answer);
+ } else {
+ answer = list.get(0);
+ LOG.info("Found a matching CustomerEntity {} having the userName {}.", answer, userName);
+ }
+
+ return answer;
+ }
+ });
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java b/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java
index d597e91..2d2be2e 100644
--- a/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java
+++ b/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java
@@ -36,7 +36,6 @@ public class EtlRoutes extends SpringRouteBuilder {
from("jpa:org.apache.camel.example.etl.CustomerEntity?consumeDelete=false&delay=3000&consumeLockEntity=false")
.setHeader(Exchange.FILE_NAME, el("${in.body.userName}.xml"))
.to("file:target/customers");
-
}
}
// END SNIPPET: example
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/main/resources/META-INF/persistence.xml b/examples/camel-example-etl/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..31fc798
--- /dev/null
+++ b/examples/camel-example-etl/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+
+ <persistence-unit name="camel" transaction-type="RESOURCE_LOCAL">
+ <class>org.apache.camel.example.etl.CustomerEntity</class>
+ <properties>
+ <property name="openjpa.ConnectionURL" value="jdbc:derby:target/derby;create=true" />
+ <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver" />
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
+ <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=TRACE" />
+ <property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=72" />
+ </properties>
+ </persistence-unit>
+</persistence>
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/main/resources/META-INF/spring/camel-context.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/main/resources/META-INF/spring/camel-context.xml b/examples/camel-example-etl/src/main/resources/META-INF/spring/camel-context.xml
new file mode 100644
index 0000000..8b1cc2f
--- /dev/null
+++ b/examples/camel-example-etl/src/main/resources/META-INF/spring/camel-context.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring" depends-on="entityManagerFactory">
+ <package>org.apache.camel.example.etl</package>
+ </camelContext>
+
+ <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent" depends-on="entityManagerFactory">
+ <property name="entityManagerFactory" ref="entityManagerFactory" />
+ <property name="transactionManager" ref="transactionManager" />
+ </bean>
+
+ <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
+ <property name="persistenceUnitName" value="camel" />
+ <property name="jpaVendorAdapter" ref="jpaAdapter" />
+ </bean>
+
+ <bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
+ <property name="databasePlatform" value="org.apache.openjpa.jdbc.sql.DerbyDictionary" />
+ <property name="database" value="DERBY" />
+ </bean>
+
+ <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+ <property name="entityManagerFactory" ref="entityManagerFactory" />
+ </bean>
+
+ <bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
+ <property name="transactionManager" ref="transactionManager" />
+ </bean>
+
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/main/resources/log4j.properties b/examples/camel-example-etl/src/main/resources/log4j.properties
index 377d54d..54d84e7 100644
--- a/examples/camel-example-etl/src/main/resources/log4j.properties
+++ b/examples/camel-example-etl/src/main/resources/log4j.properties
@@ -15,29 +15,15 @@
## limitations under the License.
## ------------------------------------------------------------------------
-#
-# The logging properties used
-#
-log4j.rootLogger=INFO, out
+# default properties to initialise log4j
+log4j.rootLogger=INFO, console
-# openjpa properties
-log4j.category.openjpa.Tool=INFO
-log4j.category.openjpa.Runtime=INFO
-log4j.category.openjpa.Remote=WARN
-log4j.category.openjpa.DataCache=WARN
-log4j.category.openjpa.MetaData=WARN
-log4j.category.openjpa.Enhance=WARN
-log4j.category.openjpa.Query=WARN
-log4j.category.openjpa.jdbc.SQL=DEBUG
-log4j.category.openjpa.jdbc.JDBC=WARN
-log4j.category.openjpa.jdbc.Schema=WARN
-
-# uncomment the next line to debug Camel
+# settings for specific packages
+#log4j.logger.org.apache.camel.component.file=DEBUG
+#log4j.logger.org.apache.camel.component.jpa=DEBUG
#log4j.logger.org.apache.camel=DEBUG
-#log4j.logger.org.hibernate=WARN
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+# Console appender
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml b/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml
deleted file mode 100644
index 2ba88a3..0000000
--- a/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Copyright 2006 The Apache Software Foundation. Licensed 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.
- -->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
-
- <persistence-unit name="camel" transaction-type="RESOURCE_LOCAL">
- <class>org.apache.camel.example.etl.CustomerEntity</class>
-
- <properties>
- <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
- <property name="javax.persistence.jdbc.url" value="jdbc:derby:target/derby;create=true" />
- <property name="javax.persistence.jdbc.user" value="sa" />
- <property name="javax.persistence.jdbc.password" value="" />
- <!-- property name="eclipselink.logging.file" value="target/camel-example-etl.log" />
- <property name="eclipselink.logging.level" value="FINE" /-->
- <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
- <property name="eclipselink.ddl-generation.output-mode" value="database" />
- <!-- <property name="eclipselink.logging.thread" value="false" />-->
- <!-- <property name="eclipselink.logging.session" value="false" />-->
- <!-- <property name="eclipselink.logging.exceptions" value="false" />-->
- </properties>
-
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml b/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml
deleted file mode 100644
index 1dacb24..0000000
--- a/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- 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.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:camel="http://camel.apache.org/schema/spring"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
-
- <camel:camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring">
- <camel:package>org.apache.camel.example.etl</camel:package>
- </camel:camelContext>
-
- <!-- Added for OSGI platform to allow -->
- <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
- <property name="entityManagerFactory" ref="entityManagerFactory" />
- </bean>
-
- <bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
- <property name="transactionManager">
- <bean class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory" />
- </bean>
- </property>
- </bean>
-
- <bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
- <property name="entityManagerFactory" ref="entityManagerFactory" />
- </bean>
-
- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
- <property name="persistenceUnitName" value="camel" />
- <property name="jpaVendorAdapter" ref="jpaAdapter" />
- </bean>
-
- <bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
- <property name="databasePlatform" value="org.eclipse.persistence.platform.database.DerbyPlatform" />
- <property name="database" value="DERBY" />
- </bean>
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties b/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties
deleted file mode 100644
index 6cd1f3c..0000000
--- a/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-## ------------------------------------------------------------------------
-## 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 for eclipse testing, We want to see INFO output on the console.
-#
-log4j.rootLogger=WARN, file
-
-# uncomment the next line to debug Camel
-log4j.logger.org.apache.camel=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/camel-example-etl.log
-log4j.appender.file.append=true
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml b/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml
deleted file mode 100644
index 68dcd7b..0000000
--- a/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Copyright 2006 The Apache Software Foundation. Licensed 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.
- -->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
-
- <persistence-unit name="camel" transaction-type="RESOURCE_LOCAL">
- <class>org.apache.camel.example.etl.CustomerEntity</class>
-
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
- <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
- <property name="hibernate.connection.url" value="jdbc:derby:target/derby;create=true"/>
- <property name="hibernate.hbm2ddl.auto" value="create"/>
- </properties>
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml b/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml
deleted file mode 100644
index 351ef9e..0000000
--- a/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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 default Application Context used by the org.apache.camel.spring.Main if there
- is no /META-INF/sprint.xml
-
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:camel="http://camel.apache.org/schema/spring"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
-
- <camel:camelContext id="camel" trace="true">
- <camel:package>org.apache.camel.example.etl</camel:package>
- </camel:camelContext>
-
- <!-- Added for OSGI platform to allow -->
- <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
- <property name="entityManagerFactory" ref="entityManagerFactory"/>
- </bean>
-
- <bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
- <property name="transactionManager">
- <bean class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory"/>
- </bean>
- </property>
- </bean>
-
- <bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
- <property name="entityManagerFactory" ref="entityManagerFactory"/>
- </bean>
-
- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
- <property name="persistenceUnitName" value="camel"/>
- <property name="jpaVendorAdapter" ref="jpaAdapter"/>
- </bean>
-
- <bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
- <property name="databasePlatform" value="org.hibernate.dialect.DerbyDialect" />
- </bean>
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/profiles/hibernate/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/profiles/hibernate/log4j.properties b/examples/camel-example-etl/src/profiles/hibernate/log4j.properties
deleted file mode 100644
index 6cd1f3c..0000000
--- a/examples/camel-example-etl/src/profiles/hibernate/log4j.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-## ------------------------------------------------------------------------
-## 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 for eclipse testing, We want to see INFO output on the console.
-#
-log4j.rootLogger=WARN, file
-
-# uncomment the next line to debug Camel
-log4j.logger.org.apache.camel=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/camel-example-etl.log
-log4j.appender.file.append=true
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/profiles/openjpa/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/profiles/openjpa/META-INF/persistence.xml b/examples/camel-example-etl/src/profiles/openjpa/META-INF/persistence.xml
deleted file mode 100644
index 74ec1ea..0000000
--- a/examples/camel-example-etl/src/profiles/openjpa/META-INF/persistence.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Copyright 2006 The Apache Software Foundation. Licensed 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.
- -->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
-
- <persistence-unit name="camel" transaction-type="RESOURCE_LOCAL">
- <class>org.apache.camel.example.etl.CustomerEntity</class>
-
- <properties>
- <property name="openjpa.ConnectionURL" value="jdbc:derby:target/derby;create=true" />
- <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver" />
- <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
- <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=TRACE, Tool=INFO, SQL=TRACE" />
- <property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=72" />
- </properties>
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/profiles/openjpa/META-INF/spring/camel-context.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/profiles/openjpa/META-INF/spring/camel-context.xml b/examples/camel-example-etl/src/profiles/openjpa/META-INF/spring/camel-context.xml
deleted file mode 100644
index 7ef3d77..0000000
--- a/examples/camel-example-etl/src/profiles/openjpa/META-INF/spring/camel-context.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- 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.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://camel.apache.org/schema/spring
- http://camel.apache.org/schema/spring/camel-spring.xsd">
-
- <camel:camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring">
- <camel:package>org.apache.camel.example.etl</camel:package>
- </camel:camelContext>
-
- <!-- Added for OSGI platform to allow -->
- <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
- <property name="entityManagerFactory" ref="entityManagerFactory" />
- </bean>
-
- <bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
- <property name="transactionManager">
- <bean class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory" />
- </bean>
- </property>
- </bean>
-
- <bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
- <property name="entityManagerFactory" ref="entityManagerFactory" />
- </bean>
-
- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
- <property name="persistenceUnitName" value="camel" />
- <property name="jpaVendorAdapter" ref="jpaAdapter" />
- </bean>
-
- <bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
- <property name="databasePlatform" value="org.apache.openjpa.jdbc.sql.DerbyDictionary" />
- <property name="database" value="DERBY" />
- </bean>
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/ad6024b6/examples/camel-example-etl/src/test/java/org/apache/camel/example/etl/IntegrationTest.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-etl/src/test/java/org/apache/camel/example/etl/IntegrationTest.java b/examples/camel-example-etl/src/test/java/org/apache/camel/example/etl/IntegrationTest.java
index 565c1f0..9dfb772 100644
--- a/examples/camel-example-etl/src/test/java/org/apache/camel/example/etl/IntegrationTest.java
+++ b/examples/camel-example-etl/src/test/java/org/apache/camel/example/etl/IntegrationTest.java
@@ -25,7 +25,7 @@ import org.apache.camel.spring.Main;
public class IntegrationTest extends TestCase {
public void testEtlRoutes() throws Exception {
- // let's boot up the Spring application context for 2 seconds to check that it works OK
- Main.main("-duration", "2s", "-o", "target/site/cameldoc");
+ // let's boot up the Spring application context for 5 seconds to check that it works OK
+ Main.main("-duration", "5s", "-o", "target/site/cameldoc");
}
}