diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/pom.xml b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/pom.xml
deleted file mode 100644
index 09ff37aa0..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/pom.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
- org.wso2.gpl.siddhi.extensions
- siddhi-extension-gpl-geo-parent
- 3.1.0-SNAPSHOT
- ../pom.xml
-
- 4.0.0
- bundle
- http://wso2.org
-
- org.wso2.gpl.siddhi.extension.geo.plugin
- Siddhi Extension - Geo Component
-
-
- FunctionExecutors
- 1. GeoWithinFunctionExecutor
- Input : (longitude double, latitude double, geoJSONGeometryFence string)
- OR (geoJSONGeometry string, geoJSONGeometryFence string)
- Output : true if (longitude, latitude) or geoJSONGeometry is within the geoJSONGeometryFence
-
- 2. GeoIntersectsFunctionExecutor
- Input : (longitude double, latitude double, geoJSONGeometryFence string)
- OR (geoJSONGeometry string, geoJSONGeometryFence string)
- Output : true if (longitude, latitude) or geoJSONGeometry intersects the geoJSONGeometryFence
-
- 3. GeoWithinDistanceFunctionExecutor
- Input : (longitude double, latitude double, geoJSONGeometryFence string, distance double)
- OR (geoJSONGeometry string, geoJSONGeometryFence string, distance double)
- Output : true if (longitude, latitude) or geoJSONGeometry is within distance of the geoJSONGeometryFence
-
- StreamProcessors
- 1. GeoCrossesStreamProcessor
- Input : (id string, longitude double, latitude double, geoJSONGeometryFence string)
- OR (id string, geoJSONGeometry string, geoJSONGeometryFence string)
- Output : an event with `crosses` additional attribute set to true when the object ((longitude, latitude) or geoJSONGeometry)
- crosses into geoJSONGeometryFence and an event with `crosses` additional attribute set to false
- when the object crosses out of the geoJSONGeometryFence
-
- 2. GeoStationaryStreamProcessor
- Input : (id string, longitude double, latitude double, geoJSONGeometryFence string, radius double)
- OR (id string, geoJSONGeometry string, geoJSONGeometryFence string, radius double)
- Output : when the object ((longitude, latitude) or geoJSONGeometry) starts being stationary within the radius
- an event with `stationary` additional attribute set to true. When the object starts to move out of the radius
- an event with `stationary` additional attribute set to false.
-
- 3. GeoProximityStreamProcessor
- Input : (id string, longitude double, latitude double, geoJSONGeometryFence string, radius double)
- OR (id string, geoJSONGeometry string, geoJSONGeometryFence string, radius double)
- Output : when two objects ((longitude, latitude) or geoJSONGeometry) starts being in close proximity within the radius
- an event with `inCloseProximity` additional attribute set to true. When the object starts to move out of the radius
- an event with `inCloseProximity` additional. attribute set to false. On each event, additional attributes
- `proximityWith` gives the id of the object that this object is in close proximity and `proximityId` is an id unique to
- the pair of objects
-
-
-
-
-
- org.wso2.siddhi
- siddhi-query-api
-
-
- org.wso2.siddhi
- siddhi-query-compiler
-
-
- org.wso2.siddhi
- siddhi-core
-
-
- log4j
- log4j
-
-
- junit
- junit
- test
-
-
- com.google.code.gson
- gson
-
-
- org.wso2.orbit.org.geotools
- gt-geojson
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.7
- true
-
-
- ${project.artifactId}
- ${project.artifactId}
- ${project.version}
- Siddhi Extension for Geo Fencing
-
- org.wso2.gpl.siddhi.extensions.geo.*
-
-
- org.wso2.gpl.siddhi.extensions.geo.internal.*
-
-
- *;resolution:=optional
-
-
-
-
-
-
-
-
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/AbstractGeoOperationExecutor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/AbstractGeoOperationExecutor.java
deleted file mode 100644
index 18e4c9041..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/AbstractGeoOperationExecutor.java
+++ /dev/null
@@ -1,115 +0,0 @@
-
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.function;
-
-import org.wso2.siddhi.core.config.ExecutionPlanContext;
-import org.wso2.siddhi.core.executor.ExpressionExecutor;
-import org.wso2.siddhi.core.executor.function.FunctionExecutor;
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.GeoOperation;
-import org.wso2.siddhi.query.api.definition.Attribute.Type;
-
-public abstract class AbstractGeoOperationExecutor extends FunctionExecutor {
-
- GeoOperation geoOperation;
-
- /**
- * The initialization method for FunctionExecutor, this method will be called before the other methods
- *
- * @param attributeExpressionExecutors are the executors of each function parameters
- * @param executionPlanContext the context of the execution plan
- */
- @Override
- protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
- this.geoOperation.init(attributeExpressionExecutors, 0, attributeExpressionExecutors.length);
- }
- /**
- * The main executions method which will be called upon event arrival
- *
- * @param data the runtime values of the attributeExpressionExecutors
- * @return
- */
- @Override
- protected Object execute(Object[] data) {
- return geoOperation.process(data);
- }
-
- /**
- * The main execution method which will be called upon event arrival
- * which has zero or one function parameter
- *
- * @param data null if the function parameter count is zero or
- * runtime data value of the function parameter
- * @return the function result
- */
- @Override
- protected Object execute(Object data) {
- throw new IllegalStateException(this.getClass().getCanonicalName() + " cannot execute data " + data);
- }
-
- /**
- * This will be called only once, to acquire required resources
- * after initializing the system and before processing the events.
- */
- @Override
- public void start() {
-
- }
-
- /**
- * This will be called only once, to release the acquired resources
- * before shutting down the system.
- */
- @Override
- public void stop() {
-
- }
-
- /**
- * The serializable state of the element, that need to be
- * persisted for the reconstructing the element to the same state
- * on a different point of time
- *
- * @return stateful objects of the element as an array
- */
- @Override
- public Object[] currentState() {
- return new Object[0];
- }
-
- /**
- * The serialized state of the 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 element as an array on
- * the same order provided by currentState().
- */
- @Override
- public void restoreState(Object[] state) {
-
- }
-
- //TODO: look into cloning
-
-
- public Type getReturnType() {
- return geoOperation.getReturnType();
- }
-
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoDistanceFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoDistanceFunctionExecutor.java
deleted file mode 100644
index c7e45d5e5..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoDistanceFunctionExecutor.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.function;
-
-import org.wso2.siddhi.core.config.ExecutionPlanContext;
-import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException;
-import org.wso2.siddhi.core.executor.ExpressionExecutor;
-import org.wso2.siddhi.core.executor.function.FunctionExecutor;
-import org.wso2.siddhi.query.api.definition.Attribute;
-import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException;
-
-/**
- * geo:distance(location1Latitude, location1Longitude, location2Latitude, location2Longitude)
- *
- * This method gives the distance between two geo locations in meters
- *
- * location1Latitude - latitude value of 1st location
- * location1Longitude - longitude value of 1st location
- * location2Latitude - latitude value of 2nd location
- * location2Longitude - longitude value of 2nd location
- *
- * Accept Type(s) for geo:distance(location1Latitude, location1Longitude, location2Latitude, location2Longitude);
- * location1Latitude : DOUBLE
- * location1Longitude : DOUBLE
- * location2Latitude : DOUBLE
- * location2Longitude : DOUBLE
- *
- * Return Type(s): DOUBLE
- */
-public class GeoDistanceFunctionExecutor extends FunctionExecutor {
- Attribute.Type returnType = Attribute.Type.DOUBLE;
- @Override
- public void start() {
-
- }
-
- @Override
- public void stop() {
-
- }
-
- @Override
- public Object[] currentState() {
- return new Object[0];
- }
-
- @Override
- public void restoreState(Object[] state) {
-
- }
-
- @Override
- protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
- if (attributeExpressionExecutors.length != 4) {
- throw new ExecutionPlanValidationException("Invalid no of arguments passed to " +
- "geo:distance() function, " +
- "requires 4, but found " + attributeExpressionExecutors.length);
- }
- }
-
- @Override
- protected Object execute(Object[] data) {
- if (data[0] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:distance() " +
- "function. First argument should be double");
- }
- if (data[1] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:distance() " +
- "function. Second argument should be double");
- }
- if (data[2] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:distance() " +
- "function. Third argument should be double");
- }
- if (data[3] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:distance() " +
- "function. Fourth argument should be double");
- }
-
- double latitude = (Double) data[0];
- double longitude = (Double) data[1];
- double prevLatitude = (Double) data[2];
- double prevLongitude = (Double) data[3];
-
- int R = 6371000; // Radius of the earth in m
- latitude = latitude * (Math.PI / 180);
- prevLatitude = prevLatitude * (Math.PI / 180);
- longitude = longitude * (Math.PI / 180);
- prevLongitude = prevLongitude * (Math.PI / 180);
- double dlon = prevLongitude - longitude;
- double dlat = prevLatitude - latitude;
- double a = Math.sin(dlat / 2) * Math.sin(dlat / 2) + Math.cos(latitude) * Math.cos(prevLatitude) *
- Math.sin(dlon / 2) * Math.sin(dlon / 2);
- double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
- return R * c;
- }
-
- @Override
- protected Object execute(Object data) {
- return null;
- }
-
- @Override
- public Attribute.Type getReturnType() {
- return returnType;
- }
-
-}
\ No newline at end of file
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoIntersectsFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoIntersectsFunctionExecutor.java
deleted file mode 100644
index 01ec9a899..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoIntersectsFunctionExecutor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.function;
-
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.IntersectsOperation;
-
-public class GeoIntersectsFunctionExecutor extends AbstractGeoOperationExecutor {
- public GeoIntersectsFunctionExecutor(){
- this.geoOperation = new IntersectsOperation();
- }
-}
-
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoWithinDistanceFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoWithinDistanceFunctionExecutor.java
deleted file mode 100644
index 7d39ec37a..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoWithinDistanceFunctionExecutor.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.function;
-
-import org.wso2.siddhi.core.config.ExecutionPlanContext;
-import org.wso2.siddhi.core.exception.ExecutionPlanCreationException;
-import org.wso2.siddhi.core.executor.ExpressionExecutor;
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.WithinDistanceOperation;
-import org.wso2.siddhi.query.api.definition.Attribute;
-
-public class GeoWithinDistanceFunctionExecutor extends AbstractGeoOperationExecutor {
- public GeoWithinDistanceFunctionExecutor() {
- this.geoOperation = new WithinDistanceOperation();
- }
- /**
- * The initialization method for FunctionExecutor, this method will be called before the other methods
- *
- * @param attributeExpressionExecutors are the executors of each function parameters
- * @param executionPlanContext the context of the execution plan
- */
- @Override
- protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
- this.geoOperation.init(attributeExpressionExecutors, 0, attributeExpressionExecutors.length);
- if (attributeExpressionExecutors[attributeExpressionExecutors.length - 1].getReturnType() != Attribute.Type.DOUBLE) {
- throw new ExecutionPlanCreationException("Last argument should be a double");
- }
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoWithinFunctionExecutor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoWithinFunctionExecutor.java
deleted file mode 100644
index 8ef2cb92c..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/function/GeoWithinFunctionExecutor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.function;
-
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.WithinOperation;
-
-public class GeoWithinFunctionExecutor extends AbstractGeoOperationExecutor {
- public GeoWithinFunctionExecutor() {
- this.geoOperation = new WithinOperation();
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/ClosestOperation.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/ClosestOperation.java
deleted file mode 100644
index 70f97c9cb..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/ClosestOperation.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.internal.util;
-
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.prep.PreparedGeometry;
-import com.vividsolutions.jts.operation.distance.DistanceOp;
-import org.wso2.siddhi.query.api.definition.Attribute;
-
-public class ClosestOperation extends org.wso2.gpl.siddhi.extensions.geo.internal.util.GeoOperation {
- @Override
- public Object operation(Geometry a, Geometry b, Object[] data) {
- DistanceOp distOp = new DistanceOp(a, b);
- return distOp.nearestPoints();
- }
-
- @Override
- public Object operation(Geometry a, PreparedGeometry b, Object[] data) {
- DistanceOp distOp = new DistanceOp(a, b.getGeometry());
- return distOp.nearestPoints();
- }
-
- @Override
- public Attribute.Type getReturnType() {
- return null;
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/GeoOperation.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/GeoOperation.java
deleted file mode 100644
index 544c05e15..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/GeoOperation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.internal.util;
-
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.prep.PreparedGeometry;
-import org.wso2.siddhi.core.exception.ExecutionPlanCreationException;
-import org.wso2.siddhi.core.executor.ConstantExpressionExecutor;
-import org.wso2.siddhi.core.executor.ExpressionExecutor;
-import org.wso2.siddhi.query.api.definition.Attribute;
-
-public abstract class GeoOperation {
- public boolean point = false;
- protected Object data;
- public PreparedGeometry geometry = null;
-
- public void init(ExpressionExecutor[] attributeExpressionExecutors, int start, int end) {
- int position = start;
- if (attributeExpressionExecutors[position].getReturnType() == Attribute.Type.DOUBLE) {
- point = true;
- if (attributeExpressionExecutors[position + 1].getReturnType() != Attribute.Type.DOUBLE) {
- throw new ExecutionPlanCreationException("Longitude and Latitude must be provided as double values");
- }
- ++position;
- } else if (attributeExpressionExecutors[position].getReturnType() == Attribute.Type.STRING) {
- point = false;
- } else {
- throw new ExecutionPlanCreationException((position + 1) +
- " parameter should be a string for a geometry or a double for a latitude");
- }
- ++position;
- if (position >= end) {
- return;
- }
- if (attributeExpressionExecutors[position].getReturnType() != Attribute.Type.STRING) {
- throw new ExecutionPlanCreationException((position + 1) + " parameter should be a GeoJSON geometry string");
- }
- if (attributeExpressionExecutors[position] instanceof ConstantExpressionExecutor) {
- String strGeometry = attributeExpressionExecutors[position].execute(null).toString();
- geometry = GeometryUtils.preparedGeometryFromJSON(strGeometry);
- }
- }
-
- public Object process(Object[] data) {
- Geometry currentGeometry;
- if (point) {
- double longitude = (Double) data[0];
- double latitude = (Double) data[1];
- currentGeometry = GeometryUtils.createPoint(longitude, latitude);
- } else {
- currentGeometry = GeometryUtils.geometryFromJSON(data[0].toString());
- }
- if (geometry != null) {
- return operation(currentGeometry, geometry, data);
- } else {
- return operation(currentGeometry, GeometryUtils.geometryFromJSON(data[point ? 2 : 1].toString()),
- data);
- }
- }
-
- public Geometry getCurrentGeometry(Object[] data) {
- if (point) {
- double longitude = (Double) data[0];
- double latitude = (Double) data[1];
- return GeometryUtils.createPoint(longitude, latitude);
- } else {
- return GeometryUtils.createGeometry(data[0]);
- }
- }
-
- public abstract Object operation(Geometry a, Geometry b, Object[] data);
-
- public abstract Object operation(Geometry a, PreparedGeometry b, Object[] data);
-
- public abstract Attribute.Type getReturnType();
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/GeometryUtils.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/GeometryUtils.java
deleted file mode 100644
index c6a102999..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/GeometryUtils.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.internal.util;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.vividsolutions.jts.geom.Coordinate;
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.GeometryFactory;
-import com.vividsolutions.jts.geom.Point;
-import com.vividsolutions.jts.geom.prep.PreparedGeometry;
-import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
-import org.geotools.geojson.geom.GeometryJSON;
-import org.geotools.geometry.jts.JTSFactoryFinder;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-public class GeometryUtils {
-
- public static final double TO_DEGREE = 110574.61087757687;
- private static final String COORDINATES = "coordinates";
- private static final String RADIUS = "radius";
- private static GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
- //JTSFactoryFinder.getGeometryFactory(new Hints(Hints.CRS, DefaultGeographicCRS.WGS84));
- private static GeometryJSON geometryJSON = new GeometryJSON(10);
-
- public static Geometry geometryFromJSON(String strGeometry) {
- if (strGeometry.contains(RADIUS)) {
- JsonObject jsonObject = new JsonParser().parse(strGeometry).getAsJsonObject();
- JsonArray jLocCoordinatesArray = jsonObject.getAsJsonArray(COORDINATES);
- Coordinate coords = new Coordinate(Double.parseDouble(jLocCoordinatesArray.get(0)
- .toString()), Double.parseDouble(jLocCoordinatesArray.get(1).toString()));
- Point point = geometryFactory.createPoint(coords); // create the points for GeoJSON file points
- double radius = Double.parseDouble(jsonObject.get(RADIUS).toString()) / TO_DEGREE; //convert to degrees
- return point.buffer(radius); //draw the buffer
- } else {
- try {
- return geometryJSON.read(strGeometry.replace("'", "\""));
- } catch (IOException e) {
- throw new RuntimeException("Failed to create a geometry from given str " + strGeometry, e);
- }
- }
- }
-
- public static String geometrytoJSON(Geometry geometry) {
- StringWriter sw = new StringWriter();
- try {
- geometryJSON.write(geometry, sw);
- } catch (IOException e) {
- throw new RuntimeException("Failed to create a json string from given geometry " + geometry, e);
- }
- return sw.toString();
- }
-
- public static PreparedGeometry preparedGeometryFromJSON(String strGeometry) {
- return PreparedGeometryFactory.prepare(geometryFromJSON(strGeometry));
- }
- public static Point createPoint(double longitude, double latitude) {
- return geometryFactory.createPoint(new Coordinate(longitude, latitude));
- }
- public static Geometry createGeometry(Object data){
- if(data instanceof Geometry) {
- return (Geometry) data;
- }
- else {
- return geometryFromJSON(data.toString());
- }
- }
-}
\ No newline at end of file
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/IntersectsOperation.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/IntersectsOperation.java
deleted file mode 100644
index 561757360..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/IntersectsOperation.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.internal.util;
-
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.prep.PreparedGeometry;
-import org.wso2.siddhi.query.api.definition.Attribute;
-
-public class IntersectsOperation extends GeoOperation {
- @Override
- public Object operation(Geometry a, Geometry b, Object[] data) {
- return a.intersects(b);
- }
-
- @Override
- public Object operation(Geometry a, PreparedGeometry b, Object[] data) {
- return b.intersects(a);
- }
-
- @Override
- public Attribute.Type getReturnType() {
- return Attribute.Type.BOOL;
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/WithinDistanceOperation.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/WithinDistanceOperation.java
deleted file mode 100644
index 7aa988bdc..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/WithinDistanceOperation.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.internal.util;
-
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.prep.PreparedGeometry;
-import org.wso2.siddhi.query.api.definition.Attribute;
-
-public class WithinDistanceOperation extends GeoOperation {
- @Override
- public Object operation(Geometry a, Geometry b, Object[] data) {
- return a.isWithinDistance(b, (Double) data[data.length - 1] / GeometryUtils.TO_DEGREE);
- }
-
- @Override
- public Object operation(Geometry a, PreparedGeometry b, Object[] data) {
- return a.isWithinDistance(b.getGeometry(), (Double) data[data.length - 1] / GeometryUtils.TO_DEGREE);
- }
-
- @Override
- public Attribute.Type getReturnType() {
- return Attribute.Type.BOOL;
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/WithinOperation.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/WithinOperation.java
deleted file mode 100644
index 4ef44b183..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/internal/util/WithinOperation.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.internal.util;
-
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.prep.PreparedGeometry;
-import org.wso2.siddhi.query.api.definition.Attribute;
-
-public class WithinOperation extends GeoOperation {
- @Override
- public Object operation(Geometry a, Geometry b, Object[] data) {
- return a.within(b);
- }
-
- @Override
- public Object operation(Geometry a, PreparedGeometry b, Object[] data) {
- return b.contains(a);
- }
-
- @Override
- public Attribute.Type getReturnType() {
- return Attribute.Type.BOOL;
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoCrossesStreamProcessor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoCrossesStreamProcessor.java
deleted file mode 100644
index ab429b36e..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoCrossesStreamProcessor.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.stream;
-
-import org.wso2.siddhi.core.config.ExecutionPlanContext;
-import org.wso2.siddhi.core.event.ComplexEvent;
-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.ExpressionExecutor;
-import org.wso2.siddhi.core.query.processor.Processor;
-import org.wso2.siddhi.core.query.processor.stream.StreamProcessor;
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.GeoOperation;
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.WithinOperation;
-import org.wso2.siddhi.query.api.definition.AbstractDefinition;
-import org.wso2.siddhi.query.api.definition.Attribute;
-import org.wso2.siddhi.query.api.definition.Attribute.Type;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class GeoCrossesStreamProcessor extends StreamProcessor {
-
- private GeoOperation geoOperation;
- private Set set = Collections.newSetFromMap(new ConcurrentHashMap());
-
- /**
- * The init method of the StreamProcessor, this method will be called before other methods
- *
- * @param inputDefinition the incoming stream definition
- * @param attributeExpressionExecutors the executors of each function parameters
- * @param executionPlanContext the context of the execution plan
- * @return the additional output attributes introduced by the function
- */
- @Override
- protected List init(AbstractDefinition inputDefinition, ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
- geoOperation = new WithinOperation();
- geoOperation.init(attributeExpressionExecutors, 1, attributeExpressionLength);
- List attributeList = new ArrayList(1);
- attributeList.add(new Attribute("crosses", Type.BOOL));
- return attributeList;
- }
-
- /**
- * This will be called only once, to acquire required resources
- * after initializing the system and before processing the events.
- */
- @Override
- public void start() {
-
- }
-
- /**
- * This will be called only once, to release the acquired resources
- * before shutting down the system.
- */
- @Override
- public void stop() {
-
- }
-
- /**
- * The serializable state of the element, that need to be
- * persisted for the reconstructing the element to the same state
- * on a different point of time
- *
- * @return stateful objects of the element as an array
- */
- @Override
- public Object[] currentState() {
- return new Object[0];
- }
-
- /**
- * The serialized state of the 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 element as an array on
- * the same order provided by currentState().
- */
- @Override
- public void restoreState(Object[] state) {
-
- }
-
- @Override
- protected void process(ComplexEventChunk streamEventChunk, Processor nextProcessor, StreamEventCloner streamEventCloner, ComplexEventPopulater complexEventPopulater) {
- while (streamEventChunk.hasNext()) {
- ComplexEvent complexEvent = streamEventChunk.next();
-
- Object[] data = new Object[attributeExpressionLength - 1];
- for (int i = 1; i < attributeExpressionLength; i++) {
- data[i-1] = attributeExpressionExecutors[i].execute(complexEvent);
- }
- boolean within = (Boolean)geoOperation.process(data);
-
- String id = attributeExpressionExecutors[0].execute(complexEvent).toString();
- if (set.contains(id)) {
- if (!within) {
- //alert out
- complexEventPopulater.populateComplexEvent(complexEvent, new Object[]{within});
- set.remove(id);
- } else {
- streamEventChunk.remove();
- }
- } else {
- if (within) {
- //alert in
- complexEventPopulater.populateComplexEvent(complexEvent, new Object[]{within});
- set.add(id);
- } else {
- streamEventChunk.remove();
- }
- }
- }
- nextProcessor.process(streamEventChunk);
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoLocationApproximateStreamProcessor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoLocationApproximateStreamProcessor.java
deleted file mode 100644
index 52321260d..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoLocationApproximateStreamProcessor.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.stream;
-
-import org.wso2.siddhi.core.config.ExecutionPlanContext;
-import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException;
-import org.wso2.siddhi.core.executor.ExpressionExecutor;
-import org.wso2.siddhi.core.query.processor.stream.function.StreamFunctionProcessor;
-import org.wso2.siddhi.query.api.definition.AbstractDefinition;
-import org.wso2.siddhi.query.api.definition.Attribute;
-import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * geoLocationApproximate(locationRecorder, latitude, longitude, sensorProximity, sensorUUID, sensorWeight, timestamp)
- *
- * This method computed the average location of the locationRecorder using the collection iBeacons which the location
- * recorder resides.
- *
- * locationRecorder - unique id of the object or item
- * latitude - latitude value of the iBeacon
- * longitude - longitude value of the iBeacon
- * sensorProximity - proximity which will be given by the iBeacon (eg: ENTER, RANGE, EXIT)
- * sensorUUID - unique id of the iBeacon
- * sensorWeight - weight of the iBeacon which influence the averaging of the location (eg: approximate distance from
- * the beacon
- * timestamp - timestamp of the log which will be used to remove iBeacon from one's collection when there is no
- * new log for 5 minutes
- *
- * Accept Type(s) for geoLocationApproximate(locationRecorder, latitude, longitude, sensorProximity, sensorUUID,
- * sensorWeight, timestamp);
- * locationRecorder : STRING
- * latitude : DOUBLE
- * longitude : DOUBLE
- * sensorProximity : STRING
- * sensorUUID : STRING
- * sensorWeight : DOUBLE
- * timestamp : LONG
- *
- * Return Type(s): DOUBLE, DOUBLE, BOOL
- *
- */
-public class GeoLocationApproximateStreamProcessor extends StreamFunctionProcessor {
-
- //locationRecorder,uuid -> BeaconValueHolder
- private Map>
- personSpecificRecordLocatorMaps;
-
- @Override
- public void start() {
-
- }
-
- @Override
- public void stop() {
-
- }
-
- @Override
- public Object[] currentState() {
- return new Object[]{personSpecificRecordLocatorMaps};
- }
-
- @Override
- public void restoreState(Object[] state) {
- personSpecificRecordLocatorMaps = (Map>) state[0];
- }
-
- @Override
- protected Object[] process(Object[] data) {
- if (data[0] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:locationApproximate() " +
- "function. First argument should be string");
- }
- if (data[1] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:locationApproximate() " +
- "function. Second argument should be double");
- }
- if (data[2] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:locationApproximate() " +
- "function. Third argument should be double");
- }
- if (data[3] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:locationApproximate() " +
- "function. Forth argument should be string");
- }
- if (data[4] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:locationApproximate() " +
- "function. Fifth argument should be string");
- }
- if (data[5] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:locationApproximate() " +
- "function. Sixth argument should be double");
- }
- if (data[6] == null) {
- throw new ExecutionPlanRuntimeException("Invalid input given to geo:locationApproximate() " +
- "function. Seventh argument should be long");
- }
-
- String locationRecorder = (String) data[0];
- double latitude = (Double) data[1];
- double longitude = (Double) data[2];
- String beaconProximity = (String) data[3];
- String uuid = (String) data[4];
- double weight = (Double) data[5]; //is calculated previously eg: distance
- long timestamp = (Long) data[6];
-
- if (personSpecificRecordLocatorMaps.get(locationRecorder) == null) {
- personSpecificRecordLocatorMaps.put(locationRecorder, new ConcurrentHashMap());
- }
- //both "enter" and "range" attributes are there in the logs I retrieve when it comes to cleaning logs
- if ("ENTER".equalsIgnoreCase(beaconProximity) || "RANGE".equalsIgnoreCase(beaconProximity)) {
- if (personSpecificRecordLocatorMaps.get(locationRecorder).containsKey(uuid)) {
- BeaconValueHolder tempBeaconValue = personSpecificRecordLocatorMaps.get(locationRecorder).get(uuid);
- if (tempBeaconValue.getLastUpdatedTime() < timestamp) {
- BeaconValueHolder beaconValueHolder = new BeaconValueHolder(latitude, longitude, timestamp, weight);
- personSpecificRecordLocatorMaps.get(locationRecorder).put(uuid, beaconValueHolder);
- }
- } else {
- BeaconValueHolder beaconValueHolder = new BeaconValueHolder(latitude, longitude, timestamp, weight);
- personSpecificRecordLocatorMaps.get(locationRecorder).put(uuid, beaconValueHolder);
- }
- } else {
- if (personSpecificRecordLocatorMaps.get(locationRecorder).containsKey(uuid)) {
- BeaconValueHolder tempBeaconValue = personSpecificRecordLocatorMaps.get(locationRecorder).get(uuid);
- if (tempBeaconValue.getLastUpdatedTime() < timestamp) {
- personSpecificRecordLocatorMaps.get(locationRecorder).remove(uuid);
- }
- }
- }
-
- int noOfSensors = personSpecificRecordLocatorMaps.get(locationRecorder).size();
- double sensorValues[][] = new double[noOfSensors][3];
- int actualNoOfSensors = 0;
- double totalWeight = 0;
- for (Map.Entry beaconLocation : personSpecificRecordLocatorMaps.get(locationRecorder).entrySet()) {
- BeaconValueHolder beaconValueHolder = beaconLocation.getValue();
- long prevTimestamp = beaconValueHolder.getLastUpdatedTime();
- if ((timestamp - prevTimestamp) > 300000) {
- //if there is a beacon which has a log older than 5 minutes, removing the beacon assuming the
- //device has gone away from that beacon
- personSpecificRecordLocatorMaps.get(locationRecorder).remove(beaconLocation.getKey());
- } else {
- sensorValues[actualNoOfSensors][0] = beaconValueHolder.getLatitude();
- sensorValues[actualNoOfSensors][1] = beaconValueHolder.getLongitude();
- sensorValues[actualNoOfSensors][2] = beaconValueHolder.getBeaconDistance();
- totalWeight += beaconValueHolder.getBeaconDistance();
- actualNoOfSensors++;
- }
- }
- if (actualNoOfSensors == 0) {
- return new Object[]{latitude, longitude, false};
- }
-
- double tempLatitude, tempLongitude;
- double x = 0;
- double y = 0;
- double z = 0;
- for (int i = 0; i < actualNoOfSensors; i++) {
- weight = sensorValues[i][2] / totalWeight;
- tempLatitude = sensorValues[i][0] * Math.PI / 180.0;
- tempLongitude = sensorValues[i][1] * Math.PI / 180.0;
- x += Math.cos(tempLatitude) * Math.cos(tempLongitude) * weight;
- y += Math.cos(tempLatitude) * Math.sin(tempLongitude) * weight;
- z += Math.sin(tempLatitude) * weight;
- }
- longitude = Math.atan2(y, x) * 180 / Math.PI;
- double hyp = Math.sqrt(x * x + y * y);
- latitude = Math.atan2(z, hyp) * 180 / Math.PI;
-
- return new Object[]{latitude, longitude, true};
- }
-
- @Override
- protected Object[] process(Object data) {
- return new Object[0];
- }
-
- @Override
- protected List init(AbstractDefinition inputDefinition,
- ExpressionExecutor[] attributeExpressionExecutors,
- ExecutionPlanContext executionPlanContext) {
- personSpecificRecordLocatorMaps = new ConcurrentHashMap>();
- if (attributeExpressionExecutors.length != 7) {
- throw new ExecutionPlanValidationException("Invalid no of arguments passed to " +
- "geo:locationApproximate() function, " +
- "requires 7, but found " + attributeExpressionExecutors.length);
- }
- ArrayList attributes = new ArrayList(3);
- attributes.add(new Attribute("averagedLatitude", Attribute.Type.DOUBLE));
- attributes.add(new Attribute("averagedLongitude", Attribute.Type.DOUBLE));
- attributes.add(new Attribute("averageExist", Attribute.Type.BOOL));
- return attributes;
- }
-
- private class BeaconValueHolder {
- private double latitude;
- private double longitude;
- private long lastUpdatedTime;
- private double beaconDistance;
-
- public BeaconValueHolder(double latitude, double longitude, long lastUpdatedTime, double
- beaconDistance) {
- this.latitude = latitude;
- this.longitude = longitude;
- this.lastUpdatedTime = lastUpdatedTime;
- this.beaconDistance = beaconDistance;
- }
-
- public long getLastUpdatedTime() {
- return lastUpdatedTime;
- }
-
- public double getBeaconDistance() {
- return beaconDistance;
- }
-
- public double getLatitude() {
- return latitude;
- }
-
- public double getLongitude() {
- return longitude;
- }
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoProximityStreamProcessor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoProximityStreamProcessor.java
deleted file mode 100644
index 60123f03e..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoProximityStreamProcessor.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.stream;
-
-import com.vividsolutions.jts.geom.Geometry;
-import org.wso2.siddhi.core.config.ExecutionPlanContext;
-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.ExecutionPlanCreationException;
-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.gpl.siddhi.extensions.geo.internal.util.GeoOperation;
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.WithinDistanceOperation;
-import org.wso2.siddhi.query.api.definition.AbstractDefinition;
-import org.wso2.siddhi.query.api.definition.Attribute;
-import org.wso2.siddhi.query.api.definition.Attribute.Type;
-
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class GeoProximityStreamProcessor extends StreamProcessor {
-
- private GeoOperation geoOperation;
- private double radius;
- private ConcurrentHashMap map = new ConcurrentHashMap();
- private Set set = Collections.newSetFromMap(new ConcurrentHashMap());
-
- /**
- * The init method of the StreamProcessor, this method will be called before other methods
- *
- * @param inputDefinition the incoming stream definition
- * @param attributeExpressionExecutors the executors of each function parameters
- * @param executionPlanContext the context of the execution plan
- * @return the additional output attributes introduced by the function
- */
- @Override
- protected List init(AbstractDefinition inputDefinition, ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
- this.geoOperation = new WithinDistanceOperation();
- this.geoOperation.init(attributeExpressionExecutors, 1, attributeExpressionLength - 1);
- if (attributeExpressionExecutors[attributeExpressionLength - 1].getReturnType() != Type.DOUBLE) {
- throw new ExecutionPlanCreationException("Last parameter should be a double");
- }
- radius = (Double) attributeExpressionExecutors[attributeExpressionLength - 1].execute(null);
- ArrayList attributeList = new ArrayList();
- attributeList.add(new Attribute("proximityWith", Type.STRING));
- attributeList.add(new Attribute("inCloseProximity", Type.BOOL));
- return attributeList;
- }
-
- /**
- * This will be called only once, to acquire required resources
- * after initializing the system and before processing the events.
- */
- @Override
- public void start() {
-
- }
-
- /**
- * This will be called only once, to release the acquired resources
- * before shutting down the system.
- */
- @Override
- public void stop() {
-
- }
-
- /**
- * The serializable state of the element, that need to be
- * persisted for the reconstructing the element to the same state
- * on a different point of time
- *
- * @return stateful objects of the element as an array
- */
- @Override
- public Object[] currentState() {
- return new Object[0];
- }
-
- /**
- * The serialized state of the 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 element as an array on
- * the same order provided by currentState().
- */
- @Override
- public void restoreState(Object[] state) {
-
- }
-
- /**
- * The main processing method that will be called upon event arrival
- *
- * @param streamEventChunk the event chunk that need to be processed
- * @param nextProcessor the next processor to which the success events need to be passed
- * @param streamEventCloner helps to clone the incoming event for local storage or modification
- * @param complexEventPopulater helps to populate the events with the resultant attributes
- */
- @Override
- protected void process(ComplexEventChunk streamEventChunk, Processor nextProcessor, StreamEventCloner streamEventCloner, ComplexEventPopulater complexEventPopulater) {
- while (streamEventChunk.hasNext()) {
- StreamEvent streamEvent = streamEventChunk.next();
- Geometry currentGeometry, previousGeometry;
- Object[] data = new Object[attributeExpressionLength - 1];
- for (int i = 1; i < attributeExpressionLength; i++) {
- data[i - 1] = attributeExpressionExecutors[i].execute(streamEvent);
- }
- String currentId = attributeExpressionExecutors[0].execute(streamEvent).toString();
- String previousId;
- currentGeometry = geoOperation.getCurrentGeometry(data);
- if(!map.contains(currentId)) {
- map.put(currentId, currentGeometry);
- }
- for (Map.Entry entry : map.entrySet()) {
- previousId = entry.getKey();
- if (!previousId.equals(currentId)) {
- previousGeometry = entry.getValue();
- boolean within = (Boolean) geoOperation.operation(currentGeometry, previousGeometry, new Object[]{radius});
- String key = makeCompositeKey(currentId, previousId);
- boolean contains = set.contains(key);
- if (contains) {
- if (!within) {
- //alert out
- StreamEvent newStreamEvent = streamEventCloner.copyStreamEvent(streamEvent);
- complexEventPopulater.populateComplexEvent(newStreamEvent, new Object[]{previousId, within});
- streamEventChunk.insertBeforeCurrent(newStreamEvent);
- set.remove(key);
- }
- } else {
- if (within) {
- //alert in
- StreamEvent newStreamEvent = streamEventCloner.copyStreamEvent(streamEvent);
- complexEventPopulater.populateComplexEvent(newStreamEvent, new Object[]{previousId, within});
- streamEventChunk.insertBeforeCurrent(newStreamEvent);
- set.add(key);
- }
- }
- }
- }
- streamEventChunk.remove();
- }
- nextProcessor.process(streamEventChunk);
- }
-/*
- private Object[] toOutput(Geometry geometry, boolean within) {
- if (geoOperation.point) {
- return new Object[]{((Point) geometry).getX(), ((Point) geometry).getY(), within};
- } else {
- return new Object[]{GeometryUtils.geometrytoJSON(geometry), within};
- }
- }*/
- public String makeCompositeKey(String key1, String key2) {
- if (key1.compareToIgnoreCase(key2) < 0) {
- return key1 + "~" + key2;
- } else {
- return key2 + "~" + key1;
- }
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoStationaryStreamProcessor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoStationaryStreamProcessor.java
deleted file mode 100644
index 7b2909d3a..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/GeoStationaryStreamProcessor.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.stream;
-
-import com.vividsolutions.jts.geom.Geometry;
-import org.wso2.siddhi.core.config.ExecutionPlanContext;
-import org.wso2.siddhi.core.event.ComplexEvent;
-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.ExecutionPlanCreationException;
-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.gpl.siddhi.extensions.geo.internal.util.GeoOperation;
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.WithinDistanceOperation;
-import org.wso2.siddhi.query.api.definition.AbstractDefinition;
-import org.wso2.siddhi.query.api.definition.Attribute;
-import org.wso2.siddhi.query.api.definition.Attribute.Type;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class GeoStationaryStreamProcessor extends StreamProcessor {
-
- private GeoOperation geoOperation;
- private double radius;
- private ConcurrentHashMap map = new ConcurrentHashMap();
-
- /**
- * The init method of the StreamProcessor, this method will be called before other methods
- *
- * @param inputDefinition the incoming stream definition
- * @param attributeExpressionExecutors the executors of each function parameters
- * @param executionPlanContext the context of the execution plan
- * @return the additional output attributes introduced by the function
- */
- @Override
- protected List init(AbstractDefinition inputDefinition, ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
- geoOperation = new WithinDistanceOperation();
- geoOperation.init(attributeExpressionExecutors, 1, attributeExpressionLength - 1);
- if (attributeExpressionExecutors[attributeExpressionLength - 1].getReturnType() != Type.DOUBLE) {
- throw new ExecutionPlanCreationException("Last parameter should be a double");
- }
- radius = (Double) attributeExpressionExecutors[attributeExpressionLength - 1].execute(null);
- ArrayList attributeList = new ArrayList(1);
- attributeList.add(new Attribute("stationary", Type.BOOL));
- return attributeList;
- }
-
- /**
- * This will be called only once, to acquire required resources
- * after initializing the system and before processing the events.
- */
- @Override
- public void start() {
-
- }
-
- /**
- * This will be called only once, to release the acquired resources
- * before shutting down the system.
- */
- @Override
- public void stop() {
-
- }
-
- /**
- * The serializable state of the element, that need to be
- * persisted for the reconstructing the element to the same state
- * on a different point of time
- *
- * @return stateful objects of the element as an array
- */
- @Override
- public Object[] currentState() {
- return new Object[0];
- }
-
- /**
- * The serialized state of the 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 element as an array on
- * the same order provided by currentState().
- */
- @Override
- public void restoreState(Object[] state) {
-
- }
-
- @Override
- protected void process(ComplexEventChunk streamEventChunk, Processor nextProcessor, StreamEventCloner streamEventCloner, ComplexEventPopulater complexEventPopulater) {
- while (streamEventChunk.hasNext()) {
- ComplexEvent complexEvent = streamEventChunk.next();
-
- Object[] data = new Object[attributeExpressionLength - 1];
- for (int i = 1; i < attributeExpressionLength; i++) {
- data[i - 1] = attributeExpressionExecutors[i].execute(complexEvent);
- }
- Geometry currentGeometry = geoOperation.getCurrentGeometry(data);
- String id = attributeExpressionExecutors[0].execute(complexEvent).toString();
- Geometry previousGeometry = map.get(id);
- if (previousGeometry == null) {
- currentGeometry.setUserData(false);
- map.put(id, currentGeometry);
- streamEventChunk.remove();
- continue;
- }
- boolean stationary = (Boolean) geoOperation.operation(currentGeometry, previousGeometry, new Object[]{radius});
-
- if((Boolean)previousGeometry.getUserData()) {
- if(!stationary) {
- //alert out
- complexEventPopulater.populateComplexEvent(complexEvent, new Object[]{stationary});
- currentGeometry.setUserData(stationary);
- map.put(id, currentGeometry);
- } else {
- streamEventChunk.remove();
- }
- } else {
- if (stationary) {
- //alert in
- previousGeometry.setUserData(stationary);
- complexEventPopulater.populateComplexEvent(complexEvent, new Object[]{stationary});
- } else {
- currentGeometry.setUserData(stationary);
- map.put(id, currentGeometry);
- streamEventChunk.remove();
- }
- }
- }
- nextProcessor.process(streamEventChunk);
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/function/GeoClosestPointsStreamFunctionProcessor.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/function/GeoClosestPointsStreamFunctionProcessor.java
deleted file mode 100644
index 8dce79f73..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/java/org/wso2/gpl/siddhi/extensions/geo/stream/function/GeoClosestPointsStreamFunctionProcessor.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.gpl.siddhi.extensions.geo.stream.function;
-
-import com.vividsolutions.jts.geom.Coordinate;
-import org.wso2.siddhi.core.config.ExecutionPlanContext;
-import org.wso2.siddhi.core.executor.ExpressionExecutor;
-import org.wso2.siddhi.core.query.processor.stream.function.StreamFunctionProcessor;
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.ClosestOperation;
-import org.wso2.gpl.siddhi.extensions.geo.internal.util.GeoOperation;
-import org.wso2.siddhi.query.api.definition.AbstractDefinition;
-import org.wso2.siddhi.query.api.definition.Attribute;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class GeoClosestPointsStreamFunctionProcessor extends StreamFunctionProcessor {
-
- GeoOperation geoOperation;
-
- @Override
- protected List init(AbstractDefinition abstractDefinition, ExpressionExecutor[] expressionExecutors, ExecutionPlanContext executionPlanContext) {
- this.geoOperation = new ClosestOperation();
- this.geoOperation.init(attributeExpressionExecutors, 0, attributeExpressionExecutors.length);
- List attributeList = new ArrayList(4);
- attributeList.add(new Attribute("closestPointOf1From2Latitude", Attribute.Type.DOUBLE));
- attributeList.add(new Attribute("closestPointOf1From2Longitude", Attribute.Type.DOUBLE));
- attributeList.add(new Attribute("closestPointOf2From1Latitude", Attribute.Type.DOUBLE));
- attributeList.add(new Attribute("closestPointOf2From1Longitude", Attribute.Type.DOUBLE));
- return attributeList;
- }
-
- @Override
- protected Object[] process(Object[] data) {
- Coordinate[] coordinates = (Coordinate[]) geoOperation.process(data);
-
- return new Object[]{coordinates[0].x, coordinates[0].y, coordinates[1].x, coordinates[1].y};
- }
-
- @Override
- protected Object[] process(Object o) {
- return null;
- }
-
- @Override
- public void start() {
-
- }
-
- @Override
- public void stop() {
-
- }
-
- @Override
- public Object[] currentState() {
- return new Object[0];
- }
-
- @Override
- public void restoreState(Object[] objects) {
-
- }
-}
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/resources/geo.siddhiext b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/resources/geo.siddhiext
deleted file mode 100644
index 679e72f10..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/main/resources/geo.siddhiext
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Copyright (C) 2015-2016 WSO2 Inc. (http://wso2.com)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-#
-
-within=org.wso2.gpl.siddhi.extensions.geo.function.GeoWithinFunctionExecutor
-intersects=org.wso2.gpl.siddhi.extensions.geo.function.GeoIntersectsFunctionExecutor
-withinDistance=org.wso2.gpl.siddhi.extensions.geo.function.GeoWithinDistanceFunctionExecutor
-crosses=org.wso2.gpl.siddhi.extensions.geo.stream.GeoCrossesStreamProcessor
-proximity=org.wso2.gpl.siddhi.extensions.geo.stream.GeoProximityStreamProcessor
-stationary=org.wso2.gpl.siddhi.extensions.geo.stream.GeoStationaryStreamProcessor
-closestPoints=org.wso2.gpl.siddhi.extensions.geo.stream.function.GeoClosestPointsStreamFunctionProcessor
-locationApproximate=org.wso2.gpl.siddhi.extensions.geo.stream.GeoLocationApproximateStreamProcessor
-distance=org.wso2.gpl.siddhi.extensions.geo.function.GeoDistanceFunctionExecutor
diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/test/java/org/wso2/gpl/siddhi/extensions/geo/GeoTestCase.java b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/test/java/org/wso2/gpl/siddhi/extensions/geo/GeoTestCase.java
deleted file mode 100644
index b55ee235a..000000000
--- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/src/main/resources/scripts/gpl-siddhi-geo-extention/org.wso2.gpl.siddhi.extension.geo.plugin/src/test/java/org/wso2/gpl/siddhi/extensions/geo/GeoTestCase.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.wso2.gpl.siddhi.extensions.geo;
-
-import org.apache.log4j.Logger;
-import org.junit.BeforeClass;
-import org.wso2.siddhi.core.ExecutionPlanRuntime;
-import org.wso2.siddhi.core.SiddhiManager;
-import org.wso2.siddhi.core.stream.input.InputHandler;
-
-import java.util.ArrayList;
-
-public abstract class GeoTestCase {
- protected static SiddhiManager siddhiManager;
- private static Logger logger = Logger.getLogger(GeoTestCase.class);
- protected static ArrayList