以用户身份运行LotusScript Domino代理并从JavaOSGi包中获取SdtOutput(LotusScript打印)

以用户身份运行LotusScript Domino代理并从JavaOSGi包中获取SdtOutput(LotusScript打印),java,osgi,lotus-domino,lotusscript,ibm-domino,Java,Osgi,Lotus Domino,Lotusscript,Ibm Domino,我在Domino上开发了一个OSGi包,它应该在用户上下文中执行代码。LotusScript中也存在大量代码,需要重写的工作太多(Web代理)。因此,我正在寻找一种解决方案,以用户身份运行这些web代理并获取输出(打印)。我已经尝试了很多,但现在我被卡住了,我要么以代理签名者的身份运行代理(session.effectiveUserName的结果)并能够获取输出,要么以用户的身份运行代理,但无法获取输出。但由于LotusScript代码必须尊重reader字段这一点很重要,因此它必须以用户身份运

我在Domino上开发了一个OSGi包,它应该在用户上下文中执行代码。LotusScript中也存在大量代码,需要重写的工作太多(Web代理)。因此,我正在寻找一种解决方案,以用户身份运行这些web代理并获取输出(打印)。我已经尝试了很多,但现在我被卡住了,我要么以代理签名者的身份运行代理(session.effectiveUserName的结果)并能够获取输出,要么以用户的身份运行代理,但无法获取输出。但由于LotusScript代码必须尊重reader字段这一点很重要,因此它必须以用户身份运行。因为我需要代理的输出在Java中完成其余的工作,所以我还需要一种获取标准输出的方法

到目前为止,我所尝试的:

  • OpenNTF Domino API:I可以作为用户运行代理,但我不能获取输出(或者我不知道如何获取)

  • Darwino NAPI:I不能以用户身份运行代理,但我可以获取输出(或者我不知道如何)

  • DominoJNA:I不能以用户身份运行代理,但我可以获取输出(或者我不知道如何获取)

有没有人知道解决方法或者能给我一个提示来解决这个问题

String user = "Effective User/Acme";
TrustedSessionFactory factory = new TrustedSessionFactory(null);
Sessions s = factory.createSession(user);
Database db = .getDatabase(null, "path/db.nsf");
Agent ag = db.getAgent("LotusScript-Web-Agent")
ag.run();
/* How can I grap the prints?? */
String user = "CN=Effective User Name/O=Acme";
String prints = null;
NSFSession nsfSession = null;
NSFDatabase nsfDb = null;
NSFAgent nsfAg = null;
RunContext runContext = null;

try {
    DominoAPI napi = DominoAPI.get();
    nsfSession = new NSFSession(napi, user, true, false);
    nsfDb = nsfSession.getDatabase(null, "path/db.nsf");
    nsfAg = nsfDb.getDesign().getAgent("LotusScript-Web-Agent");
    runContext = nsfAg.createRunContext(true);
    runContext.redirectOutput(AGENT_REDIR.MEMORY);
    runContext.documentContext(nsfNote);
    runContext.run(false);
    /* How can I run the agent as "Effective User/Acme" and not as agent signer ?? */
    prints = runContext.getStdoutBuffer();
} finally {
    if (runContext != null)
        runContext.free();
    if (nsfAg != null)
        nsfAg.free();
    if (nsfDb != null)
        nsfDb.free();
    if (nsfSession != null)
        nsfSession.free();
}
String prints = NotesGC.runWithAutoGC(() -> {
    String user = "Effective User/Acme";
    NotesDatabase ndb = new NotesDatabase(null, "path/db.nsf", user);
    NotesAgent ag = ndb.getAgent("LotusScript-Web-Agent");
    Writer printWriter = new StringWriter();
    NotesAgentRunContext narc = new NotesAgentRunContext();
    narc.setUsername(user);
    narc.setCheckSecurity(true);
    narc.setOutputWriter(printWriter);
    ag.run(narc);
    /* How can I run the agent as "Effective User/Acme" and not as agent signer ?? */
    return printWriter.toString();
});