MEECROWAVE-210 removing jolokia module
diff --git a/meecrowave-doc/src/main/jbake/content/components.adoc b/meecrowave-doc/src/main/jbake/content/components.adoc
index 87811f2..b453bf5 100755
--- a/meecrowave-doc/src/main/jbake/content/components.adoc
+++ b/meecrowave-doc/src/main/jbake/content/components.adoc
@@ -46,9 +46,8 @@
== Meecrowave and Monitoring
-Meecrowave provides few integration for the monitoring:
-
-link:{context_rootpath}/meecrowave-jolokia/index.html[Jolokia (JMX)]
+For monitoring, link:https://microprofile.io/[Microprofile] can be a neat companion of Apache Meecrowave.
+You can have a look to link:http://geronimo.apache.org/microprofile/[Geronimo] implementation.
== Meecrowave and JTA
diff --git a/meecrowave-doc/src/main/jbake/content/meecrowave-jolokia/index.adoc b/meecrowave-doc/src/main/jbake/content/meecrowave-jolokia/index.adoc
deleted file mode 100644
index 5bb908c..0000000
--- a/meecrowave-doc/src/main/jbake/content/meecrowave-jolokia/index.adoc
+++ /dev/null
@@ -1,107 +0,0 @@
-= Meecrowave Jolokia
-:jbake-date: 2016-12-04
-:jbake-type: page
-:jbake-status: published
-:jbake-meecrowavepdf:
-:jbake-meecrowavetitleicon: icon icon_puzzle_alt
-:jbake-meecrowavecolor: body-red
-:icons: font
-
-Coordinates:
-
-[source,xml]
-----
-<dependency>
- <groupId>org.apache.meecrowave</groupId>
- <artifactId>meecrowave-jolokia</artifactId>
- <version>${meecrowave.version}</version>
-</dependency>
-----
-
-== Jolokia only
-
-If Hawt.io is not setup (not there or inactive) the module will set up jolokia alone.
-
-It will deploy the jolokia servlet on `/jolokia/*` or the property `jolokia.web.mapping` set
-on the `Meecrowave.Builder`.
-
-IMPORTANT: don't forget to secure this endpoint cause it let you access all the JMX MBeans. See
-Meecrowave core configuration for more details.
-
-More on https://jolokia.org/reference/html/
-
-== Hawt.io
-
-By default hawt.io will be deployed and activated on `/hawtio/` endpoint.
-
-To activate it you need to add these dependencies:
-
-[source,xml]
-----
-<dependency>
- <groupId>io.hawt</groupId>
- <artifactId>hawtio-springboot</artifactId>
- <version>1.4.67</version>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </exclusion>
- </exclusions>
-</dependency>
-<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <optional>true</optional>
-</dependency>
-----
-
-NOTE: we don't need spring boot but we reuse hawt.io spring boot module which packages web resources in a jar.
-
-By default it will setup the security to use the Servlet security which means you can use meecrowave options:
-
-[source]
-----
-./meecrowave-runner --users=admin=admin --roles=admin=admin
-----
-
-And log with admin/admin user.
-
-== Running HawtIO war
-
-To run http://hawt.io, the easiest is to setup jaas and run the hawt.io war:
-
-[source]
-----
-java -Djava.security.auth.login.config=login.config \
- -jar meecrowave-runner.jar \
- -webapp hawtio-default-offline-1.4.67.war
-----
-
-This assumes you created a `login.config`:
-
-[source]
-----
-karaf {
- org.apache.catalina.realm.JAASMemoryLoginModule required
- pathname="/path/to/tomcat-users.xml";
-};
-----
-
-NOTE: the JAAS login module is named `karaf` because it is the default of hawt.io (check `io.hawt.web.AuthenticationFilter.init()`).
-
-And if you use - as in previous snippet - tomcat-users.xml you need to create an admin (role) user:
-
-[source,xml]
-----
-<tomcat-users>
- <user username="admin" password="admin" role="hawtio" roles="admin" />
-</tomcat-users>
-----
-
-NOTE: don't try to use `io.hawt.web.tomcat.TomcatUserDatabaseLoginContext` of hawt.io which does the same as `JAASMemoryLoginModule`
-excepted it doesn't handle absolute paths which enforce you to use a `catalina.base`.
-
-Using hawt.io war you don't need to run jolokia servlet by yourself, it is already done.
diff --git a/meecrowave-jolokia/pom.xml b/meecrowave-jolokia/pom.xml
deleted file mode 100644
index e91be7f..0000000
--- a/meecrowave-jolokia/pom.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF 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
-
- http://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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>meecrowave</artifactId>
- <groupId>org.apache.meecrowave</groupId>
- <version>1.2.9-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>meecrowave-jolokia</artifactId>
- <name>Meecrowave :: Jolokia</name>
-
- <properties>
- <jolokia.version>2.0.0-M3</jolokia.version>
- <meecrowave.build.name>${project.groupId}.jolokia</meecrowave.build.name>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-servlet-api</artifactId>
- <version>${tomcat.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.meecrowave</groupId>
- <artifactId>meecrowave-core</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <!-- <jolokia.version>2.0.0-M3</jolokia.version>
- <dependency>
- <groupId>org.jolokia</groupId>
- <artifactId>jolokia-server-core</artifactId>
- <version>${jolokia.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jolokia</groupId>
- <artifactId>jolokia-service-serializer</artifactId>
- <version>${jolokia.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jolokia</groupId>
- <artifactId>jolokia-service-jmx</artifactId>
- <version>${jolokia.version}</version>
- </dependency>
- -->
-
- <dependency> <!-- spring boot module has web resources embedded, reusing that part -->
- <groupId>io.hawt</groupId>
- <artifactId>hawtio-springboot</artifactId>
- <version>1.4.68</version>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>${commons-cli.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.meecrowave</groupId>
- <artifactId>meecrowave-junit</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.6</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/meecrowave-jolokia/src/main/java/org/apache/meecrowave/jolokia/HawtioInitializer.java b/meecrowave-jolokia/src/main/java/org/apache/meecrowave/jolokia/HawtioInitializer.java
deleted file mode 100644
index 3c6f9df..0000000
--- a/meecrowave-jolokia/src/main/java/org/apache/meecrowave/jolokia/HawtioInitializer.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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
- *
- * http://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 org.apache.meecrowave.jolokia;
-
-import io.hawt.HawtioContextListener;
-import io.hawt.web.AuthenticationFilter;
-import io.hawt.web.CORSFilter;
-import io.hawt.web.CacheHeadersFilter;
-import io.hawt.web.ContextFormatterServlet;
-import io.hawt.web.ExportContextServlet;
-import io.hawt.web.GitServlet;
-import io.hawt.web.JavaDocServlet;
-import io.hawt.web.JolokiaConfiguredAgentServlet;
-import io.hawt.web.LoginServlet;
-import io.hawt.web.LogoutServlet;
-import io.hawt.web.PluginServlet;
-import io.hawt.web.ProxyServlet;
-import io.hawt.web.RedirectFilter;
-import io.hawt.web.SessionExpiryFilter;
-import io.hawt.web.UploadServlet;
-import io.hawt.web.UserServlet;
-import io.hawt.web.XFrameOptionsFilter;
-import io.hawt.web.keycloak.KeycloakServlet;
-import org.apache.catalina.Globals;
-import org.apache.catalina.WebResourceRoot;
-import org.apache.catalina.realm.GenericPrincipal;
-import org.apache.catalina.webresources.JarResourceSet;
-import org.apache.commons.fileupload.servlet.FileCleanerCleanup;
-import org.apache.meecrowave.runner.Cli;
-import org.apache.meecrowave.runner.cli.CliOption;
-
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.CDI;
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.security.auth.login.Configuration;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.spi.LoginModule;
-import javax.servlet.DispatcherType;
-import javax.servlet.FilterRegistration;
-import javax.servlet.ServletContainerInitializer;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRegistration;
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.security.Principal;
-import java.security.Security;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import static java.util.Optional.ofNullable;
-
-public class HawtioInitializer implements ServletContainerInitializer {
- @Override
- public void onStartup(final Set<Class<?>> set, final ServletContext servletContext) throws ServletException {
- try {
- servletContext.getClassLoader().loadClass("io.hawt.web.UserServlet");
- } catch (final ClassNotFoundException e) {
- servletContext.log("Hawt.io not available, skipping");
- return;
- }
- Delegate.doSetup(servletContext);
- }
-
- private static class Delegate {
- private Delegate() {
- // no-op
- }
-
- private static void doSetup(final ServletContext servletContext) {
- final org.apache.meecrowave.configuration.Configuration config = org.apache.meecrowave.configuration.Configuration.class.cast(
- servletContext.getAttribute("meecrowave.configuration"));
- final HawtioConfiguration configuration = config.getExtension(HawtioConfiguration.class);
- final JolokiaInitializer.JolokiaConfiguration jolokia = config.getExtension(JolokiaInitializer.JolokiaConfiguration.class);
- if (!configuration.isActive()) {
- return;
- }
-
- doSetupJaas(configuration, servletContext);
-
- final String mapping = ofNullable(configuration.getMapping()).orElse("/hawtio/");
-
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-user", UserServlet.class);
- servlet.addMapping(mapping + "user/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-proxy", ProxyServlet.class);
- servlet.addMapping(mapping + "proxy/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-file-upload", UploadServlet.class);
- servlet.addMapping(mapping + "file-upload/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-login", LoginServlet.class);
- servlet.addMapping(mapping + "auth/login/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-logout", LogoutServlet.class);
- servlet.addMapping(mapping + "auth/logout/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-keycloak", KeycloakServlet.class);
- servlet.addMapping(mapping + "keycloak/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-exportContext", ExportContextServlet.class);
- servlet.addMapping(mapping + "exportContext/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-javadoc", JavaDocServlet.class);
- servlet.addMapping(mapping + "javadoc/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-plugin", PluginServlet.class);
- servlet.addMapping(mapping + "plugin/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-contextFormatter", ContextFormatterServlet.class);
- servlet.addMapping(mapping + "contextFormatter/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-git", GitServlet.class);
- servlet.addMapping(mapping + "git/*");
- }
- {
- final ServletRegistration.Dynamic servlet = servletContext.addServlet("hawtio-jolokia", JolokiaConfiguredAgentServlet.class);
- servlet.setInitParameter("mbeanQualifier", "qualifier=hawtio");
- servlet.setInitParameter("includeStackTrace", "false");
- servlet.setInitParameter("restrictorClass", "io.hawt.web.RBACRestrictor");
- servlet.addMapping(mapping + "jolokia/*");
- }
- {
- final WebResourceRoot root = WebResourceRoot.class.cast(servletContext.getAttribute(Globals.RESOURCES_ATTR));
- final String url = servletContext.getClassLoader().getResource("static/hawtio").toExternalForm();
- final int sep = url.lastIndexOf("!/");
- String jar = url;
- if (jar.startsWith("jar:")) {
- jar = url.substring("jar:".length(), sep);
- }
- if (jar.startsWith("file:")) {
- jar = jar.substring("file:".length());
- }
- root.addPostResources(new JarResourceSet(root, mapping, jar, "/static/hawtio/"));
- }
-
- servletContext.addListener(HawtioContextListener.class);
- servletContext.addListener(FileCleanerCleanup.class);
-
- {
- final FilterRegistration.Dynamic filter = servletContext.addFilter("hawtio-redirect", RedirectFilter.class);
- filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, mapping + "*");
- }
- {
- final FilterRegistration.Dynamic filter = servletContext.addFilter("hawtio-cacheheaders", CacheHeadersFilter.class);
- filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, mapping + "*");
- }
- {
- final FilterRegistration.Dynamic filter = servletContext.addFilter("hawtio-cors", CORSFilter.class);
- filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, mapping + "*");
- }
- {
- final FilterRegistration.Dynamic filter = servletContext.addFilter("hawtio-xframe", XFrameOptionsFilter.class);
- filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, mapping + "*");
- }
- {
- final FilterRegistration.Dynamic filter = servletContext.addFilter("hawtio-sessionexpiry", SessionExpiryFilter.class);
- filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, mapping + "*");
- }
- {
- final FilterRegistration.Dynamic filter = servletContext.addFilter("hawtio-authentication", AuthenticationFilter.class);
- filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false,
- mapping + "auth/*", mapping + "upload/*", mapping + "javadoc/*", mapping + "jolokia/*",
- ofNullable(jolokia.getMapping()).orElse("/jolokia/*"));
- }
-
- servletContext.log("Installed Hawt.io on " + mapping);
- }
-
- private static void doSetupJaas(final HawtioConfiguration configuration, final ServletContext servletContext) {
- if (!configuration.isJaas()) {
- return;
- }
- final String key = "login.configuration.provider";
- final String val = Security.getProperty(key);
- Security.setProperty(key, EmbeddedConfiguration.class.getName());
- servletContext.addListener(new ServletContextListener() {
- @Override
- public void contextDestroyed(final ServletContextEvent sce) {
- Security.setProperty(key, val == null ? "sun.security.provider.ConfigFile" : val);
- }
- });
- }
- }
-
- public static class EmbeddedConfiguration extends Configuration {
- private final AppConfigurationEntry[] entries = new AppConfigurationEntry[]{
- new AppConfigurationEntry(EmbeddedLoginModule.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, new HashMap<>())
- };
-
- @Override
- public AppConfigurationEntry[] getAppConfigurationEntry(final String name) {
- return "karaf".equals(name) ? entries : null;
- }
- }
-
- public static class EmbeddedLoginModule implements LoginModule {
- private Subject subject;
- private CallbackHandler callbackHandler;
-
- private Principal principal;
-
- @Override
- public void initialize(final Subject subject, final CallbackHandler callbackHandler,
- final Map<String, ?> sharedState, final Map<String, ?> options) {
- this.subject = subject;
- this.callbackHandler = callbackHandler;
- }
-
- @Override
- public boolean login() throws LoginException {
- final Callback[] callbacks = new Callback[2];
- callbacks[0] = new NameCallback("Username: ");
- callbacks[1] = new PasswordCallback("Password: ", false);
- try {
- callbackHandler.handle(callbacks);
- } catch (IOException | UnsupportedCallbackException e) {
- throw new LoginException(e.toString());
- }
-
- final BeanManager beanManager = CDI.current().getBeanManager();
- final HttpServletRequest request =
- HttpServletRequest.class.cast(
- beanManager.getReference(
- beanManager.resolve(beanManager.getBeans(HttpServletRequest.class)),
- HttpServletRequest.class,
- beanManager.createCreationalContext(null)));
-
- try {
- request.login(NameCallback.class.cast(callbacks[0]).getName(), new String(PasswordCallback.class.cast(callbacks[1]).getPassword()));
- } catch (final ServletException e) {
- throw new LoginException(e.getMessage());
- }
-
- principal = request.getUserPrincipal();
-
- return principal != null;
- }
-
- @Override
- public boolean commit() throws LoginException {
- if (!subject.getPrincipals().contains(principal)) {
- subject.getPrincipals().add(principal);
- if (GenericPrincipal.class.isInstance(principal)) {
- final String roles[] = GenericPrincipal.class.cast(principal).getRoles();
- for (final String role : roles) {
- subject.getPrincipals().add(new GenericPrincipal(role, null, null));
- }
-
- }
- }
- return true;
- }
-
- @Override
- public boolean abort() throws LoginException {
- principal = null;
- return true;
- }
-
- @Override
- public boolean logout() throws LoginException {
- subject.getPrincipals().remove(principal);
- return true;
- }
- }
-
- public static class HawtioConfiguration implements Cli.Options {
- @CliOption(name = "hawtio-mapping", description = "Hawt.io base endpoint")
- private String mapping;
-
- @CliOption(name = "hawtio-active", description = "Should Hawt.io be deployed if present")
- private boolean active = true;
-
- @CliOption(name = "hawtio-meecrowave-jaas", description = "Should meecrowave setup jaas")
- private boolean jaas = true;
-
- public boolean isJaas() {
- return jaas;
- }
-
- public void setJaas(final boolean jaas) {
- this.jaas = jaas;
- }
-
- public boolean isActive() {
- return active;
- }
-
- public void setActive(final boolean active) {
- this.active = active;
- }
-
- public String getMapping() {
- return mapping;
- }
-
- public void setMapping(final String mapping) {
- this.mapping = mapping;
- }
- }
-}
diff --git a/meecrowave-jolokia/src/main/java/org/apache/meecrowave/jolokia/JolokiaInitializer.java b/meecrowave-jolokia/src/main/java/org/apache/meecrowave/jolokia/JolokiaInitializer.java
deleted file mode 100644
index bbbb88f..0000000
--- a/meecrowave-jolokia/src/main/java/org/apache/meecrowave/jolokia/JolokiaInitializer.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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
- *
- * http://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 org.apache.meecrowave.jolokia;
-
-import org.apache.meecrowave.configuration.Configuration;
-import org.apache.meecrowave.runner.Cli;
-import org.apache.meecrowave.runner.cli.CliOption;
-import org.jolokia.http.AgentServlet;
-
-import javax.servlet.ServletContainerInitializer;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRegistration;
-import java.util.Set;
-
-import static java.util.Optional.ofNullable;
-
-public class JolokiaInitializer implements ServletContainerInitializer {
- @Override
- public void onStartup(final Set<Class<?>> set, final ServletContext servletContext) throws ServletException {
- final Configuration config = Configuration.class.cast(servletContext.getAttribute("meecrowave.configuration"));
- final JolokiaConfiguration configuration = config.getExtension(JolokiaConfiguration.class);
- if (!configuration.isActive()) {
- return;
- }
- try { // if hawtio is setup skip it
- servletContext.getClassLoader().loadClass("io.hawt.web.UserServlet");
- if (config.getExtension(HawtioInitializer.HawtioConfiguration.class).isActive()) {
- return;
- }
- } catch (final ClassNotFoundException e) {
- // that's what we want
- }
-
- final ServletRegistration.Dynamic jolokia = servletContext.addServlet("jolokia", AgentServlet.class);
- jolokia.setLoadOnStartup(1);
- final String mapping = ofNullable(configuration.getMapping()).orElse("/jolokia/*");
- jolokia.addMapping(mapping);
- servletContext.log("Installed Jolokia on " + mapping);
- }
-
- public static class JolokiaConfiguration implements Cli.Options {
- @CliOption(name = "jolokia-mapping", description = "Jolokia endpoint")
- private String mapping;
-
- @CliOption(name = "jolokia-active", description = "Should Jolokia be deployed (only if hawt.io is not)")
- private boolean active = true;
-
- public boolean isActive() {
- return active;
- }
-
- public void setActive(final boolean active) {
- this.active = active;
- }
-
- public String getMapping() {
- return mapping;
- }
-
- public void setMapping(final String mapping) {
- this.mapping = mapping;
- }
- }
-}
diff --git a/meecrowave-jolokia/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/meecrowave-jolokia/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
deleted file mode 100644
index fb09a91..0000000
--- a/meecrowave-jolokia/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
+++ /dev/null
@@ -1,2 +0,0 @@
-org.apache.meecrowave.jolokia.JolokiaInitializer
-org.apache.meecrowave.jolokia.HawtioInitializer
diff --git a/meecrowave-jolokia/src/main/resources/META-INF/services/org.apache.meecrowave.runner.Cli$Options b/meecrowave-jolokia/src/main/resources/META-INF/services/org.apache.meecrowave.runner.Cli$Options
deleted file mode 100644
index 4ff54c5..0000000
--- a/meecrowave-jolokia/src/main/resources/META-INF/services/org.apache.meecrowave.runner.Cli$Options
+++ /dev/null
@@ -1,2 +0,0 @@
-org.apache.meecrowave.jolokia.HawtioInitializer$HawtioConfiguration
-org.apache.meecrowave.jolokia.JolokiaInitializer$JolokiaConfiguration
\ No newline at end of file
diff --git a/meecrowave-jolokia/src/test/java/org/apache/meecrowave/jolokia/HawtioTest.java b/meecrowave-jolokia/src/test/java/org/apache/meecrowave/jolokia/HawtioTest.java
deleted file mode 100644
index 9b003a2..0000000
--- a/meecrowave-jolokia/src/test/java/org/apache/meecrowave/jolokia/HawtioTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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
- *
- * http://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 org.apache.meecrowave.jolokia;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.meecrowave.junit.MeecrowaveRule;
-import org.junit.ClassRule;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-
-import static org.junit.Assert.assertTrue;
-
-public class HawtioTest {
- @ClassRule
- public static final MeecrowaveRule RULE = new MeecrowaveRule();
-
- @Test
- public void run() throws IOException {
- final String actual = IOUtils.toString(
- new URL("http://localhost:" + RULE.getConfiguration().getHttpPort() + "/hawtio/"),
- StandardCharsets.UTF_8);
- assertTrue(actual, actual.contains("<title>hawtio</title>"));
- }
-}
diff --git a/meecrowave-jolokia/src/test/java/org/apache/meecrowave/jolokia/JolokiaInitializerTest.java b/meecrowave-jolokia/src/test/java/org/apache/meecrowave/jolokia/JolokiaInitializerTest.java
deleted file mode 100644
index ea0e4bf..0000000
--- a/meecrowave-jolokia/src/test/java/org/apache/meecrowave/jolokia/JolokiaInitializerTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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
- *
- * http://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 org.apache.meecrowave.jolokia;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.meecrowave.Meecrowave;
-import org.apache.meecrowave.junit.MeecrowaveRule;
-import org.junit.ClassRule;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-
-import static org.junit.Assert.assertTrue;
-
-public class JolokiaInitializerTest {
- @ClassRule
- public static final MeecrowaveRule RULE = new MeecrowaveRule(new Meecrowave.Builder() {{
- randomHttpPort();
- this.setExtension(HawtioInitializer.HawtioConfiguration.class, new HawtioInitializer.HawtioConfiguration() {{
- setActive(false);
- }});
- }}, "");
-
- @Test
- public void run() throws IOException {
- final String actual = IOUtils.toString(
- new URL("http://localhost:" + RULE.getConfiguration().getHttpPort() + "/jolokia/read/java.lang:type=Memory/HeapMemoryUsage"),
- StandardCharsets.UTF_8);
- assertTrue(actual, actual.contains("\"status\":200"));
- assertTrue(actual, actual.contains("\"mbean\":\"java.lang:type=Memory\""));
- }
-}
diff --git a/pom.xml b/pom.xml
index 6aca342..efd86b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,7 +75,6 @@
<module>meecrowave-junit</module>
<module>meecrowave-arquillian</module>
<module>meecrowave-jpa</module>
- <module>meecrowave-jolokia</module>
<module>meecrowave-doc</module>
<module>meecrowave-jta</module>
<module>integration-tests</module>