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

svn commit: r525123 - in /activemq/camel/trunk/camel-jpa: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/camel/ src/main/java/org/apache/camel/component/ src/main/java/org/apache/camel/component/j...

Author: jstrachan
Date: Tue Apr  3 02:55:01 2007
New Revision: 525123

URL: http://svn.apache.org/viewvc?view=rev&rev=525123
Log:
added an initial implementation of a JPA based component capable of storing POJOs in a database and polling for them

Added:
    activemq/camel/trunk/camel-jpa/
    activemq/camel/trunk/camel-jpa/pom.xml   (with props)
    activemq/camel/trunk/camel-jpa/src/
    activemq/camel/trunk/camel-jpa/src/main/
    activemq/camel/trunk/camel-jpa/src/main/java/
    activemq/camel/trunk/camel-jpa/src/main/java/org/
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java   (with props)
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java   (with props)
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java   (with props)
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java   (with props)
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java   (with props)
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java   (with props)
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java   (with props)
    activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/package.html   (with props)
    activemq/camel/trunk/camel-jpa/src/main/resources/
    activemq/camel/trunk/camel-jpa/src/main/resources/META-INF/
    activemq/camel/trunk/camel-jpa/src/main/resources/META-INF/services/
    activemq/camel/trunk/camel-jpa/src/main/resources/META-INF/services/org/
    activemq/camel/trunk/camel-jpa/src/main/resources/META-INF/services/org/apache/
    activemq/camel/trunk/camel-jpa/src/main/resources/META-INF/services/org/apache/camel/
    activemq/camel/trunk/camel-jpa/src/test/
    activemq/camel/trunk/camel-jpa/src/test/java/
    activemq/camel/trunk/camel-jpa/src/test/java/org/
    activemq/camel/trunk/camel-jpa/src/test/java/org/apache/
    activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/
    activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/
    activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/jpa/
    activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java   (with props)
    activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/examples/
    activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java   (with props)
    activemq/camel/trunk/camel-jpa/src/test/resources/
    activemq/camel/trunk/camel-jpa/src/test/resources/META-INF/
    activemq/camel/trunk/camel-jpa/src/test/resources/META-INF/persistence.xml   (with props)
    activemq/camel/trunk/camel-jpa/src/test/resources/log4j.properties   (with props)

