mirror of https://github.com/apache/activemq.git
More checkstyle fixes
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@564977 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
933eb2f9e4
commit
5f1adbe898
|
@ -1,4 +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.
|
||||
|
@ -16,16 +16,17 @@
|
|||
*/
|
||||
package org.apache.activemq.console;
|
||||
|
||||
import org.apache.activemq.broker.util.CommandHandler;
|
||||
import org.apache.activemq.console.command.ShellCommand;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.jms.TextMessage;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.StringTokenizer;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import org.apache.activemq.broker.util.CommandHandler;
|
||||
import org.apache.activemq.console.command.ShellCommand;
|
||||
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
|
||||
/**
|
||||
* A default implementation of the @{link CommandHandler} interface
|
||||
|
@ -44,7 +45,7 @@ public class ConsoleCommandHandler implements CommandHandler {
|
|||
// lets turn the text into a list of arguments
|
||||
String requestText = request.getText();
|
||||
|
||||
List tokens = tokenize(requestText);
|
||||
List<String> tokens = tokenize(requestText);
|
||||
command.execute(tokens);
|
||||
|
||||
out.flush();
|
||||
|
@ -55,8 +56,8 @@ public class ConsoleCommandHandler implements CommandHandler {
|
|||
response.setText(answer);
|
||||
}
|
||||
|
||||
protected List tokenize(String text) {
|
||||
List answer = new ArrayList();
|
||||
protected List<String> tokenize(String text) {
|
||||
List<String> answer = new ArrayList<String>();
|
||||
StringTokenizer iter = new StringTokenizer(text);
|
||||
while (iter.hasMoreTokens()) {
|
||||
answer.add(iter.nextToken());
|
||||
|
|
|
@ -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,
|
||||
|
@ -30,37 +29,35 @@ import java.net.URLClassLoader;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* Main class that can bootstrap an ActiveMQ broker console. Handles command line
|
||||
* argument parsing to set up and run broker tasks.
|
||||
* Main class that can bootstrap an ActiveMQ broker console. Handles command
|
||||
* line argument parsing to set up and run broker tasks.
|
||||
*
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
public static final String TASK_DEFAULT_CLASS = "org.apache.activemq.console.command.ShellCommand";
|
||||
|
||||
private File activeMQHome;
|
||||
private File activeMQBase;
|
||||
private ClassLoader classLoader;
|
||||
private Set extensions = new HashSet(5);
|
||||
private Set activeMQClassPath = new HashSet(5);
|
||||
|
||||
|
||||
public static final String TASK_DEFAULT_CLASS = "org.apache.activemq.console.command.ShellCommand";
|
||||
private static boolean useDefExt = true;
|
||||
|
||||
private File activeMQHome;
|
||||
private File activeMQBase;
|
||||
private ClassLoader classLoader;
|
||||
private Set<File> extensions = new HashSet<File>(5);
|
||||
private Set<File> activeMQClassPath = new HashSet<File>(5);
|
||||
|
||||
public static void main(String[] args) {
|
||||
Main app = new Main();
|
||||
|
||||
// Convert arguments to collection for easier management
|
||||
List tokens = new LinkedList(Arrays.asList(args));
|
||||
List<String> tokens = new LinkedList<String>(Arrays.asList(args));
|
||||
// Parse for extension directory option
|
||||
app.parseExtensions(tokens);
|
||||
|
||||
|
@ -69,24 +66,25 @@ public class Main {
|
|||
// ${activemq.base}/conf
|
||||
// ${activemq.base}/lib/* (only if activemq.base != activemq.home)
|
||||
// ${activemq.home}/lib/*
|
||||
// ${activemq.base}/lib/optional/* (only if activemq.base != activemq.home)
|
||||
// ${activemq.base}/lib/optional/* (only if activemq.base !=
|
||||
// activemq.home)
|
||||
// ${activemq.home}/lib/optional/*
|
||||
// ${activemq.base}/lib/web/* (only if activemq.base != activemq.home)
|
||||
// ${activemq.home}/lib/web/*
|
||||
//
|
||||
if(useDefExt && app.canUseExtdir()) {
|
||||
if (useDefExt && app.canUseExtdir()) {
|
||||
|
||||
boolean baseIsHome = app.getActiveMQBase().equals(app.getActiveMQHome());
|
||||
|
||||
File baseLibDir = new File(app.getActiveMQBase(), "lib");
|
||||
File homeLibDir = new File(app.getActiveMQHome(), "lib");
|
||||
|
||||
if(!baseIsHome) {
|
||||
if (!baseIsHome) {
|
||||
app.addExtensionDirectory(baseLibDir);
|
||||
}
|
||||
app.addExtensionDirectory(homeLibDir);
|
||||
|
||||
if(!baseIsHome) {
|
||||
if (!baseIsHome) {
|
||||
app.addExtensionDirectory(new File(baseLibDir, "optional"));
|
||||
app.addExtensionDirectory(new File(baseLibDir, "web"));
|
||||
}
|
||||
|
@ -95,7 +93,8 @@ public class Main {
|
|||
|
||||
}
|
||||
|
||||
// Add any custom classpath specified from the system property activemq.classpath
|
||||
// Add any custom classpath specified from the system property
|
||||
// activemq.classpath
|
||||
app.addClassPathList(System.getProperty("activemq.classpath"));
|
||||
|
||||
try {
|
||||
|
@ -104,7 +103,7 @@ public class Main {
|
|||
System.out.println("Could not load class: " + e.getMessage());
|
||||
try {
|
||||
ClassLoader cl = app.getClassLoader();
|
||||
if( cl!=null ) {
|
||||
if (cl != null) {
|
||||
System.out.println("Class loader setup: ");
|
||||
printClassLoaderTree(cl);
|
||||
}
|
||||
|
@ -123,8 +122,8 @@ public class Main {
|
|||
*/
|
||||
private static int printClassLoaderTree(ClassLoader cl) {
|
||||
int depth = 0;
|
||||
if( cl.getParent()!=null ) {
|
||||
depth = printClassLoaderTree(cl.getParent())+1;
|
||||
if (cl.getParent() != null) {
|
||||
depth = printClassLoaderTree(cl.getParent()) + 1;
|
||||
}
|
||||
|
||||
StringBuffer indent = new StringBuffer();
|
||||
|
@ -132,21 +131,21 @@ public class Main {
|
|||
indent.append(" ");
|
||||
}
|
||||
|
||||
if( cl instanceof URLClassLoader ) {
|
||||
URLClassLoader ucl = (URLClassLoader) cl;
|
||||
System.out.println(indent+cl.getClass().getName()+" {");
|
||||
if (cl instanceof URLClassLoader) {
|
||||
URLClassLoader ucl = (URLClassLoader)cl;
|
||||
System.out.println(indent + cl.getClass().getName() + " {");
|
||||
URL[] urls = ucl.getURLs();
|
||||
for (int i = 0; i < urls.length; i++) {
|
||||
System.out.println(indent+" "+urls[i]);
|
||||
System.out.println(indent + " " + urls[i]);
|
||||
}
|
||||
System.out.println(indent+"}");
|
||||
System.out.println(indent + "}");
|
||||
} else {
|
||||
System.out.println(indent+cl.getClass().getName());
|
||||
System.out.println(indent + cl.getClass().getName());
|
||||
}
|
||||
return depth;
|
||||
}
|
||||
|
||||
public void parseExtensions(List tokens) {
|
||||
public void parseExtensions(List<String> tokens) {
|
||||
if (tokens.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -156,15 +155,16 @@ public class Main {
|
|||
|
||||
// Parse for all --extdir and --noDefExt options
|
||||
while (i < count) {
|
||||
String token = (String)tokens.get(i);
|
||||
String token = tokens.get(i);
|
||||
// If token is an extension dir option
|
||||
if (token.equals("--extdir")) {
|
||||
// Process token
|
||||
count--;
|
||||
tokens.remove(i);
|
||||
|
||||
// If no extension directory is specified, or next token is another option
|
||||
if (i >= count || ((String)tokens.get(i)).startsWith("-")) {
|
||||
// If no extension directory is specified, or next token is
|
||||
// another option
|
||||
if (i >= count || tokens.get(i).startsWith("-")) {
|
||||
System.out.println("Extension directory not specified.");
|
||||
System.out.println("Ignoring extension directory option.");
|
||||
continue;
|
||||
|
@ -172,9 +172,9 @@ public class Main {
|
|||
|
||||
// Process extension dir token
|
||||
count--;
|
||||
File extDir = new File((String)tokens.remove(i));
|
||||
File extDir = new File(tokens.remove(i));
|
||||
|
||||
if(!canUseExtdir()) {
|
||||
if (!canUseExtdir()) {
|
||||
System.out.println("Extension directory feature not available due to the system classpath being able to load: " + TASK_DEFAULT_CLASS);
|
||||
System.out.println("Ignoring extension directory option.");
|
||||
continue;
|
||||
|
@ -187,7 +187,8 @@ public class Main {
|
|||
}
|
||||
|
||||
addExtensionDirectory(extDir);
|
||||
} else if (token.equals("--noDefExt")) { // If token is --noDefExt option
|
||||
} else if (token.equals("--noDefExt")) { // If token is
|
||||
// --noDefExt option
|
||||
count--;
|
||||
tokens.remove(i);
|
||||
useDefExt = false;
|
||||
|
@ -198,19 +199,23 @@ public class Main {
|
|||
|
||||
}
|
||||
|
||||
public void runTaskClass(List tokens) throws Throwable {
|
||||
public void runTaskClass(List<String> tokens) throws Throwable {
|
||||
|
||||
System.out.println("ACTIVEMQ_HOME: "+ getActiveMQHome());
|
||||
System.out.println("ACTIVEMQ_BASE: "+ getActiveMQBase());
|
||||
System.out.println("ACTIVEMQ_HOME: " + getActiveMQHome());
|
||||
System.out.println("ACTIVEMQ_BASE: " + getActiveMQBase());
|
||||
|
||||
ClassLoader cl = getClassLoader();
|
||||
|
||||
// Use reflection to run the task.
|
||||
try {
|
||||
String[] args = (String[]) tokens.toArray(new String[tokens.size()]);
|
||||
String[] args = tokens.toArray(new String[tokens.size()]);
|
||||
Class task = cl.loadClass(TASK_DEFAULT_CLASS);
|
||||
Method runTask = task.getMethod("main", new Class[] { String[].class, InputStream.class, PrintStream.class });
|
||||
runTask.invoke(task.newInstance(), new Object[] { args, System.in, System.out });
|
||||
Method runTask = task.getMethod("main", new Class[] {
|
||||
String[].class, InputStream.class, PrintStream.class
|
||||
});
|
||||
runTask.invoke(task.newInstance(), new Object[] {
|
||||
args, System.in, System.out
|
||||
});
|
||||
} catch (InvocationTargetException e) {
|
||||
throw e.getCause();
|
||||
}
|
||||
|
@ -234,8 +239,9 @@ public class Main {
|
|||
}
|
||||
|
||||
/**
|
||||
* The extension directory feature will not work if the broker factory is already in the classpath
|
||||
* since we have to load him from a child ClassLoader we build for it to work correctly.
|
||||
* The extension directory feature will not work if the broker factory is
|
||||
* already in the classpath since we have to load him from a child
|
||||
* ClassLoader we build for it to work correctly.
|
||||
*
|
||||
* @return true, if extension dir can be used. false otherwise.
|
||||
*/
|
||||
|
@ -249,39 +255,45 @@ public class Main {
|
|||
}
|
||||
|
||||
public ClassLoader getClassLoader() throws MalformedURLException {
|
||||
if(classLoader==null) {
|
||||
if (classLoader == null) {
|
||||
// Setup the ClassLoader
|
||||
classLoader = Main.class.getClassLoader();
|
||||
if (!extensions.isEmpty() || !activeMQClassPath.isEmpty()) {
|
||||
|
||||
ArrayList urls = new ArrayList();
|
||||
ArrayList<URL> urls = new ArrayList<URL>();
|
||||
|
||||
for (Iterator iter = activeMQClassPath.iterator(); iter.hasNext();) {
|
||||
File dir = (File) iter.next();
|
||||
// try{ System.out.println("Adding to classpath: " + dir.getCanonicalPath()); }catch(Exception e){}
|
||||
for (Iterator<File> iter = activeMQClassPath.iterator(); iter.hasNext();) {
|
||||
File dir = iter.next();
|
||||
// try{ System.out.println("Adding to classpath: " +
|
||||
// dir.getCanonicalPath()); }catch(Exception e){}
|
||||
urls.add(dir.toURL());
|
||||
}
|
||||
|
||||
for (Iterator iter = extensions.iterator(); iter.hasNext();) {
|
||||
File dir = (File) iter.next();
|
||||
if( dir.isDirectory() ) {
|
||||
for (Iterator<File> iter = extensions.iterator(); iter.hasNext();) {
|
||||
File dir = iter.next();
|
||||
if (dir.isDirectory()) {
|
||||
File[] files = dir.listFiles();
|
||||
if( files!=null ) {
|
||||
if (files != null) {
|
||||
|
||||
// Sort the jars so that classpath built is consistently
|
||||
// in the same order. Also allows us to use jar names to control
|
||||
// Sort the jars so that classpath built is
|
||||
// consistently
|
||||
// in the same order. Also allows us to use jar
|
||||
// names to control
|
||||
// classpath order.
|
||||
Arrays.sort(files, new Comparator(){
|
||||
Arrays.sort(files, new Comparator() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
File f1 = (File) o1;
|
||||
File f2 = (File) o2;
|
||||
File f1 = (File)o1;
|
||||
File f2 = (File)o2;
|
||||
return f1.getName().compareTo(f2.getName());
|
||||
}
|
||||
});
|
||||
|
||||
for (int j = 0; j < files.length; j++) {
|
||||
if( files[j].getName().endsWith(".zip") || files[j].getName().endsWith(".jar") ) {
|
||||
// try{ System.out.println("Adding to classpath: " + files[j].getCanonicalPath()); }catch(Exception e){}
|
||||
if (files[j].getName().endsWith(".zip") || files[j].getName().endsWith(".jar")) {
|
||||
// try{ System.out.println("Adding to
|
||||
// classpath: " +
|
||||
// files[j].getCanonicalPath());
|
||||
// }catch(Exception e){}
|
||||
urls.add(files[j].toURL());
|
||||
}
|
||||
}
|
||||
|
@ -303,29 +315,29 @@ public class Main {
|
|||
}
|
||||
|
||||
public File getActiveMQHome() {
|
||||
if(activeMQHome==null) {
|
||||
if(System.getProperty("activemq.home") != null) {
|
||||
if (activeMQHome == null) {
|
||||
if (System.getProperty("activemq.home") != null) {
|
||||
activeMQHome = new File(System.getProperty("activemq.home"));
|
||||
}
|
||||
|
||||
if(activeMQHome==null){
|
||||
if (activeMQHome == null) {
|
||||
// guess from the location of the jar
|
||||
URL url = Main.class.getClassLoader().getResource("org/apache/activemq/console/Main.class");
|
||||
if (url != null) {
|
||||
try {
|
||||
JarURLConnection jarConnection = (JarURLConnection) url.openConnection();
|
||||
JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
|
||||
url = jarConnection.getJarFileURL();
|
||||
URI baseURI = new URI(url.toString()).resolve("..");
|
||||
activeMQHome = new File(baseURI).getCanonicalFile();
|
||||
System.setProperty("activemq.home",activeMQHome.getAbsolutePath());
|
||||
System.setProperty("activemq.home", activeMQHome.getAbsolutePath());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(activeMQHome==null){
|
||||
if (activeMQHome == null) {
|
||||
activeMQHome = new File("../.");
|
||||
System.setProperty("activemq.home",activeMQHome.getAbsolutePath());
|
||||
System.setProperty("activemq.home", activeMQHome.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,14 +345,14 @@ public class Main {
|
|||
}
|
||||
|
||||
public File getActiveMQBase() {
|
||||
if(activeMQBase==null) {
|
||||
if(System.getProperty("activemq.base") != null) {
|
||||
if (activeMQBase == null) {
|
||||
if (System.getProperty("activemq.base") != null) {
|
||||
activeMQBase = new File(System.getProperty("activemq.base"));
|
||||
}
|
||||
|
||||
if(activeMQBase==null){
|
||||
if (activeMQBase == null) {
|
||||
activeMQBase = getActiveMQHome();
|
||||
System.setProperty("activemq.base",activeMQBase.getAbsolutePath());
|
||||
System.setProperty("activemq.base", activeMQBase.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,31 +16,36 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.JMSException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.JMSException;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
|
||||
public abstract class AbstractAmqCommand extends AbstractCommand {
|
||||
private URI brokerUrl;
|
||||
private ConnectionFactory factory;
|
||||
private final List connections = new ArrayList();
|
||||
private final List<Connection> connections = new ArrayList<Connection>();
|
||||
|
||||
/**
|
||||
* Establishes a connection to the remote broker specified by the broker url.
|
||||
* Establishes a connection to the remote broker specified by the broker
|
||||
* url.
|
||||
*
|
||||
* @return - connection to the broker
|
||||
* @throws JMSException
|
||||
*/
|
||||
protected Connection createConnection() throws JMSException {
|
||||
if (getBrokerUrl() == null) {
|
||||
GlobalWriter.printException(new IllegalStateException("You must specify a broker URL to connect to using the --amqurl option."));
|
||||
GlobalWriter
|
||||
.printException(new IllegalStateException("You must specify a broker "
|
||||
+ "URL to connect to using the --amqurl option."));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -56,7 +60,9 @@ public abstract class AbstractAmqCommand extends AbstractCommand {
|
|||
}
|
||||
|
||||
/**
|
||||
* Establishes a connection to the remote broker specified by the broker url.
|
||||
* Establishes a connection to the remote broker specified by the broker
|
||||
* url.
|
||||
*
|
||||
* @param username - username for the connection
|
||||
* @param password - password for the connection
|
||||
* @return - connection to the broker
|
||||
|
@ -64,7 +70,9 @@ public abstract class AbstractAmqCommand extends AbstractCommand {
|
|||
*/
|
||||
protected Connection createConnection(String username, String password) throws JMSException {
|
||||
if (getBrokerUrl() == null) {
|
||||
GlobalWriter.printException(new IllegalStateException("You must specify a broker URL to connect to using the --amqurl option."));
|
||||
GlobalWriter
|
||||
.printException(new IllegalStateException(
|
||||
"You must specify a broker URL to connect to using the --amqurl option."));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -83,10 +91,11 @@ public abstract class AbstractAmqCommand extends AbstractCommand {
|
|||
* Close all created connections.
|
||||
*/
|
||||
protected void closeAllConnections() {
|
||||
for (Iterator i=connections.iterator(); i.hasNext();) {
|
||||
for (Iterator<Connection> i = connections.iterator(); i.hasNext();) {
|
||||
try {
|
||||
((Connection)i.next()).close();
|
||||
} catch (Exception e) { }
|
||||
i.next().close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
connections.clear();
|
||||
|
@ -94,6 +103,7 @@ public abstract class AbstractAmqCommand extends AbstractCommand {
|
|||
|
||||
/**
|
||||
* Handle the --amqurl option.
|
||||
*
|
||||
* @param token - current option
|
||||
* @param tokens - succeeding list of arguments
|
||||
* @throws Exception
|
||||
|
@ -110,7 +120,8 @@ public abstract class AbstractAmqCommand extends AbstractCommand {
|
|||
|
||||
// If broker url already specified
|
||||
if (getBrokerUrl() != null) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Multiple broker URL cannot be specified."));
|
||||
GlobalWriter
|
||||
.printException(new IllegalArgumentException("Multiple broker URL cannot be specified."));
|
||||
tokens.clear();
|
||||
return;
|
||||
}
|
||||
|
@ -132,6 +143,7 @@ public abstract class AbstractAmqCommand extends AbstractCommand {
|
|||
|
||||
/**
|
||||
* Set the broker url.
|
||||
*
|
||||
* @param brokerUrl - new broker url
|
||||
*/
|
||||
protected void setBrokerUrl(URI brokerUrl) {
|
||||
|
@ -140,6 +152,7 @@ public abstract class AbstractAmqCommand extends AbstractCommand {
|
|||
|
||||
/**
|
||||
* Set the broker url.
|
||||
*
|
||||
* @param address - address of the new broker url
|
||||
* @throws URISyntaxException
|
||||
*/
|
||||
|
@ -149,6 +162,7 @@ public abstract class AbstractAmqCommand extends AbstractCommand {
|
|||
|
||||
/**
|
||||
* Get the current broker url.
|
||||
*
|
||||
* @return current broker url
|
||||
*/
|
||||
protected URI getBrokerUrl() {
|
||||
|
|
|
@ -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,23 +16,25 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionMetaData;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractCommand implements Command {
|
||||
public static final String COMMAND_OPTION_DELIMETER = ",";
|
||||
|
||||
private boolean isPrintHelp = false;
|
||||
private boolean isPrintVersion = false;
|
||||
private boolean isPrintHelp;
|
||||
private boolean isPrintVersion;
|
||||
|
||||
/**
|
||||
* Exceute a generic command, which includes parsing the options for the command and running the specific task.
|
||||
* Execute a generic command, which includes parsing the options for the
|
||||
* command and running the specific task.
|
||||
*
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
public void execute(List tokens) throws Exception {
|
||||
public void execute(List<String> tokens) throws Exception {
|
||||
// Parse the options specified by "-"
|
||||
parseOptions(tokens);
|
||||
|
||||
|
@ -41,24 +42,26 @@ public abstract class AbstractCommand implements Command {
|
|||
if (isPrintHelp) {
|
||||
printHelp();
|
||||
|
||||
// Print the AMQ version
|
||||
// Print the AMQ version
|
||||
} else if (isPrintVersion) {
|
||||
GlobalWriter.printVersion(ActiveMQConnectionMetaData.PROVIDER_VERSION);
|
||||
|
||||
// Run the specified task
|
||||
// Run the specified task
|
||||
} else {
|
||||
runTask(tokens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse any option parameters in the command arguments specified by a '-' as the first character of the token.
|
||||
* Parse any option parameters in the command arguments specified by a '-'
|
||||
* as the first character of the token.
|
||||
*
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void parseOptions(List tokens) throws Exception {
|
||||
protected void parseOptions(List<String> tokens) throws Exception {
|
||||
while (!tokens.isEmpty()) {
|
||||
String token = (String)tokens.remove(0);
|
||||
String token = tokens.remove(0);
|
||||
if (token.startsWith("-")) {
|
||||
// Token is an option
|
||||
handleOption(token, tokens);
|
||||
|
@ -71,25 +74,25 @@ public abstract class AbstractCommand implements Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle the general options for each command, which includes -h, -?, --help, -D, --version.
|
||||
* Handle the general options for each command, which includes -h, -?,
|
||||
* --help, -D, --version.
|
||||
*
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List tokens) throws Exception {
|
||||
protected void handleOption(String token, List<String> tokens) throws Exception {
|
||||
// If token is a help option
|
||||
if (token.equals("-h") || token.equals("-?") || token.equals("--help")) {
|
||||
isPrintHelp = true;
|
||||
tokens.clear();
|
||||
|
||||
// If token is a version option
|
||||
// If token is a version option
|
||||
} else if (token.equals("--version")) {
|
||||
isPrintVersion = true;
|
||||
tokens.clear();
|
||||
}
|
||||
|
||||
// If token is a system property define option
|
||||
else if (token.startsWith("-D")) {
|
||||
} else if (token.startsWith("-D")) {
|
||||
// If token is a system property define option
|
||||
String key = token.substring(2);
|
||||
String value = "";
|
||||
int pos = key.indexOf("=");
|
||||
|
@ -98,11 +101,8 @@ public abstract class AbstractCommand implements Command {
|
|||
key = key.substring(0, pos);
|
||||
}
|
||||
System.setProperty(key, value);
|
||||
|
||||
}
|
||||
|
||||
// Token is unrecognized
|
||||
else {
|
||||
} else {
|
||||
// Token is unrecognized
|
||||
GlobalWriter.printInfo("Unrecognized option: " + token);
|
||||
isPrintHelp = true;
|
||||
}
|
||||
|
@ -110,13 +110,14 @@ public abstract class AbstractCommand implements Command {
|
|||
|
||||
/**
|
||||
* Run the specific task.
|
||||
*
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
abstract protected void runTask(List tokens) throws Exception;
|
||||
protected abstract void runTask(List<String> tokens) throws Exception;
|
||||
|
||||
/**
|
||||
* Print the help messages for the specific task
|
||||
*/
|
||||
abstract protected void printHelp();
|
||||
protected abstract void printHelp();
|
||||
}
|
||||
|
|
|
@ -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,15 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import java.util.List;
|
||||
import java.net.MalformedURLException;
|
||||
import java.io.IOException;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
|
||||
public abstract class AbstractJmxCommand extends AbstractCommand {
|
||||
public static final String DEFAULT_JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi";
|
||||
|
@ -107,7 +107,7 @@ public abstract class AbstractJmxCommand extends AbstractCommand {
|
|||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List tokens) throws Exception {
|
||||
protected void handleOption(String token, List<String> tokens) throws Exception {
|
||||
// Try to handle the options first
|
||||
if (token.equals("--jmxurl")) {
|
||||
// If no jmx url specified, or next token is a new option
|
||||
|
|
|
@ -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,18 +16,19 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import org.apache.activemq.console.util.AmqMessagesUtil;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.apache.activemq.command.ActiveMQTopic;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.jms.Destination;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.apache.activemq.command.ActiveMQTopic;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.util.AmqMessagesUtil;
|
||||
|
||||
public class AmqBrowseCommand extends AbstractAmqCommand {
|
||||
public static final String QUEUE_PREFIX = "queue:";
|
||||
|
@ -36,176 +36,7 @@ public class AmqBrowseCommand extends AbstractAmqCommand {
|
|||
|
||||
public static final String VIEW_GROUP_HEADER = "header:";
|
||||
public static final String VIEW_GROUP_CUSTOM = "custom:";
|
||||
public static final String VIEW_GROUP_BODY = "body:";
|
||||
|
||||
private final List queryAddObjects = new ArrayList(10);
|
||||
private final List querySubObjects = new ArrayList(10);
|
||||
private final Set groupViews = new HashSet(10);
|
||||
private final Set queryViews = new HashSet(10);
|
||||
|
||||
/**
|
||||
* Execute the browse command, which allows you to browse the messages in a given JMS destination
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List tokens) throws Exception {
|
||||
try {
|
||||
// If no destination specified
|
||||
if (tokens.isEmpty()) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("No JMS destination specified."));
|
||||
return;
|
||||
}
|
||||
|
||||
// If no broker url specified
|
||||
if (getBrokerUrl() == null) {
|
||||
GlobalWriter.printException(new IllegalStateException("No broker url specified. Use the --amqurl option to specify a broker url."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Display the messages for each destination
|
||||
for (Iterator i=tokens.iterator(); i.hasNext();) {
|
||||
String destName = (String)i.next();
|
||||
Destination dest;
|
||||
|
||||
// If destination has been explicitly specified as a queue
|
||||
if (destName.startsWith(QUEUE_PREFIX)) {
|
||||
dest = new ActiveMQQueue(destName.substring(QUEUE_PREFIX.length()));
|
||||
|
||||
// If destination has been explicitly specified as a topic
|
||||
} else if (destName.startsWith(TOPIC_PREFIX)) {
|
||||
dest = new ActiveMQTopic(destName.substring(TOPIC_PREFIX.length()));
|
||||
|
||||
// By default destination is assumed to be a queue
|
||||
} else {
|
||||
dest = new ActiveMQQueue(destName);
|
||||
}
|
||||
|
||||
// Query for the messages to view
|
||||
List addMsgs = AmqMessagesUtil.getMessages(getBrokerUrl(), dest, queryAddObjects);
|
||||
|
||||
// Query for the messages to remove from view
|
||||
if (querySubObjects.size() > 0) {
|
||||
List subMsgs = AmqMessagesUtil.getMessages(getBrokerUrl(), dest, querySubObjects);
|
||||
addMsgs.removeAll(subMsgs);
|
||||
}
|
||||
|
||||
// Display the messages
|
||||
GlobalWriter.printMessage(AmqMessagesUtil.filterMessagesView(addMsgs, groupViews, queryViews));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute browse task. Reason: " + e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the --msgsel, --xmsgsel, --view, -V options.
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List tokens) throws Exception {
|
||||
|
||||
// If token is an additive message selector option
|
||||
if (token.startsWith("--msgsel")) {
|
||||
|
||||
// If no message selector is specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
}
|
||||
|
||||
// If token is a substractive message selector option
|
||||
else if (token.startsWith("--xmsgsel")) {
|
||||
|
||||
// If no message selector is specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If token is a view option
|
||||
else if (token.startsWith("--view")) {
|
||||
|
||||
// If no view specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Attributes to view not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the attributes to view
|
||||
StringTokenizer viewTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (viewTokens.hasMoreTokens()) {
|
||||
String viewToken = viewTokens.nextToken();
|
||||
|
||||
// If view is explicitly specified to belong to the JMS header
|
||||
if (viewToken.equals(VIEW_GROUP_HEADER)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + viewToken.substring(VIEW_GROUP_HEADER.length()));
|
||||
|
||||
// If view is explicitly specified to belong to the JMS custom header
|
||||
} else if (viewToken.equals(VIEW_GROUP_CUSTOM)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + viewToken.substring(VIEW_GROUP_CUSTOM.length()));
|
||||
|
||||
// If view is explicitly specified to belong to the JMS body
|
||||
} else if (viewToken.equals(VIEW_GROUP_BODY)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + viewToken.substring(VIEW_GROUP_BODY.length()));
|
||||
|
||||
// If no view explicitly specified, let's check the view for each group
|
||||
} else {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + viewToken);
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + viewToken);
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + viewToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If token is a predefined group view option
|
||||
else if (token.startsWith("-V")) {
|
||||
String viewGroup = token.substring(2);
|
||||
// If option is a header group view
|
||||
if (viewGroup.equals("header")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX);
|
||||
|
||||
// If option is a custom header group view
|
||||
} else if (viewGroup.equals("custom")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX);
|
||||
|
||||
// If option is a body group view
|
||||
} else if (viewGroup.equals("body")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX);
|
||||
|
||||
// Unknown group view
|
||||
} else {
|
||||
GlobalWriter.printInfo("Unknown group view: " + viewGroup + ". Ignoring group view option.");
|
||||
}
|
||||
}
|
||||
|
||||
// Let super class handle unknown option
|
||||
else {
|
||||
super.handleOption(token, tokens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
public static final String VIEW_GROUP_BODY = "body:";
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: Main browse --amqurl <broker url> [browse-options] <destinations>",
|
||||
|
@ -238,4 +69,173 @@ public class AmqBrowseCommand extends AbstractAmqCommand {
|
|||
" * To use wildcard queries, the field must be a string and the query enclosed in ''",
|
||||
"",
|
||||
};
|
||||
|
||||
private final List<String> queryAddObjects = new ArrayList<String>(10);
|
||||
private final List<String> querySubObjects = new ArrayList<String>(10);
|
||||
private final Set<String> groupViews = new HashSet<String>(10);
|
||||
private final Set queryViews = new HashSet(10);
|
||||
|
||||
/**
|
||||
* Execute the browse command, which allows you to browse the messages in a
|
||||
* given JMS destination
|
||||
*
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List tokens) throws Exception {
|
||||
try {
|
||||
// If no destination specified
|
||||
if (tokens.isEmpty()) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("No JMS destination specified."));
|
||||
return;
|
||||
}
|
||||
|
||||
// If no broker url specified
|
||||
if (getBrokerUrl() == null) {
|
||||
GlobalWriter.printException(new IllegalStateException("No broker url specified. Use the --amqurl option to specify a broker url."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Display the messages for each destination
|
||||
for (Iterator i = tokens.iterator(); i.hasNext();) {
|
||||
String destName = (String)i.next();
|
||||
Destination dest;
|
||||
|
||||
// If destination has been explicitly specified as a queue
|
||||
if (destName.startsWith(QUEUE_PREFIX)) {
|
||||
dest = new ActiveMQQueue(destName.substring(QUEUE_PREFIX.length()));
|
||||
|
||||
// If destination has been explicitly specified as a topic
|
||||
} else if (destName.startsWith(TOPIC_PREFIX)) {
|
||||
dest = new ActiveMQTopic(destName.substring(TOPIC_PREFIX.length()));
|
||||
|
||||
// By default destination is assumed to be a queue
|
||||
} else {
|
||||
dest = new ActiveMQQueue(destName);
|
||||
}
|
||||
|
||||
// Query for the messages to view
|
||||
List addMsgs = AmqMessagesUtil.getMessages(getBrokerUrl(), dest, queryAddObjects);
|
||||
|
||||
// Query for the messages to remove from view
|
||||
if (querySubObjects.size() > 0) {
|
||||
List subMsgs = AmqMessagesUtil.getMessages(getBrokerUrl(), dest, querySubObjects);
|
||||
addMsgs.removeAll(subMsgs);
|
||||
}
|
||||
|
||||
// Display the messages
|
||||
GlobalWriter.printMessage(AmqMessagesUtil.filterMessagesView(addMsgs, groupViews, queryViews));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute browse task. Reason: " + e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the --msgsel, --xmsgsel, --view, -V options.
|
||||
*
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List tokens) throws Exception {
|
||||
|
||||
// If token is an additive message selector option
|
||||
if (token.startsWith("--msgsel")) {
|
||||
|
||||
// If no message selector is specified, or next token is a new
|
||||
// option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
} else if (token.startsWith("--xmsgsel")) {
|
||||
// If token is a substractive message selector option
|
||||
|
||||
// If no message selector is specified, or next token is a new
|
||||
// option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
|
||||
} else if (token.startsWith("--view")) {
|
||||
// If token is a view option
|
||||
|
||||
// If no view specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Attributes to view not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the attributes to view
|
||||
StringTokenizer viewTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (viewTokens.hasMoreTokens()) {
|
||||
String viewToken = viewTokens.nextToken();
|
||||
|
||||
// If view is explicitly specified to belong to the JMS header
|
||||
if (viewToken.equals(VIEW_GROUP_HEADER)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + viewToken.substring(VIEW_GROUP_HEADER.length()));
|
||||
|
||||
// If view is explicitly specified to belong to the JMS
|
||||
// custom header
|
||||
} else if (viewToken.equals(VIEW_GROUP_CUSTOM)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + viewToken.substring(VIEW_GROUP_CUSTOM.length()));
|
||||
|
||||
// If view is explicitly specified to belong to the JMS body
|
||||
} else if (viewToken.equals(VIEW_GROUP_BODY)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + viewToken.substring(VIEW_GROUP_BODY.length()));
|
||||
|
||||
// If no view explicitly specified, let's check the view for
|
||||
// each group
|
||||
} else {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + viewToken);
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + viewToken);
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + viewToken);
|
||||
}
|
||||
}
|
||||
} else if (token.startsWith("-V")) {
|
||||
// If token is a predefined group view option
|
||||
String viewGroup = token.substring(2);
|
||||
// If option is a header group view
|
||||
if (viewGroup.equals("header")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX);
|
||||
|
||||
// If option is a custom header group view
|
||||
} else if (viewGroup.equals("custom")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX);
|
||||
|
||||
// If option is a body group view
|
||||
} else if (viewGroup.equals("body")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX);
|
||||
|
||||
// Unknown group view
|
||||
} else {
|
||||
GlobalWriter.printInfo("Unknown group view: " + viewGroup + ". Ignoring group view option.");
|
||||
}
|
||||
} else {
|
||||
// Let super class handle unknown option
|
||||
super.handleOption(token, tokens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,170 +16,30 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.management.ObjectInstance;
|
||||
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.util.AmqMessagesUtil;
|
||||
import org.apache.activemq.console.util.JmxMBeansUtil;
|
||||
|
||||
import javax.management.ObjectInstance;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class BrowseCommand extends AbstractJmxCommand {
|
||||
|
||||
public static final String QUEUE_PREFIX = "queue:";
|
||||
public static final String TOPIC_PREFIX = "topic:";
|
||||
|
||||
public static final String VIEW_GROUP_HEADER = "header:";
|
||||
public static final String VIEW_GROUP_CUSTOM = "custom:";
|
||||
public static final String VIEW_GROUP_BODY = "body:";
|
||||
|
||||
private final List queryAddObjects = new ArrayList(10);
|
||||
private final List querySubObjects = new ArrayList(10);
|
||||
private final Set groupViews = new HashSet(10);
|
||||
private final Set queryViews = new HashSet(10);
|
||||
|
||||
/**
|
||||
* Execute the browse command, which allows you to browse the messages in a given JMS destination
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List tokens) throws Exception {
|
||||
try {
|
||||
// If there is no queue name specified, let's select all
|
||||
if (tokens.isEmpty()) {
|
||||
tokens.add("*");
|
||||
}
|
||||
|
||||
// Iterate through the queue names
|
||||
for (Iterator i=tokens.iterator(); i.hasNext();) {
|
||||
List queueList = JmxMBeansUtil.queryMBeans(useJmxServiceUrl(), "Type=Queue,Destination=" + i.next() + ",*");
|
||||
|
||||
// Iterate through the queue result
|
||||
for (Iterator j=queueList.iterator(); j.hasNext();) {
|
||||
List messages = JmxMBeansUtil.createMessageQueryFilter(useJmxServiceUrl(), ((ObjectInstance)j.next()).getObjectName()).query(queryAddObjects);
|
||||
GlobalWriter.printMessage(JmxMBeansUtil.filterMessagesView(messages, groupViews, queryViews));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute browse task. Reason: " + e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the --msgsel, --xmsgsel, --view, -V options.
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List tokens) throws Exception {
|
||||
|
||||
// If token is an additive message selector option
|
||||
if (token.startsWith("--msgsel")) {
|
||||
|
||||
// If no message selector is specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
}
|
||||
|
||||
// If token is a substractive message selector option
|
||||
else if (token.startsWith("--xmsgsel")) {
|
||||
|
||||
// If no message selector is specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If token is a view option
|
||||
else if (token.startsWith("--view")) {
|
||||
|
||||
// If no view specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Attributes to view not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the attributes to view
|
||||
StringTokenizer viewTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (viewTokens.hasMoreTokens()) {
|
||||
String viewToken = viewTokens.nextToken();
|
||||
|
||||
// If view is explicitly specified to belong to the JMS header
|
||||
if (viewToken.equals(VIEW_GROUP_HEADER)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + viewToken.substring(VIEW_GROUP_HEADER.length()));
|
||||
|
||||
// If view is explicitly specified to belong to the JMS custom header
|
||||
} else if (viewToken.equals(VIEW_GROUP_CUSTOM)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + viewToken.substring(VIEW_GROUP_CUSTOM.length()));
|
||||
|
||||
// If view is explicitly specified to belong to the JMS body
|
||||
} else if (viewToken.equals(VIEW_GROUP_BODY)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + viewToken.substring(VIEW_GROUP_BODY.length()));
|
||||
|
||||
// If no view explicitly specified, let's check the view for each group
|
||||
} else {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + viewToken);
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + viewToken);
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + viewToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If token is a predefined group view option
|
||||
else if (token.startsWith("-V")) {
|
||||
String viewGroup = token.substring(2);
|
||||
// If option is a header group view
|
||||
if (viewGroup.equals("header")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX);
|
||||
|
||||
// If option is a custom header group view
|
||||
} else if (viewGroup.equals("custom")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX);
|
||||
|
||||
// If option is a body group view
|
||||
} else if (viewGroup.equals("body")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX);
|
||||
|
||||
// Unknown group view
|
||||
} else {
|
||||
GlobalWriter.printInfo("Unknown group view: " + viewGroup + ". Ignoring group view option.");
|
||||
}
|
||||
}
|
||||
|
||||
// Let super class handle unknown option
|
||||
else {
|
||||
super.handleOption(token, tokens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
public static final String VIEW_GROUP_BODY = "body:";
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: Main browse [browse-options] <destinations>",
|
||||
"Description: Display selected destination's messages.",
|
||||
"Task Usage: Main browse [browse-options] <destinations>", "Description: Display selected destination's messages.",
|
||||
"",
|
||||
"Browse Options:",
|
||||
" --msgsel <msgsel1,msglsel2> Add to the search list messages matched by the query similar to",
|
||||
|
@ -207,6 +66,147 @@ public class BrowseCommand extends AbstractJmxCommand {
|
|||
" - Print all the message fields that has a JMSMessageID in the header field that matches the",
|
||||
" wildcard *:10, and has a JMSPriority field > 5 in the queue FOO.BAR",
|
||||
" * To use wildcard queries, the field must be a string and the query enclosed in ''",
|
||||
"",
|
||||
""
|
||||
};
|
||||
|
||||
private final List<String> queryAddObjects = new ArrayList<String>(10);
|
||||
private final List<String> querySubObjects = new ArrayList<String>(10);
|
||||
private final Set<String> groupViews = new HashSet<String>(10);
|
||||
private final Set queryViews = new HashSet(10);
|
||||
|
||||
/**
|
||||
* Execute the browse command, which allows you to browse the messages in a
|
||||
* given JMS destination
|
||||
*
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List<String> tokens) throws Exception {
|
||||
try {
|
||||
// If there is no queue name specified, let's select all
|
||||
if (tokens.isEmpty()) {
|
||||
tokens.add("*");
|
||||
}
|
||||
|
||||
// Iterate through the queue names
|
||||
for (Iterator<String> i = tokens.iterator(); i.hasNext();) {
|
||||
List queueList = JmxMBeansUtil.queryMBeans(useJmxServiceUrl(), "Type=Queue,Destination=" + i.next() + ",*");
|
||||
|
||||
// Iterate through the queue result
|
||||
for (Iterator j = queueList.iterator(); j.hasNext();) {
|
||||
List messages = JmxMBeansUtil.createMessageQueryFilter(useJmxServiceUrl(), ((ObjectInstance)j.next()).getObjectName()).query(queryAddObjects);
|
||||
GlobalWriter.printMessage(JmxMBeansUtil.filterMessagesView(messages, groupViews, queryViews));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute browse task. Reason: " + e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the --msgsel, --xmsgsel, --view, -V options.
|
||||
*
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List<String> tokens) throws Exception {
|
||||
|
||||
// If token is an additive message selector option
|
||||
if (token.startsWith("--msgsel")) {
|
||||
|
||||
// If no message selector is specified, or next token is a new
|
||||
// option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
} else if (token.startsWith("--xmsgsel")) {
|
||||
// If token is a substractive message selector option
|
||||
|
||||
// If no message selector is specified, or next token is a new
|
||||
// option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
|
||||
} else if (token.startsWith("--view")) {
|
||||
// If token is a view option
|
||||
|
||||
// If no view specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Attributes to view not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the attributes to view
|
||||
StringTokenizer viewTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (viewTokens.hasMoreTokens()) {
|
||||
String viewToken = viewTokens.nextToken();
|
||||
|
||||
// If view is explicitly specified to belong to the JMS header
|
||||
if (viewToken.equals(VIEW_GROUP_HEADER)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + viewToken.substring(VIEW_GROUP_HEADER.length()));
|
||||
|
||||
// If view is explicitly specified to belong to the JMS
|
||||
// custom header
|
||||
} else if (viewToken.equals(VIEW_GROUP_CUSTOM)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + viewToken.substring(VIEW_GROUP_CUSTOM.length()));
|
||||
|
||||
// If view is explicitly specified to belong to the JMS body
|
||||
} else if (viewToken.equals(VIEW_GROUP_BODY)) {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + viewToken.substring(VIEW_GROUP_BODY.length()));
|
||||
|
||||
// If no view explicitly specified, let's check the view for
|
||||
// each group
|
||||
} else {
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + viewToken);
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + viewToken);
|
||||
queryViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + viewToken);
|
||||
}
|
||||
}
|
||||
} else if (token.startsWith("-V")) {
|
||||
// If token is a predefined group view option
|
||||
String viewGroup = token.substring(2);
|
||||
// If option is a header group view
|
||||
if (viewGroup.equals("header")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX);
|
||||
|
||||
// If option is a custom header group view
|
||||
} else if (viewGroup.equals("custom")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX);
|
||||
|
||||
// If option is a body group view
|
||||
} else if (viewGroup.equals("body")) {
|
||||
groupViews.add(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX);
|
||||
|
||||
// Unknown group view
|
||||
} else {
|
||||
GlobalWriter.printInfo("Unknown group view: " + viewGroup + ". Ignoring group view option.");
|
||||
}
|
||||
} else {
|
||||
// Let super class handle unknown option
|
||||
super.handleOption(token, tokens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,18 +16,34 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class BstatCommand extends QueryCommand {
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: activemq-admin bstat [bstat-options] [broker-name]",
|
||||
"Description: Performs a predefined query that displays useful statistics regarding the specified broker.",
|
||||
" If no broker name is specified, it will try and select from all registered brokers.",
|
||||
"",
|
||||
"Bstat Options:",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --version Display the version information.",
|
||||
" -h,-?,--help Display the query broker help information.",
|
||||
"",
|
||||
"Examples:",
|
||||
" activemq-admin bstat localhost",
|
||||
" - Display a summary of statistics for the broker 'localhost'"
|
||||
};
|
||||
|
||||
/**
|
||||
* Performs a predefiend query option
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List tokens) throws Exception {
|
||||
List queryTokens = new ArrayList();
|
||||
protected void runTask(List<String> tokens) throws Exception {
|
||||
List<String> queryTokens = new ArrayList<String>();
|
||||
// Find the first non-option token
|
||||
String brokerName = "*";
|
||||
for (Iterator i = tokens.iterator(); i.hasNext();) {
|
||||
|
@ -47,26 +62,12 @@ public class BstatCommand extends QueryCommand {
|
|||
queryTokens.add("Type=*,BrokerName=" + brokerName);
|
||||
queryTokens.add("-xQTopic=ActiveMQ.Advisory.*");
|
||||
queryTokens.add("--vuew");
|
||||
queryTokens.add("Type,BrokerName,Destination,ConnectorName,EnqueueCount," +
|
||||
"DequeueCount,TotalEnqueueCount,TotalDequeueCount,Messages," +
|
||||
"TotalMessages,ConsumerCount,TotalConsumerCount,DispatchQueueSize");
|
||||
queryTokens.add("Type,BrokerName,Destination,ConnectorName,EnqueueCount,"
|
||||
+ "DequeueCount,TotalEnqueueCount,TotalDequeueCount,Messages,"
|
||||
+ "TotalMessages,ConsumerCount,TotalConsumerCount,DispatchQueueSize");
|
||||
|
||||
// Call the query command
|
||||
super.runTask(queryTokens);
|
||||
}
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: activemq-admin bstat [bstat-options] [broker-name]",
|
||||
"Description: Performs a predefined query that displays useful statistics regarding the specified broker.",
|
||||
" If no broker name is specified, it will try and select from all registered brokers.",
|
||||
"",
|
||||
"Bstat Options:",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --version Display the version information.",
|
||||
" -h,-?,--help Display the query broker help information.",
|
||||
"",
|
||||
"Examples:",
|
||||
" activemq-admin bstat localhost",
|
||||
" - Display a summary of statistics for the broker 'localhost'"
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
@ -26,5 +25,5 @@ public interface Command {
|
|||
* @param tokens - arguments to the command
|
||||
* @throws Exception
|
||||
*/
|
||||
public void execute(List tokens) throws Exception;
|
||||
void execute(List<String> tokens) throws Exception;
|
||||
}
|
||||
|
|
|
@ -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,26 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.util.JmxMBeansUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class ListCommand extends AbstractJmxCommand {
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: Main list [list-options]",
|
||||
"Description: Lists all available broker in the specified JMX context.",
|
||||
"",
|
||||
"List Options:",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --version Display the version information.",
|
||||
" -h,-?,--help Display the stop broker help information.",
|
||||
""
|
||||
};
|
||||
|
||||
/**
|
||||
* List all running brokers registered in the specified JMX context
|
||||
* @param tokens - command arguments
|
||||
|
@ -33,7 +43,7 @@ public class ListCommand extends AbstractJmxCommand {
|
|||
*/
|
||||
protected void runTask(List tokens) throws Exception {
|
||||
try {
|
||||
Set propsView = new HashSet();
|
||||
Set<String> propsView = new HashSet<String>();
|
||||
propsView.add("BrokerName");
|
||||
GlobalWriter.printMBean(JmxMBeansUtil.filterMBeansView(JmxMBeansUtil.getAllBrokers(useJmxServiceUrl()), propsView));
|
||||
} catch (Exception e) {
|
||||
|
@ -49,14 +59,4 @@ public class ListCommand extends AbstractJmxCommand {
|
|||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: Main list [list-options]",
|
||||
"Description: Lists all available broker in the specified JMX context.",
|
||||
"",
|
||||
"List Options:",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --version Display the version information.",
|
||||
" -h,-?,--help Display the stop broker help information.",
|
||||
""
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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,141 +16,22 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
import javax.management.remote.JMXConnector;
|
||||
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.util.JmxMBeansUtil;
|
||||
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class PurgeCommand extends AbstractJmxCommand {
|
||||
|
||||
private final List queryAddObjects = new ArrayList(10);
|
||||
private final List querySubObjects = new ArrayList(10);
|
||||
|
||||
/**
|
||||
* Execute the purge command, which allows you to purge the messages in a given JMS destination
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List tokens) throws Exception {
|
||||
try {
|
||||
// If there is no queue name specified, let's select all
|
||||
if (tokens.isEmpty()) {
|
||||
tokens.add("*");
|
||||
}
|
||||
|
||||
// Iterate through the queue names
|
||||
for (Iterator i=tokens.iterator(); i.hasNext();) {
|
||||
List queueList = JmxMBeansUtil.queryMBeans(useJmxServiceUrl(), "Type=Queue,Destination=" + i.next() + ",*");
|
||||
|
||||
for (Iterator j=queueList.iterator(); j.hasNext();) {
|
||||
ObjectName queueName = ((ObjectInstance)j.next()).getObjectName();
|
||||
if (queryAddObjects.isEmpty()) {
|
||||
purgeQueue(queueName);
|
||||
} else {
|
||||
List messages = JmxMBeansUtil.createMessageQueryFilter(useJmxServiceUrl(), queueName).query(queryAddObjects);
|
||||
purgeMessages(queueName, messages);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute purge task. Reason: " + e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge all the messages in the queue
|
||||
* @param queue - ObjectName of the queue to purge
|
||||
* @throws Exception
|
||||
*/
|
||||
public void purgeQueue(ObjectName queue) throws Exception {
|
||||
JMXConnector conn = createJmxConnector();
|
||||
MBeanServerConnection server = conn.getMBeanServerConnection();
|
||||
GlobalWriter.printInfo("Purging all messages in queue: " + queue.getKeyProperty("Destination"));
|
||||
server.invoke(queue, "purge", new Object[] {}, new String[] {});
|
||||
conn.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge selected messages in the queue
|
||||
* @param queue - ObjectName of the queue to purge the messages from
|
||||
* @param messages - List of messages to purge
|
||||
* @throws Exception
|
||||
*/
|
||||
public void purgeMessages(ObjectName queue, List messages) throws Exception {
|
||||
JMXConnector conn = createJmxConnector();
|
||||
MBeanServerConnection server = conn.getMBeanServerConnection();
|
||||
|
||||
Object[] param = new Object[1];
|
||||
for (Iterator i=messages.iterator(); i.hasNext();) {
|
||||
CompositeData msg = (CompositeData)i.next();
|
||||
param[0] = "" + msg.get("JMSMessageID");
|
||||
GlobalWriter.printInfo("Removing message: " + param[0] + " from queue: " + queue.getKeyProperty("Destination"));
|
||||
server.invoke(queue, "removeMessage", param, new String[] {"java.lang.String"});
|
||||
}
|
||||
|
||||
conn.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the --msgsel, --xmsgsel.
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List tokens) throws Exception {
|
||||
// If token is an additive message selector option
|
||||
if (token.startsWith("--msgsel")) {
|
||||
|
||||
// If no message selector is specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
}
|
||||
|
||||
// If token is a substractive message selector option
|
||||
else if (token.startsWith("--xmsgsel")) {
|
||||
|
||||
// If no message selector is specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Let super class handle unknown option
|
||||
else {
|
||||
super.handleOption(token, tokens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: Main purge [browse-options] <destinations>",
|
||||
"Description: Delete selected destination's messages that matches the message selector.",
|
||||
|
@ -174,4 +54,130 @@ public class PurgeCommand extends AbstractJmxCommand {
|
|||
" * To use wildcard queries, the field must be a string and the query enclosed in ''",
|
||||
"",
|
||||
};
|
||||
|
||||
private final List<String> queryAddObjects = new ArrayList<String>(10);
|
||||
private final List<String> querySubObjects = new ArrayList<String>(10);
|
||||
|
||||
/**
|
||||
* Execute the purge command, which allows you to purge the messages in a
|
||||
* given JMS destination
|
||||
*
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List<String> tokens) throws Exception {
|
||||
try {
|
||||
// If there is no queue name specified, let's select all
|
||||
if (tokens.isEmpty()) {
|
||||
tokens.add("*");
|
||||
}
|
||||
|
||||
// Iterate through the queue names
|
||||
for (Iterator<String> i = tokens.iterator(); i.hasNext();) {
|
||||
List queueList = JmxMBeansUtil.queryMBeans(useJmxServiceUrl(), "Type=Queue,Destination=" + i.next() + ",*");
|
||||
|
||||
for (Iterator j = queueList.iterator(); j.hasNext();) {
|
||||
ObjectName queueName = ((ObjectInstance)j.next()).getObjectName();
|
||||
if (queryAddObjects.isEmpty()) {
|
||||
purgeQueue(queueName);
|
||||
} else {
|
||||
List messages = JmxMBeansUtil.createMessageQueryFilter(useJmxServiceUrl(), queueName).query(queryAddObjects);
|
||||
purgeMessages(queueName, messages);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute purge task. Reason: " + e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge all the messages in the queue
|
||||
*
|
||||
* @param queue - ObjectName of the queue to purge
|
||||
* @throws Exception
|
||||
*/
|
||||
public void purgeQueue(ObjectName queue) throws Exception {
|
||||
JMXConnector conn = createJmxConnector();
|
||||
MBeanServerConnection server = conn.getMBeanServerConnection();
|
||||
GlobalWriter.printInfo("Purging all messages in queue: " + queue.getKeyProperty("Destination"));
|
||||
server.invoke(queue, "purge", new Object[] {}, new String[] {});
|
||||
conn.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge selected messages in the queue
|
||||
*
|
||||
* @param queue - ObjectName of the queue to purge the messages from
|
||||
* @param messages - List of messages to purge
|
||||
* @throws Exception
|
||||
*/
|
||||
public void purgeMessages(ObjectName queue, List messages) throws Exception {
|
||||
JMXConnector conn = createJmxConnector();
|
||||
MBeanServerConnection server = conn.getMBeanServerConnection();
|
||||
|
||||
Object[] param = new Object[1];
|
||||
for (Iterator i = messages.iterator(); i.hasNext();) {
|
||||
CompositeData msg = (CompositeData)i.next();
|
||||
param[0] = "" + msg.get("JMSMessageID");
|
||||
GlobalWriter.printInfo("Removing message: " + param[0] + " from queue: " + queue.getKeyProperty("Destination"));
|
||||
server.invoke(queue, "removeMessage", param, new String[] {
|
||||
"java.lang.String"
|
||||
});
|
||||
}
|
||||
|
||||
conn.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the --msgsel, --xmsgsel.
|
||||
*
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List<String> tokens) throws Exception {
|
||||
// If token is an additive message selector option
|
||||
if (token.startsWith("--msgsel")) {
|
||||
|
||||
// If no message selector is specified, or next token is a new
|
||||
// option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
} else if (token.startsWith("--xmsgsel")) {
|
||||
// If token is a substractive message selector option
|
||||
|
||||
// If no message selector is specified, or next token is a new
|
||||
// option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Message selector not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
|
||||
} else {
|
||||
// Let super class handle unknown option
|
||||
super.handleOption(token, tokens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,171 +16,30 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import org.apache.activemq.console.util.JmxMBeansUtil;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.util.JmxMBeansUtil;
|
||||
|
||||
public class QueryCommand extends AbstractJmxCommand {
|
||||
// Predefined type=identifier query
|
||||
private static final Properties PREDEFINED_OBJNAME_QUERY = new Properties();
|
||||
|
||||
static {
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Broker", "Type=Broker,BrokerName=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Connection", "Type=Connection,Connection=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Connector", "Type=Connector,ConnectorName=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Broker", "Type=Broker,BrokerName=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Connection", "Type=Connection,Connection=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Connector", "Type=Connector,ConnectorName=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("NetworkConnector", "Type=NetworkConnector,BrokerName=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Queue", "Type=Queue,Destination=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Topic", "Type=Topic,Destination=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Queue", "Type=Queue,Destination=%1,*");
|
||||
PREDEFINED_OBJNAME_QUERY.setProperty("Topic", "Type=Topic,Destination=%1,*");
|
||||
};
|
||||
|
||||
private final List queryAddObjects = new ArrayList(10);
|
||||
private final List querySubObjects = new ArrayList(10);
|
||||
private final Set queryViews = new HashSet(10);
|
||||
|
||||
/**
|
||||
* Queries the mbeans registered in the specified JMX context
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List tokens) throws Exception {
|
||||
try {
|
||||
// Query for the mbeans to add
|
||||
List addMBeans = JmxMBeansUtil.queryMBeans(useJmxServiceUrl(), queryAddObjects, queryViews);
|
||||
|
||||
// Query for the mbeans to sub
|
||||
if (querySubObjects.size() > 0) {
|
||||
List subMBeans = JmxMBeansUtil.queryMBeans(useJmxServiceUrl(), querySubObjects, queryViews);
|
||||
addMBeans.removeAll(subMBeans);
|
||||
}
|
||||
|
||||
|
||||
GlobalWriter.printMBean(JmxMBeansUtil.filterMBeansView(addMBeans, queryViews));
|
||||
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute query task. Reason: " + e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the -Q, -xQ, --objname, --xobjname, --view options.
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List tokens) throws Exception {
|
||||
// If token is a additive predefined query define option
|
||||
if (token.startsWith("-Q")) {
|
||||
String key = token.substring(2);
|
||||
String value = "";
|
||||
int pos = key.indexOf("=");
|
||||
if (pos >= 0) {
|
||||
value = key.substring(pos + 1);
|
||||
key = key.substring(0, pos);
|
||||
}
|
||||
|
||||
// If additive query
|
||||
String predefQuery = PREDEFINED_OBJNAME_QUERY.getProperty(key);
|
||||
if (predefQuery == null) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Unknown query object type: " + key));
|
||||
return;
|
||||
}
|
||||
String queryStr = JmxMBeansUtil.createQueryString(predefQuery, value);
|
||||
StringTokenizer queryTokens = new StringTokenizer(queryStr, COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
}
|
||||
|
||||
// If token is a substractive predefined query define option
|
||||
else if (token.startsWith("-xQ")) {
|
||||
String key = token.substring(3);
|
||||
String value = "";
|
||||
int pos = key.indexOf("=");
|
||||
if (pos >= 0) {
|
||||
value = key.substring(pos + 1);
|
||||
key = key.substring(0, pos);
|
||||
}
|
||||
|
||||
// If subtractive query
|
||||
String predefQuery = PREDEFINED_OBJNAME_QUERY.getProperty(key);
|
||||
if (predefQuery == null) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Unknown query object type: " + key));
|
||||
return;
|
||||
}
|
||||
String queryStr = JmxMBeansUtil.createQueryString(predefQuery, value);
|
||||
StringTokenizer queryTokens = new StringTokenizer(queryStr, COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
}
|
||||
|
||||
// If token is an additive object name query option
|
||||
else if (token.startsWith("--objname")) {
|
||||
|
||||
// If no object name query is specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Object name query not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
}
|
||||
|
||||
// If token is a substractive object name query option
|
||||
else if (token.startsWith("--xobjname")) {
|
||||
|
||||
// If no object name query is specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Object name query not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
}
|
||||
|
||||
// If token is a view option
|
||||
else if (token.startsWith("--view")) {
|
||||
|
||||
// If no view specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Attributes to view not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the attributes to view
|
||||
Enumeration viewTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (viewTokens.hasMoreElements()) {
|
||||
queryViews.add(viewTokens.nextElement());
|
||||
}
|
||||
}
|
||||
|
||||
// Let super class handle unknown option
|
||||
else {
|
||||
super.handleOption(token, tokens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: Main query [query-options]",
|
||||
"Description: Display selected broker component's attributes and statistics.",
|
||||
|
@ -200,8 +58,7 @@ public class QueryCommand extends AbstractJmxCommand {
|
|||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --version Display the version information.",
|
||||
" -h,-?,--help Display the query broker help information.",
|
||||
"",
|
||||
"Examples:",
|
||||
"", "Examples:",
|
||||
" query",
|
||||
" - Print all the attributes of all registered objects queues, topics, connections, etc).",
|
||||
"",
|
||||
|
@ -233,4 +90,139 @@ public class QueryCommand extends AbstractJmxCommand {
|
|||
" - Print all attributes of all queues except those that are 4 letters long.",
|
||||
"",
|
||||
};
|
||||
|
||||
private final List<String> queryAddObjects = new ArrayList<String>(10);
|
||||
private final List<String> querySubObjects = new ArrayList<String>(10);
|
||||
private final Set queryViews = new HashSet(10);
|
||||
|
||||
/**
|
||||
* Queries the mbeans registered in the specified JMX context
|
||||
*
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List<String> tokens) throws Exception {
|
||||
try {
|
||||
// Query for the mbeans to add
|
||||
List addMBeans = JmxMBeansUtil.queryMBeans(useJmxServiceUrl(), queryAddObjects, queryViews);
|
||||
|
||||
// Query for the mbeans to sub
|
||||
if (querySubObjects.size() > 0) {
|
||||
List subMBeans = JmxMBeansUtil.queryMBeans(useJmxServiceUrl(), querySubObjects, queryViews);
|
||||
addMBeans.removeAll(subMBeans);
|
||||
}
|
||||
|
||||
GlobalWriter.printMBean(JmxMBeansUtil.filterMBeansView(addMBeans, queryViews));
|
||||
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute query task. Reason: " + e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the -Q, -xQ, --objname, --xobjname, --view options.
|
||||
*
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List<String> tokens) throws Exception {
|
||||
// If token is a additive predefined query define option
|
||||
if (token.startsWith("-Q")) {
|
||||
String key = token.substring(2);
|
||||
String value = "";
|
||||
int pos = key.indexOf("=");
|
||||
if (pos >= 0) {
|
||||
value = key.substring(pos + 1);
|
||||
key = key.substring(0, pos);
|
||||
}
|
||||
|
||||
// If additive query
|
||||
String predefQuery = PREDEFINED_OBJNAME_QUERY.getProperty(key);
|
||||
if (predefQuery == null) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Unknown query object type: " + key));
|
||||
return;
|
||||
}
|
||||
String queryStr = JmxMBeansUtil.createQueryString(predefQuery, value);
|
||||
StringTokenizer queryTokens = new StringTokenizer(queryStr, COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
} else if (token.startsWith("-xQ")) {
|
||||
// If token is a substractive predefined query define option
|
||||
String key = token.substring(3);
|
||||
String value = "";
|
||||
int pos = key.indexOf("=");
|
||||
if (pos >= 0) {
|
||||
value = key.substring(pos + 1);
|
||||
key = key.substring(0, pos);
|
||||
}
|
||||
|
||||
// If subtractive query
|
||||
String predefQuery = PREDEFINED_OBJNAME_QUERY.getProperty(key);
|
||||
if (predefQuery == null) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Unknown query object type: " + key));
|
||||
return;
|
||||
}
|
||||
String queryStr = JmxMBeansUtil.createQueryString(predefQuery, value);
|
||||
StringTokenizer queryTokens = new StringTokenizer(queryStr, COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
} else if (token.startsWith("--objname")) {
|
||||
// If token is an additive object name query option
|
||||
|
||||
// If no object name query is specified, or next token is a new
|
||||
// option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Object name query not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
queryAddObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
} else if (token.startsWith("--xobjname")) {
|
||||
// If token is a substractive object name query option
|
||||
|
||||
// If no object name query is specified, or next token is a new
|
||||
// option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Object name query not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer queryTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (queryTokens.hasMoreTokens()) {
|
||||
querySubObjects.add(queryTokens.nextToken());
|
||||
}
|
||||
} else if (token.startsWith("--view")) {
|
||||
// If token is a view option
|
||||
|
||||
// If no view specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
GlobalWriter.printException(new IllegalArgumentException("Attributes to view not specified"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the attributes to view
|
||||
Enumeration viewTokens = new StringTokenizer((String)tokens.remove(0), COMMAND_OPTION_DELIMETER);
|
||||
while (viewTokens.hasMoreElements()) {
|
||||
queryViews.add(viewTokens.nextElement());
|
||||
}
|
||||
} else {
|
||||
// Let super class handle unknown option
|
||||
super.handleOption(token, tokens);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,50 +16,50 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
|
||||
public class ShellCommand extends AbstractCommand {
|
||||
|
||||
private boolean interactive;
|
||||
private String[] helpFile;
|
||||
|
||||
|
||||
public ShellCommand() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public ShellCommand(boolean interactive) {
|
||||
this.interactive = interactive;
|
||||
this.helpFile = new String[]{
|
||||
(interactive ? "Usage: [task] [task-options] [task data]" : "Usage: Main [--extdir <dir>] [task] [task-options] [task data]"),
|
||||
"",
|
||||
"Tasks (default task is start):",
|
||||
" start - Creates and starts a broker using a configuration file, or a broker URI.",
|
||||
" stop - Stops a running broker specified by the broker name.",
|
||||
" list - Lists all available brokers in the specified JMX context.",
|
||||
" query - Display selected broker component's attributes and statistics.",
|
||||
" browse - Display selected messages in a specified destination.",
|
||||
"",
|
||||
"Task Options (Options specific to each task):",
|
||||
" --extdir <dir> - Add the jar files in the directory to the classpath.",
|
||||
" --version - Display the version information.",
|
||||
" -h,-?,--help - Display this help information. To display task specific help, use " + (interactive ? "" : "Main ") + "[task] -h,-?,--help",
|
||||
"",
|
||||
"Task Data:",
|
||||
" - Information needed by each specific task.",
|
||||
""
|
||||
this.helpFile = new String[] {
|
||||
interactive ? "Usage: [task] [task-options] [task data]" : "Usage: Main [--extdir <dir>] [task] [task-options] [task data]",
|
||||
"",
|
||||
"Tasks (default task is start):",
|
||||
" start - Creates and starts a broker using a configuration file, or a broker URI.",
|
||||
" stop - Stops a running broker specified by the broker name.",
|
||||
" list - Lists all available brokers in the specified JMX context.",
|
||||
" query - Display selected broker component's attributes and statistics.",
|
||||
" browse - Display selected messages in a specified destination.",
|
||||
"",
|
||||
"Task Options (Options specific to each task):",
|
||||
" --extdir <dir> - Add the jar files in the directory to the classpath.",
|
||||
" --version - Display the version information.",
|
||||
" -h,-?,--help - Display this help information. To display task specific help, use " + (interactive ? "" : "Main ") + "[task] -h,-?,--help",
|
||||
"",
|
||||
"Task Data:",
|
||||
" - Information needed by each specific task.",
|
||||
""
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Main method to run a command shell client.
|
||||
*
|
||||
* @param args - command line arguments
|
||||
* @param in - input stream to use
|
||||
* @param out - output stream to use
|
||||
|
@ -70,7 +69,7 @@ public class ShellCommand extends AbstractCommand {
|
|||
GlobalWriter.instantiate(new CommandShellOutputFormatter(out));
|
||||
|
||||
// Convert arguments to list for easier management
|
||||
List tokens = new ArrayList(Arrays.asList(args));
|
||||
List<String> tokens = new ArrayList<String>(Arrays.asList(args));
|
||||
|
||||
ShellCommand main = new ShellCommand();
|
||||
try {
|
||||
|
@ -82,7 +81,6 @@ public class ShellCommand extends AbstractCommand {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isInteractive() {
|
||||
return interactive;
|
||||
}
|
||||
|
@ -93,13 +91,14 @@ public class ShellCommand extends AbstractCommand {
|
|||
|
||||
/**
|
||||
* Parses for specific command task.
|
||||
*
|
||||
* @param tokens - command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void runTask(List tokens) throws Exception {
|
||||
protected void runTask(List<String> tokens) throws Exception {
|
||||
|
||||
// Process task token
|
||||
if( tokens.size() > 0 ) {
|
||||
if (tokens.size() > 0) {
|
||||
String taskToken = (String)tokens.remove(0);
|
||||
if (taskToken.equals("start")) {
|
||||
new StartCommand().execute(tokens);
|
||||
|
|
|
@ -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,23 +16,43 @@
|
|||
*/
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import org.apache.activemq.console.util.JmxMBeansUtil;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.util.JmxMBeansUtil;
|
||||
|
||||
public class ShutdownCommand extends AbstractJmxCommand {
|
||||
private boolean isStopAllBrokers = false;
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: Main stop [stop-options] [broker-name1] [broker-name2] ...",
|
||||
"Description: Stops a running broker.",
|
||||
"",
|
||||
"Stop Options:",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --all Stop all brokers.",
|
||||
" --version Display the version information.",
|
||||
" -h,-?,--help Display the stop broker help information.",
|
||||
"",
|
||||
"Broker Names:",
|
||||
" Name of the brokers that will be stopped.",
|
||||
" If omitted, it is assumed that there is only one broker running, and it will be stopped.",
|
||||
" Use -all to stop all running brokers.",
|
||||
""
|
||||
};
|
||||
|
||||
private boolean isStopAllBrokers;
|
||||
|
||||
/**
|
||||
* Shuts down the specified broker or brokers
|
||||
*
|
||||
* @param brokerNames - names of brokers to shutdown
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -45,10 +64,8 @@ public class ShutdownCommand extends AbstractJmxCommand {
|
|||
if (isStopAllBrokers) {
|
||||
mbeans = JmxMBeansUtil.getAllBrokers(useJmxServiceUrl());
|
||||
brokerNames.clear();
|
||||
}
|
||||
|
||||
// Stop the default broker
|
||||
else if (brokerNames.isEmpty()) {
|
||||
} else if (brokerNames.isEmpty()) {
|
||||
// Stop the default broker
|
||||
mbeans = JmxMBeansUtil.getAllBrokers(useJmxServiceUrl());
|
||||
|
||||
// If there is no broker to stop
|
||||
|
@ -56,21 +73,19 @@ public class ShutdownCommand extends AbstractJmxCommand {
|
|||
GlobalWriter.printInfo("There are no brokers to stop.");
|
||||
return;
|
||||
|
||||
// There should only be one broker to stop
|
||||
// There should only be one broker to stop
|
||||
} else if (mbeans.size() > 1) {
|
||||
GlobalWriter.printInfo("There are multiple brokers to stop. Please select the broker(s) to stop or use --all to stop all brokers.");
|
||||
return;
|
||||
|
||||
// Get the first broker only
|
||||
// Get the first broker only
|
||||
} else {
|
||||
Object firstBroker = mbeans.iterator().next();
|
||||
mbeans.clear();
|
||||
mbeans.add(firstBroker);
|
||||
}
|
||||
}
|
||||
|
||||
// Stop each specified broker
|
||||
else {
|
||||
} else {
|
||||
// Stop each specified broker
|
||||
String brokerName;
|
||||
mbeans = new HashSet();
|
||||
while (!brokerNames.isEmpty()) {
|
||||
|
@ -94,6 +109,7 @@ public class ShutdownCommand extends AbstractJmxCommand {
|
|||
|
||||
/**
|
||||
* Stops the list of brokers.
|
||||
*
|
||||
* @param jmxServiceUrl - JMX service url to connect to
|
||||
* @param brokerBeans - broker mbeans to stop
|
||||
* @throws Exception
|
||||
|
@ -102,18 +118,23 @@ public class ShutdownCommand extends AbstractJmxCommand {
|
|||
MBeanServerConnection server = createJmxConnector().getMBeanServerConnection();
|
||||
|
||||
ObjectName brokerObjName;
|
||||
for (Iterator i=brokerBeans.iterator(); i.hasNext();) {
|
||||
for (Iterator i = brokerBeans.iterator(); i.hasNext();) {
|
||||
brokerObjName = ((ObjectInstance)i.next()).getObjectName();
|
||||
|
||||
String brokerName = brokerObjName.getKeyProperty("BrokerName");
|
||||
GlobalWriter.print("Stopping broker: " + brokerName);
|
||||
|
||||
try {
|
||||
server.invoke(brokerObjName, "terminateJVM", new Object[] {Integer.valueOf(0)}, new String[] {"int"});
|
||||
server.invoke(brokerObjName, "terminateJVM", new Object[] {
|
||||
Integer.valueOf(0)
|
||||
}, new String[] {
|
||||
"int"
|
||||
});
|
||||
GlobalWriter.print("Succesfully stopped broker: " + brokerName);
|
||||
} catch (Exception e) {
|
||||
// TODO: Check exceptions throwned
|
||||
//System.out.println("Failed to stop broker: [ " + brokerName + " ]. Reason: " + e.getMessage());
|
||||
// System.out.println("Failed to stop broker: [ " + brokerName +
|
||||
// " ]. Reason: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,11 +143,12 @@ public class ShutdownCommand extends AbstractJmxCommand {
|
|||
|
||||
/**
|
||||
* Handle the --all option.
|
||||
*
|
||||
* @param token - option token to handle
|
||||
* @param tokens - succeeding command arguments
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void handleOption(String token, List tokens) throws Exception {
|
||||
protected void handleOption(String token, List<String> tokens) throws Exception {
|
||||
// Try to handle the options first
|
||||
if (token.equals("--all")) {
|
||||
isStopAllBrokers = true;
|
||||
|
@ -143,20 +165,4 @@ public class ShutdownCommand extends AbstractJmxCommand {
|
|||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: Main stop [stop-options] [broker-name1] [broker-name2] ...",
|
||||
"Description: Stops a running broker.",
|
||||
"",
|
||||
"Stop Options:",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --all Stop all brokers.",
|
||||
" --version Display the version information.",
|
||||
" -h,-?,--help Display the stop broker help information.",
|
||||
"",
|
||||
"Broker Names:",
|
||||
" Name of the brokers that will be stopped.",
|
||||
" If omitted, it is assumed that there is only one broker running, and it will be stopped.",
|
||||
" Use -all to stop all running brokers.",
|
||||
""
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
@ -18,127 +17,19 @@
|
|||
|
||||
package org.apache.activemq.console.command;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.activemq.broker.BrokerFactory;
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
public class StartCommand extends AbstractCommand {
|
||||
|
||||
public static final String DEFAULT_CONFIG_URI = "xbean:activemq.xml";
|
||||
|
||||
private URI configURI;
|
||||
private List brokers = new ArrayList(5);
|
||||
|
||||
/**
|
||||
* The default task to start a broker or a group of brokers
|
||||
* @param brokerURIs
|
||||
*/
|
||||
protected void runTask(List brokerURIs) throws Exception {
|
||||
try {
|
||||
// If no config uri, use default setting
|
||||
if (brokerURIs.isEmpty()) {
|
||||
setConfigUri(new URI(DEFAULT_CONFIG_URI));
|
||||
startBroker(getConfigUri());
|
||||
|
||||
// Set configuration data, if available, which in this case would be the config URI
|
||||
} else {
|
||||
String strConfigURI;
|
||||
|
||||
while (!brokerURIs.isEmpty()) {
|
||||
strConfigURI = (String)brokerURIs.remove(0);
|
||||
|
||||
try {
|
||||
setConfigUri(new URI(strConfigURI));
|
||||
} catch (URISyntaxException e) {
|
||||
GlobalWriter.printException(e);
|
||||
return;
|
||||
}
|
||||
|
||||
startBroker(getConfigUri());
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent the main thread from exiting unless it is terminated elsewhere
|
||||
waitForShutdown();
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute start task. Reason: " + e, e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and run a broker specified by the given configuration URI
|
||||
* @param configURI
|
||||
* @throws Exception
|
||||
*/
|
||||
public void startBroker(URI configURI) throws Exception {
|
||||
System.out.println("Loading message broker from: " + configURI);
|
||||
BrokerService broker = BrokerFactory.createBroker(configURI);
|
||||
brokers.add(broker);
|
||||
|
||||
broker.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for a shutdown invocation elsewhere
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void waitForShutdown() throws Exception {
|
||||
final boolean[] shutdown = new boolean[] {false};
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
synchronized(shutdown) {
|
||||
shutdown[0]=true;
|
||||
shutdown.notify();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Wait for any shutdown event
|
||||
synchronized(shutdown) {
|
||||
while( !shutdown[0] ) {
|
||||
try {
|
||||
shutdown.wait();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stop each broker
|
||||
for (Iterator i=brokers.iterator(); i.hasNext();) {
|
||||
BrokerService broker = (BrokerService)i.next();
|
||||
broker.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current configuration URI used by the start task
|
||||
* @param uri
|
||||
*/
|
||||
public void setConfigUri(URI uri) {
|
||||
configURI = uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current configuration URI used by the start task
|
||||
* @return current configuration URI
|
||||
*/
|
||||
public URI getConfigUri() {
|
||||
return configURI;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
public static final String DEFAULT_CONFIG_URI = "xbean:activemq.xml";
|
||||
|
||||
protected String[] helpFile = new String[] {
|
||||
"Task Usage: Main start [start-options] [uri]",
|
||||
|
@ -166,4 +57,121 @@ public class StartCommand extends AbstractCommand {
|
|||
" Configures the broker with 1 transport connector, and 1 network connector and persistence disabled",
|
||||
""
|
||||
};
|
||||
|
||||
private URI configURI;
|
||||
private List<BrokerService> brokers = new ArrayList<BrokerService>(5);
|
||||
|
||||
/**
|
||||
* The default task to start a broker or a group of brokers
|
||||
*
|
||||
* @param brokerURIs
|
||||
*/
|
||||
protected void runTask(List<String> brokerURIs) throws Exception {
|
||||
try {
|
||||
// If no config uri, use default setting
|
||||
if (brokerURIs.isEmpty()) {
|
||||
setConfigUri(new URI(DEFAULT_CONFIG_URI));
|
||||
startBroker(getConfigUri());
|
||||
|
||||
// Set configuration data, if available, which in this case
|
||||
// would be the config URI
|
||||
} else {
|
||||
String strConfigURI;
|
||||
|
||||
while (!brokerURIs.isEmpty()) {
|
||||
strConfigURI = (String)brokerURIs.remove(0);
|
||||
|
||||
try {
|
||||
setConfigUri(new URI(strConfigURI));
|
||||
} catch (URISyntaxException e) {
|
||||
GlobalWriter.printException(e);
|
||||
return;
|
||||
}
|
||||
|
||||
startBroker(getConfigUri());
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent the main thread from exiting unless it is terminated
|
||||
// elsewhere
|
||||
waitForShutdown();
|
||||
} catch (Exception e) {
|
||||
GlobalWriter.printException(new RuntimeException("Failed to execute start task. Reason: " + e, e));
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and run a broker specified by the given configuration URI
|
||||
*
|
||||
* @param configURI
|
||||
* @throws Exception
|
||||
*/
|
||||
public void startBroker(URI configURI) throws Exception {
|
||||
System.out.println("Loading message broker from: " + configURI);
|
||||
BrokerService broker = BrokerFactory.createBroker(configURI);
|
||||
brokers.add(broker);
|
||||
broker.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for a shutdown invocation elsewhere
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void waitForShutdown() throws Exception {
|
||||
final boolean[] shutdown = new boolean[] {
|
||||
false
|
||||
};
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
synchronized (shutdown) {
|
||||
shutdown[0] = true;
|
||||
shutdown.notify();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Wait for any shutdown event
|
||||
synchronized (shutdown) {
|
||||
while (!shutdown[0]) {
|
||||
try {
|
||||
shutdown.wait();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stop each broker
|
||||
for (Iterator<BrokerService> i = brokers.iterator(); i.hasNext();) {
|
||||
BrokerService broker = i.next();
|
||||
broker.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current configuration URI used by the start task
|
||||
*
|
||||
* @param uri
|
||||
*/
|
||||
public void setConfigUri(URI uri) {
|
||||
configURI = uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current configuration URI used by the start task
|
||||
*
|
||||
* @return current configuration URI
|
||||
*/
|
||||
public URI getConfigUri() {
|
||||
return configURI;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the help messages for the browse command
|
||||
*/
|
||||
protected void printHelp() {
|
||||
GlobalWriter.printHelp(helpFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,9 +16,9 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Collections;
|
||||
|
||||
public abstract class AbstractQueryFilter implements QueryFilter {
|
||||
protected QueryFilter next;
|
||||
|
|
|
@ -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,19 +16,20 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import org.apache.activemq.command.ActiveMQTopic;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Session;
|
||||
import javax.jms.QueueBrowser;
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.QueueBrowser;
|
||||
import javax.jms.Session;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.apache.activemq.command.ActiveMQTopic;
|
||||
|
||||
public class AmqMessagesQueryFilter extends AbstractQueryFilter {
|
||||
|
||||
|
@ -38,17 +38,19 @@ public class AmqMessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Create a JMS message query filter
|
||||
*
|
||||
* @param brokerUrl - broker url to connect to
|
||||
* @param destination - JMS destination to query
|
||||
*/
|
||||
public AmqMessagesQueryFilter(URI brokerUrl, Destination destination) {
|
||||
super(null);
|
||||
this.brokerUrl = brokerUrl;
|
||||
this.brokerUrl = brokerUrl;
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the specified destination using the message selector format query
|
||||
*
|
||||
* @param queries - message selector queries
|
||||
* @return list messages that matches the selector
|
||||
* @throws Exception
|
||||
|
@ -57,12 +59,12 @@ public class AmqMessagesQueryFilter extends AbstractQueryFilter {
|
|||
String selector = "";
|
||||
|
||||
// Convert to message selector
|
||||
for (Iterator i=queries.iterator(); i.hasNext();) {
|
||||
for (Iterator i = queries.iterator(); i.hasNext();) {
|
||||
selector = selector + "(" + i.next().toString() + ") AND ";
|
||||
}
|
||||
|
||||
// Remove last AND
|
||||
if (selector != "") {
|
||||
if (!selector.equals("")) {
|
||||
selector = selector.substring(0, selector.length() - 5);
|
||||
}
|
||||
|
||||
|
@ -75,6 +77,7 @@ public class AmqMessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Query the messages of a queue destination using a queue browser
|
||||
*
|
||||
* @param queue - queue destination
|
||||
* @param selector - message selector
|
||||
* @return list of messages that matches the selector
|
||||
|
@ -95,19 +98,23 @@ public class AmqMessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Query the messages of a topic destination using a message consumer
|
||||
*
|
||||
* @param topic - topic destination
|
||||
* @param selector - message selector
|
||||
* @return list of messages that matches the selector
|
||||
* @throws Exception
|
||||
*/
|
||||
protected List queryMessages(ActiveMQTopic topic, String selector) throws Exception {
|
||||
// TODO: should we use a durable subscriber or a retroactive non-durable subscriber?
|
||||
// TODO: if a durable subscriber is used, how do we manage it? subscribe/unsubscribe tasks?
|
||||
// TODO: should we use a durable subscriber or a retroactive non-durable
|
||||
// subscriber?
|
||||
// TODO: if a durable subscriber is used, how do we manage it?
|
||||
// subscribe/unsubscribe tasks?
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and start a JMS connection
|
||||
*
|
||||
* @param brokerUrl - broker url to connect to.
|
||||
* @return JMS connection
|
||||
* @throws JMSException
|
||||
|
@ -120,6 +127,7 @@ public class AmqMessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Get the broker url being used.
|
||||
*
|
||||
* @return broker url
|
||||
*/
|
||||
public URI getBrokerUrl() {
|
||||
|
@ -128,6 +136,7 @@ public class AmqMessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Set the broker url to use.
|
||||
*
|
||||
* @param brokerUrl - broker url
|
||||
*/
|
||||
public void setBrokerUrl(URI brokerUrl) {
|
||||
|
@ -136,6 +145,7 @@ public class AmqMessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Get the destination being used.
|
||||
*
|
||||
* @return - JMS destination
|
||||
*/
|
||||
public Destination getDestination() {
|
||||
|
@ -144,6 +154,7 @@ public class AmqMessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Set the destination to use.
|
||||
*
|
||||
* @param destination - JMS destination
|
||||
*/
|
||||
public void setDestination(Destination destination) {
|
||||
|
|
|
@ -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,17 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class GroupPropertiesViewFilter extends PropertiesViewFilter {
|
||||
|
||||
/**
|
||||
* Creates a group properties filter that is able to filter the display result based on a group prefix
|
||||
* Creates a group properties filter that is able to filter the display
|
||||
* result based on a group prefix
|
||||
*
|
||||
* @param next - the next query filter
|
||||
*/
|
||||
public GroupPropertiesViewFilter(QueryFilter next) {
|
||||
|
@ -33,7 +34,9 @@ public class GroupPropertiesViewFilter extends PropertiesViewFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a group properties filter that is able to filter the display result based on a group prefix
|
||||
* Creates a group properties filter that is able to filter the display
|
||||
* result based on a group prefix
|
||||
*
|
||||
* @param groupView - the group filter to use
|
||||
* @param next - the next query filter
|
||||
*/
|
||||
|
@ -43,6 +46,7 @@ public class GroupPropertiesViewFilter extends PropertiesViewFilter {
|
|||
|
||||
/**
|
||||
* Filter the properties that matches the group prefix only.
|
||||
*
|
||||
* @param data - map data to filter
|
||||
* @return - filtered map data
|
||||
*/
|
||||
|
@ -55,18 +59,18 @@ public class GroupPropertiesViewFilter extends PropertiesViewFilter {
|
|||
Map newData;
|
||||
try {
|
||||
// Lets try to use the same class as the original
|
||||
newData = (Map)data.getClass().newInstance();
|
||||
newData = data.getClass().newInstance();
|
||||
} catch (Exception e) {
|
||||
// Lets use a default HashMap
|
||||
newData = new HashMap();
|
||||
}
|
||||
|
||||
// Filter the keys to view
|
||||
for (Iterator i=data.keySet().iterator(); i.hasNext();) {
|
||||
String key = (String)i.next();
|
||||
for (Iterator<String> i = data.keySet().iterator(); i.hasNext();) {
|
||||
String key = i.next();
|
||||
|
||||
// Checks if key matches any of the group filter
|
||||
for (Iterator j=viewFilter.iterator(); j.hasNext();) {
|
||||
for (Iterator j = viewFilter.iterator(); j.hasNext();) {
|
||||
String group = (String)j.next();
|
||||
if (key.startsWith(group)) {
|
||||
newData.put(key, data.get(key));
|
||||
|
|
|
@ -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,33 +16,36 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ReflectionException;
|
||||
import javax.management.InstanceNotFoundException;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.Attribute;
|
||||
import javax.management.MBeanAttributeInfo;
|
||||
import javax.management.IntrospectionException;
|
||||
import java.util.Set;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.InstanceNotFoundException;
|
||||
import javax.management.IntrospectionException;
|
||||
import javax.management.MBeanAttributeInfo;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.ReflectionException;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
public class MBeansAttributeQueryFilter extends AbstractQueryFilter {
|
||||
public static final String KEY_OBJECT_NAME_ATTRIBUTE = "Attribute:ObjectName:";
|
||||
|
||||
private JMXServiceURL jmxServiceUrl;
|
||||
private Set attribView;
|
||||
private Set attribView;
|
||||
|
||||
/**
|
||||
* Create an mbean attributes query filter that is able to select specific mbean attributes based on the object name to get.
|
||||
* Create an mbean attributes query filter that is able to select specific
|
||||
* mbean attributes based on the object name to get.
|
||||
*
|
||||
* @param jmxServiceUrl - JMX service url to connect to.
|
||||
* @param attribView - the attributes to extract
|
||||
* @param next - the next query filter
|
||||
|
@ -51,13 +53,16 @@ public class MBeansAttributeQueryFilter extends AbstractQueryFilter {
|
|||
public MBeansAttributeQueryFilter(JMXServiceURL jmxServiceUrl, Set attribView, MBeansObjectNameQueryFilter next) {
|
||||
super(next);
|
||||
this.jmxServiceUrl = jmxServiceUrl;
|
||||
this.attribView = attribView;
|
||||
this.attribView = attribView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by retrieving the attributes specified, this will modify the collection to a list of AttributeList
|
||||
* Filter the query by retrieving the attributes specified, this will modify
|
||||
* the collection to a list of AttributeList
|
||||
*
|
||||
* @param queries - query list
|
||||
* @return List of AttributeList, which includes the ObjectName, which has a key of MBeansAttributeQueryFilter.KEY_OBJECT_NAME_ATTRIBUTE
|
||||
* @return List of AttributeList, which includes the ObjectName, which has a
|
||||
* key of MBeansAttributeQueryFilter.KEY_OBJECT_NAME_ATTRIBUTE
|
||||
* @throws Exception
|
||||
*/
|
||||
public List query(List queries) throws Exception {
|
||||
|
@ -66,6 +71,7 @@ public class MBeansAttributeQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Retrieve the specified attributes of the mbean
|
||||
*
|
||||
* @param result - collection of ObjectInstances and/or ObjectNames
|
||||
* @return List of AttributeList
|
||||
* @throws IOException
|
||||
|
@ -76,7 +82,7 @@ public class MBeansAttributeQueryFilter extends AbstractQueryFilter {
|
|||
protected List getMBeanAttributesCollection(Collection result) throws IOException, ReflectionException, InstanceNotFoundException, NoSuchMethodException, IntrospectionException {
|
||||
List mbeansCollection = new ArrayList();
|
||||
|
||||
for (Iterator i=result.iterator(); i.hasNext();) {
|
||||
for (Iterator i = result.iterator(); i.hasNext();) {
|
||||
Object mbean = i.next();
|
||||
if (mbean instanceof ObjectInstance) {
|
||||
mbeansCollection.add(getMBeanAttributes(((ObjectInstance)mbean).getObjectName(), attribView));
|
||||
|
@ -92,6 +98,7 @@ public class MBeansAttributeQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Retrieve the specified attributes of the mbean
|
||||
*
|
||||
* @param obj - mbean ObjectInstance
|
||||
* @param attrView - list of attributes to retrieve
|
||||
* @return AttributeList for the mbean
|
||||
|
@ -105,6 +112,7 @@ public class MBeansAttributeQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Retrieve the specified attributes of the mbean
|
||||
*
|
||||
* @param objName - mbean ObjectName
|
||||
* @param attrView - list of attributes to retrieve
|
||||
* @return AttributeList for the mbean
|
||||
|
@ -113,7 +121,7 @@ public class MBeansAttributeQueryFilter extends AbstractQueryFilter {
|
|||
* @throws InstanceNotFoundException
|
||||
*/
|
||||
protected AttributeList getMBeanAttributes(ObjectName objName, Set attrView) throws IOException, ReflectionException, InstanceNotFoundException, IntrospectionException {
|
||||
JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxServiceUrl);
|
||||
JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxServiceUrl);
|
||||
MBeanServerConnection server = jmxConnector.getMBeanServerConnection();
|
||||
|
||||
// If no attribute view specified, get all attributes
|
||||
|
@ -122,18 +130,18 @@ public class MBeansAttributeQueryFilter extends AbstractQueryFilter {
|
|||
MBeanAttributeInfo[] infos = server.getMBeanInfo(objName).getAttributes();
|
||||
attribs = new String[infos.length];
|
||||
|
||||
for (int i=0; i<infos.length; i++) {
|
||||
for (int i = 0; i < infos.length; i++) {
|
||||
if (infos[i].isReadable()) {
|
||||
attribs[i] = infos[i].getName();
|
||||
}
|
||||
}
|
||||
|
||||
// Get selected attributes
|
||||
// Get selected attributes
|
||||
} else {
|
||||
|
||||
attribs = new String[attrView.size()];
|
||||
int count = 0;
|
||||
for (Iterator i=attrView.iterator(); i.hasNext();) {
|
||||
for (Iterator i = attrView.iterator(); i.hasNext();) {
|
||||
attribs[count++] = (String)i.next();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,28 +16,31 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.MalformedObjectNameException;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.QueryExp;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.net.MalformedURLException;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.MalformedObjectNameException;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.QueryExp;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
||||
|
||||
public static final String DEFAULT_JMX_DOMAIN = "org.apache.activemq";
|
||||
public static final String QUERY_EXP_PREFIX = "MBeans.QueryExp.";
|
||||
public static final String QUERY_EXP_PREFIX = "MBeans.QueryExp.";
|
||||
|
||||
private JMXServiceURL jmxServiceUrl;
|
||||
|
||||
/**
|
||||
* Creates an mbeans object name query filter that will query on the given JMX Service URL
|
||||
* Creates an mbeans object name query filter that will query on the given
|
||||
* JMX Service URL
|
||||
*
|
||||
* @param jmxUrl - JMX service URL to connect to
|
||||
* @throws MalformedURLException
|
||||
*/
|
||||
|
@ -47,7 +49,9 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates an mbeans objecet name query filter that will query on the given JMX Service URL
|
||||
* Creates an mbeans objecet name query filter that will query on the given
|
||||
* JMX Service URL
|
||||
*
|
||||
* @param jmxUrl - JMX service URL to connect to
|
||||
*/
|
||||
public MBeansObjectNameQueryFilter(JMXServiceURL jmxUrl) {
|
||||
|
@ -56,10 +60,13 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Queries the JMX service using a mapping of keys and values to construct the object name
|
||||
* Queries the JMX service using a mapping of keys and values to construct
|
||||
* the object name
|
||||
*
|
||||
* @param queries - mapping of keys and values
|
||||
* @return collection of ObjectInstance that matches the query
|
||||
* @throws MalformedObjectNameException - if the given string is an invalid object name
|
||||
* @throws MalformedObjectNameException - if the given string is an invalid
|
||||
* object name
|
||||
* @throws IOException - if there is a problem querying the JMX context
|
||||
*/
|
||||
public List query(List queries) throws MalformedObjectNameException, IOException {
|
||||
|
@ -72,7 +79,7 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
// Constructs object name query
|
||||
String objNameQuery = "";
|
||||
String queryExp = "";
|
||||
for (Iterator i=queries.iterator(); i.hasNext();) {
|
||||
for (Iterator i = queries.iterator(); i.hasNext();) {
|
||||
String key = (String)i.next();
|
||||
String val = "";
|
||||
int pos = key.indexOf("=");
|
||||
|
@ -83,7 +90,7 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
if (val.startsWith(QUERY_EXP_PREFIX)) {
|
||||
// do nothing as of the moment
|
||||
} else if (key != "" && val != "") {
|
||||
} else if (!key.equals("") && !val.equals("")) {
|
||||
objNameQuery = objNameQuery + key + "=" + val + ",";
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +102,9 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Advance query that enables you to specify both the object name and the query expression to use.
|
||||
* Note: Query expression is currently unsupported.
|
||||
* Advance query that enables you to specify both the object name and the
|
||||
* query expression to use. Note: Query expression is currently unsupported.
|
||||
*
|
||||
* @param objName - object name to use for query
|
||||
* @param queryExpStr - query expression string
|
||||
* @return set of mbeans that matches the query
|
||||
|
@ -108,7 +116,8 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
QueryExp queryExp = createQueryExp(queryExpStr);
|
||||
|
||||
// Convert mbeans set to list to make it standard throughout the query filter
|
||||
// Convert mbeans set to list to make it standard throughout the query
|
||||
// filter
|
||||
List mbeans = new ArrayList(server.queryMBeans(objName, queryExp));
|
||||
|
||||
jmxConn.close();
|
||||
|
@ -118,6 +127,7 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Get the JMX service URL the query is connecting to.
|
||||
*
|
||||
* @return JMX service URL
|
||||
*/
|
||||
public JMXServiceURL getJmxServiceUrl() {
|
||||
|
@ -126,6 +136,7 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Sets the JMX service URL the query is going to connect to.
|
||||
*
|
||||
* @param jmxServiceUrl - new JMX service URL
|
||||
*/
|
||||
public void setJmxServiceUrl(JMXServiceURL jmxServiceUrl) {
|
||||
|
@ -134,6 +145,7 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Sets the JMX service URL the query is going to connect to.
|
||||
*
|
||||
* @param jmxServiceUrl - new JMX service URL
|
||||
*/
|
||||
public void setJmxServiceUrl(String jmxServiceUrl) throws MalformedURLException {
|
||||
|
@ -142,6 +154,7 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Creates a JMX connector
|
||||
*
|
||||
* @return JMX connector
|
||||
* @throws IOException
|
||||
*/
|
||||
|
@ -150,8 +163,9 @@ public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a query expression based on the query expression string
|
||||
* Note: currently unsupported
|
||||
* Creates a query expression based on the query expression string Note:
|
||||
* currently unsupported
|
||||
*
|
||||
* @param queryExpStr - query expression string
|
||||
* @return the created query expression
|
||||
*/
|
||||
|
|
|
@ -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,18 +16,21 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.Attribute;
|
||||
import java.util.Map;
|
||||
import java.util.Iterator;
|
||||
import java.util.regex.Pattern;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class MBeansRegExQueryFilter extends RegExQueryFilter {
|
||||
/**
|
||||
* Creates a regular expression query that is able to match the values of specific mbeans
|
||||
* Creates a regular expression query that is able to match the values of
|
||||
* specific mbeans
|
||||
*
|
||||
* @param next - next query filter
|
||||
*/
|
||||
public MBeansRegExQueryFilter(QueryFilter next) {
|
||||
|
@ -36,9 +38,13 @@ public class MBeansRegExQueryFilter extends RegExQueryFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Try to match the object data using the regular expression map. The regex map contains a key-value mapping of an attribute
|
||||
* key to a regular expression the value of the key should match. The basic rule of matching is that the data must contain
|
||||
* a property key that is included in the regex map, and that the value of the property key should match the regex specified.
|
||||
* Try to match the object data using the regular expression map. The regex
|
||||
* map contains a key-value mapping of an attribute key to a regular
|
||||
* expression the value of the key should match. The basic rule of matching
|
||||
* is that the data must contain a property key that is included in the
|
||||
* regex map, and that the value of the property key should match the regex
|
||||
* specified.
|
||||
*
|
||||
* @param data - object data to match
|
||||
* @param regex - regex map
|
||||
* @return true if the data matches the regex map specified
|
||||
|
@ -49,8 +55,12 @@ public class MBeansRegExQueryFilter extends RegExQueryFilter {
|
|||
|
||||
// Use reflection to determine where the object should go
|
||||
try {
|
||||
Method method = this.getClass().getDeclaredMethod("matches", new Class[] {data.getClass(), Map.class});
|
||||
return ((Boolean)method.invoke(this, new Object[] {data, regex})).booleanValue();
|
||||
Method method = this.getClass().getDeclaredMethod("matches", new Class[] {
|
||||
data.getClass(), Map.class
|
||||
});
|
||||
return ((Boolean)method.invoke(this, new Object[] {
|
||||
data, regex
|
||||
})).booleanValue();
|
||||
} catch (NoSuchMethodException e) {
|
||||
return false;
|
||||
}
|
||||
|
@ -58,6 +68,7 @@ public class MBeansRegExQueryFilter extends RegExQueryFilter {
|
|||
|
||||
/**
|
||||
* Try to match the object instance using the regular expression map
|
||||
*
|
||||
* @param data - object instance to match
|
||||
* @param regex - regex map
|
||||
* @return true if the object instance matches the regex map
|
||||
|
@ -68,12 +79,13 @@ public class MBeansRegExQueryFilter extends RegExQueryFilter {
|
|||
|
||||
/**
|
||||
* Try to match the object name instance using the regular expression map
|
||||
*
|
||||
* @param data - object name to match
|
||||
* @param regex - regex map
|
||||
* @return true if the object name matches the regex map
|
||||
*/
|
||||
protected boolean matches(ObjectName data, Map regex) {
|
||||
for (Iterator i=regex.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator i = regex.keySet().iterator(); i.hasNext();) {
|
||||
String key = (String)i.next();
|
||||
String target = data.getKeyProperty(key);
|
||||
|
||||
|
@ -87,16 +99,18 @@ public class MBeansRegExQueryFilter extends RegExQueryFilter {
|
|||
|
||||
/**
|
||||
* Try to match the attribute list using the regular expression map
|
||||
*
|
||||
* @param data - attribute list to match
|
||||
* @param regex - regex map
|
||||
* @return true if the attribute list matches the regex map
|
||||
*/
|
||||
protected boolean matches(AttributeList data, Map regex) {
|
||||
for (Iterator i=regex.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator i = regex.keySet().iterator(); i.hasNext();) {
|
||||
String key = (String)i.next();
|
||||
|
||||
// Try to match each regex to the attributes of the mbean including its ObjectName
|
||||
for (Iterator j=data.iterator(); j.hasNext();) {
|
||||
// Try to match each regex to the attributes of the mbean including
|
||||
// its ObjectName
|
||||
for (Iterator j = data.iterator(); j.hasNext();) {
|
||||
Attribute attrib = (Attribute)j.next();
|
||||
|
||||
// Try to match to the properties of the ObjectName
|
||||
|
@ -110,7 +124,7 @@ public class MBeansRegExQueryFilter extends RegExQueryFilter {
|
|||
break;
|
||||
}
|
||||
|
||||
// Try to match to the mbean attributes
|
||||
// Try to match to the mbean attributes
|
||||
} else if (attrib.getName().equals(key)) {
|
||||
if (!((Pattern)regex.get(key)).matcher(attrib.getValue().toString()).matches()) {
|
||||
return false;
|
||||
|
@ -119,7 +133,7 @@ public class MBeansRegExQueryFilter extends RegExQueryFilter {
|
|||
break;
|
||||
}
|
||||
|
||||
// If mbean does not contain the specified attribute
|
||||
// If mbean does not contain the specified attribute
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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,32 +16,36 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.util.AmqMessagesUtil;
|
||||
import org.apache.activemq.command.ActiveMQDestination;
|
||||
import org.apache.activemq.command.ActiveMQObjectMessage;
|
||||
import org.apache.activemq.command.ActiveMQBytesMessage;
|
||||
import org.apache.activemq.command.ActiveMQTextMessage;
|
||||
import org.apache.activemq.command.ActiveMQMapMessage;
|
||||
import org.apache.activemq.command.ActiveMQStreamMessage;
|
||||
import org.apache.activemq.command.ActiveMQMessage;
|
||||
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.Attribute;
|
||||
import javax.management.openmbean.CompositeDataSupport;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.DeliveryMode;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Iterator;
|
||||
import java.util.Enumeration;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.jms.DeliveryMode;
|
||||
import javax.jms.JMSException;
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.openmbean.CompositeDataSupport;
|
||||
|
||||
import org.apache.activemq.command.ActiveMQBytesMessage;
|
||||
import org.apache.activemq.command.ActiveMQDestination;
|
||||
import org.apache.activemq.command.ActiveMQMapMessage;
|
||||
import org.apache.activemq.command.ActiveMQMessage;
|
||||
import org.apache.activemq.command.ActiveMQObjectMessage;
|
||||
import org.apache.activemq.command.ActiveMQStreamMessage;
|
||||
import org.apache.activemq.command.ActiveMQTextMessage;
|
||||
import org.apache.activemq.console.formatter.GlobalWriter;
|
||||
import org.apache.activemq.console.util.AmqMessagesUtil;
|
||||
|
||||
public class MapTransformFilter extends ResultTransformFilter {
|
||||
/**
|
||||
* Creates a Map transform filter that is able to transform a variety of objects to a properties map object
|
||||
* Creates a Map transform filter that is able to transform a variety of
|
||||
* objects to a properties map object
|
||||
*
|
||||
* @param next - the next query filter
|
||||
*/
|
||||
public MapTransformFilter(QueryFilter next) {
|
||||
|
@ -51,14 +54,19 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform the given object to a Map object
|
||||
*
|
||||
* @param object - object to transform
|
||||
* @return map object
|
||||
*/
|
||||
protected Object transformElement(Object object) throws Exception {
|
||||
// Use reflection to determine how the object should be transformed
|
||||
try {
|
||||
Method method = this.getClass().getDeclaredMethod("transformToMap", new Class[] {object.getClass()});
|
||||
return (Map)method.invoke(this, new Object[] {object});
|
||||
Method method = this.getClass().getDeclaredMethod("transformToMap", new Class[] {
|
||||
object.getClass()
|
||||
});
|
||||
return (Map)method.invoke(this, new Object[] {
|
||||
object
|
||||
});
|
||||
} catch (NoSuchMethodException e) {
|
||||
GlobalWriter.print("Unable to transform mbean of type: " + object.getClass().getName() + ". No corresponding transformToMap method found.");
|
||||
return null;
|
||||
|
@ -67,6 +75,7 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform an ObjectInstance mbean to a Map
|
||||
*
|
||||
* @param obj - ObjectInstance format of an mbean
|
||||
* @return map object
|
||||
*/
|
||||
|
@ -76,6 +85,7 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform an ObjectName mbean to a Map
|
||||
*
|
||||
* @param objname - ObjectName format of an mbean
|
||||
* @return map object
|
||||
*/
|
||||
|
@ -84,7 +94,7 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
// Parse object properties
|
||||
Map objProps = objname.getKeyPropertyList();
|
||||
for (Iterator i=objProps.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator i = objProps.keySet().iterator(); i.hasNext();) {
|
||||
Object key = i.next();
|
||||
Object val = objProps.get(key);
|
||||
if (val != null) {
|
||||
|
@ -97,12 +107,13 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform an Attribute List format of an mbean to a Map
|
||||
*
|
||||
* @param list - AttributeList format of an mbean
|
||||
* @return map object
|
||||
*/
|
||||
protected Map transformToMap(AttributeList list) {
|
||||
Properties props = new Properties();
|
||||
for (Iterator i=list.iterator(); i.hasNext();) {
|
||||
for (Iterator i = list.iterator(); i.hasNext();) {
|
||||
Attribute attrib = (Attribute)i.next();
|
||||
|
||||
// If attribute is an ObjectName
|
||||
|
@ -120,6 +131,7 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform an ActiveMQTextMessage to a Map
|
||||
*
|
||||
* @param msg - text message to trasnform
|
||||
* @return map object
|
||||
* @throws JMSException
|
||||
|
@ -137,6 +149,7 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform an ActiveMQBytesMessage to a Map
|
||||
*
|
||||
* @param msg - bytes message to transform
|
||||
* @return map object
|
||||
* @throws JMSException
|
||||
|
@ -148,20 +161,21 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
long bodyLength = msg.getBodyLength();
|
||||
byte[] msgBody;
|
||||
int i=0;
|
||||
int i = 0;
|
||||
// Create separate bytes messages
|
||||
for (i=0; i<(bodyLength/Integer.MAX_VALUE); i++) {
|
||||
for (i = 0; i < (bodyLength / Integer.MAX_VALUE); i++) {
|
||||
msgBody = new byte[Integer.MAX_VALUE];
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSBytes:" + (i+1), new String(msgBody));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSBytes:" + (i + 1), new String(msgBody));
|
||||
}
|
||||
msgBody = new byte[(int)(bodyLength % Integer.MAX_VALUE)];
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSBytes:" + (i+1), new String(msgBody));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSBytes:" + (i + 1), new String(msgBody));
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform an ActiveMQMessage to a Map
|
||||
*
|
||||
* @param msg - object message to transform
|
||||
* @return map object
|
||||
* @throws JMSException
|
||||
|
@ -180,6 +194,7 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform an ActiveMQMapMessage to a Map
|
||||
*
|
||||
* @param msg - map message to transform
|
||||
* @return map object
|
||||
* @throws JMSException
|
||||
|
@ -204,6 +219,7 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform an ActiveMQStreamMessage to a Map
|
||||
*
|
||||
* @param msg - stream message to transform
|
||||
* @return map object
|
||||
* @throws JMSException
|
||||
|
@ -212,7 +228,8 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
Properties props = new Properties();
|
||||
|
||||
props.putAll(transformToMap((ActiveMQMessage)msg));
|
||||
// Just set the toString of the message as the body of the stream message
|
||||
// Just set the toString of the message as the body of the stream
|
||||
// message
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSStreamMessage", msg.toString());
|
||||
|
||||
return props;
|
||||
|
@ -220,31 +237,32 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform an ActiveMQMessage to a Map
|
||||
*
|
||||
* @param msg - message to transform
|
||||
* @return map object
|
||||
* @throws JMSException
|
||||
*/
|
||||
protected Map transformToMap(ActiveMQMessage msg) throws JMSException {
|
||||
Properties props = new Properties();
|
||||
protected Map<String, String> transformToMap(ActiveMQMessage msg) throws JMSException {
|
||||
Map<String, String> props = new HashMap<String, String>();
|
||||
|
||||
// Get JMS properties
|
||||
if (msg.getJMSCorrelationID() != null) {
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSCorrelationID", msg.getJMSCorrelationID());
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSCorrelationID", msg.getJMSCorrelationID());
|
||||
}
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDeliveryMode", (msg.getJMSDeliveryMode()==DeliveryMode.PERSISTENT) ? "persistent" : "non-persistent");
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDeliveryMode", (msg.getJMSDeliveryMode() == DeliveryMode.PERSISTENT) ? "persistent" : "non-persistent");
|
||||
if (msg.getJMSDestination() != null) {
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDestination", ((ActiveMQDestination)msg.getJMSDestination()).getPhysicalName());
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDestination", ((ActiveMQDestination)msg.getJMSDestination()).getPhysicalName());
|
||||
}
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSExpiration", Long.toString(msg.getJMSExpiration()));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSMessageID", msg.getJMSMessageID());
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSPriority", Integer.toString(msg.getJMSPriority()));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSRedelivered", Boolean.toString(msg.getJMSRedelivered()));
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSExpiration", Long.toString(msg.getJMSExpiration()));
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSMessageID", msg.getJMSMessageID());
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSPriority", Integer.toString(msg.getJMSPriority()));
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSRedelivered", Boolean.toString(msg.getJMSRedelivered()));
|
||||
if (msg.getJMSReplyTo() != null) {
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSReplyTo", ((ActiveMQDestination)msg.getJMSReplyTo()).getPhysicalName());
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSReplyTo", ((ActiveMQDestination)msg.getJMSReplyTo()).getPhysicalName());
|
||||
}
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSTimestamp", Long.toString(msg.getJMSTimestamp()));
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSTimestamp", Long.toString(msg.getJMSTimestamp()));
|
||||
if (msg.getJMSType() != null) {
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSType", msg.getJMSType());
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSType", msg.getJMSType());
|
||||
}
|
||||
|
||||
// Get custom properties
|
||||
|
@ -252,7 +270,7 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
while (e.hasMoreElements()) {
|
||||
String name = (String)e.nextElement();
|
||||
if (msg.getObjectProperty(name) != null) {
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + name, msg.getObjectProperty(name).toString());
|
||||
props.put(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + name, msg.getObjectProperty(name).toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,6 +279,7 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
|
||||
/**
|
||||
* Transform an openMBean composite data to a Map
|
||||
*
|
||||
* @param data - composite data to transform
|
||||
* @return map object
|
||||
*/
|
||||
|
@ -273,40 +292,38 @@ public class MapTransformFilter extends ResultTransformFilter {
|
|||
if (typeName.equals(ActiveMQTextMessage.class.getName())) {
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "Text", data.get("Text").toString());
|
||||
|
||||
// Retrieve byte preview
|
||||
// Retrieve byte preview
|
||||
} else if (typeName.equals(ActiveMQBytesMessage.class.getName())) {
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "BodyLength", data.get("BodyLength").toString());
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "BodyPreview", new String((byte[])data.get("BodyPreview")));
|
||||
|
||||
// Expand content map
|
||||
// Expand content map
|
||||
} else if (typeName.equals(ActiveMQMapMessage.class.getName())) {
|
||||
Map contentMap = (Map)data.get("ContentMap");
|
||||
for (Iterator i=contentMap.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator i = contentMap.keySet().iterator(); i.hasNext();) {
|
||||
String key = (String)i.next();
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + key, contentMap.get(key).toString());
|
||||
}
|
||||
|
||||
// Do nothing
|
||||
} else if (typeName.equals(ActiveMQObjectMessage.class.getName()) ||
|
||||
typeName.equals(ActiveMQStreamMessage.class.getName()) ||
|
||||
typeName.equals(ActiveMQMessage.class.getName())) {
|
||||
// Do nothing
|
||||
} else if (typeName.equals(ActiveMQObjectMessage.class.getName()) || typeName.equals(ActiveMQStreamMessage.class.getName()) || typeName.equals(ActiveMQMessage.class.getName())) {
|
||||
|
||||
// Unrecognized composite data. Throw exception.
|
||||
// Unrecognized composite data. Throw exception.
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unrecognized composite data to transform. composite type: " + typeName);
|
||||
}
|
||||
|
||||
// Process the JMS message header values
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSCorrelationID", "" + data.get("JMSCorrelationID"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDestination", "" + data.get("JMSDestination"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSMessageID", "" + data.get("JMSMessageID"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSReplyTo", "" + data.get("JMSReplyTo"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSType", "" + data.get("JMSType"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDeliveryMode", "" + data.get("JMSDeliveryMode"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSExpiration", "" + data.get("JMSExpiration"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSPriority", "" + data.get("JMSPriority"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSRedelivered", "" + data.get("JMSRedelivered"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSTimestamp", "" + data.get("JMSTimestamp"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDestination", "" + data.get("JMSDestination"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSMessageID", "" + data.get("JMSMessageID"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSReplyTo", "" + data.get("JMSReplyTo"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSType", "" + data.get("JMSType"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDeliveryMode", "" + data.get("JMSDeliveryMode"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSExpiration", "" + data.get("JMSExpiration"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSPriority", "" + data.get("JMSPriority"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSRedelivered", "" + data.get("JMSRedelivered"));
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSTimestamp", "" + data.get("JMSTimestamp"));
|
||||
|
||||
// Process the JMS custom message properties
|
||||
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + "Properties", "" + data.get("Properties"));
|
||||
|
|
|
@ -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,36 +16,39 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.Arrays;
|
||||
import java.io.IOException;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
public class MessagesQueryFilter extends AbstractQueryFilter {
|
||||
|
||||
private JMXServiceURL jmxServiceUrl;
|
||||
private ObjectName destName;
|
||||
private ObjectName destName;
|
||||
|
||||
/**
|
||||
* Create a JMS message query filter
|
||||
*
|
||||
* @param jmxServiceUrl - JMX service URL to connect to
|
||||
* @param destName - object name query to retrieve the destination
|
||||
*/
|
||||
public MessagesQueryFilter(JMXServiceURL jmxServiceUrl, ObjectName destName) {
|
||||
super(null);
|
||||
this.jmxServiceUrl = jmxServiceUrl;
|
||||
this.destName = destName;
|
||||
this.destName = destName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the specified destination using the message selector format query
|
||||
*
|
||||
* @param queries - message selector queries
|
||||
* @return list messages that matches the selector
|
||||
* @throws Exception
|
||||
|
@ -55,12 +57,12 @@ public class MessagesQueryFilter extends AbstractQueryFilter {
|
|||
String selector = "";
|
||||
|
||||
// Convert to message selector
|
||||
for (Iterator i=queries.iterator(); i.hasNext();) {
|
||||
for (Iterator i = queries.iterator(); i.hasNext();) {
|
||||
selector = selector + "(" + i.next().toString() + ") AND ";
|
||||
}
|
||||
|
||||
// Remove last AND
|
||||
if (selector != "") {
|
||||
if (!selector.equals("")) {
|
||||
selector = selector.substring(0, selector.length() - 5);
|
||||
}
|
||||
|
||||
|
@ -69,6 +71,7 @@ public class MessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Query the messages of a queue destination using JMX
|
||||
*
|
||||
* @param selector - message selector
|
||||
* @return list of messages that matches the selector
|
||||
* @throws Exception
|
||||
|
@ -84,6 +87,7 @@ public class MessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Get the JMX service URL the query is connecting to.
|
||||
*
|
||||
* @return JMX service URL
|
||||
*/
|
||||
public JMXServiceURL getJmxServiceUrl() {
|
||||
|
@ -92,6 +96,7 @@ public class MessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Sets the JMX service URL the query is going to connect to.
|
||||
*
|
||||
* @param jmxServiceUrl - new JMX service URL
|
||||
*/
|
||||
public void setJmxServiceUrl(JMXServiceURL jmxServiceUrl) {
|
||||
|
@ -100,6 +105,7 @@ public class MessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Sets the JMX service URL the query is going to connect to.
|
||||
*
|
||||
* @param jmxServiceUrl - new JMX service URL
|
||||
*/
|
||||
public void setJmxServiceUrl(String jmxServiceUrl) throws MalformedURLException {
|
||||
|
@ -108,6 +114,7 @@ public class MessagesQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Creates a JMX connector
|
||||
*
|
||||
* @return JMX connector
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
|
|
|
@ -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,13 +16,13 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Collection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class PropertiesViewFilter implements QueryFilter {
|
||||
protected QueryFilter next;
|
||||
|
@ -31,6 +30,7 @@ public class PropertiesViewFilter implements QueryFilter {
|
|||
|
||||
/**
|
||||
* Creates a filter that will select the properties of a map object to view
|
||||
*
|
||||
* @param next - the next query filter that will return a collection of maps
|
||||
*/
|
||||
public PropertiesViewFilter(QueryFilter next) {
|
||||
|
@ -39,6 +39,7 @@ public class PropertiesViewFilter implements QueryFilter {
|
|||
|
||||
/**
|
||||
* Creates a filter that will select the properties of a map object to view
|
||||
*
|
||||
* @param viewFilter - the properties to view
|
||||
* @param next - the next query filter that will return a collection of maps
|
||||
*/
|
||||
|
@ -49,35 +50,38 @@ public class PropertiesViewFilter implements QueryFilter {
|
|||
|
||||
/**
|
||||
* Filter the properties to view of the query result
|
||||
*
|
||||
* @param query - the query string
|
||||
* @return list of objects that has been view filtered
|
||||
*/
|
||||
public List query(String query) throws Exception {
|
||||
public List<Map<Object, Object>> query(String query) throws Exception {
|
||||
return filterViewCollection(next.query(query), viewFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the properties to view of the query result
|
||||
*
|
||||
* @param queries - the query map
|
||||
* @return list of objects that has been view filtered
|
||||
* @throws Exception
|
||||
*/
|
||||
public List query(List queries) throws Exception {
|
||||
public List<Map<Object, Object>> query(List queries) throws Exception {
|
||||
return filterViewCollection(next.query(queries), viewFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the view of each element in the collection
|
||||
*
|
||||
* @param result - the lists to filter the view from
|
||||
* @param viewFilter - the views to select
|
||||
* @return lsit of objects whose view has been filtered
|
||||
* @return list of objects whose view has been filtered
|
||||
*/
|
||||
protected List filterViewCollection(Collection result, Set viewFilter) {
|
||||
protected List<Map<Object, Object>> filterViewCollection(Collection<Map<Object, Object>> result, Set viewFilter) {
|
||||
// Use a list to allow duplicate entries
|
||||
List newCollection = new ArrayList();
|
||||
List<Map<Object, Object>> newCollection = new ArrayList<Map<Object, Object>>();
|
||||
|
||||
for (Iterator i=result.iterator(); i.hasNext();) {
|
||||
newCollection.add(filterView((Map)i.next()));
|
||||
for (Iterator<Map<Object, Object>> i = result.iterator(); i.hasNext();) {
|
||||
newCollection.add(filterView(i.next()));
|
||||
}
|
||||
|
||||
return newCollection;
|
||||
|
@ -85,26 +89,27 @@ public class PropertiesViewFilter implements QueryFilter {
|
|||
|
||||
/**
|
||||
* Select only the attributes to view from the map data
|
||||
*
|
||||
* @param data - data to filter the view from
|
||||
* @return - data with the view filtered
|
||||
*/
|
||||
protected Map filterView(Map data) {
|
||||
protected Map<Object, Object> filterView(Map<Object, Object> data) {
|
||||
// If no view specified, display all attributes
|
||||
if (viewFilter == null || viewFilter.isEmpty()) {
|
||||
return data;
|
||||
}
|
||||
|
||||
Map newData;
|
||||
Map<Object, Object> newData;
|
||||
try {
|
||||
// Lets try to use the same class as the original
|
||||
newData = (Map)data.getClass().newInstance();
|
||||
newData = data.getClass().newInstance();
|
||||
} catch (Exception e) {
|
||||
// Lets use a default HashMap
|
||||
newData = new HashMap();
|
||||
newData = new HashMap<Object, Object>();
|
||||
}
|
||||
|
||||
// Filter the keys to view
|
||||
for (Iterator i=viewFilter.iterator(); i.hasNext();) {
|
||||
for (Iterator i = viewFilter.iterator(); i.hasNext();) {
|
||||
Object key = i.next();
|
||||
Object val = data.get(key);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
@ -18,9 +17,11 @@
|
|||
package org.apache.activemq.console.filter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface QueryFilter {
|
||||
public static final String QUERY_DELIMETER = ",";
|
||||
|
||||
String QUERY_DELIMETER = ",";
|
||||
|
||||
/**
|
||||
* Interface for querying
|
||||
|
@ -28,7 +29,7 @@ public interface QueryFilter {
|
|||
* @return collection of objects that satisfies the query
|
||||
* @throws Exception
|
||||
*/
|
||||
public List query(String queryStr) throws Exception;
|
||||
List query(String queryStr) throws Exception;
|
||||
|
||||
/**
|
||||
* Interface for querying
|
||||
|
@ -36,5 +37,5 @@ public interface QueryFilter {
|
|||
* @return collection of objects that satisfies the query
|
||||
* @throws Exception
|
||||
*/
|
||||
public List query(List queries) throws Exception;
|
||||
List query(List queries) throws Exception;
|
||||
}
|
||||
|
|
|
@ -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,18 +16,20 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
||||
public static final String REGEX_PREFIX = "REGEX:QUERY:";
|
||||
|
||||
/**
|
||||
* Creates a regular expression query that is able to match an object using key-value pattern regex filtering
|
||||
* Creates a regular expression query that is able to match an object using
|
||||
* key-value pattern regex filtering
|
||||
*
|
||||
* @param next
|
||||
*/
|
||||
protected RegExQueryFilter(QueryFilter next) {
|
||||
|
@ -36,8 +37,10 @@ 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.
|
||||
* 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
|
||||
|
@ -47,7 +50,7 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
List newQueries = new ArrayList();
|
||||
|
||||
// Lets parse for regular expression queries
|
||||
for (Iterator i=queries.iterator(); i.hasNext();) {
|
||||
for (Iterator i = queries.iterator(); i.hasNext();) {
|
||||
// Get key-value pair
|
||||
String token = (String)i.next();
|
||||
String key = "";
|
||||
|
@ -58,11 +61,12 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
key = token.substring(0, pos);
|
||||
}
|
||||
|
||||
// Add the regex query to list and make it a non-factor in the succeeding queries
|
||||
// Add the regex query to list and make it a non-factor in the
|
||||
// succeeding queries
|
||||
if (isRegularExpression(val)) {
|
||||
regex.put(key, compileQuery(val));
|
||||
|
||||
// Add the normal query to the query list
|
||||
// Add the normal query to the query list
|
||||
} else {
|
||||
newQueries.add(token);
|
||||
}
|
||||
|
@ -73,8 +77,10 @@ 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.
|
||||
* 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
|
||||
*/
|
||||
|
@ -84,6 +90,7 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Compiles the regex query to a pattern.
|
||||
*
|
||||
* @param query - query string to compile
|
||||
* @return regex pattern
|
||||
*/
|
||||
|
@ -93,6 +100,7 @@ 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
|
||||
|
@ -100,14 +108,14 @@ public abstract class RegExQueryFilter extends AbstractQueryFilter {
|
|||
*/
|
||||
protected List filterCollectionUsingRegEx(Map regex, List data) throws Exception {
|
||||
// No regular expressions filtering needed
|
||||
if (regex==null || regex.isEmpty()) {
|
||||
if (regex == null || regex.isEmpty()) {
|
||||
return data;
|
||||
}
|
||||
|
||||
List filteredElems = new ArrayList();
|
||||
|
||||
// Get each data object to filter
|
||||
for (Iterator i=data.iterator(); i.hasNext();) {
|
||||
for (Iterator i = data.iterator(); i.hasNext();) {
|
||||
Object dataElem = i.next();
|
||||
// If properties of data matches all the regex pattern, add it
|
||||
if (matches(dataElem, regex)) {
|
||||
|
@ -120,6 +128,7 @@ 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
|
||||
|
|
|
@ -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,
|
||||
|
@ -25,7 +24,8 @@ public abstract class ResultTransformFilter implements QueryFilter {
|
|||
private QueryFilter next;
|
||||
|
||||
/**
|
||||
* Contructs a query filter that transform the format of the query result
|
||||
* Constructs a query filter that transform the format of the query result
|
||||
*
|
||||
* @param next - the query filter to retrieve the results from
|
||||
*/
|
||||
protected ResultTransformFilter(QueryFilter next) {
|
||||
|
@ -34,6 +34,7 @@ public abstract class ResultTransformFilter implements QueryFilter {
|
|||
|
||||
/**
|
||||
* Transforms the queried results to a collection of different objects
|
||||
*
|
||||
* @param query - the query string
|
||||
* @return collections of transformed objects
|
||||
* @throws Exception
|
||||
|
@ -44,23 +45,25 @@ public abstract class ResultTransformFilter implements QueryFilter {
|
|||
|
||||
/**
|
||||
* Transforms the queried results to a collection of different objects
|
||||
*
|
||||
* @param queries - the query map
|
||||
* @return collections of transformed objects
|
||||
* @throws Exception
|
||||
*/
|
||||
public List query(List queries) throws Exception {
|
||||
public List<Object> query(List queries) throws Exception {
|
||||
return transformList(next.query(queries));
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a collection to a collection of different objects.
|
||||
*
|
||||
* @param result - the collection to transform
|
||||
* @return collection of properties objects
|
||||
*/
|
||||
protected List transformList(List result) throws Exception {
|
||||
List props = new ArrayList();
|
||||
protected List<Object> transformList(List<Object> result) throws Exception {
|
||||
List<Object> props = new ArrayList<Object>();
|
||||
|
||||
for (Iterator i=result.iterator(); i.hasNext();) {
|
||||
for (Iterator<Object> i = result.iterator(); i.hasNext();) {
|
||||
props.add(transformElement(i.next()));
|
||||
}
|
||||
|
||||
|
@ -69,6 +72,7 @@ public abstract class ResultTransformFilter implements QueryFilter {
|
|||
|
||||
/**
|
||||
* Transform a result object
|
||||
*
|
||||
* @param obj - the object instance to transform
|
||||
* @return the transformed object
|
||||
*/
|
||||
|
|
|
@ -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,
|
||||
|
@ -19,11 +18,13 @@ package org.apache.activemq.console.filter;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class StubQueryFilter implements QueryFilter{
|
||||
public class StubQueryFilter implements QueryFilter {
|
||||
private List data;
|
||||
|
||||
/**
|
||||
* Creates a stub query that returns the given collections as the query result
|
||||
* Creates a stub query that returns the given collections as the query
|
||||
* result
|
||||
*
|
||||
* @param data - the stub query result
|
||||
*/
|
||||
public StubQueryFilter(List data) {
|
||||
|
@ -32,6 +33,7 @@ public class StubQueryFilter implements QueryFilter{
|
|||
|
||||
/**
|
||||
* Returns the provided stub data as a stub query result
|
||||
*
|
||||
* @param queryStr - not use
|
||||
* @return the stub query result
|
||||
* @throws Exception
|
||||
|
@ -42,6 +44,7 @@ public class StubQueryFilter implements QueryFilter{
|
|||
|
||||
/**
|
||||
* Returns the provided stub data as a stub query result
|
||||
*
|
||||
* @param queries - not use
|
||||
* @return the stub query result
|
||||
* @throws Exception
|
||||
|
|
|
@ -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,9 +16,11 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
public class WildcardToMsgSelectorTransformFilter extends WildcardTransformFilter{
|
||||
public class WildcardToMsgSelectorTransformFilter extends WildcardTransformFilter {
|
||||
/**
|
||||
* Creates a filter that is able to transform a wildcard query to a message selector format
|
||||
* Creates a filter that is able to transform a wildcard query to a message
|
||||
* selector format
|
||||
*
|
||||
* @param next - next query filter
|
||||
*/
|
||||
public WildcardToMsgSelectorTransformFilter(QueryFilter next) {
|
||||
|
@ -27,8 +28,10 @@ public class WildcardToMsgSelectorTransformFilter extends WildcardTransformFilte
|
|||
}
|
||||
|
||||
/**
|
||||
* Use to determine if a query string is a wildcard query. A query string is a wildcard query if it is a key-value
|
||||
* pair with the format <key>=<value> and the value is enclosed in '' and contains '*' and '?'.
|
||||
* Use to determine if a query string is a wildcard query. A query string is
|
||||
* a wildcard query if it is a key-value pair with the format <key>=<value>
|
||||
* and the value is enclosed in '' and contains '*' and '?'.
|
||||
*
|
||||
* @param query - query string
|
||||
* @return true, if the query string is a wildcard query, false otherwise
|
||||
*/
|
||||
|
@ -47,6 +50,7 @@ public class WildcardToMsgSelectorTransformFilter extends WildcardTransformFilte
|
|||
|
||||
/**
|
||||
* Transform a wildcard query to message selector format
|
||||
*
|
||||
* @param query - query string to transform
|
||||
* @return message selector format string
|
||||
*/
|
||||
|
|
|
@ -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,
|
||||
|
@ -19,7 +18,9 @@ package org.apache.activemq.console.filter;
|
|||
|
||||
public class WildcardToRegExTransformFilter extends WildcardTransformFilter {
|
||||
/**
|
||||
* Creates a filter that is able to transform a wildcard query to a regular expression query string
|
||||
* Creates a filter that is able to transform a wildcard query to a regular
|
||||
* expression query string
|
||||
*
|
||||
* @param next - next query filter
|
||||
*/
|
||||
public WildcardToRegExTransformFilter(RegExQueryFilter next) {
|
||||
|
@ -27,8 +28,10 @@ public class WildcardToRegExTransformFilter extends WildcardTransformFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Use to determine if a query string is a wildcard query. A query string is a wildcard query if it is a key-value
|
||||
* pair with the format <key>=<value> and the value contains '*' and '?'.
|
||||
* Use to determine if a query string is a wildcard query. A query string is
|
||||
* a wildcard query if it is a key-value pair with the format <key>=<value>
|
||||
* and the value contains '*' and '?'.
|
||||
*
|
||||
* @param query - query string
|
||||
* @return true, if the query string is a wildcard query, false otherwise
|
||||
*/
|
||||
|
@ -42,11 +45,12 @@ public class WildcardToRegExTransformFilter extends WildcardTransformFilter {
|
|||
}
|
||||
|
||||
// If the value contains wildcards
|
||||
return ((val.indexOf("*") >= 0) || (val.indexOf("?") >= 0));
|
||||
return (val.indexOf("*") >= 0) || (val.indexOf("?") >= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a wildcard query to regular expression format
|
||||
*
|
||||
* @param query - query string to transform
|
||||
* @return regex query string
|
||||
*/
|
||||
|
@ -60,11 +64,14 @@ public class WildcardToRegExTransformFilter extends WildcardTransformFilter {
|
|||
key = key.substring(0, pos);
|
||||
}
|
||||
|
||||
val = val.replaceAll("[.]", "\\\\."); // Escape all dot characters. From (.) to (\.)
|
||||
val = val.replaceAll("[?]", "."); // Match single characters
|
||||
val = val.replaceAll("[*]", ".*?"); // Match all characters, use reluctant quantifier
|
||||
val = "(" + val +")"; // Let's group the query for clarity
|
||||
val = RegExQueryFilter.REGEX_PREFIX + val; // Flag as a regular expression query
|
||||
val = val.replaceAll("[.]", "\\\\."); // Escape all dot characters.
|
||||
// From (.) to (\.)
|
||||
val = val.replaceAll("[?]", "."); // Match single characters
|
||||
val = val.replaceAll("[*]", ".*?"); // Match all characters, use
|
||||
// reluctant quantifier
|
||||
val = "(" + val + ")"; // Let's group the query for clarity
|
||||
val = RegExQueryFilter.REGEX_PREFIX + val; // Flag as a regular
|
||||
// expression query
|
||||
|
||||
return key + "=" + val;
|
||||
}
|
||||
|
|
|
@ -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,17 @@
|
|||
*/
|
||||
package org.apache.activemq.console.filter;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class WildcardTransformFilter extends AbstractQueryFilter {
|
||||
|
||||
/**
|
||||
* Creates a wildcard transform filter that is able to convert a wildcard expression (determined by isWildcardQuery)
|
||||
* to a another query type (use transformWildcardQuery).
|
||||
* Creates a wildcard transform filter that is able to convert a wildcard
|
||||
* expression (determined by isWildcardQuery) to a another query type (use
|
||||
* transformWildcardQuery).
|
||||
*
|
||||
* @param next - the next query filter
|
||||
*/
|
||||
protected WildcardTransformFilter(QueryFilter next) {
|
||||
|
@ -34,6 +35,7 @@ public abstract class WildcardTransformFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Converts the query list to set of different queries
|
||||
*
|
||||
* @param queries - query list to transform
|
||||
* @return - result of the query
|
||||
* @throws Exception
|
||||
|
@ -41,7 +43,7 @@ public abstract class WildcardTransformFilter extends AbstractQueryFilter {
|
|||
public List query(List queries) throws Exception {
|
||||
List newQueries = new ArrayList();
|
||||
|
||||
for (Iterator i=queries.iterator(); i.hasNext();) {
|
||||
for (Iterator i = queries.iterator(); i.hasNext();) {
|
||||
String queryToken = (String)i.next();
|
||||
|
||||
// Transform the wildcard query
|
||||
|
@ -49,7 +51,7 @@ public abstract class WildcardTransformFilter extends AbstractQueryFilter {
|
|||
// Transform the value part only
|
||||
newQueries.add(transformWildcardQuery(queryToken));
|
||||
|
||||
// Maintain the query as is
|
||||
// Maintain the query as is
|
||||
} else {
|
||||
newQueries.add(queryToken);
|
||||
}
|
||||
|
@ -60,6 +62,7 @@ public abstract class WildcardTransformFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Use to determine is a query string is a wildcard query
|
||||
*
|
||||
* @param query - query string
|
||||
* @return true, if the query string is a wildcard query, false otherwise
|
||||
*/
|
||||
|
@ -67,6 +70,7 @@ public abstract class WildcardTransformFilter extends AbstractQueryFilter {
|
|||
|
||||
/**
|
||||
* Use to transform a wildcard query string to another query format
|
||||
*
|
||||
* @param query - query string to transform
|
||||
* @return transformed query
|
||||
*/
|
||||
|
|
|
@ -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,16 +16,17 @@
|
|||
*/
|
||||
package org.apache.activemq.console.formatter;
|
||||
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.Attribute;
|
||||
import javax.jms.Message;
|
||||
import java.util.Map;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.io.PrintStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.jms.Message;
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
public class CommandShellOutputFormatter implements OutputFormatter {
|
||||
private OutputStream outputStream;
|
||||
|
@ -44,6 +44,7 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Retrieve the output stream being used by the formatter
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public OutputStream getOutputStream() {
|
||||
|
@ -52,6 +53,7 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print an ObjectInstance format of an mbean
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(ObjectInstance mbean) {
|
||||
|
@ -60,6 +62,7 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print an ObjectName format of an mbean
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(ObjectName mbean) {
|
||||
|
@ -68,10 +71,11 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print an AttributeList format of an mbean
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(AttributeList mbean) {
|
||||
for (Iterator i=mbean.iterator(); i.hasNext();) {
|
||||
for (Iterator i = mbean.iterator(); i.hasNext();) {
|
||||
Attribute attrib = (Attribute)i.next();
|
||||
if (attrib.getValue() instanceof ObjectName) {
|
||||
printMBean((ObjectName)attrib.getValue());
|
||||
|
@ -86,10 +90,11 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a Map format of an mbean
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(Map mbean) {
|
||||
for (Iterator i=mbean.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator i = mbean.keySet().iterator(); i.hasNext();) {
|
||||
String key = (String)i.next();
|
||||
String val = mbean.get(key).toString();
|
||||
out.println(key + " = " + val);
|
||||
|
@ -99,10 +104,11 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a collection of mbean
|
||||
*
|
||||
* @param mbean - collection of mbeans
|
||||
*/
|
||||
public void printMBean(Collection mbean) {
|
||||
for (Iterator i=mbean.iterator(); i.hasNext();) {
|
||||
for (Iterator i = mbean.iterator(); i.hasNext();) {
|
||||
Object obj = i.next();
|
||||
if (obj instanceof ObjectInstance) {
|
||||
printMBean((ObjectInstance)obj);
|
||||
|
@ -122,10 +128,11 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a Map format of a JMS message
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public void printMessage(Map msg) {
|
||||
for (Iterator i=msg.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator i = msg.keySet().iterator(); i.hasNext();) {
|
||||
String key = (String)i.next();
|
||||
String val = msg.get(key).toString();
|
||||
out.println(key + " = " + val);
|
||||
|
@ -135,6 +142,7 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a Message format of a JMS message
|
||||
*
|
||||
* @param msg - JMS message to print
|
||||
*/
|
||||
public void printMessage(Message msg) {
|
||||
|
@ -143,10 +151,11 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a collection of JMS messages
|
||||
*
|
||||
* @param msg - collection of JMS messages
|
||||
*/
|
||||
public void printMessage(Collection msg) {
|
||||
for (Iterator i=msg.iterator(); i.hasNext();) {
|
||||
for (Iterator i = msg.iterator(); i.hasNext();) {
|
||||
Object obj = i.next();
|
||||
if (obj instanceof Message) {
|
||||
printMessage((Message)obj);
|
||||
|
@ -162,10 +171,11 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print help messages
|
||||
*
|
||||
* @param helpMsgs - help messages to print
|
||||
*/
|
||||
public void printHelp(String[] helpMsgs) {
|
||||
for (int i=0; i<helpMsgs.length; i++) {
|
||||
for (int i = 0; i < helpMsgs.length; i++) {
|
||||
out.println(helpMsgs[i]);
|
||||
}
|
||||
out.println();
|
||||
|
@ -173,6 +183,7 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print an information message
|
||||
*
|
||||
* @param info - information message to print
|
||||
*/
|
||||
public void printInfo(String info) {
|
||||
|
@ -181,6 +192,7 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print an exception message
|
||||
*
|
||||
* @param e - exception to print
|
||||
*/
|
||||
public void printException(Exception e) {
|
||||
|
@ -190,6 +202,7 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a version information
|
||||
*
|
||||
* @param version - version info to print
|
||||
*/
|
||||
public void printVersion(String version) {
|
||||
|
@ -201,10 +214,11 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a generic key value mapping
|
||||
*
|
||||
* @param map to print
|
||||
*/
|
||||
public void print(Map map) {
|
||||
for (Iterator i=map.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator i = map.keySet().iterator(); i.hasNext();) {
|
||||
String key = (String)i.next();
|
||||
String val = map.get(key).toString();
|
||||
out.println(key + " = " + val);
|
||||
|
@ -214,10 +228,11 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a generic array of strings
|
||||
*
|
||||
* @param strings - string array to print
|
||||
*/
|
||||
public void print(String[] strings) {
|
||||
for (int i=0; i<strings.length; i++) {
|
||||
for (int i = 0; i < strings.length; i++) {
|
||||
out.println(strings[i]);
|
||||
}
|
||||
out.println();
|
||||
|
@ -225,10 +240,11 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a collection of objects
|
||||
*
|
||||
* @param collection - collection to print
|
||||
*/
|
||||
public void print(Collection collection) {
|
||||
for (Iterator i=collection.iterator(); i.hasNext();) {
|
||||
for (Iterator i = collection.iterator(); i.hasNext();) {
|
||||
out.println(i.next().toString());
|
||||
}
|
||||
out.println();
|
||||
|
@ -236,6 +252,7 @@ public class CommandShellOutputFormatter implements OutputFormatter {
|
|||
|
||||
/**
|
||||
* Print a java string
|
||||
*
|
||||
* @param string - string to print
|
||||
*/
|
||||
public void print(String string) {
|
||||
|
|
|
@ -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.activemq.console.formatter;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.jms.Message;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.AttributeList;
|
||||
import javax.jms.Message;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class GlobalWriter {
|
||||
public final class GlobalWriter {
|
||||
private static OutputFormatter formatter;
|
||||
|
||||
/**
|
||||
|
@ -36,14 +36,16 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Maintains a global output formatter
|
||||
*
|
||||
* @param formatter - the output formatter to use
|
||||
*/
|
||||
public static void instantiate(OutputFormatter formatter) {
|
||||
GlobalWriter.formatter = formatter;
|
||||
GlobalWriter.formatter = formatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the output stream being used by the global formatter
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static OutputStream getOutputStream() {
|
||||
|
@ -55,6 +57,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print an ObjectInstance format of an mbean
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public static void printMBean(ObjectInstance mbean) {
|
||||
|
@ -66,6 +69,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print an ObjectName format of an mbean
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public static void printMBean(ObjectName mbean) {
|
||||
|
@ -77,6 +81,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print an AttributeList format of an mbean
|
||||
*
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public static void printMBean(AttributeList mbean) {
|
||||
|
@ -88,6 +93,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a Map format of an mbean
|
||||
*
|
||||
* @param mbean
|
||||
*/
|
||||
public static void printMBean(Map mbean) {
|
||||
|
@ -99,6 +105,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a Collection format of mbeans
|
||||
*
|
||||
* @param mbean - collection of mbeans
|
||||
*/
|
||||
public static void printMBean(Collection mbean) {
|
||||
|
@ -110,6 +117,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a Map format of a JMS message
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public static void printMessage(Map msg) {
|
||||
|
@ -121,6 +129,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a Message format of a JMS message
|
||||
*
|
||||
* @param msg - JMS message to print
|
||||
*/
|
||||
public static void printMessage(Message msg) {
|
||||
|
@ -132,6 +141,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a collection of JMS messages
|
||||
*
|
||||
* @param msg - collection of JMS messages
|
||||
*/
|
||||
public static void printMessage(Collection msg) {
|
||||
|
@ -143,6 +153,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print help messages
|
||||
*
|
||||
* @param helpMsgs - help messages to print
|
||||
*/
|
||||
public static void printHelp(String[] helpMsgs) {
|
||||
|
@ -154,6 +165,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print an information message
|
||||
*
|
||||
* @param info - information message to print
|
||||
*/
|
||||
public static void printInfo(String info) {
|
||||
|
@ -165,6 +177,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print an exception message
|
||||
*
|
||||
* @param e - exception to print
|
||||
*/
|
||||
public static void printException(Exception e) {
|
||||
|
@ -176,6 +189,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a version information
|
||||
*
|
||||
* @param version - version info to print
|
||||
*/
|
||||
public static void printVersion(String version) {
|
||||
|
@ -187,6 +201,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a generic key value mapping
|
||||
*
|
||||
* @param map to print
|
||||
*/
|
||||
public static void print(Map map) {
|
||||
|
@ -198,6 +213,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a generic array of strings
|
||||
*
|
||||
* @param strings - string array to print
|
||||
*/
|
||||
public static void print(String[] strings) {
|
||||
|
@ -209,6 +225,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a collection of objects
|
||||
*
|
||||
* @param collection - collection to print
|
||||
*/
|
||||
public static void print(Collection collection) {
|
||||
|
@ -220,6 +237,7 @@ public class GlobalWriter {
|
|||
|
||||
/**
|
||||
* Print a java string
|
||||
*
|
||||
* @param string - string to print
|
||||
*/
|
||||
public static void print(String string) {
|
||||
|
|
|
@ -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,115 +16,116 @@
|
|||
*/
|
||||
package org.apache.activemq.console.formatter;
|
||||
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.AttributeList;
|
||||
import javax.jms.Message;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public interface OutputFormatter {
|
||||
import javax.jms.Message;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
interface OutputFormatter {
|
||||
|
||||
/**
|
||||
* Retrieve the output stream being used by the formatter
|
||||
* @return
|
||||
*/
|
||||
public OutputStream getOutputStream();
|
||||
OutputStream getOutputStream();
|
||||
|
||||
/**
|
||||
* Print an ObjectInstance format of an mbean
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(ObjectInstance mbean);
|
||||
void printMBean(ObjectInstance mbean);
|
||||
|
||||
/**
|
||||
* Print an ObjectName format of an mbean
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(ObjectName mbean);
|
||||
void printMBean(ObjectName mbean);
|
||||
|
||||
/**
|
||||
* Print an AttributeList format of an mbean
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(AttributeList mbean);
|
||||
void printMBean(AttributeList mbean);
|
||||
|
||||
/**
|
||||
* Print a Map format of an mbean
|
||||
* @param mbean - mbean to print
|
||||
*/
|
||||
public void printMBean(Map mbean);
|
||||
void printMBean(Map mbean);
|
||||
|
||||
/**
|
||||
* Print a Collection format of mbeans
|
||||
* @param mbean - collection of mbeans
|
||||
*/
|
||||
public void printMBean(Collection mbean);
|
||||
void printMBean(Collection mbean);
|
||||
|
||||
/**
|
||||
* Print a Map format of a JMS message
|
||||
* @param msg
|
||||
*/
|
||||
public void printMessage(Map msg);
|
||||
void printMessage(Map msg);
|
||||
|
||||
/**
|
||||
* Print a Message format of a JMS message
|
||||
* @param msg - JMS message to print
|
||||
*/
|
||||
public void printMessage(Message msg);
|
||||
void printMessage(Message msg);
|
||||
|
||||
/**
|
||||
* Print a Collection format of JMS messages
|
||||
* @param msg - collection of JMS messages
|
||||
*/
|
||||
public void printMessage(Collection msg);
|
||||
void printMessage(Collection msg);
|
||||
|
||||
/**
|
||||
* Print help messages
|
||||
* @param helpMsgs - help messages to print
|
||||
*/
|
||||
public void printHelp(String[] helpMsgs);
|
||||
void printHelp(String[] helpMsgs);
|
||||
|
||||
/**
|
||||
* Print an information message
|
||||
* @param info - information message to print
|
||||
*/
|
||||
public void printInfo(String info);
|
||||
void printInfo(String info);
|
||||
|
||||
/**
|
||||
* Print an exception message
|
||||
* @param e - exception to print
|
||||
*/
|
||||
public void printException(Exception e);
|
||||
void printException(Exception e);
|
||||
|
||||
/**
|
||||
* Print a version information
|
||||
* @param version - version info to print
|
||||
*/
|
||||
public void printVersion(String version);
|
||||
void printVersion(String version);
|
||||
|
||||
/**
|
||||
* Print a generic key value mapping
|
||||
* @param map to print
|
||||
*/
|
||||
public void print(Map map);
|
||||
void print(Map map);
|
||||
|
||||
/**
|
||||
* Print a generic array of strings
|
||||
* @param strings - string array to print
|
||||
*/
|
||||
public void print(String[] strings);
|
||||
void print(String[] strings);
|
||||
|
||||
/**
|
||||
* Print a collection of objects
|
||||
* @param collection - collection to print
|
||||
*/
|
||||
public void print(Collection collection);
|
||||
void print(Collection collection);
|
||||
|
||||
/**
|
||||
* Print a java string
|
||||
* @param string - string to print
|
||||
*/
|
||||
public void print(String string);
|
||||
void print(String string);
|
||||
}
|
||||
|
|
|
@ -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,26 +16,31 @@
|
|||
*/
|
||||
package org.apache.activemq.console.util;
|
||||
|
||||
import org.apache.activemq.console.filter.QueryFilter;
|
||||
import org.apache.activemq.console.filter.WildcardToMsgSelectorTransformFilter;
|
||||
import org.apache.activemq.console.filter.PropertiesViewFilter;
|
||||
import org.apache.activemq.console.filter.StubQueryFilter;
|
||||
import org.apache.activemq.console.filter.MapTransformFilter;
|
||||
import org.apache.activemq.console.filter.GroupPropertiesViewFilter;
|
||||
import org.apache.activemq.console.filter.AmqMessagesQueryFilter;
|
||||
|
||||
import javax.jms.Destination;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class AmqMessagesUtil {
|
||||
import javax.jms.Destination;
|
||||
|
||||
import org.apache.activemq.console.filter.AmqMessagesQueryFilter;
|
||||
import org.apache.activemq.console.filter.GroupPropertiesViewFilter;
|
||||
import org.apache.activemq.console.filter.MapTransformFilter;
|
||||
import org.apache.activemq.console.filter.PropertiesViewFilter;
|
||||
import org.apache.activemq.console.filter.QueryFilter;
|
||||
import org.apache.activemq.console.filter.StubQueryFilter;
|
||||
import org.apache.activemq.console.filter.WildcardToMsgSelectorTransformFilter;
|
||||
|
||||
public final class AmqMessagesUtil {
|
||||
|
||||
public static final String JMS_MESSAGE_HEADER_PREFIX = "JMS_HEADER_FIELD:";
|
||||
public static final String JMS_MESSAGE_CUSTOM_PREFIX = "JMS_CUSTOM_FIELD:";
|
||||
public static final String JMS_MESSAGE_BODY_PREFIX = "JMS_BODY_FIELD:";
|
||||
public static final String JMS_MESSAGE_BODY_PREFIX = "JMS_BODY_FIELD:";
|
||||
|
||||
private AmqMessagesUtil() {
|
||||
}
|
||||
|
||||
public static List getAllMessages(URI brokerUrl, Destination dest) throws Exception {
|
||||
return getMessages(brokerUrl, dest, "");
|
||||
return getMessages(brokerUrl, dest, "");
|
||||
}
|
||||
|
||||
public static List getMessages(URI brokerUrl, Destination dest, String selector) throws Exception {
|
||||
|
@ -48,18 +52,10 @@ public class AmqMessagesUtil {
|
|||
}
|
||||
|
||||
public static List filterMessagesView(List messages, Set groupViews, Set attributeViews) throws Exception {
|
||||
return (new PropertiesViewFilter(attributeViews,
|
||||
new GroupPropertiesViewFilter(groupViews,
|
||||
new MapTransformFilter(
|
||||
new StubQueryFilter(messages)
|
||||
)
|
||||
)
|
||||
)).query("");
|
||||
return (new PropertiesViewFilter(attributeViews, new GroupPropertiesViewFilter(groupViews, new MapTransformFilter(new StubQueryFilter(messages))))).query("");
|
||||
}
|
||||
|
||||
public static QueryFilter createMessageQueryFilter(URI brokerUrl, Destination dest) {
|
||||
return new WildcardToMsgSelectorTransformFilter(
|
||||
new AmqMessagesQueryFilter(brokerUrl, dest)
|
||||
);
|
||||
return new WildcardToMsgSelectorTransformFilter(new AmqMessagesQueryFilter(brokerUrl, dest));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,29 @@
|
|||
*/
|
||||
package org.apache.activemq.console.util;
|
||||
|
||||
import org.apache.activemq.console.filter.*;
|
||||
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
import javax.management.ObjectName;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class JmxMBeansUtil {
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
import org.apache.activemq.console.filter.GroupPropertiesViewFilter;
|
||||
import org.apache.activemq.console.filter.MBeansAttributeQueryFilter;
|
||||
import org.apache.activemq.console.filter.MBeansObjectNameQueryFilter;
|
||||
import org.apache.activemq.console.filter.MBeansRegExQueryFilter;
|
||||
import org.apache.activemq.console.filter.MapTransformFilter;
|
||||
import org.apache.activemq.console.filter.MessagesQueryFilter;
|
||||
import org.apache.activemq.console.filter.PropertiesViewFilter;
|
||||
import org.apache.activemq.console.filter.QueryFilter;
|
||||
import org.apache.activemq.console.filter.StubQueryFilter;
|
||||
import org.apache.activemq.console.filter.WildcardToMsgSelectorTransformFilter;
|
||||
import org.apache.activemq.console.filter.WildcardToRegExTransformFilter;
|
||||
|
||||
public final class JmxMBeansUtil {
|
||||
|
||||
private JmxMBeansUtil() {
|
||||
}
|
||||
|
||||
public static List getAllBrokers(JMXServiceURL jmxUrl) throws Exception {
|
||||
return (new MBeansObjectNameQueryFilter(jmxUrl)).query("Type=Broker");
|
||||
|
@ -45,10 +58,10 @@ public class JmxMBeansUtil {
|
|||
|
||||
public static List queryMBeans(JMXServiceURL jmxUrl, List queryList) throws Exception {
|
||||
// If there is no query defined get all mbeans
|
||||
if (queryList==null || queryList.size()==0) {
|
||||
if (queryList == null || queryList.size() == 0) {
|
||||
return createMBeansObjectNameQuery(jmxUrl).query("");
|
||||
|
||||
// Parse through all the query strings
|
||||
// Parse through all the query strings
|
||||
} else {
|
||||
return createMBeansObjectNameQuery(jmxUrl).query(queryList);
|
||||
}
|
||||
|
@ -56,10 +69,10 @@ public class JmxMBeansUtil {
|
|||
|
||||
public static List queryMBeans(JMXServiceURL jmxUrl, List queryList, Set attributes) throws Exception {
|
||||
// If there is no query defined get all mbeans
|
||||
if (queryList==null || queryList.size()==0) {
|
||||
if (queryList == null || queryList.size() == 0) {
|
||||
return createMBeansAttributeQuery(jmxUrl, attributes).query("");
|
||||
|
||||
// Parse through all the query strings
|
||||
// Parse through all the query strings
|
||||
} else {
|
||||
return createMBeansAttributeQuery(jmxUrl, attributes).query(queryList);
|
||||
}
|
||||
|
@ -74,54 +87,43 @@ public class JmxMBeansUtil {
|
|||
}
|
||||
|
||||
public static List filterMBeansView(List mbeans, Set viewFilter) throws Exception {
|
||||
return (new PropertiesViewFilter(viewFilter, new MapTransformFilter(new StubQueryFilter(mbeans))).query(""));
|
||||
return new PropertiesViewFilter(viewFilter, new MapTransformFilter(new StubQueryFilter(mbeans))).query("");
|
||||
}
|
||||
|
||||
public static String createQueryString(String query, String param) {
|
||||
return query.replaceAll("%1", param);
|
||||
}
|
||||
|
||||
public static String createQueryString(String query, List params) {
|
||||
String output = query;
|
||||
int count = 1;
|
||||
for (Iterator i = params.iterator(); i.hasNext();) {
|
||||
output = output.replaceAll("%" + count++, i.next().toString());
|
||||
}
|
||||
public static String createQueryString(String query, List params) {
|
||||
String output = query;
|
||||
int count = 1;
|
||||
for (Iterator i = params.iterator(); i.hasNext();) {
|
||||
output = output.replaceAll("%" + count++, i.next().toString());
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static QueryFilter createMBeansObjectNameQuery(JMXServiceURL jmxUrl) {
|
||||
return new WildcardToRegExTransformFilter( // Let us be able to accept wildcard queries
|
||||
new MBeansRegExQueryFilter( // Use regular expressions to filter the query results
|
||||
new MBeansObjectNameQueryFilter(jmxUrl) // Let us retrieve the mbeans object name specified by the query
|
||||
)
|
||||
);
|
||||
// Let us be able to accept wildcard queries
|
||||
// Use regular expressions to filter the query results
|
||||
// Let us retrieve the mbeans object name specified by the query
|
||||
return new WildcardToRegExTransformFilter(new MBeansRegExQueryFilter(new MBeansObjectNameQueryFilter(jmxUrl)));
|
||||
}
|
||||
|
||||
public static QueryFilter createMBeansAttributeQuery(JMXServiceURL jmxUrl, Set attributes) {
|
||||
return new WildcardToRegExTransformFilter( // Let use be able to accept wildcard queries
|
||||
new MBeansRegExQueryFilter( // Use regular expressions to filter the query result
|
||||
new MBeansAttributeQueryFilter(jmxUrl, attributes, // Retrieve the attributes needed
|
||||
new MBeansObjectNameQueryFilter(jmxUrl) // Retrieve the mbeans object name specified by the query
|
||||
)
|
||||
)
|
||||
);
|
||||
// Let use be able to accept wildcard queries
|
||||
// Use regular expressions to filter the query result
|
||||
// Retrieve the attributes needed
|
||||
// Retrieve the mbeans object name specified by the query
|
||||
return new WildcardToRegExTransformFilter(new MBeansRegExQueryFilter(new MBeansAttributeQueryFilter(jmxUrl, attributes, new MBeansObjectNameQueryFilter(jmxUrl))));
|
||||
}
|
||||
|
||||
public static QueryFilter createMessageQueryFilter(JMXServiceURL jmxUrl, ObjectName destName) {
|
||||
return new WildcardToMsgSelectorTransformFilter(
|
||||
new MessagesQueryFilter(jmxUrl, destName)
|
||||
);
|
||||
return new WildcardToMsgSelectorTransformFilter(new MessagesQueryFilter(jmxUrl, destName));
|
||||
}
|
||||
|
||||
public static List filterMessagesView(List messages, Set groupViews, Set attributeViews) throws Exception {
|
||||
return (new PropertiesViewFilter(attributeViews,
|
||||
new GroupPropertiesViewFilter(groupViews,
|
||||
new MapTransformFilter(
|
||||
new StubQueryFilter(messages)
|
||||
)
|
||||
)
|
||||
)).query("");
|
||||
return (new PropertiesViewFilter(attributeViews, new GroupPropertiesViewFilter(groupViews, new MapTransformFilter(new StubQueryFilter(messages))))).query("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,18 +16,21 @@
|
|||
*/
|
||||
package org.apache.activemq.console.util;
|
||||
|
||||
import org.apache.activemq.broker.util.CommandMessageListener;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.apache.activemq.broker.util.CommandMessageListener;
|
||||
|
||||
/**
|
||||
* A simple interactive console which can be used to communicate with a running broker
|
||||
* assuming that the classpath is fully setup
|
||||
* A simple interactive console which can be used to communicate with a running
|
||||
* broker assuming that the classpath is fully setup
|
||||
*
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class SimpleConsole {
|
||||
public final class SimpleConsole {
|
||||
|
||||
private SimpleConsole() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
CommandMessageListener listener = new CommandMessageListener(null);
|
||||
|
@ -47,8 +49,7 @@ public class SimpleConsole {
|
|||
|
||||
System.out.println(listener.processCommandText(line));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
System.out.println("Caught: " + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
@ -38,12 +37,21 @@ import javax.jms.Session;
|
|||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
|
||||
public class Consumer {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final class Consumer {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Consumer() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws JMSException, InterruptedException {
|
||||
|
||||
String url = "tcp://localhost:61616";
|
||||
if( args.length>0 ) {
|
||||
if (args.length > 0) {
|
||||
url = args[0];
|
||||
}
|
||||
|
||||
|
@ -56,10 +64,10 @@ public class Consumer {
|
|||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
MessageConsumer consumer = session.createConsumer(destination);
|
||||
|
||||
for( ;; ) {
|
||||
for (;;) {
|
||||
System.out.println("Waiting for message.");
|
||||
Message message = consumer.receive();
|
||||
if( message == null ) {
|
||||
if (message == null) {
|
||||
break;
|
||||
}
|
||||
System.out.println("Got message: " + message);
|
||||
|
|
|
@ -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,
|
||||
|
@ -36,16 +35,20 @@ import javax.jms.TextMessage;
|
|||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
public class Producer {
|
||||
public final class Producer {
|
||||
|
||||
private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
|
||||
.getLog(Producer.class);
|
||||
private static final Log LOG = LogFactory.getLog(Producer.class);
|
||||
|
||||
private Producer() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws JMSException, InterruptedException {
|
||||
|
||||
String url = "peer://localhost1/groupA?persistent=false";
|
||||
if( args.length>0 ) {
|
||||
if (args.length > 0) {
|
||||
url = args[0];
|
||||
}
|
||||
|
||||
|
@ -58,7 +61,7 @@ public class Producer {
|
|||
TextMessage message = session.createTextMessage();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
message.setText("This is message " + (i + 1));
|
||||
log.info("Sending message: " + message.getText());
|
||||
LOG.info("Sending message: " + message.getText());
|
||||
producer.send(message);
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.activemq;
|
||||
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
|
@ -25,7 +24,7 @@ package org.apache.activemq;
|
|||
* (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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue