mirror of https://github.com/apache/activemq.git
Applied a patch from: https://issues.apache.org/jira/browse/AMQ-3260
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1158333 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7557f0cfa5
commit
f1486c650d
|
@ -27,29 +27,28 @@ import org.apache.activemq.console.command.Command;
|
|||
import org.apache.activemq.console.command.ShutdownCommand;
|
||||
import org.apache.activemq.console.command.StartCommand;
|
||||
import org.apache.activemq.console.CommandContext;
|
||||
import org.apache.activemq.console.Main;
|
||||
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
|
||||
import org.apache.commons.daemon.Daemon;
|
||||
import org.apache.commons.daemon.DaemonContext;
|
||||
|
||||
/**
|
||||
* This class launches activemq under Apache JSVC {@link http://commons.apache.org/daemon/jsvc.html}
|
||||
*
|
||||
* This class launches ActiveMQ under <a href="http://commons.apache.org/daemon/jsvc.html">Apache JSVC</a>
|
||||
*
|
||||
* @author areese
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ActiveMQLauncher implements Daemon {
|
||||
private List<String> args;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public ActiveMQLauncher() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.apache.commons.daemon.Daemon#destroy()
|
||||
*/
|
||||
public void destroy() {
|
||||
|
@ -57,7 +56,7 @@ public class ActiveMQLauncher implements Daemon {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.apache.commons.daemon.Daemon#init(org.apache.commons.daemon.DaemonContext
|
||||
* )
|
||||
|
@ -69,7 +68,7 @@ public class ActiveMQLauncher implements Daemon {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.apache.commons.daemon.Daemon#start()
|
||||
*/
|
||||
public void start() throws Exception {
|
||||
|
@ -84,7 +83,7 @@ public class ActiveMQLauncher implements Daemon {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.apache.commons.daemon.Daemon#stop()
|
||||
*/
|
||||
public void stop() throws Exception {
|
||||
|
|
|
@ -32,8 +32,8 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Retrieve the output stream being used by the global formatter
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @return formatter's output stream
|
||||
*/
|
||||
public OutputStream getOutputStream() {
|
||||
if (formatter == null) {
|
||||
|
@ -44,7 +44,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print an ObjectInstance format of an mbean
|
||||
*
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(ObjectInstance mbean) {
|
||||
|
@ -56,7 +56,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print an ObjectName format of an mbean
|
||||
*
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(ObjectName mbean) {
|
||||
|
@ -68,7 +68,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print an AttributeList format of an mbean
|
||||
*
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(AttributeList mbean) {
|
||||
|
@ -80,9 +80,10 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a Map format of an mbean
|
||||
*
|
||||
*
|
||||
* @param mbean
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void printMBean(Map mbean) {
|
||||
if (formatter == null) {
|
||||
throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
|
||||
|
@ -92,9 +93,10 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a Collection format of mbeans
|
||||
*
|
||||
*
|
||||
* @param mbean - collection of mbeans
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void printMBean(Collection mbean) {
|
||||
if (formatter == null) {
|
||||
throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
|
||||
|
@ -104,9 +106,10 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a Map format of a JMS message
|
||||
*
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void printMessage(Map msg) {
|
||||
if (formatter == null) {
|
||||
throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
|
||||
|
@ -116,7 +119,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a Message format of a JMS message
|
||||
*
|
||||
*
|
||||
* @param msg - JMS message to print
|
||||
*/
|
||||
public void printMessage(Message msg) {
|
||||
|
@ -128,9 +131,10 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a collection of JMS messages
|
||||
*
|
||||
*
|
||||
* @param msg - collection of JMS messages
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void printMessage(Collection msg) {
|
||||
if (formatter == null) {
|
||||
throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
|
||||
|
@ -140,7 +144,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print help messages
|
||||
*
|
||||
*
|
||||
* @param helpMsgs - help messages to print
|
||||
*/
|
||||
public void printHelp(String[] helpMsgs) {
|
||||
|
@ -152,7 +156,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print an information message
|
||||
*
|
||||
*
|
||||
* @param info - information message to print
|
||||
*/
|
||||
public void printInfo(String info) {
|
||||
|
@ -164,7 +168,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print an exception message
|
||||
*
|
||||
*
|
||||
* @param e - exception to print
|
||||
*/
|
||||
public void printException(Exception e) {
|
||||
|
@ -176,7 +180,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a version information
|
||||
*
|
||||
*
|
||||
* @param version - version info to print
|
||||
*/
|
||||
public void printVersion(String version) {
|
||||
|
@ -188,9 +192,10 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a generic key value mapping
|
||||
*
|
||||
*
|
||||
* @param map to print
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void print(Map map) {
|
||||
if (formatter == null) {
|
||||
throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
|
||||
|
@ -200,7 +205,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a generic array of strings
|
||||
*
|
||||
*
|
||||
* @param strings - string array to print
|
||||
*/
|
||||
public void print(String[] strings) {
|
||||
|
@ -212,9 +217,10 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a collection of objects
|
||||
*
|
||||
*
|
||||
* @param collection - collection to print
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void print(Collection collection) {
|
||||
if (formatter == null) {
|
||||
throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
|
||||
|
@ -224,7 +230,7 @@ public final class CommandContext {
|
|||
|
||||
/**
|
||||
* Print a java string
|
||||
*
|
||||
*
|
||||
* @param string - string to print
|
||||
*/
|
||||
public void print(String string) {
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.wireformat.WireFormat;
|
|||
|
||||
/**
|
||||
* Reads and iterates through data log files for the AMQMessage Store
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AMQReader implements Iterable<Message> {
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class AMQReader implements Iterable<Message> {
|
|||
/**
|
||||
* List all the data files in a directory
|
||||
* @param directory
|
||||
* @return
|
||||
* @return result
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Set<File> listDataFiles(File directory) throws IOException{
|
||||
|
@ -69,25 +69,25 @@ public class AMQReader implements Iterable<Message> {
|
|||
/**
|
||||
* Create the AMQReader to read a directory of amq data logs - or an
|
||||
* individual data log file
|
||||
*
|
||||
*
|
||||
* @param file the directory - or file
|
||||
* @throws IOException
|
||||
* @throws InvalidSelectorException
|
||||
* @throws IOException
|
||||
* @throws InvalidSelectorException
|
||||
* @throws InvalidSelectorException
|
||||
* @throws IOException
|
||||
* @throws InvalidSelectorException
|
||||
*/
|
||||
public AMQReader(File file) throws InvalidSelectorException, IOException {
|
||||
this(file,null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the AMQReader to read a directory of amq data logs - or an
|
||||
* individual data log file
|
||||
*
|
||||
*
|
||||
* @param file the directory - or file
|
||||
* @param selector the JMS selector or null to select all
|
||||
* @throws IOException
|
||||
* @throws InvalidSelectorException
|
||||
* @throws InvalidSelectorException
|
||||
*/
|
||||
public AMQReader(File file, String selector) throws IOException, InvalidSelectorException {
|
||||
String str = selector != null ? selector.trim() : null;
|
||||
|
@ -110,7 +110,7 @@ public class AMQReader implements Iterable<Message> {
|
|||
return new AMQIterator(this,this.expression);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected MessageLocation getNextMessage(MessageLocation lastLocation)
|
||||
throws IllegalStateException, IOException {
|
||||
if (this.file != null) {
|
||||
|
|
|
@ -29,7 +29,7 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
/**
|
||||
* Creates a regular expression query that is able to match an object using
|
||||
* key-value pattern regex filtering
|
||||
*
|
||||
*
|
||||
* @param next
|
||||
*/
|
||||
protected RegExQueryFilter(QueryFilter next) {
|
||||
|
@ -40,11 +40,12 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
* Separates the regular expressions queries from the usual queries. A query
|
||||
* is a regex query, if it is key-value pair with the format <key>=<value>,
|
||||
* and value is a pattern that satisfies the isRegularExpression method.
|
||||
*
|
||||
*
|
||||
* @param queries - list of queries
|
||||
* @return filtered objects that matches the regex query
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public List query(List queries) throws Exception {
|
||||
Map regex = new HashMap();
|
||||
List newQueries = new ArrayList();
|
||||
|
@ -80,9 +81,9 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
* Checks if a given string is a regular expression query. Currently, a
|
||||
* pattern is a regex query, if it starts with the
|
||||
* RegExQueryFilter.REGEX_PREFIX.
|
||||
*
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
* @return boolean result of query check
|
||||
*/
|
||||
protected boolean isRegularExpression(String query) {
|
||||
return query.startsWith(REGEX_PREFIX);
|
||||
|
@ -90,7 +91,7 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Compiles the regex query to a pattern.
|
||||
*
|
||||
*
|
||||
* @param query - query string to compile
|
||||
* @return regex pattern
|
||||
*/
|
||||
|
@ -100,12 +101,13 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Filter the specified colleciton using the regex patterns extracted.
|
||||
*
|
||||
*
|
||||
* @param regex - regex map
|
||||
* @param data - list of objects to filter
|
||||
* @return filtered list of objects that matches the regex map
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
protected List filterCollectionUsingRegEx(Map regex, List data) throws Exception {
|
||||
// No regular expressions filtering needed
|
||||
if (regex == null || regex.isEmpty()) {
|
||||
|
@ -128,11 +130,12 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Determines how the object is to be matched to the regex map.
|
||||
*
|
||||
*
|
||||
* @param data - object to match
|
||||
* @param regex - regex map
|
||||
* @return true, if the object matches the regex map, false otherwise
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected abstract boolean matches(Object data, Map regex) throws Exception;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ public interface OutputFormatter {
|
|||
|
||||
/**
|
||||
* Retrieve the output stream being used by the formatter
|
||||
* @return
|
||||
*/
|
||||
OutputStream getOutputStream();
|
||||
|
||||
|
@ -55,18 +54,21 @@ public interface OutputFormatter {
|
|||
* Print a Map format of an mbean
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
void printMBean(Map mbean);
|
||||
|
||||
/**
|
||||
* Print a Collection format of mbeans
|
||||
* @param mbean - collection of mbeans
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
void printMBean(Collection mbean);
|
||||
|
||||
/**
|
||||
* Print a Map format of a JMS message
|
||||
* @param msg
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
void printMessage(Map msg);
|
||||
|
||||
/**
|
||||
|
@ -79,6 +81,7 @@ public interface OutputFormatter {
|
|||
* Print a Collection format of JMS messages
|
||||
* @param msg - collection of JMS messages
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
void printMessage(Collection msg);
|
||||
|
||||
/**
|
||||
|
@ -109,6 +112,7 @@ public interface OutputFormatter {
|
|||
* Print a generic key value mapping
|
||||
* @param map to print
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
void print(Map map);
|
||||
|
||||
/**
|
||||
|
@ -121,6 +125,7 @@ public interface OutputFormatter {
|
|||
* Print a collection of objects
|
||||
* @param collection - collection to print
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
void print(Collection collection);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue