providerUri);
_epService = EPServiceProviderManager.getProvider(providerUri,
_configuration);
}
_log.debug("Adding statements to Esper service");
final EPAdministrator epAdmin = _epService.getEPAdministrator();
// Add all statements to the Esper engine.
// Note that subscribers are added only for those statements that
// declare an output sink.
for (StatementBean epStatement : _esperStatements) {
_log.info("Compiling statement {}", epStatement);
_log.debug("Compiling Esper statement {}",
epStatement.getEsperStatement());
// Create a template for the statement in the current Esper engine.
final EPStatementObjectModel stmtModel = epAdmin
.compileEPL(epStatement.getEsperStatement());
// Create the actual statement in the current Esper engine from the
// statement model.
final String stmtName = epStatement.getName();
final EPStatement stmt = (stmtName == null ? epAdmin
.create(stmtModel) : epAdmin.create(stmtModel, stmtName));
// If an output sink was defined, then we add a subscriber.
if (epStatement.getOutput() != null) {
final String[] sinkNamesList = epStatement.getOutput();
final List<Sink> sinksList = new ArrayList<Sink>();
for (String sinkName : sinkNamesList) {
final Sink sink = _sinksMap.get(sinkName);
if (sink == null) {
_log.warn(
"Statement {} declares the sink {} "
+ "but the corresponding Esper processor does not.",
epStatement, sinkName);
} else {
sinksList.add(sink);
}
}
final String[] propertyNames = stmt.getEventType()
.getPropertyNames();
final EsperStatementSubscriber subscriber = new EsperStatementSubscriber(
sinksList, propertyNames);
_log.info("Adding subscriber {} to statement {}",
sinkNamesList, epStatement);
stmt.setSubscriber(subscriber);
}
}
_log.debug("Finished adding statements to Esper service");
_log.debug("Mapping event types to timestamp properties, if any");
for (EventType eventType : epAdmin.getConfiguration().getEventTypes()) {
final String startTimestampProperty = eventType
.getStartTimestampPropertyName();
final String endTimestampProperty = eventType
.getEndTimestampPropertyName();
final String timestampProperty = endTimestampProperty == null ? startTimestampProperty