int batchHint) throws RepositoryException, PushException, FeedException {
DctmTraversalManager dctmTM = (DctmTraversalManager) queryTraversalManager;
dctmTM.setBatchHint(batchHint);
System.out.println(batchHint);
DocumentList documentList = dctmTM.startTraversal();
// int nb = resultSet.size();
// System.out.println("nb vaut " + nb);
// The real connector manager will not always start from the beginning.
// It will start from the beginning if it receives an explicit admin
// command to do so, or if it thinks that it has never run this
// connector
// before. It decides whether it has run a connector before by storing
// every checkpoint it receives from
// the connector. If it can find no stored checkpoint, it assumes that
// it has never run this connector before and starts from the beginning,
// as here.
if (documentList == null) {
// in this test program, we will stop in this situation. The real
// connector manager might wait for a while, then try again
return;
}
DocPusher push = null;
try {
push = new DocPusher(new GsaFeedConnection(null, "gogol", 19900, -1),
"dctm", new FileSizeLimitInfo(), new DocumentFilterChain());
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int counter = 0;
while (true) {
counter = 0;
Document pm = null;
while ((pm = documentList.nextDocument()) != null) {
System.out.println("pm change");
counter++;
if (counter == batchHint) {
System.out.println("counter == batchhint !!!!");
// this test program only takes batchHint results from each
// resultSet. The real connector manager may take fewer -
// for example, if it receives a shutdown request
break;
}
int k = pm.getPropertyNames().size();
System.out.println("counter " + counter + ", num properties " + k);
System.out.println(pm.findProperty(
SpiConstants.PROPNAME_DISPLAYURL).nextValue());
push.take(pm);
}
String checkpoint = "";
if (counter != 0) {
System.out.println("appel checkpoint");
checkpoint = documentList.checkpoint();
System.out.println("appel checkpoint " + checkpoint);
}
dctmTM.resumeTraversal(checkpoint);
}
}