Skip to content

Commit

Permalink
use GoalSource instead of string for additional context
Browse files Browse the repository at this point in the history
  • Loading branch information
skovati committed Sep 5, 2024
1 parent ee3b359 commit 5cb7cee
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import java.nio.file.Path;

public sealed interface GoalType {
record EDSL(String source) implements GoalType {}
record EDSL(GoalSource source) implements GoalType {}
record JAR(Path path, String args) implements GoalType {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/*package-local*/ final class GetSchedulingGoalAction implements AutoCloseable {
Expand Down Expand Up @@ -44,7 +42,7 @@ public Optional<GoalRecord> get(final GoalId goalId) throws SQLException {
return Optional.of(new GoalRecord(
goalId,
name,
type.equals("JAR") ? new GoalType.JAR(Path.of(path), "" /* TODO this is a property of the specification, not the goal */) : new GoalType.EDSL(definition),
type.equals("JAR") ? new GoalType.JAR(Path.of(path), "" /* TODO this is a property of the specification, not the goal */) : new GoalType.EDSL(new GoalSource(definition)),
true // TODO this is not a property of the goal, but rather of the specification
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public List<GoalRecord> get(final long specificationId) throws SQLException {
goals.add(new GoalRecord(
new GoalId(id, revision, Optional.of(goalInvocationId)),
name,
type.equals("JAR") ? new GoalType.JAR(Path.of(path), args) : new GoalType.EDSL(definition),
type.equals("JAR") ? new GoalType.JAR(Path.of(path), args) : new GoalType.EDSL(new GoalSource(definition)),
simulateAfter
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import gov.nasa.jpl.aerie.scheduler.server.models.ExternalProfiles;
import gov.nasa.jpl.aerie.scheduler.server.models.GoalId;
import gov.nasa.jpl.aerie.scheduler.server.models.GoalRecord;
import gov.nasa.jpl.aerie.scheduler.server.models.GoalSource;
import gov.nasa.jpl.aerie.scheduler.server.models.GoalType;
import gov.nasa.jpl.aerie.scheduler.server.models.MerlinPlan;
import gov.nasa.jpl.aerie.scheduler.server.models.PlanId;
Expand Down Expand Up @@ -361,14 +362,14 @@ private Optional<DatasetId> storeSimulationResults(
private static SchedulingDSLCompilationService.SchedulingDSLCompilationResult<SchedulingDSL.GoalSpecifier> compileGoalDefinition(
final MerlinDatabaseService.ReaderRole merlinDatabaseService,
final PlanId planId,
final String source,
final GoalSource source,
final SchedulingDSLCompilationService schedulingDSLCompilationService,
final Collection<ResourceType> additionalResourceTypes)
{
return schedulingDSLCompilationService.compileSchedulingGoalDSL(
merlinDatabaseService,
planId,
source,
source.source(),
additionalResourceTypes
);
}
Expand Down

0 comments on commit 5cb7cee

Please sign in to comment.