Added: activemq/camel/trunk/camel-jpa/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/pom.xml?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/pom.xml (added)
+++ activemq/camel/trunk/camel-jpa/pom.xml Tue Apr  3 02:55:01 2007
@@ -0,0 +1,132 @@
+<?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.
+-->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-jpa</artifactId>
+  <name>Camel :: JPA</name>
+  <description>Camel JPA support</description>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.persistence</groupId>
+      <artifactId>persistence-api</artifactId>
+      <version>1.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.openjpa</groupId>
+      <artifactId>openjpa-persistence-jdbc</artifactId>
+      <!--<version>0.9.7-incubating-SNAPSHOT</version>-->
+      <!-- mandatory dependency for the enhancer! -->
+      <!--<scope>test</scope>-->
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-dbcp</groupId>
+      <artifactId>commons-dbcp</artifactId>
+      <version>1.2.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.2</version>
+      <scope>test</scope>
+    </dependency>
+
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+
+      <!-- lets enhance the classes for OpenJPA (shame it can't do it at runtime!) -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+
+        <executions>
+          <execution>
+            <phase>process-test-classes</phase>
+            <configuration>
+              <tasks>
+                <path id="cp">
+                  <path refid="maven.test.classpath"/>
+                  <path refid="maven.compile.classpath"/>
+                  <path refid="maven.dependency.classpath"/>
+                </path>
+                <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
+                  <classpath refid="cp"/>
+                </taskdef>
+                <openjpac directory="${basedir}/target/jpa-classes">
+                  <classpath refid="cp"/>
+                  <fileset dir="${basedir}/target/test-classes">
+                    <include name="org/apache/camel/examples/*.class"/>
+                  </fileset>
+                </openjpac>
+                <copy todir="${basedir}/target/test-classes">
+                  <fileset dir="${basedir}/target/jpa-classes"/>
+                </copy>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: activemq/camel/trunk/camel-jpa/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java (added)
+++ activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java Tue Apr  3 02:55:01 2007
@@ -0,0 +1,38 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jpa;
+
+import javax.persistence.EntityManager;
+
+/**
+ * A strategy for deleting entity beans which have been processed; either by a real delete or by an update of some
+ * application specific properties so that the entity bean will not be found in future polling queries.
+ *
+ * @version $Revision$
+ */
+public interface DeleteHandler<T> {
+
+    /**
+     * Deletes the entity bean after it has been processed either by actually
+     * deleting the object or updating it in a way so that future queries do not return this object again.
+     *
+     * @param consumer the consumer which has access to the {@link JpaEndpoint} and JPA {@link EntityManager}
+     * @param entityBean the entity bean that has been processed and should be deleted
+     */
+    void deleteObject(JpaConsumer consumer, T entityBean);
+}

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java (added)
+++ activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java Tue Apr  3 02:55:01 2007
@@ -0,0 +1,108 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jpa;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointResolver;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.util.ObjectHelper;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * A JPA Component
+ *
+ * @version $Revision$
+ */
+public class JpaComponent extends DefaultComponent<Exchange> implements EndpointResolver {
+    private EntityManagerFactory entityManagerFactory;
+    private Map entityManagerProperties;
+    private String entityManagerName = "camel";
+
+    public Component resolveComponent(CamelContext container, String uri) throws Exception {
+        return null;
+    }
+
+    public Endpoint resolveEndpoint(CamelContext container, String uri) throws Exception {
+        if (!uri.startsWith("jpa:")) {
+            return null;
+        }
+        URI u = new URI(uri);
+        String path = u.getSchemeSpecificPart();
+        JpaEndpoint endpoint = new JpaEndpoint(uri, this);
+
+        // lets interpret the next string as a class
+        if (path != null) {
+            Class<?> type = ObjectHelper.loadClass(path);
+            if (type != null) {
+                endpoint.setEntityType(type);
+            }
+        }
+        return endpoint;
+    }
+
+    // Properties
+    //-------------------------------------------------------------------------
+    public EntityManagerFactory getEntityManagerFactory() {
+        if (entityManagerFactory == null) {
+            entityManagerFactory = createEntityManagerFactory();
+        }
+        return entityManagerFactory;
+    }
+
+    public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
+        this.entityManagerFactory = entityManagerFactory;
+    }
+
+    public Map getEntityManagerProperties() {
+        if (entityManagerProperties == null) {
+            entityManagerProperties = System.getProperties();
+        }
+        return entityManagerProperties;
+    }
+
+    public void setEntityManagerProperties(Map entityManagerProperties) {
+        this.entityManagerProperties = entityManagerProperties;
+    }
+
+    public String getEntityManagerName() {
+        return entityManagerName;
+    }
+
+    public void setEntityManagerName(String entityManagerName) {
+        this.entityManagerName = entityManagerName;
+    }
+
+    // Implementation methods
+    //-------------------------------------------------------------------------
+    protected EntityManagerFactory createEntityManagerFactory() {
+        //return Persistence.createEntityManagerFactory(entityManagerName);
+        return Persistence.createEntityManagerFactory(entityManagerName, getEntityManagerProperties());
+    }
+
+    protected EntityManager createEntityManager() {
+        return getEntityManagerFactory().createEntityManager();
+    }
+}

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java (added)
+++ activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java Tue Apr  3 02:55:01 2007
@@ -0,0 +1,118 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jpa;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.DefaultConsumer;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.List;
+
+/**
+ * @version $Revision$
+ */
+public class JpaConsumer extends DefaultConsumer<Exchange> {
+    private final JpaEndpoint endpoint;
+    private final EntityManager entityManager;
+    private QueryFactory queryFactory;
+    private DeleteHandler<Object> deleteHandler;
+
+    public JpaConsumer(JpaEndpoint endpoint, Processor<Exchange> processor, EntityManager entityManager) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+        this.entityManager = entityManager;
+    }
+
+    /**
+     * Invoked whenever we should be polled
+     */
+    public void run() {
+        Query query = queryFactory.createQuery(this);
+        configureParameters(query);
+        List results = query.getResultList();
+        for (Object result : results) {
+            // lets turn the result into an exchange and fire it into the processor
+            Exchange exchange = createExchange(result);
+            getProcessor().onExchange(exchange);
+            deleteHandler.deleteObject(this, result);
+        }
+    }
+
+    // Properties
+    //-------------------------------------------------------------------------
+
+    public EntityManager getEntityManager() {
+        return entityManager;
+    }
+
+    public JpaEndpoint getEndpoint() {
+        return endpoint;
+    }
+
+    public QueryFactory getQueryFactory() {
+        if (queryFactory == null) {
+            queryFactory = createQueryFactory();
+        }
+        return queryFactory;
+    }
+
+    public void setQueryFactory(QueryFactory queryFactory) {
+        this.queryFactory = queryFactory;
+    }
+
+    public DeleteHandler getDeleteHandler() {
+        return deleteHandler;
+    }
+
+    public void setDeleteHandler(DeleteHandler deleteHandler) {
+        this.deleteHandler = deleteHandler;
+    }
+
+    // Implementation methods
+    //-------------------------------------------------------------------------
+    @Override
+    protected void doStop() throws Exception {
+        entityManager.close();
+        super.doStop();
+    }
+
+    protected QueryFactory createQueryFactory() {
+        Class<?> entityType = endpoint.getEntityType();
+        if (entityType == null) {
+            return null;
+        }
+        else {
+            return QueryBuilder.query("select x from " + entityType.getName() + " x");
+        }
+    }
+
+    protected void configureParameters(Query query) {
+        int maxResults = endpoint.getMaximumResults();
+        if (maxResults > 0) {
+            query.setMaxResults(maxResults);
+        }
+    }
+
+    protected Exchange createExchange(Object result) {
+        Exchange exchange = endpoint.createExchange();
+        exchange.getIn().setBody(result);
+        return exchange;
+    }
+}

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java (added)
+++ activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java Tue Apr  3 02:55:01 2007
@@ -0,0 +1,117 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jpa;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
+import org.apache.camel.NoTypeConversionAvailableException;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.ExpressionBuilder;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.impl.DefaultExchange;
+
+import javax.persistence.EntityManager;
+
+/**
+ * @version $Revision$
+ */
+public class JpaEndpoint extends DefaultEndpoint<Exchange> {
+    private final JpaComponent component;
+    private Expression<Exchange> producerExpression;
+    private int maximumResults = -1;
+    private Class<?> entityType;
+
+    public JpaEndpoint(String uri, JpaComponent component) {
+        super(uri, component.getContext());
+        this.component = component;
+    }
+
+    public Exchange createExchange() {
+        return new DefaultExchange(getContext());
+    }
+
+    public Producer<Exchange> createProducer() throws Exception {
+        return new JpaProducer(this, createEntityManager(), getProducerExpression());
+    }
+
+    public Consumer<Exchange> createConsumer(Processor<Exchange> processor) throws Exception {
+        return new JpaConsumer(this, processor, createEntityManager());
+    }
+
+    // Properties
+    //-------------------------------------------------------------------------
+    public Expression<Exchange> getProducerExpression() {
+        if (producerExpression == null) {
+            producerExpression = createProducerExpression();
+        }
+        return producerExpression;
+    }
+
+    public void setProducerExpression(Expression<Exchange> producerExpression) {
+        this.producerExpression = producerExpression;
+    }
+
+    public int getMaximumResults() {
+        return maximumResults;
+    }
+
+    public void setMaximumResults(int maximumResults) {
+        this.maximumResults = maximumResults;
+    }
+
+    public Class<?> getEntityType() {
+        return entityType;
+    }
+
+    public void setEntityType(Class<?> entityType) {
+        this.entityType = entityType;
+    }
+
+    // Implementation methods
+    //-------------------------------------------------------------------------
+    protected EntityManager createEntityManager() {
+        return component.createEntityManager();
+    }
+
+    protected Expression<Exchange> createProducerExpression() {
+        final Class<?> type = getEntityType();
+        if (type == null) {
+            return ExpressionBuilder.bodyExpression();
+        }
+        else {
+            return new Expression<Exchange>() {
+                public Object evaluate(Exchange exchange) {
+                    Object answer = exchange.getIn().getBody(type);
+                    if (answer == null) {
+                        Object defaultValue = exchange.getIn().getBody();
+                        if (defaultValue != null) {
+                            throw new NoTypeConversionAvailableException(defaultValue, type);
+                        }
+
+                        // if we don't have a body then
+                        // lets instantiate and inject a new instance
+                        answer = exchange.getContext().getInjector().newInstance(type);
+                    }
+                    return answer;
+                }
+            };
+        }
+    }
+}

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java (added)
+++ activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java Tue Apr  3 02:55:01 2007
@@ -0,0 +1,70 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jpa;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
+import org.apache.camel.converter.ObjectConverter;
+import org.apache.camel.impl.DefaultProducer;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
+import java.util.Iterator;
+
+/**
+ * @version $Revision$
+ */
+public class JpaProducer extends DefaultProducer<Exchange> {
+    private EntityManager entityManager;
+    private final JpaEndpoint endpoint;
+    private Expression<Exchange> expression;
+
+    public JpaProducer(JpaEndpoint endpoint, EntityManager entityManager, Expression<Exchange> expression) {
+        super(endpoint);
+        this.endpoint = endpoint;
+        this.entityManager = entityManager;
+        this.expression = expression;
+    }
+
+    public void onExchange(Exchange exchange) {
+        Object values = expression.evaluate(exchange);
+        if (values != null) {
+            // TODO remove explicit transaction handling?
+            EntityTransaction transaction = entityManager.getTransaction();
+            transaction.begin();
+            try {
+                Iterator iter = ObjectConverter.iterator(values);
+                while (iter.hasNext()) {
+                    Object value = iter.next();
+                    entityManager.persist(value);
+                }
+                transaction.commit();
+            }
+            catch (RuntimeException e) {
+                transaction.rollback();
+                throw e;
+            }
+        }
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        entityManager.close();
+        super.doStop();
+    }
+}

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java (added)
+++ activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java Tue Apr  3 02:55:01 2007
@@ -0,0 +1,179 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jpa;
+
+import javax.persistence.Query;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Collection;
+
+/**
+ * A builder of query expressions
+ *
+ * @version $Revision$
+ */
+public abstract class QueryBuilder implements QueryFactory {
+    ParameterBuilder parameterBuilder;
+
+    /**
+     * Creates a query builder using the JPA query syntax
+     *
+     * @param query JPA query language to create
+     * @return a query builder
+     */
+    public static QueryBuilder query(final String query) {
+        return new QueryBuilder() {
+            protected Query makeQueryObject(JpaConsumer consumer) {
+                return consumer.getEntityManager().createQuery(query);
+            }
+
+            @Override
+            public String toString() {
+                return "Query: " + query + " params: " + getParameterDescription();
+            }
+        };
+    }
+
+    /**
+     * Creates a named query
+     */
+    public static QueryBuilder namedQuery(final String namedQuery) {
+        return new QueryBuilder() {
+            protected Query makeQueryObject(JpaConsumer consumer) {
+                return consumer.getEntityManager().createNamedQuery(namedQuery);
+            }
+
+            @Override
+            public String toString() {
+                return "Named: " + namedQuery + getParameterDescription();
+            }
+        };
+    }
+
+    /**
+     * Creates a native SQL query
+     */
+    public static QueryBuilder nativeQuery(final String nativeQuery) {
+        return new QueryBuilder() {
+            protected Query makeQueryObject(JpaConsumer consumer) {
+                return consumer.getEntityManager().createNativeQuery(nativeQuery);
+            }
+
+            @Override
+            public String toString() {
+                return "NativeQuery: " + nativeQuery + getParameterDescription();
+            }
+        };
+    }
+
+    /**
+     * Specifies the parameters to the query
+     *
+     * @param parameters the parameters to be configured on the query
+     * @return this query builder
+     */
+    public QueryBuilder parameters(Object... parameters) {
+        return parameters(Arrays.asList(parameters));
+    }
+
+    /**
+     * Specifies the parameters to the query as an ordered collection of parameters
+     *
+     * @param parameters the parameters to be configured on the query
+     * @return this query builder
+     */
+    public QueryBuilder parameters(final Collection parameters) {
+        checkNoParametersConfigured();
+        parameterBuilder = new ParameterBuilder() {
+            public void populateQuery(JpaConsumer consumer, Query query) {
+                int counter = 0;
+                for (Object parameter : parameters) {
+                    query.setParameter(counter++, parameter);
+                }
+            }
+
+            @Override
+            public String toString() {
+                return "Parameters: " + parameters;
+            }
+        };
+        return this;
+    }
+
+    /**
+     * Specifies the parameters to the query as a Map of key/value pairs
+     *
+     * @param parameterMap the parameters to be configured on the query
+     * @return this query builder
+     */
+    public QueryBuilder parameters(final Map<String, Object> parameterMap) {
+        checkNoParametersConfigured();
+        parameterBuilder = new ParameterBuilder() {
+            public void populateQuery(JpaConsumer consumer, Query query) {
+                Set<Map.Entry<String, Object>> entries = parameterMap.entrySet();
+                for (Map.Entry<String, Object> entry : entries) {
+                    query.setParameter(entry.getKey(), entry.getValue());
+                }
+            }
+
+            @Override
+            public String toString() {
+                return "Parameters: " + parameterMap;
+            }
+        };
+        return this;
+    }
+
+    protected void checkNoParametersConfigured() {
+        if (parameterBuilder != null) {
+            throw new IllegalArgumentException("Cannot add parameters to a QueryBuilder which already has parameters configured");
+        }
+    }
+
+    public Query createQuery(JpaConsumer consumer) {
+        Query query = makeQueryObject(consumer);
+        populateQuery(consumer, query);
+        return query;
+    }
+
+    protected String getParameterDescription() {
+        if (parameterBuilder == null) {
+            return "";
+        }
+        else {
+            return " " + parameterBuilder.toString();
+        }
+    }
+
+    protected void populateQuery(JpaConsumer consumer, Query query) {
+        if (parameterBuilder != null) {
+            parameterBuilder.populateQuery(consumer, query);
+        }
+    }
+
+    protected abstract Query makeQueryObject(JpaConsumer consumer);
+
+    /**
+     * A plugin strategy to populate the query with parameters
+     */
+    protected abstract static class ParameterBuilder {
+        public abstract void populateQuery(JpaConsumer consumer, Query query);
+    }
+}

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java (added)
+++ activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java Tue Apr  3 02:55:01 2007
@@ -0,0 +1,37 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jpa;
+
+import javax.persistence.Query;
+import javax.persistence.EntityManager;
+
+/**
+ * A Strategy to create a query to search for objects in a database
+ *
+ * @version $Revision$
+ */
+public interface QueryFactory {
+
+    /**
+     * Creates a new query to find objects to be processed
+     *
+     * @param consumer the consumer which has access to the {@link JpaEndpoint} and JPA {@link EntityManager}
+     * @return the query configured with any parameters etc
+     */
+    Query createQuery(JpaConsumer consumer);
+}

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/package.html
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/package.html?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/package.html (added)
+++ activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/package.html Tue Apr  3 02:55:01 2007
@@ -0,0 +1,25 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+   
+    http://www.apache.org/licenses/LICENSE-2.0
+   
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+</head>
+<body>
+
+Defines the JPA component for polling databases or recording messages in a database.
+
+</body>
+</html>

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/package.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/main/java/org/apache/camel/component/jpa/package.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java (added)
+++ activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java Tue Apr  3 02:55:01 2007
@@ -0,0 +1,137 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jpa;
+
+import junit.framework.TestCase;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.examples.SendEmail;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.util.CamelClient;
+import static org.apache.camel.util.ServiceHelper.startServices;
+import static org.apache.camel.util.ServiceHelper.stopServices;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @version $Revision$
+ */
+public class JpaTest extends TestCase {
+    private static final transient Log log = LogFactory.getLog(JpaTest.class);
+    protected CamelContext camelContext = new DefaultCamelContext();
+    protected CamelClient client = new CamelClient(camelContext);
+    protected JpaEndpoint endpoint;
+    protected EntityManager entityManager;
+    protected Consumer<Exchange> consumer;
+    protected Exchange receivedExchange;
+    protected CountDownLatch latch = new CountDownLatch(1);
+    protected String queryText = "select o from " + SendEmail.class.getName() + " o";
+    protected EntityTransaction transaction;
+
+    public void testProducerInsertsIntoDatabaseThenConsumerFiresMessageExchange() throws Exception {
+        // lets assert that there are no existing send mail tasks
+        transaction = entityManager.getTransaction();
+        transaction.begin();
+        List results = entityManager.createQuery(queryText).getResultList();
+        assertEquals("Should have no results: " + results, 0, results.size());
+
+        // lets produce some objects
+        client.send(endpoint, new Processor<Exchange>() {
+            public void onExchange(Exchange exchange) {
+                exchange.getIn().setBody(new SendEmail("foo@bar.com"));
+            }
+        });
+        transaction.commit();
+
+        // now lets assert that there is a result
+        transaction.begin();
+        results = entityManager.createQuery(queryText).getResultList();
+        assertEquals("Should have no results: " + results, 1, results.size());
+        SendEmail mail = (SendEmail) results.get(0);
+        assertEquals("address property", "foo@bar.com", mail.getAddress());
+
+        // now lets create a consumer to consume it
+        consumer = endpoint.createConsumer(new Processor<Exchange>() {
+            public void onExchange(Exchange e) {
+                log.info("Received exchange: " + e.getIn());
+                receivedExchange = e;
+                latch.countDown();
+            }
+        });
+
+        boolean received = latch.await(5, TimeUnit.SECONDS);
+        assertTrue("Did not recieve the message!", received);
+
+        assertNotNull(receivedExchange);
+        SendEmail result = receivedExchange.getIn().getBody(SendEmail.class);
+        assertNotNull("Received a POJO", result);
+        assertEquals("address property", "foo@bar.com", result.getAddress());
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        camelContext.addComponent("foo", createJpaComponent());
+
+        startServices(client, camelContext);
+
+        Endpoint value = camelContext.resolveEndpoint("jpa:" + SendEmail.class.getName());
+        assertNotNull("Could not find endpoint!", value);
+        assertTrue("Should be a JPA endpoint but was: " + value, value instanceof JpaEndpoint);
+        endpoint = (JpaEndpoint) value;
+
+        entityManager = endpoint.createEntityManager();
+    }
+
+    protected JpaComponent createJpaComponent() {
+        JpaComponent answer = new JpaComponent();
+/*
+        Properties properties = new Properties();
+        properties.setProperty("openjpa.ConnectionDriverName", "org.apache.derby.jdbc.EmbeddedDriver");
+        properties.setProperty("openjpa.ConnectionURL", "jdbc:derby:target/derby;create=true");
+        properties.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema");
+        properties.setProperty("openjpa.Log", "DefaultLevel=WARN,SQL=TRACE");
+        answer.setEntityManagerProperties(properties);
+*/
+        return answer;
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        if (transaction != null) {
+            transaction.rollback();
+            transaction = null;
+        }
+        if (entityManager != null) {
+            entityManager.close();
+        }
+        stopServices(consumer, client, camelContext);
+
+        super.tearDown();
+    }
+}

