link start!
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BFrozenEnum
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BCacheAccessPolicy
|
||||
extends BFrozenEnum {
|
||||
public static final int LAZY_FETCH = 0;
|
||||
public static final int CACHE_ONLY = 1;
|
||||
public static final int FORCE_FETCH = 2;
|
||||
public static final BCacheAccessPolicy lazyFetch = new BCacheAccessPolicy(0);
|
||||
public static final BCacheAccessPolicy cacheOnly = new BCacheAccessPolicy(1);
|
||||
public static final BCacheAccessPolicy forceFetch = new BCacheAccessPolicy(2);
|
||||
public static final Type TYPE;
|
||||
public static final BCacheAccessPolicy DEFAULT;
|
||||
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BCacheAccessPolicy;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BCacheAccessPolicy make(int n) {
|
||||
return (BCacheAccessPolicy)lazyFetch.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BCacheAccessPolicy make(String string) {
|
||||
return (BCacheAccessPolicy)lazyFetch.getRange().get(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());
|
||||
}
|
||||
}
|
||||
|
||||
private BCacheAccessPolicy(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$daemon$file$BCacheAccessPolicy;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$daemon$file$BCacheAccessPolicy = BCacheAccessPolicy.class("[Lcom.tridium.platform.daemon.file.BCacheAccessPolicy;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
DEFAULT = lazyFetch;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BAbstractFileStore
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import com.tridium.platform.daemon.BDaemonSession;
|
||||
import com.tridium.platform.daemon.DaemonFileUtil;
|
||||
import com.tridium.platform.daemon.PlatformOperationListener;
|
||||
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
|
||||
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
|
||||
import com.tridium.platform.daemon.file.BDaemonFileSpace;
|
||||
import com.tridium.platform.daemon.file.BDaemonFileStore;
|
||||
import com.tridium.platform.daemon.file.FileHeaderInfo;
|
||||
import com.tridium.platform.daemon.file.StoreCache;
|
||||
import com.tridium.platform.daemon.message.FileHeaderMessage;
|
||||
import com.tridium.platform.daemon.message.FileTransferMessage;
|
||||
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
|
||||
import java.io.IOException;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.platform.ICancelHint;
|
||||
import javax.baja.platform.IPlatformOperationListener;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BCachedDaemonFileSpace
|
||||
extends BDaemonFileSpace {
|
||||
public static final Type TYPE;
|
||||
private BDaemonSession session;
|
||||
private boolean recurseDirs;
|
||||
private boolean getCrcs;
|
||||
private boolean getLocalPaths;
|
||||
private StoreCache cache;
|
||||
private ICancelHint cancelHint;
|
||||
private DaemonSessionTaskListener taskListener;
|
||||
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BCachedDaemonFileSpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BDaemonSession getDaemonSession() {
|
||||
return this.session;
|
||||
}
|
||||
|
||||
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
|
||||
int n = this.cache.getCacheStatus(filePath);
|
||||
if (n == 1) {
|
||||
return this.createDir(filePath, context);
|
||||
}
|
||||
if (n == 0) {
|
||||
return new BDirectory(this.cache.getStore(filePath));
|
||||
}
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, filePath, this.recurseDirs, this.getCrcs, this.getLocalPaths, this.cache);
|
||||
if (bDaemonDirectoryStore == null) {
|
||||
return this.createDir(filePath, context);
|
||||
}
|
||||
return new BDirectory((BIFileStore)bDaemonDirectoryStore);
|
||||
}
|
||||
|
||||
private final BDirectory createDir(FilePath filePath, Context context) throws IOException {
|
||||
this.cache.clear(filePath);
|
||||
try {
|
||||
DaemonFileUtil.transfer(this.getDaemonSession(), FileTransferMessage.makeMkDir(filePath, this), this.cancelHint, this.taskListener);
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, filePath, this.recurseDirs, this.getCrcs, this.getLocalPaths, this.cache);
|
||||
return bDaemonDirectoryStore == null ? null : new BDirectory((BIFileStore)bDaemonDirectoryStore);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
|
||||
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
|
||||
}
|
||||
|
||||
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
|
||||
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
|
||||
}
|
||||
|
||||
public void delete(FilePath filePath, Context context) throws IOException {
|
||||
this.cache.clear(filePath);
|
||||
try {
|
||||
DaemonFileUtil.transfer(this.getDaemonSession(), FileTransferMessage.makeDelete(filePath, this), this.cancelHint, this.taskListener);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFile getChild(BIFile bIFile, String string) {
|
||||
return this.getChild(bIFile, string, BCacheAccessPolicy.lazyFetch);
|
||||
}
|
||||
|
||||
public BIFile[] getChildren(BIFile bIFile) {
|
||||
return this.getChildren(bIFile, BCacheAccessPolicy.lazyFetch);
|
||||
}
|
||||
|
||||
public BIFile findFile(FilePath filePath) {
|
||||
return this.findFile(filePath, BCacheAccessPolicy.lazyFetch);
|
||||
}
|
||||
|
||||
public BIFileStore findStore(FilePath filePath) {
|
||||
return this.findStore(filePath, BCacheAccessPolicy.lazyFetch);
|
||||
}
|
||||
|
||||
public BIFileStore findStore(FilePath filePath, BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
try {
|
||||
BAbstractFileStore bAbstractFileStore;
|
||||
int n = bCacheAccessPolicy == BCacheAccessPolicy.forceFetch ? 2 : this.cache.getCacheStatus(filePath);
|
||||
if (n == 1) {
|
||||
return null;
|
||||
}
|
||||
if (n == 0) {
|
||||
return this.cache.getStore(filePath);
|
||||
}
|
||||
if (bCacheAccessPolicy == BCacheAccessPolicy.cacheOnly) {
|
||||
return null;
|
||||
}
|
||||
FileHeaderInfo fileHeaderInfo = DaemonFileUtil.getFileHeaderInfo(this.getDaemonSession(), new FileHeaderMessage(filePath, this));
|
||||
if (fileHeaderInfo == null) {
|
||||
if (this.cache != null) {
|
||||
this.cache.cacheNotFound(filePath);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (fileHeaderInfo.isDirectory()) {
|
||||
bAbstractFileStore = BDaemonDirectoryStore.make(this, filePath, this.recurseDirs, this.getCrcs, this.getLocalPaths, this.cache);
|
||||
} else if (filePath.depth() == 1 || !this.getCrcs) {
|
||||
bAbstractFileStore = new BDaemonFileStore(this, filePath, fileHeaderInfo.getContentLength(), -1);
|
||||
if (this.cache != null) {
|
||||
this.cache.cacheResult((BIFileStore)bAbstractFileStore);
|
||||
}
|
||||
} else {
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, filePath.getParent(), this.recurseDirs, true, this.getLocalPaths, this.cache);
|
||||
if (bDaemonDirectoryStore == null) {
|
||||
bAbstractFileStore = new BDaemonFileStore(this, filePath, fileHeaderInfo.getContentLength(), -1);
|
||||
if (this.cache != null) {
|
||||
this.cache.cacheResult((BIFileStore)bAbstractFileStore);
|
||||
}
|
||||
} else {
|
||||
bAbstractFileStore = bDaemonDirectoryStore.getChild(filePath.getName());
|
||||
}
|
||||
}
|
||||
return bAbstractFileStore;
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFile getChild(BIFile bIFile, String string, BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
if (bIFile.isDirectory()) {
|
||||
BIFileStore bIFileStore = null;
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = (BDaemonDirectoryStore)bIFile.getStore();
|
||||
bIFileStore = bDaemonDirectoryStore.getChild(string, bCacheAccessPolicy);
|
||||
return bIFileStore == null ? null : this.makeFile(bIFileStore);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BIFile[] getChildren(BIFile bIFile, BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
if (bIFile.isDirectory()) {
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = (BDaemonDirectoryStore)bIFile.getStore();
|
||||
Array array = bDaemonDirectoryStore.getChildren(bCacheAccessPolicy);
|
||||
BIFile[] bIFileArray = new BIFile[array.size()];
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
bIFileArray[n] = this.makeFile((BIFileStore)array.get(n));
|
||||
++n;
|
||||
}
|
||||
return bIFileArray;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BIFile findFile(FilePath filePath, BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
try {
|
||||
BIFileStore bIFileStore = this.findStore(filePath, bCacheAccessPolicy);
|
||||
if (bIFileStore == null) {
|
||||
return null;
|
||||
}
|
||||
if (bIFileStore instanceof BDaemonDirectoryStore) {
|
||||
return new BDirectory(bIFileStore);
|
||||
}
|
||||
return this.makeFile(bIFileStore);
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public StoreCache getCache() {
|
||||
return this.cache;
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
public BCachedDaemonFileSpace(BDaemonSession bDaemonSession, boolean bl, boolean bl2, boolean bl3, IPlatformOperationListener iPlatformOperationListener) {
|
||||
this.session = bDaemonSession;
|
||||
this.recurseDirs = bl;
|
||||
this.getCrcs = bl2;
|
||||
this.getLocalPaths = bl3;
|
||||
this.cache = new StoreCache();
|
||||
this.cancelHint = new PlatformOperationListener(iPlatformOperationListener);
|
||||
this.taskListener = (DaemonSessionTaskListener)((Object)this.cancelHint);
|
||||
}
|
||||
|
||||
public BCachedDaemonFileSpace(BDaemonSession bDaemonSession, boolean bl, boolean bl2, boolean bl3) {
|
||||
this(bDaemonSession, bl, bl2, bl3, null, null);
|
||||
}
|
||||
|
||||
public BCachedDaemonFileSpace(BDaemonSession bDaemonSession, boolean bl, boolean bl2, boolean bl3, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) {
|
||||
this.session = bDaemonSession;
|
||||
this.recurseDirs = bl;
|
||||
this.getCrcs = bl2;
|
||||
this.getLocalPaths = bl3;
|
||||
this.cache = new StoreCache();
|
||||
this.cancelHint = iCancelHint;
|
||||
this.taskListener = daemonSessionTaskListener;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$daemon$file$BCachedDaemonFileSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$daemon$file$BCachedDaemonFileSpace = BCachedDaemonFileSpace.class("[Lcom.tridium.platform.daemon.file.BCachedDaemonFileSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BAbstractFileStore
|
||||
* javax.baja.file.BFileSpace
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.SyntaxException
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.security.AuthenticationException
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.xml.XElem
|
||||
* javax.baja.xml.XParser
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import com.tridium.platform.daemon.BDaemonSession;
|
||||
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
|
||||
import com.tridium.platform.daemon.file.BDaemonFileSpace;
|
||||
import com.tridium.platform.daemon.file.BDaemonFileStore;
|
||||
import com.tridium.platform.daemon.file.StoreCache;
|
||||
import com.tridium.platform.daemon.message.DaemonMessage;
|
||||
import com.tridium.platform.daemon.message.GetDirectoryMessage;
|
||||
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
|
||||
import java.io.InputStream;
|
||||
import java.net.ConnectException;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.SyntaxException;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.security.AuthenticationException;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.xml.XElem;
|
||||
import javax.baja.xml.XParser;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BDaemonDirectoryStore
|
||||
extends BAbstractFileStore {
|
||||
public static final Type TYPE;
|
||||
private String fileUri;
|
||||
private XElem element;
|
||||
private boolean recurseDir;
|
||||
private boolean sendCrc;
|
||||
private boolean sendLocalPath;
|
||||
private StoreCache cache;
|
||||
private FilePath altPath;
|
||||
private Array children;
|
||||
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BDaemonDirectoryStore;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BDaemonDirectoryStore make(BDaemonFileSpace bDaemonFileSpace, FilePath filePath) throws ConnectException, SecurityException {
|
||||
return BDaemonDirectoryStore.make(bDaemonFileSpace, filePath, false, false, true, null);
|
||||
}
|
||||
|
||||
public static BDaemonDirectoryStore make(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, StoreCache storeCache) throws ConnectException, SecurityException {
|
||||
return BDaemonDirectoryStore.make(bDaemonFileSpace, filePath, false, false, true, storeCache);
|
||||
}
|
||||
|
||||
public static BDaemonDirectoryStore make(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, boolean bl, boolean bl2, boolean bl3, StoreCache storeCache) throws ConnectException, SecurityException {
|
||||
return BDaemonDirectoryStore.make(bDaemonFileSpace, filePath, bl, bl2, bl3, storeCache, BDaemonSession.DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
public static BDaemonDirectoryStore make(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, boolean bl, boolean bl2, boolean bl3, StoreCache storeCache, int n) throws ConnectException, SecurityException {
|
||||
XElem xElem;
|
||||
FilePath filePath2 = bDaemonFileSpace.getAltPath(filePath);
|
||||
if (storeCache != null) {
|
||||
int n2 = storeCache.getCacheStatus(filePath);
|
||||
if (n2 == 1) {
|
||||
return null;
|
||||
}
|
||||
if (n2 == 0) {
|
||||
return (BDaemonDirectoryStore)storeCache.getStore(filePath);
|
||||
}
|
||||
}
|
||||
long l = Clock.ticks();
|
||||
InputStream inputStream = bDaemonFileSpace.getDaemonSession().getInputStream((DaemonMessage)new GetDirectoryMessage(filePath, bl, bl2, bl3, bDaemonFileSpace), n);
|
||||
if (inputStream == null) {
|
||||
if (storeCache != null) {
|
||||
storeCache.cacheNotFound(filePath);
|
||||
if (filePath2 != null) {
|
||||
storeCache.cacheNotFound(filePath2);
|
||||
}
|
||||
}
|
||||
Log.getLog((String)"platform.daemonTuning").trace("parsed " + filePath.getBody() + ' ' + (Clock.ticks() - l) + "ms");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
xElem = XParser.make((InputStream)inputStream).parse();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
Log.getLog((String)"platform.daemonTuning").trace("parse failed " + filePath.getBody() + ' ' + (Clock.ticks() - l) + "ms");
|
||||
throw new LocalizableRuntimeException("platform", "RemoteDirectory.exception.contentParse", new Object[]{filePath.getBody()}, (Throwable)exception);
|
||||
}
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = new BDaemonDirectoryStore(bDaemonFileSpace, filePath, (XElem)(bl ? xElem : null), bl, bl2, bl3, storeCache);
|
||||
if (storeCache != null) {
|
||||
storeCache.cacheResult((BIFileStore)bDaemonDirectoryStore);
|
||||
if (filePath2 != null) {
|
||||
storeCache.cacheResult((BIFileStore)new BDaemonDirectoryStore(bDaemonFileSpace, filePath2, (XElem)(bl ? xElem : null), bl, bl2, bl3, storeCache));
|
||||
}
|
||||
if (bl) {
|
||||
storeCache.cacheCompleted(filePath);
|
||||
if (filePath2 != null) {
|
||||
storeCache.cacheCompleted(filePath2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.getLog((String)"platform.daemonTuning").trace("parsed " + filePath.getBody() + ' ' + (Clock.ticks() - l) + "ms");
|
||||
return bDaemonDirectoryStore;
|
||||
}
|
||||
|
||||
public BDaemonFileSpace getDaemonFileSpace() {
|
||||
return (BDaemonFileSpace)this.getFileSpace();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.children = null;
|
||||
this.element = null;
|
||||
if (this.cache != null) {
|
||||
this.cache.clear(this.getFilePath());
|
||||
if (this.getAltPath() != null) {
|
||||
this.cache.clear(this.getAltPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isReadonly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getFileUri() {
|
||||
return this.fileUri;
|
||||
}
|
||||
|
||||
public String getLocalPath() {
|
||||
if (this.element == null) {
|
||||
this.getChildren(BCacheAccessPolicy.lazyFetch);
|
||||
}
|
||||
return this.element.get("path", null);
|
||||
}
|
||||
|
||||
public boolean copyToLocalHost() throws ConnectException, AuthenticationException {
|
||||
return this.copyToLocalHost(this.getFilePath(), null);
|
||||
}
|
||||
|
||||
public boolean copyToLocalHost(FilePath filePath) throws ConnectException, AuthenticationException {
|
||||
return this.copyToLocalHost(filePath, null);
|
||||
}
|
||||
|
||||
public boolean copyToLocalHost(FilePath filePath, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
|
||||
if (!this.getFilePath().isSysHomeAbsolute()) {
|
||||
throw new IllegalStateException("Only system absolute files can be copied to local host");
|
||||
}
|
||||
Array array = this.getChildren();
|
||||
int n = 0;
|
||||
while (n < array.size()) {
|
||||
BAbstractFileStore bAbstractFileStore;
|
||||
if (array.get(n) instanceof BDaemonDirectoryStore ? !(bAbstractFileStore = (BDaemonDirectoryStore)((Object)array.get(n))).copyToLocalHost(filePath.merge(bAbstractFileStore.getFileName()), daemonSessionTaskListener) : !(bAbstractFileStore = (BDaemonFileStore)((Object)array.get(n))).copyToLocalHost(filePath.merge(bAbstractFileStore.getFileName()), daemonSessionTaskListener)) {
|
||||
return false;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public FilePath getAltPath() {
|
||||
return this.altPath;
|
||||
}
|
||||
|
||||
public BDaemonSession getDaemonSession() {
|
||||
return ((BDaemonFileSpace)this.getFileSpace()).getDaemonSession();
|
||||
}
|
||||
|
||||
public BIFileStore getChild(String string) {
|
||||
return this.getChild(string, BCacheAccessPolicy.lazyFetch);
|
||||
}
|
||||
|
||||
public BIFileStore getChild(String string, BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
if (this.getChildren(bCacheAccessPolicy) == null) {
|
||||
return null;
|
||||
}
|
||||
int n = 0;
|
||||
while (n < this.children.size()) {
|
||||
if (((BIFileStore)this.children.get(n)).getFileName().equals(string)) {
|
||||
return (BIFileStore)this.children.get(n);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
if (this.cache != null) {
|
||||
this.cache.cacheNotFound(this.getFilePath().merge(string));
|
||||
if (this.getAltPath() != null) {
|
||||
this.cache.cacheNotFound(this.getAltPath().merge(string));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Array getChildren() {
|
||||
return this.getChildren(BCacheAccessPolicy.lazyFetch, this.recurseDir, this.sendCrc, this.sendLocalPath);
|
||||
}
|
||||
|
||||
public Array getChildren(BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
return this.getChildren(bCacheAccessPolicy, this.recurseDir, this.sendCrc, this.sendLocalPath);
|
||||
}
|
||||
|
||||
public Array getChildren(BCacheAccessPolicy bCacheAccessPolicy, boolean bl, boolean bl2, boolean bl3) {
|
||||
long l = Clock.ticks();
|
||||
if (bCacheAccessPolicy == BCacheAccessPolicy.forceFetch || bCacheAccessPolicy == BCacheAccessPolicy.lazyFetch && this.element == null) {
|
||||
try {
|
||||
this.element = XParser.make((InputStream)this.getDaemonSession().getInputStream(new GetDirectoryMessage(this.getFilePath(), bl, bl2, bl3, this.getDaemonFileSpace()))).parse();
|
||||
Log.getLog((String)"platform.daemonTuning").trace("parsed " + this.getFilePath().getBody() + ' ' + (Clock.ticks() - l) + "ms");
|
||||
}
|
||||
catch (Exception exception) {
|
||||
Log.getLog((String)"platform.daemonTuning").trace("parse failed " + this.getFilePath().getBody() + ' ' + (Clock.ticks() - l) + "ms");
|
||||
throw new LocalizableRuntimeException("platform", "RemoteDirectory.exception.contentParse", new Object[]{this.getFileUri()}, (Throwable)exception);
|
||||
}
|
||||
this.children = null;
|
||||
}
|
||||
if (this.children == null && bCacheAccessPolicy != BCacheAccessPolicy.cacheOnly) {
|
||||
XElem[] xElemArray = this.element.elems();
|
||||
this.children = new Array();
|
||||
int n = 0;
|
||||
while (n < xElemArray.length) {
|
||||
BAbstractFileStore bAbstractFileStore;
|
||||
if (xElemArray[n].name().equals("file")) {
|
||||
try {
|
||||
bAbstractFileStore = new BDaemonFileStore(this.getDaemonFileSpace(), this.getFilePath().merge(xElemArray[n].get("name")), xElemArray[n]);
|
||||
if (this.cache != null) {
|
||||
this.cache.cacheResult((BIFileStore)bAbstractFileStore);
|
||||
if (this.getAltPath() != null) {
|
||||
this.cache.cacheResult((BIFileStore)new BDaemonFileStore(this.getDaemonFileSpace(), this.getAltPath().merge(xElemArray[n].get("name")), xElemArray[n]));
|
||||
}
|
||||
}
|
||||
this.children.add((Object)bAbstractFileStore);
|
||||
}
|
||||
catch (SyntaxException syntaxException) {
|
||||
Log.getLog((String)"platform.daemonTuning").trace("ignoring illegal child " + xElemArray[n].get("name") + " of " + this.getFilePath());
|
||||
}
|
||||
} else if (xElemArray[n].name().equals("directory")) {
|
||||
try {
|
||||
bAbstractFileStore = new BDaemonDirectoryStore(this.getDaemonFileSpace(), this.getFilePath().merge(xElemArray[n].get("name")), bl ? xElemArray[n] : null, bl, bl2, bl3, this.cache);
|
||||
if (this.cache != null) {
|
||||
this.cache.cacheResult((BIFileStore)bAbstractFileStore);
|
||||
if (this.getAltPath() != null) {
|
||||
this.cache.cacheResult((BIFileStore)new BDaemonDirectoryStore(this.getDaemonFileSpace(), this.getAltPath().merge(xElemArray[n].get("name")), bl ? xElemArray[n] : null, bl, bl2, bl3, this.cache));
|
||||
}
|
||||
}
|
||||
this.children.add((Object)bAbstractFileStore);
|
||||
}
|
||||
catch (SyntaxException syntaxException) {
|
||||
Log.getLog((String)"platform.daemonTuning").trace("ignoring illegal child " + xElemArray[n].get("name") + " of " + this.getFilePath());
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
if (this.cache != null) {
|
||||
this.cache.cacheCompleted(this.getFilePath());
|
||||
if (this.getAltPath() != null) {
|
||||
this.cache.cacheCompleted(this.getAltPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.children;
|
||||
}
|
||||
|
||||
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.children = null;
|
||||
}
|
||||
|
||||
private BDaemonDirectoryStore(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, XElem xElem, boolean bl, boolean bl2, boolean bl3, StoreCache storeCache) {
|
||||
super((BFileSpace)bDaemonFileSpace, filePath);
|
||||
this.this();
|
||||
this.fileUri = bDaemonFileSpace.filePathToUri(filePath);
|
||||
this.element = xElem;
|
||||
this.recurseDir = bl;
|
||||
this.sendCrc = bl2;
|
||||
this.sendLocalPath = bl3;
|
||||
this.cache = storeCache;
|
||||
this.altPath = bDaemonFileSpace.getAltPath(filePath);
|
||||
if (bl) {
|
||||
this.getChildren(BCacheAccessPolicy.lazyFetch, true, bl2, bl3);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$daemon$file$BDaemonDirectoryStore;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$daemon$file$BDaemonDirectoryStore = BDaemonDirectoryStore.class("[Lcom.tridium.platform.daemon.file.BDaemonDirectoryStore;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,382 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.net.HttpUtil
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BFileSpace
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.nav.BNavRoot
|
||||
* javax.baja.nav.NavEvent
|
||||
* javax.baja.security.AuthenticationException
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.LexiconText
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import com.tridium.net.HttpUtil;
|
||||
import com.tridium.platform.daemon.BDaemonSession;
|
||||
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
|
||||
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
|
||||
import com.tridium.platform.daemon.file.FileCache;
|
||||
import com.tridium.platform.daemon.file.FilePathComparator;
|
||||
import java.net.ConnectException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BNavRoot;
|
||||
import javax.baja.nav.NavEvent;
|
||||
import javax.baja.security.AuthenticationException;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.LexiconText;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BDaemonFileSpace
|
||||
extends BFileSpace {
|
||||
public static final Type TYPE;
|
||||
protected FilePath sysHomePathFromRoot;
|
||||
protected BDirectory[] roots;
|
||||
protected boolean initializing;
|
||||
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BDaemonFileSpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public abstract BDaemonSession getDaemonSession();
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
protected void init() throws ConnectException, AuthenticationException {
|
||||
if (this.initializing) return;
|
||||
if (this.roots != null) {
|
||||
return;
|
||||
}
|
||||
this.initializing = true;
|
||||
try {
|
||||
ArrayList<BDirectory> arrayList;
|
||||
block8: {
|
||||
Object object;
|
||||
arrayList = new ArrayList<BDirectory>();
|
||||
String string = null;
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, new FilePath("!"));
|
||||
if (bDaemonDirectoryStore != null) {
|
||||
object = new BDirectory((BIFileStore)bDaemonDirectoryStore, LexiconText.make((String)"platform", (String)"nav.sysHomeReadOnly"));
|
||||
string = bDaemonDirectoryStore.getLocalPath();
|
||||
object.setIcon(BIcon.std((String)"home.png"));
|
||||
arrayList.add((BDirectory)object);
|
||||
}
|
||||
try {
|
||||
bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, new FilePath("/"));
|
||||
if (bDaemonDirectoryStore == null) break block8;
|
||||
arrayList.add(new BDirectory((BIFileStore)bDaemonDirectoryStore, LexiconText.make((String)"platform", (String)"nav.rootReadOnly")));
|
||||
if (string != null && string.startsWith((String)(object = bDaemonDirectoryStore.getLocalPath()))) {
|
||||
this.sysHomePathFromRoot = new FilePath(string.substring(((String)object).length()));
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
this.roots = arrayList.toArray(new BDirectory[arrayList.size()]);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var2_6 = null;
|
||||
this.initializing = false;
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var2_7 = null;
|
||||
this.initializing = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public String filePathToUri(FilePath filePath) {
|
||||
StringBuffer stringBuffer;
|
||||
String[] stringArray = filePath.getNames();
|
||||
int n = 0;
|
||||
if (filePath.isLocalAbsolute()) {
|
||||
if (stringArray.length > 0 && stringArray[0].equals("niagara")) {
|
||||
stringBuffer = new StringBuffer("/niagara");
|
||||
n = 1;
|
||||
} else {
|
||||
stringBuffer = new StringBuffer("/files");
|
||||
}
|
||||
} else if (filePath.isSysHomeAbsolute()) {
|
||||
stringBuffer = new StringBuffer("/niagara");
|
||||
} else {
|
||||
throw new BajaRuntimeException("file path must be local or sys home absolute " + filePath.getBody());
|
||||
}
|
||||
int n2 = n;
|
||||
while (n2 < stringArray.length) {
|
||||
stringBuffer.append('/');
|
||||
stringBuffer.append(HttpUtil.encodeUrl((String)stringArray[n2]));
|
||||
++n2;
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getNavDescription(Context context) {
|
||||
return this.getLexicon().getText("DaemonFileSpace.navDesc");
|
||||
}
|
||||
|
||||
public FilePath getAltPath(FilePath filePath) {
|
||||
if (this.initializing) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
this.init();
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
if (this.sysHomePathFromRoot == null) {
|
||||
return null;
|
||||
}
|
||||
if (filePath.isLocalAbsolute()) {
|
||||
if (filePath.depth() < this.sysHomePathFromRoot.depth()) {
|
||||
return null;
|
||||
}
|
||||
int n = 0;
|
||||
while (n < this.sysHomePathFromRoot.depth()) {
|
||||
if (!filePath.nameAt(n).equals(this.sysHomePathFromRoot.nameAt(n))) {
|
||||
return null;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
FilePath filePath2 = new FilePath("!");
|
||||
int n2 = this.sysHomePathFromRoot.depth();
|
||||
while (n2 < filePath.depth()) {
|
||||
filePath2 = filePath2.merge(filePath.nameAt(n2));
|
||||
++n2;
|
||||
}
|
||||
return filePath2;
|
||||
}
|
||||
if (filePath.isSysHomeAbsolute()) {
|
||||
FilePath filePath3 = new FilePath("/");
|
||||
filePath3 = filePath3.merge(this.sysHomePathFromRoot);
|
||||
int n = 0;
|
||||
while (n < filePath.depth()) {
|
||||
filePath3 = filePath3.merge(filePath.nameAt(n));
|
||||
++n;
|
||||
}
|
||||
return filePath3;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BIFile[] listFiles() {
|
||||
try {
|
||||
this.init();
|
||||
return (BIFile[])this.roots.clone();
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFile getChild(BIFile bIFile, String string) {
|
||||
return this.getChild(bIFile, string, BCacheAccessPolicy.forceFetch);
|
||||
}
|
||||
|
||||
public BIFile[] getChildren(BIFile bIFile) {
|
||||
return this.getChildren(bIFile, BCacheAccessPolicy.forceFetch);
|
||||
}
|
||||
|
||||
public BIFile findFile(FilePath filePath) {
|
||||
return this.findFile(filePath, BCacheAccessPolicy.forceFetch);
|
||||
}
|
||||
|
||||
public BIFileStore findStore(FilePath filePath) {
|
||||
return this.findStore(filePath, BCacheAccessPolicy.forceFetch);
|
||||
}
|
||||
|
||||
public abstract BIFile getChild(BIFile var1, String var2, BCacheAccessPolicy var3);
|
||||
|
||||
public abstract BIFile[] getChildren(BIFile var1, BCacheAccessPolicy var2);
|
||||
|
||||
public abstract BIFile findFile(FilePath var1, BCacheAccessPolicy var2);
|
||||
|
||||
public abstract BIFileStore findStore(FilePath var1, BCacheAccessPolicy var2);
|
||||
|
||||
public void notify(Set set, Set set2) {
|
||||
BIFile bIFile;
|
||||
BDirectory bDirectory;
|
||||
Object object;
|
||||
FileCache fileCache = new FileCache(this);
|
||||
TreeSet<NavEvent> treeSet = new TreeSet<NavEvent>(new Comparator(){
|
||||
|
||||
public final int compare(Object object, Object object2) {
|
||||
NavEvent navEvent = (NavEvent)object;
|
||||
NavEvent navEvent2 = (NavEvent)object2;
|
||||
if (navEvent.getId() != navEvent2.getId()) {
|
||||
return navEvent.getId() < navEvent2.getId() ? 1 : -1;
|
||||
}
|
||||
int n = navEvent.getParentOrd().toString().compareTo(navEvent2.getParentOrd().toString());
|
||||
if (n != 0) {
|
||||
return n;
|
||||
}
|
||||
if (navEvent.getId() == 1) {
|
||||
return navEvent.getNewChildName().compareTo(navEvent2.getNewChildName());
|
||||
}
|
||||
return navEvent.getOldChildName().compareTo(navEvent2.getOldChildName());
|
||||
}
|
||||
});
|
||||
TreeSet<FilePath> treeSet2 = new TreeSet<FilePath>(FilePathComparator.INSTANCE);
|
||||
treeSet2.addAll(set);
|
||||
Object object2 = set.iterator();
|
||||
while (object2.hasNext()) {
|
||||
object = this.getAltPath((FilePath)object2.next());
|
||||
if (object == null) continue;
|
||||
treeSet2.add((FilePath)object);
|
||||
}
|
||||
object2 = treeSet2.iterator();
|
||||
while (object2.hasNext()) {
|
||||
object = (FilePath)object2.next();
|
||||
bDirectory = this.findDirectoryForNotify(object.getParent(), fileCache);
|
||||
if (bDirectory == null || (bIFile = this.getChild((BIFile)bDirectory, object.getName(), BCacheAccessPolicy.cacheOnly)) == null) continue;
|
||||
treeSet.add(NavEvent.makeRemoved((BOrd)bDirectory.getNavOrd(), (String)object.getName(), null));
|
||||
}
|
||||
object2 = new TreeSet(FilePathComparator.INSTANCE);
|
||||
object2.addAll(set2);
|
||||
object = set2.iterator();
|
||||
while (object.hasNext()) {
|
||||
bIFile = this.getAltPath((FilePath)object.next());
|
||||
if (bIFile == null) continue;
|
||||
object2.add(bIFile);
|
||||
}
|
||||
object = object2.iterator();
|
||||
block3: while (object.hasNext()) {
|
||||
BIFile bIFile2;
|
||||
bIFile = (FilePath)object.next();
|
||||
bDirectory = this.findDirectoryForNotify(bIFile.getParent(), fileCache);
|
||||
if (bDirectory == null) {
|
||||
bIFile2 = (BIFile)this.getNavChild(bIFile.getAbsoluteBase());
|
||||
if (bIFile2 == null) continue;
|
||||
int n = 0;
|
||||
while (n < bIFile.depth() - 1) {
|
||||
BIFile bIFile3 = this.getChild(bIFile2, bIFile.nameAt(n), BCacheAccessPolicy.cacheOnly);
|
||||
if (bIFile3 == null) {
|
||||
treeSet.add(NavEvent.makeAdded((BOrd)bIFile2.getNavOrd(), (String)bIFile.nameAt(n), null));
|
||||
continue block3;
|
||||
}
|
||||
bIFile2 = bIFile3;
|
||||
++n;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
bIFile2 = this.getChild((BIFile)bDirectory, bIFile.getName(), BCacheAccessPolicy.cacheOnly);
|
||||
if (bIFile2 == null) continue;
|
||||
treeSet.add(NavEvent.makeAdded((BOrd)bDirectory.getNavOrd(), (String)bIFile.getName(), null));
|
||||
}
|
||||
object = fileCache.getCachedFiles().iterator();
|
||||
while (object.hasNext()) {
|
||||
bDirectory = (BDirectory)object.next();
|
||||
((BDaemonDirectoryStore)bDirectory.getStore()).reset();
|
||||
}
|
||||
object = treeSet.iterator();
|
||||
while (object.hasNext()) {
|
||||
bIFile = (NavEvent)object.next();
|
||||
BNavRoot.INSTANCE.fireNavEvent((NavEvent)bIFile);
|
||||
}
|
||||
}
|
||||
|
||||
private final BDirectory findDirectoryForNotify(FilePath filePath, FileCache fileCache) {
|
||||
if (filePath == null) {
|
||||
return null;
|
||||
}
|
||||
switch (fileCache.getCacheStatus(filePath)) {
|
||||
case 2: {
|
||||
BDirectory bDirectory = (BDirectory)this.findFile(filePath, BCacheAccessPolicy.cacheOnly);
|
||||
if (bDirectory == null) {
|
||||
fileCache.cacheNotFound(filePath);
|
||||
} else {
|
||||
fileCache.cacheResult((BIFile)bDirectory);
|
||||
}
|
||||
return bDirectory;
|
||||
}
|
||||
case 0: {
|
||||
return (BDirectory)fileCache.getFile(filePath);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void notifyTransferred(FilePath filePath) {
|
||||
TreeSet<FilePath> treeSet = new TreeSet<FilePath>(FilePathComparator.INSTANCE);
|
||||
treeSet.add(filePath);
|
||||
this.notify(new TreeSet(FilePathComparator.INSTANCE), treeSet);
|
||||
}
|
||||
|
||||
public void notifyRemoved(FilePath filePath) {
|
||||
TreeSet<FilePath> treeSet = new TreeSet<FilePath>(FilePathComparator.INSTANCE);
|
||||
treeSet.add(filePath);
|
||||
this.notify(treeSet, new TreeSet(FilePathComparator.INSTANCE));
|
||||
}
|
||||
|
||||
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.sysHomePathFromRoot = null;
|
||||
this.roots = null;
|
||||
this.initializing = false;
|
||||
}
|
||||
|
||||
public BDaemonFileSpace() {
|
||||
super("file", LexiconText.make((String)"platform", (String)"nav.daemonFileSpace"));
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$daemon$file$BDaemonFileSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$daemon$file$BDaemonFileSpace = BDaemonFileSpace.class("[Lcom.tridium.platform.daemon.file.BDaemonFileSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.net.HttpDateFormat
|
||||
* javax.baja.file.BAbstractFileStore
|
||||
* javax.baja.file.BFileSpace
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.file.FileUtil
|
||||
* javax.baja.security.AuthenticationException
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.xml.XElem
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import com.tridium.net.HttpDateFormat;
|
||||
import com.tridium.platform.daemon.BDaemonSession;
|
||||
import com.tridium.platform.daemon.DaemonFileUtil;
|
||||
import com.tridium.platform.daemon.file.BDaemonFileSpace;
|
||||
import com.tridium.platform.daemon.file.FileHeaderInfo;
|
||||
import com.tridium.platform.daemon.message.FileHeaderMessage;
|
||||
import com.tridium.platform.daemon.message.GetFileMessage;
|
||||
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.ConnectException;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.FileUtil;
|
||||
import javax.baja.security.AuthenticationException;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.xml.XElem;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BDaemonFileStore
|
||||
extends BAbstractFileStore {
|
||||
public static final Type TYPE;
|
||||
private static Lexicon lex;
|
||||
private String fileUri;
|
||||
private long size;
|
||||
private long crc;
|
||||
private BAbsTime lastModified;
|
||||
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BDaemonFileStore;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public String getFileUri() {
|
||||
return this.fileUri;
|
||||
}
|
||||
|
||||
public BDaemonFileSpace getDaemonFileSpace() {
|
||||
return (BDaemonFileSpace)this.getFileSpace();
|
||||
}
|
||||
|
||||
public BAbsTime getLastModified() {
|
||||
return this.lastModified;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public long getCrc() throws IOException {
|
||||
if (this.crc == (long)-1) {
|
||||
this.crc = 0L;
|
||||
FileHeaderInfo fileHeaderInfo = DaemonFileUtil.getFileHeaderInfo(this.getDaemonSession(), new FileHeaderMessage(this.getFilePath(), this.getDaemonFileSpace(), true));
|
||||
if (fileHeaderInfo != null && fileHeaderInfo.getCrc() > (long)-1) {
|
||||
this.crc = fileHeaderInfo.getCrc();
|
||||
} else {
|
||||
try {
|
||||
this.crc = FileUtil.getCrc((InputStream)this.getInputStream());
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw new LocalizableRuntimeException("platform", "LocalFile.exception.readCrc", (Throwable)iOException);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.crc;
|
||||
}
|
||||
|
||||
public boolean isReadonly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
GetFileMessage getFileMessage = new GetFileMessage(this.getFilePath(), this.getDaemonFileSpace());
|
||||
return this.getDaemonSession().getInputStream(getFileMessage);
|
||||
}
|
||||
|
||||
public BDaemonSession getDaemonSession() {
|
||||
return ((BDaemonFileSpace)this.getFileSpace()).getDaemonSession();
|
||||
}
|
||||
|
||||
public boolean copyToLocalHost() throws ConnectException, AuthenticationException {
|
||||
return this.copyToLocalHost(this.getFilePath(), null);
|
||||
}
|
||||
|
||||
public boolean copyToLocalHost(FilePath filePath) throws ConnectException, AuthenticationException {
|
||||
return this.copyToLocalHost(filePath, null);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exception decompiling
|
||||
*/
|
||||
public boolean copyToLocalHost(FilePath var1_1, DaemonSessionTaskListener var2_2) throws ConnectException, AuthenticationException {
|
||||
/*
|
||||
* 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 8[TRYBLOCK] [13 : 280->283)] 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.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");
|
||||
}
|
||||
|
||||
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.lastModified = BAbsTime.NULL;
|
||||
}
|
||||
|
||||
public BDaemonFileStore(BDaemonFileSpace bDaemonFileSpace, FilePath filePath) {
|
||||
this(bDaemonFileSpace, filePath, -1, -1);
|
||||
}
|
||||
|
||||
public BDaemonFileStore(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, long l, long l2) {
|
||||
super((BFileSpace)bDaemonFileSpace, filePath);
|
||||
this.this();
|
||||
this.fileUri = bDaemonFileSpace.filePathToUri(filePath);
|
||||
this.size = l;
|
||||
this.crc = l2;
|
||||
}
|
||||
|
||||
public BDaemonFileStore(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, XElem xElem) {
|
||||
this(bDaemonFileSpace, filePath, Long.parseLong(xElem.get("size", "-1")), Long.parseLong(xElem.get("crc", "-1")));
|
||||
String string = xElem.get("lastModified", null);
|
||||
if (string != null) {
|
||||
this.lastModified = BAbsTime.make((long)HttpDateFormat.parse((String)string));
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$daemon$file$BDaemonFileStore;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$daemon$file$BDaemonFileStore = BDaemonFileStore.class("[Lcom.tridium.platform.daemon.file.BDaemonFileStore;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
lex = Lexicon.make((String)"platform");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BAbstractFileStore
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.security.AuthenticationException
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import com.tridium.platform.daemon.BDaemonSession;
|
||||
import com.tridium.platform.daemon.DaemonFileUtil;
|
||||
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
|
||||
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
|
||||
import com.tridium.platform.daemon.file.BDaemonFileSpace;
|
||||
import com.tridium.platform.daemon.file.BDaemonFileStore;
|
||||
import com.tridium.platform.daemon.file.FileHeaderInfo;
|
||||
import com.tridium.platform.daemon.file.StoreCache;
|
||||
import com.tridium.platform.daemon.message.FileHeaderMessage;
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.security.AuthenticationException;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BDefaultDaemonFileSpace
|
||||
extends BDaemonFileSpace {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
private BOrd ordInSession = BOrd.make((String)"file:");
|
||||
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BDefaultDaemonFileSpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BDaemonSession getDaemonSession() {
|
||||
return (BDaemonSession)this.getNavParent();
|
||||
}
|
||||
|
||||
protected void init() throws ConnectException, AuthenticationException {
|
||||
if (this.roots != null) {
|
||||
return;
|
||||
}
|
||||
super.init();
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
try {
|
||||
this.init();
|
||||
int n = 0;
|
||||
while (n < this.roots.length) {
|
||||
if (this.roots[n].getFileName().equals(string)) {
|
||||
return this.roots[n];
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
try {
|
||||
this.init();
|
||||
return (BINavNode[])this.roots.clone();
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession() {
|
||||
return this.ordInSession;
|
||||
}
|
||||
|
||||
public String getNavDescription(Context context) {
|
||||
return this.getLexicon().getText("DaemonFileSpace.navDesc");
|
||||
}
|
||||
|
||||
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
|
||||
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
|
||||
}
|
||||
|
||||
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
|
||||
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
|
||||
}
|
||||
|
||||
public void delete(FilePath filePath, Context context) throws IOException {
|
||||
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
|
||||
}
|
||||
|
||||
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
|
||||
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
|
||||
}
|
||||
|
||||
public BIFile findFile(FilePath filePath, BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
try {
|
||||
BIFileStore bIFileStore = this.findStore(null, filePath, false, false, bCacheAccessPolicy);
|
||||
if (bIFileStore == null) {
|
||||
return null;
|
||||
}
|
||||
if (bIFileStore instanceof BDaemonDirectoryStore) {
|
||||
return new BDirectory(bIFileStore);
|
||||
}
|
||||
return this.makeFile(bIFileStore);
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFileStore findStore(FilePath filePath) {
|
||||
try {
|
||||
return this.findStore(null, filePath, false, false, BCacheAccessPolicy.lazyFetch);
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFileStore findStore(FilePath filePath, BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
try {
|
||||
return this.findStore(null, filePath, false, false, bCacheAccessPolicy);
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFileStore findStore(StoreCache storeCache, FilePath filePath, boolean bl, boolean bl2) throws ConnectException, AuthenticationException, IOException {
|
||||
return this.findStore(storeCache, filePath, bl, bl2, BCacheAccessPolicy.lazyFetch);
|
||||
}
|
||||
|
||||
public BIFileStore findStore(StoreCache storeCache, FilePath filePath, boolean bl, boolean bl2, BCacheAccessPolicy bCacheAccessPolicy) throws ConnectException, AuthenticationException, IOException {
|
||||
BAbstractFileStore bAbstractFileStore;
|
||||
int n = bCacheAccessPolicy == BCacheAccessPolicy.forceFetch || storeCache == null ? 2 : storeCache.getCacheStatus(filePath);
|
||||
if (n == 1) {
|
||||
return null;
|
||||
}
|
||||
if (n == 0) {
|
||||
return storeCache.getStore(filePath);
|
||||
}
|
||||
if (bCacheAccessPolicy == BCacheAccessPolicy.cacheOnly) {
|
||||
return null;
|
||||
}
|
||||
FileHeaderInfo fileHeaderInfo = DaemonFileUtil.getFileHeaderInfo(this.getDaemonSession(), new FileHeaderMessage(filePath, this));
|
||||
if (fileHeaderInfo == null) {
|
||||
if (storeCache != null) {
|
||||
storeCache.cacheNotFound(filePath);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (fileHeaderInfo.isDirectory()) {
|
||||
bAbstractFileStore = BDaemonDirectoryStore.make(this, filePath, bl, bl2, false, storeCache);
|
||||
} else if (filePath.depth() == 1 || !bl2) {
|
||||
bAbstractFileStore = new BDaemonFileStore(this, filePath, fileHeaderInfo.getContentLength(), -1);
|
||||
if (storeCache != null) {
|
||||
storeCache.cacheResult((BIFileStore)bAbstractFileStore);
|
||||
}
|
||||
} else {
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, filePath.getParent(), bl, true, false, storeCache);
|
||||
if (bDaemonDirectoryStore == null) {
|
||||
bAbstractFileStore = new BDaemonFileStore(this, filePath, fileHeaderInfo.getContentLength(), -1);
|
||||
if (storeCache != null) {
|
||||
storeCache.cacheResult((BIFileStore)bAbstractFileStore);
|
||||
}
|
||||
} else {
|
||||
bAbstractFileStore = bDaemonDirectoryStore.getChild(filePath.getName());
|
||||
}
|
||||
}
|
||||
return bAbstractFileStore;
|
||||
}
|
||||
|
||||
public BIFile getChild(BIFile bIFile, String string, BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
if (bIFile.isDirectory()) {
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = (BDaemonDirectoryStore)bIFile.getStore();
|
||||
BIFileStore bIFileStore = bDaemonDirectoryStore.getChild(string, bCacheAccessPolicy);
|
||||
return bIFileStore == null ? null : this.makeFile(bIFileStore);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BIFile[] getChildren(BIFile bIFile, BCacheAccessPolicy bCacheAccessPolicy) {
|
||||
if (bIFile.isDirectory()) {
|
||||
BDaemonDirectoryStore bDaemonDirectoryStore = (BDaemonDirectoryStore)bIFile.getStore();
|
||||
Array array = bDaemonDirectoryStore.getChildren(bCacheAccessPolicy);
|
||||
BIFile[] bIFileArray = new BIFile[array.size()];
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
bIFileArray[n] = this.makeFile((BIFileStore)array.get(n));
|
||||
++n;
|
||||
}
|
||||
return bIFileArray;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
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$daemon$file$BDefaultDaemonFileSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$daemon$file$BDefaultDaemonFileSpace = BDefaultDaemonFileSpace.class("[Lcom.tridium.platform.daemon.file.BDefaultDaemonFileSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
icon = BIcon.std((String)"drive.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.nre.util.Array
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
|
||||
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
|
||||
import com.tridium.platform.daemon.message.FileTransferMessage;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeMap;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.nre.util.Array;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class DirectoryClean {
|
||||
private static final int UNKNOWN = 0;
|
||||
private static final int KEEP_SOME = 1;
|
||||
private static final int KEEP_ALL = 2;
|
||||
private static final int CLEAN_SOME = 16;
|
||||
private static final int CLEAN_ALL = 32;
|
||||
private static final int CASCADE_PARENT = 1;
|
||||
private static final int CASCADE_CHILD = 16;
|
||||
private static final int CASCADE_ANY = 17;
|
||||
private TreeMap sysHomeAbsRootsByName;
|
||||
private TreeMap localAbsRootsByName;
|
||||
|
||||
public void clean(BIFileStore bIFileStore) {
|
||||
if (bIFileStore == null) {
|
||||
return;
|
||||
}
|
||||
FilePath filePath = this.normalizePath(bIFileStore.getFilePath());
|
||||
Node node = this.makeNode(filePath);
|
||||
node.setStore(bIFileStore);
|
||||
node.transition(32);
|
||||
}
|
||||
|
||||
public void keep(FilePath filePath) {
|
||||
this.makeNode(this.normalizePath(filePath)).transition(2);
|
||||
}
|
||||
|
||||
public void addTransferElements(FileTransferMessage fileTransferMessage) {
|
||||
Iterator iterator = this.sysHomeAbsRootsByName.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((Node)iterator.next()).addTransferElements(fileTransferMessage);
|
||||
}
|
||||
iterator = this.localAbsRootsByName.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((Node)iterator.next()).addTransferElements(fileTransferMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
Iterator iterator = this.sysHomeAbsRootsByName.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((Node)iterator.next()).dump("!");
|
||||
}
|
||||
iterator = this.localAbsRootsByName.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((Node)iterator.next()).dump("/");
|
||||
}
|
||||
}
|
||||
|
||||
private final FilePath normalizePath(FilePath filePath) {
|
||||
if (filePath == null || filePath.isSysHomeAbsolute()) {
|
||||
return filePath;
|
||||
}
|
||||
if (filePath.isLocalAbsolute()) {
|
||||
if (filePath.depth() == 0 || !filePath.nameAt(0).equals("niagara")) {
|
||||
return filePath;
|
||||
}
|
||||
FilePath filePath2 = new FilePath("!");
|
||||
int n = 1;
|
||||
while (n < filePath.depth()) {
|
||||
filePath2 = filePath2.merge(filePath.nameAt(n));
|
||||
++n;
|
||||
}
|
||||
return filePath2;
|
||||
}
|
||||
throw new IllegalArgumentException("path must be sys home or local absolute");
|
||||
}
|
||||
|
||||
private final Node makeNode(FilePath filePath) {
|
||||
if (filePath.depth() == 0) {
|
||||
throw new IllegalArgumentException("root path");
|
||||
}
|
||||
TreeMap treeMap = null;
|
||||
if (filePath.isSysHomeAbsolute()) {
|
||||
treeMap = this.sysHomeAbsRootsByName;
|
||||
} else if (filePath.isLocalAbsolute()) {
|
||||
treeMap = this.localAbsRootsByName;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Path must be sys home or local absolute");
|
||||
}
|
||||
Node node = (Node)treeMap.get(filePath.nameAt(0));
|
||||
if (node == null) {
|
||||
node = new Node(null, filePath.nameAt(0));
|
||||
treeMap.put(filePath.nameAt(0), node);
|
||||
}
|
||||
int n = 1;
|
||||
while (n < filePath.depth()) {
|
||||
node = node.makeChild(filePath.nameAt(n));
|
||||
++n;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$0() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$1() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$2() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$3() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$4() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$5() {
|
||||
return 17;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$6() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$7() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.sysHomeAbsRootsByName = new TreeMap();
|
||||
this.localAbsRootsByName = new TreeMap();
|
||||
}
|
||||
|
||||
public DirectoryClean() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private static class Node {
|
||||
private BIFileStore store;
|
||||
private String name;
|
||||
private Node parent;
|
||||
private TreeMap childByName;
|
||||
private int status;
|
||||
|
||||
public Node makeChild(String string) {
|
||||
Node node = (Node)this.childByName.get(string);
|
||||
if (node == null) {
|
||||
node = new Node(this, string);
|
||||
this.childByName.put(string, node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
public void setStore(BIFileStore bIFileStore) {
|
||||
if (this.store == null) {
|
||||
this.store = bIFileStore;
|
||||
if (bIFileStore instanceof BDaemonDirectoryStore) {
|
||||
Array array = ((BDaemonDirectoryStore)bIFileStore).getChildren(BCacheAccessPolicy.lazyFetch, true, true, false);
|
||||
int n = 0;
|
||||
while (n < array.size()) {
|
||||
BIFileStore bIFileStore2 = (BIFileStore)array.get(n);
|
||||
Node node = this.makeChild(bIFileStore2.getFilePath().getName());
|
||||
node.setStore(bIFileStore2);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addTransferElements(FileTransferMessage fileTransferMessage) {
|
||||
if (this.status == 32) {
|
||||
fileTransferMessage.addDelete(this.store.getFilePath());
|
||||
} else if ((this.status & 0x10) > 0) {
|
||||
Iterator iterator = this.childByName.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((Node)iterator.next()).addTransferElements(fileTransferMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dump(String string) {
|
||||
System.out.print(string);
|
||||
System.out.print(this.name);
|
||||
System.out.print(" ");
|
||||
if (this.status == 0) {
|
||||
System.out.print("unknown ");
|
||||
}
|
||||
if ((this.status & 1) > 0) {
|
||||
System.out.print("keepSome ");
|
||||
}
|
||||
if ((this.status & 2) > 0) {
|
||||
System.out.print("keepAll ");
|
||||
}
|
||||
if ((this.status & 0x10) > 0) {
|
||||
System.out.print("cleanSome ");
|
||||
}
|
||||
if ((this.status & 0x20) > 0) {
|
||||
System.out.print("cleanAll ");
|
||||
}
|
||||
System.out.println();
|
||||
Iterator iterator = this.childByName.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((Node)iterator.next()).dump(string + this.name + '/');
|
||||
}
|
||||
}
|
||||
|
||||
public void transition(int n) {
|
||||
this.transition(n, 17);
|
||||
}
|
||||
|
||||
private final void transition(int n, int n2) {
|
||||
if (n == this.status || this.status == 2) {
|
||||
return;
|
||||
}
|
||||
if (n == 0) {
|
||||
throw new IllegalArgumentException("Can't transition to unknown");
|
||||
}
|
||||
if (n == 2) {
|
||||
this.status = 2;
|
||||
this.transitionParent(1, n2);
|
||||
this.transitionChildren(2, n2);
|
||||
} else if (n == 1) {
|
||||
if (this.status == 0) {
|
||||
this.status = 1;
|
||||
this.transitionParent(1, n2);
|
||||
} else if (this.status == 32 || this.status == 16) {
|
||||
this.status = 17;
|
||||
this.transitionParent(1, n2);
|
||||
}
|
||||
} else if (n == 16) {
|
||||
if (this.status == 0) {
|
||||
this.status = 16;
|
||||
this.transitionParent(16, n2);
|
||||
} else if (this.status == 1) {
|
||||
this.status = 17;
|
||||
this.transitionParent(16, n2);
|
||||
}
|
||||
} else if (n == 32) {
|
||||
if (this.status == 0) {
|
||||
this.status = 32;
|
||||
this.transitionChildren(32, n2);
|
||||
this.transitionParent(16, n2);
|
||||
} else if ((this.status & 1) > 0) {
|
||||
this.status |= 0x10;
|
||||
this.transitionChildren(32, n2);
|
||||
this.transitionParent(16, n2);
|
||||
} else if (this.status == 16) {
|
||||
this.transitionChildren(32, n2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final void transitionParent(int n, int n2) {
|
||||
if ((n2 & 1) > 0 && this.parent != null) {
|
||||
this.parent.transition(n, n2 & 0xFFFFFFEF);
|
||||
}
|
||||
}
|
||||
|
||||
private final void transitionChildren(int n, int n2) {
|
||||
if ((n2 & 0x10) > 0) {
|
||||
Iterator iterator = this.childByName.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((Node)iterator.next()).transition(n, n2 & 0xFFFFFFFE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.childByName = new TreeMap();
|
||||
this.status = 0;
|
||||
}
|
||||
|
||||
public Node(Node node, String string) {
|
||||
this.this();
|
||||
this.parent = node;
|
||||
this.name = string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BFileSystem
|
||||
* javax.baja.file.BIDirectory
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Cursor
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import com.tridium.platform.daemon.file.FilePathComparator;
|
||||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class DirectoryCursor
|
||||
implements Cursor {
|
||||
private Array dirContents;
|
||||
private int carat;
|
||||
private Object current;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BComponent;
|
||||
static /* synthetic */ Class class$javax$baja$file$BIDirectory;
|
||||
|
||||
public Context getContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
if (this.carat < 0) {
|
||||
this.carat = 0;
|
||||
} else if (this.current != null && this.current instanceof DirectoryCursor) {
|
||||
DirectoryCursor directoryCursor = (DirectoryCursor)this.current;
|
||||
if (!directoryCursor.next()) {
|
||||
this.current = (BIFile)this.dirContents.get(this.carat);
|
||||
++this.carat;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (this.carat < this.dirContents.size()) {
|
||||
if (this.dirContents.get(this.carat) instanceof BIDirectory) {
|
||||
DirectoryCursor directoryCursor = new DirectoryCursor((BIDirectory)this.dirContents.get(this.carat));
|
||||
if (directoryCursor.next()) {
|
||||
this.current = directoryCursor;
|
||||
} else {
|
||||
this.current = (BIFile)this.dirContents.get(this.carat);
|
||||
++this.carat;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.current = (BIFile)this.dirContents.get(this.carat);
|
||||
++this.carat;
|
||||
return true;
|
||||
}
|
||||
this.current = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean nextComponent() {
|
||||
Class clazz = class$javax$baja$sys$BComponent;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$sys$BComponent = DirectoryCursor.class("[Ljavax.baja.sys.BComponent;", false);
|
||||
}
|
||||
return this.next(clazz);
|
||||
}
|
||||
|
||||
public boolean next(Class clazz) {
|
||||
boolean bl = this.next();
|
||||
while (bl && !clazz.isAssignableFrom(this.get().getClass())) {
|
||||
bl = this.next();
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean nextNonDirectory() {
|
||||
boolean bl = this.next();
|
||||
while (bl && this.getFile() instanceof BDirectory) {
|
||||
bl = this.next();
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public BObject get() {
|
||||
if (this.current != null && this.current instanceof DirectoryCursor) {
|
||||
return ((DirectoryCursor)this.current).get();
|
||||
}
|
||||
return (BObject)this.current;
|
||||
}
|
||||
|
||||
public BIFile getFile() {
|
||||
return (BIFile)this.get();
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
public static void main(String[] var0) {
|
||||
try {
|
||||
BFileSystem.INSTANCE.makeDir(new FilePath("^testCursor"));
|
||||
BFileSystem.INSTANCE.makeDir(new FilePath("^testCursor/0"));
|
||||
BFileSystem.INSTANCE.makeDir(new FilePath("^testCursor/0/0.0"));
|
||||
BFileSystem.INSTANCE.makeDir(new FilePath("^testCursor/1"));
|
||||
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/a.txt"));
|
||||
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/0/0a.txt"));
|
||||
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/0/0b.txt"));
|
||||
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/0/0.0/0.0a.txt"));
|
||||
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/0/0.0/0.0b.txt"));
|
||||
var1_1 = (BIDirectory)BFileSystem.INSTANCE.findFile(new FilePath("^testcursor"));
|
||||
System.out.println("full iteration");
|
||||
var2_3 = new DirectoryCursor(var1_1);
|
||||
while (var2_3.next()) {
|
||||
var3_4 = (BIFile)var2_3.get();
|
||||
System.out.println(" " + var3_4.getFilePath().getBody());
|
||||
}
|
||||
System.out.println("directories only");
|
||||
var2_3 = new DirectoryCursor(var1_1);
|
||||
if (true) ** GOTO lbl33
|
||||
do {
|
||||
var3_4 = (BIFile)var2_3.get();
|
||||
System.out.println(" " + var3_4.getFilePath().getBody());
|
||||
lbl33:
|
||||
// 2 sources
|
||||
|
||||
if ((v0 = DirectoryCursor.class$javax$baja$file$BIDirectory) != null) continue;
|
||||
v0 = DirectoryCursor.class("[Ljavax.baja.file.BIDirectory;", false);
|
||||
} while (var2_3.next(v0));
|
||||
}
|
||||
catch (IOException var1_2) {
|
||||
var1_2.printStackTrace();
|
||||
}
|
||||
System.exit(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());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.carat = -1;
|
||||
this.current = null;
|
||||
}
|
||||
|
||||
public DirectoryCursor(BIDirectory bIDirectory) {
|
||||
this.this();
|
||||
this.dirContents = new Array((Object[])bIDirectory.listFiles()).sort(new Comparator(){
|
||||
|
||||
public final int compare(Object object, Object object2) {
|
||||
BIFile bIFile = (BIFile)object;
|
||||
BIFile bIFile2 = (BIFile)object2;
|
||||
return FilePathComparator.INSTANCE.compare(bIFile.getFilePath(), bIFile2.getFilePath());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BFileSpace
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import com.tridium.platform.daemon.DaemonFileUtil;
|
||||
import com.tridium.platform.daemon.file.FilePathComparator;
|
||||
import com.tridium.platform.daemon.file.StoreCache;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
|
||||
public class FileCache
|
||||
extends StoreCache {
|
||||
public static final int FOUND = 0;
|
||||
public static final int NOT_FOUND = 1;
|
||||
public static final int UNKNOWN = 2;
|
||||
private TreeSet pathsNotFound = new TreeSet(FilePathComparator.INSTANCE);
|
||||
private TreeMap fileByPath = new TreeMap(FilePathComparator.INSTANCE);
|
||||
private TreeSet completedPaths = new TreeSet(FilePathComparator.INSTANCE);
|
||||
private BFileSpace space;
|
||||
|
||||
public int getCacheStatus(FilePath filePath) {
|
||||
if (this.pathsNotFound.contains(filePath)) {
|
||||
return 1;
|
||||
}
|
||||
if (this.fileByPath.containsKey(filePath)) {
|
||||
return 0;
|
||||
}
|
||||
if (this.completedPaths.contains(filePath.getParent())) {
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
public BIFile getFile(FilePath filePath) {
|
||||
return (BIFile)this.fileByPath.get(filePath);
|
||||
}
|
||||
|
||||
public BIFileStore getStore(FilePath filePath) {
|
||||
BIFile bIFile = this.getFile(filePath);
|
||||
return bIFile == null ? null : bIFile.getStore();
|
||||
}
|
||||
|
||||
public Collection getCachedFiles() {
|
||||
return this.fileByPath.values();
|
||||
}
|
||||
|
||||
public Set getCachedFilePaths() {
|
||||
return this.fileByPath.keySet();
|
||||
}
|
||||
|
||||
public void cacheResult(BIFileStore bIFileStore) {
|
||||
this.cacheResult(this.space.makeFile(bIFileStore));
|
||||
}
|
||||
|
||||
public void cacheResult(BIFile bIFile) {
|
||||
this.fileByPath.put(bIFile.getFilePath(), bIFile);
|
||||
}
|
||||
|
||||
public void cacheNotFound(FilePath filePath) {
|
||||
this.pathsNotFound.add(filePath);
|
||||
}
|
||||
|
||||
public void cacheCompleted(FilePath filePath) {
|
||||
this.completedPaths.add(filePath);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.pathsNotFound.clear();
|
||||
this.fileByPath.clear();
|
||||
this.completedPaths.clear();
|
||||
}
|
||||
|
||||
public void clear(FilePath filePath) {
|
||||
Object object;
|
||||
Object object2;
|
||||
TreeSet<Object> treeSet = new TreeSet<Object>(FilePathComparator.INSTANCE);
|
||||
Object object3 = this.pathsNotFound.iterator();
|
||||
while (object3.hasNext()) {
|
||||
object2 = new FilePath((String)object3.next());
|
||||
if (DaemonFileUtil.isSubPath((FilePath)object2, filePath)) continue;
|
||||
treeSet.add(object2);
|
||||
}
|
||||
object3 = new TreeMap(FilePathComparator.INSTANCE);
|
||||
object2 = this.fileByPath.keySet().iterator();
|
||||
while (object2.hasNext()) {
|
||||
object = (FilePath)object2.next();
|
||||
if (DaemonFileUtil.isSubPath((FilePath)object, filePath)) continue;
|
||||
((TreeMap)object3).put(object, this.fileByPath.get(object));
|
||||
}
|
||||
object2 = new TreeSet(FilePathComparator.INSTANCE);
|
||||
object = this.completedPaths.iterator();
|
||||
while (object.hasNext()) {
|
||||
FilePath filePath2 = (FilePath)object.next();
|
||||
if (DaemonFileUtil.isSubPath(filePath2, filePath)) continue;
|
||||
((TreeSet)object2).add(filePath2);
|
||||
}
|
||||
this.pathsNotFound = treeSet;
|
||||
this.fileByPath = object3;
|
||||
this.completedPaths = object2;
|
||||
}
|
||||
|
||||
public FileCache(BFileSpace bFileSpace) {
|
||||
this.space = bFileSpace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BAbsTime
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import javax.baja.sys.BAbsTime;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class FileHeaderInfo {
|
||||
private String contentType;
|
||||
private long contentLength;
|
||||
private BAbsTime lastModified;
|
||||
private long crc;
|
||||
|
||||
public void setContentType(String string) {
|
||||
this.contentType = string;
|
||||
}
|
||||
|
||||
public void setContentLength(long l) {
|
||||
this.contentLength = l;
|
||||
}
|
||||
|
||||
public void setLastModified(BAbsTime bAbsTime) {
|
||||
this.lastModified = bAbsTime;
|
||||
}
|
||||
|
||||
public void setCrc(long l) {
|
||||
this.crc = l;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return this.contentType.equalsIgnoreCase("application/x-baja-directory");
|
||||
}
|
||||
|
||||
public long getContentLength() {
|
||||
return this.contentLength;
|
||||
}
|
||||
|
||||
public BAbsTime getLastModified() {
|
||||
return this.lastModified;
|
||||
}
|
||||
|
||||
public long getCrc() {
|
||||
return this.crc;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.contentType = null;
|
||||
this.contentLength = -1;
|
||||
this.lastModified = BAbsTime.NULL;
|
||||
this.crc = -1;
|
||||
}
|
||||
|
||||
public FileHeaderInfo(String string, long l, BAbsTime bAbsTime) {
|
||||
this(string, l, bAbsTime, -1);
|
||||
}
|
||||
|
||||
public FileHeaderInfo(String string, long l, BAbsTime bAbsTime, long l2) {
|
||||
this.this();
|
||||
this.setContentType(string);
|
||||
this.setContentLength(l);
|
||||
this.setLastModified(bAbsTime);
|
||||
this.setCrc(l2);
|
||||
}
|
||||
|
||||
public FileHeaderInfo() {
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.FilePath
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import java.util.Comparator;
|
||||
import javax.baja.file.FilePath;
|
||||
|
||||
public class FilePathComparator
|
||||
implements Comparator {
|
||||
public static FilePathComparator INSTANCE = new FilePathComparator();
|
||||
|
||||
public int compare(Object object, Object object2) {
|
||||
FilePath filePath = (FilePath)object;
|
||||
FilePath filePath2 = (FilePath)object2;
|
||||
return filePath.getBody().compareTo(filePath2.getBody());
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
boolean bl = false;
|
||||
if (object == this) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
private FilePathComparator() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
*/
|
||||
package com.tridium.platform.daemon.file;
|
||||
|
||||
import com.tridium.platform.daemon.DaemonFileUtil;
|
||||
import com.tridium.platform.daemon.file.FilePathComparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
|
||||
public class StoreCache {
|
||||
public static final int FOUND = 0;
|
||||
public static final int NOT_FOUND = 1;
|
||||
public static final int UNKNOWN = 2;
|
||||
private TreeSet pathsNotFound = new TreeSet(FilePathComparator.INSTANCE);
|
||||
private TreeMap storeByPath = new TreeMap(FilePathComparator.INSTANCE);
|
||||
private TreeSet completedPaths = new TreeSet(FilePathComparator.INSTANCE);
|
||||
|
||||
public int getCacheStatus(FilePath filePath) {
|
||||
if (this.pathsNotFound.contains(filePath)) {
|
||||
return 1;
|
||||
}
|
||||
if (this.storeByPath.containsKey(filePath)) {
|
||||
return 0;
|
||||
}
|
||||
if (filePath.getParent() != null && this.completedPaths.contains(filePath.getParent())) {
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
public BIFileStore getStore(FilePath filePath) {
|
||||
return (BIFileStore)this.storeByPath.get(filePath);
|
||||
}
|
||||
|
||||
public void cacheResult(BIFileStore bIFileStore) {
|
||||
this.storeByPath.put(bIFileStore.getFilePath(), bIFileStore);
|
||||
}
|
||||
|
||||
public void cacheNotFound(FilePath filePath) {
|
||||
this.pathsNotFound.add(filePath);
|
||||
}
|
||||
|
||||
public void cacheCompleted(FilePath filePath) {
|
||||
this.completedPaths.add(filePath);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.pathsNotFound.clear();
|
||||
this.storeByPath.clear();
|
||||
this.completedPaths.clear();
|
||||
}
|
||||
|
||||
public void clear(FilePath filePath) {
|
||||
Object object;
|
||||
Object object2;
|
||||
TreeSet<Object> treeSet = new TreeSet<Object>(FilePathComparator.INSTANCE);
|
||||
Object object3 = this.pathsNotFound.iterator();
|
||||
while (object3.hasNext()) {
|
||||
object2 = (FilePath)object3.next();
|
||||
if (DaemonFileUtil.isSubPath((FilePath)object2, filePath)) continue;
|
||||
treeSet.add(object2);
|
||||
}
|
||||
object3 = new TreeMap(FilePathComparator.INSTANCE);
|
||||
object2 = this.storeByPath.keySet().iterator();
|
||||
while (object2.hasNext()) {
|
||||
object = (FilePath)object2.next();
|
||||
if (DaemonFileUtil.isSubPath((FilePath)object, filePath)) continue;
|
||||
((TreeMap)object3).put(object, this.storeByPath.get(object));
|
||||
}
|
||||
object2 = new TreeSet(FilePathComparator.INSTANCE);
|
||||
object = this.completedPaths.iterator();
|
||||
while (object.hasNext()) {
|
||||
FilePath filePath2 = (FilePath)object.next();
|
||||
if (DaemonFileUtil.isSubPath(filePath2, filePath)) continue;
|
||||
((TreeSet)object2).add(filePath2);
|
||||
}
|
||||
this.pathsNotFound = treeSet;
|
||||
this.storeByPath = object3;
|
||||
this.completedPaths = object2;
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
System.out.println("cached not found:");
|
||||
Iterator<Object> iterator = this.pathsNotFound.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
System.out.println(" " + iterator.next());
|
||||
}
|
||||
System.out.println("cached stores:");
|
||||
iterator = this.storeByPath.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
System.out.println(" " + iterator.next());
|
||||
}
|
||||
System.out.println("cached completed:");
|
||||
iterator = this.completedPaths.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
System.out.println(" " + iterator.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user