Package com.google.enterprise.connector.notes.client

Examples of com.google.enterprise.connector.notes.client.NotesView


    LOGGER.entering(CLASS_NAME, METHOD);

    boolean isReset = false;
    NotesSession nSession = null;
    NotesDatabase dbConfig = null;
    NotesView vwConfig = null;
    NotesDocument docConfig = null;
    NotesDateTime dtTarget = null;
    try {
      nSession = connectorSession.createNotesSession();
      dbConfig = nSession.getDatabase(
              connectorSession.getServer(), connectorSession.getDatabase());
      if (!dbConfig.isOpen()) {
        throw new RepositoryException(
            "GSA Configuration database is not opened");
      }
      dtTarget = nSession.createDateTime("1/1/1970");
      dtTarget.setAnyTime();
      vwConfig = dbConfig.getView(NCCONST.VIEWSYSTEMSETUP);
      docConfig = vwConfig.getFirstDocument();
      if (docConfig == null) {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "System configuration document not found.");
        return false;
      }
View Full Code Here


  private void setLastCacheUpdate() {
    final String METHOD = "setLastCacheUpdate";
    LOGGER.entering(CLASS_NAME, METHOD);

    NotesDateTime now = null;
    NotesView systemView = null;
    NotesDocument systemDoc = null;
    try {
      now = notesSession.createDateTime("1/1/1900");
      now.setNow();
      systemView = connectorDatabase.getView(NCCONST.VIEWSYSTEMSETUP);
      systemDoc = systemView.getFirstDocument();
      if (systemDoc == null) {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "System configuration document not found.");
        return;
      }
View Full Code Here

    boolean needToUpdate = true;

    NotesDateTime lastCacheUpdate = null;
    NotesDateTime now = null;
    NotesView systemView = null;
    NotesDocument systemDoc = null;
    Vector<?> vecLastCacheUpdate = null;
    try {
      lastCacheUpdate = notesSession.createDateTime("1/1/2010");
      now = notesSession.createDateTime("1/1/1900");
      now.setNow();

      systemView = connectorDatabase.getView(NCCONST.VIEWSYSTEMSETUP);
      systemDoc = systemView.getFirstDocument();
      if (systemDoc == null) {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "System configuration document not found.");
        return false;
      }
View Full Code Here

    try {
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "Loading configuration from system setup document.");

      NotesView vw = db.getView(NCCONST.VIEWSYSTEMSETUP);
      NotesDocument systemDoc = vw.getFirstDocument();
      if (null == systemDoc) {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "System configuration document not found.");
        return false;
      }

      // "." means no file extension.  Replace with an empty string if it exists.
      ExcludedExtns = (Vector<String>)
          systemDoc.getItemValue(NCCONST.SITM_EXCLUDEDEXTENSIONS);
      for (int i = 0; i < ExcludedExtns.size(); i++ ) {
        LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
            "The following file extensions will be excluded " +
            ExcludedExtns.elementAt(i).toString());
        if (ExcludedExtns.elementAt(i).equals(".")) {
          ExcludedExtns.set(i, "");
        }
      }

      MaxFileSize = 1024 * 1024 *
          systemDoc.getItemValueInteger(NCCONST.SITM_MAXFILESIZE);
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "Maximum attachment size is " + MaxFileSize);

      // If 0, use the default value
      if (0 == MaxFileSize)
        MaxFileSize = 1024 * 1024 * NCCONST.DEFAULT_MAX_FILE_LIMIT;

      // Get the spool directory for processing attachments
      SpoolDir = systemDoc.getItemValueString(NCCONST.SITM_SPOOLDIR);
      if ((null == SpoolDir) || (0 == SpoolDir.length())) {
        SpoolDir = String.format("%s/%s",
            ns.getEnvironmentString(NCCONST.INIDIRECTORY, true),
            NCCONST.DEFAULT_ATTACHMENT_DIR);;
      }
      java.io.File sdir = new java.io.File(SpoolDir);

      // Make the directory and make sure we can write to it
      sdir.mkdirs();
      if (!sdir.isDirectory() || !sdir.canWrite()) {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "Can't write to spool directory " + SpoolDir);
        return false;
      }
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "Attachment spool directory is set to " + SpoolDir);

      // Threshhold for polling
      maxCrawlQDepth = systemDoc.getItemValueInteger(
          NCCONST.SITM_MAXCRAWLQDEPTH);
      if (maxCrawlQDepth < 1)  {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "Invalid setting for maxCrawlQDepth: " + maxCrawlQDepth);
        return false;
      }
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "maxCrawlQDepth is " + maxCrawlQDepth);

      // Time between user/group cache updates
      cacheUpdateInterval = systemDoc.getItemValueInteger(
          NCCONST.SITM_CACHEUPDATEINTERVAL);
      if (cacheUpdateInterval < 1)  {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "Invalid setting for cache update interval: "
            + cacheUpdateInterval);
        return false;
      }
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "cacheUpdateInterval is " + cacheUpdateInterval);

      // Get the directory and see if we can open it
      directory = systemDoc.getItemValueString(
          NCCONST.SITM_DIRECTORY);
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "Path to Domino directory: " + directory);

      NotesDatabase dirDb = ns.getDatabase(this.getServer(), directory);
      dirDb.recycle();

      userNameFormula = systemDoc.getItemValueString(
          NCCONST.SITM_USERNAMEFORMULA);
      if (0 == userNameFormula.length()) {
        LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
            "User Name formula is empty - using default");
        userNameFormula = NCCONST.DEFAULT_USERNAMEFORMULA;
      }
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
            "User Name formula: " + userNameFormula);

      String usernameTypeConfig = systemDoc.getItemValueString(
          NCCONST.SITM_USERNAMETYPE);
      if (usernameTypeConfig != null && usernameTypeConfig.length() > 0) {
        usernameType = NotesUsernameType.findUsernameType(
            usernameTypeConfig.toUpperCase());
      }
      LOGGER.log(Level.CONFIG, "Notes username type: " + usernameType.name());

      userSelectionFormula = systemDoc.getItemValueString(
          NCCONST.SITM_USERSELECTIONFORMULA);
      if (0 == userSelectionFormula.length()) {
        LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
            "User Selection formula is empty - using default");
        userSelectionFormula = NCCONST.DEFAULT_USERSELECTIONFORMULA;
      }
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "User Selection formula: " + userSelectionFormula);

      gsaGroupPrefix =
          systemDoc.getItemValueString(NCCONST.SITM_GSAGROUPPREFIX);
      if (null != gsaGroupPrefix) {
        gsaGroupPrefix = gsaGroupPrefix.trim();
      }
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "Group prefix: " + gsaGroupPrefix);

      // Number of docs to check when deleting
      deletionBatchSize = systemDoc.getItemValueInteger(
          NCCONST.SITM_DELETIONBATCHSIZE);
      if (deletionBatchSize < 1)  {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "Invalid setting for deletionBatchSize: " + deletionBatchSize);
        return false;
      }
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "deletionBatchSize is " + deletionBatchSize);

      // Number of crawler threads to spawn
      numCrawlerThreads = systemDoc.getItemValueInteger(
          NCCONST.SITM_NUMCRAWLERTHREADS);
      if ((numCrawlerThreads < 0) || (numCrawlerThreads > 5)) {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "Invalid setting for numCrawlerThreads: " + numCrawlerThreads);
        return false;
      }
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
          "numCrawlerThreads is " + numCrawlerThreads);

      // Load server regions
      LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD, "Loading server domains.");
      NotesView serversView = db.getView(NCCONST.VIEWSERVERS);
      serversView.refresh();
      NotesViewNavigator svn = serversView.createViewNav();
      NotesViewEntry sve = svn.getFirst();
      while (null != sve) {
        Vector<?> columnVals = sve.getColumnValues();
        String domain = columnVals.elementAt(2).toString().toLowerCase();
        if (!Strings.isNullOrEmpty(domain)) {
          if (!domain.trim().startsWith(".")) {
            domain = "." + domain.trim();
          }
        }

        // This is a problem with the Notes Java API. When the
        // server field for a given region has 1 element we get a
        // String in the server column of the ViewEntry. When
        // the server field has more than 1 element we get one
        // ViewEntry for each server value, but the value
        // returned in the getColumnValues Vector is a Vector
        // with one element.
        String server;
        Object serverObject = columnVals.elementAt(0);
        if (serverObject instanceof String) {
          server = ((String) serverObject).toLowerCase();
        } else if (serverObject instanceof Vector) {
          Vector serverVector = (Vector) serverObject;
          if (serverVector.size() == 0) {
            LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD, "Empty server value");
            continue;
          }
          server = ((String) serverVector.elementAt(0)).toLowerCase();
        } else {
            LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
                "Unknown server value " + serverObject);
            continue;
        }
        LOGGER.logp(Level.CONFIG, CLASS_NAME, METHOD,
            "Server {0} is in domain {1}", new Object[] { server, domain });
        serverDomainMap.put(server, domain);
        NotesViewEntry tmpsve = svn.getNext();
        sve.recycle();
        sve = tmpsve;
      }
      svn.recycle();
      serversView.recycle();
      if (0 == serverDomainMap.size()) {
        LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
            "No regions have been configured for this connector.");
        return false;
      }
