当前位置: 首页>>代码示例>>Java>>正文


Java DocIdPusher类代码示例

本文整理汇总了Java中com.google.enterprise.adaptor.DocIdPusher的典型用法代码示例。如果您正苦于以下问题:Java DocIdPusher类的具体用法?Java DocIdPusher怎么用?Java DocIdPusher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DocIdPusher类属于com.google.enterprise.adaptor包,在下文中一共展示了DocIdPusher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDocIds

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
/** Crawls/pushes all groups from all AdServers. */

  @Override
  public void getDocIds(DocIdPusher pusher) throws InterruptedException,
      IOException {
    log.log(Level.FINER, "getDocIds invoked - waiting for lock.");
    mutex.lock();
    try {
      clearLastCompleteGroupCatalog();
      GroupCatalog cumulativeCatalog = makeFullCatalog();
      // all servers were able to successfully populate the catalog: do a push
      // TODO(myk): Rework the structure so that a member variable of
      // cumulativeCatalog isn't passed in as a parameter to its own method.
      cumulativeCatalog.resolveForeignSecurityPrincipals(
          cumulativeCatalog.entities);
      Map<GroupPrincipal, List<Principal>> groups =
          cumulativeCatalog.makeDefs(cumulativeCatalog.entities);
      pusher.pushGroupDefinitions(groups, EVERYTHING_CASE_INSENSITIVE, REPLACE,
          null, null);
      // no longer clear cumulativeCatalog.members as part of fix for b/18028678
      lastCompleteGroupCatalog = cumulativeCatalog;
    } finally {
      mutex.unlock();
      log.log(Level.FINE, "getDocIds ending - lock released.");
    }
  }
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:27,代码来源:AdAdaptor.java

示例2: getModifiedDocIds

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
/**
 * Attempts an incremental push of updated groups from all AdServers.
 * <p>
 * When a server cannot do an incremental push, it does a full crawl without
 * doing a push afterwards -- this sets up its state so that subsequent
 * incremental pushes can work.
 */
@Override
public void getModifiedDocIds(DocIdPusher pusher) throws InterruptedException,
    IOException {
  if (!mutex.tryLock()) {
    log.log(Level.FINE, "getModifiedDocIds could not acquire lock; "
        + "will retry later.");
    return;
  }
  try {
    log.log(Level.FINE, "getModifiedDocIds starting - acquired lock.");
    getModifiedDocIdsHelper(pusher);
  } finally {
    mutex.unlock();
    log.log(Level.FINE, "getModifiedDocIds ending - lock released.");
  }
}
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:24,代码来源:AdAdaptor.java

