Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dropwizard module #2236

Merged
merged 30 commits into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f66f811
Initial commit: Dropwizard module
Nov 6, 2019
d9bcc5b
[WIP] examples/dropwizard
OneCricketeer Nov 6, 2019
99a7dcc
Cleanup dropwizard/README
OneCricketeer Nov 6, 2019
337bddf
Include dropwizard example in settings.gradle
OneCricketeer Nov 6, 2019
b19e3f1
dropwizard: passing checkStyle
OneCricketeer Nov 6, 2019
2613fcc
Correct dropwizard/README Maven targets
OneCricketeer Nov 6, 2019
fe01ef8
dropwizard: Remove license plugin
OneCricketeer Nov 6, 2019
2308a48
executable dropwizard example
OneCricketeer Nov 7, 2019
28c915d
dropwizard package-info javadoc
OneCricketeer Nov 7, 2019
25d7011
dropwizard yaml unit tests
OneCricketeer Nov 7, 2019
3dd3ecc
dropwizard sphinx docs
OneCricketeer Nov 7, 2019
f8baaf2
Refactoring for test coverage
OneCricketeer Nov 8, 2019
ea295fc
Guava Gradle patch
OneCricketeer Nov 8, 2019
2ba37b7
Javadoc typo
OneCricketeer Nov 8, 2019
448b7c1
move README sections to RST
OneCricketeer Nov 8, 2019
9cdea40
relocate dropwizard-example
OneCricketeer Nov 15, 2019
a0ae41c
review feedback
OneCricketeer Nov 15, 2019
0451f81
dropwizard docs
OneCricketeer Nov 15, 2019
3cb159b
dropwizard example tests
OneCricketeer Nov 15, 2019
792fa0d
review feedback
OneCricketeer Nov 15, 2019
66f50ae
builder-ify in the ServerFactory
OneCricketeer Nov 15, 2019
357f7e3
Fixes and clean-ups / Make ArmeriaConnector a ServerConnector
trustin Dec 11, 2019
5c40578
Checkstyle
trustin Dec 11, 2019
c4bee29
Move package. Increase coverage.
OneCricketeer Dec 15, 2019
c6fbe6c
Bump dropwizard 1.3.16 -> 1.3.17
OneCricketeer Dec 16, 2019
43a938d
Review comments
OneCricketeer Dec 16, 2019
c3e1b3b
Drop visibility on few classes
OneCricketeer Dec 17, 2019
09cfd34
Remove dropwizard-bom
OneCricketeer Dec 21, 2019
5aeb9e4
Fix tests
OneCricketeer Dec 23, 2019
788611c
Update README.md
trustin Dec 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,40 @@ com.squareup.retrofit2:
gradle.plugin.net.davidecavestro:
gradle-jxr-plugin: { version: '0.2.1' }

io.dropwizard:
dropwizard-core:
version: &DROPWIZARD_VERSION '1.3.17'
javadocs:
- https://static.javadoc.io/io.dropwizard/dropwizard-core/1.3.17/
dropwizard-jackson:
version: *DROPWIZARD_VERSION
javadocs:
- https://static.javadoc.io/io.dropwizard/dropwizard-jackson/1.3.17/
dropwizard-lifecycle:
version: *DROPWIZARD_VERSION
javadocs:
- https://static.javadoc.io/io.dropwizard/dropwizard-lifecycle/1.3.17/
dropwizard-jersey:
version: *DROPWIZARD_VERSION
javadocs:
- https://static.javadoc.io/io.dropwizard/dropwizard-jersey/1.3.17/
dropwizard-jetty:
version: *DROPWIZARD_VERSION
javadocs:
- https://static.javadoc.io/io.dropwizard/dropwizard-jetty/1.3.17/
dropwizard-testing:
version: *DROPWIZARD_VERSION
javadocs:
- https://static.javadoc.io/io.dropwizard/dropwizard-testing/1.3.17/
dropwizard-util:
version: *DROPWIZARD_VERSION
javadocs:
- https://static.javadoc.io/io.dropwizard/dropwizard-util/1.3.17/
dropwizard-validation:
version: *DROPWIZARD_VERSION
javadocs:
- https://static.javadoc.io/io.dropwizard/dropwizard-validation/1.3.17/

io.dropwizard.metrics:
metrics-core:
javadocs:
Expand Down
33 changes: 33 additions & 0 deletions dropwizard/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:${managedVersions['com.github.jengelman.gradle.plugins:shadow']}"
}
}

dependencies {
compile project(':jetty')
trustin marked this conversation as resolved.
Show resolved Hide resolved
// Dropwizard
['core', 'util', 'lifecycle', 'jackson', 'validation', 'jetty', 'jersey'].each {
compile "io.dropwizard:dropwizard-$it"
}
// Dropwizard Metrics
compile 'io.dropwizard.metrics:metrics-core'

testCompile 'io.dropwizard:dropwizard-testing'
}

// Do not relocate Guava because it's part of Dropwizard's public API.
[tasks.shadedJar, tasks.shadedTestJar].each { task ->
task.relocators.clear()
project.ext.relocations.each { Map<String, String> props ->
def from = props['from']
def to = props['to']
if (from in ['com.google.common', 'com.google.thirdparty.publicsuffix']) {
return
}
task.relocate from, to
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2019 LINE Corporation
*
* LINE Corporation 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:
*
* https://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 com.linecorp.armeria.dropwizard;

import com.linecorp.armeria.server.Server;
import com.linecorp.armeria.server.ServerBuilder;

import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;

/**
* A Dropwizard {@link ConfiguredBundle} that routes requests through an
* Armeria {@link Server} rather than the default Jetty server.
*
* @param <C> The Dropwizard {@link Configuration} type.
*/
public abstract class ArmeriaBundle<C extends Configuration>
implements ConfiguredBundle<C>, ArmeriaServerConfigurator {

@Override
public void initialize(Bootstrap<?> bootstrap) {
}

@Override
public void run(C configuration, Environment environment) throws Exception {
final ManagedArmeriaServer<C> managedArmeriaServer = new ManagedArmeriaServer<>(configuration, this);
environment.lifecycle().manage(managedArmeriaServer);
}

@Override
public abstract void configure(ServerBuilder builder);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2019 LINE Corporation
*
* LINE Corporation 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:
*
* https://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 com.linecorp.armeria.dropwizard;

import com.linecorp.armeria.server.ServerBuilder;

/**
* Interface used to configure a service on the default armeria server. Can be
* used to register arbitrary services.
*/
@FunctionalInterface
interface ArmeriaServerConfigurator {
/**
* Configures the server using the specified {@link ServerBuilder}.
*/
void configure(ServerBuilder builder);
}
Loading