Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.RepositoryDocumentException


      if (aclProperties.isPushAcls()) {
        LOGGER.finest("pushAcls flag is true so adding ACL to the document");
        try {
          addAclProperties(file);
        } catch (IOException ioe) {
          throw new RepositoryDocumentException("Failed to read ACL for "
              + file.getPath(), ioe);
        }
      }
      if (!properties.containsKey(SpiConstants.PROPNAME_ISPUBLIC)) {
        LOGGER.finest("Public flag is false so setting PROPNAME_ISPUBLIC "
View Full Code Here


            new SmbFileDelegate(path + "/", credentials.getNtlmAuthorization());
      }
      return delegate;
    } catch (SmbException e) {
      staticDetectGeneralErrors(e, path);
      throw new RepositoryDocumentException(e);
    } catch (MalformedURLException e) {
      throw new IncorrectURLException("Malformed SMB path: " + path, e);
    }
  }
View Full Code Here

      long lastModified =
          Math.max(delegate.lastModified(), delegate.createTime());
      return (lastModified > 0L) ? (lastModified >= time) : true;
    } catch (IOException e) {
      detectServerDown(e);
      throw new RepositoryDocumentException(
          "Failed to get last modified time for " + getPath(), e);
    }
  }
View Full Code Here

  boolean isTraversable() throws RepositoryDocumentException {
    try {
      int type = delegate.getType();
      return type == SmbFile.TYPE_SHARE || type == SmbFile.TYPE_FILESYSTEM;
    } catch (SmbException e) {
      throw new RepositoryDocumentException(e);
    }
  }
View Full Code Here

                 + " - too large", docid);
          }
          return null;
        }
      } catch (IOException e) {
        throw new RepositoryDocumentException("Failed to open file: " + docid,
                                              e);
      }
    } else {
      LOGGER.log(Level.FINER, "Returning no content for file {0}"
          + " - not a regular file", docid);
View Full Code Here

      long lastModified =
          Math.max(WindowsFileTimeUtil.getLastModifiedTime(path),
                   WindowsFileTimeUtil.getCreateTime(path));
      return (lastModified > 0L) ? (lastModified >= time) : true;
    } catch (IOException e) {
      throw new RepositoryDocumentException(
          "Failed to get last modified time for " + getPath(), e);
    }
  }
View Full Code Here

    try {
      feedType = DocUtils.getFeedType(document);
    } catch (RuntimeException e) {
      LOGGER.log(Level.WARNING,
          "Rethrowing RuntimeException as RepositoryDocumentException", e);
      throw new RepositoryDocumentException(e);
    }

    // All feeds in a feed file must be of the same type.
    // If the feed would change type, send the feed off to the GSA
    // and start a new one.
    // TODO: Fix this check to allow ACLs in any type feed.
    if (xmlFeed != null && !feedType.isCompatible(xmlFeed.getFeedType())) {
      if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine("A new feedType, " + feedType + ", requires a new feed for "
            + connectorName + ". Closing feed and sending to GSA.");
      }
      submitFeed();
    }

    if (xmlFeed == null) {
      if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine("Creating new " + feedType + " feed for " + connectorName);
      }
      try {
        startNewFeed(feedType);
      } catch (OutOfMemoryError me) {
        throw new PushException("Unable to allocate feed buffer.  Try reducing"
            + " the maxFeedSize setting, reducing the number of connector"
            + " intances, or adjusting the JVM heap size parameters.", me);
      }
    }

    boolean isThrowing = false;
    int resetPoint = xmlFeed.size();
    int resetCount = xmlFeed.getRecordCount();
    try {
      if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.log(Level.FINER, "DOCUMENT: Adding document with docid={0} and "
            + "searchurl={1} from connector {2} to feed.", new Object[] {
            DocUtils.getOptionalString(document, SpiConstants.PROPNAME_DOCID),
            DocUtils.getOptionalString(document,
              SpiConstants.PROPNAME_SEARCHURL),
            connectorName});
      }

      // Add this document to the feed.
      xmlFeed.addRecord(document);

      // If the feed is full, send it off to the GSA.
      if (xmlFeed.isFull() || lowMemory()) {
        if (LOGGER.isLoggable(Level.FINE)) {
          LOGGER.fine("Feed for " + connectorName + " has grown to "
              + xmlFeed.size() + " bytes. Closing feed and sending to GSA.");
        }
        submitFeed();
        return getPusherStatus();
      }

      // Indicate that this Pusher may accept more documents.
      return PusherStatus.OK;

    } catch (OutOfMemoryError me) {
      resetFeed(resetPoint, resetCount);
      throw new PushException("Out of memory building feed, retrying.", me);
    } catch (RuntimeException e) {
      resetFeed(resetPoint, resetCount);
      LOGGER.log(Level.WARNING,
          "Rethrowing RuntimeException as RepositoryDocumentException", e);
      throw new RepositoryDocumentException(e);
    } catch (RepositoryDocumentException rde) {
      // Skipping this document, remove it from the feed.
      resetFeed(resetPoint, resetCount);
      throw rde;
    } catch (IOException ioe) {
      LOGGER.log(Level.SEVERE, "IOException while reading: skipping", ioe);
      resetFeed(resetPoint, resetCount);
      Throwable t = ioe.getCause();
      isThrowing = true;
      if (t != null && (t instanceof RepositoryException)) {
        throw (RepositoryException) t;
      } else {
        throw new RepositoryDocumentException("I/O error reading data", ioe);
      }
    }
  }
View Full Code Here

        expectedId++;
        pushCount++;
      } catch (RuntimeException re) {
        // Mimicking DocPusher's behavior for RuntimeExceptions.
        expectedId++;
        throw new RepositoryDocumentException(re);
      } catch (RepositoryDocumentException rde) {
        expectedId++;
        throw rde;
      } catch (Throwable t) {
        throw new PushException(t);
View Full Code Here

         Where.FIRST_DOCUMENT, 0);
  }

  public void testFirstDocumentRepositoryDocumentException() {
    checkExceptionHandling(
         new RepositoryDocumentException("FirstDocumentRepositoryDocumentException"),
         Where.FIRST_DOCUMENT, 1);
  }
View Full Code Here

         Where.NEXT_DOCUMENT, 0);
  }

  public void testNextDocumentRepositoryDocumentException() {
    checkExceptionHandling(
         new RepositoryDocumentException("NextDocumentRepositoryDocumentException"),
         Where.NEXT_DOCUMENT, 1);
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.RepositoryDocumentException

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.