diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java index 45e1dfd38b..dfa6c91b85 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java @@ -17,6 +17,8 @@ package org.apache.activemq.artemis.cli; import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; import java.util.List; import io.airlift.airline.Cli; @@ -172,4 +174,18 @@ public class Artemis { return builder; } + public static void printBanner() throws Exception { + copy(Artemis.class.getResourceAsStream("banner.txt"), System.out); + } + + private static long copy(InputStream in, OutputStream out) throws Exception { + byte[] buffer = new byte[1024]; + int len = in.read(buffer); + while (len != -1) { + out.write(buffer, 0, len); + len = in.read(buffer); + } + return len; + } + } diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java index a299b182da..e48a1f40d1 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java @@ -22,8 +22,8 @@ import java.util.TimerTask; import io.airlift.airline.Command; import io.airlift.airline.Option; +import org.apache.activemq.artemis.cli.Artemis; import org.apache.activemq.artemis.cli.commands.tools.LockAbstract; -import org.apache.activemq.artemis.cli.commands.tools.PrintData; import org.apache.activemq.artemis.cli.factory.BrokerFactory; import org.apache.activemq.artemis.cli.factory.security.SecurityManagerFactory; import org.apache.activemq.artemis.components.ExternalComponent; @@ -60,7 +60,7 @@ public class Run extends LockAbstract { public Object execute(ActionContext context) throws Exception { super.execute(context); - PrintData.printBanner(); + Artemis.printBanner(); BrokerDTO broker = getBrokerDTO(); diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java index d5e895dc84..20cbfae4b0 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java @@ -17,8 +17,6 @@ package org.apache.activemq.artemis.cli.commands.tools; import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -33,6 +31,7 @@ import io.airlift.airline.Command; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.cli.Artemis; import org.apache.activemq.artemis.cli.commands.ActionContext; import org.apache.activemq.artemis.core.journal.RecordInfo; import org.apache.activemq.artemis.core.message.impl.CoreMessagePersister; @@ -82,7 +81,7 @@ public class PrintData extends OptionalLocking { public static void printData(File bindingsDirectory, File messagesDirectory, File pagingDirectory) throws Exception { // Having the version on the data report is an information very useful to understand what happened // When debugging stuff - printBanner(); + Artemis.printBanner(); File serverLockFile = new File(messagesDirectory, "server.lock"); @@ -136,20 +135,6 @@ public class PrintData extends OptionalLocking { } - public static void printBanner() throws Exception { - copy(PrintData.class.getResourceAsStream("banner.txt"), System.out); - } - - private static long copy(InputStream in, OutputStream out) throws Exception { - byte[] buffer = new byte[1024]; - int len = in.read(buffer); - while (len != -1) { - out.write(buffer, 0, len); - len = in.read(buffer); - } - return len; - } - private static void printPages(File pageDirectory, DescribeJournal describeJournal) { try {