Allow exporting all data in bson, json, or csv formats.

This commit is contained in:
MarkBryanMilligan
2022-01-29 18:25:19 -06:00
parent eeec6cc697
commit eaf1e4504f
117 changed files with 41205 additions and 10527 deletions

View File

@@ -28,10 +28,14 @@ public class LEDFlasher implements Runnable {
public static void setLEDOn(boolean _on) {
try {
if (_on)
if (_on) {
Runtime.getRuntime().exec(new String[]{"sh", "-c", "echo default-on > /sys/class/leds/led0/trigger"});
Runtime.getRuntime().exec(new String[]{"sh", "-c", "echo default-on > /sys/class/leds/led1/trigger"});
else
}
else {
Runtime.getRuntime().exec(new String[]{"sh", "-c", "echo none > /sys/class/leds/led0/trigger"});
Runtime.getRuntime().exec(new String[]{"sh", "-c", "echo none > /sys/class/leds/led1/trigger"});
}
}
catch (Exception _e) {
LOG.error("Failed to change LED state", _e);

View File

@@ -3,7 +3,7 @@ package com.lanternsoftware.currentmonitor;
import com.lanternsoftware.datamodel.currentmonitor.Breaker;
import com.lanternsoftware.util.CollectionUtils;
import com.lanternsoftware.util.LanternFiles;
import com.lanternsoftware.util.external.LanternFiles;
import com.lanternsoftware.util.ResourceLoader;
import com.lanternsoftware.util.dao.DaoSerializer;
@@ -23,6 +23,6 @@ public class CreateConfig {
b1.setPort(1);
b1.setSizeAmps(20);
c.setMqttBreakers(CollectionUtils.asArrayList(b1));
ResourceLoader.writeFile(LanternFiles.OPS_PATH + "mqtt1.json", DaoSerializer.toJson(c));
ResourceLoader.writeFile(LanternFiles.CONFIG_PATH + "mqtt1.json", DaoSerializer.toJson(c));
}
}

View File

@@ -1,11 +1,11 @@
package com.lanternsoftware.currentmonitor;
import com.lanternsoftware.util.LanternFiles;
import com.lanternsoftware.util.external.LanternFiles;
import com.lanternsoftware.util.dao.generator.DaoSerializerGenerator;
public class CurrentMonitorAppSerializers {
public static void main(String[] args) {
DaoSerializerGenerator.generateSerializers(LanternFiles.SOURCE_PATH + "currentmonitor", true, null);
DaoSerializerGenerator.generateSerializers(LanternFiles.SOURCE_CODE_PATH + "currentmonitor", true, null);
}
}

View File

@@ -1,6 +1,6 @@
package com.lanternsoftware.currentmonitor;
import com.lanternsoftware.util.LanternFiles;
import com.lanternsoftware.util.external.LanternFiles;
import com.lanternsoftware.util.ResourceLoader;
import com.lanternsoftware.util.dao.DaoEntity;
import com.lanternsoftware.util.dao.DaoSerializer;
@@ -9,18 +9,17 @@ import com.lanternsoftware.util.xml.XmlParser;
import org.apache.commons.codec.digest.DigestUtils;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
public class ReleaseCurrentMonitor {
public static void main(String[] args) {
XmlNode pom = XmlParser.loadXmlFile(LanternFiles.SOURCE_PATH + "currentmonitor" + File.separator + "lantern-currentmonitor" + File.separator + "pom.xml");
XmlNode pom = XmlParser.loadXmlFile(LanternFiles.SOURCE_CODE_PATH + "currentmonitor" + File.separator + "lantern-currentmonitor" + File.separator + "pom.xml");
if (pom == null)
return;
XmlNode versionNode = pom.getChild(Collections.singletonList("version"));
String version = versionNode.getContent();
ProcessBuilder builder = new ProcessBuilder();
builder.directory(new File(LanternFiles.SOURCE_PATH));
builder.directory(new File(LanternFiles.SOURCE_CODE_PATH));
builder.command("cmd.exe", "/c", "mvn clean install");
builder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
try {
@@ -30,9 +29,9 @@ public class ReleaseCurrentMonitor {
} catch (Exception _e) {
_e.printStackTrace();
}
byte[] jar = ResourceLoader.loadFile(LanternFiles.SOURCE_PATH + "currentmonitor" + File.separator + "lantern-currentmonitor" + File.separator + "target" + File.separator + "lantern-currentmonitor.jar");
byte[] jar = ResourceLoader.loadFile(LanternFiles.SOURCE_CODE_PATH + "currentmonitor" + File.separator + "lantern-currentmonitor" + File.separator + "target" + File.separator + "lantern-currentmonitor.jar");
DaoEntity meta = new DaoEntity("version", version).and("size", jar.length).and("checksum", DigestUtils.md5Hex(jar));
ResourceLoader.writeFile(LanternFiles.OPS_PATH + "release" + File.separator + "lantern-currentmonitor.jar", jar);
ResourceLoader.writeFile(LanternFiles.OPS_PATH + "release" + File.separator + "version.json", DaoSerializer.toJson(meta));
ResourceLoader.writeFile(LanternFiles.CONFIG_PATH + "release" + File.separator + "lantern-currentmonitor.jar", jar);
ResourceLoader.writeFile(LanternFiles.CONFIG_PATH + "release" + File.separator + "version.json", DaoSerializer.toJson(meta));
}
}