141 lines
3.9 KiB
Java
141 lines
3.9 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package javax.baja.spy;
|
|
|
|
import javax.baja.category.BCategoryMask;
|
|
import javax.baja.category.BCategoryService;
|
|
import javax.baja.category.BICategorizable;
|
|
import javax.baja.file.FilePath;
|
|
import javax.baja.naming.BLocalHost;
|
|
import javax.baja.naming.BOrd;
|
|
import javax.baja.naming.OrdTarget;
|
|
import javax.baja.naming.SyntaxException;
|
|
import javax.baja.naming.UnresolvedException;
|
|
import javax.baja.security.BIProtected;
|
|
import javax.baja.security.BPermissions;
|
|
import javax.baja.space.BSpace;
|
|
import javax.baja.spy.BSpy;
|
|
import javax.baja.spy.ISpyDir;
|
|
import javax.baja.spy.Spy;
|
|
import javax.baja.spy.SpyWriter;
|
|
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 class BSpySpace
|
|
extends BSpace
|
|
implements BICategorizable,
|
|
BIProtected {
|
|
private static final BIcon icon = BIcon.std("spy.png");
|
|
public static final BSpySpace INSTANCE = new BSpySpace();
|
|
public static final Type TYPE;
|
|
private static final BOrd ordInSession;
|
|
static /* synthetic */ Class class$javax$baja$spy$BSpySpace;
|
|
|
|
public BSpy resolveSpy(FilePath filePath) throws SyntaxException, UnresolvedException {
|
|
Spy spy = Spy.ROOT;
|
|
int n = 0;
|
|
while (n < filePath.depth()) {
|
|
String string = filePath.nameAt(n);
|
|
if ((spy = spy instanceof ISpyDir ? ((ISpyDir)((Object)spy)).find(string) : null) == null) break;
|
|
++n;
|
|
}
|
|
if (spy == null) {
|
|
spy = new NotFoundSpy();
|
|
}
|
|
return BSpy.make(filePath, spy);
|
|
}
|
|
|
|
public BCategoryMask getCategoryMask() {
|
|
return BCategoryService.getService().getCategoryMask(ordInSession);
|
|
}
|
|
|
|
public BCategoryMask getAppliedCategoryMask() {
|
|
return BCategoryService.getService().getAppliedCategoryMask(ordInSession);
|
|
}
|
|
|
|
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().hasAdminRead();
|
|
}
|
|
|
|
public boolean canWrite(OrdTarget ordTarget) {
|
|
return false;
|
|
}
|
|
|
|
public boolean canInvoke(OrdTarget ordTarget) {
|
|
return false;
|
|
}
|
|
|
|
public BOrd getOrdInSession() {
|
|
return ordInSession;
|
|
}
|
|
|
|
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());
|
|
}
|
|
}
|
|
|
|
protected BSpySpace() {
|
|
super("spy", LexiconText.make("baja", "nav.spy"));
|
|
}
|
|
|
|
protected BSpySpace(String string, LexiconText lexiconText) {
|
|
super(string, lexiconText);
|
|
}
|
|
|
|
static {
|
|
BLocalHost.INSTANCE.addNavChild(INSTANCE);
|
|
Class clazz = class$javax$baja$spy$BSpySpace;
|
|
if (clazz == null) {
|
|
clazz = class$javax$baja$spy$BSpySpace = BSpySpace.class("[Ljavax.baja.spy.BSpySpace;", false);
|
|
}
|
|
TYPE = Sys.loadType(clazz);
|
|
ordInSession = BOrd.make("spy:/");
|
|
}
|
|
|
|
static class NotFoundSpy
|
|
extends Spy {
|
|
public String getTitle() {
|
|
return "Spy Not Found";
|
|
}
|
|
|
|
public void write(SpyWriter spyWriter) {
|
|
spyWriter.w("<h1>Spy Not Found</h1>");
|
|
spyWriter.w(spyWriter.path);
|
|
}
|
|
|
|
NotFoundSpy() {
|
|
}
|
|
}
|
|
}
|
|
|