1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package de.bea.domingo.samples;
24
25 import de.bea.domingo.DDatabase;
26 import de.bea.domingo.DDocument;
27 import de.bea.domingo.DNotesException;
28 import de.bea.domingo.DNotesFactory;
29 import de.bea.domingo.DSession;
30 import de.bea.domingo.monitor.AbstractMonitor;
31 import de.bea.domingo.monitor.ConsoleMonitor;
32
33 /***
34 * A simple example accessing a Lotus Domino server via XML over Http.
35 *
36 * @author <a href=mailto:kriede@users.sourceforge.net>Kurt Riede</a>
37 */
38 public final class HttpMail {
39
40 /***
41 * Main method of sample.
42 *
43 * @param args arguments
44 * @throws DNotesException if the sample fails
45 */
46 public static void main(String[] args) throws DNotesException {
47
48
49 ConsoleMonitor monitor = new ConsoleMonitor();
50 monitor.setLevel(AbstractMonitor.DEBUG);
51
52
53 DNotesFactory factory = DNotesFactory.getInstance("de.bea.domingo.http.NotesHttpFactory", monitor);
54
55
56 DSession session = factory.getSession("http://plato.acme", "kriede", "password");
57
58
59
60 DDatabase database = session.getDatabase("", "mail/administ.nsf");
61
62
63 DDocument document = database.createDocument();
64 document.replaceItemValue("Form", "Memo");
65 document.replaceItemValue("From", "kriede@acme");
66 document.replaceItemValue("Subject", "Domingo Test with XML over Http");
67 document.replaceItemValue("Body", "Domingo Test with XML over Http");
68 boolean b = document.save();
69 if (b) {
70 System.out.println("Mail saved");
71 } else {
72 System.out.println("error saving mail");
73 }
74 }
75 }