File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
server/src/main/java/net/laprun/sustainability/power Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -53,4 +53,10 @@ public Duration samplingPeriod() {
5353 public List <Measure > measures (@ PathParam ("pid" ) String pid ) throws Exception {
5454 return Measure .forPID (Long .parseLong (pid ));
5555 }
56+
57+ @ GET
58+ @ Path ("pids" )
59+ public List <String > pids () {
60+ return Measure .all ().stream ().map (m -> "" + m .pid ).toList ();
61+ }
5662}
Original file line number Diff line number Diff line change @@ -16,4 +16,8 @@ public class Measure extends PanacheEntity {
1616 public static List <Measure > forPID (long pid ) {
1717 return find ("pid" , pid ).list ();
1818 }
19+
20+ public static List <Measure > all () {
21+ return Measure .findAll ().list ();
22+ }
1923}
Original file line number Diff line number Diff line change 1111
1212import io .quarkus .logging .Log ;
1313import io .quarkus .runtime .ShutdownEvent ;
14- import io .quarkus .runtime .StartupEvent ;
1514
1615public class SQLiteFilePersister {
1716 @ ConfigProperty (name = "quarkus.datasource.jdbc.url" )
@@ -20,9 +19,16 @@ public class SQLiteFilePersister {
2019 @ ConfigProperty (name = "power-server.db.location" )
2120 String fileName ;
2221
23- public void onStartup (@ Observes StartupEvent event ) {
24-
25- }
22+ // public void onStartup(@Observes StartupEvent event) {
23+ // Log.info("Restoring data from " + fileName);
24+ // try (
25+ // Connection connection = DriverManager.getConnection(jdbcUrl);
26+ // Statement statement = connection.createStatement()) {
27+ // statement.executeUpdate("restore from " + fileName);
28+ // } catch (SQLException e) {
29+ // e.printStackTrace(System.err);
30+ // }
31+ // }
2632
2733 public void onShutdown (@ Observes ShutdownEvent event ) {
2834 Log .info ("Saving data to " + fileName );
You can’t perform that action at this time.
0 commit comments