Search in sources :

Example 11 with DbDirectory

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");
            }
        }
    }
}
Also used : DbDirectory(org.openntf.domino.DbDirectory) Database(org.openntf.domino.Database) View(org.openntf.domino.View) Session(org.openntf.domino.Session)

Example 12 with DbDirectory

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();
}
Also used : DbDirectory(org.openntf.domino.DbDirectory) AboutDocument(org.openntf.domino.design.AboutDocument) Database(org.openntf.domino.Database)

Example 13 with DbDirectory

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);
    }
}
Also used : DbDirectory(org.openntf.domino.DbDirectory) Database(org.openntf.domino.Database)

Example 14 with DbDirectory

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);
}
Also used : DbDirectory(org.openntf.domino.DbDirectory) Database(org.openntf.domino.Database)

Example 15 with DbDirectory

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);
}
Also used : DbDirectory(org.openntf.domino.DbDirectory) Database(org.openntf.domino.Database)

Aggregations

DbDirectory (org.openntf.domino.DbDirectory)19 Database (org.openntf.domino.Database)17 Session (org.openntf.domino.Session)11 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Future (java.util.concurrent.Future)1 Test (org.junit.Test)1 ACL (org.openntf.domino.ACL)1 Document (org.openntf.domino.Document)1 View (org.openntf.domino.View)1 IndexDatabase (org.openntf.domino.big.IndexDatabase)1 AboutDocument (org.openntf.domino.design.AboutDocument)1 OpenNTFNotesException (org.openntf.domino.exceptions.OpenNTFNotesException)1 UserAccessException (org.openntf.domino.exceptions.UserAccessException)1 ScheduleData (org.openntf.domino.xots.ScheduleData)1