You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/11/07 09:25:22 UTC

[4/5] camel git commit: Fixed CS

Fixed CS


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/94d3aeef
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/94d3aeef
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/94d3aeef

Branch: refs/heads/master
Commit: 94d3aeefd20d01a124ca24d6a60ccc9109869cec
Parents: 2588b97
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Nov 7 09:26:28 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Nov 7 09:26:28 2015 +0100

----------------------------------------------------------------------
 .../commands/crsh/ArgumentCamelContext.java     | 12 ++++----
 .../commands/crsh/ArgumentRouteID.java          | 12 ++++----
 .../commands/crsh/CamelCommandsFacade.java      | 31 ++++++++++++--------
 .../commands/crsh/CamelCommandsPlugin.java      | 14 ++++-----
 .../commands/crsh/CamelCompleter.java           | 17 +++++------
 .../commands/crsh/CamelControllerImpl.java      |  4 +--
 .../springboot/commands/crsh/OutputBuffer.java  | 14 +++++----
 7 files changed, 55 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
index 226378a..f1fc1f3 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
@@ -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,15 +16,16 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
 import org.crsh.cli.Argument;
 import org.crsh.cli.Man;
 import org.crsh.cli.Usage;
 
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
 @Retention(RetentionPolicy.RUNTIME)
 @Usage("Camel context name")
 @Man("Camel context name")
 @Argument(name = "Camel Context", completer = CamelCompleter.class)
-@interface ArgumentCamelContext {}
+@interface ArgumentCamelContext {
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
index 94d61d1..1446444 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
@@ -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,15 +16,16 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
 import org.crsh.cli.Argument;
 import org.crsh.cli.Man;
 import org.crsh.cli.Usage;
 
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
 @Retention(RetentionPolicy.RUNTIME)
 @Usage("Route ID")
 @Man("Route ID")
 @Argument(name = "Route ID", completer = CamelCompleter.class)
-@interface ArgumentRouteID {}
+@interface ArgumentRouteID {
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
index b73c10d..90e0ebe 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
@@ -5,9 +5,9 @@
  * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
+ *      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.
@@ -16,6 +16,11 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
+import java.io.PrintStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
 import org.apache.camel.commands.AbstractCamelCommand;
@@ -25,11 +30,6 @@ import org.apache.camel.commands.StringEscape;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.PrintStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-
 public class CamelCommandsFacade {
 
     protected final Logger log = LoggerFactory.getLogger(getClass().getName());
@@ -55,7 +55,7 @@ public class CamelCommandsFacade {
         // [1] - camel context
         if (AbstractRouteCommand.class.isAssignableFrom(clazz) && null == commandArgs[1]) {
             commandArgs[1] = getCamelContextForRoute((String) commandArgs[0]);
-            ops.println("Automatically inferred context name : "+commandArgs[1]);
+            ops.println("Automatically inferred context name : " + commandArgs[1]);
         }
 
         // Finding the right constructor
@@ -64,8 +64,12 @@ public class CamelCommandsFacade {
             types[i] = commandArgs[i].getClass();
 
             // Commands require primitives
-            if (types[i] == Boolean.class) types[i] = boolean.class;
-            if (types[i] == Integer.class) types[i] = int.class;
+            if (types[i] == Boolean.class) {
+                types[i] = boolean.class;
+            }
+            if (types[i] == Integer.class) {
+                types[i] = int.class;
+            }
         }
 
         // Instantiating an object
@@ -100,8 +104,9 @@ public class CamelCommandsFacade {
             StringBuffer error = new StringBuffer();
             error.append("Cannot infer Camel Context. Please provide manually.");
 
-            if (contextNames.size() > 1)
-                error.append(" Contexts : "+contextNames.toString());
+            if (contextNames.size() > 1) {
+                error.append(" Contexts : " + contextNames.toString());
+            }
 
             throw new org.crsh.cli.impl.SyntaxException(error.toString());
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
index 51e5820..b183ec5 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
@@ -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,16 +23,16 @@ public class CamelCommandsPlugin extends CRaSHPlugin<CamelCommandsPlugin> {
 
     private static CamelCommandsPlugin camelPlugin;
 
-    private static void setCamelPlugin(CamelCommandsPlugin plugin){
+    private CamelCommandsFacade facade;
+
+    private static void setCamelPlugin(CamelCommandsPlugin plugin) {
         camelPlugin = plugin;
     }
 
-    static CamelCommandsPlugin getInstance(){
+    static CamelCommandsPlugin getInstance() {
         return camelPlugin;
     }
 
-    private CamelCommandsFacade facade;
-
     @Override
     public CamelCommandsPlugin getImplementation() {
         return this;
@@ -48,9 +47,10 @@ public class CamelCommandsPlugin extends CRaSHPlugin<CamelCommandsPlugin> {
 
     @Override
     public void destroy() {
+        // noop
     }
 
-    CamelCommandsFacade getCamelCommandsFacade(){
+    CamelCommandsFacade getCamelCommandsFacade() {
         return this.facade;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
index ffcd78c..1355661 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
@@ -5,9 +5,9 @@
  * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
+ *      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.
@@ -16,25 +16,21 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
+import java.util.LinkedList;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
 import org.apache.camel.commands.LocalCamelController;
 import org.crsh.cli.descriptor.ParameterDescriptor;
 import org.crsh.cli.spi.Completer;
 import org.crsh.cli.spi.Completion;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.LinkedList;
 
 public class CamelCompleter implements Completer {
 
     private LocalCamelController camelController = CamelCommandsPlugin.getInstance().getCamelCommandsFacade().getCamelController();
-    private Logger log = LoggerFactory.getLogger(CamelCompleter.class);
 
     public Completion complete(ParameterDescriptor parameterDescriptor, String prefix) throws Exception {
 
-
         LinkedList<String> values = new LinkedList<String>();
         Completion.Builder builder = new Completion.Builder(prefix);
 
@@ -47,8 +43,9 @@ public class CamelCompleter implements Completer {
         }
 
         for (String value : values) {
-            if (value.startsWith(prefix))
+            if (value.startsWith(prefix)) {
                 builder.add(value.substring(prefix.length()), true);
+            }
         }
 
         return builder.build();

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
index 3464f9f..af837e3 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
@@ -35,14 +35,14 @@ public class CamelControllerImpl extends AbstractLocalCamelController {
 
     private ListableBeanFactory beanFactory;
 
-    CamelControllerImpl(ListableBeanFactory factory){
+    CamelControllerImpl(ListableBeanFactory factory) {
         beanFactory = factory;
     }
 
     public List<CamelContext> getLocalCamelContexts() {
         List<CamelContext> camelContexts = new ArrayList<CamelContext>();
         try {
-            camelContexts.addAll( beanFactory.getBeansOfType(CamelContext.class).values() );
+            camelContexts.addAll(beanFactory.getBeansOfType(CamelContext.class).values());
         } catch (Exception e) {
             LOG.warn("Cannot retrieve the list of Camel contexts.", e);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
index a9b8488..5f54004 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
@@ -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,19 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
 
 class OutputBuffer {
 
     private ByteArrayOutputStream baos = new ByteArrayOutputStream();
     private PrintStream ps = new PrintStream(baos);
 
-    public PrintStream getPrintStream(){
+    public PrintStream getPrintStream() {
         return ps;
     }
 
@@ -32,7 +36,7 @@ class OutputBuffer {
     public String toString() {
         BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(baos.toByteArray())));
         StringBuffer sb = new StringBuffer();
-        String line = null;
+        String line;
         String lineSeparator = System.getProperty("line.separator");
         try {
             while ((line = bufferedReader.readLine()) != null) {