camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1241065 - in /camel/trunk/components/camel-cdi/src: main/java/org/apache/camel/component/cdi/ main/java/org/apache/camel/component/cdi/util/ test/java/org/apache/camel/cdi/
Date Mon, 06 Feb 2012 16:36:26 GMT
Author: hadrian
Date: Mon Feb  6 16:36:26 2012
New Revision: 1241065

URL: http://svn.apache.org/viewvc?rev=1241065&view=rev
Log:
Checkstyle fixes

Modified:
    camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiBeanRegistry.java
    camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/AnyLiteral.java
    camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanManagerProvider.java
    camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanProvider.java
    camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/package-info.java
    camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/CdiContainerBeanManagerTest.java

Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiBeanRegistry.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiBeanRegistry.java?rev=1241065&r1=1241064&r2=1241065&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiBeanRegistry.java
(original)
+++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiBeanRegistry.java
Mon Feb  6 16:36:26 2012
@@ -16,17 +16,15 @@
  */
 package org.apache.camel.component.cdi;
 
+import java.util.Map;
+
+import org.apache.camel.component.cdi.util.BeanProvider;
 import org.apache.camel.spi.Registry;
+import org.apache.camel.util.ObjectHelper;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Map;
-
-import static org.apache.camel.component.cdi.util.BeanProvider.getContextualNamesReferences;
-import static org.apache.camel.component.cdi.util.BeanProvider.getContextualReference;
-import static org.apache.camel.util.ObjectHelper.notEmpty;
-import static org.apache.camel.util.ObjectHelper.notNull;
-
 
 /**
  * CdiBeanRegistry used by Camel to perform lookup into the
@@ -34,7 +32,6 @@ import static org.apache.camel.util.Obje
  * to the CdiRegistry constructor.
  */
 public class CdiBeanRegistry implements Registry {
-
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     /**
@@ -42,27 +39,27 @@ public class CdiBeanRegistry implements 
      */
     @Override
     public Object lookup(final String name) {
-        notEmpty(name, "name");
+        ObjectHelper.notEmpty(name, "name");
         log.trace("Looking up bean using name = [{}] in CDI registry ...", name);
 
-        return getContextualReference(name, true);
+        return BeanProvider.getContextualReference(name, true);
     }
 
-      @Override
-      public <T> T lookup(final String name, final Class<T> type) {
-         notEmpty(name, "name");
-         notNull(type, "type");
-          return type.cast(lookup(name));
-      }
-
-      @Override
-      public <T> Map<String, T> lookupByType(final Class<T> type) {
-         notNull(type, "type");
-         return getContextualNamesReferences(type, true, true);
-      }
-
-      @Override
-      public String toString() {
-         return "CdiRegistry[" + System.identityHashCode(this) + "]";
-      }
+    @Override
+    public <T> T lookup(final String name, final Class<T> type) {
+        ObjectHelper.notEmpty(name, "name");
+        ObjectHelper.notNull(type, "type");
+        return type.cast(lookup(name));
+    }
+
+    @Override
+    public <T> Map<String, T> lookupByType(final Class<T> type) {
+        ObjectHelper.notNull(type, "type");
+        return BeanProvider.getContextualNamesReferences(type, true, true);
+    }
+
+    @Override
+    public String toString() {
+        return "CdiRegistry[" + System.identityHashCode(this) + "]";
+    }
 }

Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/AnyLiteral.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/AnyLiteral.java?rev=1241065&r1=1241064&r2=1241065&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/AnyLiteral.java
(original)
+++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/AnyLiteral.java
Mon Feb  6 16:36:26 2012
@@ -1,3 +1,19 @@
+/**
+ * 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.cdi.util;
 
 import javax.enterprise.inject.Any;

Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanManagerProvider.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanManagerProvider.java?rev=1241065&r1=1241064&r2=1241065&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanManagerProvider.java
(original)
+++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanManagerProvider.java
Mon Feb  6 16:36:26 2012
@@ -1,23 +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
+/**
+ * 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
+ *      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.
+ * 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.cdi.util;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.spi.AfterBeanDiscovery;
 import javax.enterprise.inject.spi.BeanManager;
@@ -25,10 +28,6 @@ import javax.enterprise.inject.spi.Befor
 import javax.enterprise.inject.spi.Extension;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 
 
 /**
@@ -47,7 +46,7 @@ import java.util.concurrent.ConcurrentHa
  * </pre>
  */
 public class BeanManagerProvider implements Extension {
-    private static BeanManagerProvider bmp = null;
+    private static BeanManagerProvider bmp;
 
     private volatile Map<ClassLoader, BeanManager> bms = new ConcurrentHashMap<ClassLoader,
BeanManager>();
 
@@ -80,9 +79,9 @@ public class BeanManagerProvider impleme
             // here bmp might not be null (depends on the broadcasters)
         }
         if (bmp == null) {
-            throw new IllegalStateException("No " + BeanManagerProvider.class.getName() +
" in place! " +
-                    "Please ensure that you configured the CDI implementation of your choice
properly. " +
-                    "If your setup is correct, please clear all caches and compiled artifacts.");
+            throw new IllegalStateException("No " + BeanManagerProvider.class.getName() +
" in place! "
+                + "Please ensure that you configured the CDI implementation of your choice
properly. "
+                + "If your setup is correct, please clear all caches and compiled artifacts.");
         }
         return bmp;
     }

Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanProvider.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanProvider.java?rev=1241065&r1=1241064&r2=1241065&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanProvider.java
(original)
+++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanProvider.java
Mon Feb  6 16:36:26 2012
@@ -1,28 +1,21 @@
-/*
- * 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
+/**
+ * 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
+ *      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.
+ * 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.cdi.util;
 
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.Typed;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -35,6 +28,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Typed;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
 /**
  * This class contains utility methods to resolve contextual references
  * in situations where no injection is available.

Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/package-info.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/package-info.java?rev=1241065&r1=1241064&r2=1241065&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/package-info.java
(original)
+++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/package-info.java
Mon Feb  6 16:36:26 2012
@@ -1,4 +1,21 @@
 /**
+ * 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.
+ */
+
+/**
  * mainly copied from deltaspike to avoid to bring to whole
  * package when only 2 classes are useful.
  */

