use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.
the class SiddhiAppRuntime method debug.
public synchronized SiddhiDebugger debug() {
siddhiDebugger = new SiddhiDebugger(siddhiAppContext);
List<StreamRuntime> streamRuntime = new ArrayList<>();
List<OutputCallback> streamCallbacks = new ArrayList<>();
for (QueryRuntime queryRuntime : queryProcessorMap.values()) {
streamRuntime.add(queryRuntime.getStreamRuntime());
streamCallbacks.add(queryRuntime.getOutputCallback());
}
for (StreamRuntime streamRuntime1 : streamRuntime) {
for (SingleStreamRuntime singleStreamRuntime : streamRuntime1.getSingleStreamRuntimes()) {
singleStreamRuntime.getProcessStreamReceiver().setSiddhiDebugger(siddhiDebugger);
}
}
for (OutputCallback callback : streamCallbacks) {
callback.setSiddhiDebugger(siddhiDebugger);
}
start();
running = true;
return siddhiDebugger;
}
use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.
the class SiddhiAppRuntime method addCallback.
public void addCallback(String queryName, QueryCallback callback) {
callback.setContext(siddhiAppContext);
QueryRuntime queryRuntime = queryProcessorMap.get(queryName);
if (queryRuntime == null) {
throw new QueryNotExistException("No query found with name: " + queryName);
}
callback.setQuery(queryRuntime.getQuery());
queryRuntime.addCallback(callback);
}
use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.
the class CoalesceFunctionExecutor method init.
@Override
public void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, SiddhiAppContext siddhiAppContext) {
if (attributeExpressionExecutors.length == 0) {
throw new SiddhiAppValidationException("Coalesce must have at least one parameter");
}
Attribute.Type type = attributeExpressionExecutors[0].getReturnType();
for (ExpressionExecutor expressionExecutor : attributeExpressionExecutors) {
if (type != expressionExecutor.getReturnType()) {
throw new SiddhiAppValidationException("Coalesce cannot have parameters with different type");
}
}
returnType = type;
}
use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.
the class FunctionExecutor method cloneExecutor.
@Override
public ExpressionExecutor cloneExecutor(String key) {
try {
FunctionExecutor functionExecutor = this.getClass().newInstance();
ExpressionExecutor[] innerExpressionExecutors = new ExpressionExecutor[attributeSize];
for (int i = 0; i < attributeSize; i++) {
innerExpressionExecutors[i] = attributeExpressionExecutors[i].cloneExecutor(key);
}
functionExecutor.elementId = elementId + "-" + key;
functionExecutor.functionId = functionId;
functionExecutor.initExecutor(innerExpressionExecutors, siddhiAppContext, queryName, configReader);
return functionExecutor;
} catch (Exception e) {
throw new SiddhiAppRuntimeException("Exception in cloning " + this.getClass().getCanonicalName(), e);
}
}
use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.
the class AbstractStreamProcessor method cloneProcessor.
@Override
public Processor cloneProcessor(String key) {
try {
AbstractStreamProcessor abstractStreamProcessor = this.getClass().newInstance();
abstractStreamProcessor.inputDefinition = inputDefinition;
ExpressionExecutor[] innerExpressionExecutors = new ExpressionExecutor[attributeExpressionLength];
ExpressionExecutor[] attributeExpressionExecutors1 = this.attributeExpressionExecutors;
for (int i = 0; i < attributeExpressionLength; i++) {
innerExpressionExecutors[i] = attributeExpressionExecutors1[i].cloneExecutor(key);
}
abstractStreamProcessor.attributeExpressionExecutors = innerExpressionExecutors;
abstractStreamProcessor.attributeExpressionLength = attributeExpressionLength;
abstractStreamProcessor.additionalAttributes = additionalAttributes;
abstractStreamProcessor.complexEventPopulater = complexEventPopulater;
abstractStreamProcessor.siddhiAppContext = siddhiAppContext;
abstractStreamProcessor.elementId = elementId + "-" + key;
abstractStreamProcessor.configReader = configReader;
abstractStreamProcessor.outputExpectsExpiredEvents = outputExpectsExpiredEvents;
abstractStreamProcessor.queryName = queryName;
abstractStreamProcessor.siddhiAppContext.getSnapshotService().addSnapshotable(queryName, abstractStreamProcessor);
abstractStreamProcessor.siddhiAppContext.addEternalReferencedHolder(abstractStreamProcessor);
abstractStreamProcessor.init(inputDefinition, attributeExpressionExecutors, configReader, siddhiAppContext, outputExpectsExpiredEvents);
abstractStreamProcessor.start();
return abstractStreamProcessor;
} catch (Exception e) {
throw new SiddhiAppRuntimeException("Exception in cloning " + this.getClass().getCanonicalName(), e);
}
}
Aggregations