Author: davsclaus Date: Fri Feb 11 06:00:51 2011 New Revision: 1069678 URL: http://svn.apache.org/viewvc?rev=1069678&view=rev Log: Fixed CS. Polished.
Modified: camel/trunk/components/camel-context/ (props changed) camel/trunk/components/camel-context/pom.xml camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/ContextConverters.java camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/LocalContextComponent.java camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/QualifiedContextComponent.java camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxTest.java camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxWithVerboseUriTest.java camel/trunk/components/camel-context/src/test/resources/log4j.properties Propchange: camel/trunk/components/camel-context/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Feb 11 06:00:51 2011 @@ -0,0 +1,9 @@ +.project +.checkstyle +.pmd +.classpath +target +.settings +eclipse-classes +*.i?? + Modified: camel/trunk/components/camel-context/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-context/pom.xml?rev=1069678&r1=1069677&r2=1069678&view=diff ============================================================================== --- camel/trunk/components/camel-context/pom.xml (original) +++ camel/trunk/components/camel-context/pom.xml Fri Feb 11 06:00:51 2011 @@ -15,72 +15,68 @@ See the License for the specific language governing permissions and limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>camel-parent</artifactId> - <groupId>org.apache.camel</groupId> - <version>2.7-SNAPSHOT</version> - <relativePath>../../parent</relativePath> - </parent> - - <artifactId>camel-context</artifactId> - <name>Camel :: Context </name> - <description>Camel Context component to expose CamelContext objects as a black box Component for use in other routes</description> - <packaging>bundle</packaging> - - <properties> - <camel.osgi.export.pkg> - org.apache.camel.component.context.*, - </camel.osgi.export.pkg> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core</artifactId> - </dependency> - - <!-- testing --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core-xml</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-spring</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <scope>test</scope> - </dependency> - - <!-- logging --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <parent> + <artifactId>camel-parent</artifactId> + <groupId>org.apache.camel</groupId> + <version>2.7-SNAPSHOT</version> + <relativePath>../../parent</relativePath> + </parent> + + <artifactId>camel-context</artifactId> + <name>Camel :: Context</name> + <description>Camel Context component to expose CamelContext objects as a black box Component for use in other routes</description> + <packaging>bundle</packaging> + + <properties> + <camel.osgi.export.pkg>org.apache.camel.component.context.*</camel.osgi.export.pkg> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + </dependency> + + <!-- testing --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <scope>test</scope> + </dependency> + + <!-- logging --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> </project> Modified: camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/ContextConverters.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/ContextConverters.java?rev=1069678&r1=1069677&r2=1069678&view=diff ============================================================================== --- camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/ContextConverters.java (original) +++ camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/ContextConverters.java Fri Feb 11 06:00:51 2011 @@ -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, @@ -21,13 +20,18 @@ import org.apache.camel.CamelContext; import org.apache.camel.Converter; /** - * Converts from a CamelContext to a ContextComponent so we can easily refer to external camel contexts in the Registry - * as a Component + * Converts from a {@link CamelContext} to a {@link LocalContextComponent} so we can easily refer to + * external {@link CamelContext}s in the {@link org.apache.camel.spi.Registry} as a {@link org.apache.camel.Component} */ @Converter -public class ContextConverters { +public final class ContextConverters { + + private ContextConverters() { + } + @Converter public static LocalContextComponent toComponent(CamelContext localContext) { return new LocalContextComponent(localContext); } + } Modified: camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/LocalContextComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/LocalContextComponent.java?rev=1069678&r1=1069677&r2=1069678&view=diff ============================================================================== --- camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/LocalContextComponent.java (original) +++ camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/LocalContextComponent.java Fri Feb 11 06:00:51 2011 @@ -16,19 +16,18 @@ */ package org.apache.camel.component.context; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; -import org.apache.camel.NoSuchEndpointException; import org.apache.camel.impl.DefaultComponent; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - /** * A Camel Component which exposes a local {@link CamelContext} instance as a black box set of endpoints. */ @@ -55,9 +54,6 @@ public class LocalContextComponent exten } public CamelContext getLocalCamelContext() { - if (localCamelContext == null) { - - } return localCamelContext; } @@ -94,7 +90,9 @@ public class LocalContextComponent exten } protected void logUsingEndpoint(String uri, Endpoint endpoint) { - LOG.debug("Mapping the URI " + uri + " to local endpoint " + endpoint); + if (LOG.isDebugEnabled()) { + LOG.debug("Mapping the URI " + uri + " to local endpoint " + endpoint); + } } } Modified: camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/QualifiedContextComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/QualifiedContextComponent.java?rev=1069678&r1=1069677&r2=1069678&view=diff ============================================================================== --- camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/QualifiedContextComponent.java (original) +++ camel/trunk/components/camel-context/src/main/java/org/apache/camel/component/context/QualifiedContextComponent.java Fri Feb 11 06:00:51 2011 @@ -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,8 @@ */ package org.apache.camel.component.context; +import java.util.Map; + import org.apache.camel.Component; import org.apache.camel.Endpoint; import org.apache.camel.impl.DefaultComponent; @@ -24,13 +25,11 @@ import org.apache.camel.util.ObjectHelpe import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Map; - /** - * Supports the explicit and verbose URIs of the form <b>context:camelContextId:someEndpoint</b> to access - * a local endpoint inside an external CamelContext. + * Supports the explicit and verbose URIs of the form <tt>context:camelContextId:someEndpoint</tt> to access + * a local endpoint inside an external {@link org.apache.camel.CamelContext}. * <p/> - * Typically there's no need to use this level of verbosity, you can just use <b>camelContextId:someEndpoint</b> + * Typically there's no need to use this level of verbosity, you can just use <tt>camelContextId:someEndpoint</tt> */ public class QualifiedContextComponent extends DefaultComponent { private static final transient Logger LOG = LoggerFactory.getLogger(QualifiedContextComponent.class); @@ -43,10 +42,14 @@ public class QualifiedContextComponent e String localEndpoint = splitURI[1]; Component component = getCamelContext().getComponent(contextId); if (component != null) { - LOG.debug("Attempting to create local endpoint: " + localEndpoint + " inside the component: " + component); + if (LOG.isDebugEnabled()) { + LOG.debug("Attempting to create local endpoint: " + localEndpoint + " inside the component: " + component); + } return component.createEndpoint(localEndpoint); } } + return null; } + } Modified: camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxTest.java?rev=1069678&r1=1069677&r2=1069678&view=diff ============================================================================== --- camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxTest.java (original) +++ camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxTest.java Fri Feb 11 06:00:51 2011 @@ -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,6 @@ */ package org.apache.camel.component.context; -import org.apache.camel.CamelContext; import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; Modified: camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxWithVerboseUriTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxWithVerboseUriTest.java?rev=1069678&r1=1069677&r2=1069678&view=diff ============================================================================== --- camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxWithVerboseUriTest.java (original) +++ camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxWithVerboseUriTest.java Fri Feb 11 06:00:51 2011 @@ -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,7 +23,6 @@ import org.apache.camel.builder.RouteBui */ public class JavaDslBlackBoxWithVerboseUriTest extends JavaDslBlackBoxTest { - @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @@ -34,4 +32,6 @@ public class JavaDslBlackBoxWithVerboseU from("context:accounts:direct://invoice").to("mock:results"); } }; - }} + } + +} Modified: camel/trunk/components/camel-context/src/test/resources/log4j.properties URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-context/src/test/resources/log4j.properties?rev=1069678&r1=1069677&r2=1069678&view=diff ============================================================================== --- camel/trunk/components/camel-context/src/test/resources/log4j.properties (original) +++ camel/trunk/components/camel-context/src/test/resources/log4j.properties Fri Feb 11 06:00:51 2011 @@ -1,10 +1,26 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- # -# The logging properties used for eclipse testing, We want to see debug output on the console. +# The logging properties used for testing. # log4j.rootLogger=INFO, file -log4j.logger.org.springframework=WARN +#log4j.logger.org.springframework=WARN #log4j.logger.org.apache.camel=DEBUG # CONSOLE appender not used by default @@ -17,4 +33,4 @@ log4j.appender.out.layout.ConversionPatt log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d %-5p %c{1} - %m %n -log4j.appender.file.file=target/camel-routebox.log +log4j.appender.file.file=target/camel-context-test.log