Skip to content

Modules

John Ament edited this page Jan 2, 2017 · 7 revisions

List of Modules

Hammock is designed around a modular system for bringing in dependencies. It ensures that you have the right stuff available when you need it, and doesn't bring in unnecessary components.

Core

Hammock core (ws.ament.hammock:hammock-core) is really just configuration. For now, it simply provides the configuration of CLI arguments for you if you need it.

Servlet Containers

There are two Servlet Containers available as of now, Undertow (ws.ament.hammock:web-undertow), Jetty (ws.ament.hammock:web-jetty) and Apache Tomcat (ws.ament.hammock:web-tomcat). There is also a ws.ament.hammock:web-spi which handles the actual integration of the web server into the runtime. You should only have one of these on your classpath.

JAX-RS Runtimes

JAX-RS runtimes depend on having a servlet container available. If none are on the path, they won't be loaded. There are three JAX-RS runtimes available, RestEasy (ws.ament.hammock:rest-resteasy), Jersey (ws.ament.hammock:rest-jersey) and CXF (ws.ament.hammock:rest-cxf). Each bring in the required transitive dependencies to operate.

Other Rest Runtimes

SparkJava

Spark Java support is provided under ws.ament.hammock:rest-spark. Outside of its core capabilities, Hammock adds injection support to your SparkApplication implementation, in addition to Weld's native capabilities around SessionScoped and RequestScoped beans. The Spark module has been tested to work against both Undertow and Jetty, but are all designed around its servlet integration, not native main methods.

Utilities

Security SPI

A very simple Security SPI is available as ws.ament.hammock:security-spi. Assuming you plugin in some basic identity information, it can do role checks, logged in checks for you. This is designed to be extended and used to access other frameworks, e.g. Shiro or Keycloak.

Microprofile Distribution

The Microprofile Distribution has its own page

Metrics

Support for metrics is based on Metrics CDI and automatically registers the Metrics Servlet via the AdminServlet. You can configure the URI by overriding the property metrics.uri, just make sure you include a /* in the end of the base.

Arquillian

Support for Arquillian is provided as a test dependency, ws.ament.hammock:test-arquillian. It expects that you export a JAR archive and will enrich it with additional dependencies from your classpath for your test code to run. In addition, a @ArquillianResource URI injection point is available, with the host and port of your running webserver during tests.

JPA Integration

JPA Integration has its own page

Flyway Integration

Along with JPA support, Flyway integration is provided by Hammock. A CDI bean will be installed when Flyway is found on the classpath and the JPA module is leveraged. On application startup (in the AfterBeanDiscovery phase), the life cycle methods defined by flyway.execute will be run against the flyway instance. By default, migrate is run. The methods are executed in the order defined by this configuration.

Flyway integration is purely based on configuration. Any flyway.* property discovered in your configuration will be applied to the Flyway object.

As of 1.1, Flyway integration is provided by the util-flyway module. This component provides an injection target for @Inject Flyway flyway

Apache ActiveMQ Artemis Integration

Hammock provides a custom configuration bean for Artemis' CDI client, allowing you to configure the client from any configuration source you have provided. The artifact is ws.ament.hammock:messaging-artemis. Click here for full details of Apache ActiveMQ Artemis' Support for CDI

RabbitMQ Integration

There's a page dedicated to RabbitMQ Integration