Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AB5BE200C3A for ; Thu, 2 Mar 2017 21:52:42 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A9CF0160B6F; Thu, 2 Mar 2017 20:52:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 65CD2160B6A for ; Thu, 2 Mar 2017 21:52:40 +0100 (CET) Received: (qmail 58650 invoked by uid 500); 2 Mar 2017 20:52:39 -0000 Mailing-List: contact commits-help@metron.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@metron.incubator.apache.org Delivered-To: mailing list commits@metron.incubator.apache.org Received: (qmail 58641 invoked by uid 99); 2 Mar 2017 20:52:39 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Mar 2017 20:52:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 06D1A1A0764 for ; Thu, 2 Mar 2017 20:52:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.566 X-Spam-Level: X-Spam-Status: No, score=-6.566 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id PERTG5S6kHOt for ; Thu, 2 Mar 2017 20:52:25 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 09DEC5FBC0 for ; Thu, 2 Mar 2017 20:52:22 +0000 (UTC) Received: (qmail 55254 invoked by uid 99); 2 Mar 2017 20:51:48 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Mar 2017 20:51:48 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C0007E95B8; Thu, 2 Mar 2017 20:51:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: cestella@apache.org To: commits@metron.incubator.apache.org Date: Thu, 02 Mar 2017 20:51:52 -0000 Message-Id: <0fced33b499641ada90eed76a0e4aac3@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [06/10] incubator-metron git commit: METRON-503: Metron REST API this closes apache/incubator-metron#316 archived-at: Thu, 02 Mar 2017 20:52:42 -0000 METRON-503: Metron REST API this closes apache/incubator-metron#316 Project: http://git-wip-us.apache.org/repos/asf/incubator-metron/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-metron/commit/55b3e7ea Tree: http://git-wip-us.apache.org/repos/asf/incubator-metron/tree/55b3e7ea Diff: http://git-wip-us.apache.org/repos/asf/incubator-metron/diff/55b3e7ea Branch: refs/heads/master Commit: 55b3e7ea80953a3bbfad5ec43b85d17e8ed287e6 Parents: e416a7d Author: merrimanr Authored: Thu Mar 2 10:48:00 2017 -0500 Committer: cstella Committed: Thu Mar 2 10:48:00 2017 -0500 ---------------------------------------------------------------------- dependencies_with_url.csv | 60 ++ metron-interface/metron-rest-client/pom.xml | 40 ++ .../metron/rest/model/GrokValidation.java | 55 ++ .../apache/metron/rest/model/KafkaTopic.java | 60 ++ .../metron/rest/model/ParseMessageRequest.java | 42 ++ .../org/apache/metron/rest/model/RestError.java | 43 ++ .../rest/model/StellarFunctionDescription.java | 52 ++ .../metron/rest/model/TopologyResponse.java | 42 ++ .../metron/rest/model/TopologyResponseCode.java | 23 + .../metron/rest/model/TopologyStatus.java | 76 ++ .../metron/rest/model/TopologyStatusCode.java | 32 + .../metron/rest/model/TopologySummary.java | 34 + .../rest/model/TransformationValidation.java | 51 ++ metron-interface/metron-rest/README.md | 439 ++++++++++++ metron-interface/metron-rest/pom.xml | 328 +++++++++ .../metron-rest/src/main/assembly/assembly.xml | 54 ++ .../metron/rest/MetronRestApplication.java | 29 + .../apache/metron/rest/MetronRestConstants.java | 55 ++ .../org/apache/metron/rest/RestException.java | 43 ++ .../apache/metron/rest/config/GrokConfig.java | 36 + .../apache/metron/rest/config/HadoopConfig.java | 38 + .../apache/metron/rest/config/KafkaConfig.java | 61 ++ .../apache/metron/rest/config/MvcConfig.java | 31 + .../metron/rest/config/RestTemplateConfig.java | 36 + .../apache/metron/rest/config/StormConfig.java | 48 ++ .../metron/rest/config/SwaggerConfig.java | 39 ++ .../metron/rest/config/WebSecurityConfig.java | 93 +++ .../metron/rest/config/ZookeeperConfig.java | 52 ++ .../rest/controller/GlobalConfigController.java | 79 +++ .../metron/rest/controller/GrokController.java | 56 ++ .../metron/rest/controller/KafkaController.java | 96 +++ .../rest/controller/RestExceptionHandler.java | 48 ++ .../SensorEnrichmentConfigController.java | 97 +++ .../SensorIndexingConfigController.java | 88 +++ .../SensorParserConfigController.java | 112 +++ .../metron/rest/controller/StormController.java | 190 +++++ .../controller/TransformationController.java | 80 +++ .../metron/rest/controller/UserController.java | 36 + .../rest/service/GlobalConfigService.java | 31 + .../apache/metron/rest/service/GrokService.java | 31 + .../apache/metron/rest/service/HdfsService.java | 35 + .../metron/rest/service/KafkaService.java | 37 + .../service/SensorEnrichmentConfigService.java | 40 ++ .../service/SensorIndexingConfigService.java | 37 + .../rest/service/SensorParserConfigService.java | 42 ++ .../metron/rest/service/StormAdminService.java | 40 ++ .../metron/rest/service/StormStatusService.java | 37 + .../rest/service/TransformationService.java | 39 ++ .../service/impl/DockerStormCLIWrapper.java | 70 ++ .../service/impl/GlobalConfigServiceImpl.java | 75 ++ .../rest/service/impl/GrokServiceImpl.java | 66 ++ .../rest/service/impl/HdfsServiceImpl.java | 62 ++ .../rest/service/impl/KafkaServiceImpl.java | 124 ++++ .../impl/SensorEnrichmentConfigServiceImpl.java | 112 +++ .../impl/SensorIndexingConfigServiceImpl.java | 106 +++ .../impl/SensorParserConfigServiceImpl.java | 289 ++++++++ .../service/impl/StormAdminServiceImpl.java | 100 +++ .../rest/service/impl/StormCLIWrapper.java | 150 ++++ .../service/impl/StormStatusServiceImpl.java | 122 ++++ .../service/impl/TransformationServiceImpl.java | 92 +++ .../src/main/resources/META-INF/LICENSE | 692 +++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 6 + .../src/main/resources/application-docker.yml | 57 ++ .../src/main/resources/application-test.yml | 42 ++ .../src/main/resources/application.yml | 42 ++ .../src/main/resources/log4j.properties | 16 + .../src/main/resources/schema-h2.sql | 30 + .../src/main/resources/schema-mysql.sql | 30 + .../metron-rest/src/main/scripts/start.sh | 33 + .../metron/rest/MetronRestApplicationTest.java | 42 ++ .../apache/metron/rest/config/TestConfig.java | 124 ++++ .../GlobalConfigControllerIntegrationTest.java | 107 +++ .../GrokControllerIntegrationTest.java | 115 +++ .../KafkaControllerIntegrationTest.java | 188 +++++ ...richmentConfigControllerIntegrationTest.java | 240 +++++++ ...IndexingConfigControllerIntegrationTest.java | 140 ++++ ...orParserConfigControllerIntegrationTest.java | 368 ++++++++++ .../StormControllerIntegrationTest.java | 320 +++++++++ ...TransformationControllerIntegrationTest.java | 122 ++++ .../UserControllerIntegrationTest.java | 65 ++ .../rest/generator/SampleDataGenerator.java | 170 +++++ .../rest/mock/MockStormCLIClientWrapper.java | 177 +++++ .../metron/rest/mock/MockStormRestTemplate.java | 116 ++++ .../metron/rest/service/HdfsServiceTest.java | 117 ++++ .../rest/service/SensorParserConfigTest.java | 116 ++++ .../apache/metron/rest/utils/ReadMeUtils.java | 130 ++++ .../metron/rest/utils/RestControllerInfo.java | 103 +++ .../metron-rest/src/test/resources/README.vm | 92 +++ .../src/test/resources/log4j.properties | 16 + metron-interface/pom.xml | 90 +++ pom.xml | 1 + 91 files changed, 8518 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/dependencies_with_url.csv ---------------------------------------------------------------------- diff --git a/dependencies_with_url.csv b/dependencies_with_url.csv index fded057..35acced 100644 --- a/dependencies_with_url.csv +++ b/dependencies_with_url.csv @@ -7,6 +7,7 @@ org.ow2.asm:asm:jar:5.0.3:compile,BSD,http://asm.ow2.org/ org.reflections:reflections:jar:0.9.10:compile,BSD,https://github.com/ronmamo/reflections org.javassist:javassist:jar:3.19.0-GA:compile,Apache v2,https://github.com/jboss-javassist/javassist org.javassist:javassist:jar:3.17.1-GA:compile,Apache v2,https://github.com/jboss-javassist/javassist +org.javassist:javassist:jar:3.20.0-GA:compile,Apache v2,https://github.com/jboss-javassist/javassist org.fusesource.jansi:jansi:jar:1.11:compile,Apache v2,https://github.com/fusesource/jansi de.javakaffee:kryo-serializers:jar:0.38:compile,Apache v2,https://github.com/magro/kryo-serializers com.tdunning:t-digest:jar:3.1:compile,Apache v2,https://github.com/tdunning/t-digest @@ -78,6 +79,7 @@ org.slf4j:slf4j-api:jar:1.7.10:compile,MIT,http://www.slf4j.org org.slf4j:slf4j-api:jar:1.7.5:compile,MIT,http://www.slf4j.org org.slf4j:slf4j-api:jar:1.7.6:compile,MIT,http://www.slf4j.org org.slf4j:slf4j-api:jar:1.7.7:compile,MIT,http://www.slf4j.org +org.slf4j:slf4j-api:jar:1.7.21:compile,MIT,http://www.slf4j.org org.slf4j:slf4j-log4j12:jar:1.6.1:compile,MIT,http://www.slf4j.org org.slf4j:slf4j-log4j12:jar:1.7.10:compile,MIT,http://www.slf4j.org org.slf4j:slf4j-log4j12:jar:1.7.10:runtime,MIT,http://www.slf4j.org @@ -85,6 +87,8 @@ org.slf4j:slf4j-log4j12:jar:1.7.21:compile,MIT,http://www.slf4j.org org.slf4j:slf4j-log4j12:jar:1.7.5:compile,MIT,http://www.slf4j.org org.slf4j:slf4j-log4j12:jar:1.7.7:compile,MIT,http://www.slf4j.org org.slf4j:slf4j-simple:jar:1.7.7:compile,MIT,http://www.slf4j.org +org.slf4j:jcl-over-slf4j:jar:1.7.21:compile,MIT,http://www.slf4j.org +org.slf4j:jul-to-slf4j:jar:1.7.21:compile,MIT,http://www.slf4j.org aopalliance:aopalliance:jar:1.0:compile,Public Domain,http://aopalliance.sourceforge.net com.101tec:zkclient:jar:0.8:compile,The Apache Software License, Version 2.0,https://github.com/sgroschupf/zkclient com.github.stephenc.findbugs:findbugs-annotations:jar:1.3.9-1:compile,Apache License, Version 2.0,http://stephenc.github.com/findbugs-annotations @@ -98,15 +102,21 @@ com.codahale.metrics:metrics-graphite:jar:3.0.2:compile,MIT,https://github.com/c com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.07:compile,BSD,https://github.com/EsotericSoftware/reflectasm com.fasterxml.jackson.core:jackson-annotations:jar:2.2.3:compile,ASLv2,http://wiki.fasterxml.com/JacksonHome com.fasterxml.jackson.core:jackson-annotations:jar:2.7.4:compile,ASLv2,http://github.com/FasterXML/jackson +com.fasterxml.jackson.core:jackson-annotations:jar:2.8.3:compile,ASLv2,http://github.com/FasterXML/jackson com.fasterxml.jackson.core:jackson-core:jar:2.2.3:compile,ASLv2,http://wiki.fasterxml.com/JacksonHome com.fasterxml.jackson.core:jackson-core:jar:2.6.6:compile,ASLv2,https://github.com/FasterXML/jackson-core com.fasterxml.jackson.core:jackson-core:jar:2.7.4:compile,ASLv2,https://github.com/FasterXML/jackson-core +com.fasterxml.jackson.core:jackson-core:jar:2.8.3:compile,ASLv2,https://github.com/FasterXML/jackson-core com.fasterxml.jackson.core:jackson-databind:jar:2.2.3:compile,ASLv2,http://wiki.fasterxml.com/JacksonHome com.fasterxml.jackson.core:jackson-databind:jar:2.7.4:compile,ASLv2,http://github.com/FasterXML/jackson +com.fasterxml.jackson.core:jackson-databind:jar:2.8.3:compile,ASLv2,http://github.com/FasterXML/jackson com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.6.6:compile,ASLv2,http://wiki.fasterxml.com/JacksonForCbor com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.6.6:compile,ASLv2,http://wiki.fasterxml.com/JacksonForSmile com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.6.6:compile,ASLv2,https://github.com/FasterXML/jackson +com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.8.1:compile,ASLv2,https://github.com/FasterXML/jackson-datatype-joda +com.fasterxml:classmate:jar:1.3.1:compile,ASLv2,http://github.com/cowtowncoder/java-classmate com.google.code.gson:gson:jar:2.2.4:compile,The Apache Software License, Version 2.0,http://code.google.com/p/google-gson/ +com.google.code.gson:gson:jar:2.7:compile,The Apache Software License, Version 2.0,http://code.google.com/p/google-gson/ com.google.guava:guava:jar:11.0.2:compile,ASLv2, com.google.guava:guava:jar:12.0.1:compile,ASLv2, com.google.guava:guava:jar:12.0:compile,ASLv2, @@ -129,6 +139,7 @@ commons-beanutils:commons-beanutils-core:jar:1.8.0:compile,ASLv2,http://commons. commons-beanutils:commons-beanutils-core:jar:1.8.0:provided,ASLv2,http://commons.apache.org/beanutils/ commons-beanutils:commons-beanutils:jar:1.7.0:compile,ASLv2, commons-beanutils:commons-beanutils:jar:1.8.3:compile,ASLv2,http://commons.apache.org/beanutils/ +commons-beanutils:commons-beanutils:jar:1.9.2:compile,ASLv2,http://commons.apache.org/beanutils/ commons-cli:commons-cli:jar:1.2:compile,ASLv2,http://commons.apache.org/cli/ commons-cli:commons-cli:jar:1.3.1:compile,ASLv2,http://commons.apache.org/proper/commons-cli/ commons-codec:commons-codec:jar:1.10:compile,ASLv2,http://commons.apache.org/proper/commons-codec/ @@ -142,12 +153,14 @@ commons-configuration:commons-configuration:jar:1.6:compile,The Apache Software commons-daemon:commons-daemon:jar:1.0.13:compile,ASLv2,http://commons.apache.org/daemon/ commons-digester:commons-digester:jar:1.8.1:compile,ASLv2,http://commons.apache.org/digester/ commons-digester:commons-digester:jar:1.8:compile,The Apache Software License, Version 2.0,http://jakarta.apache.org/commons/digester/ +commons-digester:commons-digester:jar:2.1:compile,ASLv2,http://commons.apache.org/digester/ commons-el:commons-el:jar:1.0:provided,The Apache Software License, Version 2.0,http://jakarta.apache.org/commons/el/ commons-el:commons-el:jar:1.0:runtime,The Apache Software License, Version 2.0,http://jakarta.apache.org/commons/el/ commons-httpclient:commons-httpclient:jar:3.1:compile,Apache License,http://jakarta.apache.org/httpcomponents/httpclient-3.x/ commons-io:commons-io:jar:2.4:compile,ASLv2,http://commons.apache.org/io/ commons-io:commons-io:jar:2.5:compile,ASLv2,http://commons.apache.org/io/ commons-io:commons-io:jar:2.4:provided,ASLv2,http://commons.apache.org/io/ +commons-lang:commons-lang:jar:2.4:compile,ASLv2,http://commons.apache.org/lang/ commons-lang:commons-lang:jar:2.5:compile,ASLv2,http://commons.apache.org/lang/ commons-lang:commons-lang:jar:2.6:compile,ASLv2,http://commons.apache.org/lang/ commons-lang:commons-lang:jar:2.6:provided,ASLv2,http://commons.apache.org/lang/ @@ -204,14 +217,25 @@ org.springframework.integration:spring-integration-core:jar:3.0.0.RELEASE:compil org.springframework.integration:spring-integration-http:jar:3.0.0.RELEASE:compile,The Apache Software License, Version 2.0,http://www.springintegration.org/ org.springframework.retry:spring-retry:jar:1.0.3.RELEASE:compile,Apache 2.0,http://www.springsource.org org.springframework:spring-aop:jar:3.2.6.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/SpringSource/spring-framework +org.springframework:spring-aop:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework +org.springframework:spring-aspects:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework org.springframework:spring-beans:jar:3.2.6.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/SpringSource/spring-framework +org.springframework:spring-beans:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework org.springframework:spring-context:jar:3.2.6.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/SpringSource/spring-framework +org.springframework:spring-context:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework org.springframework:spring-core:jar:3.2.6.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/SpringSource/spring-framework org.springframework:spring-core:jar:4.1.4.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework +org.springframework:spring-core:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework org.springframework:spring-expression:jar:3.2.6.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/SpringSource/spring-framework +org.springframework:spring-expression:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework +org.springframework:spring-jdbc:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework +org.springframework:spring-orm:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework org.springframework:spring-tx:jar:3.2.6.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/SpringSource/spring-framework +org.springframework:spring-tx:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework org.springframework:spring-web:jar:3.2.6.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/SpringSource/spring-framework +org.springframework:spring-web:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework org.springframework:spring-webmvc:jar:3.2.6.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/SpringSource/spring-framework +org.springframework:spring-webmvc:jar:4.3.3.RELEASE:compile,The Apache Software License, Version 2.0,https://github.com/spring-projects/spring-framework org.tukaani:xz:jar:1.0:compile,Public Domain,http://tukaani.org/xz/java.html org.xerial.snappy:snappy-java:jar:1.0.4.1:compile,The Apache Software License, Version 2.0,http://code.google.com/p/snappy-java/ org.xerial.snappy:snappy-java:jar:1.1.1.7:compile,The Apache Software License, Version 2.0,https://github.com/xerial/snappy-java @@ -223,3 +247,39 @@ xerces:xercesImpl:jar:2.9.1:compile,ASLv2,http://xerces.apache.org/xerces2-j xml-apis:xml-apis:jar:1.3.04:compile,ASLv2,http://xml.apache.org/commons/components/external/ de.jollyday:jollyday:jar:0.5.2:compile,ASLv2,http://jollyday.sourceforge.net/license.html org.threeten:threeten-extra:jar:1.0:compile,BSD,http://www.threeten.org/threeten-extra/license.html +xml-apis:xml-apis:jar:1.4.01:compile,ASLv2,http://xml.apache.org/commons/components/external/ +dom4j:dom4j:jar:1.6.1:compile,dom4j,https://github.com/dom4j/dom4j +io.springfox:springfox-core:jar:2.5.0:compile,ASLv2,https://github.com/springfox/springfox +io.springfox:springfox-schema:jar:2.5.0:compile,ASLv2,https://github.com/springfox/springfox +io.springfox:springfox-spi:jar:2.5.0:compile,ASLv2,https://github.com/springfox/springfox +io.springfox:springfox-spring-web:jar:2.5.0:compile,ASLv2,https://github.com/springfox/springfox +io.springfox:springfox-swagger-common:jar:2.5.0:compile,ASLv2,https://github.com/springfox/springfox +io.springfox:springfox-swagger-ui:jar:2.5.0:compile,ASLv2,https://github.com/springfox/springfox +io.springfox:springfox-swagger2:jar:2.5.0:compile,ASLv2,https://github.com/springfox/springfox +io.swagger:swagger-annotations:jar:1.5.9:compile,ASLv2,https://github.com/swagger-api/swagger-core +io.swagger:swagger-models:jar:1.5.9:compile,ASLv2,https://github.com/swagger-api/swagger-core +javax.transaction:javax.transaction-api:jar:1.2:compile,CDDL-1.0,https://java.net/projects/jta-spec/ +javax.validation:validation-api:jar:1.1.0.Final:compile,ASLv2,http://beanvalidation.org +joda-time:joda-time:jar:2.9.4:compile,ASLv2,https://github.com/JodaOrg/joda-time +org.aspectj:aspectjweaver:jar:1.8.9:compile,EPL 1.0,https://eclipse.org/aspectj +org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile,ASLv2,https://github.com/jboss-logging +org.jboss:jandex:jar:2.0.0.Final:compile,ASLv2,https://github.com/wildfly/jandex +org.mapstruct:mapstruct:jar:1.0.0.Final:compile,ASLv2,https://github.com/mapstruct/mapstruct +org.springframework.boot:spring-boot-autoconfigure:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.boot:spring-boot-starter-aop:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.boot:spring-boot-starter-logging:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.boot:spring-boot-starter-security:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.boot:spring-boot-starter-web:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.boot:spring-boot-starter:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.boot:spring-boot:jar:1.4.1.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-boot +org.springframework.data:spring-data-commons:jar:1.12.3.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-data-commons +org.springframework.data:spring-data-jpa:jar:1.10.3.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-data-jpa +org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-plugin +org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-plugin +org.springframework.security:spring-security-config:jar:4.1.3.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-security +org.springframework.security:spring-security-core:jar:4.1.3.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-security +org.springframework.security:spring-security-web:jar:4.1.3.RELEASE:compile,ASLv2,https://github.com/spring-projects/spring-security +antlr:antlr:jar:2.7.7:compile,BSD 3-Clause License,http://www.antlr2.org http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/pom.xml ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/pom.xml b/metron-interface/metron-rest-client/pom.xml new file mode 100644 index 0000000..66ccf52 --- /dev/null +++ b/metron-interface/metron-rest-client/pom.xml @@ -0,0 +1,40 @@ + + + + + 4.0.0 + + org.apache.metron + metron-interface + 0.3.0 + + metron-rest-client + + + + + org.apache.metron + metron-common + ${project.parent.version} + + + com.fasterxml.jackson.core + jackson-databind + + + + + + http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/GrokValidation.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/GrokValidation.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/GrokValidation.java new file mode 100644 index 0000000..7fbcd34 --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/GrokValidation.java @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +import java.util.HashMap; +import java.util.Map; + +public class GrokValidation { + + private String statement; + private String sampleData; + private Map results; + + public String getStatement() { + return statement; + } + + public void setStatement(String statement) { + this.statement = statement; + } + + public String getSampleData() { + return sampleData; + } + + public void setSampleData(String sampleData) { + this.sampleData = sampleData; + } + + public Map getResults() { + if (results == null) { + return new HashMap<>(); + } + return results; + } + + public void setResults(Map results) { + this.results = results; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/KafkaTopic.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/KafkaTopic.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/KafkaTopic.java new file mode 100644 index 0000000..c8db9f6 --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/KafkaTopic.java @@ -0,0 +1,60 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +import java.util.Properties; + +public class KafkaTopic { + + private String name; + private int numPartitions; + private int replicationFactor; + private Properties properties = new Properties(); + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getNumPartitions() { + return numPartitions; + } + + public void setNumPartitions(int numPartitions) { + this.numPartitions = numPartitions; + } + + public int getReplicationFactor() { + return replicationFactor; + } + + public void setReplicationFactor(int replicationFactor) { + this.replicationFactor = replicationFactor; + } + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/ParseMessageRequest.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/ParseMessageRequest.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/ParseMessageRequest.java new file mode 100644 index 0000000..8dfe17b --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/ParseMessageRequest.java @@ -0,0 +1,42 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +import org.apache.metron.common.configuration.SensorParserConfig; + +public class ParseMessageRequest { + + private SensorParserConfig sensorParserConfig; + private String sampleData; + + public SensorParserConfig getSensorParserConfig() { + return sensorParserConfig; + } + + public void setSensorParserConfig(SensorParserConfig sensorParserConfig) { + this.sensorParserConfig = sensorParserConfig; + } + + public String getSampleData() { + return sampleData; + } + + public void setSampleData(String sampleData) { + this.sampleData = sampleData; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/RestError.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/RestError.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/RestError.java new file mode 100644 index 0000000..5f9de62 --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/RestError.java @@ -0,0 +1,43 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +public class RestError { + + private int responseCode; + private String message; + private String fullMessage; + + public RestError(int responseCode, String message, String fullMessage) { + this.responseCode = responseCode; + this.message = message; + this.fullMessage = fullMessage; + } + + public int getResponseCode() { + return responseCode; + } + + public String getMessage() { + return message; + } + + public String getFullMessage() { + return fullMessage; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/StellarFunctionDescription.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/StellarFunctionDescription.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/StellarFunctionDescription.java new file mode 100644 index 0000000..a1b9f03 --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/StellarFunctionDescription.java @@ -0,0 +1,52 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +public class StellarFunctionDescription { + + private String name; + private String description; + private String[] params; + private String returns; + + public StellarFunctionDescription(String name, String description, String[] params, String returns) { + this.name = name; + this.description = description; + this.params = params; + this.returns = returns; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String[] getParams() { + if (params == null) { + return new String[0]; + } + return params; + } + + public String getReturns() { + return returns; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyResponse.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyResponse.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyResponse.java new file mode 100644 index 0000000..6894e89 --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyResponse.java @@ -0,0 +1,42 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +public class TopologyResponse { + + private TopologyResponseCode status; + private String message; + + public TopologyResponseCode getStatus() { + return status; + } + + public String getMessage() { + return message; + } + + public void setSuccessMessage(String message) { + this.status = TopologyResponseCode.SUCCESS; + this.message = message; + } + + public void setErrorMessage(String message) { + this.status = TopologyResponseCode.ERROR; + this.message = message; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyResponseCode.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyResponseCode.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyResponseCode.java new file mode 100644 index 0000000..a85bd89 --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyResponseCode.java @@ -0,0 +1,23 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +public enum TopologyResponseCode { + + SUCCESS,ERROR +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatus.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatus.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatus.java new file mode 100644 index 0000000..0e2d28a --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatus.java @@ -0,0 +1,76 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +import java.util.List; +import java.util.Map; + +public class TopologyStatus { + + private String id; + private String name; + private TopologyStatusCode status; + private Map[] topologyStats; + private double latency = 0; + private double throughput = 0; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public TopologyStatusCode getStatus() { + return status; + } + + public void setStatus(TopologyStatusCode status) { + this.status = status; + } + + public double getLatency() { + return latency; + } + + public double getThroughput() { + return throughput; + } + + public void setTopologyStats(List> topologyStats) { + for(Map topologyStatsItem: topologyStats) { + if ("600".equals(topologyStatsItem.get("window"))) { + latency = Double.parseDouble((String) topologyStatsItem.get("completeLatency")); + int acked = 0; + if (topologyStatsItem.get("acked") != null) { + acked = (int) topologyStatsItem.get("acked"); + } + throughput = acked / 600.00; + } + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatusCode.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatusCode.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatusCode.java new file mode 100644 index 0000000..461a4ab --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologyStatusCode.java @@ -0,0 +1,32 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +public enum TopologyStatusCode { + + STARTED, + STOPPED, + ACTIVE, + INACTIVE, + KILLED, + GLOBAL_CONFIG_MISSING, + SENSOR_PARSER_CONFIG_MISSING, + START_ERROR, + STOP_ERROR, + TOPOLOGY_NOT_FOUND; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologySummary.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologySummary.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologySummary.java new file mode 100644 index 0000000..b9d39a4 --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TopologySummary.java @@ -0,0 +1,34 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +public class TopologySummary { + + private TopologyStatus[] topologies; + + public TopologyStatus[] getTopologies() { + if (topologies == null) { + return new TopologyStatus[0]; + } + return topologies; + } + + public void setTopologies(TopologyStatus[] topologies) { + this.topologies = topologies; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TransformationValidation.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TransformationValidation.java b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TransformationValidation.java new file mode 100644 index 0000000..c2e39e4 --- /dev/null +++ b/metron-interface/metron-rest-client/src/main/java/org/apache/metron/rest/model/TransformationValidation.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest.model; + +import org.apache.metron.common.configuration.SensorParserConfig; + +import java.util.HashMap; +import java.util.Map; + +public class TransformationValidation { + + private Map sampleData; + private SensorParserConfig sensorParserConfig; + + public Map getSampleData() { + if (sampleData == null) { + return new HashMap<>(); + } + return sampleData; + } + + public void setSampleData(Map sampleData) { + this.sampleData = sampleData; + } + + public SensorParserConfig getSensorParserConfig() { + if (sensorParserConfig == null) { + return new SensorParserConfig(); + } + return sensorParserConfig; + } + + public void setSensorParserConfig(SensorParserConfig sensorParserConfig) { + this.sensorParserConfig = sensorParserConfig; + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest/README.md ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest/README.md b/metron-interface/metron-rest/README.md new file mode 100644 index 0000000..63a2d34 --- /dev/null +++ b/metron-interface/metron-rest/README.md @@ -0,0 +1,439 @@ +# Metron REST and Configuration UI + +This UI exposes and aids in sensor configuration. + +## Prerequisites + +* A running Metron cluster +* A running instance of MySQL +* Java 8 installed +* Storm CLI and Metron topology scripts (start_parser_topology.sh, start_enrichment_topology.sh, start_elasticsearch_topology.sh) installed + +## Installation +1. Package the Application with Maven: + ``` + mvn clean package + ``` + +1. Untar the archive in the target directory. The directory structure will look like: + ``` + bin + start.sh + lib + metron-rest-version.jar + ``` + +1. Install Hibernate by downloading version 5.0.11.Final from (http://hibernate.org/orm/downloads/). Unpack the archive and set the HIBERNATE_HOME environment variable to the absolute path of the top level directory. + ``` + export HIBERNATE_HOME=/path/to/hibernate-release-5.0.11.Final + ``` + +1. Install the MySQL client by downloading version 5.1.40 from (https://dev.mysql.com/downloads/connector/j/). Unpack the archive and set the MYSQL_CLIENT_HOME environment variable to the absolute path of the top level directory. + ``` + export MYSQL_CLIENT_HOME=/path/to/mysql-connector-java-5.1.40 + ``` + +1. Create a MySQL user for the Config UI (http://dev.mysql.com/doc/refman/5.7/en/adding-users.html). + +1. Create a Config UI database in MySQL with this command: + ``` + CREATE DATABASE IF NOT EXISTS metronrest + ``` + +1. Create an `application.yml` file with the contents of [application-docker.yml](src/main/resources/application-docker.yml). Substitute the appropriate Metron service urls (Kafka, Zookeeper, Storm, etc) in properties containing `${docker.host.address}` and update the `spring.datasource.username` and `spring.datasource.password` properties using the MySQL credentials from step 4. + +1. Start the UI with this command: + ``` + ./bin/start.sh /path/to/application.yml + ``` + +## Usage + +The exposed REST endpoints can be accessed with the Swagger UI at http://host:port/swagger-ui.html#/. The default port is 8080 but can be changed in application.yml by setting "server.port" to the desired port. Users can be added with this SQL statement: +``` +use metronrest; +insert into users (username, password, enabled) values ('your_username','your_password',1); +insert into authorities (username, authority) values ('your_username', 'ROLE_USER'); +``` +Users can be added to additional groups with this SQL statement: +``` +use metronrest; +insert into authorities (username, authority) values ('your_username', 'your_group'); +``` + +## API + +Request and Response objects are JSON formatted. The JSON schemas are available in the Swagger UI. + +| | +| ---------- | +| [ `GET /api/v1/global/config`](#get-apiv1globalconfig)| +| [ `DELETE /api/v1/global/config`](#delete-apiv1globalconfig)| +| [ `POST /api/v1/global/config`](#post-apiv1globalconfig)| +| [ `GET /api/v1/grok/list`](#get-apiv1groklist)| +| [ `POST /api/v1/grok/validate`](#post-apiv1grokvalidate)| +| [ `GET /api/v1/kafka/topic`](#get-apiv1kafkatopic)| +| [ `POST /api/v1/kafka/topic`](#post-apiv1kafkatopic)| +| [ `GET /api/v1/kafka/topic/{name}`](#get-apiv1kafkatopic{name})| +| [ `DELETE /api/v1/kafka/topic/{name}`](#delete-apiv1kafkatopic{name})| +| [ `GET /api/v1/kafka/topic/{name}/sample`](#get-apiv1kafkatopic{name}sample)| +| [ `GET /api/v1/sensor/enrichment/config`](#get-apiv1sensorenrichmentconfig)| +| [ `GET /api/v1/sensor/enrichment/config/list/available`](#get-apiv1sensorenrichmentconfiglistavailable)| +| [ `DELETE /api/v1/sensor/enrichment/config/{name}`](#delete-apiv1sensorenrichmentconfig{name})| +| [ `POST /api/v1/sensor/enrichment/config/{name}`](#post-apiv1sensorenrichmentconfig{name})| +| [ `GET /api/v1/sensor/enrichment/config/{name}`](#get-apiv1sensorenrichmentconfig{name})| +| [ `GET /api/v1/sensor/indexing/config`](#get-apiv1sensorindexingconfig)| +| [ `DELETE /api/v1/sensor/indexing/config/{name}`](#delete-apiv1sensorindexingconfig{name})| +| [ `POST /api/v1/sensor/indexing/config/{name}`](#post-apiv1sensorindexingconfig{name})| +| [ `GET /api/v1/sensor/indexing/config/{name}`](#get-apiv1sensorindexingconfig{name})| +| [ `POST /api/v1/sensor/parser/config`](#post-apiv1sensorparserconfig)| +| [ `GET /api/v1/sensor/parser/config`](#get-apiv1sensorparserconfig)| +| [ `GET /api/v1/sensor/parser/config/list/available`](#get-apiv1sensorparserconfiglistavailable)| +| [ `POST /api/v1/sensor/parser/config/parseMessage`](#post-apiv1sensorparserconfigparsemessage)| +| [ `GET /api/v1/sensor/parser/config/reload/available`](#get-apiv1sensorparserconfigreloadavailable)| +| [ `DELETE /api/v1/sensor/parser/config/{name}`](#delete-apiv1sensorparserconfig{name})| +| [ `GET /api/v1/sensor/parser/config/{name}`](#get-apiv1sensorparserconfig{name})| +| [ `GET /api/v1/storm`](#get-apiv1storm)| +| [ `GET /api/v1/storm/client/status`](#get-apiv1stormclientstatus)| +| [ `GET /api/v1/storm/enrichment`](#get-apiv1stormenrichment)| +| [ `GET /api/v1/storm/enrichment/activate`](#get-apiv1stormenrichmentactivate)| +| [ `GET /api/v1/storm/enrichment/deactivate`](#get-apiv1stormenrichmentdeactivate)| +| [ `GET /api/v1/storm/enrichment/start`](#get-apiv1stormenrichmentstart)| +| [ `GET /api/v1/storm/enrichment/stop`](#get-apiv1stormenrichmentstop)| +| [ `GET /api/v1/storm/indexing`](#get-apiv1stormindexing)| +| [ `GET /api/v1/storm/indexing/activate`](#get-apiv1stormindexingactivate)| +| [ `GET /api/v1/storm/indexing/deactivate`](#get-apiv1stormindexingdeactivate)| +| [ `GET /api/v1/storm/indexing/start`](#get-apiv1stormindexingstart)| +| [ `GET /api/v1/storm/indexing/stop`](#get-apiv1stormindexingstop)| +| [ `GET /api/v1/storm/parser/activate/{name}`](#get-apiv1stormparseractivate{name})| +| [ `GET /api/v1/storm/parser/deactivate/{name}`](#get-apiv1stormparserdeactivate{name})| +| [ `GET /api/v1/storm/parser/start/{name}`](#get-apiv1stormparserstart{name})| +| [ `GET /api/v1/storm/parser/stop/{name}`](#get-apiv1stormparserstop{name})| +| [ `GET /api/v1/storm/{name}`](#get-apiv1storm{name})| +| [ `GET /api/v1/transformation/list`](#get-apiv1transformationlist)| +| [ `GET /api/v1/transformation/list/functions`](#get-apiv1transformationlistfunctions)| +| [ `GET /api/v1/transformation/list/simple/functions`](#get-apiv1transformationlistsimplefunctions)| +| [ `POST /api/v1/transformation/validate`](#post-apiv1transformationvalidate)| +| [ `POST /api/v1/transformation/validate/rules`](#post-apiv1transformationvalidaterules)| +| [ `GET /api/v1/user`](#get-apiv1user)| + +### `GET /api/v1/global/config` + * Description: Retrieves the current Global Config from Zookeeper + * Returns: + * 200 - Returns current Global Config JSON in Zookeeper + * 404 - Global Config JSON was not found in Zookeeper + +### `DELETE /api/v1/global/config` + * Description: Deletes the current Global Config from Zookeeper + * Returns: + * 200 - Global Config JSON was deleted + * 404 - Global Config JSON was not found in Zookeeper + +### `POST /api/v1/global/config` + * Description: Creates or updates the Global Config in Zookeeper + * Input: + * globalConfig - The Global Config JSON to be saved + * Returns: + * 200 - Global Config updated. Returns saved Global Config JSON + * 201 - Global Config created. Returns saved Global Config JSON + +### `GET /api/v1/grok/list` + * Description: Lists the common Grok statements available in Metron + * Returns: + * 200 - JSON object containing pattern label/Grok statements key value pairs + +### `POST /api/v1/grok/validate` + * Description: Applies a Grok statement to a sample message + * Input: + * grokValidation - Object containing Grok statment and sample message + * Returns: + * 200 - JSON results + +### `GET /api/v1/kafka/topic` + * Description: Retrieves all Kafka topics + * Returns: + * 200 - Returns a list of all Kafka topics + +### `POST /api/v1/kafka/topic` + * Description: Creates a new Kafka topic + * Input: + * topic - Kafka topic + * Returns: + * 200 - Returns saved Kafka topic + +### `GET /api/v1/kafka/topic/{name}` + * Description: Retrieves a Kafka topic + * Input: + * name - Kafka topic name + * Returns: + * 200 - Returns Kafka topic + * 404 - Kafka topic is missing + +### `DELETE /api/v1/kafka/topic/{name}` + * Description: Delets a Kafka topic + * Input: + * name - Kafka topic name + * Returns: + * 200 - Kafka topic was deleted + * 404 - Kafka topic is missing + +### `GET /api/v1/kafka/topic/{name}/sample` + * Description: Retrieves a sample message from a Kafka topic using the most recent offset + * Input: + * name - Kafka topic name + * Returns: + * 200 - Returns sample message + * 404 - Either Kafka topic is missing or contains no messages + +### `GET /api/v1/sensor/enrichment/config` + * Description: Retrieves all SensorEnrichmentConfigs from Zookeeper + * Returns: + * 200 - Returns all SensorEnrichmentConfigs + +### `GET /api/v1/sensor/enrichment/config/list/available` + * Description: Lists the available enrichments + * Returns: + * 200 - Returns a list of available enrichments + +### `DELETE /api/v1/sensor/enrichment/config/{name}` + * Description: Deletes a SensorEnrichmentConfig from Zookeeper + * Input: + * name - SensorEnrichmentConfig name + * Returns: + * 200 - SensorEnrichmentConfig was deleted + * 404 - SensorEnrichmentConfig is missing + +### `POST /api/v1/sensor/enrichment/config/{name}` + * Description: Updates or creates a SensorEnrichmentConfig in Zookeeper + * Input: + * sensorEnrichmentConfig - SensorEnrichmentConfig + * name - SensorEnrichmentConfig name + * Returns: + * 200 - SensorEnrichmentConfig updated. Returns saved SensorEnrichmentConfig + * 201 - SensorEnrichmentConfig created. Returns saved SensorEnrichmentConfig + +### `GET /api/v1/sensor/enrichment/config/{name}` + * Description: Retrieves a SensorEnrichmentConfig from Zookeeper + * Input: + * name - SensorEnrichmentConfig name + * Returns: + * 200 - Returns SensorEnrichmentConfig + * 404 - SensorEnrichmentConfig is missing + +### `GET /api/v1/sensor/indexing/config` + * Description: Retrieves all SensorIndexingConfigs from Zookeeper + * Returns: + * 200 - Returns all SensorIndexingConfigs + +### `DELETE /api/v1/sensor/indexing/config/{name}` + * Description: Deletes a SensorIndexingConfig from Zookeeper + * Input: + * name - SensorIndexingConfig name + * Returns: + * 200 - SensorIndexingConfig was deleted + * 404 - SensorIndexingConfig is missing + +### `POST /api/v1/sensor/indexing/config/{name}` + * Description: Updates or creates a SensorIndexingConfig in Zookeeper + * Input: + * sensorIndexingConfig - SensorIndexingConfig + * name - SensorIndexingConfig name + * Returns: + * 200 - SensorIndexingConfig updated. Returns saved SensorIndexingConfig + * 201 - SensorIndexingConfig created. Returns saved SensorIndexingConfig + +### `GET /api/v1/sensor/indexing/config/{name}` + * Description: Retrieves a SensorIndexingConfig from Zookeeper + * Input: + * name - SensorIndexingConfig name + * Returns: + * 200 - Returns SensorIndexingConfig + * 404 - SensorIndexingConfig is missing + +### `POST /api/v1/sensor/parser/config` + * Description: Updates or creates a SensorParserConfig in Zookeeper + * Input: + * sensorParserConfig - SensorParserConfig + * Returns: + * 200 - SensorParserConfig updated. Returns saved SensorParserConfig + * 201 - SensorParserConfig created. Returns saved SensorParserConfig + +### `GET /api/v1/sensor/parser/config` + * Description: Retrieves all SensorParserConfigs from Zookeeper + * Returns: + * 200 - Returns all SensorParserConfigs + +### `GET /api/v1/sensor/parser/config/list/available` + * Description: Lists the available parser classes that can be found on the classpath + * Returns: + * 200 - Returns a list of available parser classes + +### `POST /api/v1/sensor/parser/config/parseMessage` + * Description: Parses a sample message given a SensorParserConfig + * Input: + * parseMessageRequest - Object containing a sample message and SensorParserConfig + * Returns: + * 200 - Returns parsed message + +### `GET /api/v1/sensor/parser/config/reload/available` + * Description: Scans the classpath for available parser classes and reloads the cached parser class list + * Returns: + * 200 - Returns a list of available parser classes + +### `DELETE /api/v1/sensor/parser/config/{name}` + * Description: Deletes a SensorParserConfig from Zookeeper + * Input: + * name - SensorParserConfig name + * Returns: + * 200 - SensorParserConfig was deleted + * 404 - SensorParserConfig is missing + +### `GET /api/v1/sensor/parser/config/{name}` + * Description: Retrieves a SensorParserConfig from Zookeeper + * Input: + * name - SensorParserConfig name + * Returns: + * 200 - Returns SensorParserConfig + * 404 - SensorParserConfig is missing + +### `GET /api/v1/storm` + * Description: Retrieves the status of all Storm topologies + * Returns: + * 200 - Returns a list of topologies with status information + +### `GET /api/v1/storm/client/status` + * Description: Retrieves information about the Storm command line client + * Returns: + * 200 - Returns storm command line client information + +### `GET /api/v1/storm/enrichment` + * Description: Retrieves the status of the Storm enrichment topology + * Returns: + * 200 - Returns topology status information + * 404 - Topology is missing + +### `GET /api/v1/storm/enrichment/activate` + * Description: Activates a Storm enrichment topology + * Returns: + * 200 - Returns activate response message + +### `GET /api/v1/storm/enrichment/deactivate` + * Description: Deactivates a Storm enrichment topology + * Returns: + * 200 - Returns deactivate response message + +### `GET /api/v1/storm/enrichment/start` + * Description: Starts a Storm enrichment topology + * Returns: + * 200 - Returns start response message + +### `GET /api/v1/storm/enrichment/stop` + * Description: Stops a Storm enrichment topology + * Input: + * stopNow - Stop the topology immediately + * Returns: + * 200 - Returns stop response message + +### `GET /api/v1/storm/indexing` + * Description: Retrieves the status of the Storm indexing topology + * Returns: + * 200 - Returns topology status information + * 404 - Topology is missing + +### `GET /api/v1/storm/indexing/activate` + * Description: Activates a Storm indexing topology + * Returns: + * 200 - Returns activate response message + +### `GET /api/v1/storm/indexing/deactivate` + * Description: Deactivates a Storm indexing topology + * Returns: + * 200 - Returns deactivate response message + +### `GET /api/v1/storm/indexing/start` + * Description: Starts a Storm indexing topology + * Returns: + * 200 - Returns start response message + +### `GET /api/v1/storm/indexing/stop` + * Description: Stops a Storm enrichment topology + * Input: + * stopNow - Stop the topology immediately + * Returns: + * 200 - Returns stop response message + +### `GET /api/v1/storm/parser/activate/{name}` + * Description: Activates a Storm parser topology + * Input: + * name - Parser name + * Returns: + * 200 - Returns activate response message + +### `GET /api/v1/storm/parser/deactivate/{name}` + * Description: Deactivates a Storm parser topology + * Input: + * name - Parser name + * Returns: + * 200 - Returns deactivate response message + +### `GET /api/v1/storm/parser/start/{name}` + * Description: Starts a Storm parser topology + * Input: + * name - Parser name + * Returns: + * 200 - Returns start response message + +### `GET /api/v1/storm/parser/stop/{name}` + * Description: Stops a Storm parser topology + * Input: + * name - Parser name + * stopNow - Stop the topology immediately + * Returns: + * 200 - Returns stop response message + +### `GET /api/v1/storm/{name}` + * Description: Retrieves the status of a Storm topology + * Input: + * name - Topology name + * Returns: + * 200 - Returns topology status information + * 404 - Topology is missing + +### `GET /api/v1/transformation/list` + * Description: Retrieves field transformations + * Returns: + * 200 - Returns a list field transformations + +### `GET /api/v1/transformation/list/functions` + * Description: Lists the Stellar functions that can be found on the classpath + * Returns: + * 200 - Returns a list of Stellar functions + +### `GET /api/v1/transformation/list/simple/functions` + * Description: Lists the simple Stellar functions (functions with only 1 input) that can be found on the classpath + * Returns: + * 200 - Returns a list of simple Stellar functions + +### `POST /api/v1/transformation/validate` + * Description: Executes transformations against a sample message + * Input: + * transformationValidation - Object containing SensorParserConfig and sample message + * Returns: + * 200 - Returns transformation results + +### `POST /api/v1/transformation/validate/rules` + * Description: Tests Stellar statements to ensure they are well-formed + * Input: + * statements - List of statements to validate + * Returns: + * 200 - Returns validation results + +### `GET /api/v1/user` + * Description: Retrieves the current user + * Returns: + * 200 - Current user + + +## License + +This project depends on the Java Transaction API. See https://java.net/projects/jta-spec/ for more details. http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest/pom.xml ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest/pom.xml b/metron-interface/metron-rest/pom.xml new file mode 100644 index 0000000..c2beb2d --- /dev/null +++ b/metron-interface/metron-rest/pom.xml @@ -0,0 +1,328 @@ + + + + + 4.0.0 + + org.apache.metron + metron-interface + 0.3.0 + + metron-rest + + UTF-8 + UTF-8 + 1.8 + 4.5 + 2.7.1 + 1.6.4 + 1.4.1.RELEASE + 2.5.0 + 5.1.40 + 1.0-alpha-3 + + + + org.springframework.boot + spring-boot-starter-web + + + ch.qos.logback + logback-classic + + + org.slf4j + log4j-over-slf4j + + + org.hibernate + hibernate-validator + + + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-jdbc + + + mysql + mysql-connector-java + ${mysql.client.version} + provided + + + org.apache.curator + curator-recipes + ${curator.version} + + + com.googlecode.json-simple + json-simple + ${global_json_simple_version} + + + org.antlr + antlr4-runtime + ${antlr.version} + + + com.fasterxml.jackson.core + jackson-databind + 2.8.3 + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + 2.8.1 + + + org.apache.metron + metron-rest-client + ${project.parent.version} + + + org.apache.metron + metron-common + ${project.parent.version} + + + com.fasterxml.jackson.core + jackson-databind + + + + + org.apache.metron + metron-parsers + ${project.parent.version} + + + com.fasterxml.jackson.core + jackson-databind + + + org.apache.metron + metron-profiler-client + + + org.apache.metron + metron-writer + + + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + org.apache.kafka + kafka_2.10 + ${global_kafka_version} + + + io.thekraken + grok + 0.1.0 + + + org.reflections + reflections + 0.9.10 + + + com.google.code.findbugs + annotations + + + + + + org.springframework.boot + spring-boot-starter-test + test + + + com.h2database + h2 + test + + + org.springframework.security + spring-security-test + test + + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + org.powermock + powermock-api-mockito + ${powermock.version} + test + + + org.apache.metron + metron-integration-test + ${project.parent.version} + test + + + org.apache.logging.log4j + log4j-slf4j-impl + + + org.slf4j + log4j-over-slf4j + + + javax.servlet + servlet-api + + + + + org.apache.kafka + kafka-clients + ${global_kafka_version} + test + test + + + log4j + log4j + + + + + org.apache.velocity + velocity + 1.7 + test + + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + org.apache.logging.log4j + log4j-slf4j-impl + + + ch.qos.logback + logback-classic + + + + + + + + + + org.codehaus.mojo + emma-maven-plugin + ${emma.version} + + + org.apache.maven.plugins + maven-pmd-plugin + + ${global_java_version} + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + + + repackage + + + + + ZIP + + + mysql + mysql-connector-java + + + org.hibernate.common + hibernate-commons-annotations + + + org.hibernate + hibernate-core + + + org.hibernate + hibernate-envers + + + org.hibernate + hibernate-entitymanager + + + org.hibernate.javax.persistence + hibernate-jpa-2.1-api + + + + + + maven-assembly-plugin + + src/main/assembly/assembly.xml + + + + make-assembly + package + + single + + + + + + + http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest/src/main/assembly/assembly.xml ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest/src/main/assembly/assembly.xml b/metron-interface/metron-rest/src/main/assembly/assembly.xml new file mode 100644 index 0000000..7a5dbee --- /dev/null +++ b/metron-interface/metron-rest/src/main/assembly/assembly.xml @@ -0,0 +1,54 @@ + + + + archive + + tar.gz + + false + + + ${project.basedir}/src/main/config + /config + true + + **/*.formatted + **/*.filtered + + 0644 + unix + true + + + ${project.basedir}/src/main/scripts + /bin + true + + **/*.formatted + **/*.filtered + + 0755 + unix + true + + + ${project.basedir}/target + + ${project.artifactId}-${project.version}.jar + + /lib + true + + + http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestApplication.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestApplication.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestApplication.java new file mode 100644 index 0000000..ac89b1d --- /dev/null +++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestApplication.java @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class MetronRestApplication { + + public static void main(String[] args) { + SpringApplication.run(MetronRestApplication.class, args); + } +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestConstants.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestConstants.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestConstants.java new file mode 100644 index 0000000..8786222 --- /dev/null +++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestConstants.java @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest; + +import org.apache.metron.parsers.GrokParser; + +public class MetronRestConstants { + + public static final String DEV_PROFILE = "dev"; + public static final String TEST_PROFILE = "test"; + public static final String DOCKER_PROFILE = "docker"; + public static final String CSRF_ENABLE_PROFILE = "csrf-enable"; + + public static final String GROK_DEFAULT_PATH_SPRING_PROPERTY = "grok.path.default"; + public static final String GROK_TEMP_PATH_SPRING_PROPERTY = "grok.path.temp"; + public static final String GROK_CLASS_NAME = GrokParser.class.getName(); + public static final String GROK_PATH_KEY = "grokPath"; + public static final String GROK_STATEMENT_KEY = "grokStatement"; + public static final String GROK_PATTERN_LABEL_KEY = "patternLabel"; + + public static final String STORM_UI_SPRING_PROPERTY = "storm.ui.url"; + public static final String TOPOLOGY_SUMMARY_URL = "/api/v1/topology/summary"; + public static final String TOPOLOGY_URL = "/api/v1/topology"; + public static final String ENRICHMENT_TOPOLOGY_NAME = "enrichment"; + public static final String INDEXING_TOPOLOGY_NAME = "indexing"; + public static final String PARSER_SCRIPT_PATH_SPRING_PROPERTY = "storm.parser.script.path"; + public static final String ENRICHMENT_SCRIPT_PATH_SPRING_PROPERTY = "storm.enrichment.script.path"; + public static final String INDEXING_SCRIPT_PATH_SPRING_PROPERTY = "storm.indexing.script.path"; + + public static final String ZK_URL_SPRING_PROPERTY = "zookeeper.url"; + public static final String ZK_CLIENT_SESSION_TIMEOUT = "zookeeper.client.timeout.session"; + public static final String ZK_CLIENT_CONNECTION_TIMEOUT = "zookeeper.client.timeout.connection"; + public static final String CURATOR_SLEEP_TIME = "curator.sleep.time"; + public static final String CURATOR_MAX_RETRIES = "curator.max.retries"; + + public static final String KAFKA_BROKER_URL_SPRING_PROPERTY = "kafka.broker.url"; + + public static final String HDFS_URL_SPRING_PROPERTY = "hdfs.namenode.url"; + public static final String DEFAULT_HDFS_URL = "file:///"; +} http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/55b3e7ea/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/RestException.java ---------------------------------------------------------------------- diff --git a/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/RestException.java b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/RestException.java new file mode 100644 index 0000000..1f985f7 --- /dev/null +++ b/metron-interface/metron-rest/src/main/java/org/apache/metron/rest/RestException.java @@ -0,0 +1,43 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.metron.rest; + +public class RestException extends Exception { + + private String fullMessage; + + public RestException(Exception e) { super( e.getMessage(), e.getCause()); } + + public RestException(String message) { + super(message); + } + + public RestException(String message, Throwable cause) { + super(message, cause); + } + + public RestException(String message, String fullMessage, Throwable cause) { + super(message, cause); + this.fullMessage = fullMessage; + } + + public String getFullMessage() { + return this.fullMessage; + } + +}