Skip to content

Commit

Permalink
Grammar cleanup based on IntelliJ analysis (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
sleberknight authored Jul 5, 2024
1 parent f28328f commit 4145522
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 29 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Features
--------
* Uses [Apache CXF](https://cxf.apache.org/) web services framework (no Spring Framework dependency).
* Java-first and WSDL-first service development.
* Use standard Jakarta XML Web Services annotations, without custom deployment descriptors.
* Use standard Jakarta XML Web Services annotations without custom deployment descriptors.
* [Metrics](https://metrics.dropwizard.io/) instrumentation: @Metered, @Timed and @ExceptionMetered annotations.
* Dropwizard validation support.
* Dropwizard Hibernate support (@UnitOfWork).
Expand All @@ -38,21 +38,26 @@ Background
This library was imported from [roskart/dropwizard-jaxws](https://github.com/roskart/dropwizard-jaxws), which
as of November 2023 seems to be no longer maintained by the original creator.

Since we are still using this library in our services which use Dropwizard and Jakarta XML Web Services, we decided to import the original repository and continue maintaining it for our own use, and anyone else who might want to use it. _We make no guarantees whatsoever about how long we will maintain it, and also plan to make our own changes such as changing the base package name to org.kiwiproject to be consistent with our other libraries._
Since we are still using this library in our REST web services that use Dropwizard and Jakarta XML Web Services,
we decided to import the original repository and continue maintaining it for our own use.
And of course, anyone else who might want to use it.

_We make no guarantees whatsoever about how long we will maintain it, and also plan to make
our own changes such as changing the base package name to org.kiwiproject to be consistent with our other libraries._

All other [kiwiproject](https://github.com/kiwiproject/) projects are MIT-licensed. However, because the original
`dropwizard-jaxws` uses the Apache 2.0 license, we are keeping the Apache 2.0 license (otherwise to switch to MIT we
would have to gain consent of all contributors, which we do not want to do and probably can't since the original
would have to gain consent of all contributors, which we do not want to do. And, we probably can't since the original
author has not been active since October 2022).

Another thing to note is that we _imported_ this repository from the original, so that it is a "disconnected fork". We
Another thing to note is that we _imported_ this repository from the original, so that it is a "disconnected fork." We
did not want a reference to the original repository since it seems no longer maintained and so no changes here will ever
be pushed back upstream. Thus, while we maintain the history that this is a fork , it is completely disconnected and is
be pushed back upstream. Thus, while we maintain the history that this is a fork, it is completely disconnected and is
now a standalone (normal) repository.

Migrating from roskart/dropwizard-jaxws
---------------------------------------
There are two things you need to do in order to migrate. First, change the Maven coordinates so that the
There are two things you need to do to migrate. First, change the Maven coordinates so that the
groupId is org.kiwiproject, the artifactId is dropwizard-jakarta-xml-ws, and choose the latest version.

Second, when we imported this repository, we updated it from the Dropwizard 2.x and JAX-WS to Dropwizard 4.x
Expand All @@ -63,8 +68,9 @@ to [Jakarta XML Web Services](https://mvnrepository.com/artifact/jakarta.xml).
For the initial [0.5.0](https://github.com/kiwiproject/dropwizard-jakarta-xml-ws/releases/tag/v0.5.0) version, we will
retain the original package names (`com.roskart.dropwizard.jaxws`).

Release [0.6.0](https://github.com/kiwiproject/dropwizard-jakarta-xml-ws/releases/tag/v0.6.0) will remove deprecated code, i.e. the deprecated methods in `JAXWSBundle`. It will also
rename the modules so that they are consistent, i.e. rename `dropwizard-jaxws` to `dropwizard-jakarta-xml-ws`.
Release [0.6.0](https://github.com/kiwiproject/dropwizard-jakarta-xml-ws/releases/tag/v0.6.0) will remove
deprecated code, i.e., the deprecated methods in `JAXWSBundle`. It will also
rename the modules so that they are consistent, i.e., rename `dropwizard-jaxws` to `dropwizard-jakarta-xml-ws`.
Finally, 0.6.0 *comments out* the Maven Shade plugin in the POM of `dropwizard-jakarta-xml-ws-example` so
that the JAR deployed to Maven Central is small (a few KB instead of the 40+ MB uber-jar).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void run(JakartaXmlWsExampleConfiguration configuration, Environment envi
endpoint = anotherJwsBundle.publishEndpoint(
new EndpointBuilder("/simple", new SimpleService()));

// Java first service protected with basic authentication
// Java-first service protected with basic authentication
endpoint = jwsBundle.publishEndpoint(
new EndpointBuilder("/javafirst", new JavaFirstServiceImpl())
.authentication(new BasicAuthentication(new BasicAuthenticator(), "TOP_SECRET")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Method getTargetMethod(Exchange exchange) {

/**
* Rethrows exception, without requiring to handle checked exception.
* Type-erasure happens at compile time, therefore if E is RuntimeException,
* Type-erasure happens at compile time, therefore, if E is RuntimeException,
* checked exception can be re-thrown without declaring them.
*/
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import java.util.Optional;

/**
* A CXF interceptor that manages HTTP Basic Authentication. Implementation is based on combination of
* A CXF interceptor that manages HTTP Basic Authentication. Implementation is based on the combination of
* CXF JAASLoginInterceptor code and the following GitHub Gist:
* <a href="https://gist.github.com/palesz/3438143">Basic HTTP Authentication Interceptor for Apache CXF</a>.
* <p>
* Dropwizard authenticator is used for credentials authentication. Authenticated principal is stored in message
* Dropwizard authenticator is used for credential authentication. Authenticated principal is stored in message
* exchange and is available in the service implementation through a Jakarta XML Web Services
* {@link jakarta.xml.ws.WebServiceContext WebServiceContext}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public String getBindingId() {
}

/**
* Create new ClientBuilder. Endpoint will be published relative to the CXF servlet path.
* Create a new ClientBuilder. Endpoint will be published relative to the CXF servlet path.
*
* @param serviceClass Service interface class.
* @param address Endpoint URL address..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public EndpointBuilder(String path, Object service) {

/**
* Publish Jakarta XML Web Services endpoint with Dropwizard Hibernate Bundle integration.
* Service will be scanned for @UnitOfWork annotations.
* The service will be scanned for @UnitOfWork annotations.
*
* @param sessionFactory Hibernate session factory.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.List;

/**
* Provides factory method for creating instrumented CXF invoker chain.
* Provides factory methods for creating an instrumented CXF invoker chain.
*
* @see InstrumentedInvokers
* @see com.codahale.metrics.jersey3.InstrumentedResourceMethodApplicationListener
Expand Down Expand Up @@ -84,7 +84,7 @@ private Invoker exceptionMetered(Invoker invoker, List<Method> meteredMethods) {
/**
* Based on the private chooseName method in
* com.codahale.metrics.jerseyX.InstrumentedResourceMethodApplicationListener,
* where X is Jersey version such as 2, 3, 31 (for 3.1), etc.
* where X is a Jersey version such as 2, 3, 31 (for 3.1), etc.
*
* @see com.codahale.metrics.jersey3.InstrumentedResourceMethodApplicationListener
*/
Expand All @@ -111,7 +111,7 @@ public InstrumentedInvokerFactory(MetricRegistry metricRegistry) {


/**
* Factory method for creating instrumented invoker chain.
* Factory method for creating an instrumented invoker chain.
*/
public Invoker create(Object service, Invoker rootInvoker) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public JakartaXmlWsEnvironment(String defaultPath) {

System.setProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Slf4jLogger");
/*
Instruct CXF to use CXFBusFactory instead of SpringBusFactory. CXFBusFactory provides ExtensionManagerBus
which loads extension based on contents of META-INF/cxf/bus-extensions.txt file. Many CXF modules contain
such file. When building shaded jar for dropwizard service, these files have to be merged into single
Instruct CXF to use CXFBusFactory instead of SpringBusFactory. CXFBusFactory provides ExtensionManagerBus,
which loads an extension based on the contents of the META-INF/cxf/bus-extensions.txt file. Many CXF modules
contain this file. When building shaded jar for dropwizard service, these files have to be merged into single
bus-extension.txt file by using AppendingTransformer with Maven shade plugin.
*/
System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, "org.apache.cxf.bus.CXFBusFactory");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public Object invoke(Exchange exchange, Object o) {
// get annotations declared on parameters
Annotation[][] parameterAnnotations = this.getTargetMethod(exchange).getParameterAnnotations();

/* Get actual parameter list start (code copied from org.apache.cxf.service.invoker.AbstractInvoker.invoke) */
/* Begin: Get the actual parameter list (code copied from org.apache.cxf.service.invoker.AbstractInvoker.invoke) */
List<Object> params = null;
if (o instanceof List) {
params = CastUtils.cast((List<?>) o);
} else if (nonNull(o)) {
params = new MessageContentsList(o);
}
/* Get actual parameter list end */
/* End: Get the actual parameter list */

// validate each parameter in the list
if (nonNull(params)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String exceptionMetered(boolean doThrow) {
MetricRegistry mockMetricRegistry;
InstrumentedInvokerFactory invokerBuilder;
InstrumentedService instrumentedService;
// CXF Exchange contains message exchange and is used by Invoker to obtain invoked method name
// CXF Exchange contains message exchange and is used by Invoker to get invoked method name
Exchange exchange;

/* Invokers that invoke test service implementation */
Expand Down Expand Up @@ -94,8 +94,9 @@ public Object invoke(Exchange exchange, Object o) {
}

/**
* Utility method that mimics runtime CXF behaviour. Enables AbstractInvoker.getTargetMethod to work properly
* during the test.
* Utility method that mimics runtime CXF behavior.
* <p>
* Enables AbstractInvoker.getTargetMethod to work properly during the test.
*/
private void setTargetMethod(Exchange exchange, String methodName, Class<?>... parameterTypes) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ protected String getPublishedEndpointUrlPrefix(Configuration configuration) {
verify(jwsEnvironment).setPublishedEndpointUrlPrefix("http://some/prefix");
}

@SuppressWarnings("resource")
@Test
void publishEndpoint() {
var jwsBundle = new JakartaXmlWsBundle<>("/soap", jwsEnvironment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Object invoke(Exchange exchange, Object o) {
Session session;
Transaction transaction;

// CXF Exchange contains message exchange and is used by Invoker to obtain invoked method name
// CXF Exchange contains message exchange and is used by Invoker to get invoked method name
Exchange exchange;

@BeforeEach
Expand All @@ -102,7 +102,7 @@ void setUp() {
}

/**
* Utility method that mimics runtime CXF behaviour. Enables AbstractInvoker.getTargetMethod to work properly
* Utility method that mimics runtime CXF behavior. Enables AbstractInvoker.getTargetMethod to work properly
* during the test.
*/
private void setTargetMethod(Exchange exchange, Class<?> serviceClass, String methodName, Class<?>... parameterTypes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void setup() {
}

/**
* Utility method that mimics runtime CXF behaviour. Enables AbstractInvoker.getTargetMethod to work properly
* Utility method that mimics runtime CXF behavior. Enables AbstractInvoker.getTargetMethod to work properly
* during the test.
*/
private void setTargetMethod(Exchange exchange, String methodName, Class<?>... parameterTypes) {
Expand Down

0 comments on commit 4145522

Please sign in to comment.