Search in sources :

Example 1 with ScheduleData

use of org.openntf.domino.xots.ScheduleData in project org.openntf.domino by OpenNTF.

the class XotsNsfScanner method scan.

/**
 * Scans all databases on the specified server
 */
public List<ScheduleData> scan() {
    // Returns a XotsSessionType.NATIVE
    Session session = Factory.getSession(SessionType.CURRENT);
    DbDirectory dir = session.getDbDirectory(getServerName());
    dir.setDirectoryType(DbDirectory.Type.DATABASE);
    List<Future<List<ScheduleData>>> futures = new ArrayList<Future<List<ScheduleData>>>();
    for (Database db : dir) {
        try {
            Future<List<ScheduleData>> future = scanDatabase(db);
            if (future != null) {
                futures.add(future);
            }
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
    List<ScheduleData> ret = new ArrayList<ScheduleData>();
    for (Future<List<ScheduleData>> future : futures) {
        try {
            ret.addAll(future.get());
        } catch (Exception e) {
        // exceptions should already been logged
        }
    }
    setChanged();
    notifyObservers(null);
    return ret;
}
Also used : DbDirectory(org.openntf.domino.DbDirectory) ScheduleData(org.openntf.domino.xots.ScheduleData) ArrayList(java.util.ArrayList) Database(org.openntf.domino.Database) Future(java.util.concurrent.Future) ArrayList(java.util.ArrayList) List(java.util.List) UserAccessException(org.openntf.domino.exceptions.UserAccessException) FileNotFoundException(java.io.FileNotFoundException) Session(org.openntf.domino.Session)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Future (java.util.concurrent.Future)1 Database (org.openntf.domino.Database)1 DbDirectory (org.openntf.domino.DbDirectory)1 Session (org.openntf.domino.Session)1 UserAccessException (org.openntf.domino.exceptions.UserAccessException)1 ScheduleData (org.openntf.domino.xots.ScheduleData)1