Author: davsclaus
Date: Mon Aug 23 07:35:11 2010
New Revision: 988011
URL: http://svn.apache.org/viewvc?rev=988011&view=rev
Log:
Fixed compilation and checkstyle.
Modified:
camel/trunk/examples/camel-example-guice-jms/pom.xml
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyActivator.java
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyOSGiModule.java
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyRouteBuilder.java
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/SomeBean.java
camel/trunk/examples/camel-example-guice-jms/src/test/java/org/apache/camel/example/guice/jms/GuiceTest.java
Modified: camel/trunk/examples/camel-example-guice-jms/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-guice-jms/pom.xml?rev=988011&r1=988010&r2=988011&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-guice-jms/pom.xml (original)
+++ camel/trunk/examples/camel-example-guice-jms/pom.xml Mon Aug 23 07:35:11
2010
@@ -1,160 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one or
more
- contributor license agreements. See the NOTICE file distributed
with
- this work for additional information regarding copyright
ownership.
- The ASF licenses this file to You under the Apache License,
Version
- 2.0 (the "License"); you may not use this file except in
compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- applicable law or agreed to in writing, software distributed
under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR
- CONDITIONS OF ANY KIND, either express or implied. See the
License for
- the specific language governing permissions and limitations
under the
- License.
- -->
-
-<project 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/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>examples</artifactId>
- <version>2.5-SNAPSHOT</version>
- </parent>
-
- <artifactId>camel-example-guice-jms</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Example :: Guice :: JMS</name>
- <description>An example showing how to work with Camel, Guice and
JMS</description>
-
- <properties>
-
<camel.osgi.export.pkg>org.apache.camel.example.guice.jms.*</camel.osgi.export.pkg>
-
<camel.osgi.import.additional>org.apache.activemq.xbean,org.apache.activemq.broker,org.apache.activemq.pool</camel.osgi.import.additional>
-
<camel.osgi.activator>org.apache.camel.example.guice.jms.MyActivator</camel.osgi.activator>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-guice</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jms</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
-
- <!-- for testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <phase>process-resources</phase>
- <goals>
- <goal>resources</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
-
<artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
-
<goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
-
<file>target/classes/features.xml</file>
-
<type>xml</type>
-
<classifier>features</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <!-- Allows the routes to be run via 'mvn guice:run' -->
- <plugin>
- <groupId>org.apache.camel</groupId>
- <artifactId>guice-maven-plugin</artifactId>
- <version>${project.version}</version>
- </plugin>
-
- <!-- Allows the example to be run via 'mvn compile
exec:java' -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <configuration>
-
<mainClass>org.apache.camel.guice.Main</mainClass>
-
<includePluginDependencies>false</includePluginDependencies>
- <arguments>
- <argument>-duration</argument>
- <argument>5s</argument>
-
<argument>-jndiProperties</argument>
-
<argument>/guicejndi.properties</argument>
- </arguments>
- </configuration>
- </plugin>
- </plugins>
-
- </build>
-
- <reporting>
- <plugins>
- <!-- Generates nice PNG / SVG diagrams from our routes
-->
- <plugin>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-maven-plugin</artifactId>
- <version>${project.version}</version>
- </plugin>
- </plugins>
- </reporting>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+ -->
+
+<project 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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>examples</artifactId>
+ <version>2.5-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-example-guice-jms</artifactId>
+ <packaging>bundle</packaging>
+ <name>Camel :: Example :: Guice :: JMS</name>
+ <description>An example showing how to work with Camel, Guice and
JMS</description>
+
+ <properties>
+
<camel.osgi.export.pkg>org.apache.camel.example.guice.jms.*</camel.osgi.export.pkg>
+
<camel.osgi.import.additional>org.apache.activemq.xbean,org.apache.activemq.broker,org.apache.activemq.pool
+ </camel.osgi.import.additional>
+
<camel.osgi.activator>org.apache.camel.example.guice.jms.MyActivator</camel.osgi.activator>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-guice</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jms</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </dependency>
+
+ <!-- osgi -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+
+ <!-- for testing -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>target/classes/features.xml</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Allows the routes to be run via 'mvn guice:run' -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>guice-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ </plugin>
+
+ <!-- Allows the example to be run via 'mvn compile exec:java' -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>org.apache.camel.guice.Main</mainClass>
+
<includePluginDependencies>false</includePluginDependencies>
+ <arguments>
+ <argument>-duration</argument>
+ <argument>5s</argument>
+ <argument>-jndiProperties</argument>
+ <argument>/guicejndi.properties</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <reporting>
+ <plugins>
+ <!-- Generates nice PNG / SVG diagrams from our routes -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
Modified:
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyActivator.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyActivator.java?rev=988011&r1=988010&r2=988011&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyActivator.java
(original)
+++
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyActivator.java
Mon Aug 23 07:35:11 2010
@@ -16,12 +16,6 @@
*/
package org.apache.camel.example.guice.jms;
-import java.net.URL;
-import java.util.Properties;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
import com.google.inject.Guice;
import com.google.inject.Injector;
@@ -29,22 +23,18 @@ import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import org.springframework.osgi.util.BundleDelegatingClassLoader;
public class MyActivator implements BundleActivator {
- CamelContext camelContext;
+ protected CamelContext camelContext;
public void start(BundleContext context) throws Exception {
-
Injector injector = Guice.createInjector(new MyOSGiModule(context));
camelContext = injector.getInstance(CamelContext.class);
-
if (camelContext instanceof DefaultCamelContext) {
if (!((DefaultCamelContext)camelContext).isStarted()) {
- ((DefaultCamelContext)camelContext).start();
+ camelContext.start();
}
-
}
}
Modified:
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyOSGiModule.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyOSGiModule.java?rev=988011&r1=988010&r2=988011&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyOSGiModule.java
(original)
+++
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyOSGiModule.java
Mon Aug 23 07:35:11 2010
@@ -14,23 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.camel.example.guice.jms;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
-import com.google.inject.Injector;
-import com.google.inject.Provides;
import com.google.inject.name.Names;
-import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.camel.CamelContext;
-import org.apache.camel.component.jms.JmsComponent;
-import org.apache.camel.guice.CamelModuleWithMatchingRoutes;
-import org.apache.camel.osgi.CamelContextFactory;
-import org.guiceyfruit.jndi.JndiBind;
import org.osgi.framework.BundleContext;
/**
@@ -39,29 +30,22 @@ import org.osgi.framework.BundleContext;
*
* @version $Revision$
*/
-
public class MyOSGiModule extends MyModule {
private OSGiCamelContextProvider provider;
private Properties properties;
- MyOSGiModule(BundleContext bundleContext) {
+ MyOSGiModule(BundleContext bundleContext) throws IOException {
super();
provider = new OSGiCamelContextProvider(bundleContext);
properties = new Properties();
- URL jndiPropertiesUrl = null;
+ URL jndiPropertiesUrl;
if (bundleContext != null) {
jndiPropertiesUrl =
bundleContext.getBundle().getEntry("camel.properties");
-
} else {
jndiPropertiesUrl =
this.getClass().getResource("/camel.properties");
}
- try {
- if (jndiPropertiesUrl != null) {
- properties.load(jndiPropertiesUrl.openStream());
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ if (jndiPropertiesUrl != null) {
+ properties.load(jndiPropertiesUrl.openStream());
}
}
Modified:
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyRouteBuilder.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyRouteBuilder.java?rev=988011&r1=988010&r2=988011&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyRouteBuilder.java
(original)
+++
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyRouteBuilder.java
Mon Aug 23 07:35:11 2010
@@ -28,9 +28,6 @@ public class MyRouteBuilder extends Rout
/**
* Allow this route to be run as an application
- *
- * @param args
- * @throws Exception
*/
public static void main(String[] args) throws Exception {
new Main().run(args);
@@ -38,11 +35,9 @@ public class MyRouteBuilder extends Rout
public void configure() {
// populate the message queue with some messages
- from("file:src/data?noop=true").
- to("jms:test.MyQueue");
+ from("file:src/data?noop=true").to("jms:test.MyQueue");
- from("jms:test.MyQueue").
- to("file://target/routeOutput");
+ from("jms:test.MyQueue").to("file://target/routeOutput");
// set up a listener on the file component
from("file://target/routeOutput?noop=true").beanRef("myBean");
Modified:
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/SomeBean.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/SomeBean.java?rev=988011&r1=988010&r2=988011&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/SomeBean.java
(original)
+++
camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/SomeBean.java
Mon Aug 23 07:35:11 2010
@@ -27,7 +27,6 @@ public class SomeBean {
public void someMethod(String body) {
printer.print(body);
- //System.out.println("Received: " + body);
}
@Override
Modified:
camel/trunk/examples/camel-example-guice-jms/src/test/java/org/apache/camel/example/guice/jms/GuiceTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-guice-jms/src/test/java/org/apache/camel/example/guice/jms/GuiceTest.java?rev=988011&r1=988010&r2=988011&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-guice-jms/src/test/java/org/apache/camel/example/guice/jms/GuiceTest.java
(original)
+++
camel/trunk/examples/camel-example-guice-jms/src/test/java/org/apache/camel/example/guice/jms/GuiceTest.java
Mon Aug 23 07:35:11 2010
@@ -22,10 +22,10 @@ import com.google.inject.Guice;
import com.google.inject.Injector;
import org.apache.camel.CamelContext;
-import org.apache.camel.guice.GuiceCamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.guiceyfruit.Injectors;
+
// Test loading the Guice Module directly
public class GuiceTest extends TestCase {
@@ -35,7 +35,7 @@ public class GuiceTest extends TestCase
if (camelContext instanceof DefaultCamelContext) {
if (!((DefaultCamelContext)camelContext).isStarted()) {
- ((DefaultCamelContext)camelContext).start();
+ camelContext.start();
}
}
Thread.sleep(2000);