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-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..a1fa1d6 100644 --- a/artemis-console-war/pom.xml +++ b/artemis-console-war/pom.xml @@ -31,7 +31,16 @@ ActiveMQ Artemis Console War + + ${project.parent.basedir} + + + + org.apache.activemq + artemis-console-cache-key-provider + ${project.version} + org.apache.activemq 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..266112f 100644 --- a/pom.xml +++ b/pom.xml @@ -35,15 +35,19 @@ artemis-console-extension artemis-console-war artemis-console-distribution + artemis-console-cache-key-provider ActiveMQ Artemis Console Project https://activemq.apache.org/components/artemis/ + ${project.basedir} 17 17 17 + 2.41.0 + 2.2.9 4.4.1 5.0.0 2.0.17 @@ -53,6 +57,8 @@ v1.22.22 1.15.1 2025-06-25T05:17:39Z + 1.44.1 + 10.26.1 @@ -228,6 +234,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 + +