Propchange: activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java (added)
+++ activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java Tue Apr  3 02:55:01 2007
@@ -0,0 +1,59 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.examples;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * Represents a task which is added to the database
+ *
+ * @version $Revision$
+ */
+@Entity
+public class SendEmail {
+    private Long id;
+    private String address;
+
+    public SendEmail() {
+
+    }
+
+    public SendEmail(String address) {
+        setAddress(address);
+    }
+
+    @Id
+    @GeneratedValue
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+}

Propchange: activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-jpa/src/test/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/test/resources/META-INF/persistence.xml?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/test/resources/META-INF/persistence.xml (added)
+++ activemq/camel/trunk/camel-jpa/src/test/resources/META-INF/persistence.xml Tue Apr  3 02:55:01 2007
@@ -0,0 +1,46 @@
+<?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">
+    <!--
+        The default provider can be OpenJPA, or some other product.
+        This element is optional if OpenJPA is the only JPA provider
+        in the current classloading environment, but can be specified
+        in cases where there are multiple JPA implementations available.
+    -->
+    <provider>
+        org.apache.openjpa.persistence.PersistenceProviderImpl
+    </provider>
+
+    <class>org.apache.camel.examples.SendEmail</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.ConnectionUserName" value="sa"/>
+            <property name="openjpa.ConnectionPassword" value=""/>
+      -->
+
+      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
+      <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO, SQL=TRACE"/>
+    </properties>
+  </persistence-unit>
+</persistence>

Propchange: activemq/camel/trunk/camel-jpa/src/test/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/test/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/test/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: activemq/camel/trunk/camel-jpa/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jpa/src/test/resources/log4j.properties?view=auto&rev=525123
==============================================================================
--- activemq/camel/trunk/camel-jpa/src/test/resources/log4j.properties (added)
+++ activemq/camel/trunk/camel-jpa/src/test/resources/log4j.properties Tue Apr  3 02:55:01 2007
@@ -0,0 +1,30 @@
+## ------------------------------------------------------------------------
+## 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 debug output on the console.
+#
+log4j.rootLogger=INFO, out
+
+#log4j.logger.org.apache.activemq=DEBUG
+#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=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n

Propchange: activemq/camel/trunk/camel-jpa/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jpa/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jpa/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain