com.aspectran.daemon.command.builtins.SysInfoCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aspectran-daemon Show documentation
Show all versions of aspectran-daemon Show documentation
Package for running Aspectran-based Java applications as background processes on Unix-based or Windows operating systems
/*
* Copyright (c) 2008-2024 The Aspectran Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aspectran.daemon.command.builtins;
import com.aspectran.core.context.resource.SiblingClassLoader;
import com.aspectran.daemon.command.AbstractCommand;
import com.aspectran.daemon.command.CommandParameters;
import com.aspectran.daemon.command.CommandRegistry;
import com.aspectran.daemon.command.CommandResult;
import com.aspectran.utils.StringUtils;
import com.aspectran.utils.annotation.jsr305.NonNull;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class SysInfoCommand extends AbstractCommand {
private static final String NAMESPACE = "builtins";
private static final String COMMAND_NAME = "sysinfo";
private final CommandDescriptor descriptor = new CommandDescriptor();
public SysInfoCommand(CommandRegistry registry) {
super(registry);
}
@Override
public CommandResult execute(CommandParameters parameters) {
try {
Object[] args = parameters.getArguments();
Writer writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
Set