if (context.isStandalone()) { // test mode
// Get the configuration
String logStashConfig = null;
SourcePipelinePojo logstashElement = null;
for (SourcePipelinePojo pxPipe: source.getProcessingPipeline()) { /// (must be non null if here)
if (null != pxPipe.logstash) {
logStashConfig = pxPipe.logstash.config;
logstashElement = pxPipe;
}
break;
}
if ((null == logStashConfig) || logStashConfig.isEmpty()) {
context.getHarvestStatus().update(source,new Date(),HarvestEnum.error, "Logstash internal logic error, no configuration", true, false);
return;
}
// Admin check (passed down)
boolean isAdmin = AuthUtils.isAdmin(source.getOwnerId());
// Perform the request
ObjectId requestId = new ObjectId();
BasicDBObject logQ = new BasicDBObject("_id", requestId);
boolean removeJobWhenDone = true;
try {
// (See records.service for the programmatic definition of this message)
logstashElement.logstash.config = logStashConfig;
BasicDBObject logStashDbo = (BasicDBObject) logstashElement.toDb();
logStashDbo.put("_id", requestId);
logStashDbo.put("maxDocs", context.getStandaloneMaxDocs());
logStashDbo.put("sourceKey", source.getKey());
logStashDbo.put("isAdmin", isAdmin);