Solved

Viewing of DXL files in Notes Client.

Posted on 2008-10-09
20
2,488 Views
Last Modified: 2013-12-18
I have a requirement to be able to open an exported content of Notes email ( DXL ) to be opened uisng Notes Client. I used the DXLExporter class in Java/Corba toolkit  to create this file.

What/How do I make this file open using Notes Client( assuming Notes client recognizes the format, since it was exported ). Or are there any other ways that the I can view this exported DXL.
0
Comment
Question by:deepankar_das1
  • 10
  • 6
  • 4
20 Comments
 
LVL 22

Expert Comment

by:mbonaci
ID: 22681133
You used DXLExporter to create DXL file from Domino data (document).

The DXLImporter class converts DXL to Domino data. Use the createDXLImporter method in Session to create a DxlImporter object. Input to DxlImporter can be a String, Stream, or NotesRichTextItem object. Output is to a Database object.
The import operation constructs a list of note IDs for the newly imported notes. You can access these note IDs using the getFirstImportedNoteId and getNextImportedNoteId methods.

Here's an example of an agent that converts a DXL file into a newly created database:
import lotus.domino.*;
 

public class JavaAgent extends AgentBase {
 

  static DxlImporter importer = null;
 

  public void NotesMain() {
 

    try {

      Session session = getSession();

      AgentContext agentContext = session.getAgentContext();
 

      // (Your code goes here) 

      // Get current database

      Database db = agentContext.getCurrentDatabase();

      // Get DXL file

      String filename = "c:\\dxl\\exporteddb.dxl";

      Stream stream = session.createStream();

      if (stream.open(filename) & (stream.getBytes() >0)) {

        // Create new database - replace if it already exists

        Database newdb = session.getDatabase(null, "imported");

        if (newdb.isOpen())

          newdb.remove();

        DbDirectory dbdir = session.getDbDirectory(null);

        newdb = dbdir.createDatabase("imported", true);

        newdb.setTitle("Imported");

        // Import DXL from file to new database

        importer = session.createDxlImporter();

        importer.setReplaceDbProperties(true);

        importer.setReplicaRequiredForReplaceOrUpdate(false);

        importer.setAclImportOption(

          DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_IGNORE);

        importer.setDesignImportOption(

          DxlImporter.DXLIMPORTOPTION_CREATE);

        importer.importDxl(stream, newdb);

      }

      else

        System.out.println(filename + " does not exist or is empty");
 

    } catch(Exception e) {

      e.printStackTrace();

      

    } finally {

      // Print importer log

      try {

        System.out.println(importer.getLog());

      } catch(Exception e) {e.printStackTrace();}

    }

  }

}

Open in new window

0
 

Author Comment

by:deepankar_das1
ID: 22681187
thanks for the inputs. But my question was how can a Notes client be automatically made to be launched when we click on a DXL file. I'm not sure if this is possible or not.

The reason why we need this is that the users don't want to just open the emails right there and not do this as a multi step process of
1. Creating a temp nsf file.
2. Importing all the DXL files into that database.
3. Now open Notes client and view the emails imported through DXL.

0
 
LVL 22

Expert Comment

by:mbonaci
ID: 22681258
I thought that your clients have Notes opened. Then you would develop e.g. action "Import DXL" in the Inbox folder, which the user would click and choose DXL file. That's it. You would, of course, convert dxl into docs and refresh the view/folder...

And although it would be the most practical solution, It can't be done the way you want - double click on dxl file in windows explorer.

Mb¤
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 22681280
And yes, the code was just example from Designer help, you wouldn't create db every time you import something, of course :)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22682901
Watch out when importing DXL: if there are Reader fields in the document you might not even see it after importing it!

If the mail is a plain text mail, so no crypting and no images, you might be able to find an XSLT-tool and a transformation xsl-stylesheet. Or you have to develop a transformation xsl-stylesheet. Not easy but doable. In that case you wouldn't even need Notes to view it, just a browser (if you translate the DXL to HTML).

There's another option, which would even allow you to get rid of the DXL: just forward the mail... :-))

By the way, if you double-click a .nsf database, Notes will automatically start and open that db.
0
 

Author Comment

by:deepankar_das1
ID: 22724164
I tried to use the code as specific above to import an DXL file into a newly created database. Note I'm running this on a separate box using the Java/Corba api. I get the following exception

NotesException: Disk i/o is a restricted operation
        at lotus.domino.NotesExceptionHelper.read(Unknown Source)
        at lotus.domino.NotesExceptionHolder._read(Unknown Source)
        at lotus.priv.CORBA.iiop.RepImpl.invoke(Unknown Source)
        at lotus.priv.CORBA.portable.ObjectImpl._invoke(Unknown Source)
        at lotus.domino.corba._IDxlImporterStub.importDxlStream(Unknown Source)
        at lotus.domino.cso.DxlImporter.importDxl(Unknown Source)

I did try to enable the flags to be able to run the restricted operations for the userId( Session is created uisng this Id) but did not change the behaviour.

