Skip to content

Commit

Permalink
chore(libcryostat): clean up to use libcryostat dependency (cryostati…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores authored Jul 19, 2024
1 parent c25c4a7 commit 7453104
Show file tree
Hide file tree
Showing 20 changed files with 58 additions and 43 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
<artifactId>cryostat-core</artifactId>
<version>${io.cryostat.core.version}</version>
</dependency>
<dependency>
<groupId>io.cryostat</groupId>
<artifactId>libcryostat</artifactId>
<version>${io.cryostat.core.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmc</groupId>
<artifactId>common</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/Producers.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/cryostat/discovery/KubeApiDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/io/cryostat/events/EventTemplates.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/cryostat/events/S3TemplateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/events/TargetTemplateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/graphql/ActiveRecordings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/cryostat/graphql/TargetNodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/cryostat/jmcagent/JMCAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/io/cryostat/recordings/RecordingHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/cryostat/recordings/Recordings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/rules/RuleService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 13 additions & 7 deletions src/main/java/io/cryostat/targets/AgentClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -123,7 +123,8 @@ Uni<IRecordingDescriptor> startRecording(StartRecordingRequest req) {
String body = resp.body();
return mapper.readValue(
body,
SerializableRecordingDescriptor.class)
JmcSerializableRecordingDescriptor
.class)
.toJmcForm();
} else if (statusCode == 403) {
logger.errorv(
Expand Down Expand Up @@ -163,7 +164,8 @@ Uni<IRecordingDescriptor> startSnapshot() {
String body = resp.body();
return mapper.readValue(
body,
SerializableRecordingDescriptor.class)
JmcSerializableRecordingDescriptor
.class)
.toJmcForm();
} else if (statusCode == 403) {
throw new ForbiddenException(
Expand Down Expand Up @@ -305,13 +307,17 @@ Uni<List<IRecordingDescriptor>> activeRecordings() {
return mapper.readValue(
s,
new TypeReference<
List<SerializableRecordingDescriptor>>() {});
List<JmcSerializableRecordingDescriptor>>() {});
} catch (JsonProcessingException e) {
logger.error(e);
return List.<SerializableRecordingDescriptor>of();
return List.<JmcSerializableRecordingDescriptor>of();
}
})
.map(arr -> arr.stream().map(SerializableRecordingDescriptor::toJmcForm).toList());
.map(
arr ->
arr.stream()
.map(JmcSerializableRecordingDescriptor::toJmcForm)
.toList());
}

Uni<Collection<? extends IEventTypeInfo>> eventTypes() {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/io/cryostat/targets/AgentConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/targets/AgentJFRService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/cryostat/targets/Target.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ JFRConnection connect(URI connectUrl, Optional<Credential> 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)));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/targets/TargetsModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/itest/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7453104

Please sign in to comment.