|
|
|
@ -9,6 +9,7 @@ import com.taobao.arthas.core.command.basic1000.HelpCommand;
|
|
|
|
|
import com.taobao.arthas.core.command.basic1000.HistoryCommand;
|
|
|
|
|
import com.taobao.arthas.core.command.basic1000.KeymapCommand;
|
|
|
|
|
import com.taobao.arthas.core.command.basic1000.OptionsCommand;
|
|
|
|
|
import com.alibaba.bytekit.utils.AnnotationUtils;
|
|
|
|
|
import com.taobao.arthas.core.command.basic1000.AuthCommand;
|
|
|
|
|
import com.taobao.arthas.core.command.basic1000.PwdCommand;
|
|
|
|
|
import com.taobao.arthas.core.command.basic1000.ResetCommand;
|
|
|
|
@ -46,8 +47,10 @@ import com.taobao.arthas.core.command.monitor200.TimeTunnelCommand;
|
|
|
|
|
import com.taobao.arthas.core.command.monitor200.TraceCommand;
|
|
|
|
|
import com.taobao.arthas.core.command.monitor200.VmToolCommand;
|
|
|
|
|
import com.taobao.arthas.core.command.monitor200.WatchCommand;
|
|
|
|
|
import com.taobao.arthas.core.shell.command.AnnotatedCommand;
|
|
|
|
|
import com.taobao.arthas.core.shell.command.Command;
|
|
|
|
|
import com.taobao.arthas.core.shell.command.CommandResolver;
|
|
|
|
|
import com.taobao.middleware.cli.annotations.Name;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -58,10 +61,10 @@ import java.util.List;
|
|
|
|
|
*/
|
|
|
|
|
public class BuiltinCommandPack implements CommandResolver {
|
|
|
|
|
|
|
|
|
|
private static List<Command> commands = new ArrayList<Command>();
|
|
|
|
|
private List<Command> commands = new ArrayList<Command>();
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
initCommands();
|
|
|
|
|
public BuiltinCommandPack(List<String> disabledCommands) {
|
|
|
|
|
initCommands(disabledCommands);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -69,53 +72,64 @@ public class BuiltinCommandPack implements CommandResolver {
|
|
|
|
|
return commands;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void initCommands() {
|
|
|
|
|
commands.add(Command.create(HelpCommand.class));
|
|
|
|
|
commands.add(Command.create(AuthCommand.class));
|
|
|
|
|
commands.add(Command.create(KeymapCommand.class));
|
|
|
|
|
commands.add(Command.create(SearchClassCommand.class));
|
|
|
|
|
commands.add(Command.create(SearchMethodCommand.class));
|
|
|
|
|
commands.add(Command.create(ClassLoaderCommand.class));
|
|
|
|
|
commands.add(Command.create(JadCommand.class));
|
|
|
|
|
commands.add(Command.create(GetStaticCommand.class));
|
|
|
|
|
commands.add(Command.create(MonitorCommand.class));
|
|
|
|
|
commands.add(Command.create(StackCommand.class));
|
|
|
|
|
commands.add(Command.create(ThreadCommand.class));
|
|
|
|
|
commands.add(Command.create(TraceCommand.class));
|
|
|
|
|
commands.add(Command.create(WatchCommand.class));
|
|
|
|
|
commands.add(Command.create(TimeTunnelCommand.class));
|
|
|
|
|
commands.add(Command.create(JvmCommand.class));
|
|
|
|
|
commands.add(Command.create(PerfCounterCommand.class));
|
|
|
|
|
// commands.add(Command.create(GroovyScriptCommand.class));
|
|
|
|
|
commands.add(Command.create(OgnlCommand.class));
|
|
|
|
|
commands.add(Command.create(MemoryCompilerCommand.class));
|
|
|
|
|
commands.add(Command.create(RedefineCommand.class));
|
|
|
|
|
commands.add(Command.create(RetransformCommand.class));
|
|
|
|
|
commands.add(Command.create(DashboardCommand.class));
|
|
|
|
|
commands.add(Command.create(DumpClassCommand.class));
|
|
|
|
|
commands.add(Command.create(HeapDumpCommand.class));
|
|
|
|
|
commands.add(Command.create(JulyCommand.class));
|
|
|
|
|
commands.add(Command.create(ThanksCommand.class));
|
|
|
|
|
commands.add(Command.create(OptionsCommand.class));
|
|
|
|
|
commands.add(Command.create(ClsCommand.class));
|
|
|
|
|
commands.add(Command.create(ResetCommand.class));
|
|
|
|
|
commands.add(Command.create(VersionCommand.class));
|
|
|
|
|
commands.add(Command.create(SessionCommand.class));
|
|
|
|
|
commands.add(Command.create(SystemPropertyCommand.class));
|
|
|
|
|
commands.add(Command.create(SystemEnvCommand.class));
|
|
|
|
|
commands.add(Command.create(VMOptionCommand.class));
|
|
|
|
|
commands.add(Command.create(LoggerCommand.class));
|
|
|
|
|
commands.add(Command.create(HistoryCommand.class));
|
|
|
|
|
commands.add(Command.create(CatCommand.class));
|
|
|
|
|
commands.add(Command.create(Base64Command.class));
|
|
|
|
|
commands.add(Command.create(EchoCommand.class));
|
|
|
|
|
commands.add(Command.create(PwdCommand.class));
|
|
|
|
|
commands.add(Command.create(MBeanCommand.class));
|
|
|
|
|
commands.add(Command.create(GrepCommand.class));
|
|
|
|
|
commands.add(Command.create(TeeCommand.class));
|
|
|
|
|
commands.add(Command.create(ProfilerCommand.class));
|
|
|
|
|
commands.add(Command.create(VmToolCommand.class));
|
|
|
|
|
commands.add(Command.create(ShutdownCommand.class));
|
|
|
|
|
commands.add(Command.create(StopCommand.class));
|
|
|
|
|
private void initCommands(List<String> disabledCommands) {
|
|
|
|
|
List<Class<? extends AnnotatedCommand>> commandClassList = new ArrayList<Class<? extends AnnotatedCommand>>(32);
|
|
|
|
|
commandClassList.add(HelpCommand.class);
|
|
|
|
|
commandClassList.add(AuthCommand.class);
|
|
|
|
|
commandClassList.add(KeymapCommand.class);
|
|
|
|
|
commandClassList.add(SearchClassCommand.class);
|
|
|
|
|
commandClassList.add(SearchMethodCommand.class);
|
|
|
|
|
commandClassList.add(ClassLoaderCommand.class);
|
|
|
|
|
commandClassList.add(JadCommand.class);
|
|
|
|
|
commandClassList.add(GetStaticCommand.class);
|
|
|
|
|
commandClassList.add(MonitorCommand.class);
|
|
|
|
|
commandClassList.add(StackCommand.class);
|
|
|
|
|
commandClassList.add(ThreadCommand.class);
|
|
|
|
|
commandClassList.add(TraceCommand.class);
|
|
|
|
|
commandClassList.add(WatchCommand.class);
|
|
|
|
|
commandClassList.add(TimeTunnelCommand.class);
|
|
|
|
|
commandClassList.add(JvmCommand.class);
|
|
|
|
|
commandClassList.add(PerfCounterCommand.class);
|
|
|
|
|
// commandClassList.add(GroovyScriptCommand.class);
|
|
|
|
|
commandClassList.add(OgnlCommand.class);
|
|
|
|
|
commandClassList.add(MemoryCompilerCommand.class);
|
|
|
|
|
commandClassList.add(RedefineCommand.class);
|
|
|
|
|
commandClassList.add(RetransformCommand.class);
|
|
|
|
|
commandClassList.add(DashboardCommand.class);
|
|
|
|
|
commandClassList.add(DumpClassCommand.class);
|
|
|
|
|
commandClassList.add(HeapDumpCommand.class);
|
|
|
|
|
commandClassList.add(JulyCommand.class);
|
|
|
|
|
commandClassList.add(ThanksCommand.class);
|
|
|
|
|
commandClassList.add(OptionsCommand.class);
|
|
|
|
|
commandClassList.add(ClsCommand.class);
|
|
|
|
|
commandClassList.add(ResetCommand.class);
|
|
|
|
|
commandClassList.add(VersionCommand.class);
|
|
|
|
|
commandClassList.add(SessionCommand.class);
|
|
|
|
|
commandClassList.add(SystemPropertyCommand.class);
|
|
|
|
|
commandClassList.add(SystemEnvCommand.class);
|
|
|
|
|
commandClassList.add(VMOptionCommand.class);
|
|
|
|
|
commandClassList.add(LoggerCommand.class);
|
|
|
|
|
commandClassList.add(HistoryCommand.class);
|
|
|
|
|
commandClassList.add(CatCommand.class);
|
|
|
|
|
commandClassList.add(Base64Command.class);
|
|
|
|
|
commandClassList.add(EchoCommand.class);
|
|
|
|
|
commandClassList.add(PwdCommand.class);
|
|
|
|
|
commandClassList.add(MBeanCommand.class);
|
|
|
|
|
commandClassList.add(GrepCommand.class);
|
|
|
|
|
commandClassList.add(TeeCommand.class);
|
|
|
|
|
commandClassList.add(ProfilerCommand.class);
|
|
|
|
|
commandClassList.add(VmToolCommand.class);
|
|
|
|
|
commandClassList.add(ShutdownCommand.class);
|
|
|
|
|
commandClassList.add(StopCommand.class);
|
|
|
|
|
|
|
|
|
|
for (Class<? extends AnnotatedCommand> clazz : commandClassList) {
|
|
|
|
|
Name name = clazz.getAnnotation(Name.class);
|
|
|
|
|
if (name != null && name.value() != null) {
|
|
|
|
|
if (disabledCommands.contains(name.value())) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
commands.add(Command.create(clazz));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|