From a7813f8ba388697b731da4df7d76a6579915c6b9 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Thu, 18 Jul 2024 16:39:00 -0400 Subject: [PATCH] chore(multimodule): split out libcryostat module (#423) * chore(multimodule): split out libcryostat module * remove JMC adoptium repo * enable dependency snapshots --- cryostat-core/.gitignore | 6 + .../JMC_LICENSE.txt | 0 cryostat-core/pom.xml | 418 ++++++++++++++++++ .../java/io/cryostat/core/CryostatCore.java | 0 .../io/cryostat/core/EventOptionsBuilder.java | 0 .../cryostat/core/EventOptionsCustomizer.java | 0 .../core/FlightRecorderException.java | 0 .../core/RecordingOptionsCustomizer.java | 2 +- .../core/jmc/CopyRecordingDescriptor.java | 0 .../io/cryostat/core/jmc/SecurityManager.java | 0 .../io/cryostat/core/jmc/internal/Store.java | 0 .../cryostat/core/jmcagent/CapturedValue.java | 0 .../java/io/cryostat/core/jmcagent/Event.java | 0 .../java/io/cryostat/core/jmcagent/Field.java | 0 .../core/jmcagent/JMCAgentJMXHelper.java | 0 .../core/jmcagent/JMCAgentXMLStream.java | 0 .../core/jmcagent/MethodParameter.java | 0 .../core/jmcagent/MethodReturnValue.java | 0 .../cryostat/core/jmcagent/ProbeTemplate.java | 0 .../core/jmcagent/ProbeTemplateService.java | 0 .../jmcagent/ProbeValidationException.java | 0 .../core/jmcagent/ProbeValidator.java | 0 .../net/CryostatFlightRecorderService.java | 2 +- .../io/cryostat/core/net/JFRConnection.java | 6 +- .../core/net/JFRConnectionToolkit.java | 7 +- .../cryostat/core/net/JFRJMXConnection.java | 16 +- .../core/net/JmxFlightRecorderService.java | 4 +- .../discovery/DiscoveredJvmDescriptor.java | 0 .../net/discovery/JvmDiscoveryClient.java | 0 .../reports/InterruptibleReportGenerator.java | 0 .../JmcSerializableRecordingDescriptor.java | 135 ++---- .../SerializableEventTypeInfo.java | 0 .../SerializableOptionDescriptor.java | 0 .../templates/AbstractTemplateService.java | 2 + .../templates/MutableTemplateService.java | 14 +- .../core/templates/RemoteTemplateService.java | 2 + .../core/templates/TemplateService.java | 2 + .../cryostat/core/util/CheckedConsumer.java | 0 .../cryostat/core/util/RuleFilterParser.java | 0 .../main/resources/config/logging.properties | 0 .../cryostat/core/agent/jfrprobes_schema.xsd | 0 .../configuration/events/jfc_v1.xsd | 0 .../configuration/events/jfc_v2.xsd | 0 .../subscription/internal/mrimetadata.xml | 0 .../src}/main/resources/resultgroups.xml | 0 .../core/EventOptionsCustomizerTest.java | 0 .../core/RecordingOptionsCustomizerTest.java | 2 +- .../core/net/JFRConnectionToolkitTest.java | 6 +- .../net/discovery/JvmDiscoveryClientTest.java | 0 .../InterruptibleReportGeneratorTest.java | 0 .../templates/RemoteTemplateServiceTest.java | 2 + .../core/util/RuleFilterParserTest.java | 0 .../core/templates/multiword_label.jfc | 0 .../io/cryostat/core/templates/profile.jfc | 0 .../src}/test/resources/profiling_sample.jfr | Bin libcryostat/.gitignore | 6 + libcryostat/LICENSE | 13 + libcryostat/LICENSE.txt | 202 +++++++++ libcryostat/pom.xml | 330 ++++++++++++++ .../cryostat/libcryostat}/JvmIdentifier.java | 6 +- .../libcryostat}/net/Credentials.java | 2 +- .../libcryostat}/net/IDException.java | 2 +- .../libcryostat}/net/MBeanMetrics.java | 2 +- .../libcryostat}/net/MemoryMetrics.java | 2 +- .../libcryostat}/net/MemoryUtilization.java | 2 +- .../net/OperatingSystemMetrics.java | 2 +- .../libcryostat}/net/RuntimeMetrics.java | 2 +- .../libcryostat}/net/ThreadMetrics.java | 2 +- .../SerializableRecordingDescriptor.java | 136 ++++++ .../io/cryostat/libcryostat}/sys/Clock.java | 2 +- .../libcryostat}/sys/Environment.java | 2 +- .../cryostat/libcryostat}/sys/FileSystem.java | 2 +- .../InvalidEventTemplateException.java | 27 ++ .../templates/MalformedXMLException.java | 4 +- .../libcryostat}/templates/Template.java | 2 +- .../libcryostat}/templates/TemplateType.java | 2 +- .../libcryostat}/tui/ClientReader.java | 4 +- .../libcryostat}/tui/ClientWriter.java | 2 +- .../cryostat/libcryostat}/sys/ClockTest.java | 2 +- .../libcryostat}/sys/EnvironmentTest.java | 2 +- pom.xml | 196 ++++---- 81 files changed, 1302 insertions(+), 280 deletions(-) create mode 100644 cryostat-core/.gitignore rename JMC_LICENSE.txt => cryostat-core/JMC_LICENSE.txt (100%) create mode 100644 cryostat-core/pom.xml rename {src => cryostat-core/src}/main/java/io/cryostat/core/CryostatCore.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/EventOptionsBuilder.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/EventOptionsCustomizer.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/FlightRecorderException.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/RecordingOptionsCustomizer.java (98%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmc/CopyRecordingDescriptor.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmc/SecurityManager.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmc/internal/Store.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/CapturedValue.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/Event.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/Field.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/JMCAgentJMXHelper.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/JMCAgentXMLStream.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/MethodParameter.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/MethodReturnValue.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/ProbeTemplate.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/ProbeTemplateService.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/ProbeValidationException.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/jmcagent/ProbeValidator.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java (98%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/net/JFRConnection.java (91%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/net/JFRConnectionToolkit.java (95%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/net/JFRJMXConnection.java (96%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/net/JmxFlightRecorderService.java (99%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/net/discovery/DiscoveredJvmDescriptor.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/net/discovery/JvmDiscoveryClient.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/reports/InterruptibleReportGenerator.java (100%) rename src/main/java/io/cryostat/core/serialization/SerializableRecordingDescriptor.java => cryostat-core/src/main/java/io/cryostat/core/serialization/JmcSerializableRecordingDescriptor.java (58%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/serialization/SerializableEventTypeInfo.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/serialization/SerializableOptionDescriptor.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/templates/AbstractTemplateService.java (95%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/templates/MutableTemplateService.java (81%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/templates/RemoteTemplateService.java (98%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/templates/TemplateService.java (93%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/util/CheckedConsumer.java (100%) rename {src => cryostat-core/src}/main/java/io/cryostat/core/util/RuleFilterParser.java (100%) rename {src => cryostat-core/src}/main/resources/config/logging.properties (100%) rename {src => cryostat-core/src}/main/resources/io/cryostat/core/agent/jfrprobes_schema.xsd (100%) rename {src => cryostat-core/src}/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v1.xsd (100%) rename {src => cryostat-core/src}/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v2.xsd (100%) rename {src => cryostat-core/src}/main/resources/org/openjdk/jmc/rjmx/subscription/internal/mrimetadata.xml (100%) rename {src => cryostat-core/src}/main/resources/resultgroups.xml (100%) rename {src => cryostat-core/src}/test/java/io/cryostat/core/EventOptionsCustomizerTest.java (100%) rename {src => cryostat-core/src}/test/java/io/cryostat/core/RecordingOptionsCustomizerTest.java (98%) rename {src => cryostat-core/src}/test/java/io/cryostat/core/net/JFRConnectionToolkitTest.java (95%) rename {src => cryostat-core/src}/test/java/io/cryostat/core/net/discovery/JvmDiscoveryClientTest.java (100%) rename {src => cryostat-core/src}/test/java/io/cryostat/core/reports/InterruptibleReportGeneratorTest.java (100%) rename {src => cryostat-core/src}/test/java/io/cryostat/core/templates/RemoteTemplateServiceTest.java (97%) rename {src => cryostat-core/src}/test/java/io/cryostat/core/util/RuleFilterParserTest.java (100%) rename {src => cryostat-core/src}/test/resources/io/cryostat/core/templates/multiword_label.jfc (100%) rename {src => cryostat-core/src}/test/resources/io/cryostat/core/templates/profile.jfc (100%) rename {src => cryostat-core/src}/test/resources/profiling_sample.jfr (100%) create mode 100644 libcryostat/.gitignore create mode 100644 libcryostat/LICENSE create mode 100644 libcryostat/LICENSE.txt create mode 100644 libcryostat/pom.xml rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/JvmIdentifier.java (96%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/net/Credentials.java (98%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/net/IDException.java (95%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/net/MBeanMetrics.java (97%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/net/MemoryMetrics.java (98%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/net/MemoryUtilization.java (97%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/net/OperatingSystemMetrics.java (99%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/net/RuntimeMetrics.java (99%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/net/ThreadMetrics.java (99%) create mode 100644 libcryostat/src/main/java/io/cryostat/libcryostat/serialization/SerializableRecordingDescriptor.java rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/sys/Clock.java (97%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/sys/Environment.java (97%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/sys/FileSystem.java (99%) create mode 100644 libcryostat/src/main/java/io/cryostat/libcryostat/templates/InvalidEventTemplateException.java rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/templates/MalformedXMLException.java (88%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/templates/Template.java (98%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/templates/TemplateType.java (93%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/tui/ClientReader.java (87%) rename {src/main/java/io/cryostat/core => libcryostat/src/main/java/io/cryostat/libcryostat}/tui/ClientWriter.java (96%) rename {src/test/java/io/cryostat/core => libcryostat/src/test/java/io/cryostat/libcryostat}/sys/ClockTest.java (98%) rename {src/test/java/io/cryostat/core => libcryostat/src/test/java/io/cryostat/libcryostat}/sys/EnvironmentTest.java (98%) diff --git a/cryostat-core/.gitignore b/cryostat-core/.gitignore new file mode 100644 index 00000000..bcc41a7f --- /dev/null +++ b/cryostat-core/.gitignore @@ -0,0 +1,6 @@ +/build/ +/target/ +/bin/ +.classpath +.project +.settings/ diff --git a/JMC_LICENSE.txt b/cryostat-core/JMC_LICENSE.txt similarity index 100% rename from JMC_LICENSE.txt rename to cryostat-core/JMC_LICENSE.txt diff --git a/cryostat-core/pom.xml b/cryostat-core/pom.xml new file mode 100644 index 00000000..b84ae9aa --- /dev/null +++ b/cryostat-core/pom.xml @@ -0,0 +1,418 @@ + + + +4.0.0 + +Cryostat Core +Core library for Cryostat +https://github.com/cryostatio/cryostat-core +2019 + +io.cryostat +cryostat-core + +4.0.0-SNAPSHOT +jar + + + io.cryostat + cryostat-core-parent + 4.0.0-SNAPSHOT + + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + Universal Permissive License Version 1.0 + http://oss.oracle.com/licenses/upl + repo + Copyright (c) 2018, 2023, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. + + + + + + Andrew Azores + aazores@redhat.com + Red Hat + https://www.redhat.com + + + Elliott Baron + ebaron@redhat.com + Red Hat + https://www.redhat.com + + + + + + s01.oss.sonatype.org-snapshot + https://s01.oss.sonatype.org/content/repositories/snapshots/ + + false + + + true + always + + + + + + UTF-8 + 17 + ${java.version} + ${java.version} + 4.0.0-SNAPSHOT + 9.0.0 + 1.17.2 + + + + + io.cryostat + libcryostat + ${io.cryostat.libcryostat.version} + + + org.openjdk.jmc + common + ${org.openjdk.jmc.version} + + + org.openjdk.jmc + flightrecorder + ${org.openjdk.jmc.version} + + + org.openjdk.jmc + flightrecorder.configuration + ${org.openjdk.jmc.version} + + + org.openjdk.jmc + flightrecorder.rules + ${org.openjdk.jmc.version} + + + org.openjdk.jmc + flightrecorder.rules.jdk + ${org.openjdk.jmc.version} + + + org.openjdk.jmc + jdp + ${org.openjdk.jmc.version} + + + org.openjdk.jmc + rjmx.common + ${org.openjdk.jmc.version} + + + org.apache.commons + commons-lang3 + + + commons-codec + commons-codec + + + commons-io + commons-io + + + org.jsoup + jsoup + ${org.jsoup.version} + + + com.github.spotbugs + spotbugs-annotations + provided + + + org.slf4j + slf4j-api + + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.hamcrest + hamcrest + test + + + org.mockito + mockito-junit-jupiter + test + + + org.mockito + mockito-inline + test + + + org.apache.commons + commons-text + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + io.smallrye + jandex-maven-plugin + + + make-index + + jandex + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + junit.jupiter.execution.parallel.enabled=true + junit.jupiter.execution.parallel.mode.default=same_thread + junit.jupiter.execution.parallel.mode.classes.default=concurrent + + + + + + com.github.spotbugs + spotbugs-maven-plugin + + io.cryostat.- + + + + spotbugs + verify + + check + + + + + + org.jacoco + jacoco-maven-plugin + + + + prepare-agent + + + + report + verify + + report + + + + + + com.diffplug.spotless + spotless-maven-plugin + + + spotless + verify + + check + + + + + + + src/main/java/org/openjdk/jmc/** + + + 1.15.0 + + true + + + + + java,javax,org.openjdk.jmc,io.cryostat, + + + + + + + org.apache.maven.plugins + maven-site-plugin + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + + com.mycila + license-maven-plugin + + + +
LICENSE
+ + src/main/java/io/cryostat/**/*.java + src/test/java/io/cryostat/**/*.java + + + src/main/java/org/openjdk/jmc/** + +
+
+
+ + + update-license + + check + + process-sources + + +
+
+
+ + + + release + + + + org.jreleaser + jreleaser-maven-plugin + false + + + + ALWAYS + true + + + + + + ALWAYS + https://s01.oss.sonatype.org/service/local + https://s01.oss.sonatype.org/content/repositories/snapshots/ + true + true + target/staging-deploy + + + + + + + + + + + + + publication + + local::file:./target/staging-deploy + + + deploy + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + true + false + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar-no-fork + + + true + + + + + + + + + + + + + com.github.spotbugs + spotbugs-maven-plugin + + + org.jacoco + jacoco-maven-plugin + + + io/cryostat/core/jmc/**/* + org/openjdk/jmc/**/* + + + + + + report + + + + + + + +
diff --git a/src/main/java/io/cryostat/core/CryostatCore.java b/cryostat-core/src/main/java/io/cryostat/core/CryostatCore.java similarity index 100% rename from src/main/java/io/cryostat/core/CryostatCore.java rename to cryostat-core/src/main/java/io/cryostat/core/CryostatCore.java diff --git a/src/main/java/io/cryostat/core/EventOptionsBuilder.java b/cryostat-core/src/main/java/io/cryostat/core/EventOptionsBuilder.java similarity index 100% rename from src/main/java/io/cryostat/core/EventOptionsBuilder.java rename to cryostat-core/src/main/java/io/cryostat/core/EventOptionsBuilder.java diff --git a/src/main/java/io/cryostat/core/EventOptionsCustomizer.java b/cryostat-core/src/main/java/io/cryostat/core/EventOptionsCustomizer.java similarity index 100% rename from src/main/java/io/cryostat/core/EventOptionsCustomizer.java rename to cryostat-core/src/main/java/io/cryostat/core/EventOptionsCustomizer.java diff --git a/src/main/java/io/cryostat/core/FlightRecorderException.java b/cryostat-core/src/main/java/io/cryostat/core/FlightRecorderException.java similarity index 100% rename from src/main/java/io/cryostat/core/FlightRecorderException.java rename to cryostat-core/src/main/java/io/cryostat/core/FlightRecorderException.java diff --git a/src/main/java/io/cryostat/core/RecordingOptionsCustomizer.java b/cryostat-core/src/main/java/io/cryostat/core/RecordingOptionsCustomizer.java similarity index 98% rename from src/main/java/io/cryostat/core/RecordingOptionsCustomizer.java rename to cryostat-core/src/main/java/io/cryostat/core/RecordingOptionsCustomizer.java index b8626e23..af727840 100644 --- a/src/main/java/io/cryostat/core/RecordingOptionsCustomizer.java +++ b/cryostat-core/src/main/java/io/cryostat/core/RecordingOptionsCustomizer.java @@ -23,8 +23,8 @@ import org.openjdk.jmc.common.unit.QuantityConversionException; import org.openjdk.jmc.flightrecorder.configuration.recording.RecordingOptionsBuilder; -import io.cryostat.core.tui.ClientWriter; import io.cryostat.core.util.CheckedConsumer; +import io.cryostat.libcryostat.tui.ClientWriter; public class RecordingOptionsCustomizer implements Function { diff --git a/src/main/java/io/cryostat/core/jmc/CopyRecordingDescriptor.java b/cryostat-core/src/main/java/io/cryostat/core/jmc/CopyRecordingDescriptor.java similarity index 100% rename from src/main/java/io/cryostat/core/jmc/CopyRecordingDescriptor.java rename to cryostat-core/src/main/java/io/cryostat/core/jmc/CopyRecordingDescriptor.java diff --git a/src/main/java/io/cryostat/core/jmc/SecurityManager.java b/cryostat-core/src/main/java/io/cryostat/core/jmc/SecurityManager.java similarity index 100% rename from src/main/java/io/cryostat/core/jmc/SecurityManager.java rename to cryostat-core/src/main/java/io/cryostat/core/jmc/SecurityManager.java diff --git a/src/main/java/io/cryostat/core/jmc/internal/Store.java b/cryostat-core/src/main/java/io/cryostat/core/jmc/internal/Store.java similarity index 100% rename from src/main/java/io/cryostat/core/jmc/internal/Store.java rename to cryostat-core/src/main/java/io/cryostat/core/jmc/internal/Store.java diff --git a/src/main/java/io/cryostat/core/jmcagent/CapturedValue.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/CapturedValue.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/CapturedValue.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/CapturedValue.java diff --git a/src/main/java/io/cryostat/core/jmcagent/Event.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/Event.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/Event.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/Event.java diff --git a/src/main/java/io/cryostat/core/jmcagent/Field.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/Field.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/Field.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/Field.java diff --git a/src/main/java/io/cryostat/core/jmcagent/JMCAgentJMXHelper.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/JMCAgentJMXHelper.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/JMCAgentJMXHelper.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/JMCAgentJMXHelper.java diff --git a/src/main/java/io/cryostat/core/jmcagent/JMCAgentXMLStream.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/JMCAgentXMLStream.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/JMCAgentXMLStream.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/JMCAgentXMLStream.java diff --git a/src/main/java/io/cryostat/core/jmcagent/MethodParameter.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/MethodParameter.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/MethodParameter.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/MethodParameter.java diff --git a/src/main/java/io/cryostat/core/jmcagent/MethodReturnValue.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/MethodReturnValue.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/MethodReturnValue.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/MethodReturnValue.java diff --git a/src/main/java/io/cryostat/core/jmcagent/ProbeTemplate.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/ProbeTemplate.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/ProbeTemplate.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/ProbeTemplate.java diff --git a/src/main/java/io/cryostat/core/jmcagent/ProbeTemplateService.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/ProbeTemplateService.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/ProbeTemplateService.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/ProbeTemplateService.java diff --git a/src/main/java/io/cryostat/core/jmcagent/ProbeValidationException.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/ProbeValidationException.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/ProbeValidationException.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/ProbeValidationException.java diff --git a/src/main/java/io/cryostat/core/jmcagent/ProbeValidator.java b/cryostat-core/src/main/java/io/cryostat/core/jmcagent/ProbeValidator.java similarity index 100% rename from src/main/java/io/cryostat/core/jmcagent/ProbeValidator.java rename to cryostat-core/src/main/java/io/cryostat/core/jmcagent/ProbeValidator.java diff --git a/src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java b/cryostat-core/src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java similarity index 98% rename from src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java rename to cryostat-core/src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java index 2215c296..3c18ae67 100644 --- a/src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java +++ b/cryostat-core/src/main/java/io/cryostat/core/net/CryostatFlightRecorderService.java @@ -31,7 +31,7 @@ import io.cryostat.core.EventOptionsBuilder.EventOptionException; import io.cryostat.core.EventOptionsBuilder.EventTypeException; -import io.cryostat.core.templates.Template; +import io.cryostat.libcryostat.templates.Template; public interface CryostatFlightRecorderService extends IFlightRecorderService { diff --git a/src/main/java/io/cryostat/core/net/JFRConnection.java b/cryostat-core/src/main/java/io/cryostat/core/net/JFRConnection.java similarity index 91% rename from src/main/java/io/cryostat/core/net/JFRConnection.java rename to cryostat-core/src/main/java/io/cryostat/core/net/JFRConnection.java index 9d7b321f..5ca17dbb 100644 --- a/src/main/java/io/cryostat/core/net/JFRConnection.java +++ b/cryostat-core/src/main/java/io/cryostat/core/net/JFRConnection.java @@ -26,9 +26,11 @@ import org.openjdk.jmc.rjmx.common.IConnectionHandle; import org.openjdk.jmc.rjmx.common.ServiceNotAvailableException; -import io.cryostat.core.JvmIdentifier; -import io.cryostat.core.sys.Clock; import io.cryostat.core.templates.TemplateService; +import io.cryostat.libcryostat.JvmIdentifier; +import io.cryostat.libcryostat.net.IDException; +import io.cryostat.libcryostat.net.MBeanMetrics; +import io.cryostat.libcryostat.sys.Clock; public interface JFRConnection extends AutoCloseable { diff --git a/src/main/java/io/cryostat/core/net/JFRConnectionToolkit.java b/cryostat-core/src/main/java/io/cryostat/core/net/JFRConnectionToolkit.java similarity index 95% rename from src/main/java/io/cryostat/core/net/JFRConnectionToolkit.java rename to cryostat-core/src/main/java/io/cryostat/core/net/JFRConnectionToolkit.java index 6ce69372..b1801e32 100644 --- a/src/main/java/io/cryostat/core/net/JFRConnectionToolkit.java +++ b/cryostat-core/src/main/java/io/cryostat/core/net/JFRConnectionToolkit.java @@ -30,9 +30,10 @@ import org.openjdk.jmc.rjmx.common.ConnectionException; import org.openjdk.jmc.rjmx.common.ConnectionToolkit; -import io.cryostat.core.sys.Environment; -import io.cryostat.core.sys.FileSystem; -import io.cryostat.core.tui.ClientWriter; +import io.cryostat.libcryostat.net.Credentials; +import io.cryostat.libcryostat.sys.Environment; +import io.cryostat.libcryostat.sys.FileSystem; +import io.cryostat.libcryostat.tui.ClientWriter; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; diff --git a/src/main/java/io/cryostat/core/net/JFRJMXConnection.java b/cryostat-core/src/main/java/io/cryostat/core/net/JFRJMXConnection.java similarity index 96% rename from src/main/java/io/cryostat/core/net/JFRJMXConnection.java rename to cryostat-core/src/main/java/io/cryostat/core/net/JFRJMXConnection.java index ca2d4e8b..5c3e1664 100644 --- a/src/main/java/io/cryostat/core/net/JFRJMXConnection.java +++ b/cryostat-core/src/main/java/io/cryostat/core/net/JFRJMXConnection.java @@ -56,13 +56,19 @@ import org.openjdk.jmc.rjmx.common.subscription.MRI; import org.openjdk.jmc.rjmx.common.subscription.MRI.Type; -import io.cryostat.core.JvmIdentifier; -import io.cryostat.core.sys.Clock; -import io.cryostat.core.sys.Environment; -import io.cryostat.core.sys.FileSystem; import io.cryostat.core.templates.RemoteTemplateService; import io.cryostat.core.templates.TemplateService; -import io.cryostat.core.tui.ClientWriter; +import io.cryostat.libcryostat.JvmIdentifier; +import io.cryostat.libcryostat.net.IDException; +import io.cryostat.libcryostat.net.MBeanMetrics; +import io.cryostat.libcryostat.net.MemoryMetrics; +import io.cryostat.libcryostat.net.OperatingSystemMetrics; +import io.cryostat.libcryostat.net.RuntimeMetrics; +import io.cryostat.libcryostat.net.ThreadMetrics; +import io.cryostat.libcryostat.sys.Clock; +import io.cryostat.libcryostat.sys.Environment; +import io.cryostat.libcryostat.sys.FileSystem; +import io.cryostat.libcryostat.tui.ClientWriter; public class JFRJMXConnection implements JFRConnection { diff --git a/src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java b/cryostat-core/src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java similarity index 99% rename from src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java rename to cryostat-core/src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java index 1023e1b9..34eb7c3b 100644 --- a/src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java +++ b/cryostat-core/src/main/java/io/cryostat/core/net/JmxFlightRecorderService.java @@ -40,8 +40,8 @@ import io.cryostat.core.EventOptionsBuilder; import io.cryostat.core.EventOptionsBuilder.EventOptionException; import io.cryostat.core.EventOptionsBuilder.EventTypeException; -import io.cryostat.core.templates.Template; -import io.cryostat.core.templates.TemplateType; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/io/cryostat/core/net/discovery/DiscoveredJvmDescriptor.java b/cryostat-core/src/main/java/io/cryostat/core/net/discovery/DiscoveredJvmDescriptor.java similarity index 100% rename from src/main/java/io/cryostat/core/net/discovery/DiscoveredJvmDescriptor.java rename to cryostat-core/src/main/java/io/cryostat/core/net/discovery/DiscoveredJvmDescriptor.java diff --git a/src/main/java/io/cryostat/core/net/discovery/JvmDiscoveryClient.java b/cryostat-core/src/main/java/io/cryostat/core/net/discovery/JvmDiscoveryClient.java similarity index 100% rename from src/main/java/io/cryostat/core/net/discovery/JvmDiscoveryClient.java rename to cryostat-core/src/main/java/io/cryostat/core/net/discovery/JvmDiscoveryClient.java diff --git a/src/main/java/io/cryostat/core/reports/InterruptibleReportGenerator.java b/cryostat-core/src/main/java/io/cryostat/core/reports/InterruptibleReportGenerator.java similarity index 100% rename from src/main/java/io/cryostat/core/reports/InterruptibleReportGenerator.java rename to cryostat-core/src/main/java/io/cryostat/core/reports/InterruptibleReportGenerator.java diff --git a/src/main/java/io/cryostat/core/serialization/SerializableRecordingDescriptor.java b/cryostat-core/src/main/java/io/cryostat/core/serialization/JmcSerializableRecordingDescriptor.java similarity index 58% rename from src/main/java/io/cryostat/core/serialization/SerializableRecordingDescriptor.java rename to cryostat-core/src/main/java/io/cryostat/core/serialization/JmcSerializableRecordingDescriptor.java index b7126556..7d49b150 100644 --- a/src/main/java/io/cryostat/core/serialization/SerializableRecordingDescriptor.java +++ b/cryostat-core/src/main/java/io/cryostat/core/serialization/JmcSerializableRecordingDescriptor.java @@ -25,64 +25,17 @@ import org.openjdk.jmc.flightrecorder.configuration.IRecordingDescriptor; import org.openjdk.jmc.flightrecorder.configuration.IRecordingDescriptor.RecordingState; -import jdk.jfr.Recording; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; - -public class SerializableRecordingDescriptor { - - protected long id; - protected String name; - protected RecordingState state; - protected long startTime; - protected long duration; - protected boolean continuous; - protected boolean toDisk; - protected long maxSize; - protected long maxAge; - - public SerializableRecordingDescriptor() {} - - public SerializableRecordingDescriptor( - long id, - String name, - RecordingState state, - long startTime, - long duration, - boolean continuous, - boolean toDisk, - long maxSize, - long maxAge) { - this.id = id; - this.name = name; - this.state = state; - this.startTime = startTime; - this.duration = duration; - this.continuous = continuous; - this.toDisk = toDisk; - this.maxSize = maxSize; - this.maxAge = maxAge; - } +import io.cryostat.libcryostat.serialization.SerializableRecordingDescriptor; - public SerializableRecordingDescriptor(Recording recording) { - this( - recording.getId(), - recording.getName(), - mapRecordingStateState(recording.getState()), - recording.getStartTime() == null ? 0 : recording.getStartTime().toEpochMilli(), - recording.getDuration() == null ? 0 : recording.getDuration().toMillis(), - recording.getDuration() == null, - recording.isToDisk(), - recording.getMaxSize(), - recording.getMaxAge() == null ? 0 : recording.getMaxAge().toMillis()); - } +public class JmcSerializableRecordingDescriptor extends SerializableRecordingDescriptor { + + public JmcSerializableRecordingDescriptor() {} - public SerializableRecordingDescriptor(IRecordingDescriptor orig) + public JmcSerializableRecordingDescriptor(IRecordingDescriptor orig) throws QuantityConversionException { this.id = orig.getId(); this.name = orig.getName(); - this.state = orig.getState(); + this.state = reverseMapRecordingState(orig.getState()); this.startTime = orig.getStartTime().longValueIn(UnitLookup.EPOCH_MS); this.duration = orig.getDuration().longValueIn(UnitLookup.MILLISECOND); this.continuous = orig.isContinuous(); @@ -91,7 +44,7 @@ public SerializableRecordingDescriptor(IRecordingDescriptor orig) this.maxAge = orig.getMaxAge().longValueIn(UnitLookup.MILLISECOND); } - public SerializableRecordingDescriptor(SerializableRecordingDescriptor o) { + public JmcSerializableRecordingDescriptor(JmcSerializableRecordingDescriptor o) { this.id = o.getId(); this.name = o.getName(); this.state = o.getState(); @@ -103,12 +56,10 @@ public SerializableRecordingDescriptor(SerializableRecordingDescriptor o) { this.maxAge = o.getMaxAge(); } - protected final void finalize() {} - /** * @see {@link org.openjdk.jmc.rjmx.services.jfr.internal.RecordingDescriptorV2#decideState} */ - private static RecordingState mapRecordingStateState(jdk.jfr.RecordingState s) { + private static RecordingState mapRecordingState(jdk.jfr.RecordingState s) { switch (s) { case NEW: return RecordingState.CREATED; @@ -125,6 +76,23 @@ private static RecordingState mapRecordingStateState(jdk.jfr.RecordingState s) { } } + private static jdk.jfr.RecordingState reverseMapRecordingState(RecordingState s) { + switch (s) { + case CREATED: + return jdk.jfr.RecordingState.NEW; + case RUNNING: + return jdk.jfr.RecordingState.RUNNING; + case STOPPED: + return jdk.jfr.RecordingState.STOPPED; + case STOPPING: + return jdk.jfr.RecordingState.RUNNING; + default: + // better not to return null here for NPE safety, but this may not always be + // accurate + return jdk.jfr.RecordingState.STOPPED; + } + } + public IRecordingDescriptor toJmcForm() { return new IRecordingDescriptor() { @@ -140,7 +108,7 @@ public String getName() { @Override public RecordingState getState() { - return state; + return mapRecordingState(JmcSerializableRecordingDescriptor.this.state); } @Override @@ -195,54 +163,7 @@ public IQuantity getMaxAge() { }; } - public long getId() { - return id; - } - - public String getName() { - return name; - } - - public RecordingState getState() { - return state; - } - - public long getStartTime() { - return startTime; - } - - public long getDuration() { - return duration; - } - - public boolean isContinuous() { - return continuous; - } - - public boolean getToDisk() { - return toDisk; - } - - public long getMaxSize() { - return maxSize; - } - - public long getMaxAge() { - return maxAge; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); + public RecordingState getJmcRecordingState() { + return mapRecordingState(this.state); } } diff --git a/src/main/java/io/cryostat/core/serialization/SerializableEventTypeInfo.java b/cryostat-core/src/main/java/io/cryostat/core/serialization/SerializableEventTypeInfo.java similarity index 100% rename from src/main/java/io/cryostat/core/serialization/SerializableEventTypeInfo.java rename to cryostat-core/src/main/java/io/cryostat/core/serialization/SerializableEventTypeInfo.java diff --git a/src/main/java/io/cryostat/core/serialization/SerializableOptionDescriptor.java b/cryostat-core/src/main/java/io/cryostat/core/serialization/SerializableOptionDescriptor.java similarity index 100% rename from src/main/java/io/cryostat/core/serialization/SerializableOptionDescriptor.java rename to cryostat-core/src/main/java/io/cryostat/core/serialization/SerializableOptionDescriptor.java diff --git a/src/main/java/io/cryostat/core/templates/AbstractTemplateService.java b/cryostat-core/src/main/java/io/cryostat/core/templates/AbstractTemplateService.java similarity index 95% rename from src/main/java/io/cryostat/core/templates/AbstractTemplateService.java rename to cryostat-core/src/main/java/io/cryostat/core/templates/AbstractTemplateService.java index 30deb5b9..21608bc8 100644 --- a/src/main/java/io/cryostat/core/templates/AbstractTemplateService.java +++ b/cryostat-core/src/main/java/io/cryostat/core/templates/AbstractTemplateService.java @@ -23,6 +23,8 @@ import org.openjdk.jmc.flightrecorder.configuration.model.xml.XMLTagInstance; import io.cryostat.core.FlightRecorderException; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; abstract class AbstractTemplateService implements TemplateService { diff --git a/src/main/java/io/cryostat/core/templates/MutableTemplateService.java b/cryostat-core/src/main/java/io/cryostat/core/templates/MutableTemplateService.java similarity index 81% rename from src/main/java/io/cryostat/core/templates/MutableTemplateService.java rename to cryostat-core/src/main/java/io/cryostat/core/templates/MutableTemplateService.java index 8b08ff5d..d4ec4961 100644 --- a/src/main/java/io/cryostat/core/templates/MutableTemplateService.java +++ b/cryostat-core/src/main/java/io/cryostat/core/templates/MutableTemplateService.java @@ -18,6 +18,9 @@ import java.io.IOException; import java.io.InputStream; +import io.cryostat.libcryostat.templates.InvalidEventTemplateException; +import io.cryostat.libcryostat.templates.Template; + public interface MutableTemplateService extends TemplateService { Template addTemplate(InputStream templateStream) @@ -40,15 +43,4 @@ public static class InvalidXmlException extends Exception { super(message); } } - - @SuppressWarnings("serial") - public static class InvalidEventTemplateException extends Exception { - public InvalidEventTemplateException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidEventTemplateException(String message) { - super(message); - } - } } diff --git a/src/main/java/io/cryostat/core/templates/RemoteTemplateService.java b/cryostat-core/src/main/java/io/cryostat/core/templates/RemoteTemplateService.java similarity index 98% rename from src/main/java/io/cryostat/core/templates/RemoteTemplateService.java rename to cryostat-core/src/main/java/io/cryostat/core/templates/RemoteTemplateService.java index 958a9a82..62ffc427 100644 --- a/src/main/java/io/cryostat/core/templates/RemoteTemplateService.java +++ b/cryostat-core/src/main/java/io/cryostat/core/templates/RemoteTemplateService.java @@ -31,6 +31,8 @@ import io.cryostat.core.FlightRecorderException; import io.cryostat.core.net.JFRConnection; +import io.cryostat.libcryostat.templates.MalformedXMLException; +import io.cryostat.libcryostat.templates.TemplateType; import org.jsoup.Jsoup; import org.jsoup.nodes.Element; diff --git a/src/main/java/io/cryostat/core/templates/TemplateService.java b/cryostat-core/src/main/java/io/cryostat/core/templates/TemplateService.java similarity index 93% rename from src/main/java/io/cryostat/core/templates/TemplateService.java rename to cryostat-core/src/main/java/io/cryostat/core/templates/TemplateService.java index b36d8285..ec84e491 100644 --- a/src/main/java/io/cryostat/core/templates/TemplateService.java +++ b/cryostat-core/src/main/java/io/cryostat/core/templates/TemplateService.java @@ -22,6 +22,8 @@ import org.openjdk.jmc.flightrecorder.configuration.events.EventOptionID; import io.cryostat.core.FlightRecorderException; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; public interface TemplateService { diff --git a/src/main/java/io/cryostat/core/util/CheckedConsumer.java b/cryostat-core/src/main/java/io/cryostat/core/util/CheckedConsumer.java similarity index 100% rename from src/main/java/io/cryostat/core/util/CheckedConsumer.java rename to cryostat-core/src/main/java/io/cryostat/core/util/CheckedConsumer.java diff --git a/src/main/java/io/cryostat/core/util/RuleFilterParser.java b/cryostat-core/src/main/java/io/cryostat/core/util/RuleFilterParser.java similarity index 100% rename from src/main/java/io/cryostat/core/util/RuleFilterParser.java rename to cryostat-core/src/main/java/io/cryostat/core/util/RuleFilterParser.java diff --git a/src/main/resources/config/logging.properties b/cryostat-core/src/main/resources/config/logging.properties similarity index 100% rename from src/main/resources/config/logging.properties rename to cryostat-core/src/main/resources/config/logging.properties diff --git a/src/main/resources/io/cryostat/core/agent/jfrprobes_schema.xsd b/cryostat-core/src/main/resources/io/cryostat/core/agent/jfrprobes_schema.xsd similarity index 100% rename from src/main/resources/io/cryostat/core/agent/jfrprobes_schema.xsd rename to cryostat-core/src/main/resources/io/cryostat/core/agent/jfrprobes_schema.xsd diff --git a/src/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v1.xsd b/cryostat-core/src/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v1.xsd similarity index 100% rename from src/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v1.xsd rename to cryostat-core/src/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v1.xsd diff --git a/src/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v2.xsd b/cryostat-core/src/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v2.xsd similarity index 100% rename from src/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v2.xsd rename to cryostat-core/src/main/resources/org/openjdk/jmc/flightrecorder/configuration/events/jfc_v2.xsd diff --git a/src/main/resources/org/openjdk/jmc/rjmx/subscription/internal/mrimetadata.xml b/cryostat-core/src/main/resources/org/openjdk/jmc/rjmx/subscription/internal/mrimetadata.xml similarity index 100% rename from src/main/resources/org/openjdk/jmc/rjmx/subscription/internal/mrimetadata.xml rename to cryostat-core/src/main/resources/org/openjdk/jmc/rjmx/subscription/internal/mrimetadata.xml diff --git a/src/main/resources/resultgroups.xml b/cryostat-core/src/main/resources/resultgroups.xml similarity index 100% rename from src/main/resources/resultgroups.xml rename to cryostat-core/src/main/resources/resultgroups.xml diff --git a/src/test/java/io/cryostat/core/EventOptionsCustomizerTest.java b/cryostat-core/src/test/java/io/cryostat/core/EventOptionsCustomizerTest.java similarity index 100% rename from src/test/java/io/cryostat/core/EventOptionsCustomizerTest.java rename to cryostat-core/src/test/java/io/cryostat/core/EventOptionsCustomizerTest.java diff --git a/src/test/java/io/cryostat/core/RecordingOptionsCustomizerTest.java b/cryostat-core/src/test/java/io/cryostat/core/RecordingOptionsCustomizerTest.java similarity index 98% rename from src/test/java/io/cryostat/core/RecordingOptionsCustomizerTest.java rename to cryostat-core/src/test/java/io/cryostat/core/RecordingOptionsCustomizerTest.java index 762d2752..6a12cede 100644 --- a/src/test/java/io/cryostat/core/RecordingOptionsCustomizerTest.java +++ b/cryostat-core/src/test/java/io/cryostat/core/RecordingOptionsCustomizerTest.java @@ -23,7 +23,7 @@ import org.openjdk.jmc.common.unit.QuantityConversionException; import org.openjdk.jmc.flightrecorder.configuration.recording.RecordingOptionsBuilder; -import io.cryostat.core.tui.ClientWriter; +import io.cryostat.libcryostat.tui.ClientWriter; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/io/cryostat/core/net/JFRConnectionToolkitTest.java b/cryostat-core/src/test/java/io/cryostat/core/net/JFRConnectionToolkitTest.java similarity index 95% rename from src/test/java/io/cryostat/core/net/JFRConnectionToolkitTest.java rename to cryostat-core/src/test/java/io/cryostat/core/net/JFRConnectionToolkitTest.java index 3ea8b9d3..f33fa465 100644 --- a/src/test/java/io/cryostat/core/net/JFRConnectionToolkitTest.java +++ b/cryostat-core/src/test/java/io/cryostat/core/net/JFRConnectionToolkitTest.java @@ -23,9 +23,9 @@ import org.openjdk.jmc.rjmx.common.internal.WrappedConnectionException; -import io.cryostat.core.sys.Environment; -import io.cryostat.core.sys.FileSystem; -import io.cryostat.core.tui.ClientWriter; +import io.cryostat.libcryostat.sys.Environment; +import io.cryostat.libcryostat.sys.FileSystem; +import io.cryostat.libcryostat.tui.ClientWriter; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/io/cryostat/core/net/discovery/JvmDiscoveryClientTest.java b/cryostat-core/src/test/java/io/cryostat/core/net/discovery/JvmDiscoveryClientTest.java similarity index 100% rename from src/test/java/io/cryostat/core/net/discovery/JvmDiscoveryClientTest.java rename to cryostat-core/src/test/java/io/cryostat/core/net/discovery/JvmDiscoveryClientTest.java diff --git a/src/test/java/io/cryostat/core/reports/InterruptibleReportGeneratorTest.java b/cryostat-core/src/test/java/io/cryostat/core/reports/InterruptibleReportGeneratorTest.java similarity index 100% rename from src/test/java/io/cryostat/core/reports/InterruptibleReportGeneratorTest.java rename to cryostat-core/src/test/java/io/cryostat/core/reports/InterruptibleReportGeneratorTest.java diff --git a/src/test/java/io/cryostat/core/templates/RemoteTemplateServiceTest.java b/cryostat-core/src/test/java/io/cryostat/core/templates/RemoteTemplateServiceTest.java similarity index 97% rename from src/test/java/io/cryostat/core/templates/RemoteTemplateServiceTest.java rename to cryostat-core/src/test/java/io/cryostat/core/templates/RemoteTemplateServiceTest.java index 8c4e1f2b..ca4c0753 100644 --- a/src/test/java/io/cryostat/core/templates/RemoteTemplateServiceTest.java +++ b/cryostat-core/src/test/java/io/cryostat/core/templates/RemoteTemplateServiceTest.java @@ -24,6 +24,8 @@ import io.cryostat.core.net.CryostatFlightRecorderService; import io.cryostat.core.net.JFRConnection; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import org.apache.commons.io.IOUtils; import org.hamcrest.MatcherAssert; diff --git a/src/test/java/io/cryostat/core/util/RuleFilterParserTest.java b/cryostat-core/src/test/java/io/cryostat/core/util/RuleFilterParserTest.java similarity index 100% rename from src/test/java/io/cryostat/core/util/RuleFilterParserTest.java rename to cryostat-core/src/test/java/io/cryostat/core/util/RuleFilterParserTest.java diff --git a/src/test/resources/io/cryostat/core/templates/multiword_label.jfc b/cryostat-core/src/test/resources/io/cryostat/core/templates/multiword_label.jfc similarity index 100% rename from src/test/resources/io/cryostat/core/templates/multiword_label.jfc rename to cryostat-core/src/test/resources/io/cryostat/core/templates/multiword_label.jfc diff --git a/src/test/resources/io/cryostat/core/templates/profile.jfc b/cryostat-core/src/test/resources/io/cryostat/core/templates/profile.jfc similarity index 100% rename from src/test/resources/io/cryostat/core/templates/profile.jfc rename to cryostat-core/src/test/resources/io/cryostat/core/templates/profile.jfc diff --git a/src/test/resources/profiling_sample.jfr b/cryostat-core/src/test/resources/profiling_sample.jfr similarity index 100% rename from src/test/resources/profiling_sample.jfr rename to cryostat-core/src/test/resources/profiling_sample.jfr diff --git a/libcryostat/.gitignore b/libcryostat/.gitignore new file mode 100644 index 00000000..bcc41a7f --- /dev/null +++ b/libcryostat/.gitignore @@ -0,0 +1,6 @@ +/build/ +/target/ +/bin/ +.classpath +.project +.settings/ diff --git a/libcryostat/LICENSE b/libcryostat/LICENSE new file mode 100644 index 00000000..45ab1462 --- /dev/null +++ b/libcryostat/LICENSE @@ -0,0 +1,13 @@ +Copyright The Cryostat Authors. + +Licensed 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. diff --git a/libcryostat/LICENSE.txt b/libcryostat/LICENSE.txt new file mode 100644 index 00000000..57bc88a1 --- /dev/null +++ b/libcryostat/LICENSE.txt @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/libcryostat/pom.xml b/libcryostat/pom.xml new file mode 100644 index 00000000..7928004a --- /dev/null +++ b/libcryostat/pom.xml @@ -0,0 +1,330 @@ + + + +4.0.0 + +libcryostat +Library containing interfaces and basic structures for Cryostat +https://github.com/cryostatio/cryostat-core +2024 + +io.cryostat +libcryostat + +4.0.0-SNAPSHOT +jar + + + io.cryostat + cryostat-core-parent + 4.0.0-SNAPSHOT + + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + Andrew Azores + aazores@redhat.com + Red Hat + https://www.redhat.com + + + Elliott Baron + ebaron@redhat.com + Red Hat + https://www.redhat.com + + + + + UTF-8 + 11 + ${java.version} + ${java.version} + + + + + org.apache.commons + commons-lang3 + + + commons-codec + commons-codec + + + com.github.spotbugs + spotbugs-annotations + provided + + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.hamcrest + hamcrest + test + + + org.mockito + mockito-junit-jupiter + test + + + org.mockito + mockito-inline + test + + + org.apache.commons + commons-text + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + io.smallrye + jandex-maven-plugin + + + make-index + + jandex + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + junit.jupiter.execution.parallel.enabled=true + junit.jupiter.execution.parallel.mode.default=same_thread + junit.jupiter.execution.parallel.mode.classes.default=concurrent + + + + + + com.github.spotbugs + spotbugs-maven-plugin + + io.cryostat.- + + + + spotbugs + verify + + check + + + + + + org.jacoco + jacoco-maven-plugin + + + + prepare-agent + + + + report + verify + + report + + + + + + com.diffplug.spotless + spotless-maven-plugin + + + spotless + verify + + check + + + + + + + 1.15.0 + + true + + + + + java,javax,io.cryostat, + + + + + + + org.apache.maven.plugins + maven-site-plugin + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + + com.mycila + license-maven-plugin + + + +
LICENSE
+ + src/main/java/io/cryostat/**/*.java + src/test/java/io/cryostat/**/*.java + +
+
+
+ + + update-license + + check + + process-sources + + +
+
+
+ + + + release + + + + org.jreleaser + jreleaser-maven-plugin + false + + + + ALWAYS + true + + + + + + ALWAYS + https://s01.oss.sonatype.org/service/local + https://s01.oss.sonatype.org/content/repositories/snapshots/ + true + true + target/staging-deploy + + + + + + + + + + + + + publication + + local::file:./target/staging-deploy + + + deploy + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + true + false + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar-no-fork + + + true + + + + + + + + + + + + + com.github.spotbugs + spotbugs-maven-plugin + + + org.jacoco + jacoco-maven-plugin + + + + report + + + + + + + +
diff --git a/src/main/java/io/cryostat/core/JvmIdentifier.java b/libcryostat/src/main/java/io/cryostat/libcryostat/JvmIdentifier.java similarity index 96% rename from src/main/java/io/cryostat/core/JvmIdentifier.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/JvmIdentifier.java index 14acf056..acd13465 100644 --- a/src/main/java/io/cryostat/core/JvmIdentifier.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/JvmIdentifier.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core; +package io.cryostat.libcryostat; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; @@ -23,8 +23,8 @@ import java.util.Base64; import java.util.Objects; -import io.cryostat.core.net.IDException; -import io.cryostat.core.net.RuntimeMetrics; +import io.cryostat.libcryostat.net.IDException; +import io.cryostat.libcryostat.net.RuntimeMetrics; import org.apache.commons.codec.digest.DigestUtils; diff --git a/src/main/java/io/cryostat/core/net/Credentials.java b/libcryostat/src/main/java/io/cryostat/libcryostat/net/Credentials.java similarity index 98% rename from src/main/java/io/cryostat/core/net/Credentials.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/net/Credentials.java index 3110386e..991042e2 100644 --- a/src/main/java/io/cryostat/core/net/Credentials.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/net/Credentials.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.net; +package io.cryostat.libcryostat.net; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; diff --git a/src/main/java/io/cryostat/core/net/IDException.java b/libcryostat/src/main/java/io/cryostat/libcryostat/net/IDException.java similarity index 95% rename from src/main/java/io/cryostat/core/net/IDException.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/net/IDException.java index a903f407..283c6013 100644 --- a/src/main/java/io/cryostat/core/net/IDException.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/net/IDException.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.net; +package io.cryostat.libcryostat.net; import java.io.IOException; diff --git a/src/main/java/io/cryostat/core/net/MBeanMetrics.java b/libcryostat/src/main/java/io/cryostat/libcryostat/net/MBeanMetrics.java similarity index 97% rename from src/main/java/io/cryostat/core/net/MBeanMetrics.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/net/MBeanMetrics.java index 290087c2..4cdf033c 100644 --- a/src/main/java/io/cryostat/core/net/MBeanMetrics.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/net/MBeanMetrics.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.net; +package io.cryostat.libcryostat.net; public class MBeanMetrics { diff --git a/src/main/java/io/cryostat/core/net/MemoryMetrics.java b/libcryostat/src/main/java/io/cryostat/libcryostat/net/MemoryMetrics.java similarity index 98% rename from src/main/java/io/cryostat/core/net/MemoryMetrics.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/net/MemoryMetrics.java index 95a13c4d..5befbcab 100644 --- a/src/main/java/io/cryostat/core/net/MemoryMetrics.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/net/MemoryMetrics.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.net; +package io.cryostat.libcryostat.net; import java.lang.management.MemoryUsage; import java.util.Map; diff --git a/src/main/java/io/cryostat/core/net/MemoryUtilization.java b/libcryostat/src/main/java/io/cryostat/libcryostat/net/MemoryUtilization.java similarity index 97% rename from src/main/java/io/cryostat/core/net/MemoryUtilization.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/net/MemoryUtilization.java index dc781585..5f853b95 100644 --- a/src/main/java/io/cryostat/core/net/MemoryUtilization.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/net/MemoryUtilization.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.net; +package io.cryostat.libcryostat.net; import java.lang.management.MemoryUsage; diff --git a/src/main/java/io/cryostat/core/net/OperatingSystemMetrics.java b/libcryostat/src/main/java/io/cryostat/libcryostat/net/OperatingSystemMetrics.java similarity index 99% rename from src/main/java/io/cryostat/core/net/OperatingSystemMetrics.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/net/OperatingSystemMetrics.java index 7b978210..d2e9ca3d 100644 --- a/src/main/java/io/cryostat/core/net/OperatingSystemMetrics.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/net/OperatingSystemMetrics.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.net; +package io.cryostat.libcryostat.net; import java.util.Map; diff --git a/src/main/java/io/cryostat/core/net/RuntimeMetrics.java b/libcryostat/src/main/java/io/cryostat/libcryostat/net/RuntimeMetrics.java similarity index 99% rename from src/main/java/io/cryostat/core/net/RuntimeMetrics.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/net/RuntimeMetrics.java index dc0c0f94..0d5c9998 100644 --- a/src/main/java/io/cryostat/core/net/RuntimeMetrics.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/net/RuntimeMetrics.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.net; +package io.cryostat.libcryostat.net; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; diff --git a/src/main/java/io/cryostat/core/net/ThreadMetrics.java b/libcryostat/src/main/java/io/cryostat/libcryostat/net/ThreadMetrics.java similarity index 99% rename from src/main/java/io/cryostat/core/net/ThreadMetrics.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/net/ThreadMetrics.java index 42ff6d41..df882fdd 100644 --- a/src/main/java/io/cryostat/core/net/ThreadMetrics.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/net/ThreadMetrics.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.net; +package io.cryostat.libcryostat.net; import java.util.Map; diff --git a/libcryostat/src/main/java/io/cryostat/libcryostat/serialization/SerializableRecordingDescriptor.java b/libcryostat/src/main/java/io/cryostat/libcryostat/serialization/SerializableRecordingDescriptor.java new file mode 100644 index 00000000..2ba01361 --- /dev/null +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/serialization/SerializableRecordingDescriptor.java @@ -0,0 +1,136 @@ +/* + * Copyright The Cryostat Authors. + * + * Licensed 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 io.cryostat.libcryostat.serialization; + +import jdk.jfr.Recording; +import jdk.jfr.RecordingState; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +public class SerializableRecordingDescriptor { + + protected long id; + protected String name; + protected RecordingState state; + protected long startTime; + protected long duration; + protected boolean continuous; + protected boolean toDisk; + protected long maxSize; + protected long maxAge; + + public SerializableRecordingDescriptor() {} + + public SerializableRecordingDescriptor( + long id, + String name, + RecordingState state, + long startTime, + long duration, + boolean continuous, + boolean toDisk, + long maxSize, + long maxAge) { + this.id = id; + this.name = name; + this.state = state; + this.startTime = startTime; + this.duration = duration; + this.continuous = continuous; + this.toDisk = toDisk; + this.maxSize = maxSize; + this.maxAge = maxAge; + } + + public SerializableRecordingDescriptor(Recording recording) { + this( + recording.getId(), + recording.getName(), + recording.getState(), + recording.getStartTime() == null ? 0 : recording.getStartTime().toEpochMilli(), + recording.getDuration() == null ? 0 : recording.getDuration().toMillis(), + recording.getDuration() == null, + recording.isToDisk(), + recording.getMaxSize(), + recording.getMaxAge() == null ? 0 : recording.getMaxAge().toMillis()); + } + + public SerializableRecordingDescriptor(SerializableRecordingDescriptor o) { + this.id = o.getId(); + this.name = o.getName(); + this.state = o.getState(); + this.startTime = o.getStartTime(); + this.duration = o.getDuration(); + this.continuous = o.isContinuous(); + this.toDisk = o.getToDisk(); + this.maxSize = o.getMaxSize(); + this.maxAge = o.getMaxAge(); + } + + protected final void finalize() {} + + public long getId() { + return id; + } + + public String getName() { + return name; + } + + public RecordingState getState() { + return state; + } + + public long getStartTime() { + return startTime; + } + + public long getDuration() { + return duration; + } + + public boolean isContinuous() { + return continuous; + } + + public boolean getToDisk() { + return toDisk; + } + + public long getMaxSize() { + return maxSize; + } + + public long getMaxAge() { + return maxAge; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o); + } +} diff --git a/src/main/java/io/cryostat/core/sys/Clock.java b/libcryostat/src/main/java/io/cryostat/libcryostat/sys/Clock.java similarity index 97% rename from src/main/java/io/cryostat/core/sys/Clock.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/sys/Clock.java index c4cc4d00..bcd1585f 100644 --- a/src/main/java/io/cryostat/core/sys/Clock.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/sys/Clock.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.sys; +package io.cryostat.libcryostat.sys; import java.time.Instant; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/io/cryostat/core/sys/Environment.java b/libcryostat/src/main/java/io/cryostat/libcryostat/sys/Environment.java similarity index 97% rename from src/main/java/io/cryostat/core/sys/Environment.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/sys/Environment.java index 94926826..fbc02831 100644 --- a/src/main/java/io/cryostat/core/sys/Environment.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/sys/Environment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.sys; +package io.cryostat.libcryostat.sys; import java.util.Map; diff --git a/src/main/java/io/cryostat/core/sys/FileSystem.java b/libcryostat/src/main/java/io/cryostat/libcryostat/sys/FileSystem.java similarity index 99% rename from src/main/java/io/cryostat/core/sys/FileSystem.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/sys/FileSystem.java index 1bd409ec..56fdd69d 100644 --- a/src/main/java/io/cryostat/core/sys/FileSystem.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/sys/FileSystem.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.sys; +package io.cryostat.libcryostat.sys; import java.io.BufferedReader; import java.io.IOException; diff --git a/libcryostat/src/main/java/io/cryostat/libcryostat/templates/InvalidEventTemplateException.java b/libcryostat/src/main/java/io/cryostat/libcryostat/templates/InvalidEventTemplateException.java new file mode 100644 index 00000000..a48aab7e --- /dev/null +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/templates/InvalidEventTemplateException.java @@ -0,0 +1,27 @@ +/* + * Copyright The Cryostat Authors. + * + * Licensed 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 io.cryostat.libcryostat.templates; + +@SuppressWarnings("serial") +public class InvalidEventTemplateException extends Exception { + public InvalidEventTemplateException(String message, Throwable cause) { + super(message, cause); + } + + public InvalidEventTemplateException(String message) { + super(message); + } +} diff --git a/src/main/java/io/cryostat/core/templates/MalformedXMLException.java b/libcryostat/src/main/java/io/cryostat/libcryostat/templates/MalformedXMLException.java similarity index 88% rename from src/main/java/io/cryostat/core/templates/MalformedXMLException.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/templates/MalformedXMLException.java index bf59bacc..e3f775b4 100644 --- a/src/main/java/io/cryostat/core/templates/MalformedXMLException.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/templates/MalformedXMLException.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.templates; +package io.cryostat.libcryostat.templates; public class MalformedXMLException extends RuntimeException { - MalformedXMLException(String reason) { + public MalformedXMLException(String reason) { super(reason); } } diff --git a/src/main/java/io/cryostat/core/templates/Template.java b/libcryostat/src/main/java/io/cryostat/libcryostat/templates/Template.java similarity index 98% rename from src/main/java/io/cryostat/core/templates/Template.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/templates/Template.java index a94f9fa8..4166a596 100644 --- a/src/main/java/io/cryostat/core/templates/Template.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/templates/Template.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.templates; +package io.cryostat.libcryostat.templates; import java.util.Objects; diff --git a/src/main/java/io/cryostat/core/templates/TemplateType.java b/libcryostat/src/main/java/io/cryostat/libcryostat/templates/TemplateType.java similarity index 93% rename from src/main/java/io/cryostat/core/templates/TemplateType.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/templates/TemplateType.java index 3a78363a..474b8e3c 100644 --- a/src/main/java/io/cryostat/core/templates/TemplateType.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/templates/TemplateType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.templates; +package io.cryostat.libcryostat.templates; public enum TemplateType { TARGET, diff --git a/src/main/java/io/cryostat/core/tui/ClientReader.java b/libcryostat/src/main/java/io/cryostat/libcryostat/tui/ClientReader.java similarity index 87% rename from src/main/java/io/cryostat/core/tui/ClientReader.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/tui/ClientReader.java index ba41e37b..dd91dc56 100644 --- a/src/main/java/io/cryostat/core/tui/ClientReader.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/tui/ClientReader.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.tui; +package io.cryostat.libcryostat.tui; import java.io.Closeable; -public interface ClientReader extends AutoCloseable, Closeable { +public interface ClientReader extends Closeable { String readLine(); } diff --git a/src/main/java/io/cryostat/core/tui/ClientWriter.java b/libcryostat/src/main/java/io/cryostat/libcryostat/tui/ClientWriter.java similarity index 96% rename from src/main/java/io/cryostat/core/tui/ClientWriter.java rename to libcryostat/src/main/java/io/cryostat/libcryostat/tui/ClientWriter.java index 66bc4d97..ca398723 100644 --- a/src/main/java/io/cryostat/core/tui/ClientWriter.java +++ b/libcryostat/src/main/java/io/cryostat/libcryostat/tui/ClientWriter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.tui; +package io.cryostat.libcryostat.tui; import org.apache.commons.lang3.exception.ExceptionUtils; diff --git a/src/test/java/io/cryostat/core/sys/ClockTest.java b/libcryostat/src/test/java/io/cryostat/libcryostat/sys/ClockTest.java similarity index 98% rename from src/test/java/io/cryostat/core/sys/ClockTest.java rename to libcryostat/src/test/java/io/cryostat/libcryostat/sys/ClockTest.java index dc3bbe4a..0332df62 100644 --- a/src/test/java/io/cryostat/core/sys/ClockTest.java +++ b/libcryostat/src/test/java/io/cryostat/libcryostat/sys/ClockTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.sys; +package io.cryostat.libcryostat.sys; import static org.junit.jupiter.api.Assertions.assertTimeout; diff --git a/src/test/java/io/cryostat/core/sys/EnvironmentTest.java b/libcryostat/src/test/java/io/cryostat/libcryostat/sys/EnvironmentTest.java similarity index 98% rename from src/test/java/io/cryostat/core/sys/EnvironmentTest.java rename to libcryostat/src/test/java/io/cryostat/libcryostat/sys/EnvironmentTest.java index 197fb043..b901d7b2 100644 --- a/src/test/java/io/cryostat/core/sys/EnvironmentTest.java +++ b/libcryostat/src/test/java/io/cryostat/libcryostat/sys/EnvironmentTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.cryostat.core.sys; +package io.cryostat.libcryostat.sys; import java.util.UUID; diff --git a/pom.xml b/pom.xml index d073d1a4..5ea0e001 100644 --- a/pom.xml +++ b/pom.xml @@ -4,16 +4,16 @@ 4.0.0 -Cryostat Core -Core library for Cryostat +Cryostat Core Parent +Parent POM - Core library for Cryostat https://github.com/cryostatio/cryostat-core 2019 io.cryostat -cryostat-core +cryostat-core-parent 4.0.0-SNAPSHOT -jar +pom @@ -44,15 +44,10 @@ - - - - jmc-libs - Adoptium JDK Mission Control Core Libraries - https://adoptium.jfrog.io/artifactory/jmc-libs - default - - + + cryostat-core + libcryostat + @@ -73,7 +68,6 @@ 17 ${java.version} ${java.version} - 9.0.0 3.1.8 3.13.0 @@ -86,7 +80,6 @@ 1.16.1 2.13.0 1.11.0 - 1.17.2 4.8.6 4.8.6.2 @@ -102,112 +95,74 @@ 1.11.0 - - - org.openjdk.jmc - common - ${org.openjdk.jmc.version} - - - org.openjdk.jmc - flightrecorder - ${org.openjdk.jmc.version} - - - org.openjdk.jmc - flightrecorder.configuration - ${org.openjdk.jmc.version} - - - org.openjdk.jmc - flightrecorder.rules - ${org.openjdk.jmc.version} - - - org.openjdk.jmc - flightrecorder.rules.jdk - ${org.openjdk.jmc.version} - - - org.openjdk.jmc - jdp - ${org.openjdk.jmc.version} - - - org.openjdk.jmc - rjmx.common - ${org.openjdk.jmc.version} - - - org.apache.commons - commons-lang3 - ${org.apache.commons.lang3.version} - - - commons-codec - commons-codec - ${org.apache.commons.codec.version} - - - commons-io - commons-io - ${org.apache.commons.io.version} - - - org.jsoup - jsoup - ${org.jsoup.version} - - - com.github.spotbugs - spotbugs-annotations - ${com.github.spotbugs.version} - provided - - - org.slf4j - slf4j-api - ${org.slf4j.version} - + + + + org.apache.commons + commons-lang3 + ${org.apache.commons.lang3.version} + + + commons-codec + commons-codec + ${org.apache.commons.codec.version} + + + commons-io + commons-io + ${org.apache.commons.io.version} + + + com.github.spotbugs + spotbugs-annotations + ${com.github.spotbugs.version} + provided + + + org.slf4j + slf4j-api + ${org.slf4j.version} + - - - org.junit.jupiter - junit-jupiter-api - ${org.junit.jupiter.version} - test - - - org.junit.jupiter - junit-jupiter-params - ${org.junit.jupiter.version} - test - - - org.hamcrest - hamcrest - ${org.hamcrest.version} - test - - - org.mockito - mockito-junit-jupiter - ${org.mockito.version} - test - - - org.mockito - mockito-inline - ${org.mockito.version} - test - - - org.apache.commons - commons-text - ${org.apache.commons.text.version} - test - - + + + org.junit.jupiter + junit-jupiter-api + ${org.junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${org.junit.jupiter.version} + test + + + org.hamcrest + hamcrest + ${org.hamcrest.version} + test + + + org.mockito + mockito-junit-jupiter + ${org.mockito.version} + test + + + org.mockito + mockito-inline + ${org.mockito.version} + test + + + org.apache.commons + commons-text + ${org.apache.commons.text.version} + test + + + @@ -375,7 +330,6 @@ ALWAYS https://s01.oss.sonatype.org/service/local https://s01.oss.sonatype.org/content/repositories/snapshots/ - false true true target/staging-deploy