use of org.openntf.domino.DbDirectory in project org.openntf.domino by OpenNTF.
the class TimeSensitive method run.
@Override
public void run() {
Session s = Factory.getSession(SessionType.NATIVE);
DbDirectory dir = s.getDbDirectory(s.getServerName());
for (Database db : dir) {
if (null == db) {
// System.out.println("Database " + db.getFilePath() + " is null");
} else {
try {
for (View vw : db.getViews()) {
if (vw.isTimeSensitive()) {
System.out.println("TIME SENSITIVE: View " + vw.getName() + " in db " + db.getFilePath());
}
}
} catch (Exception e) {
System.out.println("Database " + db.getFilePath() + " cannot be opened");
}
}
}
}
use of org.openntf.domino.DbDirectory in project org.openntf.domino by OpenNTF.
the class DesignClassTest method testCreation.
// @Test
public void testCreation() {
DbDirectory dbdir = Factory.getSession(SessionType.CURRENT).getDbDirectory("");
Database db = dbdir.createDatabase("D:/Daten/notesdaten_9/localdb/pw" + System.currentTimeMillis() + ".nsf", true);
AboutDocument abd = new org.openntf.domino.design.impl.AboutDocument(db);
abd.save();
}
use of org.openntf.domino.DbDirectory in project org.openntf.domino by OpenNTF.
the class KeyValueStore method initializeDatabases.
public void initializeDatabases() {
if (places_ > 0) {
for (int i = 0; i < pow(16, places_); i++) {
String hashChunk = Integer.toString(i, 16).toLowerCase();
while (hashChunk.length() < places_) hashChunk = "0" + hashChunk;
String server = serverStrategy_ == null ? server_ : serverStrategy_.getServerForHashChunk(hashChunk);
DbDirectory dbdir = getDbDirectoryForHashChunk(hashChunk);
String dbName = baseName_ + "-" + hashChunk + ".nsf";
Database database = session_.getDatabase(server, dbName, true);
if (!database.isOpen()) {
database = createDatabase(dbdir, dbName);
}
dbCache_.put(dbName, database);
}
} else {
Database database = session_.getDatabase(server_, baseName_ + ".nsf");
if (!database.isOpen()) {
database = createDatabase(getDbDirectoryForHashChunk(null), baseName_ + ".nsf");
}
dbCache_.put(baseName_ + ".nsf", database);
}
}
use of org.openntf.domino.DbDirectory in project org.openntf.domino by OpenNTF.
the class KeyValueStore method getDatabaseForKey.
private Database getDatabaseForKey(final String hashKey) {
String hashChunk = hashKey.substring(0, places_);
String dbName = baseName_ + "-" + hashChunk + ".nsf";
if (!dbCache_.containsKey(dbName)) {
String server = serverStrategy_ == null ? server_ : serverStrategy_.getServerForHashChunk(hashChunk);
Database database = session_.getDatabase(server, dbName, true);
if (!database.isOpen()) {
DbDirectory dbdir = getDbDirectoryForHashChunk(hashChunk);
database = createDatabase(dbdir, dbName);
}
dbCache_.put(dbName, database);
}
return dbCache_.get(dbName);
}
use of org.openntf.domino.DbDirectory in project org.openntf.domino by OpenNTF.
the class ShardingDatabase method getDatabaseForHash.
private Database getDatabaseForHash(final String hash) {
String hashChunk = hash.substring(0, places_);
String dbName = baseName_ + "-" + hashChunk + ".nsf";
if (!dbCache_.containsKey(dbName)) {
String server = serverStrategy_ == null ? server_ : serverStrategy_.getServerForHashChunk(hashChunk);
Database database = session_.getDatabase(server, dbName, true);
if (!database.isOpen()) {
DbDirectory dbdir = getDbDirectoryForHashChunk(hashChunk);
database = createDatabase(dbdir, dbName);
}
dbCache_.put(dbName, database);
}
return dbCache_.get(dbName);
}
Aggregations