From 1560c884ec7c03451a12283e507ea46adeadaf8c Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Mon, 7 Jul 2025 08:46:10 -0500 Subject: [PATCH 1/2] NO-JIRA proper Checkstyle config --- artemis-console-extension/pom.xml | 1 + artemis-console-war/pom.xml | 4 + etc/checkstyle.xml | 130 ++++++++++++++++++++++++++++++ pom.xml | 26 ++++++ 4 files changed, 161 insertions(+) create mode 100644 etc/checkstyle.xml diff --git a/artemis-console-extension/pom.xml b/artemis-console-extension/pom.xml index 820989c..dbc3ce4 100644 --- a/artemis-console-extension/pom.xml +++ b/artemis-console-extension/pom.xml @@ -35,6 +35,7 @@ artemis-extension artemis-extension + ${project.parent.basedir} ${project.artifactId} diff --git a/artemis-console-war/pom.xml b/artemis-console-war/pom.xml index 20ceb40..b3ef626 100644 --- a/artemis-console-war/pom.xml +++ b/artemis-console-war/pom.xml @@ -31,6 +31,10 @@ ActiveMQ Artemis Console War + + ${project.parent.basedir} + + diff --git a/etc/checkstyle.xml b/etc/checkstyle.xml new file mode 100644 index 0000000..8df9f26 --- /dev/null +++ b/etc/checkstyle.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index ecc1bcd..458b9af 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,7 @@ https://activemq.apache.org/components/artemis/ + ${project.basedir} 17 17 17 @@ -53,6 +54,8 @@ v1.22.22 1.15.1 2025-06-25T05:17:39Z + 1.44.1 + 10.26.1 @@ -228,6 +231,29 @@ @{project.version} + + org.apache.maven.plugins + maven-checkstyle-plugin + + + com.github.sevntu-checkstyle + sevntu-checks + ${sevntu.checks.version} + + + com.puppycrawl.tools + checkstyle + ${checkstyle.version} + + + + ${activemq.basedir}/etc/checkstyle.xml + false + true + true + true + + From c438d6d99b31e46014bb69f6701ff6f91a64944d Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Mon, 7 Jul 2025 08:22:23 -0500 Subject: [PATCH 2/2] ARTEMIS-5427 integrate Jolokia's MBeanInfo cache --- artemis-console-cache-key-provider/pom.xml | 51 +++++++++++++++++++ .../jolokia/ArtemisCacheKeyProvider.java | 41 +++++++++++++++ .../META-INF/jolokia/services-default | 16 ++++++ artemis-console-war/pom.xml | 5 ++ pom.xml | 3 ++ 5 files changed, 116 insertions(+) create mode 100644 artemis-console-cache-key-provider/pom.xml create mode 100644 artemis-console-cache-key-provider/src/main/java/org/apache/activemq/artemis/jolokia/ArtemisCacheKeyProvider.java create mode 100644 artemis-console-cache-key-provider/src/main/resources/META-INF/jolokia/services-default diff --git a/artemis-console-cache-key-provider/pom.xml b/artemis-console-cache-key-provider/pom.xml new file mode 100644 index 0000000..eb1d405 --- /dev/null +++ b/artemis-console-cache-key-provider/pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + + + org.apache.activemq + artemis-console-project + 1.3.0-SNAPSHOT + + + org.apache.activemq + artemis-console-cache-key-provider + jar + + + ActiveMQ Artemis Console Cache Key Provider + + + ${project.parent.basedir} + + + + + org.jolokia + jolokia-service-jmx + ${jolokia.version} + + + org.apache.activemq + artemis-server + ${activemq.artemis.version} + + + + \ No newline at end of file diff --git a/artemis-console-cache-key-provider/src/main/java/org/apache/activemq/artemis/jolokia/ArtemisCacheKeyProvider.java b/artemis-console-cache-key-provider/src/main/java/org/apache/activemq/artemis/jolokia/ArtemisCacheKeyProvider.java new file mode 100644 index 0000000..bf6fc2e --- /dev/null +++ b/artemis-console-cache-key-provider/src/main/java/org/apache/activemq/artemis/jolokia/ArtemisCacheKeyProvider.java @@ -0,0 +1,41 @@ +/* + * 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.activemq.artemis.jolokia; + +import javax.management.ObjectInstance; + +import org.jolokia.service.jmx.api.CacheKeyProvider; + +public class ArtemisCacheKeyProvider extends CacheKeyProvider { + + public ArtemisCacheKeyProvider(int pOrderId) { + super(pOrderId); + } + + @Override + public String determineKey(ObjectInstance objectInstance) { + try { + if (Class.forName("org.apache.activemq.artemis.core.management.impl.AbstractControl").isAssignableFrom(Class.forName(objectInstance.getClassName()))) { + return objectInstance.getClassName(); + } + } catch (Exception e) { + // ignore + } + + return null; + } +} \ No newline at end of file diff --git a/artemis-console-cache-key-provider/src/main/resources/META-INF/jolokia/services-default b/artemis-console-cache-key-provider/src/main/resources/META-INF/jolokia/services-default new file mode 100644 index 0000000..73ab129 --- /dev/null +++ b/artemis-console-cache-key-provider/src/main/resources/META-INF/jolokia/services-default @@ -0,0 +1,16 @@ +# 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. + +org.apache.activemq.artemis.jolokia.ArtemisCacheKeyProvider,100 \ No newline at end of file diff --git a/artemis-console-war/pom.xml b/artemis-console-war/pom.xml index b3ef626..a1fa1d6 100644 --- a/artemis-console-war/pom.xml +++ b/artemis-console-war/pom.xml @@ -36,6 +36,11 @@ + + org.apache.activemq + artemis-console-cache-key-provider + ${project.version} + org.apache.activemq diff --git a/pom.xml b/pom.xml index 458b9af..266112f 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ artemis-console-extension artemis-console-war artemis-console-distribution + artemis-console-cache-key-provider ActiveMQ Artemis Console Project @@ -45,6 +46,8 @@ 17 17 17 + 2.41.0 + 2.2.9 4.4.1 5.0.0 2.0.17