From c163f8755c4dc931de78a1c47d15930f815fb411 Mon Sep 17 00:00:00 2001 From: rmoquin <> Date: Fri, 9 Nov 2012 15:20:24 -0500 Subject: [PATCH] Adapted dropwizard spring and it's example to use xbean for a more compact domain language like spring configuration --- .gitignore | 20 +- example/pom.xml | 370 ++++++++++-------- .../dropwizard/spring/HelloResource.java | 65 +-- .../src/main/resources/dropwizard-service.xml | 33 +- pom.xml | 306 ++++++++------- .../dropwizard/spring/Dropwizard.java | 63 +-- .../dropwizardSpringApplicationContext.xml | 23 +- 7 files changed, 460 insertions(+), 420 deletions(-) diff --git a/.gitignore b/.gitignore index 2a1a8aa..10476cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ -*.class - -# Package Files # -*.jar -*.war -*.ear - -.classpath -.project -.settings/ +*.class +nb-configuration.xml +# Package Files # +*.jar +*.war +*.ear + +.classpath +.project +.settings/ target/ \ No newline at end of file diff --git a/example/pom.xml b/example/pom.xml index ce3ec6a..95b3783 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -1,174 +1,196 @@ - - - - 4.0.0 - - 3.0.0 - - - com.hmsonline - dropwizard-spring-example - 0.1.0-SNAPSHOT - jar - - Dropwizard-Spring Example - - - UTF-8 - UTF-8 - 0.4.3 - 3.1.1.RELEASE - com.hmsonline.dropwizard.spring.SpringService - - - - - com.hmsonline - dropwizard-spring - ${project.version} - - - com.yammer.dropwizard - dropwizard-core - ${dropwizard.version} - - - org.springframework - spring-context - ${spring.version} - - - junit - junit - 4.10 - test - - - - - - - maven-shade-plugin - 1.7 - - true - - - ${mainClass} - - - - META-INF/spring.handlers - - - META-INF/spring.schemas - - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - package - - shade - - - - - - maven-jar-plugin - 2.4 - - - - true - ${mainClass} - - - - - - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - maven-source-plugin - 2.1.2 - - - attach-sources - - jar - - - - - - maven-javadoc-plugin - 2.8.1 - - - attach-javadocs - - jar - - - - - - maven-deploy-plugin - 2.7 - - - org.apache.maven.wagon - wagon-ssh - 2.2 - - - - - maven-site-plugin - 3.0 - - - - maven-project-info-reports-plugin - 2.4 - - false - false - - - - maven-javadoc-plugin - 2.8.1 - - - - - - - - - + + + + 4.0.0 + + 3.0.0 + + + com.hmsonline + dropwizard-spring-example + 0.1.0-SNAPSHOT + jar + + Dropwizard-Spring Example + + + UTF-8 + UTF-8 + 0.4.3 + 3.1.1.RELEASE + 3.12 + com.hmsonline.dropwizard.spring.SpringService + + + + + com.hmsonline + dropwizard-spring + ${project.version} + + + com.yammer.dropwizard + dropwizard-core + ${dropwizard.version} + + + org.springframework + spring-context + ${spring.version} + + + org.apache.xbean + xbean-spring + ${xbean.version} + + + junit + junit + 4.10 + test + + + + + + + org.apache.xbean + maven-xbean-plugin + ${xbean.version} + + + + false + http://hmsonline.com/schema/example-dropwizard + + + mapping + + + + + + maven-shade-plugin + 1.7 + + true + + + ${mainClass} + + + + META-INF/spring.handlers + + + META-INF/spring.schemas + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + package + + shade + + + + + + maven-jar-plugin + 2.4 + + + + true + ${mainClass} + + + + + + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + maven-source-plugin + 2.1.2 + + + attach-sources + + jar-no-fork + + + + + + maven-javadoc-plugin + 2.8.1 + + + attach-javadocs + + jar + + + + + + maven-deploy-plugin + 2.7 + + + org.apache.maven.wagon + wagon-ssh + 2.2 + + + + + maven-site-plugin + 3.0 + + + + maven-project-info-reports-plugin + 2.4 + + false + false + + + + maven-javadoc-plugin + 2.8.1 + + + + + + + + + diff --git a/example/src/main/java/com/hmsonline/dropwizard/spring/HelloResource.java b/example/src/main/java/com/hmsonline/dropwizard/spring/HelloResource.java index 2d0ea07..c45594e 100644 --- a/example/src/main/java/com/hmsonline/dropwizard/spring/HelloResource.java +++ b/example/src/main/java/com/hmsonline/dropwizard/spring/HelloResource.java @@ -1,31 +1,34 @@ -// Copyright (c) 2012 Health Market Science, Inc. - -package com.hmsonline.dropwizard.spring; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -@Path("/hello") -public class HelloResource { - - private Object message; - - @GET - @Path("/world") - @Produces(MediaType.APPLICATION_JSON) - public Object hello(){ - return this.message; - } - - public Object getMessage() { - return message; - } - - public void setMessage(Object message) { - this.message = message; - } - - -} +// Copyright (c) 2012 Health Market Science, Inc. + +package com.hmsonline.dropwizard.spring; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +/** + * @org.apache.xbean.XBean element="hello" + */ +@Path("/hello") +public class HelloResource { + + private Object message; + + @GET + @Path("/world") + @Produces(MediaType.APPLICATION_JSON) + public Object hello(){ + return this.message; + } + + public Object getMessage() { + return message; + } + + public void setMessage(Object message) { + this.message = message; + } + + +} diff --git a/example/src/main/resources/dropwizard-service.xml b/example/src/main/resources/dropwizard-service.xml index c70d7fe..7ab981b 100644 --- a/example/src/main/resources/dropwizard-service.xml +++ b/example/src/main/resources/dropwizard-service.xml @@ -1,20 +1,15 @@ - - - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1562753..a012ee3 100644 --- a/pom.xml +++ b/pom.xml @@ -1,142 +1,164 @@ - - - 4.0.0 - - com.hmsonline - dropwizard-spring - 0.1.2-SNAPSHOT - jar - Spring Integration for DropWizard - https://github.com/hmsonline/dropwizard-spring - - Dropwizard-spring - - - org.sonatype.oss - oss-parent - 7 - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - UTF-8 - UTF-8 - 0.4.3 - 3.1.1.RELEASE - - - - - scm:git:git@github.com:hmsonline/dropwizard-spring.git - scm:git:git@github.com:hmsonline/dropwizard-spring.git - git@github.com:hmsonline/dropwizard-spring.git - - - - - boneill42 - Brian O'Neill - bone@alumni.brown.edu - - - - - - com.yammer.dropwizard - dropwizard-core - ${dropwizard.version} - - - org.springframework - spring-context - ${spring.version} - - - junit - junit - 4.10 - test - - - - - - - maven-jar-plugin - 2.4 - - - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - maven-source-plugin - 2.1.2 - - - attach-sources - - jar - - - - - - maven-javadoc-plugin - 2.8.1 - - - attach-javadocs - - jar - - - - - - maven-deploy-plugin - 2.7 - - - org.apache.maven.wagon - wagon-ssh - 2.2 - - - - - maven-site-plugin - 3.0 - - - - maven-project-info-reports-plugin - 2.4 - - false - false - - - - maven-javadoc-plugin - 2.8.1 - - - - - - - - - + + + 4.0.0 + + com.hmsonline + dropwizard-spring + 0.1.2-SNAPSHOT + jar + Spring Integration for DropWizard + https://github.com/hmsonline/dropwizard-spring + + Dropwizard-spring + + + org.sonatype.oss + oss-parent + 7 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + UTF-8 + UTF-8 + 0.4.3 + 3.1.1.RELEASE + 3.12 + + + + + scm:git:git@github.com:hmsonline/dropwizard-spring.git + scm:git:git@github.com:hmsonline/dropwizard-spring.git + git@github.com:hmsonline/dropwizard-spring.git + + + + + boneill42 + Brian O'Neill + bone@alumni.brown.edu + + + + + + com.yammer.dropwizard + dropwizard-core + ${dropwizard.version} + + + org.springframework + spring-context + ${spring.version} + + + org.apache.xbean + xbean-spring + ${xbean.version} + + + junit + junit + 4.10 + test + + + + + + + org.apache.xbean + maven-xbean-plugin + ${xbean.version} + + + + false + http://hmsonline.com/schema/dropwizard + + + mapping + + + + + + maven-jar-plugin + 2.4 + + + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + maven-source-plugin + 2.1.2 + + + attach-sources + + jar-no-fork + + + + + + maven-javadoc-plugin + 2.8.1 + + + attach-javadocs + + jar + + + + + + maven-deploy-plugin + 2.7 + + + org.apache.maven.wagon + wagon-ssh + 2.2 + + + + + maven-site-plugin + 3.0 + + + + maven-project-info-reports-plugin + 2.4 + + false + false + + + + maven-javadoc-plugin + 2.8.1 + + + + + + + + + diff --git a/src/main/java/com/hmsonline/dropwizard/spring/Dropwizard.java b/src/main/java/com/hmsonline/dropwizard/spring/Dropwizard.java index d2cf024..6a1ac66 100644 --- a/src/main/java/com/hmsonline/dropwizard/spring/Dropwizard.java +++ b/src/main/java/com/hmsonline/dropwizard/spring/Dropwizard.java @@ -1,30 +1,33 @@ -// Copyright (c) 2012 Health Market Science, Inc. - -package com.hmsonline.dropwizard.spring; - -import com.yammer.dropwizard.config.Configuration; -import com.yammer.dropwizard.config.Environment; - -public class Dropwizard { - - private Configuration configuration; - - private Environment environment; - - public Configuration getConfiguration() { - return configuration; - } - - public void setConfiguration(Configuration configuration) { - this.configuration = configuration; - } - - public Environment getEnvironment() { - return environment; - } - - public void setEnvironment(Environment environment) { - this.environment = environment; - } - -} +// Copyright (c) 2012 Health Market Science, Inc. + +package com.hmsonline.dropwizard.spring; + +import com.yammer.dropwizard.config.Configuration; +import com.yammer.dropwizard.config.Environment; + +/** + * @org.apache.xbean.XBean rootElement="true" + */ +public class Dropwizard { + + private Configuration configuration; + + private Environment environment; + + public Configuration getConfiguration() { + return configuration; + } + + public void setConfiguration(Configuration configuration) { + this.configuration = configuration; + } + + public Environment getEnvironment() { + return environment; + } + + public void setEnvironment(Environment environment) { + this.environment = environment; + } + +} diff --git a/src/main/resources/dropwizardSpringApplicationContext.xml b/src/main/resources/dropwizardSpringApplicationContext.xml index c1c5b86..6494abe 100644 --- a/src/main/resources/dropwizardSpringApplicationContext.xml +++ b/src/main/resources/dropwizardSpringApplicationContext.xml @@ -1,15 +1,10 @@ - - - - - + + + + + \ No newline at end of file