link start!
This commit is contained in:
@@ -0,0 +1,379 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.category.BCategoryService;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BISession;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BAbstractFile
|
||||
extends BObject
|
||||
implements BIFile {
|
||||
private static final BIcon icon = BIcon.std("file.png");
|
||||
public static final Type TYPE;
|
||||
private BIFileStore store;
|
||||
private boolean pendingMove;
|
||||
static /* synthetic */ Class class$javax$baja$file$BAbstractFile;
|
||||
|
||||
public BIFileStore getStore() {
|
||||
return this.store;
|
||||
}
|
||||
|
||||
public void setStore(BIFileStore bIFileStore) {
|
||||
if (bIFileStore == null) {
|
||||
throw new NullPointerException("null store");
|
||||
}
|
||||
this.store = bIFileStore;
|
||||
}
|
||||
|
||||
public BFileSpace getFileSpace() {
|
||||
return this.getStore().getFileSpace();
|
||||
}
|
||||
|
||||
public FilePath getFilePath() {
|
||||
return this.getStore().getFilePath();
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return this.getStore().getFileName();
|
||||
}
|
||||
|
||||
public String getExtension() {
|
||||
return this.getStore().getExtension();
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return this.getStore().isDirectory();
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return this.getStore().getSize();
|
||||
}
|
||||
|
||||
public BAbsTime getLastModified() {
|
||||
return this.getStore().getLastModified();
|
||||
}
|
||||
|
||||
public boolean setLastModified(BAbsTime bAbsTime) throws IOException {
|
||||
if (this.getStore() instanceof BAbstractFileStore) {
|
||||
return ((BAbstractFileStore)this.getStore()).setLastModified(bAbsTime);
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean isReadonly() {
|
||||
return this.getStore().isReadonly();
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return this.getStore().getInputStream();
|
||||
}
|
||||
|
||||
public byte[] read() throws IOException {
|
||||
return this.getStore().read();
|
||||
}
|
||||
|
||||
public void delete() throws IOException {
|
||||
this.getFileSpace().delete(this.getFilePath());
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
return this.getStore().getOutputStream();
|
||||
}
|
||||
|
||||
public void write(byte[] byArray) throws IOException {
|
||||
this.getStore().write(byArray);
|
||||
}
|
||||
|
||||
public String getMimeType() {
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
public long getCrc() throws IOException {
|
||||
if (this.getStore() instanceof BAbstractFileStore) {
|
||||
return ((BAbstractFileStore)this.getStore()).getCrc();
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean isMounted() {
|
||||
BFileSpace bFileSpace = this.getFileSpace();
|
||||
boolean bl = false;
|
||||
if (bFileSpace != null && bFileSpace.isMounted()) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public BHost getHost() {
|
||||
BFileSpace bFileSpace = this.getFileSpace();
|
||||
if (bFileSpace == null) {
|
||||
return null;
|
||||
}
|
||||
return bFileSpace.getHost();
|
||||
}
|
||||
|
||||
public BISession getSession() {
|
||||
BFileSpace bFileSpace = this.getFileSpace();
|
||||
if (bFileSpace == null) {
|
||||
return null;
|
||||
}
|
||||
return bFileSpace.getSession();
|
||||
}
|
||||
|
||||
public BSpace getSpace() {
|
||||
return this.getFileSpace();
|
||||
}
|
||||
|
||||
public BOrd getAbsoluteOrd() {
|
||||
BFileSpace bFileSpace = this.getFileSpace();
|
||||
if (bFileSpace == null) {
|
||||
return null;
|
||||
}
|
||||
return bFileSpace.getAbsoluteOrd(this.getFilePath());
|
||||
}
|
||||
|
||||
public BOrd getOrdInHost() {
|
||||
BFileSpace bFileSpace = this.getFileSpace();
|
||||
if (bFileSpace == null) {
|
||||
return null;
|
||||
}
|
||||
return bFileSpace.getOrdInHost(this.getFilePath());
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession() {
|
||||
BFileSpace bFileSpace = this.getFileSpace();
|
||||
if (bFileSpace == null) {
|
||||
return null;
|
||||
}
|
||||
return bFileSpace.getOrdInSession(this.getFilePath());
|
||||
}
|
||||
|
||||
public BOrd getOrdInSpace() {
|
||||
return this.getOrdInSession();
|
||||
}
|
||||
|
||||
public boolean isPendingMove() {
|
||||
return this.pendingMove;
|
||||
}
|
||||
|
||||
public void setPendingMove(boolean bl) {
|
||||
this.pendingMove = bl;
|
||||
}
|
||||
|
||||
public String getNavName() {
|
||||
return this.getFileName();
|
||||
}
|
||||
|
||||
public String getNavDisplayName(Context context) {
|
||||
return this.getNavName();
|
||||
}
|
||||
|
||||
public BINavNode getNavParent() {
|
||||
FilePath filePath = this.getFilePath().getParent();
|
||||
if (filePath != null) {
|
||||
return this.getFileSpace().findFile(filePath);
|
||||
}
|
||||
return this.getFileSpace();
|
||||
}
|
||||
|
||||
public BINavNode resolveNavChild(String string) {
|
||||
BINavNode bINavNode = this.getNavChild(string);
|
||||
if (bINavNode == null) {
|
||||
throw new UnresolvedException(string);
|
||||
}
|
||||
return bINavNode;
|
||||
}
|
||||
|
||||
public BOrd getNavOrd() {
|
||||
return this.getAbsoluteOrd();
|
||||
}
|
||||
|
||||
public BIcon getNavIcon() {
|
||||
return this.getIcon();
|
||||
}
|
||||
|
||||
public BCategoryMask getCategoryMask() {
|
||||
return BCategoryService.getService().getCategoryMask(this.getNavOrd());
|
||||
}
|
||||
|
||||
public BCategoryMask getAppliedCategoryMask() {
|
||||
return BCategoryService.getService().getAppliedCategoryMask(this.getNavOrd());
|
||||
}
|
||||
|
||||
public BPermissions getPermissions(Context context) {
|
||||
return this.getStore().getPermissions(this, context);
|
||||
}
|
||||
|
||||
public boolean canRead(OrdTarget ordTarget) {
|
||||
return ordTarget.getPermissionsForTarget().has(1);
|
||||
}
|
||||
|
||||
public boolean canWrite(OrdTarget ordTarget) {
|
||||
return ordTarget.getPermissionsForTarget().has(2);
|
||||
}
|
||||
|
||||
public boolean canInvoke(OrdTarget ordTarget) {
|
||||
return ordTarget.getPermissionsForTarget().has(4);
|
||||
}
|
||||
|
||||
public String toPathString() {
|
||||
BOrd bOrd = this.getOrdInSession();
|
||||
if (bOrd != null) {
|
||||
return bOrd.toString();
|
||||
}
|
||||
return "?" + this.getType() + '?';
|
||||
}
|
||||
|
||||
public int compareTo(Object object) {
|
||||
BIFile bIFile = (BIFile)object;
|
||||
if (this.isDirectory()) {
|
||||
if (!bIFile.isDirectory()) {
|
||||
return -1;
|
||||
}
|
||||
return this.getFileName().compareToIgnoreCase(bIFile.getFileName());
|
||||
}
|
||||
if (bIFile.isDirectory()) {
|
||||
return 1;
|
||||
}
|
||||
return this.getFileName().compareToIgnoreCase(bIFile.getFileName());
|
||||
}
|
||||
|
||||
public String toString(Context context) {
|
||||
if (this.getStore() == null) {
|
||||
return super.toString(context);
|
||||
}
|
||||
return this.getStore().toString(context);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.getStore().hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof BIFile) {
|
||||
BIFile bIFile = (BIFile)object;
|
||||
return this.getStore().equals(bIFile.getStore());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
try {
|
||||
BFileSystem.threadLocalContext.set(spyWriter.getContext());
|
||||
super.spy(spyWriter);
|
||||
spyWriter.startProps();
|
||||
spyWriter.trTitle("File", 2);
|
||||
spyWriter.prop((Object)"fileName", this.getFileName());
|
||||
spyWriter.prop((Object)"store.type", this.getStore().getType());
|
||||
spyWriter.prop((Object)"store.toString", this.getStore().toString());
|
||||
spyWriter.prop((Object)"isDirectory", this.isDirectory());
|
||||
spyWriter.prop((Object)"readonly", this.isReadonly());
|
||||
spyWriter.prop((Object)"size", "" + this.getSize());
|
||||
spyWriter.prop((Object)"lastModified", this.getLastModified());
|
||||
spyWriter.trTitle("SpaceNode", 2);
|
||||
spyWriter.prop((Object)"isMounted", this.isMounted());
|
||||
spyWriter.prop((Object)"host", this.getHost());
|
||||
spyWriter.prop((Object)"session", this.getSession());
|
||||
spyWriter.prop((Object)"space", this.getSpace());
|
||||
spyWriter.prop((Object)"absoluteOrd", this.getAbsoluteOrd());
|
||||
spyWriter.prop((Object)"ordInHost", this.getOrdInHost());
|
||||
spyWriter.prop((Object)"ordInSession", this.getOrdInSession());
|
||||
spyWriter.prop((Object)"ordInSpace", this.getOrdInSpace());
|
||||
spyWriter.prop((Object)"navOrd", this.getNavOrd());
|
||||
spyWriter.prop((Object)"permissions", this.getPermissions(null));
|
||||
if (this.getStore() instanceof BAbstractFileStore) {
|
||||
spyWriter.prop((Object)"crc", String.valueOf(this.getCrc()));
|
||||
}
|
||||
spyWriter.endProps();
|
||||
BINavNode[] bINavNodeArray = this.getNavChildren();
|
||||
if (bINavNodeArray != null && bINavNodeArray.length > 0) {
|
||||
spyWriter.startTable(false);
|
||||
spyWriter.trTitle("Children", 1);
|
||||
int n = 0;
|
||||
while (n < bINavNodeArray.length) {
|
||||
spyWriter.tr("<a href='" + bINavNodeArray[n].getNavName() + "'>" + bINavNodeArray[n].toString() + "</a>");
|
||||
++n;
|
||||
}
|
||||
spyWriter.endTable();
|
||||
}
|
||||
Object var3_6 = null;
|
||||
BFileSystem.threadLocalContext.set(null);
|
||||
return;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var3_5 = null;
|
||||
BFileSystem.threadLocalContext.set(null);
|
||||
throw throwable;
|
||||
}
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BAbstractFile(BIFileStore bIFileStore) {
|
||||
this.setStore(bIFileStore);
|
||||
}
|
||||
|
||||
public BAbstractFile() {
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BAbstractFile;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BAbstractFile = BAbstractFile.class("[Ljavax.baja.file.BAbstractFile;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import com.tridium.util.BRestrictedFileSpace;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.FileUtil;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BModule;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.user.BUser;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BAbstractFileStore
|
||||
extends BObject
|
||||
implements BIFileStore {
|
||||
private static final int READONLY_MASK = -35;
|
||||
public static final Type TYPE;
|
||||
private BFileSpace space;
|
||||
private FilePath path;
|
||||
static /* synthetic */ Class class$javax$baja$file$BAbstractFileStore;
|
||||
|
||||
public BFileSpace getFileSpace() {
|
||||
return this.space;
|
||||
}
|
||||
|
||||
public FilePath getFilePath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return this.getFilePath().getName();
|
||||
}
|
||||
|
||||
public String getExtension() {
|
||||
return FileUtil.getExtension(this.getFileName());
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public BAbsTime getLastModified() {
|
||||
return BAbsTime.NULL;
|
||||
}
|
||||
|
||||
public final boolean setLastModified(BAbsTime bAbsTime) throws IOException {
|
||||
bAbsTime = BAbsTime.make(bAbsTime.getYear(), bAbsTime.getMonth(), bAbsTime.getDay(), bAbsTime.getHour(), bAbsTime.getMinute(), bAbsTime.getSecond(), 0, bAbsTime.getTimeZone());
|
||||
return this.doSetLastModified(bAbsTime);
|
||||
}
|
||||
|
||||
protected boolean doSetLastModified(BAbsTime bAbsTime) throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
public byte[] read() throws IOException {
|
||||
return FileUtil.read(this);
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
public void write(byte[] byArray) throws IOException {
|
||||
FileUtil.write(this, byArray);
|
||||
}
|
||||
|
||||
public BPermissions getPermissions(BIFile bIFile, Context context) {
|
||||
BPermissions bPermissions = BPermissions.all;
|
||||
if (context != null && context.getUser() != null) {
|
||||
BUser bUser = context.getUser();
|
||||
bPermissions = this.space instanceof BModule ? BPermissions.operatorRead : (!bUser.getPermissions().isSuperUser() && this.path.getAbsoluteMode() != 4 || BRestrictedFileSpace.INSTANCE.isBlacklistedForUser(bUser, bIFile) ? BPermissions.none : context.getUser().getPermissionsFor(bIFile));
|
||||
}
|
||||
if (this.isReadonly()) {
|
||||
bPermissions = BPermissions.make(bPermissions.getMask() & 0xFFFFFFDD);
|
||||
}
|
||||
return bPermissions;
|
||||
}
|
||||
|
||||
public String toString(Context context) {
|
||||
return String.valueOf(this.path);
|
||||
}
|
||||
|
||||
public long getCrc() throws IOException {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BAbstractFileStore(BFileSpace bFileSpace, FilePath filePath) {
|
||||
this.space = bFileSpace;
|
||||
this.path = filePath;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BAbstractFileStore;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BAbstractFileStore = BAbstractFileStore.class("[Ljavax.baja.file.BAbstractFileStore;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.file.BAbstractFile;
|
||||
import javax.baja.file.BIDataFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BDataFile
|
||||
extends BAbstractFile
|
||||
implements BIDataFile {
|
||||
private static final BIcon icon = BIcon.std("file.png");
|
||||
public static final Type TYPE;
|
||||
static final BINavNode[] NO_NAV_NODES;
|
||||
static /* synthetic */ Class class$javax$baja$file$BDataFile;
|
||||
|
||||
public String getNavDescription(Context context) {
|
||||
return this.getSize() / 1024L + "kb " + this.getLastModified();
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
return NO_NAV_NODES;
|
||||
}
|
||||
|
||||
public AgentList getAgents(Context context) {
|
||||
AgentList agentList = super.getAgents(context);
|
||||
agentList.toTop("web:FileDownloadView");
|
||||
return agentList;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BDataFile(BIFileStore bIFileStore) {
|
||||
super(bIFileStore);
|
||||
}
|
||||
|
||||
public BDataFile() {
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BDataFile;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BDataFile = BDataFile.class("[Ljavax.baja.file.BDataFile;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
NO_NAV_NODES = new BINavNode[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.file.BAbstractFile;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.util.LexiconText;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BDirectory
|
||||
extends BAbstractFile
|
||||
implements BIDirectory {
|
||||
private static final BIcon defaultIcon = BIcon.std("folder.png");
|
||||
public static final Type TYPE;
|
||||
private LexiconText lexText;
|
||||
BIcon icon;
|
||||
BINavNode navParent;
|
||||
static /* synthetic */ Class class$javax$baja$file$BDirectory;
|
||||
|
||||
public BIFile[] listFiles() {
|
||||
return this.getFileSpace().getChildren(this);
|
||||
}
|
||||
|
||||
public String getMimeType() {
|
||||
return "application/x-baja-directory";
|
||||
}
|
||||
|
||||
public LexiconText getLexiconText() {
|
||||
return this.lexText;
|
||||
}
|
||||
|
||||
public void setLexiconText(LexiconText lexiconText) {
|
||||
this.lexText = lexiconText;
|
||||
}
|
||||
|
||||
public String getNavDisplayName(Context context) {
|
||||
if (this.lexText != null) {
|
||||
return this.lexText.getText(context);
|
||||
}
|
||||
return this.getNavName();
|
||||
}
|
||||
|
||||
public String getNavDescription(Context context) {
|
||||
if (this.lexText != null) {
|
||||
return Lexicon.make(this.lexText.module, context).get(this.lexText.key + ".description", null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BINavNode getNavParent() {
|
||||
if (this.navParent != null) {
|
||||
return this.navParent;
|
||||
}
|
||||
return super.getNavParent();
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
return this.getFileSpace().getChild(this, string);
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
return this.getFileSpace().getChildren(this);
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
if (this.icon != null) {
|
||||
return this.icon;
|
||||
}
|
||||
return defaultIcon;
|
||||
}
|
||||
|
||||
public void setIcon(BIcon bIcon) {
|
||||
this.icon = bIcon;
|
||||
}
|
||||
|
||||
public AgentList getAgents(Context context) {
|
||||
AgentList agentList = super.getAgents(context);
|
||||
agentList.toTop("workbench:DirectoryList");
|
||||
agentList.toTop("hx:HxDirectoryView");
|
||||
agentList.toBottom("web:FileUploadView");
|
||||
return agentList;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BDirectory(BIFileStore bIFileStore, LexiconText lexiconText) {
|
||||
super(bIFileStore);
|
||||
this.lexText = lexiconText;
|
||||
}
|
||||
|
||||
public BDirectory(BIFileStore bIFileStore) {
|
||||
super(bIFileStore);
|
||||
}
|
||||
|
||||
public BDirectory() {
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BDirectory;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BDirectory = BDirectory.class("[Ljavax.baja.file.BDirectory;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import javax.baja.agent.BIAgent;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.ExportOp;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BExporter
|
||||
extends BComponent
|
||||
implements BIAgent {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$file$BExporter;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public abstract TypeInfo getFileType();
|
||||
|
||||
public abstract String getFileExtension();
|
||||
|
||||
public final String getFileMimeType() {
|
||||
return ((BIFile)((Object)this.getFileType().getInstance())).getMimeType();
|
||||
}
|
||||
|
||||
public abstract void export(ExportOp var1) throws Exception;
|
||||
|
||||
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$javax$baja$file$BExporter;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BExporter = BExporter.class("[Ljavax.baja.file.BExporter;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import com.tridium.util.BRestrictedFileSpace;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.space.BSpaceScheme;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFileScheme
|
||||
extends BSpaceScheme {
|
||||
public static final BFileScheme INSTANCE = new BFileScheme("file");
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$file$BFileScheme;
|
||||
|
||||
public OrdQuery parse(String string) {
|
||||
return new FilePath(this.getId(), string);
|
||||
}
|
||||
|
||||
public Type getSpaceType() {
|
||||
return BFileSpace.TYPE;
|
||||
}
|
||||
|
||||
public OrdTarget resolve(OrdTarget ordTarget, OrdQuery ordQuery, BSpace bSpace) {
|
||||
String string;
|
||||
FilePath filePath = (FilePath)ordQuery;
|
||||
BFileSpace bFileSpace = (BFileSpace)bSpace;
|
||||
if (bFileSpace == BFileSystem.INSTANCE && ordTarget != null && (ordTarget.getUser() != null || ordTarget.getFacet("username") instanceof BString)) {
|
||||
bFileSpace = BRestrictedFileSpace.INSTANCE;
|
||||
}
|
||||
if ((string = filePath.getBody()).equals("") || string.equals("/")) {
|
||||
return new OrdTarget(ordTarget, bFileSpace);
|
||||
}
|
||||
return new OrdTarget(ordTarget, (BObject)((Object)bFileSpace.resolveFile(filePath)));
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
protected BFileScheme(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BFileScheme;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BFileScheme = BFileScheme.class("[Ljavax.baja.file.BFileScheme;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.category.BCategoryService;
|
||||
import javax.baja.category.BICategorizable;
|
||||
import javax.baja.file.BDataFile;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.BLocalFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.FileUtil;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.security.BIProtected;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.security.PermissionException;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.BIcon;
|
||||
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 BFileSpace
|
||||
extends BSpace
|
||||
implements BIDirectory,
|
||||
BICategorizable,
|
||||
BIProtected {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
static final BIFile[] NO_FILES;
|
||||
static /* synthetic */ Class class$javax$baja$file$BFileSpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public abstract BDirectory makeDir(FilePath var1, Context var2) throws IOException;
|
||||
|
||||
public final BDirectory makeDir(FilePath filePath) throws IOException {
|
||||
return this.makeDir(filePath, null);
|
||||
}
|
||||
|
||||
public abstract BIFile makeFile(FilePath var1, Context var2) throws IOException;
|
||||
|
||||
public final BIFile makeFile(FilePath filePath) throws IOException {
|
||||
return this.makeFile(filePath, null);
|
||||
}
|
||||
|
||||
public abstract void move(FilePath var1, FilePath var2, Context var3) throws IOException;
|
||||
|
||||
public final void move(FilePath filePath, FilePath filePath2) throws IOException {
|
||||
this.move(filePath, filePath2, null);
|
||||
}
|
||||
|
||||
public abstract void delete(FilePath var1, Context var2) throws IOException;
|
||||
|
||||
public final void delete(FilePath filePath) throws IOException {
|
||||
this.delete(filePath, null);
|
||||
}
|
||||
|
||||
public BOrd getAbsoluteOrd(FilePath filePath) {
|
||||
return this.appendFilePathToOrd(this.getAbsoluteOrd(), filePath);
|
||||
}
|
||||
|
||||
public BOrd getOrdInHost(FilePath filePath) {
|
||||
return this.appendFilePathToOrd(this.getOrdInHost(), filePath);
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession(FilePath filePath) {
|
||||
return this.appendFilePathToOrd(this.getOrdInSession(), filePath);
|
||||
}
|
||||
|
||||
protected BOrd appendFilePathToOrd(BOrd bOrd, FilePath filePath) {
|
||||
if (bOrd == null) {
|
||||
return null;
|
||||
}
|
||||
if (bOrd.toString().length() == 0) {
|
||||
return BOrd.make(filePath);
|
||||
}
|
||||
return BOrd.make(bOrd.toString() + filePath.getBody());
|
||||
}
|
||||
|
||||
public BIFile findFile(FilePath filePath) {
|
||||
BIFileStore bIFileStore = this.findStore(filePath);
|
||||
if (bIFileStore != null) {
|
||||
return this.makeFile(bIFileStore);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract BIFileStore findStore(FilePath var1);
|
||||
|
||||
public BIFile resolveFile(FilePath filePath) {
|
||||
BIFile bIFile = this.findFile(filePath);
|
||||
if (bIFile == null) {
|
||||
throw new UnresolvedException("" + filePath);
|
||||
}
|
||||
return bIFile;
|
||||
}
|
||||
|
||||
public abstract BIFile getChild(BIFile var1, String var2);
|
||||
|
||||
public abstract BIFile[] getChildren(BIFile var1);
|
||||
|
||||
public BIFile makeFile(BIFileStore bIFileStore) {
|
||||
if (bIFileStore.isDirectory()) {
|
||||
return new BDirectory(bIFileStore);
|
||||
}
|
||||
String string = bIFileStore.getExtension();
|
||||
if (string != null && string.length() > 0) {
|
||||
TypeInfo typeInfo = Sys.getRegistry().getFileTypeForExtension(string);
|
||||
try {
|
||||
BIFile bIFile = (BIFile)((Object)typeInfo.getInstance());
|
||||
bIFile.setStore(bIFileStore);
|
||||
return bIFile;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
FileUtil.log.error("Cannot create file " + typeInfo + " for ext " + string, throwable);
|
||||
}
|
||||
}
|
||||
return new BDataFile(bIFileStore);
|
||||
}
|
||||
|
||||
public BPermissions getPermissionsFor(FilePath filePath, Context context) {
|
||||
BPermissions bPermissions = BPermissions.all;
|
||||
if (context == null || context.getUser() == null) {
|
||||
return bPermissions;
|
||||
}
|
||||
try {
|
||||
BLocalFileStore bLocalFileStore = new BLocalFileStore(this, filePath, new File("dummy"));
|
||||
BDataFile bDataFile = new BDataFile(bLocalFileStore);
|
||||
return context.getUser().getPermissionsFor(bDataFile);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return bPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
public void checkReadPermission(FilePath filePath, Context context) {
|
||||
if (!this.getPermissionsFor(filePath, context).hasOperatorRead()) {
|
||||
throw new PermissionException("Missing operator read");
|
||||
}
|
||||
}
|
||||
|
||||
public void checkWritePermission(FilePath filePath, Context context) {
|
||||
if (!this.getPermissionsFor(filePath, context).hasOperatorWrite()) {
|
||||
throw new PermissionException("Missing operator write");
|
||||
}
|
||||
}
|
||||
|
||||
public BCategoryMask getCategoryMask() {
|
||||
return BCategoryService.getService().getCategoryMask(this.getNavOrd());
|
||||
}
|
||||
|
||||
public BCategoryMask getAppliedCategoryMask() {
|
||||
return BCategoryService.getService().getAppliedCategoryMask(this.getNavOrd());
|
||||
}
|
||||
|
||||
public BPermissions getPermissions(Context context) {
|
||||
if (context != null && context.getUser() != null) {
|
||||
return context.getUser().getPermissionsFor(this);
|
||||
}
|
||||
return BPermissions.all;
|
||||
}
|
||||
|
||||
public boolean canRead(OrdTarget ordTarget) {
|
||||
return ordTarget.getPermissionsForTarget().hasOperatorRead();
|
||||
}
|
||||
|
||||
public boolean canWrite(OrdTarget ordTarget) {
|
||||
return ordTarget.getPermissionsForTarget().hasOperatorWrite();
|
||||
}
|
||||
|
||||
public boolean canInvoke(OrdTarget ordTarget) {
|
||||
return ordTarget.getPermissionsForTarget().hasOperatorInvoke();
|
||||
}
|
||||
|
||||
public AgentList getAgents(Context context) {
|
||||
AgentList agentList = super.getAgents(context);
|
||||
agentList.toTop("workbench:DirectoryList");
|
||||
agentList.toTop("hx:HxDirectoryView");
|
||||
agentList.toBottom("web:FileUploadView");
|
||||
return agentList;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
public BFileSpace(String string, LexiconText lexiconText) {
|
||||
super(string, lexiconText);
|
||||
}
|
||||
|
||||
public BFileSpace(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BFileSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BFileSpace = BFileSpace.class("[Ljavax.baja.file.BFileSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
icon = BIcon.std("drive.png");
|
||||
NO_FILES = new BIFile[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,537 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.SortUtil
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import com.tridium.sys.Nre;
|
||||
import com.tridium.util.ArrayUtil;
|
||||
import com.tridium.util.BRestrictedFileSpace;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.BLocalFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.FileUtil;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BLocalHost;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nav.BNavRoot;
|
||||
import javax.baja.nav.NavEvent;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BString;
|
||||
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 class BFileSystem
|
||||
extends BFileSpace {
|
||||
public static final Type TYPE;
|
||||
public static final BFileSystem INSTANCE;
|
||||
static final Log log;
|
||||
static ThreadLocal threadLocalContext;
|
||||
private BOrd ordInHost;
|
||||
private BOrd ordInSession;
|
||||
private HashMap specials;
|
||||
private BDirectory[] roots;
|
||||
private String baseOrdSysHome;
|
||||
private String baseOrdStationHome;
|
||||
private String baseOrdStationToSysHome;
|
||||
private BDirectory sysHome;
|
||||
private BDirectory stationHome;
|
||||
static /* synthetic */ Class class$javax$baja$file$BFileSystem;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
private final void init() {
|
||||
Object object;
|
||||
this.ordInHost = this.ordInSession = BOrd.make("file:");
|
||||
ArrayList<BDirectory> arrayList = new ArrayList<BDirectory>();
|
||||
this.specials = new HashMap();
|
||||
File file = Sys.getBajaHome();
|
||||
BLocalFileStore bLocalFileStore = new BLocalFileStore(this, new FilePath("!"), file);
|
||||
this.sysHome = new BDirectory(bLocalFileStore, LexiconText.make("baja", "nav.sysHome"));
|
||||
this.sysHome.icon = BIcon.std("home.png");
|
||||
arrayList.add(this.sysHome);
|
||||
this.specials.put("!", this.sysHome);
|
||||
this.baseOrdSysHome = this.localFileToOrd(file).toString();
|
||||
File file2 = Sys.getStationHome();
|
||||
if (file2 != null) {
|
||||
object = new BLocalFileStore(this, new FilePath("^"), file2);
|
||||
this.stationHome = new BDirectory((BIFileStore)object, LexiconText.make("baja", "nav.stationHome"));
|
||||
this.stationHome.icon = BIcon.std("database.png");
|
||||
arrayList.add(this.stationHome);
|
||||
this.specials.put("^", this.stationHome);
|
||||
String string = file2.getPath().substring(file.getPath().length() + 1);
|
||||
string = string.replace('\\', '/');
|
||||
this.baseOrdStationHome = this.localFileToOrd(file2).toString();
|
||||
this.baseOrdStationToSysHome = "local:|file:!" + string;
|
||||
}
|
||||
if (((File[])(object = File.listRoots())).length == 1 && object[0].getPath().equals("/")) {
|
||||
object = object[0].listFiles();
|
||||
}
|
||||
int n = 0;
|
||||
while (n < ((File[])object).length) {
|
||||
BDirectory bDirectory = this.toRoot(object[n]);
|
||||
bDirectory.icon = this.getIcon();
|
||||
bDirectory.navParent = this;
|
||||
arrayList.add(bDirectory);
|
||||
this.specials.put("/" + TextUtil.toLowerCase((String)bDirectory.getFileName()), bDirectory);
|
||||
++n;
|
||||
}
|
||||
this.roots = arrayList.toArray(new BDirectory[arrayList.size()]);
|
||||
}
|
||||
|
||||
private final BDirectory toRoot(File file) {
|
||||
try {
|
||||
String string = file.getPath();
|
||||
string = string.replace('\\', '/');
|
||||
if (string.endsWith("/")) {
|
||||
string = string.substring(0, string.length() - 1);
|
||||
}
|
||||
if (!string.startsWith("/")) {
|
||||
string = "/" + string;
|
||||
}
|
||||
FilePath filePath = new FilePath(string);
|
||||
BLocalFileStore bLocalFileStore = new BLocalFileStore(this, filePath, file);
|
||||
return new BDirectory(bLocalFileStore);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
FileUtil.log.error("Cannot create root " + file, exception);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private final void syncRoots() {
|
||||
File[] fileArray = File.listRoots();
|
||||
if (fileArray.length == 1 && fileArray[0].getPath().equals("/")) {
|
||||
fileArray = fileArray[0].listFiles();
|
||||
}
|
||||
BDirectory[] bDirectoryArray = new BDirectory[fileArray.length];
|
||||
int n = 0;
|
||||
while (n < fileArray.length) {
|
||||
bDirectoryArray[n] = this.toRoot(fileArray[n]);
|
||||
++n;
|
||||
}
|
||||
Object[] objectArray = this.specials.keySet().toArray();
|
||||
int n2 = 0;
|
||||
while (n2 < objectArray.length) {
|
||||
BDirectory bDirectory = (BDirectory)this.specials.get(objectArray[n2]);
|
||||
boolean bl = false;
|
||||
int n3 = 0;
|
||||
while (n3 < bDirectoryArray.length) {
|
||||
if (bDirectoryArray[n3].equals(bDirectory)) {
|
||||
bl = true;
|
||||
break;
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
if (!bl && !objectArray[n2].equals("!")) {
|
||||
this.roots = (BDirectory[])ArrayUtil.removeOne((Object[])this.roots, bDirectory);
|
||||
this.specials.remove(objectArray[n2]);
|
||||
this.fireNavEvent(NavEvent.makeRemoved(this, bDirectory.getFileName(), null));
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
n2 = 0;
|
||||
while (n2 < bDirectoryArray.length) {
|
||||
if (this.specials.get("/" + TextUtil.toLowerCase((String)bDirectoryArray[n2].getFileName())) == null) {
|
||||
bDirectoryArray[n2].icon = this.getIcon();
|
||||
bDirectoryArray[n2].navParent = this;
|
||||
this.roots = (BDirectory[])ArrayUtil.addOne(this.roots, bDirectoryArray[n2]);
|
||||
this.specials.put("/" + TextUtil.toLowerCase((String)bDirectoryArray[n2].getFileName()), bDirectoryArray[n2]);
|
||||
this.fireNavEvent(NavEvent.makeAdded(this, bDirectoryArray[n2].getFileName(), null));
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
|
||||
public BDirectory getSysHome() {
|
||||
return this.sysHome;
|
||||
}
|
||||
|
||||
public BDirectory getStationHome() {
|
||||
return this.stationHome;
|
||||
}
|
||||
|
||||
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
|
||||
this.checkWritePermission(filePath, context);
|
||||
File file = this.pathToLocalFile(filePath);
|
||||
NavEvent navEvent = this.precheckAddEvent(file);
|
||||
if (file.exists()) {
|
||||
if (!file.isDirectory()) {
|
||||
throw new IOException("Exists as file: " + filePath.getBody());
|
||||
}
|
||||
} else {
|
||||
file.mkdirs();
|
||||
}
|
||||
if (navEvent != null) {
|
||||
this.fireNavEvent(navEvent);
|
||||
}
|
||||
return new BDirectory(new BLocalFileStore(INSTANCE, filePath, file));
|
||||
}
|
||||
|
||||
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
|
||||
Object object;
|
||||
this.checkWritePermission(filePath, context);
|
||||
File file = this.pathToLocalFile(filePath);
|
||||
NavEvent navEvent = this.precheckAddEvent(file);
|
||||
if (file.exists()) {
|
||||
if (file.isDirectory()) {
|
||||
throw new IllegalArgumentException("Exists as dir: " + filePath.getBody());
|
||||
}
|
||||
} else {
|
||||
object = new File(file.getParent());
|
||||
if (!((File)object).exists()) {
|
||||
((File)object).mkdirs();
|
||||
}
|
||||
}
|
||||
if (!file.exists()) {
|
||||
object = new FileOutputStream(file);
|
||||
((FileOutputStream)object).close();
|
||||
}
|
||||
if (navEvent != null) {
|
||||
this.fireNavEvent(navEvent);
|
||||
}
|
||||
return this.makeFile(new BLocalFileStore(INSTANCE, filePath, file));
|
||||
}
|
||||
|
||||
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
|
||||
File file;
|
||||
File file2;
|
||||
boolean bl;
|
||||
this.checkWritePermission(filePath, context);
|
||||
this.checkWritePermission(filePath2, context);
|
||||
boolean bl2 = false;
|
||||
if (filePath2.getBody().indexOf(47) < 0) {
|
||||
bl2 = bl = true;
|
||||
}
|
||||
if (filePath2.isRelative()) {
|
||||
filePath2 = filePath.getParent().merge(filePath2);
|
||||
}
|
||||
if (!(file2 = this.pathToLocalFile(filePath)).renameTo(file = this.pathToLocalFile(filePath2))) {
|
||||
throw new IOException("Move: " + file2 + " -> " + file);
|
||||
}
|
||||
if (bl) {
|
||||
BOrd bOrd = BOrd.make("local:|" + filePath.getParent());
|
||||
this.fireNavEvent(NavEvent.makeRenamed(bOrd, filePath.getName(), filePath2.getName(), null));
|
||||
} else {
|
||||
BOrd bOrd = BOrd.make("local:|" + filePath.getParent());
|
||||
this.fireNavEvent(NavEvent.makeRemoved(bOrd, filePath.getName(), null));
|
||||
BOrd bOrd2 = BOrd.make("local:|" + filePath2.getParent());
|
||||
this.fireNavEvent(NavEvent.makeAdded(bOrd2, filePath2.getName(), null));
|
||||
}
|
||||
}
|
||||
|
||||
public void delete(FilePath filePath, Context context) throws IOException {
|
||||
this.checkWritePermission(filePath, context);
|
||||
BIFile bIFile = this.findFile(filePath);
|
||||
if (bIFile == null) {
|
||||
return;
|
||||
}
|
||||
BLocalFileStore bLocalFileStore = (BLocalFileStore)bIFile.getStore();
|
||||
File file = bLocalFileStore.getLocalFile();
|
||||
FileUtil.delete(file);
|
||||
File file2 = new File(file.getParent());
|
||||
FilePath filePath2 = bIFile.getFilePath().getParent();
|
||||
BDirectory bDirectory = new BDirectory(new BLocalFileStore(this, filePath2, file2));
|
||||
NavEvent navEvent = NavEvent.makeRemoved(bDirectory.getNavOrd(), bIFile.getFileName(), null);
|
||||
this.fireNavEvent(navEvent);
|
||||
}
|
||||
|
||||
private final NavEvent precheckAddEvent(File file) {
|
||||
if (file.exists()) {
|
||||
return null;
|
||||
}
|
||||
File file2 = file;
|
||||
File file3 = null;
|
||||
while (!file2.exists()) {
|
||||
file3 = file2;
|
||||
file2 = new File(file2.getParent());
|
||||
}
|
||||
BOrd bOrd = this.localFileToOrd(file2);
|
||||
String string = file3.getName();
|
||||
return NavEvent.makeAdded(bOrd, string, null);
|
||||
}
|
||||
|
||||
protected void fireNavEvent(NavEvent navEvent) {
|
||||
BNavRoot.INSTANCE.fireNavEvent(navEvent);
|
||||
String string = navEvent.getParentOrd().toString();
|
||||
if (this.baseOrdStationHome != null) {
|
||||
if (string.startsWith("local:|file:^")) {
|
||||
String string2 = string.substring("local:|file:^".length());
|
||||
if (string2.length() > 0) {
|
||||
string2 = "/" + string2;
|
||||
}
|
||||
BOrd bOrd = BOrd.make(this.baseOrdStationHome + string2);
|
||||
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
|
||||
BOrd bOrd2 = BOrd.make(this.baseOrdStationToSysHome + string2);
|
||||
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd2));
|
||||
return;
|
||||
}
|
||||
if (string.startsWith(this.baseOrdStationToSysHome)) {
|
||||
BOrd bOrd = BOrd.make(this.baseOrdSysHome + '/' + string.substring("local:|file:!".length()));
|
||||
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
|
||||
BOrd bOrd3 = string.length() == this.baseOrdStationToSysHome.length() ? BOrd.make("local:|file:^") : BOrd.make("local:|file:^" + string.substring(this.baseOrdStationToSysHome.length() + 1));
|
||||
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd3));
|
||||
return;
|
||||
}
|
||||
if (string.startsWith(this.baseOrdStationHome)) {
|
||||
BOrd bOrd = string.length() == this.baseOrdStationHome.length() ? BOrd.make("local:|file:^") : BOrd.make("local:|file:^" + string.substring(this.baseOrdStationHome.length() + 1));
|
||||
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
|
||||
BOrd bOrd4 = BOrd.make("local:|file:!" + string.substring(this.baseOrdSysHome.length() + 1));
|
||||
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd4));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (string.startsWith("local:|file:!")) {
|
||||
String string3 = string.substring("local:|file:!".length());
|
||||
if (string3.length() > 0) {
|
||||
string3 = "/" + string3;
|
||||
}
|
||||
BOrd bOrd = BOrd.make(this.baseOrdSysHome + string3);
|
||||
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
|
||||
return;
|
||||
}
|
||||
if (string.startsWith(this.baseOrdSysHome)) {
|
||||
BOrd bOrd = string.length() == this.baseOrdSysHome.length() ? BOrd.make("local:|file:!") : BOrd.make("local:|file:!" + string.substring(this.baseOrdSysHome.length() + 1));
|
||||
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public BIFile[] listFiles() {
|
||||
return (BIFile[])this.roots.clone();
|
||||
}
|
||||
|
||||
public File pathToLocalFile(FilePath filePath) {
|
||||
String string = filePath.getBody();
|
||||
if (filePath.isSysHomeAbsolute()) {
|
||||
return new File(Sys.getBajaHome(), string.substring(1));
|
||||
}
|
||||
if (filePath.isStationHomeAbsolute()) {
|
||||
File file = Sys.getStationHome();
|
||||
if (file == null) {
|
||||
throw new UnresolvedException("Not a station VM");
|
||||
}
|
||||
return new File(file, string.substring(1));
|
||||
}
|
||||
if (filePath.isLocalAbsolute()) {
|
||||
if (filePath.depth() == 1) {
|
||||
String string2 = filePath.nameAt(0);
|
||||
int n = 0;
|
||||
while (n < this.roots.length) {
|
||||
if (this.roots[n].getFileName().equalsIgnoreCase(string2)) {
|
||||
return ((BLocalFileStore)this.roots[n].getStore()).getLocalFile();
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return new File(string);
|
||||
}
|
||||
throw new UnresolvedException("Relative path: " + string);
|
||||
}
|
||||
|
||||
public FilePath localFileToPath(File file) {
|
||||
try {
|
||||
String string = file.getCanonicalPath();
|
||||
string = string.replace('\\', '/');
|
||||
if (string.endsWith("/")) {
|
||||
string = string.substring(0, string.length() - 1);
|
||||
}
|
||||
if (!string.startsWith("/")) {
|
||||
string = "/" + string;
|
||||
}
|
||||
return new FilePath(string);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new UnresolvedException("Cannot map to path: " + file, exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BOrd localFileToOrd(File file) {
|
||||
return BOrd.make("local:|file:" + this.localFileToPath(file).getBody());
|
||||
}
|
||||
|
||||
public BIFile findFile(FilePath filePath) {
|
||||
BIFile bIFile = (BIFile)this.specials.get(TextUtil.toLowerCase((String)filePath.getBody()));
|
||||
if (bIFile != null) {
|
||||
return bIFile;
|
||||
}
|
||||
return super.findFile(filePath);
|
||||
}
|
||||
|
||||
public BIFileStore findStore(FilePath filePath) {
|
||||
File file = this.pathToLocalFile(filePath);
|
||||
if (file.exists()) {
|
||||
return new BLocalFileStore(this, filePath, file);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BIFile getChild(BIFile bIFile, String string) {
|
||||
File file;
|
||||
BLocalFileStore bLocalFileStore = (BLocalFileStore)bIFile.getStore();
|
||||
if (bLocalFileStore.isDirectory() && (file = new File(bLocalFileStore.getLocalFile(), string)).exists()) {
|
||||
FilePath filePath = bLocalFileStore.getFilePath().merge(string);
|
||||
return this.makeFile(new BLocalFileStore(this, filePath, file));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BIFile[] getChildren(BIFile bIFile) {
|
||||
Object object;
|
||||
BRestrictedFileSpace bRestrictedFileSpace = null;
|
||||
try {
|
||||
object = (Context)threadLocalContext.get();
|
||||
if (object != null && (object.getUser() != null || object.getFacet("username") instanceof BString)) {
|
||||
bRestrictedFileSpace = BRestrictedFileSpace.INSTANCE;
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {}
|
||||
object = (BLocalFileStore)bIFile.getStore();
|
||||
File[] fileArray = ((BLocalFileStore)object).getLocalFile().listFiles();
|
||||
if (fileArray == null || fileArray.length == 0) {
|
||||
return NO_FILES;
|
||||
}
|
||||
ArrayList<BIFile> arrayList = new ArrayList<BIFile>(fileArray.length);
|
||||
int n = 0;
|
||||
while (n < fileArray.length) {
|
||||
File file = fileArray[n];
|
||||
String string = fileArray[n].getName();
|
||||
if (!FilePath.isValidName(string)) {
|
||||
log.warning("Unsupported file name \"" + string + '\"');
|
||||
} else {
|
||||
FilePath filePath = ((BAbstractFileStore)object).getFilePath().merge(string);
|
||||
if (bRestrictedFileSpace == null || bRestrictedFileSpace.inScope(filePath)) {
|
||||
arrayList.add(this.makeFile(new BLocalFileStore(this, filePath, file)));
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
Object[] objectArray = arrayList.toArray(new BIFile[arrayList.size()]);
|
||||
SortUtil.sort((Object[])objectArray);
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
int n = 0;
|
||||
while (n < this.roots.length) {
|
||||
if (this.roots[n].getFileName().equals(string)) {
|
||||
return this.roots[n];
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
this.syncRoots();
|
||||
try {
|
||||
Context context = (Context)threadLocalContext.get();
|
||||
if (context != null && (context.getUser() != null || context.getFacet("username") instanceof BString)) {
|
||||
return new BINavNode[]{this.sysHome, this.stationHome};
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {}
|
||||
return (BINavNode[])this.roots.clone();
|
||||
}
|
||||
|
||||
public BOrd getOrdInHost() {
|
||||
return this.ordInHost;
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession() {
|
||||
return this.ordInSession;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
try {
|
||||
threadLocalContext.set(spyWriter.getContext());
|
||||
if (INSTANCE == this) {
|
||||
BRestrictedFileSpace.INSTANCE.spy(spyWriter);
|
||||
Object var3_2 = null;
|
||||
threadLocalContext.set(null);
|
||||
return;
|
||||
}
|
||||
super.spy(spyWriter);
|
||||
spyWriter.startProps("FileSystem");
|
||||
spyWriter.prop((Object)"sysHome", ((BLocalFileStore)this.getSysHome().getStore()).getLocalFile());
|
||||
spyWriter.prop((Object)"stationHome", this.stationHome == null ? "null" : "" + ((BLocalFileStore)this.getStationHome().getStore()).getLocalFile());
|
||||
spyWriter.prop((Object)"isFlash", Nre.getPlatform().isFlashFileSystem());
|
||||
spyWriter.endProps();
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var3_3 = null;
|
||||
threadLocalContext.set(null);
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var3_4 = null;
|
||||
threadLocalContext.set(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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 BFileSystem() {
|
||||
super("file", LexiconText.make("baja", "nav.fileSystem"));
|
||||
this.init();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BFileSystem;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BFileSystem = BFileSystem.class("[Ljavax.baja.file.BFileSystem;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
INSTANCE = new BFileSystem();
|
||||
BLocalHost.INSTANCE.addNavChild(INSTANCE);
|
||||
log = Log.getLog("sys.file");
|
||||
threadLocalContext = new ThreadLocal();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.space.Mark;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIComponentFile
|
||||
extends BIFile {
|
||||
public static final Type TYPE;
|
||||
|
||||
public Mark readComponents() throws Exception;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$file$BIComponentFile;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$file$BIComponentFile = 1.class("[Ljavax.baja.file.BIComponentFile;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIDataFile
|
||||
extends BIFile {
|
||||
public static final Type TYPE;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$file$BIDataFile;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$file$BIDataFile = 1.class("[Ljavax.baja.file.BIDataFile;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIDirectory
|
||||
extends BINavNode {
|
||||
public static final Type TYPE;
|
||||
|
||||
public BIFile[] listFiles();
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$file$BIDirectory;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$file$BIDirectory = 1.class("[Ljavax.baja.file.BIDirectory;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.category.BICategorizable;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.security.BIProtected;
|
||||
import javax.baja.space.BISpaceNode;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BIComparable;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIFile
|
||||
extends BINavNode,
|
||||
BISpaceNode,
|
||||
BIComparable,
|
||||
BICategorizable,
|
||||
BIProtected {
|
||||
public static final Type TYPE;
|
||||
|
||||
public BIFileStore getStore();
|
||||
|
||||
public void setStore(BIFileStore var1);
|
||||
|
||||
public BFileSpace getFileSpace();
|
||||
|
||||
public FilePath getFilePath();
|
||||
|
||||
public String getFileName();
|
||||
|
||||
public String getExtension();
|
||||
|
||||
public boolean isDirectory();
|
||||
|
||||
public String getMimeType();
|
||||
|
||||
public long getSize();
|
||||
|
||||
public BAbsTime getLastModified();
|
||||
|
||||
public boolean isReadonly();
|
||||
|
||||
public InputStream getInputStream() throws IOException;
|
||||
|
||||
public byte[] read() throws IOException;
|
||||
|
||||
public void delete() throws IOException;
|
||||
|
||||
public OutputStream getOutputStream() throws IOException;
|
||||
|
||||
public void write(byte[] var1) throws IOException;
|
||||
|
||||
public boolean equals(Object var1);
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$file$BIFile;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$file$BIFile = 1.class("[Ljavax.baja.file.BIFile;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BInterface;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIFileStore
|
||||
extends BInterface {
|
||||
public static final Type TYPE;
|
||||
|
||||
public BFileSpace getFileSpace();
|
||||
|
||||
public FilePath getFilePath();
|
||||
|
||||
public String getFileName();
|
||||
|
||||
public String getExtension();
|
||||
|
||||
public boolean isDirectory();
|
||||
|
||||
public long getSize();
|
||||
|
||||
public BAbsTime getLastModified();
|
||||
|
||||
public boolean isReadonly();
|
||||
|
||||
public BPermissions getPermissions(BIFile var1, Context var2);
|
||||
|
||||
public InputStream getInputStream() throws IOException;
|
||||
|
||||
public byte[] read() throws IOException;
|
||||
|
||||
public OutputStream getOutputStream() throws IOException;
|
||||
|
||||
public void write(byte[] var1) throws IOException;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$file$BIFileStore;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$file$BIFileStore = 1.class("[Ljavax.baja.file.BIFileStore;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.FileUtil;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BLocalFileStore
|
||||
extends BAbstractFileStore {
|
||||
public static final Type TYPE;
|
||||
File file;
|
||||
boolean initialized;
|
||||
boolean isDirectory;
|
||||
boolean isReadonly;
|
||||
boolean isRemovable;
|
||||
int hashCode;
|
||||
static /* synthetic */ Class class$javax$baja$file$BLocalFileStore;
|
||||
|
||||
public File getLocalFile() {
|
||||
return this.file;
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
if (!this.initialized) {
|
||||
this.initialize();
|
||||
}
|
||||
return this.isDirectory;
|
||||
}
|
||||
|
||||
public boolean isReadonly() {
|
||||
if (!this.initialized) {
|
||||
this.initialize();
|
||||
}
|
||||
return this.isReadonly;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
if (!this.initialized) {
|
||||
this.initialize();
|
||||
}
|
||||
if (this.isDirectory) {
|
||||
return -1;
|
||||
}
|
||||
return this.file.length();
|
||||
}
|
||||
|
||||
public BAbsTime getLastModified() {
|
||||
if (!this.initialized) {
|
||||
this.initialize();
|
||||
}
|
||||
if (this.isRemovable) {
|
||||
return BAbsTime.NULL;
|
||||
}
|
||||
return BAbsTime.make(this.file.lastModified());
|
||||
}
|
||||
|
||||
protected boolean doSetLastModified(BAbsTime bAbsTime) throws IOException {
|
||||
if (!this.initialized) {
|
||||
this.initialize();
|
||||
}
|
||||
return this.file.setLastModified(bAbsTime.getMillis());
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new FileInputStream(this.file);
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
return new FileOutputStream(this.file);
|
||||
}
|
||||
|
||||
public void delete() throws IOException {
|
||||
try {
|
||||
FileUtil.delete(this.file);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new IOException("Cannot delete: " + this.file);
|
||||
}
|
||||
}
|
||||
|
||||
public long getCrc() throws IOException {
|
||||
if (this.isDirectory()) {
|
||||
return -1;
|
||||
}
|
||||
return FileUtil.getCrc(this.getInputStream());
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
if (!this.initialized) {
|
||||
this.initialize();
|
||||
}
|
||||
return this.hashCode;
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof BLocalFileStore) {
|
||||
BLocalFileStore bLocalFileStore = (BLocalFileStore)object;
|
||||
return this.file.equals(bLocalFileStore.file);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final void initialize() {
|
||||
if (!this.initialized) {
|
||||
this.initialized = true;
|
||||
this.isRemovable = this.file.getPath().equals("A:\\");
|
||||
if (this.isRemovable) {
|
||||
this.isDirectory = true;
|
||||
this.isReadonly = false;
|
||||
} else {
|
||||
this.isDirectory = this.file.isDirectory();
|
||||
this.isReadonly = this.file.canWrite() ^ true;
|
||||
}
|
||||
this.hashCode = this.file.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BLocalFileStore(BFileSpace bFileSpace, FilePath filePath, File file) {
|
||||
super(bFileSpace, filePath);
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BLocalFileStore;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BLocalFileStore = BLocalFileStore.class("[Ljavax.baja.file.BLocalFileStore;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.io.ByteBuffer;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BMemoryFileStore
|
||||
extends BAbstractFileStore {
|
||||
public static final Type TYPE;
|
||||
BAbsTime lastModified;
|
||||
ByteBuffer buffer;
|
||||
static /* synthetic */ Class class$javax$baja$file$BMemoryFileStore;
|
||||
|
||||
public boolean isDirectory() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isReadonly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return this.buffer.getLength();
|
||||
}
|
||||
|
||||
public BAbsTime getLastModified() {
|
||||
return this.lastModified;
|
||||
}
|
||||
|
||||
public byte[] read() throws IOException {
|
||||
return this.buffer.toByteArray();
|
||||
}
|
||||
|
||||
public final InputStream getInputStream() throws IOException {
|
||||
return new ByteArrayInputStream(this.read());
|
||||
}
|
||||
|
||||
public final OutputStream getOutputStream() throws IOException {
|
||||
this.lastModified = BAbsTime.make();
|
||||
this.buffer = new ByteBuffer();
|
||||
return this.buffer.getOutputStream();
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
boolean bl = false;
|
||||
if (this == object) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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.buffer = new ByteBuffer();
|
||||
}
|
||||
|
||||
public BMemoryFileStore(BFileSpace bFileSpace, FilePath filePath) {
|
||||
super(bFileSpace, filePath);
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BMemoryFileStore;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BMemoryFileStore = BMemoryFileStore.class("[Ljavax.baja.file.BMemoryFileStore;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,351 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import com.tridium.sys.Nre;
|
||||
import com.tridium.util.BRestrictedFileSpace;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.BLocalFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BString;
|
||||
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 class BScopedFileSpace
|
||||
extends BFileSpace {
|
||||
public static final Type TYPE;
|
||||
public static final BScopedFileSpace SYS_HOME;
|
||||
public static final BScopedFileSpace STATION_HOME;
|
||||
static final String FILE_OUT_OF_SCOPE_ERROR = "File path is out of scope: ";
|
||||
private BOrd ordInHost;
|
||||
private BOrd ordInSession;
|
||||
private BIFile[] roots;
|
||||
private boolean includeSysHome;
|
||||
private boolean includeStationHome;
|
||||
private BDirectory root;
|
||||
private FilePath scope;
|
||||
static /* synthetic */ Class class$javax$baja$file$BScopedFileSpace;
|
||||
static /* synthetic */ Class class$javax$baja$file$BIFile;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
private final void init() {
|
||||
if (this.root == null) {
|
||||
BIFile bIFile = BFileSystem.INSTANCE.resolveFile(this.scope);
|
||||
if (!bIFile.isDirectory()) {
|
||||
throw new IllegalStateException("Illegal scope, not a directory: " + this.scope.getBody());
|
||||
}
|
||||
BDirectory bDirectory = (BDirectory)bIFile;
|
||||
this.ordInHost = this.ordInSession = BOrd.make(this.scope);
|
||||
ArrayList<BIFile> arrayList = new ArrayList<BIFile>();
|
||||
this.includeSysHome = this.inDirectory(bDirectory, new FilePath("!"));
|
||||
boolean bl = false;
|
||||
if (this.includeSysHome || this.inDirectory(bDirectory, new FilePath("^"))) {
|
||||
bl = this.includeStationHome = true;
|
||||
}
|
||||
if (this.includeSysHome) {
|
||||
arrayList.add(BFileSystem.INSTANCE.getSysHome());
|
||||
}
|
||||
if (this.includeStationHome) {
|
||||
arrayList.add(BFileSystem.INSTANCE.getStationHome());
|
||||
}
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
if (!this.isBlacklisted(bIFileArray[n])) {
|
||||
arrayList.add(bIFileArray[n]);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
this.roots = arrayList.toArray(new BIFile[arrayList.size()]);
|
||||
this.root = bDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean inDirectory(BDirectory bDirectory, FilePath filePath) {
|
||||
FilePath filePath2 = filePath;
|
||||
BDirectory bDirectory2 = BFileSystem.INSTANCE.getSysHome();
|
||||
BDirectory bDirectory3 = BFileSystem.INSTANCE.getStationHome();
|
||||
boolean bl = false;
|
||||
if (this.includeSysHome && bDirectory2 != null) {
|
||||
bl = true;
|
||||
}
|
||||
boolean bl2 = bl;
|
||||
boolean bl3 = false;
|
||||
if (this.includeStationHome && bDirectory3 != null) {
|
||||
bl3 = true;
|
||||
}
|
||||
boolean bl4 = bl3;
|
||||
while (filePath2 != null) {
|
||||
BIFile bIFile = null;
|
||||
try {
|
||||
bIFile = BFileSystem.INSTANCE.resolveFile(filePath2);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
bIFile = null;
|
||||
}
|
||||
if (bIFile != null) {
|
||||
if (this.isBlacklisted(bIFile)) {
|
||||
return false;
|
||||
}
|
||||
if (bDirectory.equals(bIFile) || bl2 && bDirectory2.equals(bIFile) || bl4 && bDirectory3.equals(bIFile)) {
|
||||
return true;
|
||||
}
|
||||
filePath2 = bIFile.getFilePath().getParent();
|
||||
continue;
|
||||
}
|
||||
filePath2 = filePath2.getParent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean inScope(FilePath filePath) {
|
||||
this.init();
|
||||
return this.inDirectory(this.root, filePath);
|
||||
}
|
||||
|
||||
public boolean isBlacklisted(BIFile bIFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected FilePath scopedPathToAbsPath(FilePath filePath) {
|
||||
switch (filePath.getAbsoluteMode()) {
|
||||
case 0: {
|
||||
return this.scope.merge(filePath);
|
||||
}
|
||||
case 2: {
|
||||
return this.scope.merge(new FilePath(filePath.getScheme(), filePath.getBody().substring(1)));
|
||||
}
|
||||
case 3:
|
||||
case 4: {
|
||||
if (!this.inScope(filePath)) break;
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public FilePath getScope() {
|
||||
return this.scope;
|
||||
}
|
||||
|
||||
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
|
||||
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
|
||||
if (filePath2 == null || !this.inScope(filePath2)) {
|
||||
throw new UnresolvedException(FILE_OUT_OF_SCOPE_ERROR + filePath.getBody());
|
||||
}
|
||||
return BFileSystem.INSTANCE.makeDir(filePath2, context);
|
||||
}
|
||||
|
||||
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
|
||||
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
|
||||
if (filePath2 == null || !this.inScope(filePath2)) {
|
||||
throw new UnresolvedException(FILE_OUT_OF_SCOPE_ERROR + filePath.getBody());
|
||||
}
|
||||
return BFileSystem.INSTANCE.makeFile(filePath2, context);
|
||||
}
|
||||
|
||||
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
|
||||
FilePath filePath3 = this.scopedPathToAbsPath(filePath);
|
||||
if (filePath3 == null || !this.inScope(filePath3)) {
|
||||
throw new UnresolvedException(FILE_OUT_OF_SCOPE_ERROR + filePath.getBody());
|
||||
}
|
||||
FilePath filePath4 = null;
|
||||
if (filePath2.getBody().indexOf(47) < 0 || filePath2.isRelative()) {
|
||||
filePath4 = filePath2;
|
||||
} else {
|
||||
filePath4 = this.scopedPathToAbsPath(filePath2);
|
||||
if (filePath4 == null || !this.inScope(filePath4)) {
|
||||
throw new UnresolvedException(FILE_OUT_OF_SCOPE_ERROR + filePath2.getBody());
|
||||
}
|
||||
}
|
||||
BFileSystem.INSTANCE.move(filePath3, filePath4, context);
|
||||
}
|
||||
|
||||
public void delete(FilePath filePath, Context context) throws IOException {
|
||||
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
|
||||
if (filePath2 == null || !this.inScope(filePath2)) {
|
||||
return;
|
||||
}
|
||||
BFileSystem.INSTANCE.delete(filePath2, context);
|
||||
}
|
||||
|
||||
public BIFile[] listFiles() {
|
||||
this.init();
|
||||
return (BIFile[])this.roots.clone();
|
||||
}
|
||||
|
||||
public BIFile findFile(FilePath filePath) {
|
||||
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
|
||||
if (filePath2 == null || !this.inScope(filePath2)) {
|
||||
return null;
|
||||
}
|
||||
return BFileSystem.INSTANCE.findFile(filePath2);
|
||||
}
|
||||
|
||||
public BIFileStore findStore(FilePath filePath) {
|
||||
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
|
||||
if (filePath2 == null || !this.inScope(filePath2)) {
|
||||
return null;
|
||||
}
|
||||
return BFileSystem.INSTANCE.findStore(filePath2);
|
||||
}
|
||||
|
||||
public BIFile getChild(BIFile bIFile, String string) {
|
||||
FilePath filePath;
|
||||
BIFile bIFile2 = BFileSystem.INSTANCE.getChild(bIFile, string);
|
||||
if (bIFile2 != null && !this.inScope(filePath = bIFile2.getFilePath())) {
|
||||
return null;
|
||||
}
|
||||
return bIFile2;
|
||||
}
|
||||
|
||||
public BIFile[] getChildren(BIFile bIFile) {
|
||||
int n;
|
||||
FilePath filePath = bIFile.getFilePath();
|
||||
if (!this.inScope(filePath)) {
|
||||
return NO_FILES;
|
||||
}
|
||||
BIFile[] bIFileArray = BFileSystem.INSTANCE.getChildren(bIFile);
|
||||
int n2 = 0;
|
||||
if (bIFileArray != null) {
|
||||
n2 = bIFileArray.length;
|
||||
}
|
||||
if ((n = n2) < 1) {
|
||||
return bIFileArray;
|
||||
}
|
||||
Class clazz = class$javax$baja$file$BIFile;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BIFile = BScopedFileSpace.class("[Ljavax.baja.file.BIFile;", false);
|
||||
}
|
||||
Array array = new Array(clazz, n);
|
||||
int n3 = 0;
|
||||
while (n3 < n) {
|
||||
if (!this.isBlacklisted(bIFileArray[n3])) {
|
||||
array.add((Object)bIFileArray[n3]);
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
return (BIFile[])array.trim();
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
this.init();
|
||||
int n = 0;
|
||||
while (n < this.roots.length) {
|
||||
if (this.roots[n].getFileName().equals(string)) {
|
||||
return this.roots[n];
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
this.init();
|
||||
if (this == BRestrictedFileSpace.INSTANCE) {
|
||||
try {
|
||||
Context context = (Context)BFileSystem.threadLocalContext.get();
|
||||
if (context != null && (context.getUser() != null || context.getFacet("username") instanceof BString)) {
|
||||
return new BINavNode[]{BFileSystem.INSTANCE.getSysHome(), BFileSystem.INSTANCE.getStationHome()};
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {}
|
||||
}
|
||||
return (BINavNode[])this.roots.clone();
|
||||
}
|
||||
|
||||
public BOrd getOrdInHost() {
|
||||
this.init();
|
||||
return this.ordInHost;
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession() {
|
||||
this.init();
|
||||
return this.ordInSession;
|
||||
}
|
||||
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
BDirectory bDirectory;
|
||||
super.spy(spyWriter);
|
||||
this.init();
|
||||
spyWriter.startProps("ScopedFileSpace");
|
||||
spyWriter.prop((Object)"scopeHome", ((BLocalFileStore)this.root.getStore()).getLocalFile());
|
||||
if (this.includeSysHome) {
|
||||
bDirectory = BFileSystem.INSTANCE.getSysHome();
|
||||
spyWriter.prop((Object)"sysHome", bDirectory == null ? "null" : "" + ((BLocalFileStore)bDirectory.getStore()).getLocalFile());
|
||||
}
|
||||
if (this.includeStationHome) {
|
||||
bDirectory = BFileSystem.INSTANCE.getStationHome();
|
||||
spyWriter.prop((Object)"stationHome", bDirectory == null ? "null" : "" + ((BLocalFileStore)bDirectory.getStore()).getLocalFile());
|
||||
}
|
||||
spyWriter.prop((Object)"isFlash", Nre.getPlatform().isFlashFileSystem());
|
||||
spyWriter.endProps();
|
||||
}
|
||||
|
||||
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.includeSysHome = false;
|
||||
this.includeStationHome = false;
|
||||
this.root = null;
|
||||
}
|
||||
|
||||
public BScopedFileSpace(FilePath filePath, String string, LexiconText lexiconText) {
|
||||
super(string, lexiconText);
|
||||
this.this();
|
||||
this.scope = filePath;
|
||||
try {
|
||||
this.init();
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BScopedFileSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BScopedFileSpace = BScopedFileSpace.class("[Ljavax.baja.file.BScopedFileSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
SYS_HOME = new BScopedFileSpace(new FilePath("!"), "sysFileSpace", LexiconText.make("baja", "nav.sysHome"));
|
||||
STATION_HOME = new BScopedFileSpace(new FilePath("^"), "stationFileSpace", LexiconText.make("baja", "nav.stationHome"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import java.util.HashMap;
|
||||
import javax.baja.file.BDataFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nav.BNavRoot;
|
||||
import javax.baja.nav.NavEvent;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BSubSpaceFile
|
||||
extends BDataFile {
|
||||
public static final Type TYPE;
|
||||
public static final Log log;
|
||||
private static HashMap cache;
|
||||
static /* synthetic */ Class class$javax$baja$file$BSubSpaceFile;
|
||||
|
||||
public boolean isOpen() {
|
||||
boolean bl = false;
|
||||
if (cache.get(this.getAbsoluteOrd()) != null) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public BSpace getSubSpace() {
|
||||
CacheItem cacheItem = (CacheItem)cache.get(this.getAbsoluteOrd());
|
||||
return cacheItem != null ? cacheItem.space : null;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public static BSubSpaceFile[] listOpen() {
|
||||
HashMap hashMap = cache;
|
||||
synchronized (hashMap) {
|
||||
CacheItem[] cacheItemArray = cache.values().toArray(new CacheItem[cache.size()]);
|
||||
BSubSpaceFile[] bSubSpaceFileArray = new BSubSpaceFile[cacheItemArray.length];
|
||||
int n = 0;
|
||||
while (n < bSubSpaceFileArray.length) {
|
||||
log.trace("ListIsOpen[" + n + "]: " + cacheItemArray[n].file.getAbsoluteOrd());
|
||||
bSubSpaceFileArray[n] = cacheItemArray[n].file;
|
||||
++n;
|
||||
}
|
||||
return bSubSpaceFileArray;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public BSpace open() {
|
||||
HashMap hashMap = cache;
|
||||
synchronized (hashMap) {
|
||||
BOrd bOrd = this.getAbsoluteOrd();
|
||||
CacheItem cacheItem = (CacheItem)cache.get(bOrd);
|
||||
if (cacheItem != null) {
|
||||
if (cacheItem.openTimestamp == cacheItem.file.getLastModified().getMillis()) {
|
||||
return cacheItem.space;
|
||||
}
|
||||
log.warning("File has been modified: " + cacheItem.file);
|
||||
this.close(false);
|
||||
}
|
||||
log.trace("Open: " + bOrd);
|
||||
cacheItem = new CacheItem();
|
||||
cacheItem.space = this.doOpen();
|
||||
cacheItem.file = this;
|
||||
cacheItem.openTimestamp = this.getLastModified().getMillis();
|
||||
cache.put(bOrd, cacheItem);
|
||||
return cacheItem.space;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void save() throws Exception {
|
||||
block3: {
|
||||
CacheItem cacheItem = null;
|
||||
HashMap hashMap = cache;
|
||||
synchronized (hashMap) {
|
||||
BOrd bOrd = this.getAbsoluteOrd();
|
||||
log.trace("Save: " + bOrd);
|
||||
cacheItem = (CacheItem)cache.get(bOrd);
|
||||
// MONITOREXIT @DISABLED, blocks:[0, 1] lbl8 : MonitorExitStatement: MONITOREXIT : var2_2
|
||||
if (cacheItem == null) break block3;
|
||||
}
|
||||
cacheItem.file.doSave();
|
||||
cacheItem.openTimestamp = cacheItem.file.getLastModified().getMillis();
|
||||
}
|
||||
}
|
||||
|
||||
public void reload() throws Exception {
|
||||
this.close(false);
|
||||
this.open();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.close(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
void close(boolean bl) {
|
||||
block4: {
|
||||
BOrd bOrd;
|
||||
CacheItem cacheItem = null;
|
||||
HashMap hashMap = cache;
|
||||
synchronized (hashMap) {
|
||||
bOrd = this.getAbsoluteOrd();
|
||||
log.trace("Close: " + bOrd);
|
||||
cacheItem = (CacheItem)cache.get(bOrd);
|
||||
if (cacheItem != null) {
|
||||
log.trace("isModified: " + cacheItem.file.isModified());
|
||||
cacheItem.file.doClose();
|
||||
cacheItem.openTimestamp = 0L;
|
||||
cache.remove(bOrd);
|
||||
}
|
||||
// MONITOREXIT @DISABLED, blocks:[0, 1] lbl14 : MonitorExitStatement: MONITOREXIT : var3_3
|
||||
if (cacheItem == null) break block4;
|
||||
bOrd = cacheItem.file.getNavParent().getNavOrd();
|
||||
}
|
||||
String string = cacheItem.file.getFileName();
|
||||
BFacets bFacets = bl ? BFacets.make("close", BBoolean.TRUE) : BFacets.NULL;
|
||||
BNavRoot.INSTANCE.fireNavEvent(NavEvent.makeReplaced(bOrd, string, (Context)bFacets));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean isModified();
|
||||
|
||||
protected abstract BSpace doOpen();
|
||||
|
||||
protected abstract void doSave() throws Exception;
|
||||
|
||||
protected abstract void doClose();
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
return this.open().getNavChild(string);
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
return this.open().getNavChildren();
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BSubSpaceFile(BIFileStore bIFileStore) {
|
||||
super(bIFileStore);
|
||||
}
|
||||
|
||||
public BSubSpaceFile() {
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$BSubSpaceFile;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$BSubSpaceFile = BSubSpaceFile.class("[Ljavax.baja.file.BSubSpaceFile;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
log = Log.getLog("subSpaceFile");
|
||||
cache = new HashMap();
|
||||
}
|
||||
|
||||
static class CacheItem {
|
||||
public long openTimestamp;
|
||||
public BSubSpaceFile file;
|
||||
public BSpace space;
|
||||
|
||||
CacheItem() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
|
||||
public abstract class ExportOp
|
||||
extends OrdTarget {
|
||||
public static ExportOp make(OrdTarget ordTarget, OutputStream outputStream) throws Exception {
|
||||
return new BasicExportOp(ordTarget, outputStream);
|
||||
}
|
||||
|
||||
public abstract OutputStream getOutputStream();
|
||||
|
||||
protected ExportOp(OrdTarget ordTarget) {
|
||||
super(ordTarget);
|
||||
}
|
||||
|
||||
static class BasicExportOp
|
||||
extends ExportOp {
|
||||
OutputStream out;
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
return this.out;
|
||||
}
|
||||
|
||||
BasicExportOp(OrdTarget ordTarget, OutputStream outputStream) {
|
||||
super(ordTarget);
|
||||
this.out = outputStream;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,496 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.naming.OrdQueryList;
|
||||
import javax.baja.naming.Path;
|
||||
import javax.baja.naming.SyntaxException;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.sys.IllegalNameException;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class FilePath
|
||||
implements OrdQuery,
|
||||
Path,
|
||||
Comparable {
|
||||
public static final int RELATIVE = 0;
|
||||
public static final int AUTHORITY_ABSOLUTE = 1;
|
||||
public static final int LOCAL_ABSOLUTE = 2;
|
||||
public static final int SYS_HOME_ABSOLUTE = 3;
|
||||
public static final int STATION_HOME_ABSOLUTE = 4;
|
||||
private static final String[] NO_NAMES = new String[0];
|
||||
private String scheme;
|
||||
private String body;
|
||||
private int absMode;
|
||||
private String authority;
|
||||
private int backupDepth;
|
||||
private String[] names;
|
||||
private String fragment;
|
||||
|
||||
protected FilePath newInstance(String string) {
|
||||
return new FilePath(this.getScheme(), string);
|
||||
}
|
||||
|
||||
public boolean isAbsolute() {
|
||||
boolean bl = false;
|
||||
if (this.absMode != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean isRelative() {
|
||||
boolean bl = false;
|
||||
if (this.absMode == 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public int getAbsoluteMode() {
|
||||
return this.absMode;
|
||||
}
|
||||
|
||||
public boolean isAuthorityAbsolute() {
|
||||
boolean bl = false;
|
||||
if (this.absMode == 1) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean isLocalAbsolute() {
|
||||
boolean bl = false;
|
||||
if (this.absMode == 2) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean isSysHomeAbsolute() {
|
||||
boolean bl = false;
|
||||
if (this.absMode == 3) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean isStationHomeAbsolute() {
|
||||
boolean bl = false;
|
||||
if (this.absMode == 4) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public String getAbsoluteBase() {
|
||||
switch (this.absMode) {
|
||||
case 0: {
|
||||
return "";
|
||||
}
|
||||
case 1: {
|
||||
return "//" + this.authority + '/';
|
||||
}
|
||||
case 2: {
|
||||
return "/";
|
||||
}
|
||||
case 3: {
|
||||
return "!";
|
||||
}
|
||||
case 4: {
|
||||
return "^";
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public String getAuthority() {
|
||||
return this.authority;
|
||||
}
|
||||
|
||||
public String getFragment() {
|
||||
return this.fragment;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (this.names.length == 0) {
|
||||
return this.getAbsoluteBase();
|
||||
}
|
||||
return this.names[this.names.length - 1];
|
||||
}
|
||||
|
||||
public int getBackupDepth() {
|
||||
return this.backupDepth;
|
||||
}
|
||||
|
||||
public int depth() {
|
||||
return this.names.length;
|
||||
}
|
||||
|
||||
public String nameAt(int n) {
|
||||
return this.names[n];
|
||||
}
|
||||
|
||||
public String[] getNames() {
|
||||
return (String[])this.names.clone();
|
||||
}
|
||||
|
||||
public Path getParentPath() {
|
||||
return this.getParent();
|
||||
}
|
||||
|
||||
public FilePath getParent() {
|
||||
int n;
|
||||
if (this.names.length == 0) {
|
||||
return null;
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (this.isAbsolute()) {
|
||||
stringBuffer.append(this.getAbsoluteBase());
|
||||
} else {
|
||||
n = this.getBackupDepth();
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
stringBuffer.append("../");
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
n = 0;
|
||||
while (n < this.names.length - 1) {
|
||||
if (n > 0) {
|
||||
stringBuffer.append('/');
|
||||
}
|
||||
stringBuffer.append(this.names[n]);
|
||||
++n;
|
||||
}
|
||||
return this.newInstance(stringBuffer.toString());
|
||||
}
|
||||
|
||||
public static boolean isValidName(String string) {
|
||||
try {
|
||||
int n = string.length();
|
||||
if (n == 0) {
|
||||
return false;
|
||||
}
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
char c = string.charAt(n2);
|
||||
if (!FilePath.isName(c) || c == ':') {
|
||||
return false;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void verifyValidName(String string) {
|
||||
if (!FilePath.isValidName(string)) {
|
||||
throw new IllegalNameException("baja", "IllegalNameException.name", new Object[]{string});
|
||||
}
|
||||
}
|
||||
|
||||
public String getScheme() {
|
||||
return this.scheme;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
public boolean isHost() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSession() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void normalize(OrdQueryList ordQueryList, int n) {
|
||||
if (ordQueryList.isSameScheme(n, n + 1)) {
|
||||
FilePath filePath = (FilePath)ordQueryList.get(n + 1);
|
||||
ordQueryList.merge(n, this.merge(filePath));
|
||||
}
|
||||
ordQueryList.shiftToSession(n);
|
||||
}
|
||||
|
||||
public FilePath merge(String string) {
|
||||
return this.merge(this.newInstance(string));
|
||||
}
|
||||
|
||||
public FilePath merge(FilePath filePath) {
|
||||
if (filePath.isAbsolute()) {
|
||||
if (this.isAuthorityAbsolute() && !filePath.isAuthorityAbsolute()) {
|
||||
return this.newInstance("//" + this.authority + filePath.body);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
if (this.isAbsolute() || filePath.getBackupDepth() < this.depth()) {
|
||||
StringBuffer stringBuffer = new StringBuffer(this.getAbsoluteBase());
|
||||
boolean bl = false;
|
||||
int n = 0;
|
||||
while (n < this.depth() - filePath.getBackupDepth()) {
|
||||
if (bl) {
|
||||
stringBuffer.append('/');
|
||||
} else {
|
||||
bl = true;
|
||||
}
|
||||
stringBuffer.append(this.nameAt(n));
|
||||
++n;
|
||||
}
|
||||
n = 0;
|
||||
while (n < filePath.depth()) {
|
||||
if (bl) {
|
||||
stringBuffer.append('/');
|
||||
} else {
|
||||
bl = true;
|
||||
}
|
||||
stringBuffer.append(filePath.nameAt(n));
|
||||
++n;
|
||||
}
|
||||
if (filePath.fragment != null) {
|
||||
stringBuffer.append('#').append(filePath.fragment);
|
||||
}
|
||||
return this.newInstance(stringBuffer.toString());
|
||||
}
|
||||
throw new SyntaxException("Invalid merge " + this + " + " + filePath);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.scheme + ':' + this.body;
|
||||
}
|
||||
|
||||
void parse() {
|
||||
try {
|
||||
if (this.body.length() == 0) {
|
||||
return;
|
||||
}
|
||||
String string = this.body;
|
||||
int n = this.body.indexOf(35);
|
||||
if (n >= 0) {
|
||||
this.fragment = this.body.substring(n + 1);
|
||||
this.body = this.body.substring(0, n);
|
||||
}
|
||||
int n2 = this.parsePrefix();
|
||||
this.parseNames(n2);
|
||||
this.body = string;
|
||||
}
|
||||
catch (SyntaxException syntaxException) {
|
||||
throw syntaxException;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throw new SyntaxException(this.body, throwable);
|
||||
}
|
||||
}
|
||||
|
||||
int parsePrefix() {
|
||||
String string = this.body;
|
||||
int n = string.length();
|
||||
int n2 = -1;
|
||||
if (n > 0) {
|
||||
n2 = string.charAt(0);
|
||||
}
|
||||
int n3 = -1;
|
||||
if (n > 1) {
|
||||
n3 = string.charAt(1);
|
||||
}
|
||||
if (n2 == 47) {
|
||||
if (n3 == 47) {
|
||||
this.absMode = 1;
|
||||
int n4 = string.indexOf(47, 3);
|
||||
if (n4 < 0) {
|
||||
this.authority = string.substring(2, n);
|
||||
this.checkAuthority(this.authority);
|
||||
return n;
|
||||
}
|
||||
this.authority = string.substring(2, n4);
|
||||
this.checkAuthority(this.authority);
|
||||
return n4 + 1;
|
||||
}
|
||||
this.absMode = 2;
|
||||
return this.skipSlash(string, 1);
|
||||
}
|
||||
if (n2 == 33) {
|
||||
this.absMode = 3;
|
||||
return 1;
|
||||
}
|
||||
if (n2 == 94) {
|
||||
this.absMode = 4;
|
||||
return 1;
|
||||
}
|
||||
if (n2 == 46) {
|
||||
this.absMode = 0;
|
||||
return this.parseBackup();
|
||||
}
|
||||
this.absMode = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parseBackup() {
|
||||
String string = this.body;
|
||||
int n = string.length();
|
||||
if (n == 1) {
|
||||
throw new SyntaxException("Dot not supported: " + string);
|
||||
}
|
||||
char c = string.charAt(1);
|
||||
if (c != '.') {
|
||||
if (c == '/') {
|
||||
throw new SyntaxException("Dot/ not supported: " + string);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
int n3;
|
||||
char c2 = string.charAt(n2);
|
||||
int n4 = n2 + 1 < n ? (int)string.charAt(n2 + 1) : -1;
|
||||
int n5 = n3 = n2 + 2 < n ? (int)string.charAt(n2 + 2) : 47;
|
||||
if (c2 != '.') {
|
||||
return n2;
|
||||
}
|
||||
if (n4 != 46) {
|
||||
if (n4 == 47) {
|
||||
throw new SyntaxException("Single dot unsupported: " + string);
|
||||
}
|
||||
return n2;
|
||||
}
|
||||
if (n3 != 47) {
|
||||
throw new SyntaxException("Expecting ../ backup: " + string);
|
||||
}
|
||||
++this.backupDepth;
|
||||
n2 += 3;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
void parseNames(int n) {
|
||||
String string;
|
||||
String string2 = this.body;
|
||||
int n2 = string2.length();
|
||||
if (n >= n2) {
|
||||
return;
|
||||
}
|
||||
if (string2.charAt(n2 - 1) == '/') {
|
||||
throw new SyntaxException("Trailing slash: " + string2);
|
||||
}
|
||||
String[] stringArray = new String[64];
|
||||
int n3 = 0;
|
||||
int n4 = n;
|
||||
while (n4 < n2) {
|
||||
char c = string2.charAt(n4);
|
||||
if (c == '/') {
|
||||
if (n4 == n) {
|
||||
throw new SyntaxException("Illegal double slashes: " + string2);
|
||||
}
|
||||
string = string2.substring(n, n4);
|
||||
if (string.startsWith("..")) {
|
||||
throw new SyntaxException("Illegal backup in path: " + string2);
|
||||
}
|
||||
stringArray[n3++] = string;
|
||||
n = n4 + 1;
|
||||
} else if (!FilePath.isName(c)) {
|
||||
throw new SyntaxException("Illegal char '" + (char)c + "' in body: " + string2);
|
||||
}
|
||||
++n4;
|
||||
}
|
||||
string = string2.substring(n, n2);
|
||||
if (string.startsWith("..")) {
|
||||
throw new SyntaxException("Illegal backup in path: " + string2);
|
||||
}
|
||||
stringArray[n3++] = string;
|
||||
this.names = new String[n3];
|
||||
System.arraycopy(stringArray, 0, this.names, 0, n3);
|
||||
}
|
||||
|
||||
int skipSlash(String string, int n) {
|
||||
if (n >= string.length()) {
|
||||
return n;
|
||||
}
|
||||
if (string.charAt(n) == '/') {
|
||||
return n + 1;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
void checkAuthority(String string) {
|
||||
if (string.length() == 0) {
|
||||
throw new SyntaxException("Missing authority name: " + this.body);
|
||||
}
|
||||
int n = 0;
|
||||
while (n < string.length()) {
|
||||
if (!FilePath.isAuthority(string.charAt(n))) {
|
||||
throw new SyntaxException("Illegal char '" + string.charAt(n) + "' in authority: " + this.body);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return (this.scheme + ':' + this.body).hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (!(object instanceof FilePath)) {
|
||||
return false;
|
||||
}
|
||||
if (!this.body.equals(((FilePath)object).body)) {
|
||||
return false;
|
||||
}
|
||||
return this.scheme.equals(((FilePath)object).scheme);
|
||||
}
|
||||
|
||||
public int compareTo(Object object) {
|
||||
if (!(object instanceof FilePath)) {
|
||||
return 0;
|
||||
}
|
||||
if (!this.scheme.equals(((FilePath)object).scheme)) {
|
||||
return this.scheme.compareTo(((FilePath)object).scheme);
|
||||
}
|
||||
return this.body.compareTo(((FilePath)object).body);
|
||||
}
|
||||
|
||||
static boolean isName(int n) {
|
||||
boolean bl = false;
|
||||
if (n <= 31 || n == 127 || n == 34 || n == 92 || n == 60 || n == 62 || n == 63 || n == 42 || n == 47 || n == 124) {
|
||||
bl = true;
|
||||
}
|
||||
return bl ^ true;
|
||||
}
|
||||
|
||||
static boolean isAuthority(int n) {
|
||||
boolean bl = false;
|
||||
if (n >= 97 && n <= 122 || n >= 65 && n <= 90 || n >= 48 && n <= 57 || n == 95 || n == 46 || n == 45) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.names = NO_NAMES;
|
||||
}
|
||||
|
||||
public FilePath(String string, String string2) throws SyntaxException {
|
||||
this.this();
|
||||
this.scheme = TextUtil.toLowerCase((String)string).trim();
|
||||
this.body = string2.trim();
|
||||
this.parse();
|
||||
}
|
||||
|
||||
public FilePath(String string) throws SyntaxException {
|
||||
this.this();
|
||||
this.scheme = "file";
|
||||
this.body = string.trim();
|
||||
this.parse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,507 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.SortUtil
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.zip.CRC32;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
|
||||
public class FileUtil {
|
||||
static Log log = Log.getLog("sys.file");
|
||||
|
||||
public static String getBase(String string) {
|
||||
if (string == null) {
|
||||
return null;
|
||||
}
|
||||
int n = string.lastIndexOf(46);
|
||||
if (n >= 1) {
|
||||
return string.substring(0, n);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
public static String getExtension(String string) {
|
||||
if (string == null) {
|
||||
return null;
|
||||
}
|
||||
int n = string.lastIndexOf(46);
|
||||
if (n >= 1) {
|
||||
return string.substring(n + 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static byte[] read(BIFileStore bIFileStore) throws IOException {
|
||||
return FileUtil.read(bIFileStore.getInputStream(), bIFileStore.getSize());
|
||||
}
|
||||
|
||||
public static byte[] read(InputStream inputStream, long l) throws IOException {
|
||||
if (l < 0L || l > Integer.MAX_VALUE) {
|
||||
throw new IOException("Invalid size " + l);
|
||||
}
|
||||
int n = (int)l;
|
||||
byte[] byArray = new byte[n];
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
int n3 = inputStream.read(byArray, n2, n - n2);
|
||||
if (n3 < 0) {
|
||||
throw new IOException("Unexpected EOF");
|
||||
}
|
||||
n2 += n3;
|
||||
}
|
||||
inputStream.close();
|
||||
return byArray;
|
||||
}
|
||||
|
||||
public static void write(BIFileStore bIFileStore, byte[] byArray) throws IOException {
|
||||
OutputStream outputStream = bIFileStore.getOutputStream();
|
||||
outputStream.write(byArray);
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
public static void pipe(BIFile bIFile, BIFile bIFile2) throws IOException {
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
inputStream = bIFile.getInputStream();
|
||||
outputStream = bIFile2.getOutputStream();
|
||||
long l = bIFile.getSize();
|
||||
if (l >= 0L) {
|
||||
FileUtil.pipe(inputStream, l, outputStream);
|
||||
} else {
|
||||
FileUtil.pipe(inputStream, outputStream);
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var5_6 = null;
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
try {
|
||||
if (outputStream == null) throw throwable;
|
||||
outputStream.close();
|
||||
throw throwable;
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var5_7 = null;
|
||||
}
|
||||
try {}
|
||||
catch (Exception exception) {}
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
try {}
|
||||
catch (Exception exception) {
|
||||
return;
|
||||
}
|
||||
if (outputStream == null) return;
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
public static void pipe(InputStream inputStream, long l, OutputStream outputStream) throws IOException {
|
||||
int n = 4096;
|
||||
byte[] byArray = new byte[n];
|
||||
while (l > 0L) {
|
||||
int n2 = inputStream.read(byArray, 0, (int)Math.min(l, (long)n));
|
||||
if (n2 <= 0) {
|
||||
throw new IOException("Unexpected EOF");
|
||||
}
|
||||
outputStream.write(byArray, 0, n2);
|
||||
l -= (long)n2;
|
||||
}
|
||||
}
|
||||
|
||||
public static void pipe(InputStream inputStream, OutputStream outputStream) throws IOException {
|
||||
int n;
|
||||
int n2 = 4096;
|
||||
byte[] byArray = new byte[n2];
|
||||
while ((n = inputStream.read(byArray, 0, n2)) >= 0) {
|
||||
outputStream.write(byArray, 0, n);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public static long getCrc(InputStream inputStream) throws IOException {
|
||||
long l;
|
||||
block3: {
|
||||
try {
|
||||
int n;
|
||||
byte[] byArray = new byte[4096];
|
||||
CRC32 cRC32 = new CRC32();
|
||||
while ((n = inputStream.read(byArray)) > 0) {
|
||||
cRC32.update(byArray, 0, n);
|
||||
}
|
||||
l = cRC32.getValue();
|
||||
Object var2_5 = null;
|
||||
if (inputStream == null) break block3;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
block4: {
|
||||
Object var2_6 = null;
|
||||
if (inputStream == null) break block4;
|
||||
inputStream.close();
|
||||
}
|
||||
throw throwable;
|
||||
}
|
||||
inputStream.close();
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
public static File renameToBackup(File file, int n) {
|
||||
try {
|
||||
String string = file.getName();
|
||||
String string2 = string.substring(0, string.indexOf(46));
|
||||
File[] fileArray = FileUtil.getBackups(file.getParentFile(), string2);
|
||||
int n2 = Math.max(0, n - 1);
|
||||
while (n2 < fileArray.length) {
|
||||
fileArray[n2].delete();
|
||||
++n2;
|
||||
}
|
||||
if (n != 0) {
|
||||
return FileUtil.renameToBackup(file);
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static File renameToBackup(File file) throws Exception {
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
File file2 = new File(file.getParent());
|
||||
String string = file.getName();
|
||||
String string2 = "";
|
||||
int n = string.lastIndexOf(46);
|
||||
if (n > 0) {
|
||||
string2 = string.substring(n);
|
||||
string = string.substring(0, n);
|
||||
}
|
||||
String string3 = "yyMMdd_HHmm";
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(string3);
|
||||
simpleDateFormat.setTimeZone(TimeZone.getDefault());
|
||||
String string4 = simpleDateFormat.format(new Date(file.lastModified()));
|
||||
File file3 = new File(file2, string + "_backup_" + string4 + string2);
|
||||
int n2 = 1;
|
||||
while (file3.exists()) {
|
||||
file3 = new File(file2, string + "_backup_" + string4 + '_' + n2 + string2);
|
||||
++n2;
|
||||
}
|
||||
if (!file.renameTo(file3)) {
|
||||
throw new IOException("Cannot rename");
|
||||
}
|
||||
return file3;
|
||||
}
|
||||
|
||||
public static File[] getBackups(File file, String string) {
|
||||
Object[] objectArray;
|
||||
ArrayList<Object[]> arrayList = new ArrayList<Object[]>();
|
||||
File[] fileArray = file.listFiles();
|
||||
int n = 0;
|
||||
while (n < fileArray.length) {
|
||||
objectArray = fileArray[n];
|
||||
String string2 = objectArray.getName();
|
||||
if (string2.startsWith(string) && string2.indexOf("_backup_") >= 0) {
|
||||
arrayList.add(objectArray);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
Object[] objectArray2 = arrayList.toArray(new File[arrayList.size()]);
|
||||
objectArray = new Long[objectArray2.length];
|
||||
int n2 = 0;
|
||||
while (n2 < objectArray2.length) {
|
||||
objectArray[n2] = new Long(((File)objectArray2[n2]).lastModified());
|
||||
++n2;
|
||||
}
|
||||
SortUtil.rsort((Object[])objectArray, (Object[])objectArray2);
|
||||
return objectArray2;
|
||||
}
|
||||
|
||||
public static void move(File file, File file2) throws IOException {
|
||||
log.trace("Move: " + file + " -> " + file2);
|
||||
if (file2.exists()) {
|
||||
throw new IOException("Cannot move to existing file: " + file2);
|
||||
}
|
||||
if (!file.renameTo(file2)) {
|
||||
throw new IOException("Cannot move: " + file + " -> " + file2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void copy(File file, File file2) throws IOException {
|
||||
log.trace("Copy: " + file + " -> " + file2);
|
||||
if (file2.exists()) {
|
||||
throw new IOException("Cannot copy to existing file: " + file2);
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
FileUtil.copyDir(file, file2);
|
||||
} else {
|
||||
FileUtil.copyFile(file, file2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyDir(File file, File file2) throws IOException {
|
||||
if (!file2.exists() && !file2.mkdirs()) {
|
||||
throw new IOException("Cannot make dir: " + file2);
|
||||
}
|
||||
File[] fileArray = file.listFiles();
|
||||
int n = 0;
|
||||
while (n < fileArray.length) {
|
||||
FileUtil.copy(fileArray[n], new File(file2, fileArray[n].getName()));
|
||||
++n;
|
||||
}
|
||||
file2.setLastModified(file.lastModified());
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
public static void copyFile(File file, File file2) throws IOException {
|
||||
FileOutputStream fileOutputStream;
|
||||
block14: {
|
||||
fileOutputStream = null;
|
||||
FileInputStream fileInputStream = null;
|
||||
try {
|
||||
fileOutputStream = new FileOutputStream(file2);
|
||||
fileInputStream = new FileInputStream(file);
|
||||
byte[] byArray = new byte[4096];
|
||||
long l = file.length();
|
||||
long l2 = 0L;
|
||||
while (l2 < l) {
|
||||
int n = fileInputStream.read(byArray, 0, byArray.length);
|
||||
if (n < 0) {
|
||||
throw new EOFException();
|
||||
}
|
||||
fileOutputStream.write(byArray, 0, n);
|
||||
l2 += (long)n;
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var5_9 = null;
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
}
|
||||
catch (IOException iOException) {}
|
||||
}
|
||||
if (fileOutputStream == null) throw throwable;
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
throw throwable;
|
||||
}
|
||||
catch (IOException iOException) {}
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var5_10 = null;
|
||||
if (fileInputStream == null) break block14;
|
||||
}
|
||||
try {}
|
||||
catch (IOException iOException) {}
|
||||
fileInputStream.close();
|
||||
}
|
||||
if (fileOutputStream != null) {
|
||||
try {}
|
||||
catch (IOException iOException) {}
|
||||
fileOutputStream.close();
|
||||
}
|
||||
if (!file2.exists()) return;
|
||||
file2.setLastModified(file.lastModified());
|
||||
}
|
||||
|
||||
public static void delete(File file) throws IOException {
|
||||
log.trace("Delete: " + file);
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
File[] fileArray = file.listFiles();
|
||||
int n = 0;
|
||||
while (n < fileArray.length) {
|
||||
FileUtil.delete(fileArray[n]);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
if (!file.delete()) {
|
||||
throw new IOException("Cannot delete: " + file);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean diff(BufferedReader bufferedReader, BufferedReader bufferedReader2) throws IOException {
|
||||
int n = 1;
|
||||
boolean bl = false;
|
||||
String string = bufferedReader.readLine();
|
||||
String string2 = bufferedReader2.readLine();
|
||||
while (string != null || string2 != null) {
|
||||
if (string == null || string2 == null || !string.equals(string2)) {
|
||||
bl = true;
|
||||
}
|
||||
++n;
|
||||
if (string != null) {
|
||||
string = bufferedReader.readLine();
|
||||
}
|
||||
if (string2 == null) continue;
|
||||
string2 = bufferedReader2.readLine();
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public static String readString(File file) throws IOException {
|
||||
return FileUtil.readString(new FileReader(file));
|
||||
}
|
||||
|
||||
public static String readString(BIFile bIFile) throws IOException {
|
||||
return FileUtil.readString(new InputStreamReader(bIFile.getInputStream()));
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public static String readString(Reader reader) throws IOException {
|
||||
String string;
|
||||
try {
|
||||
String string2;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
BufferedReader bufferedReader = new BufferedReader(reader);
|
||||
while ((string2 = bufferedReader.readLine()) != null) {
|
||||
stringBuffer.append(string2).append("\n");
|
||||
}
|
||||
string = stringBuffer.toString();
|
||||
Object var2_5 = null;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var2_6 = null;
|
||||
reader.close();
|
||||
throw throwable;
|
||||
}
|
||||
reader.close();
|
||||
return string;
|
||||
}
|
||||
|
||||
public static String[] readLines(File file) throws IOException {
|
||||
return FileUtil.readLines(new FileReader(file));
|
||||
}
|
||||
|
||||
public static String[] readLines(BIFile bIFile) throws IOException {
|
||||
return FileUtil.readLines(new InputStreamReader(bIFile.getInputStream()));
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public static String[] readLines(Reader reader) throws IOException {
|
||||
String[] stringArray;
|
||||
try {
|
||||
String string;
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
BufferedReader bufferedReader = new BufferedReader(reader);
|
||||
while ((string = bufferedReader.readLine()) != null) {
|
||||
arrayList.add(string);
|
||||
}
|
||||
stringArray = arrayList.toArray(new String[arrayList.size()]);
|
||||
Object var2_5 = null;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var2_6 = null;
|
||||
reader.close();
|
||||
throw throwable;
|
||||
}
|
||||
reader.close();
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public static FileInfo getFileInfo(InputStream inputStream) throws IOException {
|
||||
FileInfo fileInfo;
|
||||
block3: {
|
||||
FileInfo fileInfo2 = new FileInfo();
|
||||
try {
|
||||
int n;
|
||||
byte[] byArray = new byte[4096];
|
||||
CRC32 cRC32 = new CRC32();
|
||||
while ((n = inputStream.read(byArray)) > 0) {
|
||||
fileInfo2.size += (long)n;
|
||||
cRC32.update(byArray, 0, n);
|
||||
}
|
||||
fileInfo2.crc = cRC32.getValue();
|
||||
fileInfo = fileInfo2;
|
||||
Object var3_6 = null;
|
||||
if (inputStream == null) break block3;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
block4: {
|
||||
Object var3_7 = null;
|
||||
if (inputStream == null) break block4;
|
||||
inputStream.close();
|
||||
}
|
||||
throw throwable;
|
||||
}
|
||||
inputStream.close();
|
||||
}
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
public static void main(String[] stringArray) throws Exception {
|
||||
System.out.println(FileUtil.diff(new BufferedReader(new FileReader(stringArray[0])), new BufferedReader(new FileReader(stringArray[1]))) ? "MISMATCH" : "match");
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public static class FileInfo {
|
||||
public long size;
|
||||
public long crc;
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.size = 0L;
|
||||
this.crc = 0L;
|
||||
}
|
||||
|
||||
public FileInfo() {
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file;
|
||||
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public interface IFileFilter {
|
||||
public static final IFileFilter directory = new IFileFilter(){
|
||||
|
||||
public final boolean accept(BIFile bIFile) {
|
||||
return bIFile instanceof BIDirectory;
|
||||
}
|
||||
|
||||
public final String getDescription(Context context) {
|
||||
return Lexicon.make("baja", context).getText("fileFilter.dirOnly");
|
||||
}
|
||||
};
|
||||
public static final IFileFilter all = new IFileFilter(){
|
||||
|
||||
public final boolean accept(BIFile bIFile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final String getDescription(Context context) {
|
||||
return Lexicon.make("baja", context).getText("fileFilter.all");
|
||||
}
|
||||
};
|
||||
|
||||
public boolean accept(BIFile var1);
|
||||
|
||||
public String getDescription(Context var1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file.zip;
|
||||
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.BLocalFileStore;
|
||||
import javax.baja.file.BSubSpaceFile;
|
||||
import javax.baja.file.zip.BZipSpace;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BZipFile
|
||||
extends BSubSpaceFile {
|
||||
private static final BIcon icon = BIcon.std("files/zip.png");
|
||||
public static final Type TYPE;
|
||||
BZipSpace zipSpace;
|
||||
static /* synthetic */ Class class$javax$baja$file$zip$BZipFile;
|
||||
|
||||
public boolean isModified() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected BSpace doOpen() {
|
||||
if (this.zipSpace == null) {
|
||||
this.zipSpace = new BZipSpace(this);
|
||||
}
|
||||
return this.zipSpace;
|
||||
}
|
||||
|
||||
protected void doSave() throws Exception {
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 doClose() {
|
||||
if (this.zipSpace == null) return;
|
||||
try {
|
||||
this.zipSpace.close();
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var2_2 = null;
|
||||
this.zipSpace = null;
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var2_3 = null;
|
||||
this.zipSpace = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return this.getStore() instanceof BLocalFileStore;
|
||||
}
|
||||
|
||||
public BZipSpace getZipSpace() {
|
||||
return (BZipSpace)this.getSubSpace();
|
||||
}
|
||||
|
||||
public String getMimeType() {
|
||||
return "application/zip";
|
||||
}
|
||||
|
||||
public BOrd getNavOrd() {
|
||||
if (this.getStore() instanceof BLocalFileStore) {
|
||||
return BOrd.make(super.getNavOrd(), "zip:");
|
||||
}
|
||||
return super.getNavOrd();
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BZipFile(BIFileStore bIFileStore) {
|
||||
super(bIFileStore);
|
||||
}
|
||||
|
||||
public BZipFile() {
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$zip$BZipFile;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$zip$BZipFile = BZipFile.class("[Ljavax.baja.file.zip.BZipFile;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.SortUtil
|
||||
*/
|
||||
package javax.baja.file.zip;
|
||||
|
||||
import java.util.HashMap;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.zip.BZipSpace;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BZipFileDirectory
|
||||
extends BAbstractFileStore {
|
||||
public static final Type TYPE;
|
||||
private HashMap byName;
|
||||
private BIFile[] byList;
|
||||
static /* synthetic */ Class class$javax$baja$file$zip$BZipFileDirectory;
|
||||
|
||||
BDirectory getOrMakeDir(String string) {
|
||||
BDirectory bDirectory = (BDirectory)this.byName.get(string);
|
||||
if (bDirectory == null) {
|
||||
BZipSpace bZipSpace = (BZipSpace)this.getFileSpace();
|
||||
FilePath filePath = this.getFilePath().merge(string);
|
||||
BZipFileDirectory bZipFileDirectory = new BZipFileDirectory(bZipSpace, filePath);
|
||||
bDirectory = new BDirectory(bZipFileDirectory);
|
||||
this.byName.put(string, bDirectory);
|
||||
}
|
||||
return bDirectory;
|
||||
}
|
||||
|
||||
BIFile get(String string) {
|
||||
return (BIFile)this.byName.get(string);
|
||||
}
|
||||
|
||||
BIFile[] list() {
|
||||
if (this.byList == null) {
|
||||
this.byList = this.byName.values().toArray(new BIFile[this.byName.size()]);
|
||||
SortUtil.sort((Object[])this.byList);
|
||||
}
|
||||
return this.byList;
|
||||
}
|
||||
|
||||
void add(BIFile bIFile) {
|
||||
this.byName.put(bIFile.getFileName(), bIFile);
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isReadonly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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.byName = new HashMap();
|
||||
this.byList = null;
|
||||
}
|
||||
|
||||
public BZipFileDirectory(BZipSpace bZipSpace, FilePath filePath) {
|
||||
super(bZipSpace, filePath);
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$zip$BZipFileDirectory;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$zip$BZipFileDirectory = BZipFileDirectory.class("[Ljavax.baja.file.zip.BZipFileDirectory;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file.zip;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.zip.BZipSpace;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BZipFileEntry
|
||||
extends BAbstractFileStore {
|
||||
public static final Type TYPE;
|
||||
ZipEntry zipEntry;
|
||||
BAbsTime modified;
|
||||
static /* synthetic */ Class class$javax$baja$file$zip$BZipFileEntry;
|
||||
|
||||
public ZipEntry getZipEntry() {
|
||||
return this.zipEntry;
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isReadonly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return this.zipEntry.getSize();
|
||||
}
|
||||
|
||||
public BAbsTime getLastModified() {
|
||||
if (this.modified == null) {
|
||||
this.modified = BAbsTime.make(this.zipEntry.getTime());
|
||||
}
|
||||
return this.modified;
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
BZipSpace bZipSpace = (BZipSpace)this.getFileSpace();
|
||||
return bZipSpace.getZip().getInputStream(this.zipEntry);
|
||||
}
|
||||
|
||||
public long getCrc() throws IOException {
|
||||
return this.zipEntry.getCrc();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.zipEntry.hashCode();
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BZipFileEntry(BZipSpace bZipSpace, FilePath filePath, ZipEntry zipEntry) {
|
||||
super(bZipSpace, filePath);
|
||||
this.zipEntry = zipEntry;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$zip$BZipFileEntry;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$zip$BZipFileEntry = BZipFileEntry.class("[Ljavax.baja.file.zip.BZipFileEntry;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file.zip;
|
||||
|
||||
import javax.baja.file.zip.BZipFile;
|
||||
import javax.baja.file.zip.BZipSpace;
|
||||
import javax.baja.file.zip.ZipPath;
|
||||
import javax.baja.naming.BOrdScheme;
|
||||
import javax.baja.naming.InvalidOrdBaseException;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
import javax.baja.naming.SyntaxException;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BZipScheme
|
||||
extends BOrdScheme {
|
||||
public static final BZipScheme INSTANCE = new BZipScheme();
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$file$zip$BZipScheme;
|
||||
|
||||
public OrdQuery parse(String string) {
|
||||
return new ZipPath(this.getId(), string);
|
||||
}
|
||||
|
||||
public OrdTarget resolve(OrdTarget ordTarget, OrdQuery ordQuery) throws SyntaxException, UnresolvedException {
|
||||
ZipPath zipPath = (ZipPath)ordQuery;
|
||||
String string = zipPath.getBody();
|
||||
if (ordTarget.get() instanceof BZipFile) {
|
||||
BZipFile bZipFile = (BZipFile)ordTarget.get();
|
||||
BZipSpace bZipSpace = (BZipSpace)bZipFile.open();
|
||||
if (string.equals("") || string.equals("/")) {
|
||||
return new OrdTarget(ordTarget, bZipSpace);
|
||||
}
|
||||
return new OrdTarget(ordTarget, (BObject)((Object)bZipSpace.resolveFile(zipPath)));
|
||||
}
|
||||
if (ordTarget.get() instanceof BZipSpace) {
|
||||
BZipSpace bZipSpace = (BZipSpace)ordTarget.get();
|
||||
if (string.equals("") || string.equals("/")) {
|
||||
return new OrdTarget(ordTarget, bZipSpace);
|
||||
}
|
||||
return new OrdTarget(ordTarget, (BObject)((Object)bZipSpace.resolveFile(zipPath)));
|
||||
}
|
||||
throw new InvalidOrdBaseException(ordTarget.get().getType().toString());
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BZipScheme() {
|
||||
super("zip");
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$zip$BZipScheme;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$zip$BZipScheme = BZipScheme.class("[Ljavax.baja.file.zip.BZipScheme;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file.zip;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.BLocalFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.zip.BZipFile;
|
||||
import javax.baja.file.zip.BZipFileDirectory;
|
||||
import javax.baja.file.zip.BZipFileEntry;
|
||||
import javax.baja.file.zip.ZipPath;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BISession;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BZipSpace
|
||||
extends BFileSpace
|
||||
implements BIDirectory {
|
||||
public static final Type TYPE;
|
||||
static final Log log;
|
||||
BSpace parentSpace;
|
||||
BOrd ordInSession;
|
||||
private ZipFile zip;
|
||||
BZipFile bZipFile;
|
||||
BDirectory roots;
|
||||
boolean isModule;
|
||||
static /* synthetic */ Class class$javax$baja$file$zip$BZipSpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
ZipFile getZip() {
|
||||
if (this.zip == null && this.bZipFile != null) {
|
||||
this.zip = BZipSpace.open(this.bZipFile.getStore());
|
||||
}
|
||||
return this.zip;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
void close() {
|
||||
try {
|
||||
try {
|
||||
this.zip.close();
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw new BajaRuntimeException(iOException);
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var2_3 = null;
|
||||
this.zip = null;
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var2_4 = null;
|
||||
this.zip = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static ZipFile open(BIFileStore bIFileStore) {
|
||||
try {
|
||||
if (bIFileStore instanceof BLocalFileStore) {
|
||||
File file = ((BLocalFileStore)bIFileStore).getLocalFile();
|
||||
return new ZipFile(file);
|
||||
}
|
||||
throw new IllegalStateException("Only BLocalFileStore supported");
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw new BajaRuntimeException(iOException);
|
||||
}
|
||||
}
|
||||
|
||||
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
|
||||
throw new IOException("ZipSpace is readonly");
|
||||
}
|
||||
|
||||
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
|
||||
throw new IOException("ZipSpace is readonly");
|
||||
}
|
||||
|
||||
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
|
||||
throw new IOException("ZipSpace is readonly");
|
||||
}
|
||||
|
||||
public void delete(FilePath filePath, Context context) throws IOException {
|
||||
throw new IOException("ZipSpace is readonly");
|
||||
}
|
||||
|
||||
public BIFile[] listFiles() {
|
||||
return this.getChildren(this.roots());
|
||||
}
|
||||
|
||||
public BIFile findFile(FilePath filePath) {
|
||||
BIFile bIFile = this.roots();
|
||||
int n = 0;
|
||||
while (n < filePath.depth()) {
|
||||
if ((bIFile = this.getChild(bIFile, filePath.nameAt(n))) == null) {
|
||||
return null;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return bIFile;
|
||||
}
|
||||
|
||||
public BIFileStore findStore(FilePath filePath) {
|
||||
BIFile bIFile = this.findFile(filePath);
|
||||
if (bIFile == null) {
|
||||
return null;
|
||||
}
|
||||
return bIFile.getStore();
|
||||
}
|
||||
|
||||
public BIFile getChild(BIFile bIFile, String string) {
|
||||
BIFileStore bIFileStore = bIFile.getStore();
|
||||
if (bIFileStore instanceof BZipFileDirectory) {
|
||||
BZipFileDirectory bZipFileDirectory = (BZipFileDirectory)bIFileStore;
|
||||
return bZipFileDirectory.get(string);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BIFile[] getChildren(BIFile bIFile) {
|
||||
BIFileStore bIFileStore = bIFile.getStore();
|
||||
if (bIFileStore instanceof BZipFileDirectory) {
|
||||
BZipFileDirectory bZipFileDirectory = (BZipFileDirectory)bIFileStore;
|
||||
return bZipFileDirectory.list();
|
||||
}
|
||||
return new BIFile[0];
|
||||
}
|
||||
|
||||
protected BOrd appendFilePathToOrd(BOrd bOrd, FilePath filePath) {
|
||||
if (bOrd == null) {
|
||||
return null;
|
||||
}
|
||||
if (bOrd.toString().length() == 0) {
|
||||
return BOrd.make(filePath);
|
||||
}
|
||||
return BOrd.make(bOrd, filePath);
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession() {
|
||||
return this.ordInSession;
|
||||
}
|
||||
|
||||
public String getNavDescription(Context context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
return this.getChild(this.roots(), string);
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
return this.listFiles();
|
||||
}
|
||||
|
||||
private final synchronized BDirectory roots() {
|
||||
if (this.roots != null) {
|
||||
return this.roots;
|
||||
}
|
||||
this.roots = new BDirectory(new BZipFileDirectory(this, (FilePath)new ZipPath("/")));
|
||||
try {
|
||||
Enumeration<? extends ZipEntry> enumeration = this.zip.entries();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
ZipEntry zipEntry = enumeration.nextElement();
|
||||
if (zipEntry.isDirectory()) continue;
|
||||
String string = zipEntry.getName().replace('\\', '/');
|
||||
if (this.isModule && (string.endsWith(".class") || string.endsWith(".properties") || string.startsWith("META-INF/") || string.startsWith("meta-inf/"))) continue;
|
||||
ZipPath zipPath = new ZipPath("/" + string);
|
||||
BZipFileEntry bZipFileEntry = new BZipFileEntry(this, zipPath, zipEntry);
|
||||
BIFile bIFile = this.makeFile(bZipFileEntry);
|
||||
BDirectory bDirectory = this.mapToDirectory(zipPath);
|
||||
BZipFileDirectory bZipFileDirectory = (BZipFileDirectory)bDirectory.getStore();
|
||||
bZipFileDirectory.add(bIFile);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Loading zip: " + this.zip, exception);
|
||||
}
|
||||
return this.roots;
|
||||
}
|
||||
|
||||
public BHost getHost() {
|
||||
return this.parentSpace == null ? null : this.parentSpace.getHost();
|
||||
}
|
||||
|
||||
public BISession getSession() {
|
||||
return this.parentSpace == null ? null : this.parentSpace.getSession();
|
||||
}
|
||||
|
||||
private final BDirectory mapToDirectory(FilePath filePath) {
|
||||
BDirectory bDirectory = this.roots;
|
||||
int n = 0;
|
||||
while (n < filePath.depth() - 1) {
|
||||
BZipFileDirectory bZipFileDirectory = (BZipFileDirectory)bDirectory.getStore();
|
||||
bDirectory = bZipFileDirectory.getOrMakeDir(filePath.nameAt(n));
|
||||
++n;
|
||||
}
|
||||
return bDirectory;
|
||||
}
|
||||
|
||||
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 BZipSpace(BZipFile bZipFile) {
|
||||
super("zip");
|
||||
this.parentSpace = bZipFile.getSpace();
|
||||
this.ordInSession = bZipFile.getOrdInSession();
|
||||
this.bZipFile = bZipFile;
|
||||
this.zip = BZipSpace.open(bZipFile.getStore());
|
||||
}
|
||||
|
||||
public BZipSpace(BOrd bOrd, ZipFile zipFile) {
|
||||
super("zip");
|
||||
this.ordInSession = bOrd;
|
||||
this.zip = zipFile;
|
||||
boolean bl = false;
|
||||
if (bOrd.toString().indexOf("module:") >= 0) {
|
||||
bl = true;
|
||||
}
|
||||
this.isModule = bl;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$file$zip$BZipSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$file$zip$BZipSpace = BZipSpace.class("[Ljavax.baja.file.zip.BZipSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
log = Log.getLog("file");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.file.zip;
|
||||
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.OrdQueryList;
|
||||
|
||||
public class ZipPath
|
||||
extends FilePath {
|
||||
protected FilePath newInstance(String string) {
|
||||
return new ZipPath(this.getScheme(), string);
|
||||
}
|
||||
|
||||
public void normalize(OrdQueryList ordQueryList, int n) {
|
||||
if (ordQueryList.isSameScheme(n, n + 1)) {
|
||||
FilePath filePath = (FilePath)ordQueryList.get(n + 1);
|
||||
ordQueryList.merge(n, this.merge(filePath));
|
||||
}
|
||||
}
|
||||
|
||||
public ZipPath(String string, String string2) {
|
||||
super(string, string2);
|
||||
}
|
||||
|
||||
public ZipPath(String string) {
|
||||
this("zip", string);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user