DominoTarget.java
1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.sitech.ismp.coll;
import lotus.domino.Database;
import lotus.domino.NotesException;
import lotus.domino.NotesFactory;
import lotus.domino.Session;
public class DominoTarget {
private String ip;
private String port;
private String user;
private String pass;
private String nsf;
private String url;
private Database db = null;
private Session s = null;
public DominoTarget(String ip, String port, String user, String pass,
String nsf) {
this.ip = ip;
this.port = port;
this.user = user;
this.pass = pass;
this.nsf = nsf;
this.url = this.ip + ":" + this.port;
}
public boolean openDB() {
try {
s = NotesFactory.createSession(url, user, pass);
db = s.getDatabase(s.getServerName(), nsf, false);
if (!db.isOpen()) {
db.open();
}
} catch (NotesException e) {
// TODO Auto-generated catch block
db = null;
s = null;
return false;
}
return true;
}
public Database getDB() {
return this.db;
}
public void closeDB() {
db = null;
s = null;
}
public static void main(String[] args) {
String ip = "172.16.9.2";
String port = "63148";
String user = "lianlian";
String pass = "lianlian7";
String nsf = "mail/lianlian.nsf";
DominoTarget target = new DominoTarget(ip, port, user, pass, nsf);
if (target.openDB()) {
Database db = target.getDB();
try {
System.out.println(db.getCreated());
} catch (NotesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
target.closeDB();
}
}