63 lines
2.0 KiB
Java
63 lines
2.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.tridium.sys.transfer;
|
|
|
|
import com.tridium.sys.transfer.CompToComp;
|
|
import com.tridium.sys.transfer.FileToFile;
|
|
import com.tridium.sys.transfer.TransferResult;
|
|
import java.io.OutputStream;
|
|
import javax.baja.file.BDirectory;
|
|
import javax.baja.file.BFileSpace;
|
|
import javax.baja.file.BIFile;
|
|
import javax.baja.io.ValueDocEncoder;
|
|
import javax.baja.space.BComponentSpace;
|
|
import javax.baja.util.BUnrestrictedFolder;
|
|
|
|
public class CompToBog
|
|
extends CompToComp {
|
|
String filename;
|
|
|
|
protected void name() throws Exception {
|
|
if (CompToBog.isDebugOn()) {
|
|
CompToBog.debug("CompToBog.name");
|
|
}
|
|
this.insertNames = (String[])this.suggestedNames.clone();
|
|
}
|
|
|
|
protected BComponentSpace getTargetSpace() {
|
|
return new BComponentSpace(null, null, null);
|
|
}
|
|
|
|
protected void insert() throws Exception {
|
|
if (CompToBog.isDebugOn()) {
|
|
CompToBog.debug("CompToBog.insert");
|
|
}
|
|
BDirectory bDirectory = (BDirectory)this.target;
|
|
BFileSpace bFileSpace = bDirectory.getFileSpace();
|
|
this.filename = FileToFile.getUniqueFilename(bDirectory, this.insertNames[0] + ".bog");
|
|
BIFile bIFile = bFileSpace.makeFile(bDirectory.getFilePath().merge(this.filename), this.getContext());
|
|
BUnrestrictedFolder bUnrestrictedFolder = new BUnrestrictedFolder();
|
|
int n = 0;
|
|
while (n < this.insertValues.length) {
|
|
bUnrestrictedFolder.add(this.insertNames[n], this.insertValues[n]);
|
|
++n;
|
|
}
|
|
OutputStream outputStream = bIFile.getOutputStream();
|
|
ValueDocEncoder valueDocEncoder = new ValueDocEncoder(outputStream);
|
|
valueDocEncoder.setZipped(true);
|
|
valueDocEncoder.encodeDocument(bUnrestrictedFolder);
|
|
valueDocEncoder.close();
|
|
}
|
|
|
|
public TransferResult makeResult() {
|
|
return new TransferResult(new String[]{this.filename}){
|
|
|
|
public final void undo() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|