diff --git a/pom.xml b/pom.xml index 88c506697f..e977731baa 100644 --- a/pom.xml +++ b/pom.xml @@ -115,6 +115,11 @@ cryostat-core ${io.cryostat.core.version} + + io.cryostat + libcryostat + ${io.cryostat.core.version} + org.openjdk.jmc common diff --git a/src/main/java/io/cryostat/Producers.java b/src/main/java/io/cryostat/Producers.java index 3b85044000..0358367531 100644 --- a/src/main/java/io/cryostat/Producers.java +++ b/src/main/java/io/cryostat/Producers.java @@ -20,8 +20,8 @@ import java.util.concurrent.ForkJoinPool; import io.cryostat.core.reports.InterruptibleReportGenerator; -import io.cryostat.core.sys.Clock; -import io.cryostat.core.sys.FileSystem; +import io.cryostat.libcryostat.sys.Clock; +import io.cryostat.libcryostat.sys.FileSystem; import io.quarkus.arc.DefaultBean; import io.vertx.mutiny.core.Vertx; diff --git a/src/main/java/io/cryostat/discovery/ContainerDiscovery.java b/src/main/java/io/cryostat/discovery/ContainerDiscovery.java index 3243b27a0d..7a0be8f0f5 100644 --- a/src/main/java/io/cryostat/discovery/ContainerDiscovery.java +++ b/src/main/java/io/cryostat/discovery/ContainerDiscovery.java @@ -38,7 +38,7 @@ import io.cryostat.ConfigProperties; import io.cryostat.core.net.JFRConnectionToolkit; -import io.cryostat.core.sys.FileSystem; +import io.cryostat.libcryostat.sys.FileSystem; import io.cryostat.targets.Target; import io.cryostat.targets.Target.Annotations; import io.cryostat.targets.Target.EventKind; diff --git a/src/main/java/io/cryostat/discovery/KubeApiDiscovery.java b/src/main/java/io/cryostat/discovery/KubeApiDiscovery.java index 5a57bfe5f9..c6ddcd3f25 100644 --- a/src/main/java/io/cryostat/discovery/KubeApiDiscovery.java +++ b/src/main/java/io/cryostat/discovery/KubeApiDiscovery.java @@ -32,7 +32,7 @@ import javax.management.remote.JMXServiceURL; -import io.cryostat.core.sys.FileSystem; +import io.cryostat.libcryostat.sys.FileSystem; import io.cryostat.targets.Target; import io.cryostat.targets.Target.Annotations; import io.cryostat.targets.Target.EventKind; diff --git a/src/main/java/io/cryostat/events/EventTemplates.java b/src/main/java/io/cryostat/events/EventTemplates.java index 72bba9b678..dade41164e 100644 --- a/src/main/java/io/cryostat/events/EventTemplates.java +++ b/src/main/java/io/cryostat/events/EventTemplates.java @@ -20,11 +20,11 @@ import java.util.ArrayList; import java.util.List; -import io.cryostat.core.sys.FileSystem; -import io.cryostat.core.templates.MutableTemplateService.InvalidEventTemplateException; import io.cryostat.core.templates.MutableTemplateService.InvalidXmlException; -import io.cryostat.core.templates.Template; -import io.cryostat.core.templates.TemplateType; +import io.cryostat.libcryostat.sys.FileSystem; +import io.cryostat.libcryostat.templates.InvalidEventTemplateException; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import io.cryostat.targets.Target; import io.cryostat.util.HttpMimeType; diff --git a/src/main/java/io/cryostat/events/S3TemplateService.java b/src/main/java/io/cryostat/events/S3TemplateService.java index d853450110..61e67ef79e 100644 --- a/src/main/java/io/cryostat/events/S3TemplateService.java +++ b/src/main/java/io/cryostat/events/S3TemplateService.java @@ -43,8 +43,9 @@ import io.cryostat.StorageBuckets; import io.cryostat.core.FlightRecorderException; import io.cryostat.core.templates.MutableTemplateService; -import io.cryostat.core.templates.Template; -import io.cryostat.core.templates.TemplateType; +import io.cryostat.libcryostat.templates.InvalidEventTemplateException; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import io.cryostat.ws.MessagingServer; import io.cryostat.ws.Notification; diff --git a/src/main/java/io/cryostat/events/TargetTemplateService.java b/src/main/java/io/cryostat/events/TargetTemplateService.java index 6d7afe9131..7ab7d7ce61 100644 --- a/src/main/java/io/cryostat/events/TargetTemplateService.java +++ b/src/main/java/io/cryostat/events/TargetTemplateService.java @@ -22,9 +22,9 @@ import org.openjdk.jmc.flightrecorder.configuration.events.EventOptionID; import io.cryostat.core.FlightRecorderException; -import io.cryostat.core.templates.Template; import io.cryostat.core.templates.TemplateService; -import io.cryostat.core.templates.TemplateType; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import io.cryostat.targets.Target; import io.cryostat.targets.TargetConnectionManager; diff --git a/src/main/java/io/cryostat/graphql/ActiveRecordings.java b/src/main/java/io/cryostat/graphql/ActiveRecordings.java index a9877ee20a..0bb85bd7ec 100644 --- a/src/main/java/io/cryostat/graphql/ActiveRecordings.java +++ b/src/main/java/io/cryostat/graphql/ActiveRecordings.java @@ -27,13 +27,13 @@ import org.openjdk.jmc.common.unit.QuantityConversionException; import io.cryostat.ConfigProperties; -import io.cryostat.core.templates.Template; -import io.cryostat.core.templates.TemplateType; import io.cryostat.discovery.DiscoveryNode; import io.cryostat.graphql.RootNode.DiscoveryNodeFilter; import io.cryostat.graphql.TargetNodes.AggregateInfo; import io.cryostat.graphql.TargetNodes.Recordings; import io.cryostat.graphql.matchers.LabelSelectorMatcher; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import io.cryostat.recordings.ActiveRecording; import io.cryostat.recordings.RecordingHelper; import io.cryostat.recordings.RecordingHelper.RecordingOptions; diff --git a/src/main/java/io/cryostat/graphql/TargetNodes.java b/src/main/java/io/cryostat/graphql/TargetNodes.java index 7c77c68a88..f2f0e3dbcb 100644 --- a/src/main/java/io/cryostat/graphql/TargetNodes.java +++ b/src/main/java/io/cryostat/graphql/TargetNodes.java @@ -20,11 +20,11 @@ import java.util.Objects; import io.cryostat.core.net.JFRConnection; -import io.cryostat.core.net.MBeanMetrics; import io.cryostat.discovery.DiscoveryNode; import io.cryostat.graphql.ActiveRecordings.ActiveRecordingsFilter; import io.cryostat.graphql.ArchivedRecordings.ArchivedRecordingsFilter; import io.cryostat.graphql.RootNode.DiscoveryNodeFilter; +import io.cryostat.libcryostat.net.MBeanMetrics; import io.cryostat.recordings.ActiveRecording; import io.cryostat.recordings.RecordingHelper; import io.cryostat.recordings.Recordings.ArchivedRecording; diff --git a/src/main/java/io/cryostat/jmcagent/JMCAgent.java b/src/main/java/io/cryostat/jmcagent/JMCAgent.java index 15f74ec2ca..18cb2147cf 100644 --- a/src/main/java/io/cryostat/jmcagent/JMCAgent.java +++ b/src/main/java/io/cryostat/jmcagent/JMCAgent.java @@ -27,7 +27,7 @@ import io.cryostat.core.jmcagent.JMCAgentJMXHelper; import io.cryostat.core.jmcagent.JMCAgentJMXHelper.ProbeDefinitionException; import io.cryostat.core.jmcagent.ProbeTemplate; -import io.cryostat.core.sys.FileSystem; +import io.cryostat.libcryostat.sys.FileSystem; import io.cryostat.targets.Target; import io.cryostat.targets.TargetConnectionManager; import io.cryostat.ws.MessagingServer; diff --git a/src/main/java/io/cryostat/recordings/RecordingHelper.java b/src/main/java/io/cryostat/recordings/RecordingHelper.java index 8bc6bfc83e..1b96f15b34 100644 --- a/src/main/java/io/cryostat/recordings/RecordingHelper.java +++ b/src/main/java/io/cryostat/recordings/RecordingHelper.java @@ -59,13 +59,13 @@ import io.cryostat.core.EventOptionsBuilder; import io.cryostat.core.FlightRecorderException; import io.cryostat.core.net.JFRConnection; -import io.cryostat.core.sys.Clock; -import io.cryostat.core.sys.FileSystem; -import io.cryostat.core.templates.Template; -import io.cryostat.core.templates.TemplateType; import io.cryostat.events.EventTemplates; import io.cryostat.events.S3TemplateService; import io.cryostat.events.TargetTemplateService; +import io.cryostat.libcryostat.sys.Clock; +import io.cryostat.libcryostat.sys.FileSystem; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import io.cryostat.recordings.ActiveRecording.Listener.ActiveRecordingEvent; import io.cryostat.recordings.ActiveRecording.Listener.ArchivedRecordingEvent; import io.cryostat.recordings.Recordings.ArchivedRecording; diff --git a/src/main/java/io/cryostat/recordings/Recordings.java b/src/main/java/io/cryostat/recordings/Recordings.java index f232e304bd..bcd408129e 100644 --- a/src/main/java/io/cryostat/recordings/Recordings.java +++ b/src/main/java/io/cryostat/recordings/Recordings.java @@ -44,9 +44,9 @@ import io.cryostat.V2Response; import io.cryostat.core.EventOptionsBuilder; import io.cryostat.core.RecordingOptionsCustomizer; -import io.cryostat.core.sys.Clock; -import io.cryostat.core.templates.Template; -import io.cryostat.core.templates.TemplateType; +import io.cryostat.libcryostat.sys.Clock; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import io.cryostat.recordings.ActiveRecording.Listener.ArchivedRecordingEvent; import io.cryostat.recordings.RecordingHelper.RecordingOptions; import io.cryostat.recordings.RecordingHelper.RecordingReplace; diff --git a/src/main/java/io/cryostat/rules/RuleService.java b/src/main/java/io/cryostat/rules/RuleService.java index 7b2e2b3f1d..5859766cac 100644 --- a/src/main/java/io/cryostat/rules/RuleService.java +++ b/src/main/java/io/cryostat/rules/RuleService.java @@ -25,9 +25,9 @@ import java.util.stream.Collectors; import io.cryostat.ConfigProperties; -import io.cryostat.core.templates.Template; -import io.cryostat.core.templates.TemplateType; import io.cryostat.expressions.MatchExpressionEvaluator; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import io.cryostat.recordings.ActiveRecording; import io.cryostat.recordings.RecordingHelper; import io.cryostat.recordings.RecordingHelper.RecordingOptions; diff --git a/src/main/java/io/cryostat/targets/AgentClient.java b/src/main/java/io/cryostat/targets/AgentClient.java index 296e1e81cf..146d96ab99 100644 --- a/src/main/java/io/cryostat/targets/AgentClient.java +++ b/src/main/java/io/cryostat/targets/AgentClient.java @@ -36,10 +36,10 @@ import org.openjdk.jmc.flightrecorder.configuration.internal.EventTypeIDV2; import io.cryostat.ConfigProperties; -import io.cryostat.core.net.MBeanMetrics; -import io.cryostat.core.serialization.SerializableRecordingDescriptor; +import io.cryostat.core.serialization.JmcSerializableRecordingDescriptor; import io.cryostat.credentials.Credential; import io.cryostat.discovery.DiscoveryPlugin; +import io.cryostat.libcryostat.net.MBeanMetrics; import io.cryostat.targets.AgentJFRService.StartRecordingRequest; import io.cryostat.util.HttpStatusCodeIdentifier; @@ -123,7 +123,8 @@ Uni startRecording(StartRecordingRequest req) { String body = resp.body(); return mapper.readValue( body, - SerializableRecordingDescriptor.class) + JmcSerializableRecordingDescriptor + .class) .toJmcForm(); } else if (statusCode == 403) { logger.errorv( @@ -163,7 +164,8 @@ Uni startSnapshot() { String body = resp.body(); return mapper.readValue( body, - SerializableRecordingDescriptor.class) + JmcSerializableRecordingDescriptor + .class) .toJmcForm(); } else if (statusCode == 403) { throw new ForbiddenException( @@ -305,13 +307,17 @@ Uni> activeRecordings() { return mapper.readValue( s, new TypeReference< - List>() {}); + List>() {}); } catch (JsonProcessingException e) { logger.error(e); - return List.of(); + return List.of(); } }) - .map(arr -> arr.stream().map(SerializableRecordingDescriptor::toJmcForm).toList()); + .map( + arr -> + arr.stream() + .map(JmcSerializableRecordingDescriptor::toJmcForm) + .toList()); } Uni> eventTypes() { diff --git a/src/main/java/io/cryostat/targets/AgentConnection.java b/src/main/java/io/cryostat/targets/AgentConnection.java index 27cac84816..658b93a5f3 100644 --- a/src/main/java/io/cryostat/targets/AgentConnection.java +++ b/src/main/java/io/cryostat/targets/AgentConnection.java @@ -28,15 +28,15 @@ import org.openjdk.jmc.rjmx.common.IConnectionHandle; import org.openjdk.jmc.rjmx.common.ServiceNotAvailableException; -import io.cryostat.core.JvmIdentifier; import io.cryostat.core.net.CryostatFlightRecorderService; -import io.cryostat.core.net.IDException; import io.cryostat.core.net.JFRConnection; -import io.cryostat.core.net.MBeanMetrics; -import io.cryostat.core.sys.Clock; import io.cryostat.core.templates.RemoteTemplateService; import io.cryostat.core.templates.TemplateService; import io.cryostat.events.S3TemplateService; +import io.cryostat.libcryostat.JvmIdentifier; +import io.cryostat.libcryostat.net.IDException; +import io.cryostat.libcryostat.net.MBeanMetrics; +import io.cryostat.libcryostat.sys.Clock; import io.smallrye.common.annotation.Blocking; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/cryostat/targets/AgentJFRService.java b/src/main/java/io/cryostat/targets/AgentJFRService.java index b54949aa92..c96cf83304 100644 --- a/src/main/java/io/cryostat/targets/AgentJFRService.java +++ b/src/main/java/io/cryostat/targets/AgentJFRService.java @@ -47,9 +47,9 @@ import io.cryostat.core.EventOptionsBuilder.EventOptionException; import io.cryostat.core.EventOptionsBuilder.EventTypeException; import io.cryostat.core.net.CryostatFlightRecorderService; -import io.cryostat.core.templates.Template; import io.cryostat.core.templates.TemplateService; -import io.cryostat.core.templates.TemplateType; +import io.cryostat.libcryostat.templates.Template; +import io.cryostat.libcryostat.templates.TemplateType; import io.smallrye.common.annotation.Blocking; import io.smallrye.mutiny.Uni; diff --git a/src/main/java/io/cryostat/targets/Target.java b/src/main/java/io/cryostat/targets/Target.java index 89f902940f..f24f9af7cb 100644 --- a/src/main/java/io/cryostat/targets/Target.java +++ b/src/main/java/io/cryostat/targets/Target.java @@ -31,11 +31,11 @@ import java.util.stream.Collectors; import io.cryostat.ConfigProperties; -import io.cryostat.core.JvmIdentifier; import io.cryostat.core.net.JFRConnection; import io.cryostat.credentials.Credential; import io.cryostat.discovery.DiscoveryNode; import io.cryostat.expressions.MatchExpressionEvaluator; +import io.cryostat.libcryostat.JvmIdentifier; import io.cryostat.recordings.ActiveRecording; import io.cryostat.recordings.RecordingHelper; import io.cryostat.ws.MessagingServer; diff --git a/src/main/java/io/cryostat/targets/TargetConnectionManager.java b/src/main/java/io/cryostat/targets/TargetConnectionManager.java index 16a3466f15..51c3ca36dc 100644 --- a/src/main/java/io/cryostat/targets/TargetConnectionManager.java +++ b/src/main/java/io/cryostat/targets/TargetConnectionManager.java @@ -324,7 +324,10 @@ JFRConnection connect(URI connectUrl, Optional credentials) throws E return jfrConnectionToolkit.connect( new JMXServiceURL(connectUrl.toString()), credentials - .map(c -> new io.cryostat.core.net.Credentials(c.username, c.password)) + .map( + c -> + new io.cryostat.libcryostat.net.Credentials( + c.username, c.password)) .orElse(null), Collections.singletonList( () -> connections.synchronous().invalidate(connectUrl))); diff --git a/src/main/java/io/cryostat/targets/TargetsModule.java b/src/main/java/io/cryostat/targets/TargetsModule.java index 570eaff510..7191722d95 100644 --- a/src/main/java/io/cryostat/targets/TargetsModule.java +++ b/src/main/java/io/cryostat/targets/TargetsModule.java @@ -16,8 +16,8 @@ package io.cryostat.targets; import io.cryostat.core.net.JFRConnectionToolkit; -import io.cryostat.core.sys.Environment; -import io.cryostat.core.sys.FileSystem; +import io.cryostat.libcryostat.sys.Environment; +import io.cryostat.libcryostat.sys.FileSystem; import io.quarkus.arc.DefaultBean; import jakarta.enterprise.inject.Produces; diff --git a/src/test/java/itest/util/Utils.java b/src/test/java/itest/util/Utils.java index 3bfcb6dcf9..02468a44e9 100644 --- a/src/test/java/itest/util/Utils.java +++ b/src/test/java/itest/util/Utils.java @@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import io.cryostat.core.sys.Environment; +import io.cryostat.libcryostat.sys.Environment; import io.vertx.core.MultiMap; import io.vertx.core.Vertx;