I would appreciate any pointers.

Paresh
0
 

Author Comment

by:deepankar_das1
ID: 22724186
Here's the attachment showing the settings that I have on the server.
permissions.doc
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22725588
Is it an agent? Try to set, in the Agent Properties box, the Runtime security level to 2 or 3.

Or where is your Java running? What permissions do you have on the system you're running your program on??
0
 

Author Comment

by:deepankar_das1
ID: 22725741
Not it is not an agent. My Java program is running on a Windows box as a service under Tomcat and I'm using the Java/Corba toolkit api's.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22725980
Did you try to add your username to the people allowed to run Unrestricted agents?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:deepankar_das1
ID: 22726251
If I allow the user to "Run Unrestricted methods and operations" I get the following exception. Note this worked when I used Notes.jar through my service, as I also have the Notes client installed locally. But I don't want to use it since it prompts me during the runtime for password before importing the document. Whereas using the remote calls since my session is already established using an username/pasword I don't have this problem. Hence I'm using the remote calls to achive this.

NotesException: DXLImporter output object is invalid, uninitialized, or not explicitly declared and strongly typed
        at lotus.domino.NotesExceptionHelper.read(Unknown Source)
        at lotus.domino.NotesExceptionHolder._read(Unknown Source)
        at lotus.priv.CORBA.iiop.RepImpl.invoke(Unknown Source)
        at lotus.priv.CORBA.portable.ObjectImpl._invoke(Unknown Source)
        at lotus.domino.corba._IDxlImporterStub.importDxlStream(Unknown Source)

I'm using the DxlImporter as follows.
        .....
        // Import DXL from file to new database
        importer = session.createDxlImporter();
        importer.setReplaceDbProperties(true);
        importer.setReplicaRequiredForReplaceOrUpdate(true);
        importer.setInputValidationOption(DxlImporter.DXLVALIDATIONOPTION_VALIDATE_NEVER);
        importer.setAclImportOption(
                          DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_IGNORE);
        importer.setDesignImportOption(
                          DxlImporter.DXLIMPORTOPTION_CREATE);
        importer.importDxl(stream, newdb);
        .....

I'm using Notes 6.5 as the Domino Administrator Client.
0
 

Author Comment

by:deepankar_das1
ID: 22726428
Is it possible becuse this is a remote api its acutally trying to locate the database file on the server box where I'm connected when the
                            importer.importDxl(...)
is executed. This is something that I'm trying to execute locally on my Windows box where the database file is. Is my understanding right here??

If remote api's is not the one to use as the database exists locally,  how can I prevent the prompt for the password during the import operation which I get when I use the Notes.jar file.



0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22726515
Seems a complete copy/paste from the Help db to me, so it should work. What line does the execution stop at? The first one, at the createDxlImporter?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22726581
Aaaah, you're right, that isn't possible.  The database must reside on the server. The only way to use a local database would be through a Local Notes client, using the COM interface. Maybe it's possible via Java and the Lotus.NotesSession objects (not Domino.Notes), but that I don't know.
0
 

Author Comment

by:deepankar_das1
ID: 22726588
No as I indicated it happens when we exeucte the importer.importDxl(..) stmt. Could you please clarify the above question as well. There's no point looking into it if the remote calls will not work for local databases.

0
 

Author Comment

by:deepankar_das1
ID: 22726616
I undid the permission for "Run unrestricted methods and operations" due to the exception. Can you tell me what I need to set based on the attached document.
total-perms.doc
0
 

Author Comment

by:deepankar_das1
ID: 22726637
Sorry I missed you previous response. So now if I use the Notes.jar for which the import works, what settings do I need to have. Can I put somethings inside the notes.ini to not prompt for the password and proceed.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22726651
The password is required to allow the Notes-layer to access the server, by means of opening the ID-file. There is the possibility in COM to create a Session in combination with a name and a password, but whether that works for Java as well ... dunno.

I'm off now. I'll read the attachment tomorrow. Sorry (yawn).
0
 
LVL 22

Accepted Solution

by:
mbonaci earned 250 total points
ID: 22728850
For local calls:
- you don't need CORBA.
- the classpath must include Notes.jar (for local calls).
- path has to include Lotus\Notes dir.
- the interfaces in lotus.domino package are implemented in package lotus.domino.local.

The local calls require that the NotesThread class manages threads (because NotesThread extends java.lang.Thread to include special init and term codes for Domino.
You have three options to execute threads:
- through inheritance
- through the Runnable interface
- through the static methods

To avoid password prompt (when accessing through the Notes ID) create session like this:

Session s = NotesFactory.createSession((String)null, (String)null, "password" )

Note that the ID file through you access session is specified in KeyFileName variable in first Notes.ini in path.


Hope this helps,
mb¤
0
 

Author Comment

by:deepankar_das1
ID: 22734131
I created the Session without specifying the userName and I did not see the prompt. Thanks for the help.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now