/* * Decompiled with CFR 0.152. * * Could not load the following classes: * javax.baja.file.FilePath * javax.baja.security.PermissionException * javax.baja.spy.BSpy * javax.baja.spy.BSpySpace * javax.baja.spy.Spy * javax.baja.spy.SpyWriter * javax.baja.sys.Sys * javax.baja.sys.Type */ package com.tridium.fox.sys.spy; import com.tridium.fox.session.FoxRequest; import com.tridium.fox.session.FoxResponse; import com.tridium.fox.session.InvalidCommandException; import com.tridium.fox.sys.BFoxChannel; import com.tridium.fox.sys.spy.FoxSpy; import java.io.ByteArrayOutputStream; import java.io.OutputStream; import javax.baja.file.FilePath; import javax.baja.security.PermissionException; import javax.baja.spy.BSpy; import javax.baja.spy.BSpySpace; import javax.baja.spy.Spy; import javax.baja.spy.SpyWriter; import javax.baja.sys.Sys; import javax.baja.sys.Type; /* * Illegal identifiers - consider using --renameillegalidents true */ public class BSpyChannel extends BFoxChannel { public static final Type TYPE; static /* synthetic */ Class class$com$tridium$fox$sys$spy$BSpyChannel; public Type getType() { return TYPE; } public FoxResponse process(FoxRequest foxRequest) throws Exception { String string = foxRequest.command; if (string == "get") { return this.get(foxRequest); } throw new InvalidCommandException(string); } public BSpy get(FilePath filePath) throws Exception { FoxRequest foxRequest = this.makeRequest("get"); foxRequest.add("path", filePath.getBody()); if (this.isTraceOn()) { this.trace("c:get \"" + filePath.getBody() + '\"'); } FoxResponse foxResponse = this.sendSync(foxRequest); String string = foxResponse.getString("title"); byte[] byArray = foxResponse.getBlob("content"); return BSpy.make((FilePath)filePath, (Spy)new FoxSpy(string, new String(byArray))); } public FoxResponse get(FoxRequest foxRequest) throws Exception { BSpy bSpy; FilePath filePath = new FilePath(foxRequest.getString("path")); if (this.isTraceOn()) { this.trace("s:get \"" + filePath.getBody() + '\"'); } if (!this.getPermissionsFor(bSpy = BSpySpace.INSTANCE.resolveSpy(filePath)).hasOperatorRead()) { throw new PermissionException(); } Spy spy = bSpy.get(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); SpyWriter spyWriter = new SpyWriter((OutputStream)byteArrayOutputStream, filePath, this.getSessionContext()); spy.write(spyWriter); spyWriter.flush(); byte[] byArray = byteArrayOutputStream.toByteArray(); FoxResponse foxResponse = new FoxResponse(foxRequest); foxResponse.add("title", spy.getTitle()); foxResponse.add("content", byArray); return foxResponse; } 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 BSpyChannel() { super("spy"); } static { Class clazz = class$com$tridium$fox$sys$spy$BSpyChannel; if (clazz == null) { clazz = class$com$tridium$fox$sys$spy$BSpyChannel = BSpyChannel.class("[Lcom.tridium.fox.sys.spy.BSpyChannel;", false); } TYPE = Sys.loadType((Class)clazz); } }