You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/04/17 06:23:35 UTC
[camel-karaf] branch master updated: CAMEL-14916: Remove JAXB based
dump model classes that are no longer in use - removed related karaf
commands
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-karaf.git
The following commit(s) were added to refs/heads/master by this push:
new ca52b88 CAMEL-14916: Remove JAXB based dump model classes that are no longer in use - removed related karaf commands
ca52b88 is described below
commit ca52b88571ba8bb6993318f913ab91cb26cca29f
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 17 08:22:56 2020 +0200
CAMEL-14916: Remove JAXB based dump model classes that are no longer in use - removed related karaf commands
---
.../apache/camel/commands/ContextInfoCommand.java | 245 ---------------------
.../apache/camel/commands/RouteInfoCommand.java | 120 ----------
.../apache/camel/commands/RouteProfileCommand.java | 85 -------
.../apache/camel/commands/RouteStepCommand.java | 83 -------
.../apache/camel/karaf/commands/ContextInfo.java | 50 -----
.../org/apache/camel/karaf/commands/RouteInfo.java | 37 ----
.../apache/camel/karaf/commands/RouteProfile.java | 36 ---
.../org/apache/camel/karaf/commands/RouteStep.java | 36 ---
8 files changed, 692 deletions(-)
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
deleted file mode 100644
index 6c5ed2e..0000000
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * 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;
-
-import java.io.PrintStream;
-import java.io.StringReader;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Map;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.camel.support.dump.CamelContextStatDump;
-
-import static org.apache.camel.util.ObjectHelper.isEmpty;
-
-/**
- * Command to display detailed information about a given {@link org.apache.camel.CamelContext}.
- */
-public class ContextInfoCommand extends AbstractContextCommand {
-
- public static final String XML_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
- public static final String OUTPUT_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss";
- private StringEscape stringEscape;
- private boolean verbose;
-
- /**
- * @param context The name of the Camel context
- * @param verbose Whether to output verbose
- */
- public ContextInfoCommand(String context, boolean verbose) {
- super(context);
- this.verbose = verbose;
- }
-
- /**
- * Sets the {@link org.apache.camel.commands.StringEscape} to use.
- */
- public void setStringEscape(StringEscape stringEscape) {
- this.stringEscape = stringEscape;
- }
-
- @Override
- protected Object performContextCommand(CamelController camelController, String contextName, PrintStream out, PrintStream err) throws Exception {
- Map<String, Object> row = camelController.getCamelContextInformation(context);
- if (row == null || row.isEmpty()) {
- err.println("Camel context " + context + " not found.");
- return null;
- }
-
- out.println("");
- out.println(stringEscape.unescapeJava("\u001B[1mCamel Context " + context + "\u001B[0m"));
- out.println(stringEscape.unescapeJava("\tName: " + row.get("name")));
- out.println(stringEscape.unescapeJava("\tManagementName: " + row.get("managementName")));
- out.println(stringEscape.unescapeJava("\tVersion: " + row.get("version")));
- out.println(stringEscape.unescapeJava("\tStatus: " + row.get("status")));
- out.println(stringEscape.unescapeJava("\tUptime: " + row.get("uptime")));
-
- out.println("");
- out.println(stringEscape.unescapeJava("\u001B[1mMiscellaneous\u001B[0m"));
- out.println(stringEscape.unescapeJava("\tSuspended: " + row.get("suspended")));
- out.println(stringEscape.unescapeJava("\tShutdown Timeout: " + row.get("shutdownTimeout") + " sec."));
- if (row.get("managementStatisticsLevel") != null) {
- out.println(stringEscape.unescapeJava("\tManagement StatisticsLevel: " + row.get("managementStatisticsLevel")));
- }
- out.println(stringEscape.unescapeJava("\tAllow UseOriginalMessage: " + row.get("allowUseOriginalMessage")));
- out.println(stringEscape.unescapeJava("\tMessage History: " + row.get("messageHistory")));
- out.println(stringEscape.unescapeJava("\tTracing: " + row.get("tracing")));
- out.println(stringEscape.unescapeJava("\tLog Mask: " + row.get("logMask")));
- out.println("");
- out.println(stringEscape.unescapeJava("\u001B[1mProperties\u001B[0m"));
- for (Map.Entry<String, Object> entry : row.entrySet()) {
- String key = entry.getKey();
- if (key.startsWith("property.")) {
- key = key.substring(9);
- out.println(stringEscape.unescapeJava("\t" + key + " = " + entry.getValue()));
- }
- }
-
- if (verbose) {
- out.println("");
- out.println(stringEscape.unescapeJava("\u001B[1mAdvanced\u001B[0m"));
- out.println(stringEscape.unescapeJava("\tClassResolver: " + row.get("classResolver")));
- out.println(stringEscape.unescapeJava("\tPackageScanClassResolver: " + row.get("packageScanClassResolver")));
- out.println(stringEscape.unescapeJava("\tApplicationContextClassLoader: " + row.get("applicationContextClassLoader")));
- out.println(stringEscape.unescapeJava("\tHeadersMapFactory: " + row.get("headersMapFactory")));
-
- printStatistics(camelController, out);
-
- // add type converter details
- out.println(stringEscape.unescapeJava("\tNumber of type converters: " + row.get("typeConverter.numberOfTypeConverters")));
- boolean enabled = false;
- if (row.get("typeConverter.statisticsEnabled") != null) {
- enabled = (boolean) row.get("typeConverter.statisticsEnabled");
- }
- if (enabled) {
- long noop = (long) row.get("typeConverter.noopCounter");
- long attempt = (long) row.get("typeConverter.attemptCounter");
- long hit = (long) row.get("typeConverter.hitCounter");
- long miss = (long) row.get("typeConverter.missCounter");
- long failed = (long) row.get("typeConverter.failedCounter");
- out.println(stringEscape.unescapeJava(String.format("\tType converter usage: [noop=%s, attempts=%s, hits=%s, misses=%s, failures=%s]", noop, attempt, hit, miss, failed)));
- }
-
- // add async processor await details
- out.println(stringEscape.unescapeJava("\tNumber of blocked threads: " + row.get("asyncProcessorAwaitManager.size")));
- enabled = false;
- if (row.get("asyncProcessorAwaitManager.statisticsEnabled") != null) {
- enabled = (boolean) row.get("asyncProcessorAwaitManager.statisticsEnabled");
- }
- if (enabled) {
- long blocked = (long) row.get("asyncProcessorAwaitManager.threadsBlocked");
- long interrupted = (long) row.get("asyncProcessorAwaitManager.threadsInterrupted");
- long total = (long) row.get("asyncProcessorAwaitManager.totalDuration");
- long min = (long) row.get("asyncProcessorAwaitManager.minDuration");
- long max = (long) row.get("asyncProcessorAwaitManager.maxDuration");
- long mean = (long) row.get("asyncProcessorAwaitManager.meanDuration");
- out.println(stringEscape.unescapeJava(String.format("\tAsyncProcessorAwaitManager usage: [blocked=%s, interrupted=%s, total=%s msec, min=%s msec, max=%s msec, mean=%s msec]",
- blocked, interrupted, total, min, max, mean)));
- }
-
- // add stream caching details if enabled
- enabled = (boolean) row.get("streamCachingEnabled");
- if (enabled) {
- Object spoolDirectory = safeNull(row.get("streamCaching.spoolDirectory"));
- Object spoolCipher = safeNull(row.get("streamCaching.spoolCipher"));
- Object spoolThreshold = safeNull(row.get("streamCaching.spoolThreshold"));
- Object spoolUsedHeapMemoryThreshold = safeNull(row.get("streamCaching.spoolUsedHeapMemoryThreshold"));
- Object spoolUsedHeapMemoryLimit = safeNull(row.get("streamCaching.spoolUsedHeapMemoryLimit"));
- Object anySpoolRules = safeNull(row.get("streamCaching.anySpoolRules"));
- Object bufferSize = safeNull(row.get("streamCaching.bufferSize"));
- Object removeSpoolDirectoryWhenStopping = safeNull(row.get("streamCaching.removeSpoolDirectoryWhenStopping"));
- boolean statisticsEnabled = (boolean) row.get("streamCaching.statisticsEnabled");
-
- String text = String.format("\tStream caching: [spoolDirectory=%s, spoolCipher=%s, spoolThreshold=%s, spoolUsedHeapMemoryThreshold=%s, "
- + "spoolUsedHeapMemoryLimit=%s, anySpoolRules=%s, bufferSize=%s, removeSpoolDirectoryWhenStopping=%s, statisticsEnabled=%s]",
- spoolDirectory, spoolCipher, spoolThreshold, spoolUsedHeapMemoryThreshold, spoolUsedHeapMemoryLimit, anySpoolRules, bufferSize,
- removeSpoolDirectoryWhenStopping, statisticsEnabled);
- out.println(stringEscape.unescapeJava(text));
-
- if (statisticsEnabled) {
- Object cacheMemoryCounter = safeNull(row.get("streamCaching.cacheMemoryCounter"));
- Object cacheMemorySize = safeNull(row.get("streamCaching.cacheMemorySize"));
- Object cacheMemoryAverageSize = safeNull(row.get("streamCaching.cacheMemoryAverageSize"));
- Object cacheSpoolCounter = safeNull(row.get("streamCaching.cacheSpoolCounter"));
- Object cacheSpoolSize = safeNull(row.get("streamCaching.cacheSpoolSize"));
- Object cacheSpoolAverageSize = safeNull(row.get("streamCaching.cacheSpoolAverageSize"));
-
- text = String.format("\t [cacheMemoryCounter=%s, cacheMemorySize=%s, cacheMemoryAverageSize=%s, cacheSpoolCounter=%s, "
- + "cacheSpoolSize=%s, cacheSpoolAverageSize=%s]",
- cacheMemoryCounter, cacheMemorySize, cacheMemoryAverageSize, cacheSpoolCounter, cacheSpoolSize, cacheSpoolAverageSize);
- out.println(stringEscape.unescapeJava(text));
- }
- }
-
- long totalRoutes = (long) row.get("totalRoutes");
- long startedRoutes = (long) row.get("totalRoutes");
- out.println(stringEscape.unescapeJava("\tNumber of running routes: " + startedRoutes));
- out.println(stringEscape.unescapeJava("\tNumber of not running routes: " + (totalRoutes - startedRoutes)));
- }
-
- return null;
- }
-
- protected void printStatistics(CamelController camelController, PrintStream out) throws Exception {
- out.println("");
- out.println(stringEscape.unescapeJava("\u001B[1mStatistics\u001B[0m"));
-
- String xml = camelController.getCamelContextStatsAsXml(context, true, false);
- if (xml != null) {
- JAXBContext context = JAXBContext.newInstance(CamelContextStatDump.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
-
- CamelContextStatDump stat = (CamelContextStatDump) unmarshaller.unmarshal(new StringReader(xml));
-
- long total = stat.getExchangesCompleted() + stat.getExchangesFailed();
- out.println(stringEscape.unescapeJava("\tExchanges Total: " + total));
- out.println(stringEscape.unescapeJava("\tExchanges Completed: " + stat.getExchangesCompleted()));
- out.println(stringEscape.unescapeJava("\tExchanges Failed: " + stat.getExchangesFailed()));
- out.println(stringEscape.unescapeJava("\tExchanges Inflight: " + stat.getExchangesInflight()));
- out.println(stringEscape.unescapeJava("\tMin Processing Time: " + stat.getMinProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tMax Processing Time: " + stat.getMaxProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tMean Processing Time: " + stat.getMeanProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tTotal Processing Time: " + stat.getTotalProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tLast Processing Time: " + stat.getLastProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tDelta Processing Time: " + stat.getDeltaProcessingTime() + " ms"));
-
- if (isEmpty(stat.getStartTimestamp())) {
- // Print an empty value for scripting
- out.println(stringEscape.unescapeJava("\tStart Statistics Date:"));
- } else {
- Date date = new SimpleDateFormat(XML_TIMESTAMP_FORMAT).parse(stat.getStartTimestamp());
- String text = new SimpleDateFormat(OUTPUT_TIMESTAMP_FORMAT).format(date);
- out.println(stringEscape.unescapeJava("\tStart Statistics Date: " + text));
- }
-
- // Test for null to see if a any exchanges have been processed first to avoid NPE
- if (isEmpty(stat.getResetTimestamp())) {
- // Print an empty value for scripting
- out.println(stringEscape.unescapeJava("\tReset Statistics Date:"));
- } else {
- Date date = new SimpleDateFormat(XML_TIMESTAMP_FORMAT).parse(stat.getResetTimestamp());
- String text = new SimpleDateFormat(OUTPUT_TIMESTAMP_FORMAT).format(date);
- out.println(stringEscape.unescapeJava("\tReset Statistics Date: " + text));
- }
-
- // Test for null to see if a any exchanges have been processed first to avoid NPE
- if (isEmpty(stat.getFirstExchangeCompletedTimestamp())) {
- // Print an empty value for scripting
- out.println(stringEscape.unescapeJava("\tFirst Exchange Date:"));
- } else {
- Date date = new SimpleDateFormat(XML_TIMESTAMP_FORMAT).parse(stat.getFirstExchangeCompletedTimestamp());
- String text = new SimpleDateFormat(OUTPUT_TIMESTAMP_FORMAT).format(date);
- out.println(stringEscape.unescapeJava("\tFirst Exchange Date: " + text));
- }
-
- // Test for null to see if a any exchanges have been processed first to avoid NPE
- if (isEmpty(stat.getLastExchangeCompletedTimestamp())) {
- // Print an empty value for scripting
- out.println(stringEscape.unescapeJava("\tLast Exchange Date:"));
- } else {
- Date date = new SimpleDateFormat(XML_TIMESTAMP_FORMAT).parse(stat.getLastExchangeCompletedTimestamp());
- String text = new SimpleDateFormat(OUTPUT_TIMESTAMP_FORMAT).format(date);
- out.println(stringEscape.unescapeJava("\tLast Exchange Date: " + text));
- }
- }
-
- }
-
-}
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteInfoCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteInfoCommand.java
deleted file mode 100644
index fe83b02..0000000
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteInfoCommand.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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;
-
-import java.io.PrintStream;
-import java.io.StringReader;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.camel.support.dump.RouteStatDump;
-
-import static org.apache.camel.util.ObjectHelper.isEmpty;
-
-/**
- * Command to display detailed information about a Camel route.
- */
-public class RouteInfoCommand extends AbstractRouteCommand {
-
- public static final String XML_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
- public static final String OUTPUT_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss";
- private StringEscape stringEscape;
-
- public RouteInfoCommand(String route, String context) {
- super(route, context);
- }
-
- /**
- * Sets the {@link org.apache.camel.commands.StringEscape} to use.
- */
- public void setStringEscape(StringEscape stringEscape) {
- this.stringEscape = stringEscape;
- }
-
- @Override
- public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
- out.println(stringEscape.unescapeJava("\u001B[1mCamel Route " + routeId + "\u001B[0m"));
- out.println(stringEscape.unescapeJava("\tCamel Context: " + contextName));
-
- String xml = camelController.getRouteStatsAsXml(routeId, contextName, true, false);
- if (xml != null) {
- JAXBContext context = JAXBContext.newInstance(RouteStatDump.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
-
- RouteStatDump route = (RouteStatDump) unmarshaller.unmarshal(new StringReader(xml));
- out.println(stringEscape.unescapeJava("\tState: " + route.getState()));
- out.println(stringEscape.unescapeJava("\tState: " + route.getState()));
-
- out.println("");
- out.println("");
- out.println(stringEscape.unescapeJava("\u001B[1mStatistics\u001B[0m"));
- long total = route.getExchangesCompleted() + route.getExchangesFailed();
- out.println(stringEscape.unescapeJava("\tExchanges Total: " + total));
- out.println(stringEscape.unescapeJava("\tExchanges Completed: " + route.getExchangesCompleted()));
- out.println(stringEscape.unescapeJava("\tExchanges Failed: " + route.getExchangesFailed()));
- out.println(stringEscape.unescapeJava("\tExchanges Inflight: " + route.getExchangesInflight()));
- out.println(stringEscape.unescapeJava("\tMin Processing Time: " + route.getMinProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tMax Processing Time: " + route.getMaxProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tMean Processing Time: " + route.getMeanProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tTotal Processing Time: " + route.getTotalProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tLast Processing Time: " + route.getLastProcessingTime() + " ms"));
- out.println(stringEscape.unescapeJava("\tDelta Processing Time: " + route.getDeltaProcessingTime() + " ms"));
-
- if (isEmpty(route.getStartTimestamp())) {
- // Print an empty value for scripting
- out.println(stringEscape.unescapeJava("\tStart Statistics Date:"));
- } else {
- Date date = new SimpleDateFormat(XML_TIMESTAMP_FORMAT).parse(route.getStartTimestamp());
- String text = new SimpleDateFormat(OUTPUT_TIMESTAMP_FORMAT).format(date);
- out.println(stringEscape.unescapeJava("\tStart Statistics Date: " + text));
- }
-
- // Test for null to see if a any exchanges have been processed first to avoid NPE
- if (isEmpty(route.getResetTimestamp())) {
- // Print an empty value for scripting
- out.println(stringEscape.unescapeJava("\tReset Statistics Date:"));
- } else {
- Date date = new SimpleDateFormat(XML_TIMESTAMP_FORMAT).parse(route.getResetTimestamp());
- String text = new SimpleDateFormat(OUTPUT_TIMESTAMP_FORMAT).format(date);
- out.println(stringEscape.unescapeJava("\tReset Statistics Date: " + text));
- }
-
- // Test for null to see if a any exchanges have been processed first to avoid NPE
- if (isEmpty(route.getFirstExchangeCompletedTimestamp())) {
- // Print an empty value for scripting
- out.println(stringEscape.unescapeJava("\tFirst Exchange Date:"));
- } else {
- Date date = new SimpleDateFormat(XML_TIMESTAMP_FORMAT).parse(route.getFirstExchangeCompletedTimestamp());
- String text = new SimpleDateFormat(OUTPUT_TIMESTAMP_FORMAT).format(date);
- out.println(stringEscape.unescapeJava("\tFirst Exchange Date: " + text));
- }
-
- // Test for null to see if a any exchanges have been processed first to avoid NPE
- if (isEmpty(route.getLastExchangeCompletedTimestamp())) {
- // Print an empty value for scripting
- out.println(stringEscape.unescapeJava("\tLast Exchange Date:"));
- } else {
- Date date = new SimpleDateFormat(XML_TIMESTAMP_FORMAT).parse(route.getLastExchangeCompletedTimestamp());
- String text = new SimpleDateFormat(OUTPUT_TIMESTAMP_FORMAT).format(date);
- out.println(stringEscape.unescapeJava("\tLast Exchange Date: " + text));
- }
- }
- }
-}
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
deleted file mode 100644
index 469a79a..0000000
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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;
-
-import java.io.PrintStream;
-import java.io.StringReader;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.camel.support.dump.ProcessorStatDump;
-import org.apache.camel.support.dump.RouteStatDump;
-
-/**
- * Command to display profile information about a Camel route.
- */
-public class RouteProfileCommand extends AbstractRouteCommand {
-
- protected static final String HEADER_FORMAT = "%-30s %10s %12s %12s %12s %12s %12s %12s %12s";
- protected static final String OUTPUT_FORMAT = "%-30s %10d %12d %12d %12d %12d %12d %12d %12d";
-
- private StringEscape stringEscape;
- private volatile String previousCamelContextName;
-
- public RouteProfileCommand(String route, String context) {
- super(route, context);
- }
-
- /**
- * Sets the {@link org.apache.camel.commands.StringEscape} to use.
- */
- public void setStringEscape(StringEscape stringEscape) {
- this.stringEscape = stringEscape;
- }
-
- @Override
- public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
-
- JAXBContext context = JAXBContext.newInstance(RouteStatDump.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
-
- // write new header for new camel context
- if (previousCamelContextName == null || !previousCamelContextName.equals(contextName)) {
- out.println("");
- out.println(stringEscape.unescapeJava("\u001B[1mProfile\u001B[0m"));
- out.println(stringEscape.unescapeJava("\tCamel Context: " + contextName));
- out.println(String.format(HEADER_FORMAT, "Id", "Count", "Last (ms)", "Delta (ms)", "Mean (ms)", "Min (ms)", "Max (ms)", "Total (ms)", "Self (ms)"));
- }
-
- String xml = camelController.getRouteStatsAsXml(routeId, contextName, true, true);
- if (xml != null) {
- RouteStatDump route = (RouteStatDump) unmarshaller.unmarshal(new StringReader(xml));
-
- long count = route.getExchangesCompleted() + route.getExchangesFailed();
- out.println(String.format(OUTPUT_FORMAT, route.getId(), count, route.getLastProcessingTime(), route.getDeltaProcessingTime(),
- route.getMeanProcessingTime(), route.getMinProcessingTime(), route.getMaxProcessingTime(), route.getTotalProcessingTime(), route.getSelfProcessingTime()));
-
- for (ProcessorStatDump ps : route.getProcessorStats()) {
- // the self time is the total time of the processor itself
- long selfTime = ps.getTotalProcessingTime();
- count = ps.getExchangesCompleted() + ps.getExchangesFailed();
- // indent route id with 2 spaces
- out.println(String.format(OUTPUT_FORMAT, " " + ps.getId(), count, ps.getLastProcessingTime(), ps.getDeltaProcessingTime(),
- ps.getMeanProcessingTime(), ps.getMinProcessingTime(), ps.getMaxProcessingTime(), ps.getAccumulatedProcessingTime(), selfTime));
- }
- }
-
- // we want to group routes from the same context in the same table
- previousCamelContextName = contextName;
- }
-}
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStepCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStepCommand.java
deleted file mode 100644
index 7f6256c..0000000
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStepCommand.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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;
-
-import java.io.PrintStream;
-import java.io.StringReader;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.camel.support.dump.RouteStatDump;
-import org.apache.camel.support.dump.StepStatDump;
-
-/**
- * Command to display step information about a Camel route.
- */
-public class RouteStepCommand extends AbstractRouteCommand {
-
- protected static final String HEADER_FORMAT = "%-30s %10s %12s %12s %12s %12s %12s %12s";
- protected static final String OUTPUT_FORMAT = "%-30s %10d %12d %12d %12d %12d %12d %12d";
-
- private StringEscape stringEscape;
- private volatile String previousCamelContextName;
-
- public RouteStepCommand(String route, String context) {
- super(route, context);
- }
-
- /**
- * Sets the {@link StringEscape} to use.
- */
- public void setStringEscape(StringEscape stringEscape) {
- this.stringEscape = stringEscape;
- }
-
- @Override
- public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
-
- JAXBContext context = JAXBContext.newInstance(RouteStatDump.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
-
- // write new header for new camel context
- if (previousCamelContextName == null || !previousCamelContextName.equals(contextName)) {
- out.println("");
- out.println(stringEscape.unescapeJava("\u001B[1mStep\u001B[0m"));
- out.println(stringEscape.unescapeJava("\tCamel Context: " + contextName));
- out.println(String.format(HEADER_FORMAT, "Id", "Count", "Last (ms)", "Delta (ms)", "Mean (ms)", "Min (ms)", "Max (ms)", "Total (ms)"));
- }
-
- String xml = camelController.getStepStatsAsXml(routeId, contextName, true);
- if (xml != null) {
- RouteStatDump route = (RouteStatDump) unmarshaller.unmarshal(new StringReader(xml));
-
- long count = route.getExchangesCompleted() + route.getExchangesFailed();
- out.println(String.format(OUTPUT_FORMAT, route.getId(), count, route.getLastProcessingTime(), route.getDeltaProcessingTime(),
- route.getMeanProcessingTime(), route.getMinProcessingTime(), route.getMaxProcessingTime(), route.getTotalProcessingTime()));
-
- for (StepStatDump ss : route.getStepStats()) {
- count = ss.getExchangesCompleted() + ss.getExchangesFailed();
- // indent step id with 2 spaces
- out.println(String.format(OUTPUT_FORMAT, " " + ss.getId(), count, ss.getLastProcessingTime(), ss.getDeltaProcessingTime(),
- ss.getMeanProcessingTime(), ss.getMinProcessingTime(), ss.getMaxProcessingTime(), ss.getTotalProcessingTime()));
- }
- }
-
- // we want to group routes from the same context in the same table
- previousCamelContextName = contextName;
- }
-}
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
deleted file mode 100644
index e786888..0000000
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.karaf.commands;
-
-import org.apache.camel.commands.ContextInfoCommand;
-import org.apache.camel.commands.StringEscape;
-import org.apache.camel.karaf.commands.completers.CamelContextCompleter;
-import org.apache.camel.karaf.commands.internal.CamelControllerImpl;
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "camel", name = "context-info", description = "Display detailed information about a Camel context.")
-@Service
-public class ContextInfo extends CamelControllerImpl implements Action {
-
- @Argument(index = 0, name = "name", description = "The name of the Camel context", required = true, multiValued = false)
- @Completion(CamelContextCompleter.class)
- String name;
-
- @Option(name = "--verbose", aliases = "-v", description = "Verbose output",
- required = false, multiValued = false, valueToShowInHelp = "false")
- boolean verbose;
-
- private StringEscape stringEscape = org.apache.camel.karaf.commands.internal.StringEscape.getInstance();
-
- @Override
- public Object execute() throws Exception {
- ContextInfoCommand command = new ContextInfoCommand(name, verbose);
- command.setStringEscape(stringEscape);
- return command.execute(this, System.out, System.err);
- }
-}
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
deleted file mode 100644
index a6fe08b..0000000
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.karaf.commands;
-
-import org.apache.camel.commands.RouteInfoCommand;
-import org.apache.camel.commands.StringEscape;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "camel", name = "route-info", description = "Display information about a Camel route.")
-@Service
-public class RouteInfo extends AbstractRouteCommand {
-
- private StringEscape stringEscape = org.apache.camel.karaf.commands.internal.StringEscape.getInstance();
-
- @Override
- public Object execute() throws Exception {
- RouteInfoCommand command = new RouteInfoCommand(route, context);
- command.setStringEscape(stringEscape);
- return command.execute(this, System.out, System.err);
- }
-
-}
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteProfile.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteProfile.java
deleted file mode 100644
index eb892ac..0000000
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteProfile.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.karaf.commands;
-
-import org.apache.camel.commands.RouteProfileCommand;
-import org.apache.camel.commands.StringEscape;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "camel", name = "route-profile", description = "Display profile information about Camel route(s).")
-@Service
-public class RouteProfile extends AbstractRouteCommand {
-
- private StringEscape stringEscape = org.apache.camel.karaf.commands.internal.StringEscape.getInstance();
-
- @Override
- public Object execute() throws Exception {
- RouteProfileCommand command = new RouteProfileCommand(route, context);
- command.setStringEscape(stringEscape);
- return command.execute(this, System.out, System.err);
- }
-}
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteStep.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteStep.java
deleted file mode 100644
index 3791edd..0000000
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteStep.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.karaf.commands;
-
-import org.apache.camel.commands.RouteStepCommand;
-import org.apache.camel.commands.StringEscape;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "camel", name = "route-step", description = "Display step information about Camel route(s).")
-@Service
-public class RouteStep extends AbstractRouteCommand {
-
- private StringEscape stringEscape = org.apache.camel.karaf.commands.internal.StringEscape.getInstance();
-
- @Override
- public Object execute() throws Exception {
- RouteStepCommand command = new RouteStepCommand(route, context);
- command.setStringEscape(stringEscape);
- return command.execute(this, System.out, System.err);
- }
-}