View Full Code Here

      LOGGER.logp(Level.INFO, CLASS_NAME, METHOD, "Checking for deletions ");
      ns = ncs.createNotesSession();
      CheckTime = ns.createDateTime("1/1/1900");
      CheckTime.setNow();
      cdb = ns.getDatabase(ncs.getServer(), ncs.getDatabase());
      NotesView DatabaseView = cdb.getView(NCCONST.VIEWDATABASES);
      DatabaseView.refresh();
      LOGGER.logp(Level.FINE, CLASS_NAME, METHOD,
          "MaintenanceThread: Entries in database view: " +
          DatabaseView.getEntryCount());
     
      if (Strings.isNullOrEmpty(startdocid)) {
        indexedDocuments = ncs.getNotesDocumentManager()
            .getIndexedDocuments(null, null, batchsize);
        LOGGER.logp(Level.FINE, CLASS_NAME, METHOD,
View Full Code Here

        return;
      }
      TemplateDoc.recycle();
      TemplateDoc = null;
    }
    NotesView vw = cdb.getView(NCCONST.VIEWTEMPLATES);
    TemplateDoc = vw.getDocumentByKey(TemplateName, true);
    vw.recycle();
    if (null != TemplateDoc) {
      LOGGER.logp(Level.FINEST, CLASS_NAME, METHOD,
          "Loaded template: " +
          TemplateDoc.getItemValueString(NCCONST.TITM_TEMPLATENAME));
    }
View Full Code Here

          user.getNotesName() + " user is authenticated");

      // Find the user in Notes.
      NotesSession notesSession = connectorSession.createNotesSession();
      NotesDatabase notesDirectory = null;
      NotesView notesUsersView = null;
      NotesDocument notesUserDoc = null;
      boolean hasValidPassword = false;
      try {
        notesDirectory = notesSession.getDatabase(
            connectorSession.getServer(), connectorSession.getDirectory());
        notesUsersView = notesDirectory.getView(NCCONST.DIRVIEW_USERS);
        notesUserDoc =
            notesUsersView.getDocumentByKey(user.getNotesName(), true);
        if (notesUserDoc == null) {
          LOGGER.logp(Level.FINE, CLASS_NAME, METHOD,
              "Username not found in Notes directory");
          return new AuthenticationResponse(false, null);
        }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.notes.client.NotesView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.