本文整理汇总了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.");
}
}
示例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.");
}
}
示例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");
}
示例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());
}
示例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;
}
示例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
}
示例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);
}
}
示例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);
}
}
示例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");
}
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}