Package com.google.enterprise.connector.spi

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

Boundary cases are important for {@link #checkpoint()}: The typical pattern for consuming an object that implements this interface is as follows (disregarding exception handling):
 DocumentList docList = ... Document doc; while (doc = docList.nextDocument()) { handleDoc(doc); if (whatever reason) break; } String check = doclist.checkpoint(); 
Note: because of the restriction that the next call to {@link #nextDocument()} invalidates the previous Document, and thereare similar restrictions in the {@link Document} interface, it is possibleto provide a single stateful object that implements {@link DocumentList}, {@link Document} and {@link Property}, by returning {@code this}(or {@code null}) to all calls to {@link #nextDocument()} and{@link Document#findProperty(String)}. However, if preferred, the implementor may also use separate objects for each of those interfaces. @since 1.0

    assertEquals(ImmutableSet.of(),
        getPrincipalsNames(doc, SpiConstants.PROPNAME_ACLGROUPS));
  }

  public void testAcl_noAclEntries() throws RepositoryException, SQLException {
    DocumentList list = getObjectUnderTest(27, 0, 1002);
    Document doc = list.nextDocument();

    assertNotNull(doc);
    assertEquals(ImmutableSet.of(),
        getPrincipalsNames(doc, SpiConstants.PROPNAME_ACLUSERS));
    assertEquals(ImmutableSet.of(),
View Full Code Here


  }

  public void testAcl_emptyUserName() throws RepositoryException, SQLException {
    insertDTreeAcl(28, 1666, Client.PERM_SEECONTENTS);

    DocumentList list = getObjectUnderTest(28, 0, 1001);
    Document doc = list.nextDocument();

    assertNotNull(doc);
    assertEquals(ImmutableSet.of(),
        getPrincipalsNames(doc, SpiConstants.PROPNAME_ACLUSERS));
    assertEquals(ImmutableSet.of(),
View Full Code Here

  }

  public void testStartTraversal() {
    System.out.println("Testing startTraversal()...");
    try {
      final DocumentList docList = this.travMan.startTraversal();
      assertNotNull(docList);
      System.out.println("[ startTraversal() ] Test Passed.");
    } catch (final RepositoryException re) {
      System.out.println(re);
      System.out.println("[ startTraversal() ] Test Failed.");
View Full Code Here

  }

  public void testResumeTraversal() {
    System.out.println("Testing resumeTraversal()...");
    try {
      final DocumentList docList = this.travMan.resumeTraversal("SharePoint");
      assertNotNull(docList);
      System.out.println("[ resumeTraversal() ] Test Passed.");
    } catch (final RepositoryException re) {
      System.out.println(re);
      System.out.println("[ resumeTraversal() ] Test Failed.");
View Full Code Here

 
  public void testBatchTimeoutandCheckpoint() throws RepositoryException {
    SharepointTraversalManager manager = this.travMan;
    sharepointClientContext.setSocialOption(
        SharepointConnector.SocialOption.NO);
    DocumentList initial = manager.startTraversal();
    List<SPDocument> pass1 = ((SPDocumentList) initial).getDocuments();
    String checkpoint1 = initial.checkpoint();
    assertEquals(SPConstants.CHECKPOINT_VALUE, checkpoint1);
    DocumentList incremental = manager.resumeTraversal(checkpoint1);
    List<SPDocument> pass2 = ((SPDocumentList) incremental).getDocuments();
    assertEquals(pass1.size(), pass2.size());   
  }
View Full Code Here

    TraversalManager mgr = sess.getTraversalManager();
    mgr.setBatchHint(3000);

    String checkpoint = "2007-02-16 14:39:09,31257";

    DocumentList rs = mgr.resumeTraversal(checkpoint);
    processResultSet(rs);
  }
View Full Code Here

   *          Not really used by the SharePoint connector
   */
  public DocumentList resumeTraversal(final String checkpoint)
      throws RepositoryException {
    LOGGER.info("resumeTraversal, checkpoint received: " + checkpoint);
    DocumentList rsSocial = null;
    boolean docCheckpoint = true; // is this a user profile checkpoint or a doc checkpoint
    if (sharepointClientContext.getSocialOption() != SocialOption.NO) {
      if (checkpoint.startsWith(SharepointSocialUserProfileDocumentList.CHECKPOINT_PREFIX)) {
        rsSocial = doUserprofileCrawl(checkpoint);
        docCheckpoint = false;
View Full Code Here

    }
    LOGGER.info("BatchHint Set to [ " + hintNew + " ] ");
  }

  private DocumentList doUserprofileCrawl(String checkPoint) {
    DocumentList rsSocial;
    if (socialTraversal != null) {
      try {
        if ((checkPoint == null) || (checkPoint.equals(""))) {
          rsSocial = this.socialTraversal.startTraversal();
        } else {
View Full Code Here

   *
   * @see com.google.enterprise.connector.spi.TraversalManager #startTraversal()
   */
  public DocumentList startTraversal() throws RepositoryException {
    LOGGER.info("startTraversal()");
    DocumentList rsSocial = null;
    if (sharepointClientContext.getSocialOption() != SocialOption.NO) {
      rsSocial = doUserprofileCrawl("");
    }
    if (sharepointClientContext.getSocialOption() == SocialOption.ONLY)
      return rsSocial;
View Full Code Here

  @Test
  public void testResumeTraversal() throws RepositoryException {
    TraversalManager trav = session.getTraversalManager();
    trav.setBatchHint(500);
    DocumentList docList = trav.startTraversal();
    assertNotNull(docList);
    docList = trav.resumeTraversal("");
    assertNotNull(docList);
  }
View Full Code Here

TOP

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

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.