Author: cmoulliard
Date: Wed Dec 9 16:24:25 2009
New Revision: 888856
URL: http://svn.apache.org/viewvc?rev=888856&view=rev
Log:
Add new profiles -P hibernate and -P openjpa.
Added:
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml
(with props)
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml
(with props)
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties
(with props)
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml
(with props)
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml
(with props)
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/log4j.properties
(with props)
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/persistence.xml
(with props)
Modified:
camel/trunk/examples/camel-example-etl/pom.xml
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java
camel/trunk/examples/camel-example-etl/src/main/resources/log4j.properties
camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/persistence.xml
camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/spring/camel-context.xml
Modified: camel/trunk/examples/camel-example-etl/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/pom.xml?rev=888856&r1=888855&r2=888856&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-etl/pom.xml (original)
+++ camel/trunk/examples/camel-example-etl/pom.xml Wed Dec 9 16:24:25 2009
@@ -33,16 +33,9 @@
<description>An example showing how to use Camel as an Extract
Transform and Load (ETL) tool</description>
<properties>
- <camel.osgi.export.pkg>
- org.apache.camel.example.etl.*
- </camel.osgi.export.pkg>
- <camel.osgi.import.additional>
-
org.hsqldb,org.hsqldb.util,org.hsqldb.jdbc,org.hibernate.ejb
- </camel.osgi.import.additional>
- <!-- to avoid us import bunch other package -->
- <camel.osgi.dynamic>
- *
- </camel.osgi.dynamic>
+
<camel.osgi.export.pkg>org.apache.camel.example.etl.*</camel.osgi.export.pkg>
+ <!-- to avoid us import bunch other package -->
+ <camel.osgi.dynamic>*</camel.osgi.dynamic>
</properties>
<dependencies>
@@ -137,6 +130,24 @@
<activation>
<activeByDefault>true</activeByDefault>
</activation>
+ <properties>
+ <camel.osgi.import.additional>
+ org.hsqldb,
+ org.hsqldb.util,
+ org.hsqldb.jdbc,
+ 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>
+ </resource>
+ </resources>
+ </build>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
@@ -157,10 +168,6 @@
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
- <excludes>
-
<exclude>**/persistence.xml</exclude>
-
<exclude>**/camel-context.xml</exclude>
- </excludes>
</resource>
</resources>
<!-- Will enhance classes as we run in a non
J2EE 5 env -->
@@ -193,6 +200,13 @@
</plugin>
</plugins>
</build>
+ <properties>
+ <camel.osgi.import.additional>
+ org.hsqldb,
+ org.hsqldb.util,
+ org.hsqldb.jdbc
+ </camel.osgi.import.additional>
+ </properties>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
@@ -200,6 +214,66 @@
</dependency>
</dependencies>
</profile>
+
+ <!-- EclipseLink - HSQLDB -->
+ <profile>
+ <id>eclipselink</id>
+ <build>
+ <resources>
+ <resource>
+
<directory>${basedir}/src/profiles/eclipselink</directory>
+ </resource>
+ <resource>
+
<directory>${basedir}/src/main/resources</directory>
+ </resource>
+ </resources>
+ </build>
+ <properties>
+ <camel.osgi.import.additional>
+ org.hsqldb,
+ org.hsqldb.util,
+ org.hsqldb.jdbc
+ </camel.osgi.import.additional>
+ </properties>
+ <dependencies>
+ <dependency>
+
<groupId>org.eclipse.persistence</groupId>
+
<artifactId>javax.persistence</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+
<groupId>org.eclipse.persistence</groupId>
+
<artifactId>org.eclipse.persistence.antlr</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+
<groupId>org.eclipse.persistence</groupId>
+
<artifactId>org.eclipse.persistence.asm</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+
<groupId>org.eclipse.persistence</groupId>
+
<artifactId>org.eclipse.persistence.core</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+
<groupId>org.eclipse.persistence</groupId>
+
<artifactId>org.eclipse.persistence.jpa</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>Eclipse</id>
+
<url>http://eclipse.ialto.org/rt/eclipselink/maven.repo</url>
+ </repository>
+ </repositories>
+ </profile>
+
</profiles>
<reporting>
<plugins>
Modified:
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java?rev=888856&r1=888855&r2=888856&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java
(original)
+++
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java
Wed Dec 9 16:24:25 2009
@@ -29,7 +29,7 @@
*
* @version $Revision$
*/
-...@entity(name = "Customer")
+...@entity(name = "customer")
@XmlRootElement(name = "customer")
@XmlAccessorType(XmlAccessType.FIELD)
public class CustomerEntity {
Modified:
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java?rev=888856&r1=888855&r2=888856&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java
(original)
+++
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java
Wed Dec 9 16:24:25 2009
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.jpa.JpaTemplate;
+import org.springframework.util.ClassUtils;
/**
* A Message Transformer of an XML document to a Customer entity bean
@@ -39,28 +40,32 @@
/**
* A transformation method to convert a person document into a customer
* entity
+ * @throws Exception
*/
@Converter
- public CustomerEntity toCustomer(PersonDocument doc, Exchange exchange) {
+ public CustomerEntity toCustomer(PersonDocument doc, Exchange exchange)
throws Exception {
JpaTemplate template = exchange.getIn().getHeader("CamelJpaTemplate",
JpaTemplate.class);
+
String user = doc.getUser();
CustomerEntity customer = findCustomerByName(template, user);
// let's convert information from the document into the entity bean
+ customer.setUserName(user);
customer.setFirstName(doc.getFirstName());
customer.setSurname(doc.getLastName());
customer.setCity(doc.getCity());
- LOG.debug("Created customer: " + customer);
+ LOG.debug("Created object customer: " + customer);
return customer;
}
/**
- * Finds a customer for the given username, or creates and inserts a new
one
+ * Finds a customer for the given username
*/
- protected CustomerEntity findCustomerByName(JpaTemplate template, String
user) {
- List<CustomerEntity> list = CastUtils.cast(template.find("select x
from " + CustomerEntity.class.getName() + " x where x.userName = ?1", user));
+ 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);
@@ -69,5 +74,6 @@
return list.get(0);
}
}
+
}
// END SNIPPET: example
Modified:
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java?rev=888856&r1=888855&r2=888856&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java
(original)
+++
camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java
Wed Dec 9 16:24:25 2009
@@ -18,6 +18,8 @@
import org.apache.camel.Exchange;
import org.apache.camel.spring.SpringRouteBuilder;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.processor.interceptor.Tracer;
import static org.apache.camel.language.juel.JuelExpression.el;
/**
@@ -26,13 +28,24 @@
// START SNIPPET: example
public class EtlRoutes extends SpringRouteBuilder {
public void configure() throws Exception {
- from("file:src/data?noop=true").convertBodyTo(PersonDocument.class)
+
+ /**
+ Tracer tracer = new Tracer();
+ tracer.setLogLevel(LoggingLevel.FATAL);
+ tracer.setLogName("org.apache.camel.example.etl");
+ tracer.setLogStackTrace(true);
+ tracer.setTraceExceptions(true);
+ **/
+
+ from("file:src/data?noop=true")
+ .convertBodyTo(PersonDocument.class)
.to("jpa:org.apache.camel.example.etl.CustomerEntity");
// the following will dump the database to files
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
Modified:
camel/trunk/examples/camel-example-etl/src/main/resources/log4j.properties
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/main/resources/log4j.properties?rev=888856&r1=888855&r2=888856&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-etl/src/main/resources/log4j.properties
(original)
+++ camel/trunk/examples/camel-example-etl/src/main/resources/log4j.properties
Wed Dec 9 16:24:25 2009
@@ -20,7 +20,17 @@
#
log4j.rootLogger=INFO, out
-#log4j.logger.org.apache.activemq=DEBUG
+# 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
log4j.logger.org.apache.camel=DEBUG
@@ -37,4 +47,5 @@
log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} -
%m%n
-log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file
+log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
+
Added:
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml?rev=888856&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml
(added)
+++
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml
Wed Dec 9 16:24:25 2009
@@ -0,0 +1,34 @@
+<?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.hsqldb.jdbcDriver" />
+ <property name="javax.persistence.jdbc.user" value="sa"
/>
+ <property name="javax.persistence.jdbc.password"
value="" />
+ <property name="javax.persistence.jdbc.url"
value="jdbc:hsqldb:mem:camel_etl" />
+ <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>
Propchange:
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/persistence.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml?rev=888856&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml
(added)
+++
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml
Wed Dec 9 16:24:25 2009
@@ -0,0 +1,77 @@
+<?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-2.5.xsd
+ http://camel.apache.org/schema/spring
+ http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://camel.apache.org/schema/osgi
+ http://camel.apache.org/schema/osgi/camel-osgi.xsd">
+
+ <camel:camelContext id="camel" trace="true"
+ xmlns="http://camel.apache.org/schema/osgi">
+ <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>
+
+ <!-- EclipseLink addapter -->
+ <bean id="jpaAdapter"
class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
+ <property name="databasePlatform"
value="org.eclipse.persistence.platform.database.HSQLPlatform" />
+ <property name="database" value="HSQL" />
+ </bean>
+
+
+ <!-- lets show a simple UI to browse the database
+ <bean id="databaseExplorer"
class="org.apache.camel.spring.util.MainRunner"
+ lazy-init="false">
+ <property name="main"
value="org.hsqldb.util.DatabaseManagerSwing" />
+ <property name="args">
+ <list>
+ <value>url</value>
+ <value>jdbc:hsqldb:mem:camel_etl</value>
+ </list>
+ </property>
+ <property name="delay" value="3000" />
+ </bean>
+ -->
+
+</beans>
\ No newline at end of file
Propchange:
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/META-INF/spring/camel-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties?rev=888856&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties
(added)
+++
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties
Wed Dec 9 16:24:25 2009
@@ -0,0 +1,36 @@
+## ------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ------------------------------------------------------------------------
+
+#
+# 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
Propchange:
camel/trunk/examples/camel-example-etl/src/profiles/eclipselink/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml?rev=888856&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml
(added)
+++
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml
Wed Dec 9 16:24:25 2009
@@ -0,0 +1,26 @@
+<?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>
+
+ <!-- Hibernate -->
+ <properties>
+ <property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
+ </properties>
+
+ </persistence-unit>
+</persistence>
Propchange:
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/persistence.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml?rev=888856&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml
(added)
+++
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml
Wed Dec 9 16:24:25 2009
@@ -0,0 +1,85 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <package>org.apache.camel.example.etl</package>
+ </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"/>
+ <property name="dataSource" ref="dataSource" />
+ </bean>
+
+ <bean id="jpaAdapter"
+ class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+ <property name="databasePlatform"
value="org.hibernate.dialect.HSQLDialect" />
+ </bean>
+
+ <!-- DataSource Definition -->
+ <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
+ <property name="url" value="jdbc:hsqldb:mem:camel_etl" />
+ <property name="username" value="sa" />
+ <property name="password" value="" />
+ </bean>
+
+ <!-- lets show a simple UI to browse the database -->
+ <!-- This bean will cause OSGi server exit , so we disable it here -->
+ <bean id="databaseExplorer" class="org.apache.camel.spring.util.MainRunner"
lazy-init="false">
+ <property name="main" value="org.hsqldb.util.DatabaseManagerSwing"/>
+ <property name="args">
+ <list>
+ <value>--url</value>
+ <value>jdbc:hsqldb:mem:camel_etl</value>
+ </list>
+ </property>
+ <property name="delay" value="1000"/>
+ </bean>
+
+</beans>
Propchange:
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/META-INF/spring/camel-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/log4j.properties
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/profiles/hibernate/log4j.properties?rev=888856&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/log4j.properties
(added)
+++
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/log4j.properties
Wed Dec 9 16:24:25 2009
@@ -0,0 +1,36 @@
+## ------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ------------------------------------------------------------------------
+
+#
+# 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
Propchange:
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/persistence.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/profiles/hibernate/persistence.xml?rev=888856&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/persistence.xml
(added)
+++
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/persistence.xml
Wed Dec 9 16:24:25 2009
@@ -0,0 +1,30 @@
+<?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.HSQLDialect"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
+ </properties>
+
+ </persistence-unit>
+</persistence>
Propchange:
camel/trunk/examples/camel-example-etl/src/profiles/hibernate/persistence.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/persistence.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/persistence.xml?rev=888856&r1=888855&r2=888856&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/persistence.xml
(original)
+++
camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/persistence.xml
Wed Dec 9 16:24:25 2009
@@ -1,44 +1,51 @@
<?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.
--->
+ <!--
+ 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">
+ 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>
+
+ <!-- Hibernate properties
+ <properties>
+ <property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect" />
+ <property name="hibernate.hbm2ddl.auto" value="create"
/>
+ </properties>
+ -->
+
+ <!-- OpenJPA & HSQL -->
+ <properties>
+ <property name="openjpa.ConnectionDriverName"
value="org.hsqldb.jdbcDriver" />
+ <property name="openjpa.ConnectionURL"
value="jdbc:hsqldb:mem:camel_etl" />
+ <property name="openjpa.ConnectionUserName" value="sa"
/>
+ <property name="openjpa.ConnectionPassword" value="" />
+ <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema" />
+ <property name="openjpa.Log" value="commons" />
+ <!-- value="DefaultLevel=INFO, Runtime=TRACE,
Tool=INFO, SQL=TRACE" /> -->
+ <property name="openjpa.ConnectionFactoryProperties"
value="PrettyPrint=true, PrettyPrintLineLength=72" />
+ </properties>
+
+ <!-- OpenJPA & Derby
+ <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 name="camel" transaction-type="RESOURCE_LOCAL">
- <class>org.apache.camel.example.etl.CustomerEntity</class>
- <properties>
- <property name="openjpa.ConnectionURL"
value="jdbc:hsqldb:mem:camel_etl"/>
- <property name="openjpa.ConnectionDriverName"
value="org.hsqldb.jdbcDriver"/>
- <property name="openjpa.ConnectionUserName" value="sa" />
- <property name="openjpa.ConnectionPassword" value="" />
- <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
- <property name="openjpa.ConnectionFactoryProperties"
value="PrettyPrint=true, PrettyPrintLineLength=72" />
- </properties>
-
- <!-- 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-unit>
</persistence>
Modified:
camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/spring/camel-context.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/spring/camel-context.xml?rev=888856&r1=888855&r2=888856&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/spring/camel-context.xml
(original)
+++
camel/trunk/examples/camel-example-etl/src/profiles/openjpa/META-INF/spring/camel-context.xml
Wed Dec 9 16:24:25 2009
@@ -1,42 +1,36 @@
<?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
-
- -->
-
+ <!--
+ 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: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-2.5.xsd
- http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.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>
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <package>org.apache.camel.example.etl</package>
- </camelContext>
-
- <!-- Added for OSGI platform to allow -->
- <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
- <property name="entityManagerFactory" ref="entityManagerFactory"/>
- </bean>
+ <!-- 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">
@@ -54,18 +48,34 @@
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="camel" />
+ <property name="jpaVendorAdapter" ref="jpaAdapter" />
</bean>
+ <!--
+ Hibernate addapter <bean id="jpaAdapter"
+
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+ <property name="databasePlatform"
+ value="org.hibernate.dialect.HSQLDialect" /> </bean>
+ -->
+
+ <!-- OpenJPA addapter -->
+ <bean id="jpaAdapter"
class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
+ <property name="databasePlatform"
value="org.apache.openjpa.jdbc.sql.HSQLDictionary" />
+ <property name="database" value="HSQL" />
+ </bean>
+
+
+ <!-- lets show a simple UI to browse the database -->
+ <bean id="databaseExplorer"
class="org.apache.camel.spring.util.MainRunner"
+ lazy-init="false">
+ <property name="main"
value="org.hsqldb.util.DatabaseManagerSwing" />
+ <property name="args">
+ <list>
+ <value>--url</value>
+ <value>jdbc:hsqldb:mem:camel_etl</value>
+ </list>
+ </property>
+ <property name="delay" value="3000" />
+ </bean>
- <!-- lets show a simple UI to browse the database
- <bean id="databaseExplorer" class="org.apache.camel.spring.util.MainRunner"
lazy-init="false">
- <property name="main" value="org.hsqldb.util.DatabaseManagerSwing"/>
- <property name="args">
- <list>
- <value>url</value>
- <value>jdbc:hsqldb:mem:camel_etl</value>
- </list>
- </property>
- <property name="delay" value="1000"/>
- </bean-->
-</beans>
+</beans>
\ No newline at end of file