在数据库中使用DXL导入SSJS脚本库 [英] Import SSJS script library using DXL in a database

查看:133
本文介绍了在数据库中使用DXL导入SSJS脚本库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要使用DXL在数据库中导入SSJS库.为此,我们编写了一个Java Agent,其代码如下所示:

We need to import a SSJS library in a database using DXL. For this we have written a Java Agent and its code goes something like this:

import lotus.domino.*;
public class JavaAgent extends AgentBase {
    private DxlImporter importer = null;
    public void NotesMain() {
        try {
            Session session = getSession();
            AgentContext agentContext = session.getAgentContext();

            String filename = "C:\\tempssjslib.xml";

            Stream stream = session.createStream();
            if (stream.open(filename) & (stream.getBytes() > 0)) {
                Database importdb = session.getCurrentDatabase();
                importer = session.createDxlImporter();
                importer.setReplaceDbProperties(true);
                importer.setReplicaRequiredForReplaceOrUpdate(false);
                importer.setAclImportOption(DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_IGNORE);
                importer.setDesignImportOption(DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_CREATE);
                importer.importDxl(stream, importdb);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } 
        finally {
            try {
                System.out.println(importer.getLog());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}

文件 C:\ tempssjslib.xml 包含一个SSJS库,该库是我在Domino Designer中创建的,然后使用工具> DXL实用工具>导出器"(用于测试目的)导出.但是,当我运行此代理程序库时,不会不会导入数据库中. DxlImporter.getLog()也没有错误.

The file C:\tempssjslib.xml contains a SSJS library which I created in Domino Designer and then exported using "Tools > DXL Utilities > Exporter" (for testing purpose). But when I run this agent library does not get imported in the database. There is no error in DxlImporter.getLog() also.

我尝试使用XPages,Form,LotusScript脚本库执行类似的过程,并成功导入了它们.但是同一代理程序无法导入SSJS库.

I tried similar procedure with XPages, Form, LotusScript script library and was successfully able to import them. But the same agent is not able to import SSJS library.

代码中是否缺少某些内容?我们可以使用DXL导入数据库中的SSJS库吗?

Is there something that I have missed in the code? Can we import SSJS library in database using DXL?

推荐答案

似乎导出器工具(甚至DXLexporter)没有导出所有需要的字段.如果您在dxl文件中手动将其添加到项目名称='$ ServerJavaScriptLibrary'...行之前,它将成功导入.

It looks like the exporter tool (or maybe even the DXLexporter) is not exporting all needed fields. If you manually add this inside the dxl file, just before the item name='$ServerJavaScriptLibrary'... line, it will succesfully import it.

<item name='$Flags'><text>.5834Q</text></item>
<item name='$TITLE'><text>...name of the SSJS library...</text></item>

这篇关于在数据库中使用DXL导入SSJS脚本库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