You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2012/09/04 18:13:19 UTC
svn commit: r1380728 - in /camel/trunk:
components/camel-cdi/src/main/java/org/apache/camel/cdi/
components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/
components/camel-cdi/src/test/java/org/apache/camel/cdi/
components/camel-cdi/s...
Author: bvahdat
Date: Tue Sep 4 16:13:19 2012
New Revision: 1380728
URL: http://svn.apache.org/viewvc?rev=1380728&view=rev
Log:
Fixed the CS errors as well as the compiler warnings.
Modified:
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/Main.java
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/DelegateInjectionTarget.java
camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/EndpointDefinedUsingConfigPropertyTest.java
camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CdiConfigFile.java
camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRouteConfig.java
camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java
camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java
Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/Main.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/Main.java?rev=1380728&r1=1380727&r2=1380728&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/Main.java (original)
+++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/Main.java Tue Sep 4 16:13:19 2012
@@ -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,
@@ -41,6 +40,9 @@ public class Main extends MainSupport {
private JAXBContext jaxbContext;
private CdiContainer cdiContainer;
+ public Main() {
+ // add options...
+ }
public static void main(String... args) throws Exception {
Main main = new Main();
@@ -58,10 +60,6 @@ public class Main extends MainSupport {
return instance;
}
- public Main() {
- // add options...
- }
-
@Override
protected ProducerTemplate findOrCreateCamelTemplate() {
ProducerTemplate answer = BeanProvider.getContextualReference(ProducerTemplate.class, true);
Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java?rev=1380728&r1=1380727&r2=1380728&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java (original)
+++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java Tue Sep 4 16:13:19 2012
@@ -147,9 +147,7 @@ public class CamelExtension implements E
// lets force singletons and application scoped objects
// to be created eagerly to ensure they startup
- if (eagerlyCreateSingletonsOnStartup() &&
- isApplicationScopeOrSingleton(beanClass) &&
- beanClass.getAnnotation(Startup.class) != null) {
+ if (eagerlyCreateSingletonsOnStartup() && isApplicationScopeOrSingleton(beanClass) && beanClass.getAnnotation(Startup.class) != null) {
eagerlyCreate(bean);
}
}
@@ -171,7 +169,6 @@ public class CamelExtension implements E
Set<Map.Entry<Bean<?>, BeanAdapter>> entries = eagerBeans.entrySet();
for (Map.Entry<Bean<?>, BeanAdapter> entry : entries) {
Bean<?> bean = entry.getKey();
- BeanAdapter adapter = entry.getValue();
CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean);
// force lazy creation
@@ -183,10 +180,9 @@ public class CamelExtension implements E
/**
* Lets perform injection of all beans which use Camel annotations
*/
- @SuppressWarnings("unchecked")
- public void onInjectionTarget(@Observes ProcessInjectionTarget event) {
- final InjectionTarget injectionTarget = event.getInjectionTarget();
- final Class beanClass = event.getAnnotatedType().getJavaClass();
+ public void onInjectionTarget(@Observes ProcessInjectionTarget<Object> event) {
+ final InjectionTarget<Object> injectionTarget = event.getInjectionTarget();
+ final Class<?> beanClass = event.getAnnotatedType().getJavaClass();
// TODO this is a bit of a hack - what should the bean name be?
final String beanName = event.getInjectionTarget().toString();
final BeanAdapter adapter = createBeanAdapter(beanClass);
@@ -220,7 +216,7 @@ public class CamelExtension implements E
}
}
- private BeanAdapter createBeanAdapter(Class beanClass) {
+ private BeanAdapter createBeanAdapter(Class<?> beanClass) {
final BeanAdapter adapter = new BeanAdapter();
ReflectionHelper.doWithFields(beanClass, new ReflectionHelper.FieldCallback() {
@Override
Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/DelegateInjectionTarget.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/DelegateInjectionTarget.java?rev=1380728&r1=1380727&r2=1380728&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/DelegateInjectionTarget.java (original)
+++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/DelegateInjectionTarget.java Tue Sep 4 16:13:19 2012
@@ -24,10 +24,10 @@ import javax.enterprise.inject.spi.Injec
/**
* A helper class for creating delegate implementations of {@link InjectionTarget}
*/
-public abstract class DelegateInjectionTarget implements InjectionTarget {
- private final InjectionTarget delegate;
+public abstract class DelegateInjectionTarget implements InjectionTarget<Object> {
+ private final InjectionTarget<Object> delegate;
- public DelegateInjectionTarget(InjectionTarget delegate) {
+ public DelegateInjectionTarget(InjectionTarget<Object> delegate) {
this.delegate = delegate;
}
@@ -42,7 +42,7 @@ public abstract class DelegateInjectionT
}
@Override
- public void inject(Object instance, CreationalContext ctx) {
+ public void inject(Object instance, CreationalContext<Object> ctx) {
delegate.inject(instance, ctx);
}
@@ -57,7 +57,7 @@ public abstract class DelegateInjectionT
}
@Override
- public Object produce(CreationalContext creationalContext) {
+ public Object produce(CreationalContext<Object> creationalContext) {
return delegate.produce(creationalContext);
}
}
Modified: camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/EndpointDefinedUsingConfigPropertyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/EndpointDefinedUsingConfigPropertyTest.java?rev=1380728&r1=1380727&r2=1380728&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/EndpointDefinedUsingConfigPropertyTest.java (original)
+++ camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/EndpointDefinedUsingConfigPropertyTest.java Tue Sep 4 16:13:19 2012
@@ -16,20 +16,24 @@
*/
package org.apache.camel.cdi;
-import org.apache.camel.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.cdi.store.Item;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.deltaspike.core.api.config.annotation.ConfigProperty;
import org.junit.Test;
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.List;
-
public class EndpointDefinedUsingConfigPropertyTest extends CdiContextTestSupport {
- @Inject @ConfigProperty(name="directEndpoint")
+ @Inject @ConfigProperty(name = "directEndpoint")
String directInjectEndpoint;
@EndpointInject(uri = "mock:result")
Modified: camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CdiConfigFile.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CdiConfigFile.java?rev=1380728&r1=1380727&r2=1380728&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CdiConfigFile.java (original)
+++ camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CdiConfigFile.java Tue Sep 4 16:13:19 2012
@@ -18,12 +18,14 @@ package org.apache.camel.cdi.support;
import org.apache.deltaspike.core.api.config.PropertyFileConfig;
-/*
+/**
* Class which is used to retrieve camel properties files tp configure endpoints.
* By default, it will check for the file META-INF/camel-properties
*/
public class CdiConfigFile implements PropertyFileConfig {
+ private static final long serialVersionUID = 1L;
+
@Override
public String getPropertyFileName() {
return "META-INF/camel.properties";
Modified: camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRouteConfig.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRouteConfig.java?rev=1380728&r1=1380727&r2=1380728&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRouteConfig.java (original)
+++ camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRouteConfig.java Tue Sep 4 16:13:19 2012
@@ -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: camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java?rev=1380728&r1=1380727&r2=1380728&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java (original)
+++ camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java Tue Sep 4 16:13:19 2012
@@ -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: camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java?rev=1380728&r1=1380727&r2=1380728&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java (original)
+++ camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java Tue Sep 4 16:13:19 2012
@@ -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,