Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 1&1 Internet AG, https://github.com/1and1/
*
* 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 net.oneandone.stool.cli;
import net.oneandone.stool.configuration.Property;
import net.oneandone.stool.locking.Mode;
import net.oneandone.stool.stage.Stage;
import net.oneandone.stool.users.UserNotFound;
import net.oneandone.stool.util.Field;
import net.oneandone.stool.util.Info;
import net.oneandone.stool.util.LogEntry;
import net.oneandone.stool.util.Ports;
import net.oneandone.stool.util.Processes;
import net.oneandone.stool.util.Session;
import net.oneandone.stool.util.Vhost;
import net.oneandone.sushi.util.Separator;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.openmbean.CompositeData;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.NamingException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class InfoCommand extends StageCommand {
protected final List selected = new ArrayList<>();
private final String defaults;
public InfoCommand(Session session, String defaults) {
super(false, session, Mode.SHARED, Mode.SHARED,
Mode.NONE
/* this is not 100% accurate, but it help to avoid annoging lock-waits:
1) diskused might be work in progress
2) buildtime might inaccurate */);
this.defaults = defaults;
}
public void field(String str) {
selected.add(get(str));
}
private Info get(String str) {
return Info.get(session.properties(), str);
}
protected List defaults(Info ... systemDefaults) {
List result;
if (defaults.isEmpty()) {
return Arrays.asList(systemDefaults);
}
result = new ArrayList<>();
for (String name : Separator.COMMA.split(defaults)) {
result.add(get(name));
}
return result;
}
//--
public static String toString(Object value) {
boolean first;
List