187 lines
6.9 KiB
Java
187 lines
6.9 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.tridium.sys.Nre
|
|
* com.tridium.util.CommandLineArguments
|
|
* javax.baja.license.FeatureNotLicensedException
|
|
* javax.baja.license.LicenseDatabaseException
|
|
* javax.baja.nre.util.TextUtil
|
|
* javax.baja.registry.TypeInfo
|
|
* javax.baja.sys.BObject
|
|
* javax.baja.sys.Sys
|
|
* javax.baja.sys.Type
|
|
*/
|
|
package com.tridium.platform.command;
|
|
|
|
import com.tridium.platform.command.BIPlatformCommand;
|
|
import com.tridium.sys.Nre;
|
|
import com.tridium.util.CommandLineArguments;
|
|
import java.util.Comparator;
|
|
import java.util.TreeSet;
|
|
import javax.baja.license.FeatureNotLicensedException;
|
|
import javax.baja.license.LicenseDatabaseException;
|
|
import javax.baja.nre.util.TextUtil;
|
|
import javax.baja.registry.TypeInfo;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class BPlat
|
|
extends BObject {
|
|
public static final Type TYPE;
|
|
private static BIPlatformCommand[] licensedCommands;
|
|
static /* synthetic */ Class class$com$tridium$platform$command$BPlat;
|
|
|
|
public Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
public static void commands() {
|
|
BIPlatformCommand[] bIPlatformCommandArray = BPlat.getLicensedCommands();
|
|
int n = 0;
|
|
while (n < bIPlatformCommandArray.length) {
|
|
if (bIPlatformCommandArray[n].includeInCommandListing()) {
|
|
BPlat.println(" " + bIPlatformCommandArray[n].getCommandName());
|
|
BPlat.println(" " + bIPlatformCommandArray[n].getCommandDescription());
|
|
}
|
|
++n;
|
|
}
|
|
BPlat.println(" installdaemon");
|
|
BPlat.println(" install the Niagara Platform service (Win32 only)");
|
|
BPlat.println(" uninstalldaemon");
|
|
BPlat.println(" remove the Niagara Platform service (Win32 only)");
|
|
BPlat.println(" stopdaemon");
|
|
BPlat.println(" stop the Niagara Platform service (Win32 only)");
|
|
BPlat.println(" restartdaemon");
|
|
BPlat.println(" restart the Niagara Platform service (Win32 only)");
|
|
}
|
|
|
|
public static void usage() {
|
|
if (Nre.args.parameters.length < 2) {
|
|
BPlat.showUsage();
|
|
return;
|
|
}
|
|
BIPlatformCommand[] bIPlatformCommandArray = BPlat.getLicensedCommands();
|
|
int n = 0;
|
|
while (n < bIPlatformCommandArray.length) {
|
|
if (Nre.args.parameters[1].equals(bIPlatformCommandArray[n].getCommandName())) {
|
|
bIPlatformCommandArray[n].usage();
|
|
return;
|
|
}
|
|
++n;
|
|
}
|
|
BPlat.showUsage();
|
|
}
|
|
|
|
private static final void showUsage() {
|
|
BPlat.println("");
|
|
BPlat.println("usage:");
|
|
BPlat.println(" plat <command> <flags> <command-flags>");
|
|
BPlat.println("commands:");
|
|
BPlat.commands();
|
|
BPlat.println("optional flags:");
|
|
BPlat.println(" -usage plat -usage prints this message");
|
|
BPlat.println(" plat <command> -usage prints command");
|
|
BPlat.println(" specific usage");
|
|
BPlat.println(" -? same as -usage");
|
|
BPlat.println(" -help same as -usage");
|
|
BPlat.println(" -locale:<x> set the default locale (en_US)");
|
|
BPlat.println(" -@<option> pass option to Java VM");
|
|
BPlat.println(" -buildreg force rebuild of the registry");
|
|
BPlat.println("");
|
|
}
|
|
|
|
private static final BIPlatformCommand[] getLicensedCommands() {
|
|
if (licensedCommands == null) {
|
|
TreeSet<BIPlatformCommand> treeSet = new TreeSet<BIPlatformCommand>(new Comparator(){
|
|
|
|
public final int compare(Object object, Object object2) {
|
|
return ((BIPlatformCommand)object).getCommandName().compareTo(((BIPlatformCommand)object2).getCommandName());
|
|
}
|
|
});
|
|
TypeInfo[] typeInfoArray = Sys.getRegistry().getConcreteTypes(BIPlatformCommand.TYPE.getTypeInfo());
|
|
int n = 0;
|
|
while (n < typeInfoArray.length) {
|
|
BIPlatformCommand bIPlatformCommand = (BIPlatformCommand)typeInfoArray[n].getInstance();
|
|
try {
|
|
if (bIPlatformCommand.getLicenseVendor() != null && bIPlatformCommand.getLicenseFeature() != null) {
|
|
Sys.getLicenseManager().checkFeature(bIPlatformCommand.getLicenseVendor(), bIPlatformCommand.getLicenseFeature());
|
|
}
|
|
treeSet.add(bIPlatformCommand);
|
|
}
|
|
catch (FeatureNotLicensedException featureNotLicensedException) {
|
|
}
|
|
catch (LicenseDatabaseException licenseDatabaseException) {}
|
|
++n;
|
|
}
|
|
licensedCommands = new BIPlatformCommand[treeSet.size()];
|
|
treeSet.toArray(licensedCommands);
|
|
}
|
|
return licensedCommands;
|
|
}
|
|
|
|
public static int parse(String string) {
|
|
return BPlat.parse(TextUtil.splitAndTrim((String)string, (char)' '));
|
|
}
|
|
|
|
public static int parse(String[] stringArray) {
|
|
try {
|
|
if (stringArray.length == 0) {
|
|
BPlat.showUsage();
|
|
return 2;
|
|
}
|
|
BIPlatformCommand[] bIPlatformCommandArray = BPlat.getLicensedCommands();
|
|
int n = 0;
|
|
while (n < bIPlatformCommandArray.length) {
|
|
if (stringArray[0].equals(bIPlatformCommandArray[n].getCommandName())) {
|
|
String[] stringArray2 = new String[stringArray.length - 1];
|
|
System.arraycopy(stringArray, 1, stringArray2, 0, stringArray.length - 1);
|
|
return bIPlatformCommandArray[n].invoke(new CommandLineArguments(stringArray2));
|
|
}
|
|
++n;
|
|
}
|
|
BPlat.showUsage();
|
|
return 2;
|
|
}
|
|
catch (Throwable throwable) {
|
|
throwable.printStackTrace();
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public static void main(String[] stringArray) {
|
|
System.exit(BPlat.parse(stringArray));
|
|
}
|
|
|
|
static void println(String string) {
|
|
System.out.println(string);
|
|
}
|
|
|
|
static /* synthetic */ Class class(String string, boolean bl) {
|
|
try {
|
|
Class<?> clazz = Class.forName(string);
|
|
if (!bl) {
|
|
clazz = clazz.getComponentType();
|
|
}
|
|
return clazz;
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
|
|
static {
|
|
Class clazz = class$com$tridium$platform$command$BPlat;
|
|
if (clazz == null) {
|
|
clazz = class$com$tridium$platform$command$BPlat = BPlat.class("[Lcom.tridium.platform.command.BPlat;", false);
|
|
}
|
|
TYPE = Sys.loadType((Class)clazz);
|
|
licensedCommands = null;
|
|
}
|
|
}
|
|
|