From 122453278ae0112b52a10c9635af58108ed0b932 Mon Sep 17 00:00:00 2001 From: mohan Date: Fri, 12 Apr 2019 03:30:02 +0530 Subject: [PATCH] Update Siddhi dependency to 5.x.x --- component/pom.xml | 10 +- ...enizerAsObjectStreamProcessorFunction.java | 103 +++++++++--------- .../JsonTokenizerStreamProcessorFunction.java | 99 ++++++++--------- .../GetBoolJSONFunctionExtension.java | 60 ++++------ .../GetDoubleJSONFunctionExtension.java | 62 ++++------- .../GetFloatJSONFunctionExtension.java | 62 ++++------- .../function/GetIntJSONFunctionExtension.java | 62 ++++------- .../GetLongJSONFunctionExtension.java | 62 ++++------- .../GetObjectJSONFunctionExtension.java | 66 ++++------- .../GetStringJSONFunctionExtension.java | 61 ++++------- .../InsertToJSONFunctionExtension.java | 59 ++++------ .../function/IsExistsFunctionExtension.java | 61 ++++------- .../ToJSONObjectFunctionExtension.java | 62 ++++------- .../ToJSONStringFunctionExtension.java | 63 ++++------- .../json/GetBoolJSONFunctionTestCase.java | 14 +-- .../json/GetDoubleJSONFunctionTestCase.java | 14 +-- .../json/GetFloatJSONFunctionTestCase.java | 14 +-- .../json/GetIntJSONFunctionTestCase.java | 14 +-- .../json/GetLongJSONFunctionTestCase.java | 14 +-- .../json/GetObjectJSONFunctionTestCase.java | 14 +-- .../json/GetStringJSONFunctionTestCase.java | 14 +-- .../json/InsertToJSONFunctionTestCase.java | 14 +-- ...ObjectStreamProcessorFunctionTestCase.java | 14 +-- ...enizerStreamProcessorFunctionTestCase.java | 14 +-- .../json/ToJSONFunctionTestCase.java | 14 +-- .../json/ToStringFunctionTestCase.java | 14 +-- pom.xml | 8 +- 27 files changed, 425 insertions(+), 643 deletions(-) diff --git a/component/pom.xml b/component/pom.xml index 3cd9e54..b548526 100644 --- a/component/pom.xml +++ b/component/pom.xml @@ -12,7 +12,7 @@ - org.wso2.siddhi + io.siddhi siddhi-core @@ -96,8 +96,8 @@ net.minidev.* - org.wso2.siddhi.core.*;version="${siddhi.version.range}", - org.wso2.siddhi.query.api.*;version="${siddhi.version.range}", + io.siddhi.core.*;version="${siddhi.version.range}", + io.siddhi.query.api.*;version="${siddhi.version.range}", *;resolution:=optional * @@ -108,7 +108,7 @@ - org.wso2.siddhi + io.siddhi siddhi-doc-gen ${siddhi.version} @@ -128,7 +128,7 @@ - org.wso2.siddhi + io.siddhi siddhi-doc-gen ${siddhi.version} diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerAsObjectStreamProcessorFunction.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerAsObjectStreamProcessorFunction.java index a33abbd..087ae90 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerAsObjectStreamProcessorFunction.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerAsObjectStreamProcessorFunction.java @@ -21,26 +21,31 @@ import com.jayway.jsonpath.InvalidJsonException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.event.ComplexEventChunk; +import io.siddhi.core.event.stream.MetaStreamEvent; +import io.siddhi.core.event.stream.StreamEvent; +import io.siddhi.core.event.stream.StreamEventCloner; +import io.siddhi.core.event.stream.holder.StreamEventClonerHolder; +import io.siddhi.core.event.stream.populater.ComplexEventPopulater; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ConstantExpressionExecutor; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.query.processor.ProcessingMode; +import io.siddhi.core.query.processor.Processor; +import io.siddhi.core.query.processor.stream.StreamProcessor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.AbstractDefinition; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.event.ComplexEventChunk; -import org.wso2.siddhi.core.event.stream.StreamEvent; -import org.wso2.siddhi.core.event.stream.StreamEventCloner; -import org.wso2.siddhi.core.event.stream.populater.ComplexEventPopulater; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ConstantExpressionExecutor; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.query.processor.Processor; -import org.wso2.siddhi.core.query.processor.stream.StreamProcessor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.AbstractDefinition; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; import java.util.ArrayList; import java.util.List; @@ -95,13 +100,14 @@ "attribute named 'jsonElement' into the stream \n`\n e.g.,\n jsonInput - " + "{name:\"John\",age:25}, \n path - \"$.age\"\n`\n") ) -public class JsonTokenizerAsObjectStreamProcessorFunction extends StreamProcessor { +public class JsonTokenizerAsObjectStreamProcessorFunction extends StreamProcessor { private static final Logger log = Logger.getLogger(JsonTokenizerAsObjectStreamProcessorFunction.class); private boolean failOnMissingAttribute = true; @Override protected void process(ComplexEventChunk streamEventChunk, Processor nextProcessor, - StreamEventCloner streamEventCloner, ComplexEventPopulater complexEventPopulater) { + StreamEventCloner streamEventCloner, ComplexEventPopulater complexEventPopulater, + State state) { while (streamEventChunk.hasNext()) { StreamEvent streamEvent = streamEventChunk.next(); Object jsonInput = attributeExpressionExecutors[0].execute(streamEvent); @@ -145,14 +151,21 @@ protected void process(ComplexEventChunk streamEventChunk, Processo * The initialization method for {@link StreamProcessor}, which will be called before other methods and validate * the all configuration and getting the initial values. * - * @param attributeExpressionExecutors are the executors of each attributes in the Function - * @param configReader this hold the {@link StreamProcessor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param metaStreamEvent the stream event meta + * @param abstractDefinition the incoming stream definition + * @param expressionExecutors the executors for the function parameters + * @param configReader this hold the Stream Processor configuration reader. + * @param streamEventClonerHolder streamEventCloner Holder + * @param outputExpectsExpiredEvents whether output can be expired events + * @param findToBeExecuted find will be executed + * @param siddhiQueryContext current siddhi query context */ @Override - protected List init(AbstractDefinition inputDefinition, - ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(MetaStreamEvent metaStreamEvent, AbstractDefinition abstractDefinition, + ExpressionExecutor[] expressionExecutors, ConfigReader configReader, + StreamEventClonerHolder streamEventClonerHolder, + boolean outputExpectsExpiredEvents, boolean findToBeExecuted, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2 || attributeExpressionExecutors.length == 3) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of " + @@ -188,9 +201,8 @@ protected List init(AbstractDefinition inputDefinition, throw new SiddhiAppValidationException("Invalid no of arguments passed to json:tokenizeAsObject() function," + "required 2, but found " + attributeExpressionExecutors.length); } - List attributes = new ArrayList<>(); - attributes.add(new Attribute("jsonElement", Attribute.Type.OBJECT)); - return attributes; + + return null; } /** @@ -212,30 +224,21 @@ public void start() { public void stop() { } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; + + private void sendEvents(StreamEvent streamEvent, Object[] data, ComplexEventChunk streamEventChunk) { + complexEventPopulater.populateComplexEvent(streamEvent, data); + nextProcessor.process(streamEventChunk); } - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ @Override - public void restoreState(Map state) { + public List getReturnAttributes() { + List attributes = new ArrayList<>(); + attributes.add(new Attribute("jsonElement", Attribute.Type.OBJECT)); + return attributes; } - private void sendEvents(StreamEvent streamEvent, Object[] data, ComplexEventChunk streamEventChunk) { - complexEventPopulater.populateComplexEvent(streamEvent, data); - nextProcessor.process(streamEventChunk); + @Override + public ProcessingMode getProcessingMode() { + return ProcessingMode.BATCH; } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerStreamProcessorFunction.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerStreamProcessorFunction.java index 38f6cc5..5e59e5e 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerStreamProcessorFunction.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerStreamProcessorFunction.java @@ -22,25 +22,30 @@ import com.google.gson.GsonBuilder; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.event.ComplexEventChunk; +import io.siddhi.core.event.stream.MetaStreamEvent; +import io.siddhi.core.event.stream.StreamEvent; +import io.siddhi.core.event.stream.StreamEventCloner; +import io.siddhi.core.event.stream.holder.StreamEventClonerHolder; +import io.siddhi.core.event.stream.populater.ComplexEventPopulater; +import io.siddhi.core.executor.ConstantExpressionExecutor; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.query.processor.ProcessingMode; +import io.siddhi.core.query.processor.Processor; +import io.siddhi.core.query.processor.stream.StreamProcessor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.AbstractDefinition; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.event.ComplexEventChunk; -import org.wso2.siddhi.core.event.stream.StreamEvent; -import org.wso2.siddhi.core.event.stream.StreamEventCloner; -import org.wso2.siddhi.core.event.stream.populater.ComplexEventPopulater; -import org.wso2.siddhi.core.executor.ConstantExpressionExecutor; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.query.processor.Processor; -import org.wso2.siddhi.core.query.processor.stream.StreamProcessor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.AbstractDefinition; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; import java.util.ArrayList; import java.util.List; @@ -94,14 +99,15 @@ "named 'jsonElement' into the stream. \n`\n e.g.,\n jsonInput - {name:\"John\",age:25}, \n " + "path - \"$.age\"\n`\n") ) -public class JsonTokenizerStreamProcessorFunction extends StreamProcessor { +public class JsonTokenizerStreamProcessorFunction extends StreamProcessor { private static final Logger log = Logger.getLogger(JsonTokenizerStreamProcessorFunction.class); private static final Gson gson = new GsonBuilder().serializeNulls().create(); private boolean failOnMissingAttribute = true; @Override protected void process(ComplexEventChunk streamEventChunk, Processor nextProcessor, - StreamEventCloner streamEventCloner, ComplexEventPopulater complexEventPopulater) { + StreamEventCloner streamEventCloner, ComplexEventPopulater complexEventPopulater, + State state) { while (streamEventChunk.hasNext()) { StreamEvent streamEvent = streamEventChunk.next(); Object jsonInput = attributeExpressionExecutors[0].execute(streamEvent); @@ -143,14 +149,21 @@ protected void process(ComplexEventChunk streamEventChunk, Processo * The initialization method for {@link StreamProcessor}, which will be called before other methods and validate * the all configuration and getting the initial values. * - * @param attributeExpressionExecutors are the executors of each attributes in the Function - * @param configReader this hold the {@link StreamProcessor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param metaStreamEvent the stream event meta + * @param abstractDefinition the incoming stream definition + * @param expressionExecutors the executors for the function parameters + * @param configReader this hold the Stream Processor configuration reader. + * @param streamEventClonerHolder streamEventCloner Holder + * @param outputExpectsExpiredEvents whether output can be expired events + * @param findToBeExecuted find will be executed + * @param siddhiQueryContext current siddhi query context */ @Override - protected List init(AbstractDefinition inputDefinition, - ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(MetaStreamEvent metaStreamEvent, AbstractDefinition abstractDefinition, + ExpressionExecutor[] expressionExecutors, ConfigReader configReader, + StreamEventClonerHolder streamEventClonerHolder, + boolean outputExpectsExpiredEvents, boolean findToBeExecuted, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2 || attributeExpressionExecutors.length == 3) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of json:tokenize" + @@ -188,9 +201,8 @@ protected List init(AbstractDefinition inputDefinition, throw new SiddhiAppValidationException("Invalid no of arguments passed to json:tokenize() function, " + "required 2, but found " + attributeExpressionExecutors.length); } - List attributes = new ArrayList<>(); - attributes.add(new Attribute("jsonElement", Attribute.Type.STRING)); - return attributes; + + return null; } /** @@ -214,31 +226,20 @@ public void stop() { } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ @Override - public void restoreState(Map state) { - + public List getReturnAttributes() { + List attributes = new ArrayList<>(); + attributes.add(new Attribute("jsonElement", Attribute.Type.STRING)); + return attributes; } private void sendEvents(StreamEvent streamEvent, Object[] data, ComplexEventChunk streamEventChunk) { complexEventPopulater.populateComplexEvent(streamEvent, data); nextProcessor.process(streamEventChunk); } + + @Override + public ProcessingMode getProcessingMode() { + return ProcessingMode.BATCH; + } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetBoolJSONFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetBoolJSONFunctionExtension.java index 90e4e7b..9937acc 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetBoolJSONFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetBoolJSONFunctionExtension.java @@ -23,22 +23,23 @@ import com.jayway.jsonpath.InvalidJsonException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; import java.util.List; -import java.util.Map; /** @@ -83,11 +84,11 @@ public class GetBoolJSONFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to the first argument 'json' of " + @@ -115,6 +116,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea + "required 2, but found " + attributeExpressionExecutors.length); } + return null; } /** @@ -125,7 +127,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { String jsonInput; if (data[0] instanceof String) { jsonInput = (String) data[0]; @@ -173,7 +175,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return null; } @@ -187,26 +189,4 @@ public Attribute.Type getReturnType() { return Attribute.Type.BOOL; } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetDoubleJSONFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetDoubleJSONFunctionExtension.java index c2f4663..b4efeea 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetDoubleJSONFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetDoubleJSONFunctionExtension.java @@ -23,22 +23,23 @@ import com.jayway.jsonpath.InvalidJsonException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; import java.util.List; -import java.util.Map; /** @@ -69,7 +70,7 @@ "select json:getDouble(json,\"$.name\") as name\n" + "insert into OutputStream;", description = "This returns the double value of the given path. The results are" + - "directed to the 'OutputStream' stream.") + "directed to the 'OutputStream' stream.") ) public class GetDoubleJSONFunctionExtension extends FunctionExecutor { private static final Logger log = Logger.getLogger(GetDoubleJSONFunctionExtension.class); @@ -81,11 +82,11 @@ public class GetDoubleJSONFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of " + @@ -113,6 +114,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea + "required 2, but found " + attributeExpressionExecutors.length); } + return null; } /** @@ -123,7 +125,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { String jsonInput; if (data[0] instanceof String) { jsonInput = (String) data[0]; @@ -173,7 +175,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return null; } @@ -187,26 +189,4 @@ public Attribute.Type getReturnType() { return Attribute.Type.DOUBLE; } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetFloatJSONFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetFloatJSONFunctionExtension.java index 17a27ce..920f2eb 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetFloatJSONFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetFloatJSONFunctionExtension.java @@ -23,22 +23,23 @@ import com.jayway.jsonpath.InvalidJsonException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; import java.util.List; -import java.util.Map; /** @@ -70,7 +71,7 @@ "select json:getFloat(json,\"$.name\") as name\n" + "insert into OutputStream;", description = "This returns the float value of the JSON input in the given path. The results are" + - "directed to the 'OutputStream' stream.") + "directed to the 'OutputStream' stream.") ) public class GetFloatJSONFunctionExtension extends FunctionExecutor { private static final Logger log = Logger.getLogger(GetFloatJSONFunctionExtension.class); @@ -82,11 +83,11 @@ public class GetFloatJSONFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of " + @@ -114,6 +115,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea + "required 2, but found " + attributeExpressionExecutors.length); } + return null; } /** @@ -124,7 +126,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { String jsonInput; if (data[0] instanceof String) { jsonInput = (String) data[0]; @@ -172,7 +174,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return null; } @@ -186,26 +188,4 @@ public Attribute.Type getReturnType() { return Attribute.Type.FLOAT; } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetIntJSONFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetIntJSONFunctionExtension.java index 8a5f7d0..b84260e 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetIntJSONFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetIntJSONFunctionExtension.java @@ -23,22 +23,23 @@ import com.jayway.jsonpath.InvalidJsonException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; import java.util.List; -import java.util.Map; /** @@ -70,7 +71,7 @@ "select json:getInt(json,\"$.name\") as name\n" + "insert into OutputStream;", description = "This returns the integer value of the JSON input in the given path. The results" + - "are directed to the 'OutputStream' stream.") + "are directed to the 'OutputStream' stream.") ) public class GetIntJSONFunctionExtension extends FunctionExecutor { private static final Logger log = Logger.getLogger(GetIntJSONFunctionExtension.class); @@ -82,11 +83,11 @@ public class GetIntJSONFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of " + @@ -114,6 +115,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea + "required 2, but found " + attributeExpressionExecutors.length); } + return null; } /** @@ -124,7 +126,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { String jsonInput; if (data[0] instanceof String) { jsonInput = (String) data[0]; @@ -172,7 +174,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return null; } @@ -186,26 +188,4 @@ public Attribute.Type getReturnType() { return Attribute.Type.INT; } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetLongJSONFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetLongJSONFunctionExtension.java index 5470187..a1d7bde 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetLongJSONFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetLongJSONFunctionExtension.java @@ -23,22 +23,23 @@ import com.jayway.jsonpath.InvalidJsonException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; import java.util.List; -import java.util.Map; /** @@ -69,7 +70,7 @@ "select json:getLong(json,\"$.name\") as name\n" + "insert into OutputStream;", description = "This returns the long value of the JSON input in the given path. The results are" + - "directed to 'OutputStream' stream.") + "directed to 'OutputStream' stream.") ) public class GetLongJSONFunctionExtension extends FunctionExecutor { @@ -82,11 +83,11 @@ public class GetLongJSONFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of " + @@ -114,6 +115,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea + "required 2, but found " + attributeExpressionExecutors.length); } + return null; } /** @@ -124,7 +126,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { String jsonInput; if (data[0] instanceof String) { jsonInput = (String) data[0]; @@ -172,7 +174,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return null; } @@ -186,26 +188,4 @@ public Attribute.Type getReturnType() { return Attribute.Type.LONG; } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetObjectJSONFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetObjectJSONFunctionExtension.java index ee40582..5c66717 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetObjectJSONFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetObjectJSONFunctionExtension.java @@ -23,22 +23,23 @@ import com.jayway.jsonpath.InvalidJsonException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; import java.util.List; -import java.util.Map; /** @@ -63,12 +64,12 @@ description = "Returns the object of the input JSON from the input stream.", type = {DataType.OBJECT}), examples = @Example( - syntax = "define stream InputStream(json string);\n" + + syntax = "define stream InputStream(json string);\n" + "from InputStream\n" + "select json:getObject(json,\"$.name\") as name\n" + "insert into OutputStream;", - description = "This returns the object of the JSON input in the given path. The results are " + - "directed to the 'OutputStream' stream.") + description = "This returns the object of the JSON input in the given path. The results are " + + "directed to the 'OutputStream' stream.") ) public class GetObjectJSONFunctionExtension extends FunctionExecutor { private static final Logger log = Logger.getLogger(GetObjectJSONFunctionExtension.class); @@ -80,11 +81,11 @@ public class GetObjectJSONFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of " + @@ -112,6 +113,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea + "required 2, but found " + attributeExpressionExecutors.length); } + return null; } /** @@ -122,7 +124,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { String jsonInput; if (data[0] instanceof String) { jsonInput = (String) data[0]; @@ -155,7 +157,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return null; } @@ -169,26 +171,4 @@ public Attribute.Type getReturnType() { return Attribute.Type.OBJECT; } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetStringJSONFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetStringJSONFunctionExtension.java index 5debeec..1243a68 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetStringJSONFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/GetStringJSONFunctionExtension.java @@ -23,21 +23,21 @@ import com.jayway.jsonpath.InvalidJsonException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; - -import java.util.Map; /** @@ -79,11 +79,11 @@ public class GetStringJSONFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of " + @@ -111,6 +111,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea + "required 2, but found " + attributeExpressionExecutors.length); } + return null; } /** @@ -121,7 +122,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { String jsonInput; if (data[0] instanceof String) { jsonInput = (String) data[0]; @@ -155,7 +156,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return null; } @@ -169,26 +170,4 @@ public Attribute.Type getReturnType() { return Attribute.Type.STRING; } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/InsertToJSONFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/InsertToJSONFunctionExtension.java index 5b05351..576d2ff 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/InsertToJSONFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/InsertToJSONFunctionExtension.java @@ -25,19 +25,21 @@ import com.jayway.jsonpath.InvalidModificationException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; import java.util.List; import java.util.Map; @@ -93,11 +95,11 @@ public class InsertToJSONFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 4 || attributeExpressionExecutors.length == 3) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of " + @@ -143,6 +145,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea + "required 3 or 4, but found " + attributeExpressionExecutors.length); } + return null; } /** @@ -153,7 +156,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { String jsonInput; if (data[0] instanceof String) { jsonInput = (String) data[0]; @@ -214,7 +217,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return null; } @@ -228,26 +231,4 @@ public Attribute.Type getReturnType() { return Attribute.Type.OBJECT; } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was/ on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/IsExistsFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/IsExistsFunctionExtension.java index 2e6f706..cb038a6 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/IsExistsFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/IsExistsFunctionExtension.java @@ -23,21 +23,21 @@ import com.jayway.jsonpath.InvalidJsonException; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.exception.SiddhiAppRuntimeException; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppRuntimeException; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; - -import java.util.Map; /** @@ -84,11 +84,11 @@ public class IsExistsFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length == 2) { if (attributeExpressionExecutors[0] == null) { throw new SiddhiAppValidationException("Invalid input given to first argument 'json' of " + @@ -115,6 +115,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea + "required 2, but found " + attributeExpressionExecutors.length); } + return null; } /** @@ -125,7 +126,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { String jsonInput; if (data[0] instanceof String) { jsonInput = (String) data[0]; @@ -154,7 +155,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return null; } @@ -168,26 +169,4 @@ public Attribute.Type getReturnType() { return Attribute.Type.BOOL; } - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was/ on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/ToJSONObjectFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/ToJSONObjectFunctionExtension.java index 86a37bd..6a9c0bc 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/ToJSONObjectFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/ToJSONObjectFunctionExtension.java @@ -18,22 +18,22 @@ package org.wso2.extension.siddhi.execution.json.function; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; - -import java.util.Map; /** @@ -72,11 +72,11 @@ public class ToJSONObjectFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length != 1) { @@ -94,6 +94,8 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea "json:toJson() function, required " + Attribute.Type.STRING + ", but found " + firstAttributeType .toString()); } + + return null; } /** @@ -104,7 +106,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { return null; } @@ -117,7 +119,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { Object returnValue = null; try { returnValue = jsonParser.parse(data.toString()); @@ -136,27 +138,5 @@ protected Object execute(Object data) { public Attribute.Type getReturnType() { return Attribute.Type.OBJECT; } - - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } + diff --git a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/ToJSONStringFunctionExtension.java b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/ToJSONStringFunctionExtension.java index 0427113..f80a958 100644 --- a/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/ToJSONStringFunctionExtension.java +++ b/component/src/main/java/org/wso2/extension/siddhi/execution/json/function/ToJSONStringFunctionExtension.java @@ -20,20 +20,20 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ReturnAttribute; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiQueryContext; +import io.siddhi.core.executor.ExpressionExecutor; +import io.siddhi.core.executor.function.FunctionExecutor; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.exception.SiddhiAppValidationException; import org.apache.log4j.Logger; -import org.wso2.siddhi.annotation.Example; -import org.wso2.siddhi.annotation.Extension; -import org.wso2.siddhi.annotation.Parameter; -import org.wso2.siddhi.annotation.ReturnAttribute; -import org.wso2.siddhi.annotation.util.DataType; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.executor.ExpressionExecutor; -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.util.config.ConfigReader; -import org.wso2.siddhi.query.api.definition.Attribute; -import org.wso2.siddhi.query.api.exception.SiddhiAppValidationException; - -import java.util.Map; /** @@ -47,7 +47,7 @@ @Parameter( name = "json", description = "A valid JSON object from which the function generates a JSON string.", - type = {DataType.OBJECT}), + type = {DataType.OBJECT}), }, returnAttributes = @ReturnAttribute( description = "Returns the JSON string generated using the given JSON object.", @@ -71,11 +71,11 @@ public class ToJSONStringFunctionExtension extends FunctionExecutor { * * @param attributeExpressionExecutors are the executors of each attributes in the Function * @param configReader this hold the {@link FunctionExecutor} extensions configuration reader. - * @param siddhiAppContext Siddhi app runtime context + * @param siddhiQueryContext Siddhi query context */ @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { + protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, + SiddhiQueryContext siddhiQueryContext) { if (attributeExpressionExecutors.length != 1) { @@ -93,6 +93,8 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea "json:toString() function, required " + Attribute.Type.OBJECT + ", but found " + firstAttributeType .toString()); } + + return null; } /** @@ -103,7 +105,7 @@ protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigRea * @return the Function result */ @Override - protected Object execute(Object[] data) { + protected Object execute(Object[] data, State state) { return null; } @@ -116,7 +118,7 @@ protected Object execute(Object[] data) { * @return the Function result */ @Override - protected Object execute(Object data) { + protected Object execute(Object data, State state) { return gson.toJson(data); } @@ -129,27 +131,4 @@ protected Object execute(Object data) { public Attribute.Type getReturnType() { return Attribute.Type.STRING; } - - /** - * Used to collect the serializable state of the processing element, that need to be - * persisted for reconstructing the element to the same state on a different point of time - * - * @return stateful objects of the processing element as an map - */ - @Override - public Map currentState() { - return null; - } - - /** - * Used to restore serialized state of the processing element, for reconstructing - * the element to the same state as if was on a previous point of time. - * - * @param state the stateful objects of the processing element as a map. - * This is the same map that is created upon calling currentState() method. - */ - @Override - public void restoreState(Map state) { - - } } diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetBoolJSONFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetBoolJSONFunctionTestCase.java index d0dcc94..36164d0 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetBoolJSONFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetBoolJSONFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,19 +31,13 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class GetBoolJSONFunctionTestCase { private static final Logger log = Logger.getLogger(JsonTokenizerStreamProcessorFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", married:true, citizen:false}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetDoubleJSONFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetDoubleJSONFunctionTestCase.java index d6aa14f..5c381fd 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetDoubleJSONFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetDoubleJSONFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,19 +31,13 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class GetDoubleJSONFunctionTestCase { private static final Logger log = Logger.getLogger(GetDoubleJSONFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", age:25, citizen:false}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetFloatJSONFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetFloatJSONFunctionTestCase.java index db11270..35b47b9 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetFloatJSONFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetFloatJSONFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,19 +31,13 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class GetFloatJSONFunctionTestCase { private static final Logger log = Logger.getLogger(GetFloatJSONFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", age:25, citizen:false}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetIntJSONFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetIntJSONFunctionTestCase.java index dda2599..9519aac 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetIntJSONFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetIntJSONFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,19 +31,13 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class GetIntJSONFunctionTestCase { private static final Logger log = Logger.getLogger(GetIntJSONFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", age:25, citizen:false}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetLongJSONFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetLongJSONFunctionTestCase.java index 183d92c..71e1779 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetLongJSONFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetLongJSONFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,19 +31,13 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class GetLongJSONFunctionTestCase { private static final Logger log = Logger.getLogger(GetLongJSONFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", age:25, citizen:false}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetObjectJSONFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetObjectJSONFunctionTestCase.java index 54f8dc8..36faae4 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetObjectJSONFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetObjectJSONFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,19 +31,13 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class GetObjectJSONFunctionTestCase { private static final Logger log = Logger.getLogger(GetObjectJSONFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", age:25, citizen:false}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetStringJSONFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetStringJSONFunctionTestCase.java index 48594e5..46893bc 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetStringJSONFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/GetStringJSONFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,20 +31,14 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class GetStringJSONFunctionTestCase { private static final Logger log = Logger.getLogger(GetStringJSONFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", age:25, citizen:false, " + "bar:[{barName:\"barName\"},{barName:\"barName2\"}]}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/InsertToJSONFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/InsertToJSONFunctionTestCase.java index 32a59f2..bf27913 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/InsertToJSONFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/InsertToJSONFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,21 +31,15 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class InsertToJSONFunctionTestCase { private static final Logger log = Logger.getLogger(JsonTokenizerStreamProcessorFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", married:true, citizen:false, subjects:[\"Mathematics\"]}"; private static final String EXPECTED_JSON = "{\"name\":\"John\",\"married\":true,\"citizen\":false," + "\"subjects\":[\"Mathematics\"],\"key\":{\"key\":\"value\"}}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerAsObjectStreamProcessorFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerAsObjectStreamProcessorFunctionTestCase.java index 0bcae84..9444e6b 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerAsObjectStreamProcessorFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerAsObjectStreamProcessorFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,22 +31,16 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class JsonTokenizerAsObjectStreamProcessorFunctionTestCase { private static final Logger log = Logger.getLogger(JsonTokenizerAsObjectStreamProcessorFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{emp:[" + "{\"name\":\"John\", foo:{fooName:\"fooName\"}, bar:[{barName:\"barName\"},{barName:\"barName2\"}]}," + "{\"name\":\"Peter\", foo:{fooName:\"fooName2\"}, bar:[{barName:\"barName3\"},{barName:\"barName4\"}]}" + "]}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerStreamProcessorFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerStreamProcessorFunctionTestCase.java index 8696400..79da6d4 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerStreamProcessorFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/JsonTokenizerStreamProcessorFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,22 +31,16 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class JsonTokenizerStreamProcessorFunctionTestCase { private static final Logger log = Logger.getLogger(JsonTokenizerStreamProcessorFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{emp:[" + "{\"name\":\"John\", foo:{fooName:\"fooName\"}, bar:[{barName:\"barName\"},{barName:\"barName2\"}]}," + "{\"name\":\"Peter\", foo:{fooName:\"fooName2\"}, bar:[{barName:\"barName3\"},{barName:\"barName4\"}]}" + "]}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/ToJSONFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/ToJSONFunctionTestCase.java index a16da61..54e6468 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/ToJSONFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/ToJSONFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,20 +31,14 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class ToJSONFunctionTestCase { private static final Logger log = Logger.getLogger(ToJSONFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", age:25, citizen:false, " + "bar:[{barName:\"barName\"},{barName:\"barName2\"}]}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/component/src/test/java/org/wso2/extension/siddhi/execution/json/ToStringFunctionTestCase.java b/component/src/test/java/org/wso2/extension/siddhi/execution/json/ToStringFunctionTestCase.java index 4a042ed..2683958 100644 --- a/component/src/test/java/org/wso2/extension/siddhi/execution/json/ToStringFunctionTestCase.java +++ b/component/src/test/java/org/wso2/extension/siddhi/execution/json/ToStringFunctionTestCase.java @@ -18,6 +18,12 @@ package org.wso2.extension.siddhi.execution.json; +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.query.output.callback.QueryCallback; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.util.EventPrinter; import net.minidev.json.JSONObject; import net.minidev.json.parser.JSONParser; import net.minidev.json.parser.ParseException; @@ -25,20 +31,14 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.query.output.callback.QueryCallback; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.util.EventPrinter; import java.util.concurrent.atomic.AtomicInteger; public class ToStringFunctionTestCase { private static final Logger log = Logger.getLogger(ToStringFunctionTestCase.class); - private AtomicInteger count = new AtomicInteger(0); private static final String JSON_INPUT = "{name:\"John\", age:25, citizen:false, " + "bar:[{barName:\"barName\"},{barName:\"barName2\"}]}"; + private AtomicInteger count = new AtomicInteger(0); @BeforeMethod public void init() { diff --git a/pom.xml b/pom.xml index 4893510..344118e 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,8 @@ - 4.4.8 - [4.0.0,5.0.0) + 5.0.0-m12 + [5.0.0,6.0.0) 1.2.17.wso2v1 2.2.0 6.11 @@ -41,12 +41,12 @@ - org.wso2.siddhi + io.siddhi siddhi-core ${siddhi.version} - org.wso2.siddhi + io.siddhi siddhi-query-api ${siddhi.version}