You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/04/14 07:27:46 UTC
svn commit: r647667 - in /activemq/camel/trunk:
camel-core/src/main/java/org/apache/camel/builder/xml/
camel-core/src/main/java/org/apache/camel/component/file/
camel-core/src/main/java/org/apache/camel/processor/
camel-core/src/test/java/org/apache/ca...
Author: ningjiang
Date: Sun Apr 13 22:27:43 2008
New Revision: 647667
URL: http://svn.apache.org/viewvc?rev=647667&view=rev
Log:
Added the missing Apache Header and fixed some CS errors
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetHeaderProcessor.java
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/ToFileRouteTest.java
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/InterceptorLogTest.java
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptorSimpleRouteTest.java
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisComponent.java
activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisEndpoint.java
activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisPollingConsumer.java
activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisProducer.java
activemq/camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/Account.java
activemq/camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteTest.java
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java
activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Sun Apr 13 22:27:43 2008
@@ -43,7 +43,7 @@
/**
* Creates a <a href="http://activemq.apache.org/camel/processor.html">Processor</a>
* which performs an XSLT transformation of the IN message body
- *
+ *
* @version $Revision$
*/
public class XsltBuilder implements Processor {
@@ -198,17 +198,17 @@
* @throws TransformerConfigurationException is thrown if creating a XSLT transformer failed.
*/
public void setTransformerSource(Source source) throws TransformerConfigurationException {
- // Check that the call to newTransformer() returns a valid transformer instance.
- // In case of an xslt parse error, it will return null and we should stop the
- // deployment and raise an exception as the route will not be setup properly.
- Transformer transformer = converter.getTransformerFactory().newTransformer(source);
- if (transformer != null) {
- setTransformer(transformer);
- } else {
- throw new TransformerConfigurationException("Error creating XSLT transformer. " +
- "This is most likely be caused by an XML parse error. " +
- "Please verify your XSLT file configured.");
- }
+ // Check that the call to newTransformer() returns a valid transformer instance.
+ // In case of an xslt parse error, it will return null and we should stop the
+ // deployment and raise an exception as the route will not be setup properly.
+ Transformer transformer = converter.getTransformerFactory().newTransformer(source);
+ if (transformer != null) {
+ setTransformer(transformer);
+ } else {
+ throw new TransformerConfigurationException("Error creating XSLT transformer. "
+ + "This is most likely be caused by an XML parse error. "
+ + "Please verify your XSLT file configured.");
+ }
}
/**
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java Sun Apr 13 22:27:43 2008
@@ -190,7 +190,7 @@
if (isUnchangedSize()) {
long prevFileSize = (fileSizes.get(file) == null) ? 0 : fileSizes.get(file).longValue();
sizeDifference = file.length() - prevFileSize;
- sizeCheck = (sizeDifference == 0);
+ sizeCheck = sizeDifference == 0;
}
boolean answer = lastModifiedCheck && sizeCheck;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetHeaderProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetHeaderProcessor.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetHeaderProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetHeaderProcessor.java Sun Apr 13 22:27:43 2008
@@ -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,
@@ -40,15 +39,15 @@
Processor childProcessor) {
super(childProcessor);
this.name = name;
- this.expression = expression;
+ this.expression = expression;
}
public void process(Exchange exchange) throws Exception {
Object value = expression.evaluate(exchange);
if (value == null) {
- LOG.warn("Expression: " + expression
+ LOG.warn("Expression: " + expression
+ " on exchange: " + exchange + " evaluated to null.");
- }
+ }
exchange.getIn().setHeader(name, value);
super.process(exchange);
}
@@ -56,5 +55,5 @@
@Override
public String toString() {
return "setHeader(" + name + ", " + expression + ")";
- }
+ }
}
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/ToFileRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/ToFileRouteTest.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/ToFileRouteTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/ToFileRouteTest.java Sun Apr 13 22:27:43 2008
@@ -19,10 +19,10 @@
import java.io.File;
import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Processor;
import org.apache.camel.Exchange;
-import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
/**
* For documentation how to write files using the FileProducer.
@@ -74,5 +74,5 @@
}
// END SNIPPET: e1
-
+
}
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/InterceptorLogTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/InterceptorLogTest.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/InterceptorLogTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/InterceptorLogTest.java Sun Apr 13 22:27:43 2008
@@ -1,8 +1,24 @@
+/**
+ * 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.issues;
import org.apache.camel.ContextTestSupport;
-import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
/**
* Testing http://activemq.apache.org/camel/dsl.html
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptorSimpleRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptorSimpleRouteTest.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptorSimpleRouteTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptorSimpleRouteTest.java Sun Apr 13 22:27:43 2008
@@ -17,8 +17,8 @@
package org.apache.camel.processor;
import org.apache.camel.ContextTestSupport;
-import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
/**
* A simple interceptor routing test
Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java Sun Apr 13 22:27:43 2008
@@ -100,7 +100,7 @@
int lastPathIndex = fileName.lastIndexOf('/');
if (lastPathIndex != -1) {
String directory = fileName.substring(0, lastPathIndex);
- boolean success = buildDirectory(channel, directory);
+ boolean success = buildDirectory(channel, directory);
if (!success) {
LOG.warn("Couldn't build directory: " + directory + " (either permissions deny it, or it already exists)");
}
@@ -135,7 +135,7 @@
protected static boolean buildDirectory(ChannelSftp sftpClient, String dirName)
throws IOException, SftpException {
-
+
boolean atLeastOneSuccess = false;
final StringBuilder sb = new StringBuilder(dirName.length());
final String[] dirs = dirName.split("\\/");
@@ -154,5 +154,5 @@
return atLeastOneSuccess;
}
-
+
}
Modified: activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java Sun Apr 13 22:27:43 2008
@@ -1,7 +1,23 @@
+/**
+ * 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.file.remote;
-import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
/**
* Unit test used for FTP wiki documentation
Modified: activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisComponent.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisComponent.java (original)
+++ activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisComponent.java Sun Apr 13 22:27:43 2008
@@ -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,
@@ -37,9 +36,10 @@
* @version $Revision$
*/
public class IBatisComponent extends DefaultComponent {
+ public static final String DEFAULT_CONFIG_URI = "SqlMapConfig.xml";
private static final transient Log LOG = LogFactory.getLog(IBatisComponent.class);
- public static final String DEFAULT_CONFIG_URI = "SqlMapConfig.xml";
+
private SqlMapClient sqlMapClient;
private Resource sqlMapResource;
Modified: activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisEndpoint.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisEndpoint.java Sun Apr 13 22:27:43 2008
@@ -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,
@@ -18,14 +17,15 @@
package org.apache.camel.component.ibatis;
import java.io.IOException;
-import java.util.List;
import java.sql.SQLException;
+import java.util.List;
+
+import com.ibatis.sqlmap.client.SqlMapClient;
+import org.apache.camel.Message;
import org.apache.camel.PollingConsumer;
import org.apache.camel.Producer;
-import org.apache.camel.Message;
import org.apache.camel.impl.DefaultPollingEndpoint;
-import com.ibatis.sqlmap.client.SqlMapClient;
/**
* An <a href="http://activemq.apache.org/camel/ibatis.html>iBatis Endpoint</a>
@@ -51,7 +51,7 @@
}
public Producer createProducer() throws Exception {
- return new IBatisProducer(this);
+ return new IBatisProducer(this);
}
@Override
Modified: activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisPollingConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisPollingConsumer.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisPollingConsumer.java (original)
+++ activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisPollingConsumer.java Sun Apr 13 22:27:43 2008
@@ -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,10 +16,6 @@
*/
package org.apache.camel.component.ibatis;
-import java.sql.SQLException;
-import java.util.List;
-
-import com.ibatis.sqlmap.client.SqlMapClient;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.RuntimeCamelException;
@@ -51,8 +46,7 @@
Message in = exchange.getIn();
endpoint.query(in);
return exchange;
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new RuntimeCamelException("Failed to poll: " + endpoint + ". Reason: " + e, e);
}
}
Modified: activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisProducer.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisProducer.java (original)
+++ activemq/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisProducer.java Sun Apr 13 22:27:43 2008
@@ -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,
@@ -19,9 +18,7 @@
import java.util.Iterator;
-import com.ibatis.sqlmap.client.SqlMapClient;
import org.apache.camel.Exchange;
-import org.apache.camel.util.ObjectHelper;
import org.apache.camel.converter.ObjectConverter;
import org.apache.camel.impl.DefaultProducer;
@@ -46,8 +43,7 @@
if (body == null) {
// must be a poll so lets do a query
endpoint.query(exchange.getOut(true));
- }
- else {
+ } else {
String operation = getOperationName(exchange);
// lets handle arrays or collections of objects
Modified: activemq/camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/Account.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/Account.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/Account.java (original)
+++ activemq/camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/Account.java Sun Apr 13 22:27:43 2008
@@ -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-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteTest.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteTest.java (original)
+++ activemq/camel/trunk/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteTest.java Sun Apr 13 22:27:43 2008
@@ -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,13 @@
*/
package org.apache.camel.component.ibatis;
-import java.util.List;
-import java.sql.Statement;
import java.sql.Connection;
+import java.sql.Statement;
+import java.util.List;
import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
/**
* @version $Revision$
Modified: activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java (original)
+++ activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java Sun Apr 13 22:27:43 2008
@@ -57,8 +57,7 @@
public String toString() {
if (jmsMessage != null) {
return "JmsMessage: " + jmsMessage;
- }
- else {
+ } else {
return "JmsMessage: " + getBody();
}
}
@@ -96,8 +95,7 @@
if (exchange instanceof JmsExchange) {
JmsExchange jmsExchange = (JmsExchange) exchange;
return jmsExchange.getBinding();
- }
- else {
+ } else {
return new JmsBinding();
}
}
@@ -120,8 +118,7 @@
if (jmsMessage != null && !name.startsWith("JMS")) {
try {
answer = jmsMessage.getObjectProperty(name);
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
throw new MessagePropertyAccessException(name, e);
}
}
@@ -162,16 +159,14 @@
// TODO this works around a bug in the ActiveMQ property handling
map.put("JMSXGroupID", jmsMessage.getStringProperty("JMSXGroupID"));
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
throw new MessageJMSPropertyAccessException(e);
}
Enumeration names;
try {
names = jmsMessage.getPropertyNames();
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
throw new MessagePropertyNamesAccessException(e);
}
while (names.hasMoreElements()) {
@@ -179,8 +174,7 @@
try {
Object value = jmsMessage.getObjectProperty(name);
map.put(name, value);
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
throw new MessagePropertyAccessException(name, e);
}
}
@@ -202,11 +196,9 @@
String result;
if (destination == null) {
result = "null destination!" + File.separator;
- }
- else if (destination instanceof Topic) {
+ } else if (destination instanceof Topic) {
result = "topic" + File.separator + ((Topic) destination).getTopicName() + File.separator;
- }
- else {
+ } else {
result = "queue" + File.separator + ((Queue) destination).getQueueName() + File.separator;
}
return result;
Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java Sun Apr 13 22:27:43 2008
@@ -27,20 +27,19 @@
public class SpringComponentScanTest extends ContextTestSupport {
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- ApplicationContext c = new ClassPathXmlApplicationContext(
- "org/apache/camel/spring/config/scan/componentScan.xml");
- context = (CamelContext) c.getBean("camelContext");
- template = new CamelTemplate<Exchange>(context);
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ ApplicationContext c = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/scan/componentScan.xml");
+ context = (CamelContext)c.getBean("camelContext");
+ template = new CamelTemplate<Exchange>(context);
- }
+ }
- public void testSpringComponentScanFeature() throws InterruptedException {
- template.sendBody("direct:start", "request");
- MockEndpoint mock = getMockEndpoint("mock:end");
- mock.expectedMessageCount(1);
- mock.assertIsSatisfied();
- }
+ public void testSpringComponentScanFeature() throws InterruptedException {
+ template.sendBody("direct:start", "request");
+ MockEndpoint mock = getMockEndpoint("mock:end");
+ mock.expectedMessageCount(1);
+ mock.assertIsSatisfied();
+ }
}
Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java Sun Apr 13 22:27:43 2008
@@ -24,8 +24,8 @@
@Component
public class MyProcessor implements Processor {
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().setBody("foo");
- }
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setBody("foo");
+ }
}
Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java Sun Apr 13 22:27:43 2008
@@ -23,16 +23,16 @@
public class MyRouteBuilder extends RouteBuilder {
- MyProcessor component;
+ MyProcessor component;
- @Override
- public void configure() throws Exception {
- from("direct:start").process(component).to("mock:end");
- }
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").process(component).to("mock:end");
+ }
- @Autowired
- public void setComponent(MyProcessor component) {
- this.component = component;
- }
+ @Autowired
+ public void setComponent(MyProcessor component) {
+ this.component = component;
+ }
}
Modified: activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java?rev=647667&r1=647666&r2=647667&view=diff
==============================================================================
--- activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java (original)
+++ activemq/camel/trunk/tooling/maven/maven-camel-converters/src/main/java/org/apache/camel/maven/ConvertersMojo.java Sun Apr 13 22:27:43 2008
@@ -16,13 +16,6 @@
*/
package org.apache.camel.maven;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.ReportingTypeConverterLoader;
-import org.apache.camel.util.ReportingTypeConverterRegistry;
-import org.apache.camel.util.ReportingTypeConverterLoader.TypeMapping;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -30,19 +23,28 @@
import java.util.HashSet;
import java.util.Set;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.ReportingTypeConverterLoader;
+import org.apache.camel.util.ReportingTypeConverterLoader.TypeMapping;
+import org.apache.camel.util.ReportingTypeConverterRegistry;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
/**
* Generate report of available type converstions.
*
* @goal report
- *
+ *
* @phase verify
*/
public class ConvertersMojo
- extends AbstractMojo
-{
+ extends AbstractMojo {
+ private static final String LINE_SEPARATOR =
+ "-------------------------------------------------------------------------------\n";
/**
* Base directory where all reports are written to.
- *
+ *
* @parameter expression="${project.build.directory}/camel-reports"
*/
private File reportsDirectory;
@@ -54,42 +56,39 @@
*/
private boolean generateReports;
- private static final String LINE_SEPARATOR =
- "-------------------------------------------------------------------------------\n";
-
+
+
public void execute() throws MojoExecutionException {
- getLog().info( "Camel report directory: " + reportsDirectory );
-
+ getLog().info("Camel report directory: " + reportsDirectory);
+
ReportingTypeConverterLoader loader = new ReportingTypeConverterLoader();
ReportingTypeConverterRegistry registry = new ReportingTypeConverterRegistry();
try {
- loader.load(registry);
-
- String[] errors = registry.getErrors();
- for (String error : errors) {
- getLog().error(error);
- }
- }
- catch (Exception e) {
- throw new MojoExecutionException(e.getMessage());
+ loader.load(registry);
+
+ String[] errors = registry.getErrors();
+ for (String error : errors) {
+ getLog().error(error);
+ }
+ } catch (Exception e) {
+ throw new MojoExecutionException(e.getMessage());
}
- if (generateReports) {
- generateReport(loader.getTypeConversions());
- }
+ if (generateReports) {
+ generateReport(loader.getTypeConversions());
+ }
}
-
+
protected void generateReport(TypeMapping[] mappings) throws MojoExecutionException {
-
- File f = reportsDirectory;
+
+ File f = reportsDirectory;
if (!f.exists()) {
f.mkdirs();
}
- File report = new File(f, "camel-converters.txt" );
+ File report = new File(f, "camel-converters.txt");
FileWriter fw = null;
- try
- {
+ try {
fw = new FileWriter(report);
fw.write("Camel Type Converter definitions\n");
@@ -97,53 +96,49 @@
Set<String> packages = new HashSet<String>();
Set<String> classes = new HashSet<String>();
-
+
StringBuffer buffer = new StringBuffer();
Class prevFrom = null;
Class prevTo = null;
for (TypeMapping mapping : mappings) {
- boolean ignored = false;
- Class from = mapping.getFromType();
- Class to = mapping.getToType();
- if (ObjectHelper.equal(from, prevFrom) &&
- ObjectHelper.equal(to, prevTo)) {
-
- ignored = true;
- buffer.append(" ");
- }
- prevFrom = from;
- prevTo = to;
- Method method = mapping.getMethod();
- Class methodClass = method.getDeclaringClass();
- packages.add(methodClass.getPackage().getName());
- classes.add(methodClass.getName());
-
- buffer.append(from.getSimpleName() + "=>" + to.getSimpleName());
- buffer.append(" [" + mapping.getConverterType().getSimpleName());
- buffer.append("(" + methodClass.getName() + "." + method.getName() + "())]");
- if (ignored) {
- buffer.append(" - IGNORED replaced by conversion method above");
- }
-
+ boolean ignored = false;
+ Class from = mapping.getFromType();
+ Class to = mapping.getToType();
+ if (ObjectHelper.equal(from, prevFrom) && ObjectHelper.equal(to, prevTo)) {
+
+ ignored = true;
+ buffer.append(" ");
+ }
+ prevFrom = from;
+ prevTo = to;
+ Method method = mapping.getMethod();
+ Class methodClass = method.getDeclaringClass();
+ packages.add(methodClass.getPackage().getName());
+ classes.add(methodClass.getName());
+
+ buffer.append(from.getSimpleName() + "=>" + to.getSimpleName());
+ buffer.append(" [" + mapping.getConverterType().getSimpleName());
+ buffer.append("(" + methodClass.getName() + "." + method.getName() + "())]");
+ if (ignored) {
+ buffer.append(" - IGNORED replaced by conversion method above");
+ }
+
fw.write(buffer.toString() + "\n");
buffer.setLength(0);
}
-
- String summary = "Found " + mappings.length + " type conversion methods in "
- + classes.size() + " classes from " + packages.size() + " packages.";
+
+ String summary = "Found " + mappings.length + " type conversion methods in " + classes.size()
+ + " classes from " + packages.size() + " packages.";
fw.write(LINE_SEPARATOR);
fw.write(summary + "\n");
- getLog().info(summary);
- }
- catch (IOException e ) {
- throw new MojoExecutionException( "Error creating report file " + report, e);
- }
- finally {
+ getLog().info(summary);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Error creating report file " + report, e);
+ } finally {
if (fw != null) {
try {
fw.close();
- }
- catch (IOException e) {
+ } catch (IOException e) {
// ignore
}
}