[
https://issues.apache.org/jira/browse/STREAMS-592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16424146#comment-16424146
]
ASF GitHub Bot commented on STREAMS-592:
----------------------------------------
steveblackmon closed pull request #432: resolves STREAMS-592
URL: https://github.com/apache/streams/pull/432
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/streams-runtimes/pom.xml b/streams-runtimes/pom.xml
index 49bc801491..3d54be4c5c 100644
--- a/streams-runtimes/pom.xml
+++ b/streams-runtimes/pom.xml
@@ -34,7 +34,6 @@
<packaging>pom</packaging>
<modules>
- <module>streams-runtime-dropwizard</module>
<module>streams-runtime-local</module>
</modules>
</project>
diff --git a/streams-runtimes/streams-runtime-dropwizard/README.md
b/streams-runtimes/streams-runtime-dropwizard/README.md
deleted file mode 100644
index 52dab1da68..0000000000
--- a/streams-runtimes/streams-runtime-dropwizard/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-Apache Streams
-Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
---------------------------------------------------------------------------------
-
-org.apache.streams:streams-runtime-dropwizard
-=============================================
-
-[README.md](src/site/markdown/index.md "README")
diff --git a/streams-runtimes/streams-runtime-dropwizard/pom.xml
b/streams-runtimes/streams-runtime-dropwizard/pom.xml
deleted file mode 100644
index 13f9e4b2d3..0000000000
--- a/streams-runtimes/streams-runtime-dropwizard/pom.xml
+++ /dev/null
@@ -1,269 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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
- ~
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-runtimes</artifactId>
- <version>0.5.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>streams-runtime-dropwizard</artifactId>
-
- <properties>
- <dropwizard.version>0.7.1</dropwizard.version>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-core</artifactId>
- <version>${dropwizard.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-afterburner</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.datatype</groupId>
- <artifactId>jackson-datatype-guava</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-configuration</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-validation</artifactId>
- <version>${dropwizard.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-metrics</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-testing</artifactId>
- <version>${dropwizard.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-afterburner</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.datatype</groupId>
- <artifactId>jackson-datatype-guava</artifactId>
- <version>${jackson.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.hubspot.dropwizard</groupId>
- <artifactId>dropwizard-guice</artifactId>
- <version>0.7.1</version>
- <exclusions>
- <exclusion>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>annotations</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- <version>3.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-config</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-util</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-pojo</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-runtime-local</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <version>1.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-testing</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <type>test-jar</type>
- </dependency>
- </dependencies>
-
- <build>
- <sourceDirectory>src/main/java</sourceDirectory>
- <testSourceDirectory>src/test/java</testSourceDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.streams.plugins</groupId>
- <artifactId>streams-plugin-pojo</artifactId>
- <version>${project.version}</version>
- <configuration>
- <sourcePaths>
-
<sourcePath>${project.basedir}/src/main/jsonschema</sourcePath>
- </sourcePaths>
-
<targetDirectory>${project.basedir}/target/generated-sources/pojo</targetDirectory>
-
<targetPackage>org.apache.streams.dropwizard.pojo</targetPackage>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-core</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-configuration</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-validation</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-metrics</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/generated-sources/pojo</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/GenericWebhookResource.java
b/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/GenericWebhookResource.java
deleted file mode 100644
index 56fb46576c..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/GenericWebhookResource.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * 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
- *
- * 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.streams.dropwizard;
-
-import org.apache.streams.core.StreamsDatum;
-import org.apache.streams.core.StreamsProvider;
-import org.apache.streams.core.StreamsResultSet;
-import org.apache.streams.jackson.StreamsJacksonMapper;
-import org.apache.streams.util.ComponentUtils;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.base.Splitter;
-import org.joda.time.DateTime;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.math.BigInteger;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.regex.Pattern;
-import javax.annotation.Resource;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-/**
- * GenericWebhookResource provides basic webhook connectivity.
- *
- * <p/>
- * Add processors / persistWriters that read from "GenericWebhookResource" to
- * consume data posted to streams.
- */
-@Resource
-@Path("/streams/webhooks")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public class GenericWebhookResource implements StreamsProvider {
-
- public static final String STREAMS_ID = "GenericWebhookResource";
-
- public GenericWebhookResource() {
- }
-
- private static final Logger log = LoggerFactory
- .getLogger(GenericWebhookResource.class);
-
- private static ObjectMapper mapper = StreamsJacksonMapper.getInstance();
-
- protected Queue<StreamsDatum> providerQueue = new ConcurrentLinkedQueue<>();
-
- protected final ReadWriteLock lock = new ReentrantReadWriteLock();
-
- private static Pattern newLinePattern = Pattern.compile("(\\r\\n?|\\n)",
Pattern.MULTILINE);
-
- @Override
- public String getId() {
- return STREAMS_ID;
- }
-
- /**
- * push a String json datum into a stream.
- * @param headers HttpHeaders
- * @param body String json
- * @return Response
- */
- @POST
- @Path("json")
- public Response json(@Context HttpHeaders headers,
- String body) {
-
- ObjectNode response = mapper.createObjectNode();
- int responseCode = Response.Status.BAD_REQUEST.getStatusCode();
-
- try {
- ObjectNode item = mapper.readValue(body, ObjectNode.class);
-
- StreamsDatum datum = new StreamsDatum(body);
-
- lock.writeLock().lock();
- ComponentUtils.offerUntilSuccess(datum, providerQueue);
- lock.writeLock().unlock();
-
- Boolean success = true;
-
- response.put("success", success);
-
- responseCode = Response.Status.OK.getStatusCode();
-
- } catch (Exception ex) {
- log.warn(ex.toString(), ex);
-
- Boolean success = false;
-
- response.put("success", success);
- responseCode = Response.Status.BAD_REQUEST.getStatusCode();
-
- } finally {
- return Response.status(responseCode).entity(response).build();
- }
- }
-
- /**
- * push multiple String json datums into a stream.
- * @param headers HttpHeaders
- * @param body String json
- * @return Response
- */
- @POST
- @Path("json_new_line")
- public Response json_new_line(@Context HttpHeaders headers,
- String body) {
-
- ObjectNode response = mapper.createObjectNode();
- int responseCode = Response.Status.BAD_REQUEST.getStatusCode();
-
- if (body.equalsIgnoreCase("{}")) {
-
- Boolean success = true;
-
- response.put("success", success);
- responseCode = Response.Status.OK.getStatusCode();
- return Response.status(responseCode).entity(response).build();
- }
-
- try {
-
- for (String line : Splitter.on(newLinePattern).split(body)) {
- ObjectNode item = mapper.readValue(line, ObjectNode.class);
-
- StreamsDatum datum = new StreamsDatum(item);
-
- lock.writeLock().lock();
- ComponentUtils.offerUntilSuccess(datum, providerQueue);
- lock.writeLock().unlock();
-
- }
-
- Boolean success = true;
-
- response.put("success", success);
- responseCode = Response.Status.OK.getStatusCode();
-
- } catch (Exception ex) {
- log.warn(ex.toString(), ex);
-
- Boolean success = false;
-
- response.put("success", success);
- responseCode = Response.Status.BAD_REQUEST.getStatusCode();
-
- } finally {
- return Response.status(responseCode).entity(response).build();
-
- }
-
- }
-
- /**
- * push multiple ObjectNode json datums into a stream.
- * @param headers HttpHeaders
- * @param body String json
- * @return Response
- */
- @POST
- @Path("json_meta")
- public Response json_meta(@Context HttpHeaders headers,
- String body) {
-
- ObjectNode response = mapper.createObjectNode();
- int responseCode = Response.Status.BAD_REQUEST.getStatusCode();
-
- if (body.equalsIgnoreCase("{}")) {
-
- Boolean success = true;
-
- response.put("success", success);
- responseCode = Response.Status.OK.getStatusCode();
-
- return Response.status(responseCode).entity(response).build();
- }
-
- try {
-
- GenericWebhookData objectWrapper = mapper.readValue(body,
GenericWebhookData.class);
-
- for ( ObjectNode item : objectWrapper.getData()) {
-
- StreamsDatum datum = new StreamsDatum(item);
-
- lock.writeLock().lock();
- ComponentUtils.offerUntilSuccess(datum, providerQueue);
- lock.writeLock().unlock();
- }
-
- Boolean success = true;
-
- response.put("success", success);
- responseCode = Response.Status.OK.getStatusCode();
-
- } catch (Exception ex) {
- log.warn(ex.toString(), ex);
-
- Boolean success = false;
-
- response.put("success", success);
- responseCode = Response.Status.BAD_REQUEST.getStatusCode();
- } finally {
- return Response.status(responseCode).entity(response).build();
- }
-
- }
-
- @Override
- public void startStream() {
- }
-
- @Override
- public StreamsResultSet readCurrent() {
-
- StreamsResultSet current;
-
- lock.writeLock().lock();
- current = new StreamsResultSet(new ConcurrentLinkedQueue<>(providerQueue));
- providerQueue.clear();
- lock.writeLock().unlock();
-
- return current;
-
- }
-
- @Override
- public StreamsResultSet readNew(BigInteger sequence) {
- return null;
- }
-
- @Override
- public StreamsResultSet readRange(DateTime start, DateTime end) {
- return null;
- }
-
- @Override
- public boolean isRunning() {
- return true;
- }
-
- @Override
- public void prepare(Object configurationObject) {
-
- }
-
- @Override
- public void cleanUp() {
-
- }
-
-}
\ No newline at end of file
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/StreamDropwizardBuilder.java
b/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/StreamDropwizardBuilder.java
deleted file mode 100644
index 771aed4a79..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/StreamDropwizardBuilder.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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
- *
- * 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.streams.dropwizard;
-
-import org.apache.streams.config.ComponentConfigurator;
-import org.apache.streams.config.StreamsConfiguration;
-import org.apache.streams.core.StreamBuilder;
-import org.apache.streams.core.StreamsProvider;
-import org.apache.streams.local.LocalRuntimeConfiguration;
-import org.apache.streams.local.builders.LocalStreamBuilder;
-import org.apache.streams.local.monitoring.MonitoringConfiguration;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import java.util.Map;
-
-/**
- * StreamDropwizardBuilder is currently a light wrapper around
LocalStreamBuilder.
- *
- * <p/>
- * It's a seperate class because they will almost certainly deviate going
forward
- */
-public class StreamDropwizardBuilder extends LocalStreamBuilder implements
StreamBuilder {
-
- public StreamDropwizardBuilder() {
- super(
- new
ComponentConfigurator<>(LocalRuntimeConfiguration.class).detectConfiguration(),
- new
ComponentConfigurator<>(MonitoringConfiguration.class).detectConfiguration()
- );
- }
-
- @Override
- public StreamBuilder newPerpetualStream(String streamId, StreamsProvider
provider) {
- return super.newPerpetualStream(streamId, provider);
- }
-
-}
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/StreamsApplication.java
b/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/StreamsApplication.java
deleted file mode 100644
index 0251b301dc..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/StreamsApplication.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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
- *
- * 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.streams.dropwizard;
-
-import org.apache.streams.config.StreamsConfiguration;
-import org.apache.streams.core.StreamBuilder;
-import org.apache.streams.core.StreamsProvider;
-import org.apache.streams.jackson.StreamsJacksonMapper;
-
-import com.codahale.metrics.MetricRegistry;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.datatype.guava.GuavaModule;
-import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
-import com.hubspot.dropwizard.guice.GuiceBundle;
-import io.dropwizard.Application;
-import io.dropwizard.jackson.GuavaExtrasModule;
-import io.dropwizard.metrics.MetricsFactory;
-import io.dropwizard.setup.Bootstrap;
-import io.dropwizard.setup.Environment;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-
-/**
- * Entry point to a dropwizard streams application
- *
- * <p/>
- * It will start up a stream in the local runtime, as well as bind any
- * StreamsProvider on the classpath with a @Resource annotation.
- */
-public class StreamsApplication extends
Application<StreamsDropwizardConfiguration> {
-
- private static final Logger LOGGER = LoggerFactory
- .getLogger(StreamsApplication.class);
-
- protected static ObjectMapper mapper = StreamsJacksonMapper.getInstance();
-
- protected StreamBuilder builder;
-
- private static StreamsConfiguration streamsConfiguration;
-
- // ConcurrentHashSet is preferable, but it's only in guava 15+
- // spark 1.5.0 uses guava 14 so for the moment this is the workaround
- // Set<StreamsProvider> resourceProviders = Sets.newConcurrentHashSet();
- private Set<StreamsProvider> resourceProviders =
Collections.newSetFromMap(new ConcurrentHashMap<StreamsProvider, Boolean>());
-
- private Executor executor = Executors.newSingleThreadExecutor();
-
- static {
- mapper.registerModule(new AfterburnerModule());
- mapper.registerModule(new GuavaModule());
- mapper.registerModule(new GuavaExtrasModule());
- }
-
- @Override
- public void initialize(Bootstrap<StreamsDropwizardConfiguration> bootstrap) {
-
- LOGGER.info(getClass().getPackage().getName());
-
- GuiceBundle<StreamsDropwizardConfiguration> guiceBundle =
- GuiceBundle.<StreamsDropwizardConfiguration>newBuilder()
- .addModule(new StreamsDropwizardModule())
- .setConfigClass(StreamsDropwizardConfiguration.class)
- // override and add more packages to pick up custom Resources
- .enableAutoConfig(getClass().getPackage().getName())
- .build();
- bootstrap.addBundle(guiceBundle);
-
- }
-
- @Override
- public void run(StreamsDropwizardConfiguration
streamsDropwizardConfiguration, Environment environment) throws Exception {
-
- executor = Executors.newSingleThreadExecutor();
-
- for ( Class<?> resourceProviderClass :
environment.jersey().getResourceConfig().getRootResourceClasses() ) {
- StreamsProvider provider =
(StreamsProvider)resourceProviderClass.newInstance();
- if ( StreamsProvider.class.isInstance(provider)) {
- resourceProviders.add(provider);
- }
- }
-
- MetricRegistry metrics = new MetricRegistry();
- MetricsFactory mfac = streamsDropwizardConfiguration.getMetricsFactory();
- mfac.configure(environment.lifecycle(), metrics);
-
- streamsConfiguration = mapper.convertValue(streamsDropwizardConfiguration,
StreamsConfiguration.class);
-
- builder = setup(streamsConfiguration, resourceProviders);
-
- executor.execute(new StreamsDropwizardRunner(builder,
streamsConfiguration));
-
- // wait for streams to start up
- Thread.sleep(10000);
-
- for (StreamsProvider resource : resourceProviders) {
- environment.jersey().register(resource);
- LOGGER.info("Added resource class: {}", resource);
- }
-
- }
-
- /**
- * setup StreamBuilder.
- * @param streamsConfiguration StreamsConfiguration
- * @param resourceProviders Set of StreamsProvider
- * @return StreamBuilder
- */
- public StreamBuilder setup(StreamsConfiguration streamsConfiguration,
Set<StreamsProvider> resourceProviders) {
-
- StreamBuilder builder = new StreamDropwizardBuilder();
-
- List<String> providers = new ArrayList<>();
- for ( StreamsProvider provider: resourceProviders) {
- String providerId = provider.getClass().getSimpleName();
- builder.newPerpetualStream(providerId, provider);
- providers.add(providerId);
- }
-
- return builder;
- }
-
- private class StreamsDropwizardRunner implements Runnable {
-
- private StreamsConfiguration streamsConfiguration;
-
- private StreamBuilder builder;
-
- protected StreamsDropwizardRunner(StreamBuilder builder,
StreamsConfiguration streamsConfiguration) {
- this.streamsConfiguration = streamsConfiguration;
- this.builder = builder;
- }
-
- @Override
- public void run() {
-
- builder.start();
-
- }
- }
-
- /**
- * Run from console:
- *
- * <p/>
- * java -jar uber.jar server ./configuration.yml
- *
- * @param args ["server", configuration.yml]
- * @throws Exception Exception
- */
- public static void main(String[] args) throws Exception {
-
- new StreamsApplication().run(args);
-
- }
-
-}
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/StreamsDropwizardModule.java
b/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/StreamsDropwizardModule.java
deleted file mode 100644
index 9514cafdca..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/main/java/org/apache/streams/dropwizard/StreamsDropwizardModule.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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
- *
- * 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.streams.dropwizard;
-
-import org.apache.streams.config.StreamsConfiguration;
-import org.apache.streams.config.StreamsConfigurator;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
-
-/**
- * This class exists because dropwizard-guice requires at least
- * one module to run.
- *
- * <p/>
- * Do not expect @Inject StreamsConfiguration to work at the moment.
- */
-public class StreamsDropwizardModule extends AbstractModule {
-
- @Override
- protected void configure() {
- requestStaticInjection(StreamsConfiguration.class);
- }
-
- @Provides
- @Singleton
- public StreamsConfiguration providesStreamsConfiguration() {
- return StreamsConfigurator.detectConfiguration();
- }
-
-}
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/main/jsonschema/org/apache/streams/dropwizard/GenericWebhookData.json
b/streams-runtimes/streams-runtime-dropwizard/src/main/jsonschema/org/apache/streams/dropwizard/GenericWebhookData.json
deleted file mode 100644
index adcafe259c..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/main/jsonschema/org/apache/streams/dropwizard/GenericWebhookData.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-03/schema",
- "$license": [
- "http://www.apache.org/licenses/LICENSE-2.0"
- ],
- "id": "#",
- "type": "object",
- "$schema": "http://json-schema.org/draft-03/schema",
- "javaType": "org.apache.streams.dropwizard.GenericWebhookData",
- "properties": {
- "id": {
- "type": "string"
- },
- "hash": {
- "type": "string"
- },
- "hash_type": {
- "type": "string"
- },
- "count": {
- "type": "long"
- },
- "delivered_at": {
- "type": "string",
- "format": "date-time"
- },
- "data": {
- "type": "array",
- "items": {
- "type": "object",
- "javaType": "com.fasterxml.jackson.databind.node.ObjectNode"
- }
- }
- }
-}
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/main/jsonschema/org/apache/streams/dropwizard/StreamsDropwizardConfiguration.json
b/streams-runtimes/streams-runtime-dropwizard/src/main/jsonschema/org/apache/streams/dropwizard/StreamsDropwizardConfiguration.json
deleted file mode 100644
index 59628ba199..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/main/jsonschema/org/apache/streams/dropwizard/StreamsDropwizardConfiguration.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-03/schema",
- "$license": [
- "http://www.apache.org/licenses/LICENSE-2.0"
- ],
- "id": "#",
- "type": "object",
- "javaType" :
"org.apache.streams.dropwizard.StreamsDropwizardConfiguration",
- "extends": {
- "javaType": "io.dropwizard.Configuration",
- "type": "object"
- }
-}
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/site/markdown/index.md
b/streams-runtimes/streams-runtime-dropwizard/src/site/markdown/index.md
deleted file mode 100644
index 1c8e13ebdc..0000000000
--- a/streams-runtimes/streams-runtime-dropwizard/src/site/markdown/index.md
+++ /dev/null
@@ -1,16 +0,0 @@
-streams-runtime-dropwizard
-==============
-
-streams-runtime-dropwizard can embed streams and stream components within the
dropwizard framework.
-
-## Data Types
-
-[GenericWebhookData.json](GenericWebhookData.json "GenericWebhookData.json")
-
-## Configuration
-
-[StreamsDropwizardConfiguration.json](StreamsDropwizardConfiguration.json
"StreamsDropwizardConfiguration.json")
-
-[JavaDocs](apidocs/index.html "JavaDocs")
-
-###### Licensed under Apache License 2.0 -
http://www.apache.org/licenses/LICENSE-2.0
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/test/java/org/apache/streams/dropwizard/test/GenericWebhookResourceTest.java
b/streams-runtimes/streams-runtime-dropwizard/src/test/java/org/apache/streams/dropwizard/test/GenericWebhookResourceTest.java
deleted file mode 100644
index fee77d4e21..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/test/java/org/apache/streams/dropwizard/test/GenericWebhookResourceTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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
- *
- * 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.streams.dropwizard.test;
-
-import org.apache.streams.dropwizard.GenericWebhookData;
-import org.apache.streams.dropwizard.GenericWebhookResource;
-import org.apache.streams.jackson.StreamsJacksonMapper;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import io.dropwizard.testing.junit.ResourceTestRule;
-import org.joda.time.DateTime;
-import org.junit.Assert;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Tests {@link: org.apache.streams.dropwizard.GenericWebhookResource}
- */
-@Ignore
-public class GenericWebhookResourceTest {
-
- private static ObjectMapper mapper = StreamsJacksonMapper.getInstance();
-
- private static final GenericWebhookResource genericWebhookResource = new
GenericWebhookResource();
-
- @ClassRule
- public static final ResourceTestRule resources = ResourceTestRule.builder()
- .addResource(genericWebhookResource)
- .build();
-
- @Test
- public void testPostJson() {
- Assert.assertEquals(400, genericWebhookResource.json(null,
"{").getStatus());
- Assert.assertEquals(400, genericWebhookResource.json(null,
"}").getStatus());
- Assert.assertEquals(400, genericWebhookResource.json(null,
"srg").getStatus());
- Assert.assertEquals(400, genericWebhookResource.json(null,
"123").getStatus());
- Assert.assertEquals(200, genericWebhookResource.json(null,
"{}").getStatus());
- Assert.assertEquals(200, genericWebhookResource.json(null,
"{\"valid\":\"true\"}").getStatus());
- }
-
- @Test
- public void testPostJsonNewLine() {
- Assert.assertEquals(200, genericWebhookResource.json_new_line(null,
"{}").getStatus());
- Assert.assertEquals(400, genericWebhookResource.json_new_line(null,
"notvalid").getStatus());
- Assert.assertEquals(200, genericWebhookResource.json_new_line(null,
"{\"valid\":\"true\"}").getStatus());
- Assert.assertEquals(200, genericWebhookResource.json_new_line(null,
"{\"valid\":\"true\"}\n{\"valid\":\"true\"}\r{\"valid\":\"true\"}").getStatus());
- }
-
- @Test
- public void testPostJsonMeta() throws JsonProcessingException {
- Assert.assertEquals(200, genericWebhookResource.json_meta(null,
"{}").getStatus());
- Assert.assertEquals(400, genericWebhookResource.json_meta(null,
"notvalid").getStatus());
- GenericWebhookData testPostJsonMeta = new GenericWebhookData()
- .withHash("test")
- .withDeliveredAt(DateTime.now())
- .withCount(1)
- .withHashType("type")
- .withId("test");
- List<ObjectNode> testPostJsonData = new ArrayList<>();
- testPostJsonData.add(mapper.createObjectNode().put("valid", "true"));
- testPostJsonMeta.setData(testPostJsonData);
- String testPostJsonEntity = mapper.writeValueAsString(testPostJsonMeta);
- Assert.assertEquals(200, genericWebhookResource.json_meta(null,
testPostJsonEntity).getStatus());
-
- }
-
-}
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/test/java/org/apache/streams/dropwizard/test/StreamsApplicationIT.java
b/streams-runtimes/streams-runtime-dropwizard/src/test/java/org/apache/streams/dropwizard/test/StreamsApplicationIT.java
deleted file mode 100644
index 743df02540..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/test/java/org/apache/streams/dropwizard/test/StreamsApplicationIT.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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
- *
- * 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.streams.dropwizard.test;
-
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * Tests {@link: org.apache.streams.dropwizard.StreamsApplication}
- */
-public class StreamsApplicationIT {
-
- @BeforeClass
- public void setupTest() throws Exception {
- String[] testArgs = Stream.of("server",
"src/test/resources/configuration.yml").collect(Collectors.toList()).toArray(new
String[2]);
- TestStreamsApplication.main(testArgs);
- }
-
- @Test
- public void testApplicationStarted() throws Exception {
-
- final URL url = new URL("http://localhost:8003/admin/ping");
- final String response = new BufferedReader(new
InputStreamReader(url.openStream())).readLine();
- Assert.assertEquals("pong", response);
- }
-}
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/test/java/org/apache/streams/dropwizard/test/TestStreamsApplication.java
b/streams-runtimes/streams-runtime-dropwizard/src/test/java/org/apache/streams/dropwizard/test/TestStreamsApplication.java
deleted file mode 100644
index 9c10b93f26..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/test/java/org/apache/streams/dropwizard/test/TestStreamsApplication.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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
- *
- * 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.streams.dropwizard.test;
-
-import org.apache.streams.dropwizard.StreamsApplication;
-
-/**
- * This class exists to support {@link:
org.apache.streams.dropwizard.test.StreamsApplicationIT}
- */
-public class TestStreamsApplication extends StreamsApplication {
-}
diff --git
a/streams-runtimes/streams-runtime-dropwizard/src/test/resources/configuration.yml
b/streams-runtimes/streams-runtime-dropwizard/src/test/resources/configuration.yml
deleted file mode 100644
index 6517565a24..0000000000
---
a/streams-runtimes/streams-runtime-dropwizard/src/test/resources/configuration.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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.
-
-template: Hello, %s!
-defaultName: streams
-
-server:
- type: simple
- applicationContextPath: /
- adminContextPath: /admin
- connector:
- type: http
- port: 8003
-
-logging:
- level: DEBUG
- appenders:
- - type: console
- threshold: ALL
- target: stdout
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Delete streams-runtime-dropwizard
> ---------------------------------
>
> Key: STREAMS-592
> URL: https://issues.apache.org/jira/browse/STREAMS-592
> Project: Streams
> Issue Type: Task
> Reporter: Steve Blackmon
> Assignee: Steve Blackmon
> Priority: Major
> Fix For: 0.6.0
>
>
> It's bringing in unwanted dependencies and isn't required by the project
> roadmap
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)