Search code examples
javalotus-dominolotus

Lotus Domino 8.5.2 Java Agent , write Metadata to extracted attachments?


I'm using Lotus Domino server 8.5.2. Using Java scheduled agents, I can extract the attachments of several Lotus Domino Documents in to the file system (win 32). The Idea is that after extraction I need add some metadata to the files and upload the files to another system.

Does someone knows, or can give me a few tips (preferably using Java) of how I can write some metadata to the extracted files? I need add some keywords, change the author, and so on. I understand Lotus Domino 8.5.2 supports Java 6

thank you!

Alex.


Solution

  • According to this answer, Java 7 has a native ability to manipulate Windows metadata but Java 6 does not.

    It does say that you can use Java Native Access (JNA) to make calls to native DLLs, which means you should be able to use dsofile.dll to manipulate the metadata. Example from here of using JNA to access the "puts" function from msvcrt.dll (couldn't find any examples specific to dsofile.dll):

    Interface

    package CInterface; 
    
    import com.sun.jna.Library; 
    
    public interface CInterface extends Library 
    { 
          public int puts(String str);
    }     
    

    Sample class

    // JNA Demo. Scriptol.com
    package CInterface; 
    import com.sun.jna.Library; 
    import com.sun.jna.Native;
    import com.sun.jna.Platform;
    
    public class hello 
    { 
      public static void main(String[] args) 
      { 
        String mytext = "Hello World!";  
         if (args.length != 1) 
        { 
          System.err.println("You can enter your own text between quotes..."); 
          System.err.println("Syntax: java -jar /jna/dist/demo.jar \"myowntext\"");
        }
        else
           mytext = args[0]; 
    
        // Library is c for unix and msvcrt for windows
        String libName = "c"; 
        if (System.getProperty("os.name").contains("Windows")) 
        { 
          libName = "msvcrt";  
        } 
    
        // Loading dynamically the library
        CInterface demo = (CInterface) Native.loadLibrary(libName, CInterface.class); 
        demo.puts(mytext);
      } 
    }