97 lines
3.3 KiB
Java
97 lines
3.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.baja.job.BSimpleJob
|
|
* javax.baja.sys.Context
|
|
* javax.baja.sys.Property
|
|
* javax.baja.sys.Sys
|
|
* javax.baja.sys.Type
|
|
*/
|
|
package com.tridium.platform;
|
|
|
|
import com.tridium.platform.daemon.BDaemonSession;
|
|
import com.tridium.platform.daemon.LocalSessionUtil;
|
|
import com.tridium.platform.daemon.message.DeleteStationMessage;
|
|
import javax.baja.job.BSimpleJob;
|
|
import javax.baja.sys.Context;
|
|
import javax.baja.sys.Property;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public final class BStationRenameCleanupJob
|
|
extends BSimpleJob {
|
|
public static final Property oldStationName = BStationRenameCleanupJob.newProperty((int)0, (String)"", null);
|
|
public static final Type TYPE;
|
|
static /* synthetic */ Class class$com$tridium$platform$BStationRenameCleanupJob;
|
|
|
|
public final String getOldStationName() {
|
|
return this.getString(oldStationName);
|
|
}
|
|
|
|
public final void setOldStationName(String string) {
|
|
this.setString(oldStationName, string, null);
|
|
}
|
|
|
|
public final Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
public final void stationStarted() throws Exception {
|
|
new Thread(this.getType().toString()){
|
|
|
|
public final void run() {
|
|
try {
|
|
Thread.sleep(100L);
|
|
}
|
|
catch (Exception exception) {
|
|
exception.printStackTrace();
|
|
}
|
|
BStationRenameCleanupJob.this.getParent().asComponent().remove(BStationRenameCleanupJob.this.getName());
|
|
BStationRenameCleanupJob.this.submit(null);
|
|
}
|
|
}.start();
|
|
}
|
|
|
|
public final void run(Context context) throws Exception {
|
|
BDaemonSession bDaemonSession;
|
|
this.setProgress(50);
|
|
if (!Sys.getStation().getStationName().equals(this.getOldStationName())) {
|
|
bDaemonSession = LocalSessionUtil.getLocalSession();
|
|
if (bDaemonSession == null) {
|
|
throw new Exception("Could not rename Station. Please ensure Station is running from Platform!");
|
|
}
|
|
} else {
|
|
throw new Exception("Cannot rename station; station files must locked by another process.");
|
|
}
|
|
bDaemonSession.sendMessage(new DeleteStationMessage(this.getOldStationName()));
|
|
this.log().success("Station rename from " + this.getOldStationName() + " to " + Sys.getStation().getStationName() + " complete.");
|
|
this.setProgress(100);
|
|
}
|
|
|
|
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$BStationRenameCleanupJob;
|
|
if (clazz == null) {
|
|
clazz = class$com$tridium$platform$BStationRenameCleanupJob = BStationRenameCleanupJob.class("[Lcom.tridium.platform.BStationRenameCleanupJob;", false);
|
|
}
|
|
TYPE = Sys.loadType((Class)clazz);
|
|
}
|
|
}
|
|
|