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 2017/04/14 14:42:28 UTC

camel git commit: Rename catalog to runtimecatalog to avoid clash with same package name in camel-catalog.

Repository: camel
Updated Branches:
  refs/heads/master cd84f3857 -> 49e1c0111


Rename catalog to runtimecatalog to avoid clash with same package name in camel-catalog.


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

Branch: refs/heads/master
Commit: 49e1c011126df57f41987e432cf0566a523e9ffd
Parents: cd84f38
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 14 16:41:58 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 14 16:42:21 2017 +0200

----------------------------------------------------------------------
 .../camel/commands/AbstractCamelController.java |  9 +++---
 .../camel/commands/internal/MatchUtil.java      | 31 ++++++++++++++++++++
 2 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/49e1c011/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
index 3036d46..2937d10 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
@@ -21,11 +21,12 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.camel.catalog.CatalogHelper;
-import org.apache.camel.commands.internal.RegexUtil;
 import org.apache.camel.util.JsonSchemaHelper;
 import org.apache.camel.util.ObjectHelper;
 
+import static org.apache.camel.commands.internal.MatchUtil.matchWildcard;
+import static org.apache.camel.commands.internal.RegexUtil.wildcardAsRegex;
+
 /**
  * Abstract {@link org.apache.camel.commands.CamelController} that implementators should extend.
  */
@@ -37,13 +38,13 @@ public abstract class AbstractCamelController implements CamelController {
 
         List<Map<String, String>> context = getCamelContexts();
         if (filter != null) {
-            filter = RegexUtil.wildcardAsRegex(filter);
+            filter = wildcardAsRegex(filter);
         } else {
             filter = "*";
         }
         for (Map<String, String> entry : context) {
             String name = entry.get("name");
-            if (name.equalsIgnoreCase(filter) || CatalogHelper.matchWildcard(name, filter) || name.matches(filter)) {
+            if (name.equalsIgnoreCase(filter) || matchWildcard(name, filter) || name.matches(filter)) {
                 answer.add(entry);
             }
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/49e1c011/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/internal/MatchUtil.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/internal/MatchUtil.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/internal/MatchUtil.java
new file mode 100644
index 0000000..874276e
--- /dev/null
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/internal/MatchUtil.java
@@ -0,0 +1,31 @@
+/**
+ * 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.commands.internal;
+
+/**
+ * Util class.
+ */
+public final class MatchUtil {
+
+    private MatchUtil() {
+    }
+
+    public static boolean matchWildcard(String name, String pattern) {
+        return pattern.endsWith("*") && name.startsWith(pattern.substring(0, pattern.length() - 1));
+    }
+
+}