link start!

This commit is contained in:
cherubin
2026-03-17 13:31:18 -07:00
commit 08abe87cfb
5910 changed files with 386288 additions and 0 deletions
@@ -0,0 +1,238 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.BSingleton
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.platform.command.BIPlatformCommand;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PushbackInputStream;
import java.util.Arrays;
import javax.baja.sys.BSingleton;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BAbstractPlatformCommand
extends BSingleton
implements BIPlatformCommand {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$command$BAbstractPlatformCommand;
public Type getType() {
return TYPE;
}
public String getLicenseVendor() {
return null;
}
public String getLicenseFeature() {
return null;
}
public boolean includeInCommandListing() {
return true;
}
protected boolean promptBoolean(String string) {
String string2 = this.promptString(string);
boolean bl = false;
if (string2.charAt(0) == 'Y' || string2.charAt(0) == 'y') {
bl = true;
}
return bl;
}
protected String promptPasswordString(String string) {
return this.promptPasswordString(string, new Filter());
}
protected String promptPasswordString(String string, Filter filter) {
try {
String string2 = null;
while (!filter.accept(string2)) {
System.out.print(string);
string2 = new String(BAbstractPlatformCommand.getPassword(System.in));
}
return string2;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
protected String promptString(String string) {
return this.promptString(string, new Filter());
}
protected String promptString(String string, Filter filter) {
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String string2 = null;
while (!filter.accept(string2)) {
System.out.print(string);
string2 = bufferedReader.readLine();
}
return string2;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
protected static void println(String string) {
System.out.println(string);
}
public static final char[] getPassword(InputStream inputStream) throws IOException {
char[] cArray;
MaskingThread maskingThread = new MaskingThread();
Thread thread = new Thread(maskingThread);
thread.start();
char[] cArray2 = cArray = new char[128];
int n = cArray2.length;
int n2 = 0;
block4: while (true) {
int n3 = inputStream.read();
switch (n3) {
case -1:
case 10: {
break block4;
}
case 13: {
int n4 = inputStream.read();
if (n4 == 10 || n4 == -1) break block4;
if (!(inputStream instanceof PushbackInputStream)) {
inputStream = new PushbackInputStream(inputStream);
}
((PushbackInputStream)inputStream).unread(n4);
}
default: {
if (--n < 0) {
cArray2 = new char[n2 + 128];
n = cArray2.length - n2 - 1;
System.arraycopy(cArray, 0, cArray2, 0, n2);
Arrays.fill(cArray, ' ');
cArray = cArray2;
}
cArray2[n2++] = (char)n3;
continue block4;
}
}
break;
}
maskingThread.stopMasking();
if (n2 == 0) {
return new char[0];
}
char[] cArray3 = new char[n2];
System.arraycopy(cArray2, 0, cArray3, 0, n2);
Arrays.fill(cArray2, ' ');
return cArray3;
}
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$BAbstractPlatformCommand;
if (clazz == null) {
clazz = class$com$tridium$platform$command$BAbstractPlatformCommand = BAbstractPlatformCommand.class("[Lcom.tridium.platform.command.BAbstractPlatformCommand;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
public static class Filter {
public boolean accept(String string) {
boolean bl = false;
if (string != null && string.length() > 0) {
bl = true;
}
return bl;
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private static class MaskingThread
extends Thread {
private volatile boolean stop;
private char echochar;
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void run() {
int n = Thread.currentThread().getPriority();
Thread.currentThread().setPriority(10);
try {
this.stop = true;
while (this.stop) {
System.out.print("\b" + this.echochar);
try {
Thread.sleep(1L);
}
catch (InterruptedException interruptedException) {
Thread.currentThread().interrupt();
Object var3_3 = null;
Thread.currentThread().setPriority(n);
return;
}
}
Object var3_5 = null;
Thread.currentThread().setPriority(n);
return;
}
catch (Throwable throwable) {
Object var3_4 = null;
Thread.currentThread().setPriority(n);
throw throwable;
}
}
public void stopMasking() {
this.stop = false;
}
private final /* synthetic */ void this() {
this.echochar = (char)32;
}
public MaskingThread() {
super("AbstractPlatformCommand:MaskingThread");
this.this();
}
}
}
@@ -0,0 +1,162 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.util.CommandLineArguments
* javax.baja.naming.BHost
* javax.baja.naming.BOrd
* javax.baja.security.AuthenticationException
* javax.baja.security.BICredentials
* javax.baja.security.BPassword
* javax.baja.security.BUsernameAndPassword
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.platform.command.BAbstractPlatformCommand;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.task.DaemonSessionTask;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import com.tridium.util.CommandLineArguments;
import java.net.ConnectException;
import javax.baja.naming.BHost;
import javax.baja.naming.BOrd;
import javax.baja.security.AuthenticationException;
import javax.baja.security.BICredentials;
import javax.baja.security.BPassword;
import javax.baja.security.BUsernameAndPassword;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BDaemonSessionCommand
extends BAbstractPlatformCommand
implements DaemonSessionTaskListener {
public static final Type TYPE;
private String lastTaskMessage;
static /* synthetic */ Class class$com$tridium$platform$command$BDaemonSessionCommand;
public Type getType() {
return TYPE;
}
/*
* Loose catch block
*/
protected BDaemonSession getSession(CommandLineArguments commandLineArguments) throws ConnectException {
BHost bHost = this.getHost(commandLineArguments);
if (bHost == null) {
return null;
}
int n = this.getPort(commandLineArguments);
BDaemonSession bDaemonSession = BDaemonSession.make(bHost, n);
BUsernameAndPassword bUsernameAndPassword = this.getCredentials(bDaemonSession, commandLineArguments);
bDaemonSession.setCredentials((BICredentials)bUsernameAndPassword);
while (true) {
try {
bDaemonSession.connect();
return bDaemonSession;
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
if (commandLineArguments.hasOption("noinput")) {
throw authenticationException;
}
BDaemonSessionCommand.println("Authentication failed");
bUsernameAndPassword = this.getCredentials(bDaemonSession, null);
bDaemonSession.setCredentials((BICredentials)bUsernameAndPassword);
continue;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
break;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
protected BHost getHost(CommandLineArguments commandLineArguments) {
String string = commandLineArguments.getOption("h");
return string == null ? null : (BHost)BOrd.make((String)string).get();
}
public int getPort(CommandLineArguments commandLineArguments) {
return commandLineArguments.getIntOption("p", 3011);
}
public BUsernameAndPassword getCredentials(BDaemonSession bDaemonSession, CommandLineArguments commandLineArguments) throws ConnectException {
String string;
String string2 = commandLineArguments == null ? null : commandLineArguments.getOption("usr");
String string3 = string = commandLineArguments == null ? null : commandLineArguments.getOption("pwd");
if (!(string2 != null || commandLineArguments != null && commandLineArguments.hasOption("noinput"))) {
string2 = this.promptString("User: ");
}
if (!(string != null || commandLineArguments != null && commandLineArguments.hasOption("noinput"))) {
string = this.promptPasswordString("Password: ");
}
if (string2 == null || string == null) {
return null;
}
BUsernameAndPassword bUsernameAndPassword = (BUsernameAndPassword)bDaemonSession.makeCredentials();
bUsernameAndPassword.setUsername(string2);
bUsernameAndPassword.setPassword(BPassword.make((String)string));
return bUsernameAndPassword;
}
public void taskStarted(DaemonSessionTask daemonSessionTask) {
if (!daemonSessionTask.getMessage().equals(this.lastTaskMessage)) {
System.out.println(daemonSessionTask.getMessage());
this.lastTaskMessage = daemonSessionTask.getMessage();
}
}
public void taskUpdated(DaemonSessionTask daemonSessionTask) {
this.taskStarted(daemonSessionTask);
}
public void taskFinished(DaemonSessionTask daemonSessionTask) {
}
public boolean isCancelEnabled() {
return false;
}
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());
}
}
private final /* synthetic */ void this() {
this.lastTaskMessage = null;
}
public BDaemonSessionCommand() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$command$BDaemonSessionCommand;
if (clazz == null) {
clazz = class$com$tridium$platform$command$BDaemonSessionCommand = BDaemonSessionCommand.class("[Lcom.tridium.platform.command.BDaemonSessionCommand;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,48 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.util.CommandLineArguments
* javax.baja.sys.BInterface
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.util.CommandLineArguments;
import javax.baja.sys.BInterface;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIPlatformCommand
extends BInterface {
public static final Type TYPE;
public static final int EXIT_SUCCESS = 0;
public static final int EXIT_FAILURE = 1;
public static final int EXIT_INVALID_USAGE = 2;
public static final int EXIT_FINISHED_WITH_ERRORS = 3;
public static final int EXIT_NO_ACTION = 4;
public void usage();
public int invoke(CommandLineArguments var1) throws Exception;
public String getCommandName();
public boolean includeInCommandListing();
public String getCommandDescription();
public String getLicenseVendor();
public String getLicenseFeature();
static {
Class clazz = 1.class$com$tridium$platform$command$BIPlatformCommand;
if (clazz == null) {
clazz = 1.class$com$tridium$platform$command$BIPlatformCommand = 1.class("[Lcom.tridium.platform.command.BIPlatformCommand;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,301 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.file.types.bog.BBogFile
* com.tridium.nre.security.Aes256PasswordManager
* com.tridium.nre.security.KeyMaterial
* com.tridium.nre.security.KeyRing
* com.tridium.nre.security.SimpleKeyRing
* com.tridium.util.CommandLineArguments
* com.tridium.util.ComponentTreeCursor
* javax.baja.file.BFileSpace
* javax.baja.file.BFileSystem
* javax.baja.file.BIFileStore
* javax.baja.file.BLocalFileStore
* javax.baja.file.FileUtil
* javax.baja.log.Log
* javax.baja.security.BPassword
* javax.baja.space.BComponentSpace
* javax.baja.sys.BComponent
* javax.baja.sys.BValue
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.file.types.bog.BBogFile;
import com.tridium.nre.security.Aes256PasswordManager;
import com.tridium.nre.security.KeyMaterial;
import com.tridium.nre.security.KeyRing;
import com.tridium.nre.security.SimpleKeyRing;
import com.tridium.platform.command.BAbstractPlatformCommand;
import com.tridium.util.CommandLineArguments;
import com.tridium.util.ComponentTreeCursor;
import java.io.File;
import javax.baja.file.BFileSpace;
import javax.baja.file.BFileSystem;
import javax.baja.file.BIFileStore;
import javax.baja.file.BLocalFileStore;
import javax.baja.file.FileUtil;
import javax.baja.log.Log;
import javax.baja.security.BPassword;
import javax.baja.space.BComponentSpace;
import javax.baja.sys.BComponent;
import javax.baja.sys.BValue;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BMakeStationPortableCommand
extends BAbstractPlatformCommand {
public static final BMakeStationPortableCommand INSTANCE = new BMakeStationPortableCommand();
public static final Type TYPE;
private static final Log log;
private KeyRing kr;
private boolean errors;
static /* synthetic */ Class class$com$tridium$platform$command$BMakeStationPortableCommand;
public Type getType() {
return TYPE;
}
public void usage() {
BMakeStationPortableCommand.println("");
BMakeStationPortableCommand.println("usage:");
BMakeStationPortableCommand.println(" plat makeportable <flags> <sourceStationDir> [target] [securityDir]");
BMakeStationPortableCommand.println("parameters:");
BMakeStationPortableCommand.println(" sourceStationDir the station directory to convert");
BMakeStationPortableCommand.println(" target the name of the target station. Defaults to the name of the source station.");
BMakeStationPortableCommand.println(" securityDir the security directory of the source station. Defaults to <sourceStationDir>/../../security");
BMakeStationPortableCommand.println("optional flags:");
BMakeStationPortableCommand.println(" -o overwrite existing destStationDir");
BMakeStationPortableCommand.println(" -locale:<x> set the default locale (en_US)");
BMakeStationPortableCommand.println(" -@<option> pass option to Java VM");
BMakeStationPortableCommand.println(" -buildreg force rebuild of the registry");
BMakeStationPortableCommand.println("");
}
public int invoke(CommandLineArguments commandLineArguments) {
if (commandLineArguments.hasHelpOption()) {
this.usage();
return 2;
}
if (commandLineArguments.parameters.length < 1) {
this.usage();
return 2;
}
String string = commandLineArguments.parameters[0];
File file = new File(string);
String string2 = commandLineArguments.parameters.length > 1 ? commandLineArguments.parameters[1] : file.getName();
File file2 = new File(Sys.getBajaHome(), "stations" + File.separator + string2);
File file3 = commandLineArguments.parameters.length > 2 ? new File(commandLineArguments.parameters[2]) : new File(file.getParentFile().getParentFile(), "security");
File file4 = new File(file3, ".km");
File file5 = new File(file3, ".kr");
if (!file.isDirectory()) {
log.error("Source directory " + file.getAbsolutePath() + " is not a directory or does not exist.");
return 2;
}
if (!file3.isDirectory()) {
log.error("Security directory " + file3.getAbsolutePath() + " is not a directory or does not exist.");
return 2;
}
if (!file4.isFile()) {
log.error("Key material file " + file4.getAbsolutePath() + " does not exist.");
return 2;
}
if (!file5.isFile()) {
log.error("Key ring file " + file5.getAbsolutePath() + " does not exist.");
return 2;
}
try {
LegacyKeyMaterial legacyKeyMaterial = new LegacyKeyMaterial(file4);
this.kr = new SimpleKeyRing(file3, ".kr", (KeyMaterial)legacyKeyMaterial);
}
catch (Exception exception) {
log.error("Could not get key ring: " + exception);
return 1;
}
if (commandLineArguments.hasOption("o")) {
try {
FileUtil.delete((File)file2);
}
catch (Exception exception) {
log.error("Could not overwrite existing destination directory: " + exception);
return 1;
}
} else if (file2.exists()) {
log.error("Destination directory " + file2.getAbsolutePath() + " already exists. Rerun with '-o' to overwrite.");
return 2;
}
log.message("Copying station directory " + file.getAbsolutePath() + " to " + file2.getAbsolutePath());
try {
FileUtil.copyDir((File)file, (File)file2);
}
catch (Exception exception) {
log.warning("Could not copy source station: " + exception);
return 1;
}
this.convertBogs(file2);
if (this.errors) {
log.message("Done with errors.");
return 3;
}
log.message("Done.");
return 0;
}
public void convertBogs(File file) {
File[] fileArray = file.listFiles();
if (fileArray != null) {
int n = 0;
while (n < fileArray.length) {
if (fileArray[n].isDirectory()) {
this.convertBogs(fileArray[n]);
} else if (fileArray[n].getName().endsWith(".bog")) {
this.convertBog(fileArray[n]);
}
++n;
}
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void convertBog(File file) {
Property[] propertyArray;
log.message("Converting bog " + file.getAbsolutePath());
BBogFile bBogFile = new BBogFile((BIFileStore)new BLocalFileStore((BFileSpace)BFileSystem.INSTANCE, BFileSystem.INSTANCE.localFileToPath(file), file));
BComponentSpace bComponentSpace = (BComponentSpace)bBogFile.open();
BComponent bComponent = bComponentSpace.getRootComponent();
ComponentTreeCursor componentTreeCursor = new ComponentTreeCursor(bComponent, null);
while (componentTreeCursor.nextComponent()) {
BComponent bComponent2 = (BComponent)componentTreeCursor.get();
propertyArray = bComponent2.getPropertiesArray();
int n = 0;
while (n < propertyArray.length) {
BPassword bPassword;
String string;
BValue bValue = bComponent2.get(propertyArray[n]);
if (bValue instanceof BPassword && (!bValue.equals((Object)propertyArray[n].getDefaultValue()) || propertyArray[n].isDynamic()) && (string = (bPassword = (BPassword)bValue).getPasswordEncoder().getEncodingType()).equals("aes256/text")) {
String string2 = bPassword.getPasswordEncoder().getEncodedValue();
int n2 = string2.indexOf(":");
String string3 = string2.substring(0, n2);
String string4 = string2.substring(n2 + 1);
try {
String string5 = Aes256PasswordManager.getManager((KeyRing)this.kr).decrypt(string4, string3);
BPassword bPassword2 = BPassword.make((String)string5);
bComponent2.set(propertyArray[n], (BValue)bPassword2);
log.trace("Converted password " + bComponent2.getSlotPathOrd() + '/' + propertyArray[n].getName());
}
catch (Exception exception) {
log.warning("Could not convert password " + bComponent2.getSlotPathOrd() + '/' + propertyArray[n].getName() + ": " + exception);
this.errors = true;
}
}
++n;
}
}
try {
try {
bBogFile.save();
}
catch (Exception exception) {
log.warning("Could not save bog " + file.getAbsolutePath() + ": " + exception);
this.errors = true;
}
propertyArray = null;
}
catch (Throwable throwable) {
propertyArray = null;
bBogFile.close();
throw throwable;
}
bBogFile.close();
}
public String getCommandName() {
return "makeportable";
}
public String getCommandDescription() {
return "Convert station to use portable encoding for reversible passwords.";
}
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());
}
}
private final /* synthetic */ void this() {
this.errors = false;
}
public BMakeStationPortableCommand() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$command$BMakeStationPortableCommand;
if (clazz == null) {
clazz = class$com$tridium$platform$command$BMakeStationPortableCommand = BMakeStationPortableCommand.class("[Lcom.tridium.platform.command.BMakeStationPortableCommand;", false);
}
TYPE = Sys.loadType((Class)clazz);
log = Log.getLog((String)"makeportable");
}
private static class LegacyKeyMaterial
extends KeyMaterial {
File kmFile;
/*
* Exception decompiling
*/
public byte[] getKeyMaterial() throws Exception {
/*
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
*
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 1[TRYBLOCK] [1 : 117->120)] java.lang.Throwable
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
* at org.benf.cfr.reader.entities.ClassFile.analyseInnerClassesPass1(ClassFile.java:923)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1035)
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
* at org.benf.cfr.reader.Main.main(Main.java:54)
*/
throw new IllegalStateException("Decompilation failed");
}
public void setKeyMaterial(byte[] byArray) throws Exception {
throw new UnsupportedOperationException();
}
private LegacyKeyMaterial(File file) {
this.kmFile = file;
}
}
}
@@ -0,0 +1,186 @@
/*
* 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;
}
}
@@ -0,0 +1,208 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.util.CommandLineArguments
* javax.baja.file.BFileSystem
* javax.baja.file.FilePath
* javax.baja.nre.util.TextUtil
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.platform.command.BAbstractPlatformCommand;
import com.tridium.platform.command.BPlat;
import com.tridium.util.CommandLineArguments;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import javax.baja.file.BFileSystem;
import javax.baja.file.FilePath;
import javax.baja.nre.util.TextUtil;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatformCommandScript
extends BAbstractPlatformCommand {
public static final BPlatformCommandScript INSTANCE = new BPlatformCommandScript();
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$command$BPlatformCommandScript;
public Type getType() {
return TYPE;
}
public String getCommandName() {
return "script";
}
public String getCommandDescription() {
return "run one or more platform commands in a script";
}
public void usage() {
BPlatformCommandScript.println("usage:");
BPlatformCommandScript.println(" plat script <flags>");
BPlatformCommandScript.println("optional flags:");
BPlatformCommandScript.println(" -f:<filePath> reads the script from the given file, instead");
BPlatformCommandScript.println(" of from standard input");
BPlatformCommandScript.println(" -echo echo commands read from the script");
BPlatformCommandScript.println(" -usage prints this message");
BPlatformCommandScript.println(" -? same as -usage");
BPlatformCommandScript.println(" -help same as -usage");
BPlatformCommandScript.println(" -locale:<x> set the default locale (en_US)");
BPlatformCommandScript.println(" -@<option> pass option to Java VM");
BPlatformCommandScript.println(" -buildreg force rebuild of the registry");
BPlatformCommandScript.println("");
}
public void help() {
BPlatformCommandScript.println("Script commands:");
BPlatformCommandScript.println(" quit");
BPlatformCommandScript.println(" Quit this program");
BPlatformCommandScript.println(" help");
BPlatformCommandScript.println(" Display this help message");
BPlatformCommandScript.println(" option -<optName>:<optVal>*");
BPlatformCommandScript.println(" Set the default value for the given command option(s)");
BPlatformCommandScript.println(" removeopt -<optName>");
BPlatformCommandScript.println(" Remove a default option value previously set with 'option'");
BPlatformCommandScript.println(" showoptions");
BPlatformCommandScript.println(" Show all default option values");
BPlatformCommandScript.println(" <command> <commandopts>");
BPlatformCommandScript.println(" Execute one of the platform commands listed below");
BPlatformCommandScript.println("Platform commands:");
BPlat.commands();
}
public int invoke(CommandLineArguments commandLineArguments) throws Exception {
String string;
BufferedReader bufferedReader;
Object object;
boolean bl = false;
boolean bl2 = commandLineArguments.hasOption("echo");
if (commandLineArguments.hasHelpOption()) {
this.usage();
return 0;
}
if (commandLineArguments.hasOption("f")) {
object = BFileSystem.INSTANCE.findFile(new FilePath(commandLineArguments.getOption("f")));
if (object == null) {
System.out.println("File not found");
return 1;
}
bufferedReader = new BufferedReader(new InputStreamReader(object.getInputStream()));
} else {
bufferedReader = new BufferedReader(new InputStreamReader(System.in));
bl = true;
}
object = new HashMap();
int n = 0;
while (n < commandLineArguments.options.length) {
if (!commandLineArguments.options[n].equals("f")) {
((HashMap)object).put(commandLineArguments.options[n], commandLineArguments.optionValues[n]);
}
++n;
}
if (bl) {
System.out.println("Type 'quit' to exit, 'help' for instructions");
System.out.print("> ");
}
while ((string = bufferedReader.readLine()) != null) {
String string2;
if (bl2) {
System.out.println(string);
}
string = string.trim();
CommandLineArguments commandLineArguments2 = new CommandLineArguments(TextUtil.splitAndTrim((String)string, (char)' '));
while (commandLineArguments2.parameters.length == 0 || commandLineArguments2.parameters[0].equals("plat")) {
if (commandLineArguments2.parameters.length <= 0) continue;
string = string.substring(5).trim();
commandLineArguments2 = new CommandLineArguments(TextUtil.splitAndTrim((String)string, (char)' '));
}
if (commandLineArguments2.parameters.length == 0 || commandLineArguments2.parameters[0].trim().length() == 0) {
if (commandLineArguments2.options.length > 0) {
this.help();
}
if (!bl) continue;
System.out.print("> ");
continue;
}
if (commandLineArguments2.parameters[0].equals("quit")) break;
if (commandLineArguments2.parameters[0].equals("help")) {
this.help();
if (!bl) continue;
System.out.print("> ");
continue;
}
if (commandLineArguments2.parameters[0].equals("option")) {
int n2 = 0;
while (n2 < commandLineArguments2.options.length) {
((HashMap)object).put(commandLineArguments2.options[n2], commandLineArguments2.optionValues[n2]);
++n2;
}
if (!bl) continue;
System.out.print("> ");
continue;
}
if (commandLineArguments2.parameters[0].equals("removeopt")) {
int n3 = 0;
while (n3 < commandLineArguments2.options.length) {
((HashMap)object).remove(commandLineArguments2.options[n3]);
++n3;
}
if (!bl) continue;
System.out.print("> ");
continue;
}
if (commandLineArguments2.parameters[0].equals("showoptions")) {
System.out.println("Default options:");
Iterator iterator = ((HashMap)object).keySet().iterator();
while (iterator.hasNext()) {
string2 = (String)iterator.next();
System.out.println(" " + string2 + ':' + ((HashMap)object).get(string2));
}
if (!bl) continue;
System.out.print("> ");
continue;
}
Iterator iterator = ((HashMap)object).keySet().iterator();
while (iterator.hasNext()) {
string2 = (String)iterator.next();
if (commandLineArguments2.hasOption(string2)) continue;
string = string + " -" + string2 + ':' + ((HashMap)object).get(string2);
}
BPlat.parse(string);
if (!bl) continue;
System.out.print("> ");
}
bufferedReader.close();
return 0;
}
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$BPlatformCommandScript;
if (clazz == null) {
clazz = class$com$tridium$platform$command$BPlatformCommandScript = BPlatformCommandScript.class("[Lcom.tridium.platform.command.BPlatformCommandScript;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}