ScanResponseType scanResponse = new ScanResponseType();
String version=request.getVersion();
if(version!=null && !version.equals("1.1"))
return diagnostic(SRWDiagnostic.UnsupportedVersion, version, scanResponse);
CQLTermNode root = null;
int max = maxTerms, pos = position;
long startTime = System.currentTimeMillis();
PositiveInteger pi = request.getMaximumTerms();
if(pi!=null) {
max=pi.intValue();
pos=max/2+1;
}
NonNegativeInteger nni = request.getResponsePosition();
if(nni!=null)
pos=nni.intValue();
String scanTerm = request.getScanClause();
try{
if (scanTerm!=null)
log.info("scanTerm:\n" + Utilities.byteArrayToString(scanTerm.getBytes("UTF-8")));
} catch (Exception e){}
log.info("maxTerms="+max+", position="+pos);
try {
root = Utilities.getFirstTerm(parser.parse(scanTerm));
} catch (CQLParseException e) {
log.error(e);
return diagnostic(SRWDiagnostic.QuerySyntaxError, e.getMessage(),
scanResponse);
} catch (IOException e) {
log.error(e);
return diagnostic(SRWDiagnostic.QuerySyntaxError, e.getMessage(),
scanResponse);
}
if (root.getTerm().length()==0)
// The method getQualifier() was replaced by getIndex() in version
// 1.0 of the parser. This code ensures that either one works.
//root = new CQLTermNode(root.getQualifier(), root.getRelation(), "$");
root = new CQLTermNode(SRWSoapBindingImpl.getQualifier(root), root.getRelation(), "$");
String resultSetID = root.getResultSetName();
if (resultSetID!=null) { // you can't scan on resultSetId!
return diagnostic(SRWDiagnostic.UnsupportedIndex,
"cql.resultSetId", scanResponse);
}
TermsType terms = new TermsType();