use of org.wso2.siddhi.core.exception.SiddhiAppRuntimeException 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.exception.SiddhiAppRuntimeException 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);
}
}
use of org.wso2.siddhi.core.exception.SiddhiAppRuntimeException in project siddhi by wso2.
the class AggregateWindowProcessor method cloneProcessor.
@Override
public Processor cloneProcessor(String key) {
try {
AggregateWindowProcessor streamProcessor = new AggregateWindowProcessor(aggregationRuntime, within, per);
streamProcessor.inputDefinition = inputDefinition;
ExpressionExecutor[] innerExpressionExecutors = new ExpressionExecutor[attributeExpressionLength];
ExpressionExecutor[] attributeExpressionExecutors1 = this.attributeExpressionExecutors;
for (int i = 0; i < attributeExpressionLength; i++) {
innerExpressionExecutors[i] = attributeExpressionExecutors1[i].cloneExecutor(key);
}
streamProcessor.attributeExpressionExecutors = innerExpressionExecutors;
streamProcessor.attributeExpressionLength = attributeExpressionLength;
streamProcessor.additionalAttributes = additionalAttributes;
streamProcessor.complexEventPopulater = complexEventPopulater;
streamProcessor.init(inputDefinition, attributeExpressionExecutors, configReader, siddhiAppContext, outputExpectsExpiredEvents);
streamProcessor.start();
return streamProcessor;
} catch (Exception e) {
throw new SiddhiAppRuntimeException("Exception in cloning " + this.getClass().getCanonicalName(), e);
}
}
use of org.wso2.siddhi.core.exception.SiddhiAppRuntimeException in project siddhi by wso2.
the class AttributeAggregator method cloneAggregator.
public AttributeAggregator cloneAggregator(String key) {
try {
AttributeAggregator attributeAggregator = this.getClass().newInstance();
ExpressionExecutor[] innerExpressionExecutors = new ExpressionExecutor[attributeSize];
for (int i = 0; i < attributeSize; i++) {
innerExpressionExecutors[i] = attributeExpressionExecutors[i].cloneExecutor(key);
}
attributeAggregator.elementId = elementId + "-" + key;
attributeAggregator.initAggregator(innerExpressionExecutors, siddhiAppContext, configReader);
return attributeAggregator;
} catch (Exception e) {
throw new SiddhiAppRuntimeException("Exception in cloning " + this.getClass().getCanonicalName(), e);
}
}
use of org.wso2.siddhi.core.exception.SiddhiAppRuntimeException in project siddhi by wso2.
the class MaxIncrementalAttributeAggregator method init.
@Override
public void init(String attributeName, Attribute.Type attributeType) {
if (attributeName == null) {
throw new SiddhiAppCreationException("Max incremental attribute aggregation cannot be executed " + "when no parameters are given");
}
if (attributeType.equals(Attribute.Type.INT) || attributeType.equals(Attribute.Type.LONG) || attributeType.equals(Attribute.Type.DOUBLE) || attributeType.equals(Attribute.Type.FLOAT)) {
this.baseAttributes = new Attribute[] { new Attribute("AGG_MAX_".concat(attributeName), attributeType) };
this.baseAttributesInitialValues = new Expression[] { Expression.variable(attributeName) };
this.returnType = attributeType;
assert baseAttributes.length == baseAttributesInitialValues.length;
} else {
throw new SiddhiAppRuntimeException("Max aggregation cannot be executed on attribute type " + attributeType.toString());
}
}
Aggregations