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() {
53
53
public List <Measure > measures (@ PathParam ("pid" ) String pid ) throws Exception {
54
54
return Measure .forPID (Long .parseLong (pid ));
55
55
}
56
+
57
+ @ GET
58
+ @ Path ("pids" )
59
+ public List <String > pids () {
60
+ return Measure .all ().stream ().map (m -> "" + m .pid ).toList ();
61
+ }
56
62
}
Original file line number Diff line number Diff line change @@ -16,4 +16,8 @@ public class Measure extends PanacheEntity {
16
16
public static List <Measure > forPID (long pid ) {
17
17
return find ("pid" , pid ).list ();
18
18
}
19
+
20
+ public static List <Measure > all () {
21
+ return Measure .findAll ().list ();
22
+ }
19
23
}
Original file line number Diff line number Diff line change 11
11
12
12
import io .quarkus .logging .Log ;
13
13
import io .quarkus .runtime .ShutdownEvent ;
14
- import io .quarkus .runtime .StartupEvent ;
15
14
16
15
public class SQLiteFilePersister {
17
16
@ ConfigProperty (name = "quarkus.datasource.jdbc.url" )
@@ -20,9 +19,16 @@ public class SQLiteFilePersister {
20
19
@ ConfigProperty (name = "power-server.db.location" )
21
20
String fileName ;
22
21
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
+ // }
26
32
27
33
public void onShutdown (@ Observes ShutdownEvent event ) {
28
34
Log .info ("Saving data to " + fileName );
You can’t perform that action at this time.
0 commit comments