You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ch...@apache.org on 2007/08/07 23:33:12 UTC
svn commit: r563665 [6/11] - in /activemq/camel/trunk:
camel-core/src/main/java/org/apache/camel/converter/jaxp/
camel-core/src/test/java/org/apache/camel/processor/
components/camel-activemq/src/main/java/org/apache/camel/component/activemq/
component...
Modified: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TransactedJmsRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TransactedJmsRouteTest.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TransactedJmsRouteTest.java (original)
+++ activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TransactedJmsRouteTest.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,9 +16,6 @@
*/
package org.apache.camel.component.jms;
-import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
-import static org.apache.camel.component.mock.MockEndpoint.assertWait;
-
import java.util.concurrent.TimeUnit;
import javax.jms.ConnectionFactory;
@@ -27,8 +23,8 @@
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Processor;
import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.processor.DelegateProcessor;
@@ -38,235 +34,262 @@
import org.apache.camel.spring.spi.SpringTransactionPolicy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.apache.camel.component.mock.MockEndpoint.assertWait;
+
/**
* @version $Revision: 529902 $
*/
public class TransactedJmsRouteTest extends ContextTestSupport {
-
- private static final transient Log log = LogFactory.getLog(TransactedJmsRouteTest.class);
- private MockEndpoint mockEndpointA;
- private MockEndpoint mockEndpointB;
- private ClassPathXmlApplicationContext spring;
- private MockEndpoint mockEndpointC;
- private MockEndpoint mockEndpointD;
-
- @Override
- protected RouteBuilder createRouteBuilder() {
- return new SpringRouteBuilder() {
- public void configure() {
-
- Policy requried = new SpringTransactionPolicy(bean(TransactionTemplate.class, "PROPAGATION_REQUIRED"));
- Policy notsupported = new SpringTransactionPolicy(bean(TransactionTemplate.class, "PROPAGATION_NOT_SUPPORTED"));
- Policy requirenew = new SpringTransactionPolicy(bean(TransactionTemplate.class, "PROPAGATION_REQUIRES_NEW"));
-
- Policy rollback = new Policy() {
- public Processor wrap(Processor processor) {
- return new DelegateProcessor(processor) {
- @Override
- public void process(Exchange exchange) throws Exception {
- processNext(exchange);
- throw new RuntimeException("rollback");
- }
-
- @Override
- public String toString() {
- return "rollback(" + getProcessor() + ")";
- }
- };
- }
- };
-
- Policy catchRollback = new Policy() {
- public Processor wrap(Processor processor) {
- return new DelegateProcessor(processor) {
- @Override
- public void process(Exchange exchange) {
- try {
- processNext(exchange);
- } catch ( Throwable e ) {
- }
- }
- @Override
- public String toString() {
- return "catchRollback(" + getProcessor() + ")";
- }
- };
- }
- };
-
- // NOTE: ErrorHandler has to be disabled since it operates within the failed transaction.
- inheritErrorHandler(false);
- // Used to validate messages are sent to the target.
- from("activemq:queue:mock.a").trace().to("mock:a");
- from("activemq:queue:mock.b").trace().to("mock:b");
- from("activemq:queue:mock.c").trace().to("mock:c");
- from("activemq:queue:mock.d").trace().to("mock:d");
-
- // Receive from a and send to target in 1 tx.
- from("activemq:queue:a").to("activemq:queue:mock.a");
-
- // Cause an error after processing the send. The send to activemq:queue:mock.a should rollback
- // since it is participating in the inbound transaction, but mock:b does not participate so we should see the message get
- // there. Also, expect multiple inbound retries as the message is rolled back.
- //transactionPolicy(requried);
- from("activemq:queue:b").policy(rollback).to("activemq:queue:mock.a", "mock:b");
-
- // Cause an error after processing the send in a new transaction. The send to activemq:queue:mock.a should rollback
- // since the rollback is within it's transaction, but mock:b does not participate so we should see the message get
- // there. Also, expect the message to be successfully consumed since the rollback error is not propagated.
- //transactionPolicy(requried);
- from("activemq:queue:c").policy(catchRollback).policy(requirenew).policy(rollback).to("activemq:queue:mock.a", "mock:b");
-
- // Cause an error after processing the send in without a transaction. The send to activemq:queue:mock.a should succeed.
- // Also, expect the message to be successfully consumed since the rollback error is not propagated.
- from("activemq:queue:d").policy(catchRollback).policy(notsupported).policy(rollback).to("activemq:queue:mock.a");
-
- // Receive message on a non transacted JMS endpoint, start a transaction, send and then rollback.
- // mock:a should never get the message (due to rollback) but mock:b should get only 1 since the
- // inbound was not transacted.
- JmsEndpoint endpoint = (JmsEndpoint)endpoint("activemq:queue:e");
- endpoint.getConfiguration().setTransacted(false);
- endpoint.getConfiguration().setAcknowledgementMode(Session.AUTO_ACKNOWLEDGE);
- from(endpoint).policy(requried).policy(rollback).to("activemq:queue:mock.a", "mock:b");
-
-
- //
- // Sets up 2 consumers on single topic, one being transacted the other not. Used to verify
- // That each consumer can have independently configured transaction settings.
- // Do a rollback, should cause the transacted consumer to re-deliver (since we are using a durable subscription) but not the un-transacted one.
- // TODO: find out why re-delivery is not working with a non durable transacted topic.
- JmsEndpoint endpoint1 = (JmsEndpoint) endpoint("activemq:topic:f");
+
+ private static final transient Log LOG = LogFactory.getLog(TransactedJmsRouteTest.class);
+ private MockEndpoint mockEndpointA;
+ private MockEndpoint mockEndpointB;
+ private ClassPathXmlApplicationContext spring;
+ private MockEndpoint mockEndpointC;
+ private MockEndpoint mockEndpointD;
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new SpringRouteBuilder() {
+ public void configure() {
+
+ Policy requried = new SpringTransactionPolicy(bean(TransactionTemplate.class, "PROPAGATION_REQUIRED"));
+ Policy notsupported = new SpringTransactionPolicy(bean(TransactionTemplate.class, "PROPAGATION_NOT_SUPPORTED"));
+ Policy requirenew = new SpringTransactionPolicy(bean(TransactionTemplate.class, "PROPAGATION_REQUIRES_NEW"));
+
+ Policy rollback = new Policy() {
+ public Processor wrap(Processor processor) {
+ return new DelegateProcessor(processor) {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ processNext(exchange);
+ throw new RuntimeException("rollback");
+ }
+
+ @Override
+ public String toString() {
+ return "rollback(" + getProcessor() + ")";
+ }
+ };
+ }
+ };
+
+ Policy catchRollback = new Policy() {
+ public Processor wrap(Processor processor) {
+ return new DelegateProcessor(processor) {
+ @Override
+ public void process(Exchange exchange) {
+ try {
+ processNext(exchange);
+ } catch (Throwable ignore) {
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "catchRollback(" + getProcessor() + ")";
+ }
+ };
+ }
+ };
+
+ // NOTE: ErrorHandler has to be disabled since it operates
+ // within the failed transaction.
+ inheritErrorHandler(false);
+ // Used to validate messages are sent to the target.
+ from("activemq:queue:mock.a").trace().to("mock:a");
+ from("activemq:queue:mock.b").trace().to("mock:b");
+ from("activemq:queue:mock.c").trace().to("mock:c");
+ from("activemq:queue:mock.d").trace().to("mock:d");
+
+ // Receive from a and send to target in 1 tx.
+ from("activemq:queue:a").to("activemq:queue:mock.a");
+
+ // Cause an error after processing the send. The send to
+ // activemq:queue:mock.a should rollback
+ // since it is participating in the inbound transaction, but
+ // mock:b does not participate so we should see the message get
+ // there. Also, expect multiple inbound retries as the message
+ // is rolled back.
+ // transactionPolicy(requried);
+ from("activemq:queue:b").policy(rollback).to("activemq:queue:mock.a", "mock:b");
+
+ // Cause an error after processing the send in a new
+ // transaction. The send to activemq:queue:mock.a should
+ // rollback
+ // since the rollback is within it's transaction, but mock:b
+ // does not participate so we should see the message get
+ // there. Also, expect the message to be successfully consumed
+ // since the rollback error is not propagated.
+ // transactionPolicy(requried);
+ from("activemq:queue:c").policy(catchRollback).policy(requirenew).policy(rollback).to("activemq:queue:mock.a", "mock:b");
+
+ // Cause an error after processing the send in without a
+ // transaction. The send to activemq:queue:mock.a should
+ // succeed.
+ // Also, expect the message to be successfully consumed since
+ // the rollback error is not propagated.
+ from("activemq:queue:d").policy(catchRollback).policy(notsupported).policy(rollback).to("activemq:queue:mock.a");
+
+ // Receive message on a non transacted JMS endpoint, start a
+ // transaction, send and then rollback.
+ // mock:a should never get the message (due to rollback) but
+ // mock:b should get only 1 since the
+ // inbound was not transacted.
+ JmsEndpoint endpoint = (JmsEndpoint)endpoint("activemq:queue:e");
+ endpoint.getConfiguration().setTransacted(false);
+ endpoint.getConfiguration().setAcknowledgementMode(Session.AUTO_ACKNOWLEDGE);
+ from(endpoint).policy(requried).policy(rollback).to("activemq:queue:mock.a", "mock:b");
+
+ //
+ // Sets up 2 consumers on single topic, one being transacted the
+ // other not. Used to verify
+ // That each consumer can have independently configured
+ // transaction settings.
+ // Do a rollback, should cause the transacted consumer to
+ // re-deliver (since we are using a durable subscription) but
+ // not the un-transacted one.
+ // TODO: find out why re-delivery is not working with a non
+ // durable transacted topic.
+ JmsEndpoint endpoint1 = (JmsEndpoint)endpoint("activemq:topic:f");
endpoint1.getConfiguration().setTransacted(true);
endpoint1.getConfiguration().setSubscriptionDurable(true);
endpoint1.getConfiguration().setClientId("client2");
endpoint1.getConfiguration().setDurableSubscriptionName("sub");
- from(endpoint1).policy(requried).policy(rollback).to("activemq:queue:mock.a", "mock:b");
-
- JmsEndpoint endpoint2 = (JmsEndpoint) endpoint("activemq:topic:f");
+ from(endpoint1).policy(requried).policy(rollback).to("activemq:queue:mock.a", "mock:b");
+
+ JmsEndpoint endpoint2 = (JmsEndpoint)endpoint("activemq:topic:f");
endpoint2.getConfiguration().setTransacted(false);
- endpoint2.getConfiguration().setAcknowledgementMode(Session.AUTO_ACKNOWLEDGE);
+ endpoint2.getConfiguration().setAcknowledgementMode(Session.AUTO_ACKNOWLEDGE);
endpoint2.getConfiguration().setSubscriptionDurable(true);
endpoint2.getConfiguration().setClientId("client1");
endpoint2.getConfiguration().setDurableSubscriptionName("sub");
from(endpoint2).policy(requried).policy(rollback).to("activemq:queue:mock.c", "mock:d");
- }
- };
- }
-
+ }
+ };
+ }
+
protected CamelContext createCamelContext() throws Exception {
spring = new ClassPathXmlApplicationContext("org/apache/camel/component/jms/spring.xml");
- SpringCamelContext ctx = SpringCamelContext.springCamelContext(spring);
- PlatformTransactionManager transactionManager = (PlatformTransactionManager) spring.getBean("jmsTransactionManager");
- ConnectionFactory connectionFactory = (ConnectionFactory) spring.getBean("jmsConnectionFactory");
+ SpringCamelContext ctx = SpringCamelContext.springCamelContext(spring);
+ PlatformTransactionManager transactionManager = (PlatformTransactionManager)spring.getBean("jmsTransactionManager");
+ ConnectionFactory connectionFactory = (ConnectionFactory)spring.getBean("jmsConnectionFactory");
JmsComponent component = JmsComponent.jmsComponentTransacted(connectionFactory, transactionManager);
component.getConfiguration().setConcurrentConsumers(1);
- ctx.addComponent("activemq", component);
+ ctx.addComponent("activemq", component);
return ctx;
}
@Override
protected void setUp() throws Exception {
super.setUp();
-
-// for (Route route : this.context.getRoutes()) {
-// System.out.println(route);
-// }
-
- mockEndpointA = (MockEndpoint) resolveMandatoryEndpoint("mock:a");
- mockEndpointB = (MockEndpoint) resolveMandatoryEndpoint("mock:b");
- mockEndpointC = (MockEndpoint) resolveMandatoryEndpoint("mock:c");
- mockEndpointD = (MockEndpoint) resolveMandatoryEndpoint("mock:d");
+
+ // for (Route route : this.context.getRoutes()) {
+ // System.out.println(route);
+ // }
+
+ mockEndpointA = (MockEndpoint)resolveMandatoryEndpoint("mock:a");
+ mockEndpointB = (MockEndpoint)resolveMandatoryEndpoint("mock:b");
+ mockEndpointC = (MockEndpoint)resolveMandatoryEndpoint("mock:c");
+ mockEndpointD = (MockEndpoint)resolveMandatoryEndpoint("mock:d");
}
-
+
@Override
protected void tearDown() throws Exception {
- super.tearDown();
- spring.destroy();
+ super.tearDown();
+ spring.destroy();
}
/**
- * This test seems to be fail every other run.
+ * This test seems to be fail every other run.
+ *
* @throws Exception
*/
- public void disabledtestSenarioF() throws Exception {
- String expected = getName()+": "+System.currentTimeMillis();
- mockEndpointA.expectedMessageCount(0);
- mockEndpointB.expectedMinimumMessageCount(2);
- mockEndpointC.expectedMessageCount(0);
- mockEndpointD.expectedMessageCount(1);
+ public void disabledtestSenarioF() throws Exception {
+ String expected = getName() + ": " + System.currentTimeMillis();
+ mockEndpointA.expectedMessageCount(0);
+ mockEndpointB.expectedMinimumMessageCount(2);
+ mockEndpointC.expectedMessageCount(0);
+ mockEndpointD.expectedMessageCount(1);
sendBody("activemq:topic:f", expected);
// Wait till the endpoints get their messages.
- assertWait(10, TimeUnit.SECONDS, mockEndpointA,mockEndpointB,mockEndpointC,mockEndpointD);
+ assertWait(10, TimeUnit.SECONDS, mockEndpointA, mockEndpointB, mockEndpointC, mockEndpointD);
// Wait a little more to make sure extra messages are not received.
Thread.sleep(1000);
-
- assertIsSatisfied(mockEndpointA,mockEndpointB,mockEndpointC,mockEndpointD);
- }
- public void testSenarioA() throws Exception {
- String expected = getName()+": "+System.currentTimeMillis();
+ assertIsSatisfied(mockEndpointA, mockEndpointB, mockEndpointC, mockEndpointD);
+ }
+
+ public void testSenarioA() throws Exception {
+ String expected = getName() + ": " + System.currentTimeMillis();
mockEndpointA.expectedBodiesReceived(expected);
sendBody("activemq:queue:a", expected);
assertIsSatisfied(mockEndpointA);
- }
+ }
- public void testSenarioB() throws Exception {
- String expected = getName()+": "+System.currentTimeMillis();
- mockEndpointA.expectedMessageCount(0);
- mockEndpointB.expectedMinimumMessageCount(2); // May be more since spring seems to go into tight loop re-delivering.
+ public void testSenarioB() throws Exception {
+ String expected = getName() + ": " + System.currentTimeMillis();
+ mockEndpointA.expectedMessageCount(0);
+ mockEndpointB.expectedMinimumMessageCount(2); // May be more since
+ // spring seems to go
+ // into tight loop
+ // re-delivering.
sendBody("activemq:queue:b", expected);
- assertIsSatisfied(5, TimeUnit.SECONDS, mockEndpointA,mockEndpointB);
- }
+ assertIsSatisfied(5, TimeUnit.SECONDS, mockEndpointA, mockEndpointB);
+ }
- public void testSenarioC() throws Exception {
- String expected = getName()+": "+System.currentTimeMillis();
- mockEndpointA.expectedMessageCount(0);
- mockEndpointB.expectedMessageCount(1); // Should only get 1 message the incoming transaction does not rollback.
+ public void testSenarioC() throws Exception {
+ String expected = getName() + ": " + System.currentTimeMillis();
+ mockEndpointA.expectedMessageCount(0);
+ mockEndpointB.expectedMessageCount(1); // Should only get 1 message the
+ // incoming transaction does not
+ // rollback.
sendBody("activemq:queue:c", expected);
// Wait till the endpoints get their messages.
- assertWait(5, TimeUnit.SECONDS, mockEndpointA,mockEndpointB);
+ assertWait(5, TimeUnit.SECONDS, mockEndpointA, mockEndpointB);
// Wait a little more to make sure extra messages are not received.
Thread.sleep(1000);
-
- assertIsSatisfied(mockEndpointA,mockEndpointB);
- }
-
- public void testSenarioD() throws Exception {
- String expected = getName()+": "+System.currentTimeMillis();
- mockEndpointA.expectedMessageCount(1);
+
+ assertIsSatisfied(mockEndpointA, mockEndpointB);
+ }
+
+ public void testSenarioD() throws Exception {
+ String expected = getName() + ": " + System.currentTimeMillis();
+ mockEndpointA.expectedMessageCount(1);
sendBody("activemq:queue:d", expected);
// Wait till the endpoints get their messages.
- assertWait(5, TimeUnit.SECONDS, mockEndpointA,mockEndpointB);
+ assertWait(5, TimeUnit.SECONDS, mockEndpointA, mockEndpointB);
// Wait a little more to make sure extra messages are not received.
Thread.sleep(1000);
-
+
assertIsSatisfied(mockEndpointA);
- }
-
- public void testSenarioE() throws Exception {
- String expected = getName()+": "+System.currentTimeMillis();
- mockEndpointA.expectedMessageCount(0);
- mockEndpointB.expectedMessageCount(1);
+ }
+
+ public void testSenarioE() throws Exception {
+ String expected = getName() + ": " + System.currentTimeMillis();
+ mockEndpointA.expectedMessageCount(0);
+ mockEndpointB.expectedMessageCount(1);
sendBody("activemq:queue:e", expected);
// Wait till the endpoints get their messages.
- assertWait(5, TimeUnit.SECONDS, mockEndpointA,mockEndpointB);
+ assertWait(5, TimeUnit.SECONDS, mockEndpointA, mockEndpointB);
// Wait a little more to make sure extra messages are not received.
Thread.sleep(1000);
-
+
assertIsSatisfied(mockEndpointA, mockEndpointB);
- }
-
-
+ }
+
}
Modified: activemq/camel/trunk/components/camel-josql/src/main/java/org/apache/camel/builder/sql/SqlBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-josql/src/main/java/org/apache/camel/builder/sql/SqlBuilder.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-josql/src/main/java/org/apache/camel/builder/sql/SqlBuilder.java (original)
+++ activemq/camel/trunk/components/camel-josql/src/main/java/org/apache/camel/builder/sql/SqlBuilder.java Tue Aug 7 14:33:00 2007
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -16,31 +16,33 @@
*/
package org.apache.camel.builder.sql;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Message;
import org.apache.camel.Predicate;
import org.apache.camel.RuntimeExpressionException;
import org.apache.camel.util.ObjectHelper;
+
import org.josql.Query;
import org.josql.QueryExecutionException;
import org.josql.QueryParseException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.HashMap;
-
/**
- * A builder of SQL {@link org.apache.camel.Expression} and {@link org.apache.camel.Predicate} implementations
- *
+ * A builder of SQL {@link org.apache.camel.Expression} and
+ * {@link org.apache.camel.Predicate} implementations
+ *
* @version $Revision: $
*/
public class SqlBuilder<E extends Exchange> implements Expression<E>, Predicate<E> {
private Query query;
- private Map<String,Object> variables = new HashMap<String, Object>();
+ private Map<String, Object> variables = new HashMap<String, Object>();
public SqlBuilder(Query query) {
this.query = query;
@@ -63,11 +65,11 @@
}
// Builder API
- //-----------------------------------------------------------------------
+ // -----------------------------------------------------------------------
/**
* Creates a new builder for the given SQL query string
- *
+ *
* @param sql the SQL query to perform
* @return a new builder
* @throws QueryParseException if there is an issue with the SQL
@@ -86,9 +88,8 @@
return this;
}
-
// Properties
- //-----------------------------------------------------------------------
+ // -----------------------------------------------------------------------
public Map<String, Object> getVariables() {
return variables;
}
@@ -97,9 +98,8 @@
this.variables = properties;
}
-
// Implementation methods
- //-----------------------------------------------------------------------
+ // -----------------------------------------------------------------------
protected boolean matches(E exchange, List list) {
return ObjectHelper.matches(list);
}
@@ -113,8 +113,7 @@
}
try {
return query.execute(list).getResults();
- }
- catch (QueryExecutionException e) {
+ } catch (QueryExecutionException e) {
throw new RuntimeExpressionException(e);
}
}
@@ -130,7 +129,7 @@
query.setVariable("out", exchange.getOut());
}
- protected void addVariables(Map <String, Object> map) {
+ protected void addVariables(Map<String, Object> map) {
Set<Map.Entry<String, Object>> propertyEntries = map.entrySet();
for (Map.Entry<String, Object> entry : propertyEntries) {
query.setVariable(entry.getKey(), entry.getValue());
Modified: activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/Person.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/Person.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/Person.java (original)
+++ activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/Person.java Tue Aug 7 14:33:00 2007
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
Modified: activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/SqlTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/SqlTest.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/SqlTest.java (original)
+++ activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/SqlTest.java Tue Aug 7 14:33:00 2007
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -16,7 +16,8 @@
*/
package org.apache.camel.builder.sql;
-import static org.apache.camel.builder.sql.SqlBuilder.sql;
+import java.util.List;
+
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
@@ -25,7 +26,7 @@
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.DefaultExchange;
-import java.util.List;
+import static org.apache.camel.builder.sql.SqlBuilder.sql;
/**
* @version $Revision: $
@@ -40,7 +41,7 @@
Object value = expression.evaluate(exchange);
assertIsInstanceOf(List.class, value);
- List list = (List) value;
+ List list = (List)value;
assertEquals("List size", 2, list.size());
for (Object person : list) {
@@ -53,7 +54,7 @@
Object value = expression.evaluate(exchange);
assertIsInstanceOf(List.class, value);
- List<Person> list = (List<Person>) value;
+ List<Person> list = (List<Person>)value;
assertEquals("List size", 1, list.size());
for (Person person : list) {
@@ -81,10 +82,12 @@
Message message = exchange.getIn();
message.setHeader("fooHeader", "James");
- Person[] people = {new Person("James", "London"),
- new Person("Guillaume", "Normandy"),
- new Person("Rob", "London"),
- new Person("Hiram", "Tampa")};
+ Person[] people = {
+ new Person("James", "London"),
+ new Person("Guillaume", "Normandy"),
+ new Person("Rob", "London"),
+ new Person("Hiram", "Tampa")
+ };
message.setBody(people);
return exchange;
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/Callback.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/Callback.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/Callback.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/Callback.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/Consumed.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/Consumed.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/Consumed.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/Consumed.java Tue Aug 7 14:33:00 2007
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -30,6 +30,6 @@
* @version $Revision$
*/
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
+@Target({ElementType.METHOD })
public @interface Consumed {
}
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/DefaultTransactionStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/DefaultTransactionStrategy.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/DefaultTransactionStrategy.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/DefaultTransactionStrategy.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,14 +16,16 @@
*/
package org.apache.camel.component.jpa;
-import org.apache.camel.impl.ServiceSupport;
-import static org.apache.camel.util.ObjectHelper.notNull;
-import org.springframework.orm.jpa.JpaCallback;
-
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
+import org.apache.camel.impl.ServiceSupport;
+
+import org.springframework.orm.jpa.JpaCallback;
+
+import static org.apache.camel.util.ObjectHelper.notNull;
+
/**
* @version $Revision$
*/
@@ -51,8 +52,7 @@
Object answer = callback.doInJpa(em);
transaction.commit();
return answer;
- }
- catch (RuntimeException e) {
+ } catch (RuntimeException e) {
if (transaction != null) {
transaction.rollback();
}
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/DeleteHandler.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaComponent.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,16 +16,16 @@
*/
package org.apache.camel.component.jpa;
+import java.util.Map;
+
+import javax.persistence.EntityManagerFactory;
+
import org.apache.camel.CamelContext;
import org.apache.camel.Component;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultComponent;
-import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
-
-import javax.persistence.EntityManagerFactory;
-import java.util.Map;
/**
* A JPA Component
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,26 +16,28 @@
*/
package org.apache.camel.component.jpa;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.LockModeType;
+import javax.persistence.PersistenceException;
+import javax.persistence.Query;
+
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.impl.ScheduledPollConsumer;
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.orm.jpa.JpaCallback;
-import javax.persistence.EntityManager;
-import javax.persistence.LockModeType;
-import javax.persistence.PersistenceException;
-import javax.persistence.Query;
-import java.lang.reflect.Method;
-import java.util.List;
+import org.springframework.orm.jpa.JpaCallback;
/**
* @version $Revision$
*/
public class JpaConsumer extends ScheduledPollConsumer<Exchange> {
- private static final transient Log log = LogFactory.getLog(JpaConsumer.class);
+ private static final transient Log LOG = LogFactory.getLog(JpaConsumer.class);
private final JpaEndpoint endpoint;
private final TransactionStrategy template;
private QueryFactory queryFactory;
@@ -58,17 +59,17 @@
configureParameters(query);
List results = query.getResultList();
for (Object result : results) {
- if (log.isDebugEnabled()) {
- log.debug("Processing new entity: " + result);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Processing new entity: " + result);
}
if (lockEntity(result, entityManager)) {
- // lets turn the result into an exchange and fire it into the processor
+ // lets turn the result into an exchange and fire it
+ // into the processor
Exchange exchange = createExchange(result);
try {
getProcessor().process(exchange);
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new PersistenceException(e);
}
getDeleteHandler().deleteObject(entityManager, result);
@@ -81,7 +82,7 @@
}
// Properties
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
public JpaEndpoint getEndpoint() {
return endpoint;
}
@@ -136,12 +137,13 @@
}
// Implementation methods
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
/**
- * A strategy method to lock an object with an exclusive lock so that it can be processed
- *
- * @param entity the entity to be locked
+ * A strategy method to lock an object with an exclusive lock so that it can
+ * be processed
+ *
+ * @param entity the entity to be locked
* @param entityManager
* @return true if the entity was locked
*/
@@ -150,15 +152,14 @@
return true;
}
try {
- if (log.isDebugEnabled()) {
- log.debug("Acquiring exclusive lock on entity: " + entity);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Acquiring exclusive lock on entity: " + entity);
}
entityManager.lock(entity, LockModeType.WRITE);
return true;
- }
- catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug("Failed to achieve lock on entity: " + entity + ". Reason: " + e, e);
+ } catch (Exception e) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Failed to achieve lock on entity: " + entity + ". Reason: " + e, e);
}
return false;
}
@@ -167,33 +168,29 @@
protected QueryFactory createQueryFactory() {
if (query != null) {
return QueryBuilder.query(query);
- }
- else if (namedQuery != null) {
+ } else if (namedQuery != null) {
return QueryBuilder.namedQuery(namedQuery);
- }
- else if (nativeQuery != null) {
+ } else if (nativeQuery != null) {
return QueryBuilder.nativeQuery(nativeQuery);
- }
- else {
+ } else {
Class<?> entityType = endpoint.getEntityType();
if (entityType == null) {
return null;
- }
- else {
+ } else {
return QueryBuilder.query("select x from " + entityType.getName() + " x");
}
}
}
protected DeleteHandler<Object> createDeleteHandler() {
- // TODO auto-discover an annotation in the entity bean to indicate the process completed method call?
+ // TODO auto-discover an annotation in the entity bean to indicate the
+ // process completed method call?
Class<?> entityType = getEndpoint().getEntityType();
if (entityType != null) {
List<Method> methods = ObjectHelper.findMethodsWithAnnotation(entityType, Consumed.class);
if (methods.size() > 1) {
throw new IllegalArgumentException("Only one method can be annotated with the @Consumed annotation but found: " + methods);
- }
- else if (methods.size() == 1) {
+ } else if (methods.size() == 1) {
final Method method = methods.get(0);
return new DeleteHandler<Object>() {
@@ -209,8 +206,7 @@
entityManager.remove(entityBean);
}
};
- }
- else {
+ } else {
return new DeleteHandler<Object>() {
public void deleteObject(EntityManager entityManager, Object entityBean) {
// do nothing
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,6 +16,12 @@
*/
package org.apache.camel.component.jpa;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
import org.apache.camel.Consumer;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
@@ -27,12 +32,8 @@
import org.apache.camel.impl.DefaultExchange;
import org.apache.camel.impl.ScheduledPollEndpoint;
import org.apache.camel.util.IntrospectionSupport;
-import org.springframework.orm.jpa.JpaTemplate;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import java.util.Map;
+import org.springframework.orm.jpa.JpaTemplate;
/**
* @version $Revision$
@@ -77,11 +78,11 @@
}
public boolean isSingleton() {
- return false;
- }
+ return false;
+ }
// Properties
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
public JpaTemplate getTemplate() {
if (template == null) {
template = createTemplate();
@@ -167,7 +168,7 @@
}
// Implementation methods
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
protected JpaTemplate createTemplate() {
return new JpaTemplate(getEntityManagerFactory());
}
@@ -183,15 +184,14 @@
protected TransactionStrategy createTransactionStrategy() {
EntityManagerFactory emf = getEntityManagerFactory();
return JpaTemplateTransactionStrategy.newInstance(emf, getTemplate());
- //return new DefaultTransactionStrategy(emf);
+ // return new DefaultTransactionStrategy(emf);
}
protected Expression<Exchange> createProducerExpression() {
final Class<?> type = getEntityType();
if (type == null) {
return ExpressionBuilder.bodyExpression();
- }
- else {
+ } else {
return new Expression<Exchange>() {
public Object evaluate(Exchange exchange) {
Object answer = exchange.getIn().getBody(type);
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,15 +16,17 @@
*/
package org.apache.camel.component.jpa;
+import java.util.Iterator;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceException;
+
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.converter.ObjectConverter;
import org.apache.camel.impl.DefaultProducer;
-import org.springframework.orm.jpa.JpaCallback;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceException;
-import java.util.Iterator;
+import org.springframework.orm.jpa.JpaCallback;
/**
* @version $Revision$
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaTemplateTransactionStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaTemplateTransactionStrategy.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaTemplateTransactionStrategy.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaTemplateTransactionStrategy.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,7 +16,12 @@
*/
package org.apache.camel.component.jpa;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceException;
+
import org.apache.camel.impl.ServiceSupport;
+
import org.springframework.orm.jpa.JpaCallback;
import org.springframework.orm.jpa.JpaTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
@@ -25,10 +29,6 @@
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.PersistenceException;
-
/**
* Delegates the strategy to the {@link JpaTemplate} and {@link TransactionTemplate} for transaction handling
*
@@ -38,6 +38,11 @@
private final JpaTemplate jpaTemplate;
private final TransactionTemplate transactionTemplate;
+ public JpaTemplateTransactionStrategy(JpaTemplate jpaTemplate, TransactionTemplate transactionTemplate) {
+ this.jpaTemplate = jpaTemplate;
+ this.transactionTemplate = transactionTemplate;
+ }
+
/**
* Creates a new implementation from the given JPA factory
*/
@@ -54,11 +59,6 @@
tranasctionTemplate.afterPropertiesSet();
return new JpaTemplateTransactionStrategy(template, tranasctionTemplate);
- }
-
- public JpaTemplateTransactionStrategy(JpaTemplate jpaTemplate, TransactionTemplate transactionTemplate) {
- this.jpaTemplate = jpaTemplate;
- this.transactionTemplate = transactionTemplate;
}
public Object execute(final JpaCallback callback) {
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryBuilder.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,16 +16,17 @@
*/
package org.apache.camel.component.jpa;
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
/**
* A builder of query expressions
- *
+ *
* @version $Revision$
*/
public abstract class QueryBuilder implements QueryFactory {
@@ -34,7 +34,7 @@
/**
* Creates a query builder using the JPA query syntax
- *
+ *
* @param query JPA query language to create
* @return a query builder
*/
@@ -85,7 +85,7 @@
/**
* Specifies the parameters to the query
- *
+ *
* @param parameters the parameters to be configured on the query
* @return this query builder
*/
@@ -94,8 +94,9 @@
}
/**
- * Specifies the parameters to the query as an ordered collection of 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
*/
@@ -119,7 +120,7 @@
/**
* 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
*/
@@ -156,8 +157,7 @@
protected String getParameterDescription() {
if (parameterBuilder == null) {
return "";
- }
- else {
+ } else {
return " " + parameterBuilder.toString();
}
}
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/QueryFactory.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/TransactionStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/TransactionStrategy.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/TransactionStrategy.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/TransactionStrategy.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -24,5 +23,5 @@
* @version $Revision$
*/
public interface TransactionStrategy extends Service {
- public Object execute(JpaCallback callback);
+ Object execute(JpaCallback callback);
}
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,8 +16,13 @@
*/
package org.apache.camel.processor.idempotent.jpa;
+import java.util.List;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
import org.apache.camel.processor.idempotent.MessageIdRepository;
-import org.springframework.orm.jpa.JpaCallback;
+
import org.springframework.orm.jpa.JpaTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.transaction.TransactionDefinition;
@@ -26,13 +30,6 @@
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.persistence.PersistenceException;
-
-import java.util.List;
-
/**
* @version $Revision: 1.1 $
*/
@@ -40,7 +37,17 @@
protected static final String QUERY_STRING = "select x from " + MessageProcessed.class.getName() + " x where x.processorName = ?1 and x.messageId = ?2";
private JpaTemplate jpaTemplate;
private String processorName;
- private TransactionTemplate transactionTemplate;
+ private TransactionTemplate transactionTemplate;
+
+ public JpaMessageIdRepository(JpaTemplate template, String processorName) {
+ this(template, createTransactionTemplate(template), processorName);
+ }
+
+ public JpaMessageIdRepository(JpaTemplate template, TransactionTemplate transactionTemplate, String processorName) {
+ this.jpaTemplate = template;
+ this.processorName = processorName;
+ this.transactionTemplate = transactionTemplate;
+ }
public static JpaMessageIdRepository jpaMessageIdRepository(String persistenceUnit, String processorName) {
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(persistenceUnit);
@@ -51,42 +58,31 @@
return new JpaMessageIdRepository(jpaTemplate, processorName);
}
- public JpaMessageIdRepository(JpaTemplate template, String processorName) {
- this(template, createTransactionTemplate(template), processorName);
- }
-
- public JpaMessageIdRepository(JpaTemplate template, TransactionTemplate transactionTemplate, String processorName) {
- this.jpaTemplate = template;
- this.processorName = processorName;
- this.transactionTemplate=transactionTemplate;
- }
-
- static private TransactionTemplate createTransactionTemplate(JpaTemplate jpaTemplate) {
- TransactionTemplate transactionTemplate = new TransactionTemplate();
+ private static TransactionTemplate createTransactionTemplate(JpaTemplate jpaTemplate) {
+ TransactionTemplate transactionTemplate = new TransactionTemplate();
transactionTemplate.setTransactionManager(new JpaTransactionManager(jpaTemplate.getEntityManagerFactory()));
transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
return transactionTemplate;
}
public boolean contains(final String messageId) {
- // Run this in single transaction.
- Boolean rc = (Boolean) transactionTemplate.execute(new TransactionCallback(){
- public Object doInTransaction(TransactionStatus arg0) {
-
- List list = jpaTemplate.find(QUERY_STRING, processorName, messageId);
- if (list.isEmpty()) {
- MessageProcessed processed = new MessageProcessed();
- processed.setProcessorName(processorName);
- processed.setMessageId(messageId);
- jpaTemplate.persist(processed);
- jpaTemplate.flush();
- return Boolean.FALSE;
- }
- else {
- return Boolean.TRUE;
- }
- }
- });
- return rc.booleanValue();
+ // Run this in single transaction.
+ Boolean rc = (Boolean)transactionTemplate.execute(new TransactionCallback() {
+ public Object doInTransaction(TransactionStatus arg0) {
+
+ List list = jpaTemplate.find(QUERY_STRING, processorName, messageId);
+ if (list.isEmpty()) {
+ MessageProcessed processed = new MessageProcessed();
+ processed.setProcessorName(processorName);
+ processed.setMessageId(messageId);
+ jpaTemplate.persist(processed);
+ jpaTemplate.flush();
+ return Boolean.FALSE;
+ } else {
+ return Boolean.TRUE;
+ }
+ }
+ });
+ return rc.booleanValue();
}
}
Modified: activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/MessageProcessed.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/MessageProcessed.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/MessageProcessed.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/MessageProcessed.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -26,7 +25,7 @@
* @version $Revision: 1.1 $
*/
@Entity
-@UniqueConstraint(columnNames = {"processorName", "messageId"})
+@UniqueConstraint(columnNames = {"processorName", "messageId" })
public class MessageProcessed {
private Long id;
private String messageId;
Modified: activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,33 +16,37 @@
*/
package org.apache.camel.component.jpa;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceException;
+
import junit.framework.TestCase;
+
import org.apache.camel.CamelContext;
+import org.apache.camel.CamelTemplate;
import org.apache.camel.Consumer;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.CamelTemplate;
import org.apache.camel.examples.SendEmail;
import org.apache.camel.impl.DefaultCamelContext;
-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 org.springframework.orm.jpa.JpaCallback;
import org.springframework.orm.jpa.JpaTemplate;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceException;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+import static org.apache.camel.util.ServiceHelper.startServices;
+import static org.apache.camel.util.ServiceHelper.stopServices;
/**
* @version $Revision$
*/
public class JpaTest extends TestCase {
- private static final transient Log log = LogFactory.getLog(JpaTest.class);
+ private static final transient Log LOG = LogFactory.getLog(JpaTest.class);
protected CamelContext camelContext = new DefaultCamelContext();
protected CamelTemplate template = new CamelTemplate(camelContext);
protected JpaEndpoint endpoint;
@@ -83,7 +86,7 @@
// now lets create a consumer to consume it
consumer = endpoint.createConsumer(new Processor() {
public void process(Exchange e) {
- log.info("Received exchange: " + e.getIn());
+ LOG.info("Received exchange: " + e.getIn());
receivedExchange = e;
latch.countDown();
}
Modified: activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUsingCustomPersistenceUnitTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUsingCustomPersistenceUnitTest.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUsingCustomPersistenceUnitTest.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUsingCustomPersistenceUnitTest.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,32 +16,35 @@
*/
package org.apache.camel.component.jpa;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceException;
+
import junit.framework.TestCase;
+
import org.apache.camel.CamelContext;
+import org.apache.camel.CamelTemplate;
import org.apache.camel.Consumer;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.CamelTemplate;
import org.apache.camel.examples.MultiSteps;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.util.ServiceHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.orm.jpa.JpaCallback;
import org.springframework.orm.jpa.JpaTemplate;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceException;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
/**
* @version $Revision$
*/
public class JpaWithNamedQueryTest extends TestCase {
- private static final transient Log log = LogFactory.getLog(JpaWithNamedQueryTest.class);
+ private static final transient Log LOG = LogFactory.getLog(JpaWithNamedQueryTest.class);
protected CamelContext camelContext = new DefaultCamelContext();
protected CamelTemplate template = new CamelTemplate(camelContext);
protected JpaEndpoint endpoint;
@@ -81,13 +83,13 @@
// now lets assert that there is a result
results = jpaTemplate.find(queryText);
assertEquals("Should have results: " + results, 1, results.size());
- MultiSteps mail = (MultiSteps) results.get(0);
+ MultiSteps mail = (MultiSteps)results.get(0);
assertEquals("address property", "foo@bar.com", mail.getAddress());
// now lets create a consumer to consume it
consumer = endpoint.createConsumer(new Processor() {
public void process(Exchange e) {
- log.info("Received exchange: " + e.getIn());
+ LOG.info("Received exchange: " + e.getIn());
receivedExchange = e;
latch.countDown();
}
@@ -103,7 +105,8 @@
assertEquals("address property", "foo@bar.com", result.getAddress());
// lets now test that the database is updated
- // TODO we need to sleep as we will be invoked from inside the transaction!
+ // TODO we need to sleep as we will be invoked from inside the
+ // transaction!
Thread.sleep(1000);
transactionStrategy.execute(new JpaCallback() {
@@ -115,14 +118,13 @@
int counter = 1;
for (MultiSteps row : rows) {
- log.info("entity: " + counter++ + " = " + row);
+ LOG.info("entity: " + counter++ + " = " + row);
if (row.getAddress().equals("foo@bar.com")) {
- log.info("Found updated row: " + row);
+ LOG.info("Found updated row: " + row);
assertEquals("Updated row step for: " + row, 2, row.getStep());
- }
- else {
+ } else {
// dummy row
assertEquals("dummy row step for: " + row, 4, row.getStep());
}
@@ -141,7 +143,7 @@
Endpoint value = camelContext.getEndpoint(getEndpointUri());
assertNotNull("Could not find endpoint!", value);
assertTrue("Should be a JPA endpoint but was: " + value, value instanceof JpaEndpoint);
- endpoint = (JpaEndpoint) value;
+ endpoint = (JpaEndpoint)value;
transactionStrategy = endpoint.createTransactionStrategy();
jpaTemplate = endpoint.getTemplate();
Modified: activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,15 +16,15 @@
*/
package org.apache.camel.examples;
-import org.apache.camel.component.jpa.Consumed;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
+import org.apache.camel.component.jpa.Consumed;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* Represents a task which has multiple steps so that it can move from stage to stage
* with the method annotated with {@link @Consumed} being invoked when the Camel consumer
@@ -36,7 +35,7 @@
@Entity
@NamedQuery(name = "step1", query = "select x from MultiSteps x where x.step = 1")
public class MultiSteps {
- private static final transient Log log = LogFactory.getLog(MultiSteps.class);
+ private static final transient Log LOG = LogFactory.getLog(MultiSteps.class);
private Long id;
private String address;
private int step;
@@ -87,6 +86,6 @@
public void goToNextStep() {
setStep(getStep() + 1);
- log.info("Invoked the completion complete method. Now updated the step to: " + getStep());
+ LOG.info("Invoked the completion complete method. Now updated the step to: " + getStep());
}
}
Modified: activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/examples/SendEmail.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaIdempotentConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaIdempotentConsumerTest.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaIdempotentConsumerTest.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaIdempotentConsumerTest.java Tue Aug 7 14:33:00 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,16 +16,17 @@
*/
package org.apache.camel.processor.jpa;
-import static org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository.jpaMessageIdRepository;
-
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.processor.IdempotentConsumerTest;
import org.apache.camel.spring.SpringCamelContext;
import org.apache.camel.spring.SpringRouteBuilder;
+
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.jpa.JpaTemplate;
+
+import static org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository.jpaMessageIdRepository;
/**
* @version $Revision: 1.1 $
Modified: activemq/camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelExpression.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelExpression.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelExpression.java (original)
+++ activemq/camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelExpression.java Tue Aug 7 14:33:00 2007
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -16,15 +16,16 @@
*/
package org.apache.camel.language.juel;
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+
import de.odysseus.el.util.SimpleContext;
+
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.impl.ExpressionSupport;
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
-
/**
* @version $Revision: $
*/
@@ -34,13 +35,13 @@
private final Class<?> type;
private ExpressionFactory expressionFactory;
- public static JuelExpression el(String expression) {
- return new JuelExpression(expression, Object.class);
- }
-
public JuelExpression(String expression, Class<?> type) {
this.expression = expression;
this.type = type;
+ }
+
+ public static JuelExpression el(String expression) {
+ return new JuelExpression(expression, Object.class);
}
public Object evaluate(Exchange exchange) {
Modified: activemq/camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelLanguage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelLanguage.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelLanguage.java (original)
+++ activemq/camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelLanguage.java Tue Aug 7 14:33:00 2007
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -16,10 +16,10 @@
*/
package org.apache.camel.language.juel;
-import org.apache.camel.spi.Language;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Predicate;
+import org.apache.camel.spi.Language;
/**
* @version $Revision: $
Modified: activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/language/juel/JuelLanguageTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/language/juel/JuelLanguageTest.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/language/juel/JuelLanguageTest.java (original)
+++ activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/language/juel/JuelLanguageTest.java Tue Aug 7 14:33:00 2007
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
Modified: activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/language/juel/JuelTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/language/juel/JuelTest.java?view=diff&rev=563665&r1=563664&r2=563665
==============================================================================
--- activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/language/juel/JuelTest.java (original)
+++ activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/language/juel/JuelTest.java Tue Aug 7 14:33:00 2007
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -16,12 +16,13 @@
*/
package org.apache.camel.language.juel;
-import de.odysseus.el.util.SimpleContext;
-import junit.framework.TestCase;
-
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
+
+import junit.framework.TestCase;
+
+import de.odysseus.el.util.SimpleContext;
/**
* @version $Revision: $