Modified: camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/CdiContainerBeanManagerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/CdiContainerBeanManagerTest.java?rev=1241065&r1=1241064&r2=1241065&view=diff
==============================================================================
--- camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/CdiContainerBeanManagerTest.java
(original)
+++ camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/CdiContainerBeanManagerTest.java
Mon Feb  6 16:36:26 2012
@@ -1,6 +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.
+ */
 package org.apache.camel.cdi;
 
-import org.apache.camel.CamelContext;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
@@ -16,21 +36,15 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.List;
 
 public class CdiContainerBeanManagerTest extends CamelTestSupport {
-
     private MockEndpoint resultEndpoint;
-
     private ProducerTemplate template;
 
-    CdiTestContainer cdiContainer;
-    CamelContext camelContext;
+    private CdiTestContainer cdiContainer;
 
     @Inject
-    ShoppingBean shoppingBean;
+    private ShoppingBean shoppingBean;
 
     @Before
     public void setUp() throws Exception {
@@ -68,13 +82,12 @@ public class CdiContainerBeanManagerTest
 
         Object[] items = (Object[]) results.toArray();
         Object[] itemsExpected = (Object[]) itemsExpected().toArray();
-        for(int i=0; i< items.length; ++i) {
-           Item itemExpected = (Item)items[i];
-           Item itemReceived = (Item)itemsExpected[i];
-           assertEquals(itemExpected.getName(), itemReceived.getName());
-           assertEquals(itemExpected.getPrice(), itemReceived.getPrice());
+        for (int i = 0; i < items.length; ++i) {
+            Item itemExpected = (Item)items[i];
+            Item itemReceived = (Item)itemsExpected[i];
+            assertEquals(itemExpected.getName(), itemReceived.getName());
+            assertEquals(itemExpected.getPrice(), itemReceived.getPrice());
         }
-
         assertNotNull(results);
     }
 



Mime
View raw message