From aea0caf6f3bd0ba380c926ea6dcc459e2da165f7 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 18:33:39 +0100 Subject: [PATCH] Remove unused code, config and pom.xml configuration --- checkstyle-suppressions.xml | 47 - coverage-reports/pom.xml | 83 -- findbugs-exclude.xml | 211 ----- issue_template.md | 18 - modules/siddhi-annotations/pom.xml | 5 - modules/siddhi-core/pom.xml | 9 - .../siddhi-core/siddhi-core-doc-gen/pom.xml | 134 --- modules/siddhi-doc-gen/pom.xml | 92 -- .../gen/commons/metadata/ExampleMetaData.java | 42 - .../commons/metadata/ExtensionMetaData.java | 170 ---- .../gen/commons/metadata/ExtensionType.java | 96 -- .../commons/metadata/NamespaceMetaData.java | 104 --- .../commons/metadata/ParameterMetaData.java | 82 -- .../metadata/ReturnAttributeMetaData.java | 55 -- .../metadata/SystemParameterMetaData.java | 62 -- .../core/ExtensionsIndexGenerationMojo.java | 110 --- .../MarkdownDocumentationGenerationMojo.java | 167 ---- .../gen/core/MkdocsGitHubPagesDeployMojo.java | 202 ----- .../freemarker/FormatDescriptionMethod.java | 121 --- .../siddhi/doc/gen/core/utils/Constants.java | 102 --- .../gen/core/utils/DocumentationUtils.java | 842 ------------------ .../resources/templates/documentation.md.ftl | 147 --- .../resources/templates/extensions.md.ftl | 38 - .../templates/headings-update.md.ftl | 57 -- .../src/main/resources/templates/utils.ftl | 30 - modules/siddhi-query-api/pom.xml | 9 - modules/siddhi-query-compiler/pom.xml | 8 - .../performance-samples/build.xml | 78 -- .../performance-samples/pom.xml | 64 -- .../performance-samples/readme.txt | 8 - .../NoIndexingTablePerformance.java | 192 ---- .../performance/PartitionPerformance.java | 64 -- .../SimpleFilterMultipleQueryPerformance.java | 109 --- ...MultipleQueryWithDisruptorPerformance.java | 109 --- .../SimpleFilterSingleQueryPerformance.java | 77 -- ...erSingleQueryWithDisruptorPerformance.java | 80 -- .../SimpleFilterSyncPerformance.java | 124 --- .../src/main/resources/log4j.properties | 31 - modules/siddhi-samples/pom.xml | 110 --- .../quick-start-samples/build.xml | 77 -- .../quick-start-samples/pom.xml | 65 -- .../quick-start-samples/readme.txt | 9 - .../wso2/siddhi/sample/ExtensionSample.java | 76 -- .../wso2/siddhi/sample/FunctionSample.java | 73 -- .../wso2/siddhi/sample/PartitionSample.java | 77 -- .../siddhi/sample/SimpleFilterSample.java | 75 -- .../wso2/siddhi/sample/TimeWindowSample.java | 89 -- .../sample/util/CustomFunctionExtension.java | 126 --- .../src/main/resources/log4j.properties | 31 - modules/siddhi-service/netty-transports.yml | 27 - modules/siddhi-service/pom.xml | 228 ----- .../wso2/siddhi/service/api/ApiException.java | 32 - .../siddhi/service/api/ApiOriginFilter.java | 44 - .../service/api/ApiResponseMessage.java | 87 -- .../wso2/siddhi/service/api/Application.java | 30 - .../service/api/JacksonJsonProvider.java | 43 - .../siddhi/service/api/NotFoundException.java | 33 - .../siddhi/service/api/RFC3339DateFormat.java | 36 - .../wso2/siddhi/service/api/SiddhiApi.java | 67 -- .../siddhi/service/api/SiddhiApiService.java | 29 - .../wso2/siddhi/service/api/StringUtil.java | 65 -- .../org/wso2/siddhi/service/model/Error.java | 139 --- .../wso2/siddhi/service/model/Success.java | 141 --- modules/siddhi-service/src/main/bin.xml | 56 -- .../factories/SiddhiApiServiceFactory.java | 32 - .../service/impl/SiddhiApiServiceImpl.java | 128 --- .../siddhi/service/util/ServiceResponse.java | 47 - .../service/util/SiddhiAppConfiguration.java | 77 -- .../service/util/SiddhiServiceConstants.java | 35 - .../src/main/resources/dependencies/Readme | 1 - .../src/main/resources/startup.sh | 24 - .../siddhi/service/SiddhiApiTestCase.java | 56 -- .../src/test/resources/log4j.properties | 31 - .../src/test/resources/testng.xml | 28 - pom.xml | 199 +---- pull_request_template.md | 52 -- 76 files changed, 8 insertions(+), 6546 deletions(-) delete mode 100644 checkstyle-suppressions.xml delete mode 100644 coverage-reports/pom.xml delete mode 100644 findbugs-exclude.xml delete mode 100644 issue_template.md delete mode 100644 modules/siddhi-core/siddhi-core-doc-gen/pom.xml delete mode 100644 modules/siddhi-doc-gen/pom.xml delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExampleMetaData.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExtensionMetaData.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExtensionType.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/NamespaceMetaData.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ParameterMetaData.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ReturnAttributeMetaData.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/SystemParameterMetaData.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/ExtensionsIndexGenerationMojo.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/MarkdownDocumentationGenerationMojo.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/MkdocsGitHubPagesDeployMojo.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/freemarker/FormatDescriptionMethod.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/utils/Constants.java delete mode 100644 modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/utils/DocumentationUtils.java delete mode 100755 modules/siddhi-doc-gen/src/main/resources/templates/documentation.md.ftl delete mode 100644 modules/siddhi-doc-gen/src/main/resources/templates/extensions.md.ftl delete mode 100644 modules/siddhi-doc-gen/src/main/resources/templates/headings-update.md.ftl delete mode 100644 modules/siddhi-doc-gen/src/main/resources/templates/utils.ftl delete mode 100644 modules/siddhi-samples/performance-samples/build.xml delete mode 100644 modules/siddhi-samples/performance-samples/pom.xml delete mode 100644 modules/siddhi-samples/performance-samples/readme.txt delete mode 100644 modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/NoIndexingTablePerformance.java delete mode 100644 modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/PartitionPerformance.java delete mode 100644 modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterMultipleQueryPerformance.java delete mode 100644 modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterMultipleQueryWithDisruptorPerformance.java delete mode 100644 modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSingleQueryPerformance.java delete mode 100644 modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSingleQueryWithDisruptorPerformance.java delete mode 100644 modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSyncPerformance.java delete mode 100644 modules/siddhi-samples/performance-samples/src/main/resources/log4j.properties delete mode 100644 modules/siddhi-samples/pom.xml delete mode 100644 modules/siddhi-samples/quick-start-samples/build.xml delete mode 100644 modules/siddhi-samples/quick-start-samples/pom.xml delete mode 100644 modules/siddhi-samples/quick-start-samples/readme.txt delete mode 100644 modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/ExtensionSample.java delete mode 100644 modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/FunctionSample.java delete mode 100644 modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/PartitionSample.java delete mode 100644 modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/SimpleFilterSample.java delete mode 100644 modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/TimeWindowSample.java delete mode 100644 modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/util/CustomFunctionExtension.java delete mode 100644 modules/siddhi-samples/quick-start-samples/src/main/resources/log4j.properties delete mode 100644 modules/siddhi-service/netty-transports.yml delete mode 100644 modules/siddhi-service/pom.xml delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiException.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiOriginFilter.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiResponseMessage.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/Application.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/JacksonJsonProvider.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/NotFoundException.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/RFC3339DateFormat.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/SiddhiApi.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/SiddhiApiService.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/StringUtil.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/model/Error.java delete mode 100644 modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/model/Success.java delete mode 100644 modules/siddhi-service/src/main/bin.xml delete mode 100644 modules/siddhi-service/src/main/java/org/wso2/siddhi/service/factories/SiddhiApiServiceFactory.java delete mode 100644 modules/siddhi-service/src/main/java/org/wso2/siddhi/service/impl/SiddhiApiServiceImpl.java delete mode 100644 modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/ServiceResponse.java delete mode 100644 modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/SiddhiAppConfiguration.java delete mode 100644 modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/SiddhiServiceConstants.java delete mode 100644 modules/siddhi-service/src/main/resources/dependencies/Readme delete mode 100644 modules/siddhi-service/src/main/resources/startup.sh delete mode 100644 modules/siddhi-service/src/test/java/org/wso2/siddhi/service/SiddhiApiTestCase.java delete mode 100644 modules/siddhi-service/src/test/resources/log4j.properties delete mode 100644 modules/siddhi-service/src/test/resources/testng.xml delete mode 100644 pull_request_template.md diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml deleted file mode 100644 index 151c4837c5..0000000000 --- a/checkstyle-suppressions.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/coverage-reports/pom.xml b/coverage-reports/pom.xml deleted file mode 100644 index 762d74e960..0000000000 --- a/coverage-reports/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - org.graylog.repackaged.siddhi - siddhi - 4.5.11 - ../pom.xml - - - 4.0.0 - coverage-reports - Siddhi Tests Coverage Report Aggregation - pom - - - - org.graylog.repackaged.siddhi - siddhi-core - - - org.graylog.repackaged.siddhi - siddhi-query-api - - - org.graylog.repackaged.siddhi - siddhi-query-compiler - - - - - src - - - org.jacoco - jacoco-maven-plugin - ${org.jacoco.version} - - - report-aggregate - prepare-package - - report-aggregate - - - Siddhi Test Coverage -
Code Coverage Report for Siddhi ${project.version}
- - **/*.class - - - **/*Constants.class - **/*Exception.class - **/SiddhiQLBaseVisitor.class - **/SiddhiQLParser* - **/SiddhiQLLexer* - -
-
-
-
-
-
-
- diff --git a/findbugs-exclude.xml b/findbugs-exclude.xml deleted file mode 100644 index a234ff78eb..0000000000 --- a/findbugs-exclude.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/issue_template.md b/issue_template.md deleted file mode 100644 index 757e13efe6..0000000000 --- a/issue_template.md +++ /dev/null @@ -1,18 +0,0 @@ -**Description:** - - -**Suggested Labels:** - - -**Suggested Assignees:** - - -**Affected Product Version:** - -**OS, DB, other environment details and versions:** - -**Steps to reproduce:** - - -**Related Issues:** - \ No newline at end of file diff --git a/modules/siddhi-annotations/pom.xml b/modules/siddhi-annotations/pom.xml index d266f438bf..130851c8a7 100644 --- a/modules/siddhi-annotations/pom.xml +++ b/modules/siddhi-annotations/pom.xml @@ -69,9 +69,4 @@ - - - ../../findbugs-exclude.xml - - \ No newline at end of file diff --git a/modules/siddhi-core/pom.xml b/modules/siddhi-core/pom.xml index fc75070b24..b467fdf915 100644 --- a/modules/siddhi-core/pom.xml +++ b/modules/siddhi-core/pom.xml @@ -126,15 +126,6 @@ - - org.jacoco - jacoco-maven-plugin - - - - ../../findbugs-exclude.xml - - diff --git a/modules/siddhi-core/siddhi-core-doc-gen/pom.xml b/modules/siddhi-core/siddhi-core-doc-gen/pom.xml deleted file mode 100644 index f1f7a907c0..0000000000 --- a/modules/siddhi-core/siddhi-core-doc-gen/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - siddhi - org.graylog.repackaged.siddhi - 4.5.11 - ../../../pom.xml - - 4.0.0 - siddhi-core-doc-gen - Siddhi Core Documentation Generation - - - - - org.graylog.repackaged.siddhi - siddhi-doc-gen - - - compile - - generate-md-docs - generate-extensions-index - - - - - ../target/ - - - siddhi-execution-string - siddhi-execution-math - siddhi-execution-time - siddhi-execution-streamingml - siddhi-execution-regex - siddhi-execution-markov - siddhi-execution-unique - siddhi-execution-map - siddhi-execution-unitconversion - siddhi-execution-extrema - siddhi-execution-timeseries - siddhi-execution-var - siddhi-execution-priority - siddhi-execution-reorder - siddhi-execution-sentiment - siddhi-execution-stats - siddhi-execution-geo - siddhi-execution-kalmanfilter - siddhi-execution-approximate - siddhi-execution-graph - siddhi-execution-tensorflow - siddhi-execution-env - siddhi-io-http - siddhi-io-kafka - siddhi-io-tcp - siddhi-io-wso2event - siddhi-io-email - siddhi-io-jms - siddhi-io-file - siddhi-io-rabbitmq - siddhi-io-mqtt - siddhi-io-websocket - siddhi-io-sqs - siddhi-io-twitter - siddhi-io-cdc - siddhi-io-prometheus - siddhi-map-json - siddhi-map-xml - siddhi-map-binary - siddhi-map-text - siddhi-map-wso2event - siddhi-map-keyvalue - siddhi-map-csv - siddhi-store-rdbms - siddhi-store-solr - siddhi-store-mongodb - siddhi-store-hbase - siddhi-store-redis - siddhi-store-cassandra - siddhi-script-js - siddhi-script-scala - - - siddhi-gpl-execution-pmml - siddhi-gpl-execution-geo - siddhi-gpl-execution-nlp - siddhi-gpl-execution-r - siddhi-gpl-execution-streamingml - siddhi-gpl-script-r - - - - - - - - - documentation-deploy - - - - org.graylog.repackaged.siddhi - siddhi-doc-gen - - - compile - - deploy-mkdocs-github-pages - - - - - - - - - diff --git a/modules/siddhi-doc-gen/pom.xml b/modules/siddhi-doc-gen/pom.xml deleted file mode 100644 index a09dcf5b47..0000000000 --- a/modules/siddhi-doc-gen/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - siddhi - org.graylog.repackaged.siddhi - 4.5.11 - ../../pom.xml - - 4.0.0 - siddhi-doc-gen - Siddhi Documentation Generator - maven-plugin - - - - org.graylog.repackaged.siddhi - siddhi-core - - - org.graylog.repackaged.siddhi - siddhi-annotations - - - org.apache.maven - maven-plugin-api - - - org.apache.maven.plugin-tools - maven-plugin-annotations - - - org.freemarker - freemarker-gae - - - org.yaml - snakeyaml - - - org.apache.maven - maven-core - - - org.apache.commons - commons-io - - - - - - - org.apache.maven.plugins - maven-plugin-plugin - 3.6.0 - - - true - - - - - mojo-descriptor - - descriptor - - - - - - - - ../../findbugs-exclude.xml - - - diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExampleMetaData.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExampleMetaData.java deleted file mode 100644 index effe249be5..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExampleMetaData.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.commons.metadata; - -/** - * POJO for holding example meta data - */ -public class ExampleMetaData { - private String syntax; - private String description; - - public String getSyntax() { - return syntax; - } - - public void setSyntax(String syntax) { - this.syntax = syntax; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExtensionMetaData.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExtensionMetaData.java deleted file mode 100644 index 206d4a1fae..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExtensionMetaData.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.commons.metadata; - -import java.util.List; - -/** - * POJO for holding extension meta data - */ -public class ExtensionMetaData implements Comparable { - private String name; - private String namespace; - private String description; - private List parameters; - private List systemParameters; - private List returnAttributes; - private List examples; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getParameters() { - return parameters; - } - - public void setParameters(List parameters) { - this.parameters = parameters; - } - - public List getSystemParameters() { - return systemParameters; - } - - public void setSystemParameters(List systemParameters) { - this.systemParameters = systemParameters; - } - - public List getReturnAttributes() { - return returnAttributes; - } - - public void setReturnAttributes(List returnAttributes) { - this.returnAttributes = returnAttributes; - } - - public List getExamples() { - return examples; - } - - public void setExamples(List examples) { - this.examples = examples; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - ExtensionMetaData that = (ExtensionMetaData) o; - - if (name != null ? !name.equals(that.name) : that.name != null) { - return false; - } - if (namespace != null ? !namespace.equals(that.namespace) : that.namespace != null) { - return false; - } - if (description != null ? !description.equals(that.description) : that.description != null) { - return false; - } - if (parameters != null ? !parameters.equals(that.parameters) : that.parameters != null) { - return false; - } - if (systemParameters != null ? !systemParameters.equals(that.systemParameters) : - that.systemParameters != null) { - return false; - } - if (returnAttributes != null ? !returnAttributes.equals(that.returnAttributes) : - that.returnAttributes != null) { - return false; - } - return examples != null ? examples.equals(that.examples) : that.examples == null; - } - - @Override - public int hashCode() { - int result = name != null ? name.hashCode() : 0; - result = 31 * result + (namespace != null ? namespace.hashCode() : 0); - result = 31 * result + (description != null ? description.hashCode() : 0); - result = 31 * result + (parameters != null ? parameters.hashCode() : 0); - result = 31 * result + (systemParameters != null ? systemParameters.hashCode() : 0); - result = 31 * result + (returnAttributes != null ? returnAttributes.hashCode() : 0); - result = 31 * result + (examples != null ? examples.hashCode() : 0); - return result; - } - - @Override - public int compareTo(ExtensionMetaData o) { - if (o == null) { - return -1; - } - if (this.equals(o)) { - return 0; - } - int result; - if (namespace != null && o.namespace != null) { - result = namespace.compareTo(o.namespace); - } else if (namespace == null && o.namespace == null) { - result = 0; - } else if (namespace == null) { - return -1; - } else { - return 1; - } - if (result == 0) { - if (name != null && o.name != null) { - result = name.compareTo(o.name); - } else if (name == null && o.name == null) { - result = 0; - } else if (name == null) { - return -1; - } else { - return 1; - } - if (result == 0) { - result = description.compareTo(o.description); - } - } - return result; - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExtensionType.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExtensionType.java deleted file mode 100644 index 397dd8e85e..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ExtensionType.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.commons.metadata; - -import org.wso2.siddhi.core.executor.function.FunctionExecutor; -import org.wso2.siddhi.core.function.Script; -import org.wso2.siddhi.core.query.processor.stream.StreamProcessor; -import org.wso2.siddhi.core.query.processor.stream.function.StreamFunctionProcessor; -import org.wso2.siddhi.core.query.processor.stream.window.WindowProcessor; -import org.wso2.siddhi.core.query.selector.attribute.aggregator.AttributeAggregator; -import org.wso2.siddhi.core.stream.input.source.Source; -import org.wso2.siddhi.core.stream.input.source.SourceMapper; -import org.wso2.siddhi.core.stream.output.sink.Sink; -import org.wso2.siddhi.core.stream.output.sink.SinkMapper; -import org.wso2.siddhi.core.table.Table; - -import java.util.HashMap; -import java.util.Map; - -/** - * Enum for holding extension types supported by the doc generator and the free marker templates - * - * The enum values should be changed to match the names used in the documentation - * The enum values will affect the names used in the documentation as well as the hyperlinks - * - * These enum values will be passed onto the freemarker templates as a map - * The other members of the enum class will not be accessible from the freemarker templates - * These can be accesses using the EXTENSION_TYPE variable - * eg:- EXTENSION_TYPE.FUNCTION - */ -public enum ExtensionType { - FUNCTION("Function"), - ATTRIBUTE_AGGREGATOR("Aggregate Function"), - WINDOW("Window"), - STREAM_FUNCTION("Stream Function"), - STREAM_PROCESSOR("Stream Processor"), - SOURCE("Source"), - SINK("Sink"), - SOURCE_MAPPER("Source Mapper"), - SINK_MAPPER("Sink Mapper"), - STORE("Store"), - SCRIPT("Script"); - - /** - * Contains the name to be displayed as the extension type - */ - private final String value; - - /** - * The map from extension class type to super class - */ - private static final Map> superClassMap; - - static { - // Populating the processor super class map - superClassMap = new HashMap<>(); - superClassMap.put(ExtensionType.FUNCTION, FunctionExecutor.class); - superClassMap.put(ExtensionType.ATTRIBUTE_AGGREGATOR, AttributeAggregator.class); - superClassMap.put(ExtensionType.WINDOW, WindowProcessor.class); - superClassMap.put(ExtensionType.STREAM_FUNCTION, StreamFunctionProcessor.class); - superClassMap.put(ExtensionType.STREAM_PROCESSOR, StreamProcessor.class); - superClassMap.put(ExtensionType.SOURCE, Source.class); - superClassMap.put(ExtensionType.SINK, Sink.class); - superClassMap.put(ExtensionType.SOURCE_MAPPER, SourceMapper.class); - superClassMap.put(ExtensionType.SINK_MAPPER, SinkMapper.class); - superClassMap.put(ExtensionType.STORE, Table.class); - superClassMap.put(ExtensionType.SCRIPT, Script.class); - } - - ExtensionType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Map> getSuperClassMap() { - return superClassMap; - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/NamespaceMetaData.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/NamespaceMetaData.java deleted file mode 100644 index 007b9ff006..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/NamespaceMetaData.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.commons.metadata; - -import java.util.Iterator; -import java.util.List; -import java.util.TreeMap; - -/** - * POJO for holding extension meta data - */ -public class NamespaceMetaData implements Comparable { - private String name; - private TreeMap> extensionMap; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public TreeMap> getExtensionMap() { - return extensionMap; - } - - public void setExtensionMap(TreeMap> extensionMap) { - this.extensionMap = extensionMap; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - NamespaceMetaData that = (NamespaceMetaData) o; - - if (name != null ? !name.equals(that.name) : that.name != null) { - return false; - } - return extensionMap != null ? extensionMap.equals(that.extensionMap) : that.extensionMap == null; - } - - @Override - public int hashCode() { - int result = name != null ? name.hashCode() : 0; - result = 31 * result + (extensionMap != null ? extensionMap.hashCode() : 0); - return result; - } - - @Override - public int compareTo(NamespaceMetaData o) { - if (o == null) { - return -1; - } - if (this.equals(o)) { - return 0; - } - int result = 0; - if (name != null && o.name != null) { - result = name.compareTo(o.name); - } else if (name == null && o.name == null) { - result = 0; - } else if (name == null) { - return -1; - } else { - return 1; - } - Iterator thisIterable = extensionMap.keySet().iterator(); - Iterator oIterable = o.extensionMap.keySet().iterator(); - while (result == 0) { - if (thisIterable.hasNext() && oIterable.hasNext()) { - result = thisIterable.next().compareTo(oIterable.next()); - } else if (!thisIterable.hasNext() && !oIterable.hasNext()) { - result = 0; - } else if (!thisIterable.hasNext()) { - return -1; - } else { - return 1; - } - } - return result; - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ParameterMetaData.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ParameterMetaData.java deleted file mode 100644 index 10cd9f5945..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ParameterMetaData.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.commons.metadata; - -import org.wso2.siddhi.annotation.util.DataType; - -import java.util.List; - -/** - * POJO for holding extension parameter meta data - */ -public class ParameterMetaData { - private String name; - private List type; - private String description; - private boolean optional; - private boolean dynamic; - private String defaultValue; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getType() { - return type; - } - - public void setType(List type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public boolean isOptional() { - return optional; - } - - public void setOptional(boolean optional) { - this.optional = optional; - } - - public boolean isDynamic() { - return dynamic; - } - - public void setDynamic(boolean dynamic) { - this.dynamic = dynamic; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ReturnAttributeMetaData.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ReturnAttributeMetaData.java deleted file mode 100644 index c3753601b2..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/ReturnAttributeMetaData.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.commons.metadata; - -import org.wso2.siddhi.annotation.util.DataType; - -import java.util.List; - -/** - * POJO for holding extension return attribute meta data - */ -public class ReturnAttributeMetaData { - private String name; - private List type; - private String description; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getType() { - return type; - } - - public void setType(List type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/SystemParameterMetaData.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/SystemParameterMetaData.java deleted file mode 100644 index 9875afd39e..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/commons/metadata/SystemParameterMetaData.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.commons.metadata; - -import java.util.List; - -/** - * POJO for holding extension system parameters meta data - */ -public class SystemParameterMetaData { - private String name; - private String description; - private String defaultValue; - private List possibleParameters; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public List getPossibleParameters() { - return possibleParameters; - } - - public void setPossibleParameters(List possibleParameters) { - this.possibleParameters = possibleParameters; - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/ExtensionsIndexGenerationMojo.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/ExtensionsIndexGenerationMojo.java deleted file mode 100644 index 4d5f2f8aeb..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/ExtensionsIndexGenerationMojo.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.core; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; -import org.wso2.siddhi.doc.gen.core.utils.Constants; -import org.wso2.siddhi.doc.gen.core.utils.DocumentationUtils; - -import java.io.File; -import java.util.List; - -/** - * Mojo for creating an index Siddhi documentation - */ -@Mojo( - name = "generate-extensions-index", - aggregator = true, - defaultPhase = LifecyclePhase.INSTALL -) -public class ExtensionsIndexGenerationMojo extends AbstractMojo { - /** - * The maven project object - */ - @Parameter(defaultValue = "${project}", readonly = true, required = true) - private MavenProject mavenProject; - - /** - * The extension repository owner - */ - @Parameter(property = "extension.repository.owner") - private String extensionRepositoryOwner; - - /** - * The extension repository names - */ - @Parameter(property = "extension.repositories", required = true) - private List extensionRepositories; - - /** - * The directory in which the index will be generated - * Optional - */ - @Parameter(property = "doc.gen.base.directory") - private File docGenBaseDirectory; - - /** - * The final output file name of the index - */ - @Parameter(property = "index.gen.file.name") - private String indexGenFileName; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - // Finding the root maven project - MavenProject rootMavenProject = mavenProject; - while (rootMavenProject.getParent().getBasedir() != null) { - rootMavenProject = rootMavenProject.getParent(); - } - - // Checking if extension repositories and repository owner had been added in the configuration - if (extensionRepositories == null || extensionRepositories.size() == 0) { - throw new MojoExecutionException("extensionRepositories configuration is required to use goal " + - "generate-extensions-index"); - } - - // Setting the extension repository owner if not set by the user - if (extensionRepositoryOwner == null) { - extensionRepositoryOwner = Constants.GITHUB_OWNER_WSO2_EXTENSIONS; - } - - // Setting the documentation output directory if not set by user - String docGenBasePath; - if (docGenBaseDirectory != null) { - docGenBasePath = docGenBaseDirectory.getAbsolutePath(); - } else { - docGenBasePath = rootMavenProject.getBasedir() + File.separator + Constants.DOCS_DIRECTORY; - } - - // Setting the extension index output file name if not set by user - if (indexGenFileName == null) { - indexGenFileName = Constants.MARKDOWN_EXTENSIONS_INDEX_TEMPLATE; - } - - // Creating a extensions index - DocumentationUtils.createExtensionsIndex( - extensionRepositories, extensionRepositoryOwner, docGenBasePath, indexGenFileName - ); - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/MarkdownDocumentationGenerationMojo.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/MarkdownDocumentationGenerationMojo.java deleted file mode 100644 index 381bb3d946..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/MarkdownDocumentationGenerationMojo.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.core; - -import org.apache.maven.artifact.DependencyResolutionRequiredException; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.maven.project.MavenProject; -import org.wso2.siddhi.doc.gen.commons.metadata.NamespaceMetaData; -import org.wso2.siddhi.doc.gen.core.utils.Constants; -import org.wso2.siddhi.doc.gen.core.utils.DocumentationUtils; - -import java.io.File; -import java.util.List; - -/** - * Mojo for generating Siddhi Documentation - */ -@Mojo( - name = "generate-md-docs", - aggregator = true, - defaultPhase = LifecyclePhase.INSTALL, - requiresDependencyResolution = ResolutionScope.TEST -) -public class MarkdownDocumentationGenerationMojo extends AbstractMojo { - /** - * The maven project object - */ - @Parameter(defaultValue = "${project}", readonly = true, required = true) - private MavenProject mavenProject; - - /** - * The target module for which the files will be generated - * Optional - */ - @Parameter(property = "module.target.directory") - private File moduleTargetDirectory; - -// /** -// * The path of the readme file in the base directory -// * Optional -// */ -// @Parameter(property = "home.page.template.file") -// private File homePageTemplateFile; -// -// /** -// * The name of the index file -// * Optional -// */ -// @Parameter(property = "home.page.file.name") -// private String homePageFileName; - - /** - * The path of the mkdocs.yml file in the base directory - * Optional - */ - @Parameter(property = "mkdocs.config.file") - private File mkdocsConfigFile; - - /** - * The directory in which the docs will be generated - * Optional - */ - @Parameter(property = "doc.gen.base.directory") - private File docGenBaseDirectory; - - /** - * The readme file - * Optional - */ - @Parameter(property = "readme.file") - private File readmeFile; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - // Finding the root maven project - MavenProject rootMavenProject = mavenProject; - while (rootMavenProject.getParent().getBasedir() != null) { - rootMavenProject = rootMavenProject.getParent(); - } - - // Setting the relevant modules target directory if not set by user - String moduleTargetPath; - if (moduleTargetDirectory != null) { - moduleTargetPath = moduleTargetDirectory.getAbsolutePath(); - } else { - moduleTargetPath = mavenProject.getBuild().getDirectory(); - } - - // Setting the documentation output directory if not set by user - String docGenBasePath; - if (docGenBaseDirectory != null) { - docGenBasePath = docGenBaseDirectory.getAbsolutePath(); - } else { - docGenBasePath = rootMavenProject.getBasedir() + File.separator + Constants.DOCS_DIRECTORY; - } - -// // Setting the home page template file path if not set by user -// if (homePageTemplateFile == null) { -// homePageTemplateFile = new File(rootMavenProject.getBasedir() + File.separator -// + Constants.README_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION); -// } - - // Setting the mkdocs config file path if not set by user - if (mkdocsConfigFile == null) { - mkdocsConfigFile = new File(rootMavenProject.getBasedir() + File.separator - + Constants.MKDOCS_CONFIG_FILE_NAME + Constants.YAML_FILE_EXTENSION); - } -// -// // Setting the home page file name if not set by user -// File homePageFile; -// if (homePageFileName == null) { -// homePageFile = new File(docGenBasePath + File.separator -// + Constants.HOMEPAGE_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION); -// } else { -// homePageFile = new File(docGenBasePath + File.separator + homePageFileName); -// } - - // Setting the readme file name if not set by user - if (readmeFile == null) { - readmeFile = new File(rootMavenProject.getBasedir() + File.separator - + Constants.README_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION); - } - - // Retrieving metadata - List namespaceMetaDataList; - try { - namespaceMetaDataList = DocumentationUtils.getExtensionMetaData( - moduleTargetPath, - mavenProject.getRuntimeClasspathElements(), - getLog() - ); - } catch (DependencyResolutionRequiredException e) { - throw new MojoFailureException("Unable to resolve dependencies of the project", e); - } - - // Generating the documentation - if (namespaceMetaDataList.size() > 0) { - DocumentationUtils.generateDocumentation(namespaceMetaDataList, docGenBasePath, mavenProject.getVersion(), - getLog()); -// DocumentationUtils.updateHeadingsInMarkdownFile(homePageTemplateFile, homePageFile, -// rootMavenProject.getArtifactId(), mavenProject.getVersion(), namespaceMetaDataList); -// DocumentationUtils.updateHeadingsInMarkdownFile(readmeFile, readmeFile, rootMavenProject.getArtifactId(), -// mavenProject.getVersion(), namespaceMetaDataList); - } - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/MkdocsGitHubPagesDeployMojo.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/MkdocsGitHubPagesDeployMojo.java deleted file mode 100644 index b6cd157d68..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/MkdocsGitHubPagesDeployMojo.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.core; - -import org.apache.maven.artifact.DependencyResolutionRequiredException; -import org.apache.maven.model.Scm; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; -import org.wso2.siddhi.doc.gen.commons.metadata.NamespaceMetaData; -import org.wso2.siddhi.doc.gen.core.utils.Constants; -import org.wso2.siddhi.doc.gen.core.utils.DocumentationUtils; - -import java.io.File; -import java.io.FileNotFoundException; -import java.util.List; - -import static org.wso2.siddhi.doc.gen.core.utils.DocumentationUtils.updateAPIPagesInMkdocsConfig; - -/** - * Mojo for deploying mkdocs website on GitHub pages - */ -@Mojo( - name = "deploy-mkdocs-github-pages", - aggregator = true, - defaultPhase = LifecyclePhase.INSTALL -) -public class MkdocsGitHubPagesDeployMojo extends AbstractMojo { - /** - * The maven project object - */ - @Parameter(defaultValue = "${project}", readonly = true, required = true) - private MavenProject mavenProject; - - /** - * The target module for which the files will be generated - * Optional - */ - @Parameter(property = "module.target.directory") - private File moduleTargetDirectory; - - /** - * The path of the mkdocs.yml file in the base directory - * Optional - */ - @Parameter(property = "mkdocs.config.file") - private File mkdocsConfigFile; - - /** - * The directory in which the index will be generated - * Optional - */ - @Parameter(property = "doc.gen.base.directory") - private File docGenBaseDirectory; - - /** - * The name of the index file - * Optional - */ - @Parameter(property = "home.page.file.name") - private String homePageFileName; - - /** - * The path of the readme file in the base directory - * Optional - */ - @Parameter(property = "home.page.template.file") - private File homePageTemplateFile; - - /** - * The readme file - * Optional - */ - @Parameter(property = "readme.file") - private File readmeFile; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - // Finding the root maven project - MavenProject rootMavenProject = mavenProject; - while (rootMavenProject.getParent().getBasedir() != null) { - rootMavenProject = rootMavenProject.getParent(); - } - - // Setting the relevant modules target directory if not set by user - String moduleTargetPath; - if (moduleTargetDirectory != null) { - moduleTargetPath = moduleTargetDirectory.getAbsolutePath(); - } else { - moduleTargetPath = mavenProject.getBuild().getDirectory(); - } - - // Setting the mkdocs config file path if not set by user - if (mkdocsConfigFile == null) { - mkdocsConfigFile = new File(rootMavenProject.getBasedir() + File.separator - + Constants.MKDOCS_CONFIG_FILE_NAME + Constants.YAML_FILE_EXTENSION); - } - - // Setting the documentation output directory if not set by user - String docGenBasePath; - if (docGenBaseDirectory != null) { - docGenBasePath = docGenBaseDirectory.getAbsolutePath(); - } else { - docGenBasePath = rootMavenProject.getBasedir() + File.separator + Constants.DOCS_DIRECTORY; - } - - // Setting the home page file name if not set by user - File homePageFile; - if (homePageFileName == null) { - homePageFile = new File(docGenBasePath + File.separator - + Constants.HOMEPAGE_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION); - } else { - homePageFile = new File(docGenBasePath + File.separator + homePageFileName); - } - - // Setting the readme file name if not set by user - if (readmeFile == null) { - readmeFile = new File(rootMavenProject.getBasedir() + File.separator - + Constants.README_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION); - } - - // Setting the home page template file path if not set by user - if (homePageTemplateFile == null) { - homePageTemplateFile = new File(rootMavenProject.getBasedir() + File.separator - + Constants.README_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION); - } - - // Retrieving metadata - List namespaceMetaDataList; - try { - namespaceMetaDataList = DocumentationUtils.getExtensionMetaData( - moduleTargetPath, - mavenProject.getRuntimeClasspathElements(), - getLog() - ); - } catch (DependencyResolutionRequiredException e) { - throw new MojoFailureException("Unable to resolve dependencies of the project", e); - } - - // Generating the documentation - if (namespaceMetaDataList.size() > 0) { - DocumentationUtils.generateDocumentation(namespaceMetaDataList, docGenBasePath, mavenProject.getVersion(), - getLog()); - DocumentationUtils.updateHeadingsInMarkdownFile(homePageTemplateFile, homePageFile, - rootMavenProject.getArtifactId(), mavenProject.getVersion(), namespaceMetaDataList); - DocumentationUtils.updateHeadingsInMarkdownFile(readmeFile, readmeFile, rootMavenProject.getArtifactId(), - mavenProject.getVersion(), namespaceMetaDataList); - } - - // Delete snapshot files - DocumentationUtils.removeSnapshotAPIDocs(mkdocsConfigFile, docGenBasePath, getLog()); - - // Updating the links in the home page to the mkdocs config - try { - updateAPIPagesInMkdocsConfig(mkdocsConfigFile, docGenBasePath); - } catch (FileNotFoundException e) { - getLog().warn("Unable to find mkdocs configuration file: " - + mkdocsConfigFile.getAbsolutePath() + ". Mkdocs configuration file not updated."); - } - // Deploying the documentation - if (DocumentationUtils.generateMkdocsSite(mkdocsConfigFile, getLog())) { - // Creating the credential provider fot Git - String scmUsername = System.getenv(Constants.SYSTEM_PROPERTY_SCM_USERNAME_KEY); - String scmPassword = System.getenv(Constants.SYSTEM_PROPERTY_SCM_PASSWORD_KEY); - - if (scmUsername == null && scmPassword == null) { - getLog().info("SCM_USERNAME and SCM_PASSWORD not defined!"); - } - String url = null; - Scm scm = rootMavenProject.getScm(); - if (scm != null) { - url = scm.getUrl(); - } - // Deploying documentation - DocumentationUtils.updateDocumentationOnGitHub(docGenBasePath, mkdocsConfigFile, readmeFile, - mavenProject.getVersion(), getLog()); - DocumentationUtils.deployMkdocsOnGitHubPages(mavenProject.getVersion(), - rootMavenProject.getBasedir(), url, scmUsername, scmPassword, getLog()); - } else { - getLog().warn("Unable to generate documentation. Skipping documentation deployment."); - } - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/freemarker/FormatDescriptionMethod.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/freemarker/FormatDescriptionMethod.java deleted file mode 100644 index 718b3a2d3c..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/freemarker/FormatDescriptionMethod.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.core.freemarker; - -import freemarker.template.SimpleScalar; -import freemarker.template.TemplateMethodModelEx; -import freemarker.template.TemplateModelException; - -import java.util.List; -import java.util.Objects; - -/** - * Apache Freemarker method for formatting text - * This is invoked by the freemarker templates - * - * This method escapes relevant html characters, wraps text - */ -public class FormatDescriptionMethod implements TemplateMethodModelEx { - @Override - public Object exec(List args) throws TemplateModelException { - if (args.size() != 1) { - throw new TemplateModelException("There should be a single argument of type string " + - "passed to format description method"); - } - - SimpleScalar arg1 = (SimpleScalar) args.get(0); - String inputString = arg1.getAsString(); - - // Replacing spaces that should not be considered in text wrapping with non breaking spaces - inputString = replaceLeadingSpaces(inputString); - - inputString = inputString.replaceAll("<", "<"); - inputString = inputString.replaceAll(">", ">"); - - // Replacing new line characters - inputString = replaceNewLines(inputString); - - inputString = inputString.replaceAll("\t", "    "); - inputString = inputString.replaceAll("```([^```]*)```", "
$1
"); - inputString = inputString.replaceAll("`([^`]*)`", "$1"); - - return inputString; - } - - /** - * Replaces any spaces at the start of a new line with " " - * This will preserve the tabs entered at the start of a line - * - * @param inputString The string which needs to changed - * @return The string with spaces replaced - */ - private String replaceLeadingSpaces(String inputString) { - StringBuilder stringBuilder = new StringBuilder(inputString); - int i = 0; - boolean isInsideCode = false; - while (i < stringBuilder.length()) { - if (i + 3 < stringBuilder.length() && - Objects.equals(stringBuilder.substring(i, i + 3), "```")) { - isInsideCode = !isInsideCode; // Is inside a
 code section
-                i += 3;
-            } else if (stringBuilder.charAt(i) == '`') {
-                isInsideCode = !isInsideCode;   // Is inside a  code section
-                i++;
-            } else if (!isInsideCode && stringBuilder.charAt(i) == '\n') {
-                i++;
-                // Replacing leading spaces
-                while (i < stringBuilder.length() && stringBuilder.charAt(i) == ' ') {
-                    stringBuilder.replace(i, i + 1, " ");
-                    i += 6;
-                }
-            } else {
-                i++;
-            }
-        }
-        return stringBuilder.toString();
-    }
-
-    /**
-     * Replaces new line characters outside code segments with "
" tags - * - * @param inputString The string which needs to changed - * @return The string with the new lines replaced - */ - private String replaceNewLines(String inputString) { - StringBuilder stringBuilder = new StringBuilder(inputString); - int i = 0; - boolean isInsideCode = false; - while (i < stringBuilder.length()) { - if (i + 3 < stringBuilder.length() && - Objects.equals(stringBuilder.substring(i, i + 3), "```")) { - isInsideCode = !isInsideCode; // Is inside a
 code section
-                i += 3;
-            } else if (stringBuilder.charAt(i) == '`') {
-                isInsideCode = !isInsideCode;   // Is inside a  code section
-                i++;
-            } else if (!isInsideCode && stringBuilder.charAt(i) == '\n') {
-                // Replacing new lines
-                stringBuilder.replace(i, i + 1, "
"); - i += 4; - } else { - i++; - } - } - return stringBuilder.toString(); - } -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/utils/Constants.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/utils/Constants.java deleted file mode 100644 index 0fd3e0a459..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/utils/Constants.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.core.utils; - -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; - -/** - * Constants used by the doc generator and the free marker templates - * - * These constants will be passed onto the freemarker templates as a map - * These can be accesses using the CONSTANTS variable - * eg:- CONSTANTS.DOCS_DIRECTORY - */ -public class Constants { - public static final String DOCS_DIRECTORY = "docs"; - public static final String CLASSES_DIRECTORY = "classes"; - public static final String TEMPLATES_DIRECTORY = "templates"; - public static final String API_SUB_DIRECTORY = "api"; - - public static final String README_FILE_NAME = "README"; - public static final String LATEST_FILE_NAME = "latest"; - public static final String MKDOCS_CONFIG_FILE_NAME = "mkdocs"; - public static final String HOMEPAGE_FILE_NAME = "index"; - - public static final String FREEMARKER_TEMPLATE_FILE_EXTENSION = ".ftl"; - public static final String CLASS_FILE_EXTENSION = ".class"; - public static final String MARKDOWN_FILE_EXTENSION = ".md"; - public static final String YAML_FILE_EXTENSION = ".yml"; - - public static final String MARKDOWN_DOCUMENTATION_TEMPLATE = "documentation"; - public static final String MARKDOWN_EXTENSIONS_INDEX_TEMPLATE = "extensions"; - public static final String MARKDOWN_HEADINGS_UPDATE_TEMPLATE = "headings-update"; - - public static final String GITHUB_GPL_EXTENSION_REPOSITORY_PREFIX = "siddhi-gpl-"; - public static final String GITHUB_APACHE_EXTENSION_REPOSITORY_PREFIX = "siddhi-"; - public static final String GITHUB_OWNER_WSO2_EXTENSIONS = "wso2-extensions"; - - public static final String SYSTEM_PROPERTY_SCM_USERNAME_KEY = "SCM_USERNAME"; - public static final String SYSTEM_PROPERTY_SCM_PASSWORD_KEY = "SCM_PASSWORD"; - - public static final String MKDOCS_CONFIG_PAGES_KEY = "pages"; - public static final String MKDOCS_CONFIG_PAGES_API_KEY = "API Docs"; - public static final String MKDOCS_FILE_SEPARATOR = "/"; - public static final String MKDOCS_SITE_DIRECTORY = "site"; - - public static final String MKDOCS_COMMAND = "mkdocs"; - public static final String MKDOCS_BUILD_COMMAND = "build"; - public static final String MKDOCS_BUILD_COMMAND_CLEAN_ARGUEMENT = "-c"; - public static final String MKDOCS_BUILD_COMMAND_CONFIG_FILE_ARGUMENT = "-f"; - public static final String MKDOCS_BUILD_COMMAND_SITE_DIRECTORY_ARGUMENT = "-d"; - - public static final String GIT_REMOTE = "origin"; - public static final String GITHUB_URL = "https:\\/\\/github\\.com"; - public static final String GITHUB_URL_WITH_USERNAME_PASSWORD = "https://%s:%s@github.com"; - public static final String GIT_MASTER_BRANCH = "master"; - public static final String GIT_GH_PAGES_BRANCH = "gh-pages"; - - public static final String GIT_COMMAND = "git"; - public static final String GIT_BRANCH_COMMAND = "branch"; - public static final String GIT_BRANCH_COMMAND_OUTPUT_CURRENT_BRANCH_PREFIX = "* "; - public static final String GIT_STASH_COMMAND = "stash"; - public static final String GIT_STASH_POP_COMMAND = "pop"; - public static final String GIT_ADD_COMMAND = "add"; - public static final String GIT_PULL_COMMAND = "pull"; - public static final String GIT_PUSH_COMMAND = "push"; - public static final String GIT_CHECKOUT_COMMAND = "checkout"; - public static final String GIT_CHECKOUT_COMMAND_ORPHAN_ARGUMENT = "--orphan"; - public static final String GIT_COMMIT_COMMAND = "commit"; - public static final String GIT_COMMIT_COMMAND_FILES_ARGUMENT = "--"; - public static final String GIT_COMMIT_COMMAND_MESSAGE_ARGUMENT = "-m"; - public static final String GIT_COMMIT_COMMAND_MESSAGE_FORMAT = "[WSO2-Release] [Release %s] " + - "update documentation for release %s"; - - public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; - public static final String CORE_NAMESPACE = "core"; - public static final String SNAPSHOT_VERSION_POSTFIX = "-SNAPSHOT"; - - /* - * Constants used by freemarker templates - */ - public static final String FREEMARKER_FEATURES_HEADING = "## Features"; - public static final String FREEMARKER_LATEST_API_DOCS_HEADING = "## Latest API Docs"; - public static final String FREEMARKER_SIDDHI_HOME_PAGE = "https://wso2.github.io/siddhi"; - public static final String FREEMARKER_SIDDHI_REPOSITORY_ARTIFACT_ID = "siddhi"; - public static final String FREEMARKER_EXTENSION_REPOSITORY_PARENT_POSTFIX = "-parent"; -} diff --git a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/utils/DocumentationUtils.java b/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/utils/DocumentationUtils.java deleted file mode 100644 index c9be5ca55c..0000000000 --- a/modules/siddhi-doc-gen/src/main/java/org/wso2/siddhi/doc/gen/core/utils/DocumentationUtils.java +++ /dev/null @@ -1,842 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.doc.gen.core.utils; - -import com.google.common.io.Files; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import freemarker.template.TemplateExceptionHandler; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.logging.Log; -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.SystemParameter; -import org.wso2.siddhi.doc.gen.commons.metadata.ExampleMetaData; -import org.wso2.siddhi.doc.gen.commons.metadata.ExtensionMetaData; -import org.wso2.siddhi.doc.gen.commons.metadata.ExtensionType; -import org.wso2.siddhi.doc.gen.commons.metadata.NamespaceMetaData; -import org.wso2.siddhi.doc.gen.commons.metadata.ParameterMetaData; -import org.wso2.siddhi.doc.gen.commons.metadata.ReturnAttributeMetaData; -import org.wso2.siddhi.doc.gen.commons.metadata.SystemParameterMetaData; -import org.wso2.siddhi.doc.gen.core.freemarker.FormatDescriptionMethod; -import org.yaml.snakeyaml.DumperOptions; -import org.yaml.snakeyaml.Yaml; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.lang.reflect.Field; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.nio.charset.Charset; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.TreeMap; - -/** - * Utility class for getting the meta data for the extension processors in Siddhi - */ -public class DocumentationUtils { - private DocumentationUtils() { // To prevent instantiating utils class - } - - /** - * Returns the extension extension meta data - * Gets the meta data from the siddhi manager - * - * @param targetDirectoryPath The path of the target directory of the maven module containing extensions - * @param logger The maven plugin logger - * @return NamespaceMetaData namespace meta data list - * @throws MojoFailureException If this fails to access project dependencies - * @throws MojoExecutionException If the classes directory from which classes are loaded is invalid - */ - public static List getExtensionMetaData(String targetDirectoryPath, - List runtimeClasspathElements, - Log logger) - throws MojoFailureException, MojoExecutionException { - List namespaceMetaDataList = new ArrayList(); - int urlCount = runtimeClasspathElements.size() + 1; // +1 to include the module's target/classes folder - - // Creating a list of URLs with all project dependencies - URL[] urls = new URL[urlCount]; - for (int i = 0; i < runtimeClasspathElements.size(); i++) { - try { - urls[i] = new File(runtimeClasspathElements.get(i)).toURI().toURL(); - } catch (MalformedURLException e) { - throw new MojoFailureException("Unable to access project dependency: " - + runtimeClasspathElements.get(i), e); - } - } - - File classesDirectory = new File(targetDirectoryPath + File.separator + Constants.CLASSES_DIRECTORY); - try { - // Adding the generated classes to the class loader - urls[urlCount - 1] = classesDirectory.toURI().toURL(); - ClassLoader urlClassLoader = AccessController.doPrivileged( - (PrivilegedAction) () -> new URLClassLoader( - urls, Thread.currentThread().getContextClassLoader() - ) - ); - // Getting extensions from all the class files in the classes directory - addExtensionInDirectory(classesDirectory, classesDirectory.getAbsolutePath(), urlClassLoader, - namespaceMetaDataList, logger); - } catch (MalformedURLException e) { - throw new MojoExecutionException("Invalid classes directory: " + classesDirectory.getAbsolutePath(), e); - } - for (NamespaceMetaData aNamespaceMetaData : namespaceMetaDataList) { - for (List extensionMetaData : aNamespaceMetaData.getExtensionMap().values()) { - Collections.sort(extensionMetaData); - } - } - Collections.sort(namespaceMetaDataList); - return namespaceMetaDataList; - } - - - /** - * Generate documentation related files using metadata - * - * @param namespaceMetaDataList Metadata in this repository - * @param documentationBaseDirectory The path of the directory in which the documentation will be generated - * @param documentationVersion The version of the documentation being generated - * @param logger The logger to log errors - * @throws MojoFailureException if the Mojo fails to find template file or create new documentation file - */ - public static void generateDocumentation(List namespaceMetaDataList, - String documentationBaseDirectory, String documentationVersion, Log logger) - throws MojoFailureException { - // Generating data model - Map rootDataModel = new HashMap<>(); - rootDataModel.put("metaData", namespaceMetaDataList); - rootDataModel.put("formatDescription", new FormatDescriptionMethod()); - rootDataModel.put("latestDocumentationVersion", documentationVersion); - - String outputFileRelativePath = Constants.API_SUB_DIRECTORY + File.separator + documentationVersion - + Constants.MARKDOWN_FILE_EXTENSION; - - generateFileFromTemplate( - Constants.MARKDOWN_DOCUMENTATION_TEMPLATE + Constants.MARKDOWN_FILE_EXTENSION - + Constants.FREEMARKER_TEMPLATE_FILE_EXTENSION, - rootDataModel, documentationBaseDirectory, outputFileRelativePath - ); - File newVersionFile = new File(documentationBaseDirectory + File.separator + outputFileRelativePath); - File latestLabelFile = new File(documentationBaseDirectory + File.separator + - Constants.API_SUB_DIRECTORY + File.separator + Constants.LATEST_FILE_NAME + - Constants.MARKDOWN_FILE_EXTENSION); - try { - Files.copy(newVersionFile, latestLabelFile); - } catch (IOException e) { - logger.warn("Failed to generate latest.md file", e); - } - } - - /** - * Update the documentation home page - * - * @param inputFile The path to the input file - * @param outputFile The path to the output file - * @param extensionRepositoryName The name of the extension repository - * @param latestDocumentationVersion The version of the latest documentation generated - * @param namespaceMetaDataList Metadata in this repository - * @throws MojoFailureException if the Mojo fails to find template file or create new documentation file - */ - public static void updateHeadingsInMarkdownFile(File inputFile, File outputFile, - String extensionRepositoryName, - String latestDocumentationVersion, - List namespaceMetaDataList) - throws MojoFailureException { - // Retrieving the content of the README.md file - List inputFileLines = new ArrayList<>(); - try { - inputFileLines = Files.readLines(inputFile, Constants.DEFAULT_CHARSET); - } catch (IOException ignored) { - } - - // Generating data model - Map rootDataModel = new HashMap<>(); - rootDataModel.put("inputFileLines", inputFileLines); - rootDataModel.put("extensionRepositoryName", extensionRepositoryName); - rootDataModel.put("latestDocumentationVersion", latestDocumentationVersion); - rootDataModel.put("metaData", namespaceMetaDataList); - rootDataModel.put("formatDescription", new FormatDescriptionMethod()); - - generateFileFromTemplate( - Constants.MARKDOWN_HEADINGS_UPDATE_TEMPLATE + Constants.MARKDOWN_FILE_EXTENSION - + Constants.FREEMARKER_TEMPLATE_FILE_EXTENSION, - rootDataModel, outputFile.getParent(), outputFile.getName() - ); - } - - /** - * Remove the snapshot version documentation files from docs/api directory - * - * @param mkdocsConfigFile The mkdocs configuration file - * @param documentationBaseDirectory The path of the base directory in which the documentation will be generated - * @param logger The maven plugin logger - */ - public static void removeSnapshotAPIDocs(File mkdocsConfigFile, String documentationBaseDirectory, Log logger) { - // Retrieving the documentation file names - File apiDocsDirectory = new File(documentationBaseDirectory - + File.separator + Constants.API_SUB_DIRECTORY); - String[] documentationFileNames = apiDocsDirectory.list( - (directory, fileName) -> fileName.endsWith(Constants.MARKDOWN_FILE_EXTENSION) - ); - - if (documentationFileNames != null) { - // Removing snapshot files and creating a list of the files that are left out - for (String documentationFileName : documentationFileNames) { - if (documentationFileName.endsWith(Constants.SNAPSHOT_VERSION_POSTFIX - + Constants.MARKDOWN_FILE_EXTENSION)) { - // Removing the snapshot documentation file - File documentationFile = new File(apiDocsDirectory.getAbsolutePath() - + File.separator + documentationFileName); - if (!documentationFile.delete()) { - logger.warn("Failed to delete SNAPSHOT documentation file " - + documentationFile.getAbsolutePath()); - } - } - } - - } - } - - /** - * This add a new page to the list of pages in the mkdocs configuration - * - * @param mkdocsConfigFile The mkdocs configuration file - * @param documentationBaseDirectory The base directory of the documentation - * @throws FileNotFoundException If mkdocs configuration file is not found - */ - public static void updateAPIPagesInMkdocsConfig(File mkdocsConfigFile, String documentationBaseDirectory) - throws FileNotFoundException { - // Retrieving the documentation file names - File documentationDirectory = new File(documentationBaseDirectory - + File.separator + Constants.API_SUB_DIRECTORY); - String[] documentationFiles = documentationDirectory.list( - (directory, fileName) -> fileName.endsWith(Constants.MARKDOWN_FILE_EXTENSION) - ); - - List apiDirectoryContent; - if (documentationFiles == null) { - apiDirectoryContent = new ArrayList<>(); - } else { - apiDirectoryContent = Arrays.asList(documentationFiles); - apiDirectoryContent.sort(new Comparator() { - @Override - public int compare(String s1, String s2) { - String[] s1s = s1.split("\\D+"); - String[] s2s = s2.split("\\D+"); - int i = 0; - while (s1s.length > i || s2s.length > i) { - String s1a = "0"; - String s2a = "0"; - if (s1s.length > i) { - s1a = s1s[i]; - } - if (s2s.length > i) { - s2a = s2s[i]; - } - int s1aInt = Integer.parseInt(s1a); - int s2aInt = Integer.parseInt(s2a); - if (s2aInt > s1aInt) { - return 1; - } else if (s2aInt < s1aInt) { - return -1; - } - i++; - } - return 0; - } - }); - } - - String latestVersionFile = null; - if (apiDirectoryContent.size() > 1) { - String first = apiDirectoryContent.get(0); - String second = apiDirectoryContent.get(1); - if (first.equals(Constants.LATEST_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION)) { - latestVersionFile = second; - } - } - - // Creating yaml parser - DumperOptions dumperOptions = new DumperOptions(); - dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - Yaml yaml = new Yaml(dumperOptions); - - // Reading the mkdocs configuration - Map yamlConfig = (Map) yaml.load(new InputStreamReader( - new FileInputStream(mkdocsConfigFile), Constants.DEFAULT_CHARSET) - ); - - // Getting the pages list - List> yamlConfigPagesList = - (List>) yamlConfig.get(Constants.MKDOCS_CONFIG_PAGES_KEY); - - // Creating the new api pages list - List> apiPagesList = new ArrayList<>(); - for (String apiFile : apiDirectoryContent) { - String pageName = apiFile.substring(0, apiFile.length() - Constants.MARKDOWN_FILE_EXTENSION.length()); - - Map newPage = new HashMap<>(); - if (latestVersionFile != null && pageName.equals(Constants.LATEST_FILE_NAME)) { - pageName = "Latest (" + latestVersionFile.substring(0, latestVersionFile.length() - - Constants.MARKDOWN_FILE_EXTENSION.length()) + ")"; - } - newPage.put(pageName, Constants.API_SUB_DIRECTORY + Constants.MKDOCS_FILE_SEPARATOR + apiFile); - apiPagesList.add(newPage); - } - - // Setting the new api pages - Map yamlConfigAPIPage = null; - for (Map yamlConfigPage : yamlConfigPagesList) { - if (yamlConfigPage.get(Constants.MKDOCS_CONFIG_PAGES_API_KEY) != null) { - yamlConfigAPIPage = yamlConfigPage; - break; - } - } - if (yamlConfigAPIPage == null) { - yamlConfigAPIPage = new HashMap<>(); - yamlConfigPagesList.add(yamlConfigAPIPage); - } - yamlConfigAPIPage.put(Constants.MKDOCS_CONFIG_PAGES_API_KEY, apiPagesList); - - // Saving the updated configuration - yaml.dump(yamlConfig, new OutputStreamWriter( - new FileOutputStream(mkdocsConfigFile), Constants.DEFAULT_CHARSET) - ); - } - - /** - * Generate a extension index file from the template file - * - * @param extensionRepositories The list of extension repository names - * @param extensionRepositoryOwner The extension repository owner's name - * @param documentationBaseDirectory The output directory path in which the extension index will be generated - * @param extensionsIndexFileName The name of the index file that will be generated - * @throws MojoFailureException if the Mojo fails to find template file or create new documentation file - */ - public static void createExtensionsIndex(List extensionRepositories, String extensionRepositoryOwner, - String documentationBaseDirectory, String extensionsIndexFileName) - throws MojoFailureException { - // Separating Apache and GPL extensions based on siddhi repository prefix conventions - List gplExtensionRepositories = new ArrayList<>(); - List apacheExtensionRepositories = new ArrayList<>(); - for (String extensionRepository : extensionRepositories) { - if (extensionRepository.startsWith(Constants.GITHUB_GPL_EXTENSION_REPOSITORY_PREFIX)) { - gplExtensionRepositories.add(extensionRepository); - } else if (extensionRepository.startsWith(Constants.GITHUB_APACHE_EXTENSION_REPOSITORY_PREFIX)) { - apacheExtensionRepositories.add(extensionRepository); - } - } - - // Generating data model - Map rootDataModel = new HashMap<>(); - rootDataModel.put("extensionsOwner", extensionRepositoryOwner); - rootDataModel.put("gplExtensionRepositories", gplExtensionRepositories); - rootDataModel.put("apacheExtensionRepositories", apacheExtensionRepositories); - - generateFileFromTemplate( - Constants.MARKDOWN_EXTENSIONS_INDEX_TEMPLATE + Constants.MARKDOWN_FILE_EXTENSION - + Constants.FREEMARKER_TEMPLATE_FILE_EXTENSION, - rootDataModel, documentationBaseDirectory, - extensionsIndexFileName + Constants.MARKDOWN_FILE_EXTENSION - ); - } - - /** - * Build the mkdocs site using the mkdocs config file - * - * @param mkdocsConfigFile The mkdocs configuration file - * @param logger The maven logger - * @return true if the documentation generation is successful - */ - public static boolean generateMkdocsSite(File mkdocsConfigFile, Log logger) { - boolean isDocumentationGenerationSuccessful = false; - try { - // Building the mkdocs site - executeCommand(new String[]{Constants.MKDOCS_COMMAND, - Constants.MKDOCS_BUILD_COMMAND, - Constants.MKDOCS_BUILD_COMMAND_CLEAN_ARGUEMENT, - Constants.MKDOCS_BUILD_COMMAND_CONFIG_FILE_ARGUMENT, - mkdocsConfigFile.getAbsolutePath(), - Constants.MKDOCS_BUILD_COMMAND_SITE_DIRECTORY_ARGUMENT, - Constants.MKDOCS_SITE_DIRECTORY}, logger); - isDocumentationGenerationSuccessful = true; - } catch (Throwable t) { - logger.warn("Failed to generate the mkdocs site.", t); - } - return isDocumentationGenerationSuccessful; - } - - /** - * Deploy the mkdocs website on GitHub pages - * - * @param version The version of the documentation - * @param baseDirectory The base directory of the project - * @param url The SCM URL - * @param scmUsername The SCM username - * @param scmPassword The SCM password - * @param logger The maven logger - */ - public static void deployMkdocsOnGitHubPages(String version, File baseDirectory, String url, String scmUsername, - String scmPassword, Log logger) { - try { - // Find initial branch name - List gitStatusOutput = getCommandOutput(new String[]{Constants.GIT_COMMAND, - Constants.GIT_BRANCH_COMMAND}, logger); - String initialBranch = null; - for (String gitStatusOutputLine : gitStatusOutput) { - if (gitStatusOutputLine.startsWith(Constants.GIT_BRANCH_COMMAND_OUTPUT_CURRENT_BRANCH_PREFIX)) { - initialBranch = gitStatusOutputLine.substring( - Constants.GIT_BRANCH_COMMAND_OUTPUT_CURRENT_BRANCH_PREFIX.length()); - } - } - - if (initialBranch != null) { - // Stash changes - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_STASH_COMMAND}, logger); - - // Change to gh-pages branch. This will not do anything if a new branch was created in the last command. - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_CHECKOUT_COMMAND, - Constants.GIT_GH_PAGES_BRANCH}, logger); - - // Create branch if it does not exist. This will fail if the branch exists and will not do anything. - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_CHECKOUT_COMMAND, - Constants.GIT_CHECKOUT_COMMAND_ORPHAN_ARGUMENT, - Constants.GIT_GH_PAGES_BRANCH}, logger); - - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_PULL_COMMAND, - Constants.GIT_REMOTE, - Constants.GIT_GH_PAGES_BRANCH}, logger); - - // Getting the site that was built by mkdocs - File siteDirectory = new File(Constants.MKDOCS_SITE_DIRECTORY); - FileUtils.copyDirectory(siteDirectory, baseDirectory); - String[] siteDirectoryContent = siteDirectory.list(); - - // Pushing the site to GitHub (Assumes that site/ directory is ignored by git) - if (siteDirectoryContent != null && siteDirectoryContent.length > 0) { - List gitAddCommand = new ArrayList<>(); - Collections.addAll(gitAddCommand, Constants.GIT_COMMAND, - Constants.GIT_ADD_COMMAND); - Collections.addAll(gitAddCommand, siteDirectoryContent); - executeCommand(gitAddCommand.toArray(new String[gitAddCommand.size()]), logger); - - List gitCommitCommand = new ArrayList<>(); - Collections.addAll(gitCommitCommand, Constants.GIT_COMMAND, - Constants.GIT_COMMIT_COMMAND, - Constants.GIT_COMMIT_COMMAND_MESSAGE_ARGUMENT, - String.format(Constants.GIT_COMMIT_COMMAND_MESSAGE_FORMAT, version, version), - Constants.GIT_COMMIT_COMMAND_FILES_ARGUMENT); - Collections.addAll(gitCommitCommand, siteDirectoryContent); - executeCommand(gitCommitCommand.toArray(new String[gitCommitCommand.size()]), logger); - - if (scmUsername != null && scmPassword != null && url != null) { - // Using scm username and password env var values - String urlWithUsernameAndPassword = url.replaceFirst(Constants.GITHUB_URL, - Constants.GITHUB_URL_WITH_USERNAME_PASSWORD); - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_PUSH_COMMAND, - String.format(urlWithUsernameAndPassword, scmUsername, scmPassword), - Constants.GIT_GH_PAGES_BRANCH}, logger); - - } else { - // Using git credential store - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_PUSH_COMMAND, - Constants.GIT_REMOTE, - Constants.GIT_GH_PAGES_BRANCH}, logger); - } - } - - // Changing back to initial branch - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_CHECKOUT_COMMAND, - initialBranch}, logger); - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_STASH_COMMAND, - Constants.GIT_STASH_POP_COMMAND}, logger); - } else { - logger.warn("Unable to parse git-status command and retrieve current git branch. " + - "Skipping deployment."); - } - } catch (Throwable t) { - logger.warn("Failed to deploy the documentation on github pages.", t); - } - } - - /** - * Commit the documentation directory and the mkdocs config file - * - * @param docsDirectory The docs drectory - * @param mkdocsConfigFile The mkdocs configuration file - * @param readmeFile The read me file - * @param version The version of the documentation - * @param logger The maven logger - */ - public static void updateDocumentationOnGitHub(String docsDirectory, File mkdocsConfigFile, File readmeFile, - String version, Log logger) { - try { - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_ADD_COMMAND, - docsDirectory, mkdocsConfigFile.getAbsolutePath(), readmeFile.getAbsolutePath()}, logger); - executeCommand(new String[]{Constants.GIT_COMMAND, - Constants.GIT_COMMIT_COMMAND, - Constants.GIT_COMMIT_COMMAND_MESSAGE_ARGUMENT, - String.format(Constants.GIT_COMMIT_COMMAND_MESSAGE_FORMAT, version, version), - Constants.GIT_COMMIT_COMMAND_FILES_ARGUMENT, - docsDirectory, mkdocsConfigFile.getAbsolutePath(), readmeFile.getAbsolutePath()}, logger); - } catch (Throwable t) { - logger.warn("Failed to update the documentation on GitHub repository", t); - } - } - - /** - * Search for class files in the directory and add extensions from them - * This method recursively searches the sub directories - * - * @param moduleTargetClassesDirectory The directory from which the extension metadata will be loaded - * @param classesDirectoryPath The absolute path to the classes directory in the target folder in the module - * @param urlClassLoader The url class loader which should be used for loading the classes - * @param namespaceMetaDataList List of namespace meta data - * @param logger The maven logger - */ - private static void addExtensionInDirectory(File moduleTargetClassesDirectory, String classesDirectoryPath, - ClassLoader urlClassLoader, - List namespaceMetaDataList, Log logger) { - File[] innerFiles = moduleTargetClassesDirectory.listFiles(); - if (innerFiles != null) { - for (File innerFile : innerFiles) { - if (innerFile.isDirectory()) { - addExtensionInDirectory(innerFile, classesDirectoryPath, urlClassLoader, namespaceMetaDataList, - logger); - } else { - addExtensionInFile(innerFile, classesDirectoryPath, urlClassLoader, namespaceMetaDataList, - logger); - } - } - } - } - - /** - * Add an extension annotation in a file - * This first checks if this is a class file and loads the class and adds the annotation if present - * - * @param file The file from which the extension metadata will be loaded - * @param classesDirectoryPath The absolute path to the classes directory in the target folder in the module - * @param urlClassLoader The url class loader which should be used for loading the classes - * @param namespaceMetaDataList List of namespace meta data - * @param logger The maven logger - */ - private static void addExtensionInFile(File file, String classesDirectoryPath, ClassLoader urlClassLoader, - List namespaceMetaDataList, Log logger) { - String filePath = file.getAbsolutePath(); - if (filePath.endsWith(Constants.CLASS_FILE_EXTENSION) && - filePath.length() > classesDirectoryPath.length()) { - String relativePathToClass = filePath.substring((classesDirectoryPath + File.separator).length()); - - try { - // Loading class - Class extensionClass = Class.forName( - relativePathToClass - .substring(0, relativePathToClass.length() - Constants.CLASS_FILE_EXTENSION.length()) - .replace(File.separator, "."), - false, urlClassLoader - ); - - // Generating metadata and adding the it to the list of relevant extensions - addExtensionMetaDataIntoNamespaceList(namespaceMetaDataList, extensionClass, logger); - } catch (Throwable ignored) { - logger.warn("Ignoring the failed class loading from " + file.getAbsolutePath()); - } - } - } - - /** - * Generate extension meta data from the annotated data in the class - * - * @param namespaceList The list of namespaces to which the new extension will be added - * @param extensionClass Class from which meta data should be extracted from - * @param logger The maven plugin logger - */ - private static void addExtensionMetaDataIntoNamespaceList(List namespaceList, - Class extensionClass, Log logger) { - Extension extensionAnnotation = extensionClass.getAnnotation(Extension.class); - - if (extensionAnnotation != null) { // Discarding extension classes without annotation - ExtensionMetaData extensionMetaData = new ExtensionMetaData(); - - // Finding extension type - String extensionType = null; - for (Map.Entry> entry : ExtensionType.getSuperClassMap().entrySet()) { - Class superClass = entry.getValue(); - if (superClass.isAssignableFrom(extensionClass) && superClass != extensionClass) { - extensionType = entry.getKey().getValue(); - break; - } - } - - // Discarding the extension if it belongs to an unknown type - if (extensionType == null) { - logger.warn("Discarding extension (belonging to an unknown extension type): " - + extensionClass.getCanonicalName()); - return; - } - - extensionMetaData.setName(extensionAnnotation.name()); - extensionMetaData.setDescription(extensionAnnotation.description()); - - // Adding query parameters - ParameterMetaData[] parameters = new ParameterMetaData[extensionAnnotation.parameters().length]; - for (int i = 0; i < extensionAnnotation.parameters().length; i++) { - Parameter parameterAnnotation = extensionAnnotation.parameters()[i]; - - ParameterMetaData parameter = new ParameterMetaData(); - parameter.setName(parameterAnnotation.name()); - parameter.setType(Arrays.asList(parameterAnnotation.type())); - parameter.setDescription(parameterAnnotation.description()); - parameter.setOptional(parameterAnnotation.optional()); - parameter.setDynamic(parameterAnnotation.dynamic()); - parameter.setDefaultValue(parameterAnnotation.defaultValue()); - parameters[i] = parameter; - } - extensionMetaData.setParameters(Arrays.asList(parameters)); - - // Adding system parameters - SystemParameterMetaData[] systemParameters = - new SystemParameterMetaData[extensionAnnotation.systemParameter().length]; - for (int i = 0; i < extensionAnnotation.systemParameter().length; i++) { - SystemParameter systemParameterAnnotation = extensionAnnotation.systemParameter()[i]; - - SystemParameterMetaData systemParameter = new SystemParameterMetaData(); - systemParameter.setName(systemParameterAnnotation.name()); - systemParameter.setDescription(systemParameterAnnotation.description()); - systemParameter.setDefaultValue(systemParameterAnnotation.defaultValue()); - systemParameter.setPossibleParameters(Arrays.asList(systemParameterAnnotation.possibleParameters())); - systemParameters[i] = systemParameter; - } - extensionMetaData.setSystemParameters(Arrays.asList(systemParameters)); - - // Adding return attributes - ReturnAttributeMetaData[] returnAttributes = - new ReturnAttributeMetaData[extensionAnnotation.returnAttributes().length]; - for (int i = 0; i < extensionAnnotation.returnAttributes().length; i++) { - ReturnAttribute parameterAnnotation = extensionAnnotation.returnAttributes()[i]; - - ReturnAttributeMetaData returnAttribute = new ReturnAttributeMetaData(); - returnAttribute.setName(parameterAnnotation.name()); - returnAttribute.setType(Arrays.asList(parameterAnnotation.type())); - returnAttribute.setDescription(parameterAnnotation.description()); - returnAttributes[i] = returnAttribute; - } - extensionMetaData.setReturnAttributes(Arrays.asList(returnAttributes)); - - // Adding examples - ExampleMetaData[] examples = new ExampleMetaData[extensionAnnotation.examples().length]; - for (int i = 0; i < extensionAnnotation.examples().length; i++) { - Example exampleAnnotation = extensionAnnotation.examples()[i]; - - ExampleMetaData exampleMetaData = new ExampleMetaData(); - exampleMetaData.setSyntax(exampleAnnotation.syntax()); - exampleMetaData.setDescription(exampleAnnotation.description()); - examples[i] = exampleMetaData; - } - extensionMetaData.setExamples(Arrays.asList(examples)); - - // Finding the namespace - String namespaceName = extensionAnnotation.namespace(); - if (Objects.equals(namespaceName, "")) { - namespaceName = Constants.CORE_NAMESPACE; - } - - // Finding the relevant namespace in the namespace list - NamespaceMetaData namespace = null; - for (NamespaceMetaData existingNamespace : namespaceList) { - if (Objects.equals(existingNamespace.getName(), namespaceName)) { - namespace = existingNamespace; - break; - } - } - // Creating namespace if it doesn't exist - if (namespace == null) { - namespace = new NamespaceMetaData(); - namespace.setName(namespaceName); - namespace.setExtensionMap(new TreeMap<>()); - namespaceList.add(namespace); - } - - // Adding to the relevant extension metadata list in the namespace - List extensionMetaDataList = namespace.getExtensionMap() - .computeIfAbsent(extensionType, k -> new ArrayList<>()); - - extensionMetaDataList.add(extensionMetaData); - } - } - - /** - * Generate a file from a template - * - * @param templateFile The template file name - * @param dataModel The data model to be used for generating the output files from template files - * @param outputDirectory The output directory in which the file will be generated - * @param outputFileName The name of the file that will be generated - * @throws MojoFailureException if the Mojo fails to find template file or create new documentation file - */ - private static void generateFileFromTemplate(String templateFile, Map dataModel, - String outputDirectory, String outputFileName) - throws MojoFailureException { - // Creating the free marker configuration - Configuration cfg = new Configuration(Configuration.VERSION_2_3_25); - cfg.setDefaultEncoding("UTF-8"); - cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); - cfg.setClassForTemplateLoading( - DocumentationUtils.class, - File.separator + Constants.TEMPLATES_DIRECTORY - ); - - // Adding the constants to the freemarker data model - Map constantsClassFieldMap = new HashMap<>(); - for (Field field : Constants.class.getDeclaredFields()) { - try { - constantsClassFieldMap.put(field.getName(), field.get(null).toString()); - } catch (IllegalAccessException ignored) { // Ignoring inaccessible variables - } - } - dataModel.put("CONSTANTS", constantsClassFieldMap); - - // Adding the ExtensionType enum values to the freemarker data model - Map extensionTypeEnumMap = new HashMap<>(); - for (Field field : ExtensionType.class.getDeclaredFields()) { - try { - if (field.isEnumConstant()) { - extensionTypeEnumMap.put(field.getName(), ((ExtensionType) field.get(null)).getValue()); - } - } catch (IllegalAccessException ignored) { // Ignoring inaccessible variables - } - } - dataModel.put("EXTENSION_TYPE", extensionTypeEnumMap); - - try { - // Fetching the template - Template template = cfg.getTemplate(templateFile); - - // Generating empty documentation files - File outputFile = new File(outputDirectory + File.separator + outputFileName); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - throw new MojoFailureException("Unable to create directory " + outputFile.getParentFile()); - } - } - if (!outputFile.exists()) { - if (!outputFile.createNewFile()) { - throw new MojoFailureException("Unable to create file " + outputFile.getAbsolutePath()); - } - } - - // Writing to the documentation file - try (OutputStream outputStream = new FileOutputStream(outputFile)) { - try (Writer writer = new OutputStreamWriter(outputStream, Charset.defaultCharset())) { - template.process(dataModel, writer); - } - } catch (TemplateException e) { - throw new MojoFailureException("Invalid Free Marker template found in " + templateFile, e); - } - } catch (IOException e) { - throw new MojoFailureException("Unable to find template file " + templateFile, e); - } - } - - /** - * Executing a command - * - * @param command The command to be executed - * @param logger The maven plugin logger - * @return The output lines from executing the command - * @throws Throwable if any error occurs during the execution of the command - */ - private static List getCommandOutput(String[] command, Log logger) throws Throwable { - logger.info("Executing: " + String.join(" ", command)); - Process process = Runtime.getRuntime().exec(command); - List executionOutputLines = new ArrayList<>(); - - // Logging the output of the command execution - InputStream[] inputStreams = new InputStream[]{process.getInputStream(), process.getErrorStream()}; - BufferedReader bufferedReader = null; - try { - for (InputStream inputStream : inputStreams) { - bufferedReader = new BufferedReader(new InputStreamReader(inputStream, Constants.DEFAULT_CHARSET)); - String commandOutput; - while (true) { - commandOutput = bufferedReader.readLine(); - if (commandOutput == null) { - break; - } - - executionOutputLines.add(commandOutput); - } - } - process.waitFor(); - } finally { - IOUtils.closeQuietly(bufferedReader); - } - - return executionOutputLines; - } - - /** - * Executing a command. - * - * @param command The command to be executed - * @param logger The maven plugin logger - * @throws Throwable if any error occurs during the execution of the command - */ - private static void executeCommand(String[] command, Log logger) throws Throwable { - List executionOutputLines = getCommandOutput(command, logger); - for (String executionOutputLine : executionOutputLines) { - logger.debug(executionOutputLine); - } - } -} diff --git a/modules/siddhi-doc-gen/src/main/resources/templates/documentation.md.ftl b/modules/siddhi-doc-gen/src/main/resources/templates/documentation.md.ftl deleted file mode 100755 index 438b88ef69..0000000000 --- a/modules/siddhi-doc-gen/src/main/resources/templates/documentation.md.ftl +++ /dev/null @@ -1,147 +0,0 @@ -<#-- - ~ Copyright (c) 2017, 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. - --> -<#import "utils.ftl" as utils> -# API Docs - v${latestDocumentationVersion} - -<#list metaData as namespace> -## ${namespace.name?capitalize} - -<#list namespace.extensionMap as extensionType, extensionsList> -<#list extensionsList as extension> -### ${extension.name} *<@utils.renderLinkToExtensionTypeDoc extensionType=extensionType/>* - -

${formatDescription(extension.description)}

- -<@utils.renderHeadingFourWithStylesOnly heading="Syntax"/> - -<#if [EXTENSION_TYPE.FUNCTION, EXTENSION_TYPE.ATTRIBUTE_AGGREGATOR]?seq_index_of(extensionType) != -1> -``` -<#if extension.returnAttributes??><#list extension.returnAttributes><<#items as returnAttribute>${returnAttribute.type?join("|", "")}> <#if namespace.name != CONSTANTS.CORE_NAMESPACE>${namespace.name}:${extension.name}(<#list extension.parameters><#items as parameter><${parameter.type?join("|", "")}> ${parameter.name}<#sep>, ) -``` -<#elseif [EXTENSION_TYPE.STREAM_PROCESSOR, EXTENSION_TYPE.STREAM_FUNCTION, EXTENSION_TYPE.WINDOW]?seq_index_of(extensionType) != -1> -``` -<#if namespace.name != CONSTANTS.CORE_NAMESPACE>${namespace.name}:${extension.name}(<#list extension.parameters><#items as parameter><${parameter.type?join("|", "")}> ${parameter.name}<#sep>, ) -``` -<#elseif [EXTENSION_TYPE.SOURCE, EXTENSION_TYPE.SINK]?seq_index_of(extensionType) != -1> -``` -@${extensionType?lower_case}(type="${extension.name}"<#list extension.parameters as parameter>, ${parameter.name}="<${parameter.type?join("|", "")}>", @map(...))) -``` -<#elseif extensionType == EXTENSION_TYPE.SOURCE_MAPPER> -``` -@source(..., @map(type="${extension.name}"<#list extension.parameters as parameter>, ${parameter.name}="<${parameter.type?join("|", "")}>") -``` -<#elseif extensionType == EXTENSION_TYPE.SINK_MAPPER> -``` -@sink(..., @map(type="${extension.name}"<#list extension.parameters as parameter>, ${parameter.name}="<${parameter.type?join("|", "")}>") -``` -<#elseif extensionType == EXTENSION_TYPE.STORE> -``` -@Store(type="${extension.name}"<#list extension.parameters as parameter>, ${parameter.name}="<${parameter.type?join("|", "")}>") -@PrimaryKey("PRIMARY_KEY") -@Index("INDEX") -``` -<#elseif extensionType == EXTENSION_TYPE.SCRIPT> -``` -define function [${extension.name}] return { - // Script code -}; -``` - -<#list extension.parameters> - -<@utils.renderHeadingFiveWithStylesOnly heading="Query Parameters"/> - - - - - - - - - - - <#items as parameter> - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
${parameter.name}${formatDescription(parameter.description)}${parameter.defaultValue}${parameter.type?join("
", "")}
<#if parameter.optional>Yes<#else>No<#if parameter.dynamic>Yes<#else>No
- -<#list extension.systemParameters> - -<@utils.renderHeadingFourWithStylesOnly heading="System Parameters"/> - - - - - - - - - <#items as systemParameter> - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
${systemParameter.name}${formatDescription(systemParameter.description)}${systemParameter.defaultValue}${systemParameter.possibleParameters?join("
", "")}
- -<#if [EXTENSION_TYPE.STREAM_PROCESSOR, EXTENSION_TYPE.STREAM_FUNCTION]?seq_index_of(extensionType) != -1> -<#list extension.returnAttributes> -<@utils.renderHeadingFourWithStylesOnly heading="Extra Return Attributes"/> - - - - - - - - <#items as returnAttribute> - - - - - - -
NameDescriptionPossible Types
${returnAttribute.name}${formatDescription(returnAttribute.description)}${returnAttribute.type?join("
", "")}
- - - -<#list extension.examples> -<@utils.renderHeadingFourWithStylesOnly heading="Examples"/> - -<#items as example> -<@utils.renderHeadingFiveWithStylesOnly heading=("Example " + (example?index + 1))/> - -``` -${example.syntax} -``` -

${formatDescription(example.description)}

- - - - - - diff --git a/modules/siddhi-doc-gen/src/main/resources/templates/extensions.md.ftl b/modules/siddhi-doc-gen/src/main/resources/templates/extensions.md.ftl deleted file mode 100644 index c00de0354e..0000000000 --- a/modules/siddhi-doc-gen/src/main/resources/templates/extensions.md.ftl +++ /dev/null @@ -1,38 +0,0 @@ -<#-- - ~ Copyright (c) 2017, 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. - --> -# Siddhi Extensions - -## Available Extensions - -Following are some prewritten extensions that are supported with Siddhi; - -<#macro displayRepositoriesList title extensionRepositories> -<#list extensionRepositories> -### ${title} -<#items as extensionRepository> -1. ${extensionRepository?replace(CONSTANTS.GITHUB_GPL_EXTENSION_REPOSITORY_PREFIX, "", "rf")?replace(CONSTANTS.GITHUB_APACHE_EXTENSION_REPOSITORY_PREFIX, "", "rf")?replace("-", " ")} - - - - -<@displayRepositoriesList title="Extensions released under Apache 2.0 License" extensionRepositories=apacheExtensionRepositories/> -<@displayRepositoriesList title="Extensions released under GPL License" extensionRepositories=gplExtensionRepositories/> - -## Extension Repositories - -All the extension repositories maintained by WSO2 can be found here diff --git a/modules/siddhi-doc-gen/src/main/resources/templates/headings-update.md.ftl b/modules/siddhi-doc-gen/src/main/resources/templates/headings-update.md.ftl deleted file mode 100644 index f8c1b92916..0000000000 --- a/modules/siddhi-doc-gen/src/main/resources/templates/headings-update.md.ftl +++ /dev/null @@ -1,57 +0,0 @@ -<#-- - ~ Copyright (c) 2017, 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. - --> -<#import "utils.ftl" as utils> -<#assign skipMaxHeadingLevel = -1> -<#if extensionRepositoryName == CONSTANTS.FREEMARKER_SIDDHI_REPOSITORY_ARTIFACT_ID> - <#assign repositoryOwner = "wso2"> -<#else> - <#assign repositoryOwner = "wso2-extensions"> - <#assign extensionRepositoryName = extensionRepositoryName?replace(CONSTANTS.FREEMARKER_EXTENSION_REPOSITORY_PARENT_POSTFIX, "", "r")> - -<#macro renderLine line> -${line} -<#if line?starts_with(CONSTANTS.FREEMARKER_FEATURES_HEADING)> -<#assign skipMaxHeadingLevel = line?index_of(" ")> - -<#if metaData??> -<#list metaData as namespace> -<#list namespace.extensionMap as extensionType, extensionsList> -<#list extensionsList as extension> -* ">${extension.name} *<@utils.renderLinkToExtensionTypeDoc extensionType=extensionType/>*

${formatDescription(extension.description)}

- - -<#else> -No Features Currently Available - - - -<#elseif line?starts_with(CONSTANTS.FREEMARKER_LATEST_API_DOCS_HEADING)> -<#assign skipMaxHeadingLevel = line?index_of(" ")> - -Latest API Docs is ${latestDocumentationVersion}. - - - -<#list inputFileLines as inputFileLine> -<#if skipMaxHeadingLevel == -1> -<@renderLine line=inputFileLine/> -<#elseif inputFileLine?starts_with("#") && skipMaxHeadingLevel gte inputFileLine?index_of(" ")> -<#assign skipMaxHeadingLevel = -1> -<@renderLine line=inputFileLine/> - - diff --git a/modules/siddhi-doc-gen/src/main/resources/templates/utils.ftl b/modules/siddhi-doc-gen/src/main/resources/templates/utils.ftl deleted file mode 100644 index b663ad8756..0000000000 --- a/modules/siddhi-doc-gen/src/main/resources/templates/utils.ftl +++ /dev/null @@ -1,30 +0,0 @@ -<#-- - ~ Copyright (c) 2017, 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. - --> -<#macro getHTMLIDForHeading heading>${heading?lower_case?replace(" ", "-", "r")} - -<#macro renderLinkToExtensionTypeDoc extensionType>(${extensionType}) - -<#macro renderHeadingOneWithStylesOnly heading>${heading} - -<#macro renderHeadingTwoWithStylesOnly heading>${heading} - -<#macro renderHeadingThreeWithStylesOnly heading>${heading} - -<#macro renderHeadingFourWithStylesOnly heading>${heading} - -<#macro renderHeadingFiveWithStylesOnly heading>${heading?upper_case} diff --git a/modules/siddhi-query-api/pom.xml b/modules/siddhi-query-api/pom.xml index 02cff66ab1..cf792dc371 100644 --- a/modules/siddhi-query-api/pom.xml +++ b/modules/siddhi-query-api/pom.xml @@ -67,15 +67,6 @@ - - org.jacoco - jacoco-maven-plugin - - - - ../../findbugs-exclude.xml - - diff --git a/modules/siddhi-query-compiler/pom.xml b/modules/siddhi-query-compiler/pom.xml index 2c365a9380..8306917ad4 100644 --- a/modules/siddhi-query-compiler/pom.xml +++ b/modules/siddhi-query-compiler/pom.xml @@ -99,14 +99,6 @@ - - org.jacoco - jacoco-maven-plugin - - - - findbugs-exclude.xml - diff --git a/modules/siddhi-samples/performance-samples/build.xml b/modules/siddhi-samples/performance-samples/build.xml deleted file mode 100644 index 21697822d8..0000000000 --- a/modules/siddhi-samples/performance-samples/build.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/siddhi-samples/performance-samples/pom.xml b/modules/siddhi-samples/performance-samples/pom.xml deleted file mode 100644 index 623664a697..0000000000 --- a/modules/siddhi-samples/performance-samples/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - org.graylog.repackaged.siddhi - siddhi-samples - 4.5.11 - - 4.0.0 - performance-samples - Siddhi Performance Samples - - - - - org.graylog.repackaged.siddhi - siddhi-query-api - compile - - - org.graylog.repackaged.siddhi - siddhi-query-compiler - compile - - - org.graylog.repackaged.siddhi - siddhi-core - compile - - - org.apache.log4j.wso2 - log4j - compile - - - org.antlr - antlr4-runtime - compile - - - org.wso2.orbit.com.lmax - disruptor - compile - - - - diff --git a/modules/siddhi-samples/performance-samples/readme.txt b/modules/siddhi-samples/performance-samples/readme.txt deleted file mode 100644 index e634c88e57..0000000000 --- a/modules/siddhi-samples/performance-samples/readme.txt +++ /dev/null @@ -1,8 +0,0 @@ - -ReadMe on running the performance samples -========================================= - -1. run "ant" from "performance-samples" (this) directory to build the performance samples -2. run "ant SimpleFilterSingleQuery" to run the simple filter performance sample -3. run "ant SimpleFilterMultipleQuery" to run the two simple filter queries performance sample -4. run "ant SimpleFilterMultipleQueryWithDisruptor" to run the two simple filter queries with disruptor enabled performance sample diff --git a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/NoIndexingTablePerformance.java b/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/NoIndexingTablePerformance.java deleted file mode 100644 index 08548dfb30..0000000000 --- a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/NoIndexingTablePerformance.java +++ /dev/null @@ -1,192 +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.siddhi.performance; - -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.stream.input.InputHandler; - -import java.util.Random; - -public class NoIndexingTablePerformance { - - public static boolean output = false; - public static int numberOfEventsStored = 1000000; - public static int numberOfEventsChunked = 10000; - - public static void main(String[] args) throws InterruptedException { - - SiddhiManager siddhiManager = new SiddhiManager(); - - String siddhiApp = "" + -// "@app:async" + -// " " + - "define stream StockCheckStream (symbol string, company string, price float, volume int, timestamp " + - "long);" + - "define stream StockInputStream (symbol string, company string, price float, volume int); " + - "" + - "@PrimaryKey('symbol')" + - "@Index('volume')" + - "define table StockTable (symbol string, company string, price float, volume int);" + - "" + - "@info(name = 'query1') " + - "from StockInputStream " + - "select symbol, company, price, volume " + - "insert into StockTable ;" + - "" + - "@info(name = 'query2') " + - "from StockCheckStream join StockTable " + - "on StockCheckStream.symbol == StockTable.symbol and StockCheckStream.volume == StockTable.volume " + - "select StockCheckStream.timestamp, StockCheckStream.symbol, StockCheckStream.company, " + - "StockCheckStream.price, StockCheckStream.volume " + - "insert into OutputStream ;" + - "" + -// "@info(name = 'query2') " + -// "from StockCheckStream " + -// "select volume " + -// "delete StockTable " + -// "on volume < StockTable.volume " + -// "" + -// "@info(name = 'query2') " + -// "from StockCheckStream " + -// "select symbol, price " + -// "update StockTable " + -// "on symbol == StockTable.symbol " + -// "" + -// "@info(name = 'query2') " + -// "from StockCheckStream[volume < StockTable.volume in StockTable] " + -// "select symbol, price " + -// "insert into OutputStream; " + - ""; - - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - System.out.println("Throughput\tLatency\tAvg Throughput\tAvg Latency"); - -// siddhiAppRuntime.addCallback("OutputStream", new StreamCallback() { -// public volatile double eventCount = 0; -// public volatile double timeSpent = 0; -// public volatile double totalThroughput = 0; -// public volatile double totalLatency = 0; -// public volatile double totalIterations = 0; -// volatile long startTime = System.currentTimeMillis(); -// -// @Override -// public void receive(Event[] events) { -// -//// EventPrinter.print(events); -// for (Event event : events) { -// if (output) { -// eventCount++; -// timeSpent += (System.currentTimeMillis() - (Long) events[0].getData(0)); -// if (eventCount % numberOfEventsChunked == 0) { -// synchronized (this) { -// totalIterations++; -// double throughput = (eventCount * 1000.0) / ((System.currentTimeMillis()) - -// startTime); -// double latency = (timeSpent * 1.0 / eventCount); -// totalThroughput += throughput; -// totalLatency += latency; -// System.out.println(throughput + "\t" + latency + "\t" + totalThroughput / -// totalIterations + "\t" + totalLatency / totalIterations); -// startTime = System.currentTimeMillis(); -// eventCount = 0; -// timeSpent = 0; -// } -// } -// } -// } -// } -// -// }); - - InputHandler stockCheckInputHandler = siddhiAppRuntime.getInputHandler("StockCheckStream"); - InputHandler stockInputInputHandler = siddhiAppRuntime.getInputHandler("StockInputStream"); - siddhiAppRuntime.start(); - - Random random = new Random(); - for (int i = 0; i < numberOfEventsStored; i++) { - stockInputInputHandler.send(new Object[]{"" + i, "" + i, i * 1.0f, i}); - } - - for (int i = 0; i < 1; i++) { - EventPublisher eventPublisher = new EventPublisher(stockCheckInputHandler, random); - eventPublisher.run(); - } - //siddhiAppRuntime.shutdown(); - } - - - static class EventPublisher implements Runnable { - - public volatile double eventCount = 0; - public volatile double timeSpent = 0; - public volatile double totalThroughput = 0; - public volatile double totalLatency = 0; - public volatile double totalIterations = 0; - volatile long startTime = System.currentTimeMillis(); - - - InputHandler inputHandler; - private Random random; - - EventPublisher(InputHandler inputHandler, Random random) { - this.inputHandler = inputHandler; - this.random = random; - } - - @Override - public void run() { - int count = 100000000; - while (count > 0) { - count--; - try { - int number = random.nextInt(numberOfEventsStored); -// int number = (numberOfEventsStored*99)/100; - long startEventTime = System.currentTimeMillis(); - inputHandler.send(new Object[]{"" + number, "" + number, random.nextFloat(), number, System - .currentTimeMillis()}); - if (!output) { - eventCount++; - timeSpent += (System.currentTimeMillis() - startEventTime); - if (eventCount % numberOfEventsChunked == 0) { - synchronized (this) { - totalIterations++; - if (totalIterations == 1001) { - System.exit(0); - } - double throughput = (eventCount * 1000.0) / ((System.currentTimeMillis()) - startTime); - double latency = (timeSpent * 1.0 / eventCount); - totalThroughput += throughput; - totalLatency += latency; - System.out.println(throughput + "\t" + latency + "\t" + totalThroughput / - totalIterations + "\t" + totalLatency / totalIterations); - startTime = System.currentTimeMillis(); - eventCount = 0; - timeSpent = 0; - } - } - } - } catch (InterruptedException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - } - } -} diff --git a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/PartitionPerformance.java b/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/PartitionPerformance.java deleted file mode 100644 index a5971cfd05..0000000000 --- a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/PartitionPerformance.java +++ /dev/null @@ -1,64 +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.siddhi.performance; - -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.stream.output.StreamCallback; - -public class PartitionPerformance { - private static int count = 0; - - public static void main(String[] args) throws InterruptedException { - SiddhiManager siddhiManager = new SiddhiManager(); - - String siddhiApp = "" + - "define stream cseEventStream (symbol string, price float, volume long);" + - "" + - "partition with (symbol of cseEventStream) " + - "begin " + - " @info(name = 'query1') " + - " from cseEventStream[700 > price] " + - " select * " + - " insert into outputStream ;" + - "end;"; - - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - siddhiAppRuntime.addCallback("outputStream", new StreamCallback() { - - @Override - public void receive(Event[] events) { -// EventPrinter.print(events); - } - }); - - - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("cseEventStream"); - siddhiAppRuntime.start(); - - while (true) { - count++; - inputHandler.send(new Object[]{"WSO2" + count, 55.6f, 100}); - System.out.println("Partition created :" + count); - } - - } -} diff --git a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterMultipleQueryPerformance.java b/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterMultipleQueryPerformance.java deleted file mode 100644 index 6b2d1b619c..0000000000 --- a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterMultipleQueryPerformance.java +++ /dev/null @@ -1,109 +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.siddhi.performance; - -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.stream.output.StreamCallback; - -public class SimpleFilterMultipleQueryPerformance { - - public static void main(String[] args) throws InterruptedException { - SiddhiManager siddhiManager = new SiddhiManager(); - - String siddhiApp = "" + - "define stream cseEventStream (symbol string, price float, volume int, timestamp long);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream[70 > price] " + - "select * " + - "insert into outputStream ;" + - "" + - "@info(name = 'query2') " + - "from cseEventStream[volume > 90] " + - "select * " + - "insert into outputStream ;"; - - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - siddhiAppRuntime.addCallback("outputStream", new StreamCallback() { - public int eventCount = 0; - public int timeSpent = 0; - long startTime = System.currentTimeMillis(); - - @Override - public void receive(Event[] events) { - for (Event event : events) { - eventCount++; - timeSpent += (System.currentTimeMillis() - (Long) event.getData(3)); - if (eventCount % 1000000 == 0) { - System.out.println("Throughput : " + (eventCount * 1000) / ((System.currentTimeMillis()) - - startTime)); - System.out.println("Time spent : " + (timeSpent * 1.0 / eventCount)); - startTime = System.currentTimeMillis(); - eventCount = 0; - timeSpent = 0; - } - } - } - - }); - - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("cseEventStream"); - siddhiAppRuntime.start(); - - - for (int i = 0; i <= 100; i++) { - EventPublisher eventPublisher = new EventPublisher(inputHandler); - eventPublisher.run(); - } - //siddhiAppRuntime.shutdown(); - } - - - static class EventPublisher implements Runnable { - - InputHandler inputHandler; - - EventPublisher(InputHandler inputHandler) { - this.inputHandler = inputHandler; - } - - @Override - public void run() { - while (true) { - try { - inputHandler.send(new Object[]{"WSO2", 55.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 100f, 80, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 55.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 100f, 80, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - } catch (InterruptedException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - - - } - } -} diff --git a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterMultipleQueryWithDisruptorPerformance.java b/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterMultipleQueryWithDisruptorPerformance.java deleted file mode 100644 index 6cae6e33d1..0000000000 --- a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterMultipleQueryWithDisruptorPerformance.java +++ /dev/null @@ -1,109 +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.siddhi.performance; - -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.stream.output.StreamCallback; - -public class SimpleFilterMultipleQueryWithDisruptorPerformance { - - public static void main(String[] args) throws InterruptedException { - SiddhiManager siddhiManager = new SiddhiManager(); - - String siddhiApp = "" + - "@app:async" + - " " + - "define stream cseEventStream (symbol string, price float, volume int, timestamp long);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream[70 > price] " + - "select * " + - "insert into outputStream ;" + - "" + - "@info(name = 'query2') " + - "from cseEventStream[volume > 90] " + - "select * " + - "insert into outputStream ;"; - - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - siddhiAppRuntime.addCallback("outputStream", new StreamCallback() { - public int eventCount = 0; - public int timeSpent = 0; - long startTime = System.currentTimeMillis(); - - @Override - public void receive(Event[] events) { - for (Event event : events) { - eventCount++; - timeSpent += (System.currentTimeMillis() - (Long) event.getData(3)); - if (eventCount % 1000000 == 0) { - System.out.println("Throughput : " + (eventCount * 1000) / ((System.currentTimeMillis()) - - startTime)); - System.out.println("Time spent : " + (timeSpent * 1.0 / eventCount)); - startTime = System.currentTimeMillis(); - eventCount = 0; - timeSpent = 0; - } - } - } - - }); - - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("cseEventStream"); - siddhiAppRuntime.start(); - - - for (int i = 0; i <= 100; i++) { - EventPublisher eventPublisher = new EventPublisher(inputHandler); - eventPublisher.run(); - } - //siddhiAppRuntime.shutdown(); - } - - - static class EventPublisher implements Runnable { - - InputHandler inputHandler; - - EventPublisher(InputHandler inputHandler) { - this.inputHandler = inputHandler; - } - - @Override - public void run() { - while (true) { - try { - inputHandler.send(new Object[]{"WSO2", 55.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 100f, 80, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 55.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 100f, 80, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - } catch (InterruptedException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - } - } -} diff --git a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSingleQueryPerformance.java b/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSingleQueryPerformance.java deleted file mode 100644 index 4115992253..0000000000 --- a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSingleQueryPerformance.java +++ /dev/null @@ -1,77 +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.siddhi.performance; - -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.stream.output.StreamCallback; - -public class SimpleFilterSingleQueryPerformance { - - public static void main(String[] args) throws InterruptedException { - SiddhiManager siddhiManager = new SiddhiManager(); - - String siddhiApp = "" + - "define stream cseEventStream (symbol string, price float, volume long, timestamp long);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream[700 > price] " + - "select * " + - "insert into outputStream ;"; - - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - siddhiAppRuntime.addCallback("outputStream", new StreamCallback() { - public int eventCount = 0; - public int timeSpent = 0; - long startTime = System.currentTimeMillis(); - - @Override - public void receive(Event[] events) { - for (Event event : events) { - eventCount++; - timeSpent += (System.currentTimeMillis() - (Long) event.getData(3)); - if (eventCount % 1000000 == 0) { - System.out.println("Throughput : " + (eventCount * 1000) / ((System.currentTimeMillis()) - - startTime)); - System.out.println("Time spent : " + (timeSpent * 1.0 / eventCount)); - startTime = System.currentTimeMillis(); - eventCount = 0; - timeSpent = 0; - } - } - } - }); - - - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("cseEventStream"); - siddhiAppRuntime.start(); - while (true) { - inputHandler.send(new Object[]{"WSO2", 55.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 100f, 80, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 55.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 100f, 80, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - } - - } -} diff --git a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSingleQueryWithDisruptorPerformance.java b/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSingleQueryWithDisruptorPerformance.java deleted file mode 100644 index 5db01bb945..0000000000 --- a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSingleQueryWithDisruptorPerformance.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.siddhi.performance; - -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.stream.output.StreamCallback; - -public class SimpleFilterSingleQueryWithDisruptorPerformance { - - public static void main(String[] args) throws InterruptedException { - SiddhiManager siddhiManager = new SiddhiManager(); - - String siddhiApp = "" + - "@app:async " + - "" + - "define stream cseEventStream (symbol string, price float, volume long, timestamp long);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream[700 > price] " + - "select * " + - "insert into outputStream ;"; - - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - siddhiAppRuntime.addCallback("outputStream", new StreamCallback() { - public int eventCount = 0; - public int timeSpent = 0; - long startTime = System.currentTimeMillis(); - - @Override - public void receive(Event[] events) { - for (Event event : events) { - eventCount++; - timeSpent += (System.currentTimeMillis() - (Long) event.getData(3)); - if (eventCount % 1000000 == 0) { - System.out.println("Throughput : " + (eventCount * 1000) / ((System.currentTimeMillis()) - - startTime)); - System.out.println("Time spent : " + (timeSpent * 1.0 / eventCount)); - startTime = System.currentTimeMillis(); - eventCount = 0; - timeSpent = 0; - } - } - } - - }); - - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("cseEventStream"); - siddhiAppRuntime.start(); - while (true) { - inputHandler.send(new Object[]{"WSO2", 55.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 100f, 80, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 55.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"WSO2", 100f, 80, System.currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", 75.6f, 100, System.currentTimeMillis()}); - } -// siddhiAppRuntime.shutdown(); - } -} diff --git a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSyncPerformance.java b/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSyncPerformance.java deleted file mode 100644 index 4ae3ee73b3..0000000000 --- a/modules/siddhi-samples/performance-samples/src/main/java/org/wso2/siddhi/performance/SimpleFilterSyncPerformance.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.siddhi.performance; - -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.stream.output.StreamCallback; - -public class SimpleFilterSyncPerformance { - private static int count = 0; - private static volatile long start = System.currentTimeMillis(); - - public static void main(String[] args) throws InterruptedException { - SiddhiManager siddhiManager = new SiddhiManager(); - - String cseEventStream = " " + - "define stream RequestStream (messageID string, app_key string, api_key string, app_tier string, " + - "api_tier string, user_id string, properties string, timeNow long); " + - "define stream EligibilityStream (rule string, messageID string, isEligible bool, isLocallyThrottled " + - "bool, throttle_key string , timeNow long); "; - - String query = "" + - "@info(name = 'query1') " + - "FROM RequestStream " + - "SELECT 'sub_gold' AS rule, messageID, ( api_tier == 'Gold') AS isEligible,false as " + - "isLocallyThrottled, 'sub_gold_TEST1TEST1Test1_key' AS throttle_key , timeNow \n" + - "INSERT INTO EligibilityStream; " + - "@info(name = 'query2') " + - "FROM EligibilityStream[isEligible==false]\n" + - "\t\tSELECT rule, messageID, false AS isThrottled , timeNow\n" + - "\t\tINSERT INTO ThrottleStream;\n" + - "\n" + - "@info(name = 'query3') " + - "FROM EligibilityStream[isEligible==true AND isLocallyThrottled==true]\n" + - "\t\tSELECT rule, messageID, true AS isThrottled , timeNow \n" + - "\t\tINSERT INTO ThrottleStream; \n" + - "\n" + - "@info(name = 'query4') " + - "FROM EligibilityStream[isEligible==true AND isLocallyThrottled==false]\n" + - "\t\tSELECT rule, messageID, false AS isThrottled, timeNow \n" + - "\t\tINSERT INTO ThrottleStream; "; - - - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(cseEventStream + query); - siddhiAppRuntime.addCallback("ThrottleStream", new StreamCallback() { - public int eventCount = 0; - public int timeSpent = 0; - long startTime = System.currentTimeMillis(); - - @Override - public void receive(Event[] events) { - for (Event event : events) { - eventCount++; - timeSpent += (System.currentTimeMillis() - (Long) event.getData(3)); - if (eventCount % 1000000 == 0) { - System.out.println("Throughput : " + (eventCount * 1000) / ((System.currentTimeMillis - ()) - startTime)); - System.out.println("Time spent : " + (timeSpent * 1.0 / eventCount)); - startTime = System.currentTimeMillis(); - eventCount = 0; - timeSpent = 0; - } - } - } - } - ); - - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("RequestStream"); - siddhiAppRuntime.start(); - - for (int i = 0; i <= 100; i++) { - EventPublisher eventPublisher = new EventPublisher(inputHandler); - eventPublisher.run(); - } - //siddhiAppRuntime.shutdown(); - } - - - static class EventPublisher implements Runnable { - - InputHandler inputHandler; - - EventPublisher(InputHandler inputHandler) { - this.inputHandler = inputHandler; - } - - @Override - public void run() { - while (true) { - try { - inputHandler.send(new Object[]{"IBM", "TEST1", "TEST1", "TEST1", "Gold", "Test1", null, System - .currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", "TEST1", "TEST1", "TEST1", "Gold", "Test1", null, System - .currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", "TEST1", "TEST1", "TEST1", "Gold", "Test1", null, System - .currentTimeMillis()}); - inputHandler.send(new Object[]{"IBM", "TEST1", "TEST1", "TEST1", "Gold", "Test1", null, System - .currentTimeMillis()}); - } catch (InterruptedException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - - - } - } -} diff --git a/modules/siddhi-samples/performance-samples/src/main/resources/log4j.properties b/modules/siddhi-samples/performance-samples/src/main/resources/log4j.properties deleted file mode 100644 index 2c00a08cfc..0000000000 --- a/modules/siddhi-samples/performance-samples/src/main/resources/log4j.properties +++ /dev/null @@ -1,31 +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. -# -# For the general syntax of property based configuration files see the -# documenation of org.apache.log4j.PropertyConfigurator. -# The root category uses the appender called A1. Since no priority is -# specified, the root category assumes the default priority for root -# which is DEBUG in log4j. The root category is the only category that -# has a default priority. All other categories need not be assigned a -# priority in which case they inherit their priority from the -# hierarchy. -#log4j.rootLogger=DEBUG, stdout -log4j.rootLogger=INFO, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%m%n -#log4j.appender.stdout.layout.ConversionPattern=[%t] %-5p %c %x - %m%n diff --git a/modules/siddhi-samples/pom.xml b/modules/siddhi-samples/pom.xml deleted file mode 100644 index ccb6c7da64..0000000000 --- a/modules/siddhi-samples/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - siddhi - org.graylog.repackaged.siddhi - 4.5.11 - ../../pom.xml - - 4.0.0 - siddhi-samples - Siddhi Samples - pom - - - performance-samples - quick-start-samples - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - false - - - copy - package - - copy - - - - - org.apache.log4j.wso2 - log4j - ${log4j.version} - false - ${project.basedir}/target/lib - - - - org.wso2.orbit.com.lmax - disruptor - ${disruptor.version} - false - ${project.basedir}/target/lib - - - - org.antlr - antlr4-runtime - ${antlr.runtime.version} - false - ${project.basedir}/target/lib - - - - org.graylog.repackaged.siddhi - siddhi-core - ${project.version} - true - ${project.basedir}/target/lib - - - - org.graylog.repackaged.siddhi - siddhi-query-api - ${project.version} - true - ${project.basedir}/target/lib - - - - org.graylog.repackaged.siddhi - siddhi-query-compiler - ${project.version} - true - ${project.basedir}/target/lib - - - - - - - - - - - diff --git a/modules/siddhi-samples/quick-start-samples/build.xml b/modules/siddhi-samples/quick-start-samples/build.xml deleted file mode 100644 index f349ffd6e6..0000000000 --- a/modules/siddhi-samples/quick-start-samples/build.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/siddhi-samples/quick-start-samples/pom.xml b/modules/siddhi-samples/quick-start-samples/pom.xml deleted file mode 100644 index 3726a868c2..0000000000 --- a/modules/siddhi-samples/quick-start-samples/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - siddhi-samples - org.graylog.repackaged.siddhi - 4.5.11 - - 4.0.0 - - quick-start-samples - Siddhi Quick Start Samples - - - - - org.graylog.repackaged.siddhi - siddhi-query-api - compile - - - org.graylog.repackaged.siddhi - siddhi-query-compiler - compile - - - org.graylog.repackaged.siddhi - siddhi-core - compile - - - org.apache.log4j.wso2 - log4j - compile - - - org.antlr - antlr4-runtime - compile - - - org.wso2.orbit.com.lmax - disruptor - compile - - - - \ No newline at end of file diff --git a/modules/siddhi-samples/quick-start-samples/readme.txt b/modules/siddhi-samples/quick-start-samples/readme.txt deleted file mode 100644 index ec0c5a7eb6..0000000000 --- a/modules/siddhi-samples/quick-start-samples/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ - -ReadMe on running the samples -============================= - -1. run "ant" from "quick-start-samples" (this) directory to build the samples -2. run "ant simpleFilter" to run the simple filter sample -3. run "ant function" to run the simple function sample -4. run "ant extension" to run the simple extension sample -5. run "ant partition" to run the simple extension sample \ No newline at end of file diff --git a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/ExtensionSample.java b/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/ExtensionSample.java deleted file mode 100644 index 21492266f0..0000000000 --- a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/ExtensionSample.java +++ /dev/null @@ -1,76 +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.siddhi.sample; - -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 org.wso2.siddhi.sample.util.CustomFunctionExtension; - -public class ExtensionSample { - - public static void main(String[] args) throws InterruptedException { - - // Creating Siddhi Manager - SiddhiManager siddhiManager = new SiddhiManager(); - siddhiManager.setExtension("custom:plus", CustomFunctionExtension.class); - - - String siddhiApp = "" + - "define stream cseEventStream (symbol string, price long, volume long);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream " + - "select symbol , custom:plus(price,volume) as totalCount " + - "insert into Output;"; - - //Generating runtime - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - //Adding callback to retrieve output events from query - siddhiAppRuntime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - EventPrinter.print(timestamp, inEvents, removeEvents); - } - }); - - //Retrieving InputHandler to push events into Siddhi - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("cseEventStream"); - - //Starting event processing - siddhiAppRuntime.start(); - - //Sending events to Siddhi - inputHandler.send(new Object[]{"IBM", 700L, 100L}); - inputHandler.send(new Object[]{"WSO2", 600L, 200L}); - inputHandler.send(new Object[]{"GOOG", 60L, 200L}); - Thread.sleep(500); - - //Shutting down the runtime - siddhiAppRuntime.shutdown(); - - //Shutting down Siddhi - siddhiManager.shutdown(); - - } -} diff --git a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/FunctionSample.java b/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/FunctionSample.java deleted file mode 100644 index ec74100e5d..0000000000 --- a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/FunctionSample.java +++ /dev/null @@ -1,73 +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.siddhi.sample; - -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; - -public class FunctionSample { - public static void main(String[] args) throws InterruptedException { - - // Creating Siddhi Manager - SiddhiManager siddhiManager = new SiddhiManager(); - - String siddhiApp = "" + - "define stream cseEventStream (symbol string, price1 float, price2 float, volume long , quantity int)" + - ";" + - "" + - "@info(name = 'query1') " + - "from cseEventStream " + - "select symbol, coalesce(price1,price2) as price, quantity " + - "insert into outputStream;"; - - //Generating runtime - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - //Adding callback to retrieve output events from query - siddhiAppRuntime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - EventPrinter.print(timestamp, inEvents, removeEvents); - } - }); - - //Retrieving InputHandler to push events into Siddhi - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("cseEventStream"); - - //Starting event processing - siddhiAppRuntime.start(); - - //Sending events to Siddhi - inputHandler.send(new Object[]{"WSO2", 50f, 60f, 60L, 6}); - inputHandler.send(new Object[]{"WSO2", 70f, null, 40L, 10}); - inputHandler.send(new Object[]{"WSO2", null, 44f, 200L, 56}); - Thread.sleep(100); - - //Shutting down the runtime - siddhiAppRuntime.shutdown(); - - //Shutting down Siddhi - siddhiManager.shutdown(); - - } -} diff --git a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/PartitionSample.java b/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/PartitionSample.java deleted file mode 100644 index 976c9c3bf6..0000000000 --- a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/PartitionSample.java +++ /dev/null @@ -1,77 +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.siddhi.sample; - -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.stream.output.StreamCallback; -import org.wso2.siddhi.core.util.EventPrinter; - -public class PartitionSample { - - public static void main(String[] args) throws InterruptedException { - - // Creating Siddhi Manager - SiddhiManager siddhiManager = new SiddhiManager(); - - - String siddhiApp = "" + - "define stream cseEventStream (symbol string, price float,volume int);" + - "" + - "partition with (symbol of cseEventStream)" + - "begin" + - " @info(name = 'query') " + - " from cseEventStream " + - " select symbol, sum(price) as price, volume " + - " insert into OutStockStream ;" + - "end "; - - //Generating runtime - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - //Adding callback to retrieve output events from stream - siddhiAppRuntime.addCallback("OutStockStream", new StreamCallback() { - @Override - public void receive(Event[] events) { - EventPrinter.print(events); - } - }); - - //Retrieving InputHandler to push events into Siddhi - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("cseEventStream"); - - //Starting event processing - siddhiAppRuntime.start(); - - //Sending events to Siddhi - inputHandler.send(new Object[]{"IBM", 75f, 100}); - inputHandler.send(new Object[]{"WSO2", 705f, 100}); - inputHandler.send(new Object[]{"IBM", 35f, 100}); - inputHandler.send(new Object[]{"ORACLE", 50.0f, 100}); - Thread.sleep(1000); - - //Shutting down the runtime - siddhiAppRuntime.shutdown(); - - //Shutting down Siddhi - siddhiManager.shutdown(); - } -} diff --git a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/SimpleFilterSample.java b/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/SimpleFilterSample.java deleted file mode 100644 index 69ad67aafa..0000000000 --- a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/SimpleFilterSample.java +++ /dev/null @@ -1,75 +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.siddhi.sample; - -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; - -public class SimpleFilterSample { - - public static void main(String[] args) throws InterruptedException { - - // Creating Siddhi Manager - SiddhiManager siddhiManager = new SiddhiManager(); - - String siddhiApp = "" + - "define stream cseEventStream (symbol string, price float, volume long); " + - "" + - "@info(name = 'query1') " + - "from cseEventStream[volume < 150] " + - "select symbol,price " + - "insert into outputStream ;"; - - //Generating runtime - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - //Adding callback to retrieve output events from query - siddhiAppRuntime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - EventPrinter.print(timestamp, inEvents, removeEvents); - } - }); - - //Retrieving InputHandler to push events into Siddhi - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("cseEventStream"); - - //Starting event processing - siddhiAppRuntime.start(); - - //Sending events to Siddhi - inputHandler.send(new Object[]{"IBM", 700f, 100L}); - inputHandler.send(new Object[]{"WSO2", 60.5f, 200L}); - inputHandler.send(new Object[]{"GOOG", 50f, 30L}); - inputHandler.send(new Object[]{"IBM", 76.6f, 400L}); - inputHandler.send(new Object[]{"WSO2", 45.6f, 50L}); - Thread.sleep(500); - - //Shutting down the runtime - siddhiAppRuntime.shutdown(); - - //Shutting down Siddhi - siddhiManager.shutdown(); - - } -} diff --git a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/TimeWindowSample.java b/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/TimeWindowSample.java deleted file mode 100644 index 5efb377f84..0000000000 --- a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/TimeWindowSample.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.sample; - -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.event.Event; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.core.stream.output.StreamCallback; -import org.wso2.siddhi.core.util.EventPrinter; - -/** - * Sample Siddhi application that groups the events by symbol and calculates aggregates such as the sum for price and - * sum of volume for the last 5 seconds time window. - */ -public class TimeWindowSample { - - public static void main(String[] args) throws InterruptedException { - - // Create Siddhi Application - String siddhiApp = "define stream StockEventStream (symbol string, price float, volume long); " + - " " + - "@info(name = 'query1') " + - "from StockEventStream#window.time(5 sec) " + - "select symbol, sum(price) as price, sum(volume) as volume " + - "group by symbol " + - "insert into AggregateStockStream ;"; - - // Creating Siddhi Manager - SiddhiManager siddhiManager = new SiddhiManager(); - - //Generating runtime - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - //Adding callback to retrieve output events from query - siddhiAppRuntime.addCallback("AggregateStockStream", new StreamCallback() { - @Override - public void receive(Event[] events) { - EventPrinter.print(events); - } - }); - - //Retrieving input handler to push events into Siddhi - InputHandler inputHandler = siddhiAppRuntime.getInputHandler("StockEventStream"); - - //Starting event processing - siddhiAppRuntime.start(); - - //Sending events to Siddhi - inputHandler.send(new Object[]{"IBM", 100f, 100L}); - Thread.sleep(1000); - inputHandler.send(new Object[]{"IBM", 200f, 300L}); - inputHandler.send(new Object[]{"WSO2", 60f, 200L}); - Thread.sleep(1000); - inputHandler.send(new Object[]{"WSO2", 70f, 400L}); - inputHandler.send(new Object[]{"GOOG", 50f, 30L}); - Thread.sleep(1000); - inputHandler.send(new Object[]{"IBM", 200f, 400L}); - Thread.sleep(2000); - inputHandler.send(new Object[]{"WSO2", 70f, 50L}); - Thread.sleep(2000); - inputHandler.send(new Object[]{"WSO2", 80f, 400L}); - inputHandler.send(new Object[]{"GOOG", 60f, 30L}); - Thread.sleep(1000); - - //Shutting down the runtime - siddhiAppRuntime.shutdown(); - - //Shutting down Siddhi - siddhiManager.shutdown(); - - } -} diff --git a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/util/CustomFunctionExtension.java b/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/util/CustomFunctionExtension.java deleted file mode 100644 index e485f4c274..0000000000 --- a/modules/siddhi-samples/quick-start-samples/src/main/java/org/wso2/siddhi/sample/util/CustomFunctionExtension.java +++ /dev/null @@ -1,126 +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.siddhi.sample.util; - -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.exception.SiddhiAppCreationException; -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 java.util.Map; - -public class CustomFunctionExtension extends FunctionExecutor { - - private Attribute.Type returnType; - - /** - * The initialization method for FunctionExecutor, this method will be called before the other methods - * @param attributeExpressionExecutors are the executors of each function parameters - * @param configReader - * @param siddhiAppContext the context of the siddhi app - */ - @Override - protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { - for (ExpressionExecutor expressionExecutor : attributeExpressionExecutors) { - Attribute.Type attributeType = expressionExecutor.getReturnType(); - if (attributeType == Attribute.Type.DOUBLE) { - returnType = attributeType; - - } else if ((attributeType == Attribute.Type.STRING) || (attributeType == Attribute.Type.BOOL)) { - throw new SiddhiAppCreationException("Plus cannot have parameters with types String or Bool"); - } else { - returnType = Attribute.Type.LONG; - } - } - } - - /** - * The main execution method which will be called upon event arrival - * when there are more then one function parameter - * - * @param data the runtime values of function parameters - * @return the function result - */ - @Override - protected Object execute(Object[] data) { - if (returnType == Attribute.Type.DOUBLE) { - double total = 0; - for (Object aObj : data) { - total += Double.parseDouble(String.valueOf(aObj)); - } - - return total; - } else { - long total = 0; - for (Object aObj : data) { - total += Long.parseLong(String.valueOf(aObj)); - } - return total; - } - } - - /** - * The main execution method which will be called upon event arrival - * when there are 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) { - if (returnType == Attribute.Type.DOUBLE) { - return Double.parseDouble(String.valueOf(data)); - } else { - return Long.parseLong(String.valueOf(data)); - } - } - - @Override - public Attribute.Type getReturnType() { - return returnType; - } - - /** - * Used to collect the serializable state of the processing 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 processing element as an array - */ - @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 element as an array on - * the same order provided by currentState(). - */ - @Override - public void restoreState(Map state) { - - } - -} diff --git a/modules/siddhi-samples/quick-start-samples/src/main/resources/log4j.properties b/modules/siddhi-samples/quick-start-samples/src/main/resources/log4j.properties deleted file mode 100644 index 2c00a08cfc..0000000000 --- a/modules/siddhi-samples/quick-start-samples/src/main/resources/log4j.properties +++ /dev/null @@ -1,31 +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. -# -# For the general syntax of property based configuration files see the -# documenation of org.apache.log4j.PropertyConfigurator. -# The root category uses the appender called A1. Since no priority is -# specified, the root category assumes the default priority for root -# which is DEBUG in log4j. The root category is the only category that -# has a default priority. All other categories need not be assigned a -# priority in which case they inherit their priority from the -# hierarchy. -#log4j.rootLogger=DEBUG, stdout -log4j.rootLogger=INFO, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%m%n -#log4j.appender.stdout.layout.ConversionPattern=[%t] %-5p %c %x - %m%n diff --git a/modules/siddhi-service/netty-transports.yml b/modules/siddhi-service/netty-transports.yml deleted file mode 100644 index 4e2399b027..0000000000 --- a/modules/siddhi-service/netty-transports.yml +++ /dev/null @@ -1,27 +0,0 @@ -################################################################################ -# Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -# -# Licensed 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. -################################################################################ -listenerConfigurations: - - - id: "msf4j-http" - host: "127.0.0.1" - port: 8080 - bossThreadPoolSize: 2 - workerThreadPoolSize: 250 - parameters: - - - name: "executor.workerpool.size" - value: 60 - diff --git a/modules/siddhi-service/pom.xml b/modules/siddhi-service/pom.xml deleted file mode 100644 index aa04002a5a..0000000000 --- a/modules/siddhi-service/pom.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - siddhi - org.graylog.repackaged.siddhi - 4.5.11 - ../../pom.xml - - - 4.0.0 - siddhi-service - Siddhi As a Service - jar - - - - org.apache.log4j.wso2 - log4j - - - com.google.code.gson - gson - - - org.graylog.repackaged.siddhi - siddhi-query-api - - - org.graylog.repackaged.siddhi - siddhi-core - - - org.graylog.repackaged.siddhi - siddhi-query-compiler - - - org.graylog.repackaged.siddhi - siddhi-annotations - - - org.wso2.msf4j - msf4j-all - - - javax.servlet - servlet-api - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - - - org.testng - testng - test - - - - - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - prepare-package - - copy-dependencies - - - target/classes/dependencies - false - false - true - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - org.wso2.siddhi.service.api.Application - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.9.1 - - - add-source - generate-sources - - add-source - - - - src/gen/java - - - - - - - maven-assembly-plugin - 2.2 - - - src/main/bin.xml - - siddhi-service-${project.version} - false - - - - make-assembly - package - - single - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.8 - ${java.version} - ${java.version} - UTF-8 - 3.1.2 - 3.0.3 - ../../findbugs-exclude.xml - - - diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiException.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiException.java deleted file mode 100644 index 39b2a1e383..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", date = - "2017-03-15T08:56:59.657Z") -public class ApiException extends Exception { - private int code; - - public ApiException(int code, String msg) { - super(msg); - this.code = code; - } - - public int getCode() { - return code; - } -} diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiOriginFilter.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiOriginFilter.java deleted file mode 100644 index 10c29662be..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiOriginFilter.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - -import java.io.IOException; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; - -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", date = - "2017-03-15T08:56:59.657Z") -public class ApiOriginFilter implements javax.servlet.Filter { - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - public void destroy() { - } - - public void init(FilterConfig filterConfig) throws ServletException { - } -} \ No newline at end of file diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiResponseMessage.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiResponseMessage.java deleted file mode 100644 index 5be9f3f8f5..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/ApiResponseMessage.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - -import javax.xml.bind.annotation.XmlTransient; - -@javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", date = - "2017-03-15T08:56:59.657Z") -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage() { - } - - public ApiResponseMessage(int code, String message) { - this.code = code; - switch (code) { - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/Application.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/Application.java deleted file mode 100644 index ecc332a5e9..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/Application.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - -import org.wso2.msf4j.MicroservicesRunner; - -/** - * Application entry point. - */ -public class Application { - - public static void main(String[] args) { - new MicroservicesRunner().deploy(new SiddhiApi()).start(); - } -} diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/JacksonJsonProvider.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/JacksonJsonProvider.java deleted file mode 100644 index 99396e433a..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/JacksonJsonProvider.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.datatype.joda.JodaModule; -import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; - -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.ext.Provider; - -@Provider -@Produces({MediaType.APPLICATION_JSON}) -public class JacksonJsonProvider extends JacksonJaxbJsonProvider { - - public JacksonJsonProvider() { - - ObjectMapper objectMapper = new ObjectMapper() - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - .registerModule(new JodaModule()) - .setDateFormat(new RFC3339DateFormat()); - - setMapper(objectMapper); - } -} \ No newline at end of file diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/NotFoundException.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/NotFoundException.java deleted file mode 100644 index dfde9ab367..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/NotFoundException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", date = - "2017-03-15T08:56:59.657Z") -public class NotFoundException extends ApiException { - private int code; - - public NotFoundException(int code, String msg) { - super(code, msg); - this.code = code; - } - - @Override - public int getCode() { - return code; - } -} diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/RFC3339DateFormat.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/RFC3339DateFormat.java deleted file mode 100644 index 1fe7ce8cde..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/RFC3339DateFormat.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - -import com.fasterxml.jackson.databind.util.ISO8601DateFormat; -import com.fasterxml.jackson.databind.util.ISO8601Utils; - -import java.text.FieldPosition; -import java.util.Date; - -public class RFC3339DateFormat extends ISO8601DateFormat { - private static final long serialVersionUID = 142L; - // Same as ISO8601DateFormat but serializing milliseconds. - @Override - public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - String value = ISO8601Utils.format(date, true); - toAppendTo.append(value); - return toAppendTo; - } - -} \ No newline at end of file diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/SiddhiApi.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/SiddhiApi.java deleted file mode 100644 index 3152d09858..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/SiddhiApi.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - -import io.swagger.annotations.ApiParam; -import org.wso2.siddhi.service.factories.SiddhiApiServiceFactory; -import org.wso2.siddhi.service.model.Success; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -@Path("/siddhi") - -@io.swagger.annotations.Api(description = "The siddhi API") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", date = - "2017-03-15T08:56:59.657Z") -public class SiddhiApi { - private final SiddhiApiService delegate = SiddhiApiServiceFactory.getSiddhiApi(); - - @POST - @Path("/artifact/deploy") - @Consumes({"text/plain"}) - @Produces({"application/json"}) - @io.swagger.annotations.ApiOperation(value = "", notes = "Deploys the siddhi app. Request **SiddhiApp** " + - "explains the Siddhi Query ", response = Success.class, tags = {}) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Successful response", response = Success.class), - @io.swagger.annotations.ApiResponse(code = 200, message = "Unexpected error", response = Success.class)}) - public Response siddhiArtifactDeployPost(@ApiParam(value = "Siddhi Siddhi app", required = true) String body) - throws NotFoundException { - return delegate.siddhiArtifactDeployPost(body); - } - - @GET - @Path("/artifact/undeploy/{siddhiApp}") - @Produces({"application/json"}) - @io.swagger.annotations.ApiOperation(value = "", notes = "Undeploys the siddhi app as given by " + - "`siddhiAppName`. Path param of **siddhiAppName** determines name of the siddhi app ", - response = Success.class, tags = {}) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Successful response", response = Success.class), - @io.swagger.annotations.ApiResponse(code = 200, message = "Unexpected error", response = Success.class)}) - public Response siddhiArtifactUndeploySiddhiAppGet( - @ApiParam(value = "Siddhi app Name", required = true) @PathParam("siddhiApp") String siddhiApp) - throws NotFoundException { - return delegate.siddhiArtifactUndeploySiddhiAppGet(siddhiApp); - } -} diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/SiddhiApiService.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/SiddhiApiService.java deleted file mode 100644 index 38b0911cff..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/SiddhiApiService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - - -import javax.ws.rs.core.Response; - -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", date = - "2017-03-15T08:56:59.657Z") -public abstract class SiddhiApiService { - - public abstract Response siddhiArtifactDeployPost(String body) throws NotFoundException; - - public abstract Response siddhiArtifactUndeploySiddhiAppGet(String siddhiApp) throws NotFoundException; -} diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/StringUtil.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/StringUtil.java deleted file mode 100644 index 2c814fc59e..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/api/StringUtil.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.api; - -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", date = - "2017-03-15T08:56:59.657Z") -public class StringUtil { - /** - * Check if the given array contains the given value (with case-insensitive comparison). - * - * @param array The array - * @param value The value to search - * @return true if the array contains the value - */ - public static boolean containsIgnoreCase(String[] array, String value) { - for (String str : array) { - if (value == null && str == null) { - return true; - } - if (value != null && value.equalsIgnoreCase(str)) { - return true; - } - } - return false; - } - - /** - * Join an array of strings with the given separator. - *

- * Note: This might be replaced by utility method from commons-lang or guava someday - * if one of those libraries is added as dependency. - *

- * - * @param array The array of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(String[] array, String separator) { - int len = array.length; - if (len == 0) { - return ""; - } - - StringBuilder out = new StringBuilder(); - out.append(array[0]); - for (int i = 1; i < len; i++) { - out.append(separator).append(array[i]); - } - return out.toString(); - } -} diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/model/Error.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/model/Error.java deleted file mode 100644 index bfa2301826..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/model/Error.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - -import java.util.Objects; - -/** - * Error - */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", date = - "2017-03-15T08:56:59.657Z") -public class Error { - @JsonProperty("code") - private Integer code = null; - - @JsonProperty("status") - private String status = null; - - @JsonProperty("message") - private String message = null; - - public Error code(Integer code) { - this.code = code; - return this; - } - - /** - * Get code - * - * @return code - **/ - @ApiModelProperty(value = "") - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public Error status(String status) { - this.status = status; - return this; - } - - /** - * Get status - * - * @return status - **/ - @ApiModelProperty(value = "") - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public Error message(String message) { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message - **/ - @ApiModelProperty(value = "") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Error error = (Error) o; - return Objects.equals(this.code, error.code) && - Objects.equals(this.status, error.status) && - Objects.equals(this.message, error.message); - } - - @Override - public int hashCode() { - return Objects.hash(code, status, message); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Error {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/model/Success.java b/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/model/Success.java deleted file mode 100644 index b0bfb2384d..0000000000 --- a/modules/siddhi-service/src/gen/java/org/wso2/siddhi/service/model/Success.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2017, 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.siddhi.service.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - -import java.util.Objects; - -/** - * Success - */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", date = - "2017-03-15T08:56:59.657Z") -public class Success { - @JsonProperty("code") - private Integer code = null; - - @JsonProperty("status") - private String status = null; - - @JsonProperty("message") - private String message = null; - - public Success code(Integer code) { - this.code = code; - return this; - } - - /** - * Get code - * - * @return code - **/ - @ApiModelProperty(value = "") - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public Success status(String status) { - this.status = status; - return this; - } - - /** - * Get status - * - * @return status - **/ - @ApiModelProperty(value = "") - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public Success message(String message) { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message - **/ - @ApiModelProperty(value = "") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Success success = (Success) o; - return Objects.equals(this.code, success.code) && - Objects.equals(this.status, success.status) && - Objects.equals(this.message, success.message); - } - - @Override - public int hashCode() { - return Objects.hash(code, status, message); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Success {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/modules/siddhi-service/src/main/bin.xml b/modules/siddhi-service/src/main/bin.xml deleted file mode 100644 index db620dd8ab..0000000000 --- a/modules/siddhi-service/src/main/bin.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - true - siddhi-service-${project.version} - Siddhi Service - - zip - - - - target - . - - siddhi-*.jar - - - - target/classes/dependencies - dependencies - - slf4j-simple-*.jar - - - *.jar - - - - target/classes - . - - startup.sh - - 755 - - - \ No newline at end of file diff --git a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/factories/SiddhiApiServiceFactory.java b/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/factories/SiddhiApiServiceFactory.java deleted file mode 100644 index 71fb76ffd6..0000000000 --- a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/factories/SiddhiApiServiceFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.factories; - -import org.wso2.siddhi.service.api.SiddhiApiService; -import org.wso2.siddhi.service.impl.SiddhiApiServiceImpl; - -/** - * Siddhi API Service factory Class - */ -public class SiddhiApiServiceFactory { - - private static final SiddhiApiService service = new SiddhiApiServiceImpl(); - - public static SiddhiApiService getSiddhiApi() { - return service; - } -} diff --git a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/impl/SiddhiApiServiceImpl.java b/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/impl/SiddhiApiServiceImpl.java deleted file mode 100644 index a33bf0d97d..0000000000 --- a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/impl/SiddhiApiServiceImpl.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.impl; - -import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.siddhi.core.SiddhiAppRuntime; -import org.wso2.siddhi.core.SiddhiManager; -import org.wso2.siddhi.core.stream.input.InputHandler; -import org.wso2.siddhi.query.api.SiddhiApp; -import org.wso2.siddhi.query.api.util.AnnotationHelper; -import org.wso2.siddhi.query.compiler.SiddhiCompiler; -import org.wso2.siddhi.service.api.ApiResponseMessage; -import org.wso2.siddhi.service.api.NotFoundException; -import org.wso2.siddhi.service.api.SiddhiApiService; -import org.wso2.siddhi.service.util.SiddhiAppConfiguration; -import org.wso2.siddhi.service.util.SiddhiServiceConstants; - -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import javax.ws.rs.core.Response; - -/** - * Siddhi Service Implementataion Class - */ - -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen", - date = "2017-03-15T08:56:59.657Z") -public class SiddhiApiServiceImpl extends SiddhiApiService { - - private Log log = LogFactory.getLog(SiddhiApiServiceImpl.class); - private SiddhiManager siddhiManager = new SiddhiManager(); - private Map> siddhiAppSpecificInputHandlerMap = new ConcurrentHashMap<>(); - private Map siddhiAppConfigurationMap = new ConcurrentHashMap<>(); - private Map siddhiAppRunTimeMap = new ConcurrentHashMap<>(); - - @Override - public Response siddhiArtifactDeployPost(String siddhiApp) throws NotFoundException { - - log.info("SiddhiApp = " + siddhiApp); - String jsonString = new Gson().toString(); - try { - SiddhiApp parsedSiddhiApp = SiddhiCompiler.parse(siddhiApp); - String siddhiAppName = AnnotationHelper.getAnnotationElement( - SiddhiServiceConstants.ANNOTATION_NAME_NAME, null, parsedSiddhiApp. - getAnnotations()).getValue(); - if (!siddhiAppRunTimeMap.containsKey(siddhiApp)) { - SiddhiAppConfiguration siddhiAppConfiguration = new SiddhiAppConfiguration(); - siddhiAppConfiguration.setName(siddhiAppName); - siddhiAppConfigurationMap.put(siddhiAppName, siddhiAppConfiguration); - - SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); - - if (siddhiAppRuntime != null) { - Set streamNames = siddhiAppRuntime.getStreamDefinitionMap().keySet(); - Map inputHandlerMap = new ConcurrentHashMap<>(streamNames.size()); - - for (String streamName : streamNames) { - inputHandlerMap.put(streamName, siddhiAppRuntime.getInputHandler(streamName)); - } - - siddhiAppSpecificInputHandlerMap.put(siddhiAppName, inputHandlerMap); - - siddhiAppRunTimeMap.put(siddhiAppName, siddhiAppRuntime); - siddhiAppRuntime.start(); - - jsonString = new Gson().toJson(new ApiResponseMessage(ApiResponseMessage.OK, - "Siddhi app is deployed " + - "and runtime is created")); - } - } else { - jsonString = new Gson().toJson(new ApiResponseMessage(ApiResponseMessage.ERROR, - "There is a Siddhi app already " + - "exists with same name")); - } - - } catch (Exception e) { - jsonString = new Gson().toJson(new ApiResponseMessage(ApiResponseMessage.ERROR, e.getMessage())); - } - - return Response.ok() - .entity(jsonString) - .build(); - } - - @Override - public Response siddhiArtifactUndeploySiddhiAppGet(String siddhiAppName) throws NotFoundException { - - String jsonString = new Gson().toString(); - if (siddhiAppName != null) { - if (siddhiAppRunTimeMap.containsKey(siddhiAppName)) { - siddhiAppRunTimeMap.remove(siddhiAppName); - siddhiAppConfigurationMap.remove(siddhiAppName); - siddhiAppSpecificInputHandlerMap.remove(siddhiAppName); - - jsonString = new Gson().toJson(new ApiResponseMessage(ApiResponseMessage.OK, - "Siddhi app removed successfully")); - } else { - jsonString = new Gson().toJson(new ApiResponseMessage(ApiResponseMessage.ERROR, - "There is no siddhi app exist " + - "with provided name : " + siddhiAppName)); - } - } else { - jsonString = new Gson().toJson(new ApiResponseMessage(ApiResponseMessage.ERROR, - "nvalid Request")); - - } - return Response.ok() - .entity(jsonString) - .build(); - } -} diff --git a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/ServiceResponse.java b/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/ServiceResponse.java deleted file mode 100644 index dc6d36979d..0000000000 --- a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/ServiceResponse.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - *

- * Licensed 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.siddhi.service.util; - -/** - * Class which defines the API response - */ -public class ServiceResponse { - - private String status; - private String message; - - public ServiceResponse(String status, String message) { - this.status = status; - this.message = message; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/SiddhiAppConfiguration.java b/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/SiddhiAppConfiguration.java deleted file mode 100644 index 62c7e80287..0000000000 --- a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/SiddhiAppConfiguration.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.util; - -/** - * Class which defines the Siddhi app Configuration - */ -public class SiddhiAppConfiguration { - private String name; - private String description; - private boolean isTracingEnabled; - private boolean isStatisticsEnabled; - private String siddhiApp; - private boolean editable; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getSiddhiApp() { - return siddhiApp; - } - - public void setSiddhiApp(String siddhiApp) { - this.siddhiApp = siddhiApp; - } - - public boolean isTracingEnabled() { - return isTracingEnabled; - } - - public void setTracingEnabled(boolean tracingEnabled) { - isTracingEnabled = tracingEnabled; - } - - public boolean isStatisticsEnabled() { - return isStatisticsEnabled; - } - - public void setStatisticsEnabled(boolean statisticsEnabled) { - isStatisticsEnabled = statisticsEnabled; - } - - public boolean isEditable() { - return editable; - } - - public void setEditable(boolean editable) { - this.editable = editable; - } -} diff --git a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/SiddhiServiceConstants.java b/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/SiddhiServiceConstants.java deleted file mode 100644 index de8d98dba2..0000000000 --- a/modules/siddhi-service/src/main/java/org/wso2/siddhi/service/util/SiddhiServiceConstants.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service.util; - -/** - * Class which holds the constants related to siddhi service - */ -public class SiddhiServiceConstants { - - public static final String ANNOTATION_NAME_NAME = "name"; - - public static final String EVENT_TRACE_LOGGER = "EVENT_TRACE_LOGGER"; - - public static final String ANNOTATION_INFO = "info"; - public static final String ANNOTATION_ELEMENT_NAME = "name"; - - public static final String INNER_STREAM_FLAG = "#"; - public static final String TRIGGERED_TIME = "triggered_time"; - - public static final int LAST = -2; -} diff --git a/modules/siddhi-service/src/main/resources/dependencies/Readme b/modules/siddhi-service/src/main/resources/dependencies/Readme deleted file mode 100644 index eb23bf8ffc..0000000000 --- a/modules/siddhi-service/src/main/resources/dependencies/Readme +++ /dev/null @@ -1 +0,0 @@ -#Location to add dependencies \ No newline at end of file diff --git a/modules/siddhi-service/src/main/resources/startup.sh b/modules/siddhi-service/src/main/resources/startup.sh deleted file mode 100644 index 699f657b76..0000000000 --- a/modules/siddhi-service/src/main/resources/startup.sh +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh - - -# add the libraries to the SIDDHI_CLASSPATH. -SCRIPT_PATH=${0%/*} - -if [ "$0" != "$SCRIPT_PATH" ] && [ "$SCRIPT_PATH" != "" ]; then - cd $SCRIPT_PATH -fi - -DIRLIBS=dependencies/*.jar - -for i in ${DIRLIBS} -do - if [ -z "$SIDDHI_CLASSPATH" ] ; then - SIDDHI_CLASSPATH=$i - else - SIDDHI_CLASSPATH="$i":$SIDDHI_CLASSPATH - fi -done - -echo classpath: $SIDDHI_CLASSPATH - -java -cp siddhi-service-${pom.version}.jar":$SIDDHI_CLASSPATH:." org.wso2.siddhi.service.api.Application diff --git a/modules/siddhi-service/src/test/java/org/wso2/siddhi/service/SiddhiApiTestCase.java b/modules/siddhi-service/src/test/java/org/wso2/siddhi/service/SiddhiApiTestCase.java deleted file mode 100644 index 1ec047e578..0000000000 --- a/modules/siddhi-service/src/test/java/org/wso2/siddhi/service/SiddhiApiTestCase.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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.siddhi.service; - -import org.testng.Assert; -import org.testng.annotations.Test; -import org.wso2.siddhi.service.api.NotFoundException; -import org.wso2.siddhi.service.impl.SiddhiApiServiceImpl; - -import javax.ws.rs.core.Response; - -public class SiddhiApiTestCase { - - @Test - /** - * Check deploy and undeploy functionality - */ - public void testDeployAndUndeploy() throws NotFoundException { - SiddhiApiServiceImpl apiService = new SiddhiApiServiceImpl(); - String siddhiApp = "@app:name('filterTest1') " + - "" + - "define stream cseEventStream (symbol string, price float, volume long);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream[70 > price] " + - "select symbol, price " + - "insert into outputStream;" + - "" + - "@info(name = 'query2') " + - "from outputStream[70 > price] " + - "select symbol, price " + - "insert into outputStream2 ;"; - Response response = apiService.siddhiArtifactDeployPost(siddhiApp); - Assert.assertEquals(response.getStatus(), 200, "HTTP 200 should be returned"); - Assert.assertTrue(response.getEntity().toString().contains("Siddhi app is deployed and runtime is created"), - "Siddhi App creation message should be returned"); - - Response undeployResponse = apiService.siddhiArtifactUndeploySiddhiAppGet("filterTest1"); - Assert.assertEquals(undeployResponse.getStatus(), 200, "HTTP 200 should be returned"); - Assert.assertTrue(undeployResponse.getEntity().toString().contains("Siddhi app removed successfully"), - "Siddhi App removed message should be returned"); - } -} diff --git a/modules/siddhi-service/src/test/resources/log4j.properties b/modules/siddhi-service/src/test/resources/log4j.properties deleted file mode 100644 index d18dfe0c15..0000000000 --- a/modules/siddhi-service/src/test/resources/log4j.properties +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2017, 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. -# -# For the general syntax of property based configuration files see the -# documenation of org.apache.log4j.PropertyConfigurator. -# The root category uses the appender called A1. Since no priority is -# specified, the root category assumes the default priority for root -# which is DEBUG in log4j. The root category is the only category that -# has a default priority. All other categories need not be assigned a -# priority in which case they inherit their priority from the -# hierarchy. -#log4j.rootLogger=DEBUG, stdout -log4j.rootLogger=INFO, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%m%n -#log4j.appender.stdout.layout.ConversionPattern=[%t] %-5p %c %x - %m%n diff --git a/modules/siddhi-service/src/test/resources/testng.xml b/modules/siddhi-service/src/test/resources/testng.xml deleted file mode 100644 index 12b34fd5a1..0000000000 --- a/modules/siddhi-service/src/test/resources/testng.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5fc90a7676..3e8cfe9ace 100644 --- a/pom.xml +++ b/pom.xml @@ -20,12 +20,6 @@ 4.0.0 - - - - - - org.graylog.repackaged.siddhi siddhi pom @@ -51,14 +45,9 @@ modules/siddhi-query-api - modules/siddhi-query-compiler modules/siddhi-core - modules/siddhi-annotations - - - @@ -92,6 +81,12 @@ ${testng.version} test + + org.webjars + jquery + 3.7.1 + test + junit junit @@ -169,67 +164,10 @@ siddhi-annotations ${project.version} - - - - org.wso2.msf4j - msf4j-all - ${msf4j.version} - - - javax.servlet - servlet-api - ${servlet-api-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-datatype-joda-version} - - - - - org.apache.maven - maven-core - ${maven.core.version} - - - org.apache.maven - maven-plugin-api - ${maven.plugin.api.version} - - - org.apache.maven.plugin-tools - maven-plugin-annotations - ${maven.plugin.annotations.version} - - - org.freemarker - freemarker-gae - ${freemarker.version} - - - org.apache.commons - commons-io - ${commons.io.version} - - - org.jacoco - org.jacoco.agent - ${org.jacoco.version} - test - - - - org.apache.maven.wagon - wagon-ssh - 2.1 - - @@ -258,46 +196,6 @@ once - - org.jacoco - jacoco-maven-plugin - ${org.jacoco.version} - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - post-integration-test - - report - - - - **/SiddhiQLBaseVisitor.class - **/SiddhiQLParser* - **/SiddhiQLLexer* - - - - - - org.apache.maven.plugins maven-javadoc-plugin @@ -317,11 +215,6 @@ - - net.alchim31.maven - scala-maven-plugin - 4.8.1 - org.apache.felix maven-bundle-plugin @@ -388,19 +281,11 @@ org.apache.maven.plugins maven-surefire-plugin - org.apache.maven.plugins maven-shade-plugin - ${maven.shadeplugin.version} + 3.4.1 @@ -484,60 +369,9 @@ false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + UTF-8 UTF-8 @@ -545,7 +379,6 @@ 7.8.0 4.13.2 1.2.17.wso2v1 - [1.2.17, 1.3.0) 4.13.1 3.4.2.wso2v1 32.1.3-jre @@ -553,23 +386,7 @@ 3.13 6.0.0 3.3.100.v20130513-1956 - [1.2.0, 1.3.0) - - [3.5, 3.6.0) 4.2.22 - 2.8.11 - 3.4.1 - 2.5 - 2.15.3 - 3.9.5 - 3.9.5 - 3.10.2 - 2.3.32 - 1.3.2 - 0.8.11 - 3.0.4 - findbugs-exclude.xml - checkstyle-suppressions.xml diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 9b32185a46..0000000000 --- a/pull_request_template.md +++ /dev/null @@ -1,52 +0,0 @@ -## Purpose -> Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc. - -## Goals -> Describe the solutions that this feature/fix will introduce to resolve the problems described above - -## Approach -> Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here. - -## User stories -> Summary of user stories addressed by this change> - -## Release note -> Brief description of the new feature or bug fix as it will appear in the release notes - -## Documentation -> Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact - -## Training -> Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable - -## Certification -> Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why. - -## Marketing -> Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable - -## Automation tests - - Unit tests - > Code coverage information - - Integration tests - > Details about the test cases and coverage - -## Security checks - - Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? yes/no - - Ran FindSecurityBugs plugin and verified report? yes/no - - Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes/no - -## Samples -> Provide high-level details about the samples related to this feature - -## Related PRs -> List any other related PRs - -## Migrations (if applicable) -> Describe migration steps and platforms on which migration has been tested - -## Test environment -> List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested - -## Learning -> Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem. \ No newline at end of file