From 23362b3f182575ca73f89b50bcc23db8a07e1fde Mon Sep 17 00:00:00 2001 From: Scott Leberknight <174812+sleberknight@users.noreply.github.com> Date: Sun, 12 Nov 2023 17:08:11 -0500 Subject: [PATCH] Rename application and configuration classes in example (#80) * Rename JaxWsExampleApplication to JakartaXmlWsExampleApplication * Rename JaxWsExampleApplicationConfiguration to JakartaXmlWsExampleConfiguration * Rename the JAXWSBundle fields in JakartaXmlWsExampleApplication to have the "jws" prefix instead of "jaxWs" * Update the example in the README to use a field name of jwsBundle instead of jaxWsBundle Closes #79 --- README.md | 8 ++-- dropwizard-jakarta-xml-ws-example/pom.xml | 2 +- ...va => JakartaXmlWsExampleApplication.java} | 42 +++++++++---------- ... => JakartaXmlWsExampleConfiguration.java} | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) rename dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/{JaxWsExampleApplication.java => JakartaXmlWsExampleApplication.java} (82%) rename dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/{JaxWsExampleApplicationConfiguration.java => JakartaXmlWsExampleConfiguration.java} (86%) diff --git a/README.md b/README.md index 055d444..20fb1dc 100644 --- a/README.md +++ b/README.md @@ -110,16 +110,16 @@ public HelloWorldSOAP { ```java public class MyApplication extends Application { - private JAXWSBundle jaxWsBundle = new JAXWSBundle(); + private JAXWSBundle jswBundle = new JAXWSBundle(); @Override public void initialize(Bootstrap bootstrap) { - bootstrap.addBundle(jaxWsBundle); + bootstrap.addBundle(jswBundle); } @Override public void run(MyApplicationConfiguration configuration, Environment environment) throws Exception { - jaxWsBundle.publishEndpoint( + jswBundle.publishEndpoint( new EndpointBuilder("/hello", new HelloWorldSOAP())); } @@ -135,7 +135,7 @@ Client Using HelloWorldSOAP web service client: ```java -HelloWorldSOAP helloWorld = jaxWsBundle.getClient( +HelloWorldSOAP helloWorld=jwsBundle.getClient( new ClientBuilder(HelloWorldSOAP.class, "http://server/path")); System.out.println(helloWorld.sayHello()); ``` diff --git a/dropwizard-jakarta-xml-ws-example/pom.xml b/dropwizard-jakarta-xml-ws-example/pom.xml index 23c16fa..1956a08 100644 --- a/dropwizard-jakarta-xml-ws-example/pom.xml +++ b/dropwizard-jakarta-xml-ws-example/pom.xml @@ -130,7 +130,7 @@ - org.kiwiproject.dropwizard.jakarta.xml.ws.example.JaxWsExampleApplication + org.kiwiproject.dropwizard.jakarta.xml.ws.example.JakartaXmlWsExampleApplication META-INF/cxf/bus-extensions.txt diff --git a/dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JaxWsExampleApplication.java b/dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JakartaXmlWsExampleApplication.java similarity index 82% rename from dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JaxWsExampleApplication.java rename to dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JakartaXmlWsExampleApplication.java index 34c5c4e..86691f5 100644 --- a/dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JaxWsExampleApplication.java +++ b/dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JakartaXmlWsExampleApplication.java @@ -30,85 +30,85 @@ import ws.example.ws.xml.jakarta.dropwizard.kiwiproject.org.mtomservice.MtomService; import ws.example.ws.xml.jakarta.dropwizard.kiwiproject.org.wsdlfirstservice.WsdlFirstService; -public class JaxWsExampleApplication extends Application { +public class JakartaXmlWsExampleApplication extends Application { - private static final Logger LOG = LoggerFactory.getLogger(JaxWsExampleApplication.class); + private static final Logger LOG = LoggerFactory.getLogger(JakartaXmlWsExampleApplication.class); // HibernateBundle is used by HibernateExampleService - private final HibernateBundle hibernate = new HibernateBundle<>(Person.class) { + private final HibernateBundle hibernate = new HibernateBundle<>(Person.class) { @Override - public DataSourceFactory getDataSourceFactory(JaxWsExampleApplicationConfiguration configuration) { + public DataSourceFactory getDataSourceFactory(JakartaXmlWsExampleConfiguration configuration) { return configuration.getDatabaseConfiguration(); } }; // Jakarta XML Web Services Bundle - private final JAXWSBundle jaxWsBundle = new JAXWSBundle<>(); - private final JAXWSBundle anotherJaxWsBundle = new JAXWSBundle<>("/api2"); + private final JAXWSBundle jwsBundle = new JAXWSBundle<>(); + private final JAXWSBundle anotherJwsBundle = new JAXWSBundle<>("/api2"); public static void main(String[] args) throws Exception { - new JaxWsExampleApplication().run(args); + new JakartaXmlWsExampleApplication().run(args); } @Override - public void initialize(Bootstrap bootstrap) { + public void initialize(Bootstrap bootstrap) { bootstrap.addBundle(hibernate); - bootstrap.addBundle(jaxWsBundle); - bootstrap.addBundle(anotherJaxWsBundle); + bootstrap.addBundle(jwsBundle); + bootstrap.addBundle(anotherJwsBundle); } @SuppressWarnings({ "UnusedAssignment", "java:S1854", "java:S125" }) @Override - public void run(JaxWsExampleApplicationConfiguration jaxWsExampleApplicationConfiguration, Environment environment) { + public void run(JakartaXmlWsExampleConfiguration configuration, Environment environment) { // Hello world service @SuppressWarnings("unused") - EndpointImpl e = jaxWsBundle.publishEndpoint( + EndpointImpl e = jwsBundle.publishEndpoint( new EndpointBuilder("/simple", new SimpleService())); // publishEndpoint returns javax.xml.ws.Endpoint to enable further customization. // e.getProperties().put(...); // Publish Hello world service again using different JAXWSBundle instance - e = anotherJaxWsBundle.publishEndpoint( + e = anotherJwsBundle.publishEndpoint( new EndpointBuilder("/simple", new SimpleService())); // Java first service protected with basic authentication - e = jaxWsBundle.publishEndpoint( + e = jwsBundle.publishEndpoint( new EndpointBuilder("/javafirst", new JavaFirstServiceImpl()) .authentication(new BasicAuthentication(new BasicAuthenticator(), "TOP_SECRET"))); // WSDL first service using server side Jakarta XML Web Services handler and CXF logging interceptors. // The server handler is defined in the wsdlfirstservice-handlerchain.xml file, via the // HandlerChain annotation on WsdlFirstServiceImpl - e = jaxWsBundle.publishEndpoint( + e = jwsBundle.publishEndpoint( new EndpointBuilder("/wsdlfirst", new WsdlFirstServiceImpl()) .cxfInInterceptors(new LoggingInInterceptor()) .cxfOutInterceptors(new LoggingOutInterceptor())); // Service using Hibernate PersonDAO personDAO = new PersonDAO(hibernate.getSessionFactory()); - e = jaxWsBundle.publishEndpoint( + e = jwsBundle.publishEndpoint( new EndpointBuilder("/hibernate", new HibernateExampleService(personDAO)) .sessionFactory(hibernate.getSessionFactory())); // Publish the same service again using different JAXWSBundle instance - e = anotherJaxWsBundle.publishEndpoint( + e = anotherJwsBundle.publishEndpoint( new EndpointBuilder("/hibernate", new HibernateExampleService(personDAO)) .sessionFactory(hibernate.getSessionFactory())); // WSDL first service using MTOM. Invoking enableMTOM on EndpointBuilder is not necessary // if you use @MTOM Jakarta XML Web Services annotation on your service implementation class. - e = jaxWsBundle.publishEndpoint( + e = jwsBundle.publishEndpoint( new EndpointBuilder("/mtom", new MtomServiceImpl()) .enableMtom() ); // A RESTful resource that invokes WsdlFirstService on localhost and uses client side Jakarta XML Web Services handler. environment.jersey().register(new AccessWsdlFirstServiceResource( - jaxWsBundle.getClient( + jwsBundle.getClient( new ClientBuilder<>( WsdlFirstService.class, "http://localhost:8080/soap/wsdlfirst") @@ -116,7 +116,7 @@ public void run(JaxWsExampleApplicationConfiguration jaxWsExampleApplicationConf // A RESTful resource that invokes MtomService on localhost environment.jersey().register(new AccessMtomServiceResource( - jaxWsBundle.getClient( + jwsBundle.getClient( new ClientBuilder<>( MtomService.class, "http://localhost:8080/soap/mtom") @@ -125,7 +125,7 @@ public void run(JaxWsExampleApplicationConfiguration jaxWsExampleApplicationConf // A RESTful resource that invokes JavaFirstService on localhost and uses basic authentication and // client side CXF interceptors. environment.jersey().register(new AccessProtectedServiceResource( - jaxWsBundle.getClient( + jwsBundle.getClient( new ClientBuilder<>( JavaFirstService.class, "http://localhost:8080/soap/javafirst") diff --git a/dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JaxWsExampleApplicationConfiguration.java b/dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JakartaXmlWsExampleConfiguration.java similarity index 86% rename from dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JaxWsExampleApplicationConfiguration.java rename to dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JakartaXmlWsExampleConfiguration.java index 333d658..260415c 100644 --- a/dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JaxWsExampleApplicationConfiguration.java +++ b/dropwizard-jakarta-xml-ws-example/src/main/java/org/kiwiproject/dropwizard/jakarta/xml/ws/example/JakartaXmlWsExampleConfiguration.java @@ -6,7 +6,7 @@ import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; -public class JaxWsExampleApplicationConfiguration extends Configuration { +public class JakartaXmlWsExampleConfiguration extends Configuration { @Valid @NotNull