示例3: getDocIdsSiteCollectionOnly

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
private void getDocIdsSiteCollectionOnly(DocIdPusher pusher)
    throws InterruptedException,IOException {
  log.entering("SharePointAdaptor", "getDocIdsSiteCollectionOnly", pusher);
  SiteAdaptor scAdaptor = getSiteAdaptor(sharePointUrl.getSharePointUrl(), 
      sharePointUrl.getSharePointUrl());
  SiteDataClient scClient = scAdaptor.getSiteDataClient();
  Site site = scClient.getContentSite();
  String siteCollectionUrl = getCanonicalUrl(site.getMetadata().getURL());
  // Reset site collection URL instance to use correct URL.
  scAdaptor = getSiteAdaptor(siteCollectionUrl, siteCollectionUrl);
  DocId siteCollectionDocId = scAdaptor.encodeDocId(siteCollectionUrl);
  pusher.pushDocIds(Arrays.asList(siteCollectionDocId));
  Map<GroupPrincipal, Collection<Principal>> groupDefs 
      = new HashMap<GroupPrincipal, Collection<Principal>>();
  groupDefs.putAll(scAdaptor.computeMembersForGroups(site.getGroups()));
  String siteId = site.getMetadata().getID();
  sitePushGroupDefinitions(siteId, pusher, groupDefs);
  log.exiting("SharePointAdaptor", "getDocIdsSiteCollectionOnly");
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:20,代码来源:SharePointAdaptor.java

示例4: testOverflowToDocIdPusher

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
@Test
public void testOverflowToDocIdPusher() throws Exception {
  final String golden = "<!DOCTYPE html>\n"
      + "<html><head><title>s</title></head>"
      + "<body><h1><!--googleoff: index-->Site<!--googleon: index--> s</h1>"
      + "<p><!--googleoff: index-->Lists<!--googleon: index--></p>"
      + "<ul><li><a href=\"s/l\">My List</a></li></ul>"
      + "</body></html>";
  final List<DocIdPusher.Record> goldenRecords = Arrays.asList(
      new DocIdPusher.Record.Builder(new DocId("s/l")).build());
  RecordingDocIdPusher docIdPusher = new RecordingDocIdPusher();
  writer = new HtmlResponseWriter(baos, charset,
      context.getDocIdEncoder(), Locale.ENGLISH, 1, docIdPusher,
      executor);
  writer.start(new DocId("s"), ObjectType.SITE, null);
  writer.startSection(ObjectType.LIST);
  writer.addLink(new DocId("s/l"), "My List");
  writer.finish();
  assertEquals(golden, new String(baos.toByteArray(), charset));
  assertEquals(goldenRecords, docIdPusher.getRecords());
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:22,代码来源:HtmlResponseWriterTest.java

示例5: pushCollection

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
@Override
protected Checkpoint pushCollection(DocIdPusher pusher)
    throws InterruptedException {
  FeedType feedType;
  if ((queryBatchSize > 0) || caughtException || prevError) {
    feedType = FeedType.INCREMENTAL;
  } else {
    feedType = this.feedType;
  }

  Map<GroupPrincipal, Collection<Principal>> groupDefs = groups.build();
  pusher.pushGroupDefinitions(groupDefs,
      caseSensitivityType == CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
      feedType, null, null);
  // If we caught an exception, then the next push will also be incomplete,
  // else (modulo batching) we finished sending all the groups, and the
  // next push can be full again.
  prevError = caughtException;
  return groupsCheckpoint;
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:21,代码来源:DocumentumAdaptor.java

示例6: getModifiedDocIdsHelper

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
@VisibleForTesting
void getModifiedDocIdsHelper(DocIdPusher pusher) throws InterruptedException,
    IOException {
  if (lastCompleteGroupCatalog == null) {
    log.log(Level.FINE, "getModifiedDocIds doing a fetch with no push.");
    lastCompleteGroupCatalog = makeFullCatalog();
    return;
  }

  Set<AdEntity> allNewOrUpdatedEntities = new HashSet<AdEntity>();
  for (AdServer server : servers) {
    String previousServiceName = server.getDsServiceName();
    String previousInvocationId = server.getInvocationID();
    long previousHighestUSN = server.getHighestCommittedUSN();
    try {
      server.ensureConnectionIsCurrent();
      allNewOrUpdatedEntities.addAll(
          lastCompleteGroupCatalog.readUpdatesFrom(server,
              previousServiceName, previousInvocationId,
              previousHighestUSN));
    } catch (NamingException ne) {
      // invalidate the saved group catalog
      clearLastCompleteGroupCatalog();
      String host = server.getHostName();
      throw new IOException("could not get entities from " + host, ne);
    }
  }

  // all servers were able to successfully update the catalog: do a push
  lastCompleteGroupCatalog.resolveForeignSecurityPrincipals(
      allNewOrUpdatedEntities);
  Map<GroupPrincipal, List<Principal>> groups =
      lastCompleteGroupCatalog.makeDefs(allNewOrUpdatedEntities);
  pusher.pushGroupDefinitions(groups, EVERYTHING_CASE_INSENSITIVE,
      INCREMENTAL, null, null);
  // no longer clear cumulativeCatalog.members as part of fix for b/18028678
}
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:38,代码来源:AdAdaptor.java

示例7: pushGroupDefinitions

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
public static void pushGroupDefinitions(AdAdaptor adaptor,
    Map<String, String> configEntries, final DocIdPusher pusher,
    boolean fullPush, boolean init) throws Exception {
  if (init) {
    initializeAdaptorConfig(adaptor, configEntries);
  }
  if (fullPush) {
    adaptor.getDocIds(pusher);
  } else {
    adaptor.getModifiedDocIds(pusher);
  }
}
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:13,代码来源:AdAdaptorTest.java

示例8: getDocIds

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
/** Crawls/pushes ids of all people from all LDAP Servers. */
@Override
public void getDocIds(DocIdPusher pusher) throws InterruptedException,
    IOException {
  log.entering("LdapAdaptor", "getDocIds");
  String badHosts = ""; // built up as we run into errors
  NamingException lastException = null;
  for (int serverNumber = 0; serverNumber < servers.size(); serverNumber++) {
    LdapServer server = servers.get(serverNumber);
    try {
      server.ensureConnectionIsCurrent();
      Set<LdapPerson> entities = server.scanAll();
      ArrayList<DocId> docIds = new ArrayList<DocId>();
      log.fine("received " + entities.size() + " entities from server");
      for (LdapPerson person : entities) {
        docIds.add(makeDocId(serverNumber, person.getDn()));
      }
      log.fine("About to push " + docIds.size() + " docIds for host "
          + server.getHostName() + "");
      pusher.pushDocIds(docIds);
      log.finer("Done with push of " + docIds.size() + " docIds for host "
          + server.getHostName() + "");
    } catch (NamingException ne) {
      String host = server.getHostName();
      badHosts += "," + host;
      lastException = ne;
      log.log(Level.WARNING, "Could not get entitites from " + host + "", ne);
      continue; // just log for now; throw exception at very end.
    }
  }
  log.exiting("LdapAdaptor", "getDocIds", (lastException != null));
  if (lastException != null) {
    throw new IOException("Could not get entities from the following "
        + "server(s): " + badHosts.substring(1) + "", lastException);
  }
}
 
开发者ID:googlegsa,项目名称:ldap,代码行数:37,代码来源:LdapAdaptor.java

示例9: pushGroupDefinitions

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
public static void pushGroupDefinitions(LdapAdaptor adaptor,
    Map<String, String> configEntries, final DocIdPusher pusher,
    boolean fullPush, boolean init) throws Exception {
  if (init) {
    initializeAdaptorConfig(adaptor, configEntries);
  }
  if (fullPush) {
    adaptor.getDocIds(pusher);
  } else {
    // adaptor.getModifiedDocIds(pusher);
    throw new IllegalArgumentException("Incremental Push not implemented");
  }
}
 
开发者ID:googlegsa,项目名称:ldap,代码行数:14,代码来源:LdapAdaptorTest.java

示例10: getDocIds

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
@Override
public void getDocIds(DocIdPusher pusher) throws InterruptedException,
    IOException {
  log.entering("SharePointAdaptor", "getDocIds", pusher);
  if (sharePointUrl.isSiteCollectionUrl()) {
    getDocIdsSiteCollectionOnly(pusher);
  } else {
    getDocIdsVirtualServer(pusher);
  } 
  log.exiting("SharePointAdaptor", "getDocIds");
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:12,代码来源:SharePointAdaptor.java

示例11: sitePushGroupDefinitions

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
private void sitePushGroupDefinitions(String siteId, DocIdPusher pusher,
    Map<GroupPrincipal, Collection<Principal>> groupDefs)
    throws InterruptedException {
  String sourceId = "SITEID-" + siteId.replaceAll("[{}]", "");
  pusher.pushGroupDefinitions(groupDefs, EVERYTHING_CASE_INSENSITIVE,
      REPLACE, sourceId, null);
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:8,代码来源:SharePointAdaptor.java

示例12: getModifiedDocIds

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
@Override
public void getModifiedDocIds(DocIdPusher pusher)
    throws InterruptedException {
  log.entering("SharePointAdaptor", "getModifiedDocIds", pusher);
  if (sharePointUrl.isSiteCollectionUrl()) {
    getModifiedDocIdsSiteCollection(pusher);
  } else {
    getModifiedDocIdsVirtualServer(pusher);
  }    
  log.exiting("SharePointAdaptor", "getModifiedDocIds", pusher);
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:12,代码来源:SharePointAdaptor.java

示例13: pushIncrementalUpdatesAndGroups

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
private void pushIncrementalUpdatesAndGroups(DocIdPusher pusher, 
  SiteAdaptor siteAdaptor, Set<DocId> docIds,
  Set<String> updatedSiteSecurity) throws InterruptedException {
  List<DocIdPusher.Record> records
      = new ArrayList<DocIdPusher.Record>(docIds.size());
  DocIdPusher.Record.Builder builder
      = new DocIdPusher.Record.Builder(new DocId("to-be-replaced-name"))
      .setCrawlImmediately(true);
  for (DocId docId : docIds) {
    records.add(builder.setDocId(docId).build());
  }
  pusher.pushRecords(records);
  if (updatedSiteSecurity.isEmpty()) {
    return;
  }
  for (String siteUrl : updatedSiteSecurity) {
    Site site;
    try {
      site = getSiteAdaptor(siteUrl, siteUrl).getSiteDataClient()
          .getContentSite();
    } catch (IOException ex) {
      log.log(Level.WARNING, "Failed to get local groups for site: "
          + siteUrl, ex);
      continue;
    }
    Map<GroupPrincipal, Collection<Principal>> groupDefs
        = siteAdaptor.computeMembersForGroups(site.getGroups());
    String siteId = site.getMetadata().getID();
    sitePushGroupDefinitions(siteId, pusher, groupDefs);
  }      
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:32,代码来源:SharePointAdaptor.java

示例14: HtmlResponseWriter

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
public HtmlResponseWriter(OutputStream os, Charset charset,
    DocIdEncoder docIdEncoder, Locale locale, long thresholdBytes,
    DocIdPusher pusher, Executor executor) {
  if (os == null) {
    throw new NullPointerException();
  }
  if (charset == null) {
    throw new NullPointerException();
  }
  if (docIdEncoder == null) {
    throw new NullPointerException();
  }
  if (locale == null) {
    throw new NullPointerException();
  }
  if (pusher == null) {
    throw new NullPointerException();
  }
  if (executor == null) {
    throw new NullPointerException();
  }
  countingOutputStream = new CountingOutputStream(os);
  this.writer = new OutputStreamWriter(countingOutputStream, charset);
  this.docIdEncoder = docIdEncoder;
  this.locale = locale;
  this.thresholdBytes = thresholdBytes;
  this.pusher = pusher;
  this.executor = executor;
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:30,代码来源:HtmlResponseWriter.java

示例15: getModifiedDocIds

import com.google.enterprise.adaptor.DocIdPusher; //导入依赖的package包/类
@Override
public void getModifiedDocIds(DocIdPusher pusher)
    throws InterruptedException, IOException {
  userProfileChangeToken = userProfileServiceClient.getModifiedDocIds(pusher,
      userProfileChangeToken);
  log.log(Level.FINE, "getModifiedDocIds returned change token: {0}",
      userProfileChangeToken);
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:9,代码来源:SharePointUserProfileAdaptor.java


注:本文中的com.google.enterprise.adaptor.DocIdPusher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。