Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Jun 3, 2024
1 parent 5451637 commit a9cdb91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,19 @@
import io.cryostat.core.EventOptionsBuilder.EventOptionException;
import io.cryostat.core.EventOptionsBuilder.EventTypeException;
import io.cryostat.core.templates.Template;
import io.cryostat.core.templates.TemplateType;

public interface CryostatFlightRecorderService extends IFlightRecorderService {

IRecordingDescriptor start(
IConstrainedMap<String> recordingOptions,
String templateName,
TemplateType preferredTemplateType)
IRecordingDescriptor start(IConstrainedMap<String> recordingOptions, Template eventTemplate)
throws io.cryostat.core.FlightRecorderException, FlightRecorderException,
ConnectionException, IOException, FlightRecorderException,
ConnectionException, ParseException, IOException, FlightRecorderException,
ServiceNotAvailableException, QuantityConversionException, EventOptionException,
EventTypeException;

default IRecordingDescriptor start(
IConstrainedMap<String> recordingOptions, Template eventTemplate)
throws io.cryostat.core.FlightRecorderException, FlightRecorderException,
ConnectionException, IOException, FlightRecorderException,
ServiceNotAvailableException, QuantityConversionException, EventOptionException,
EventTypeException {
return start(recordingOptions, eventTemplate.getName(), eventTemplate.getType());
}

default IRecordingDescriptor start(IConstrainedMap<String> recordingOptions, String template)
throws FlightRecorderException, ParseException, IOException {
throws io.cryostat.core.FlightRecorderException, FlightRecorderException,
ConnectionException, ParseException, IOException, ServiceNotAvailableException,
QuantityConversionException, EventOptionException, EventTypeException {
XMLModel model = EventConfiguration.createModel(template);
IConstrainedMap<EventOptionID> eventOptions =
new EventConfiguration(model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,13 @@ public IDescribedMap<EventOptionID> getDefaultEventOptions() {
}

@Override
public IRecordingDescriptor start(
IConstrainedMap<String> recordingOptions,
String templateName,
TemplateType preferredTemplateType)
public IRecordingDescriptor start(IConstrainedMap<String> recordingOptions, Template template)
throws io.cryostat.core.FlightRecorderException, FlightRecorderException,
ConnectionException, IOException, FlightRecorderException,
ServiceNotAvailableException, QuantityConversionException, EventOptionException,
EventTypeException {
return tryConnect()
.start(recordingOptions, enableEvents(templateName, preferredTemplateType));
.start(recordingOptions, enableEvents(template.getName(), template.getType()));
}

private IConstrainedMap<EventOptionID> enableEvents(
Expand Down

0 comments on commit a9cdb91

Please sign in to comment.