Import SSJS script library using DXL on database

We need to import the SSJS library into the database using DXL. To do this, we wrote a Java agent, and its code looks 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();
            }
        }
    }
}

      

The C: \ tempssjslib.xml file contains the SSJS library that I created in Domino Designer and then exported using Tools> DXL Utilities> Exporter (for testing purposes). But when I run this agent library, not imported into the database . There is DxlImporter.getLog()

also no error.

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

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

+3


source to share


3 answers


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



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

      

+1


source


If you type the imported note id and parse it in the appropriate tool (Ytria or Notespeek), you will see that the problem is with the $ Flags field.

I created an SSJS test library and the $ Flags field contains ".5834Q". But the imported one has only "34Q".

I don't have an exact link for these flags, but this might be a good start. Overwriting this field manually works well, but this flag may contain some valuable information.



It seems to me that this is a mistake.

Also, YTria has a good link on the contents of the $ flags field.

+1


source


Make your life easier and use the Import / Export plugin open in OpenNTF: http://www.openntf.org/blogs/openntf.nsf/d6plinks/NHEF-7YAAF6 It has an ANT API so you can automate operations. Domino Designer is needed, so it might not fit your use case. Alternatively (not tested): have you seen if webDAV provides script libraries?

+1


source







All Articles