diff --git a/Hal.iml b/Hal.iml index 6da1b2e3..f6d22b8a 100755 --- a/Hal.iml +++ b/Hal.iml @@ -13,7 +13,10 @@ + + + diff --git a/plugins/hal-raspberry/src/se/hal/plugin/raspberry/plugin.json b/plugins/hal-raspberry/src/se/hal/plugin/raspberry/plugin.json index c6827be1..0a3a7ca8 100644 --- a/plugins/hal-raspberry/src/se/hal/plugin/raspberry/plugin.json +++ b/plugins/hal-raspberry/src/se/hal/plugin/raspberry/plugin.json @@ -1,6 +1,6 @@ { "version": 1.1, - "name": "Raspberry Pi Sensors", + "name": "Hal-RaspberryPi Sensors", "interfaces": [ {"se.hal.intf.HalSensorConfig": "se.hal.plugin.raspberry.RPiPowerConsumptionSensor"}, {"se.hal.intf.HalSensorConfig": "se.hal.plugin.raspberry.RPiTemperatureSensor"} diff --git a/plugins/hal-tellstick/src/se/hal/plugin/tellstick/plugin.json b/plugins/hal-tellstick/src/se/hal/plugin/tellstick/plugin.json index a4ddadbd..6032aef4 100644 --- a/plugins/hal-tellstick/src/se/hal/plugin/tellstick/plugin.json +++ b/plugins/hal-tellstick/src/se/hal/plugin/tellstick/plugin.json @@ -1,6 +1,6 @@ { "version": 1.0, - "name": "Tellstick", + "name": "Hal-Tellstick", "interfaces": [ {"se.hal.intf.HalAutoScannableController": "se.hal.plugin.tellstick.TellstickSerialComm"}, diff --git a/plugins/hal-zwave/src/se/hal/plugin/zwave/plugin.json b/plugins/hal-zwave/src/se/hal/plugin/zwave/plugin.json new file mode 100644 index 00000000..560ce9fe --- /dev/null +++ b/plugins/hal-zwave/src/se/hal/plugin/zwave/plugin.json @@ -0,0 +1,6 @@ +{ + "version": 1.0, + "name": "Hal-ZWwave", + "interfaces": [ + ] +} \ No newline at end of file diff --git a/resource/web/plugin_config.tmpl b/resource/web/plugin_config.tmpl new file mode 100644 index 00000000..64d2fe74 --- /dev/null +++ b/resource/web/plugin_config.tmpl @@ -0,0 +1,22 @@ +

Plugins

+ +
+
+
Local Events
+
+ + + + + + + {{#plugins}} + + + + + {{/plugins}} +
NameVersion
{{.getName()}}{{.getVersion()}}
+
+
+
\ No newline at end of file diff --git a/resource/web/properties_config.tmpl b/resource/web/property_config.tmpl similarity index 94% rename from resource/web/properties_config.tmpl rename to resource/web/property_config.tmpl index 6283b599..4ca54625 100644 --- a/resource/web/properties_config.tmpl +++ b/resource/web/property_config.tmpl @@ -1,4 +1,4 @@ -

Event Overview

+

Hal Properties

diff --git a/src/se/hal/HalServer.java b/src/se/hal/HalServer.java index 1b50c498..f35065aa 100755 --- a/src/se/hal/HalServer.java +++ b/src/se/hal/HalServer.java @@ -31,6 +31,8 @@ public class HalServer { private static HttpServer http; private static List pages = new ArrayList<>(); + private static PluginManager pluginManager; + public static void main(String[] args) throws Exception { @@ -40,7 +42,7 @@ public class HalServer { // init DB and other configurations HalContext.initialize(); DBConnection db = HalContext.getDB(); - PluginManager pluginManager = new PluginManager("./"); + pluginManager = new PluginManager("./"); // init Managers HalAlertManager.initialize(); @@ -85,6 +87,10 @@ public class HalServer { } + public static PluginManager getPluginManager() { + return pluginManager; + } + public static void registerDaemon(HalDaemon daemon){ daemons.add(daemon); daemon.initiate(daemonExecutor); diff --git a/src/se/hal/page/PluginConfigWebPage.java b/src/se/hal/page/PluginConfigWebPage.java new file mode 100644 index 00000000..9c7ba76f --- /dev/null +++ b/src/se/hal/page/PluginConfigWebPage.java @@ -0,0 +1,39 @@ +package se.hal.page; + +import se.hal.HalContext; +import se.hal.HalServer; +import se.hal.intf.HalWebPage; +import zutil.db.DBConnection; +import zutil.io.file.FileUtil; +import zutil.parser.Templator; +import zutil.plugin.PluginManager; + +import java.util.HashMap; +import java.util.Map; + +public class PluginConfigWebPage extends HalWebPage { + private static final String TEMPLATE = "resource/web/plugin_config.tmpl"; + + + public PluginConfigWebPage(){ + super("plugins"); + super.getRootNav().createSubNav("Settings").createSubNav(this.getId(), "Plugins").setWeight(100); + } + + @Override + public Templator httpRespond( + Map session, + Map cookie, + Map request) + throws Exception{ + + DBConnection db = HalContext.getDB(); + + PluginManager pluginManager = HalServer.getPluginManager(); + + Templator tmpl = new Templator(FileUtil.find(TEMPLATE)); + tmpl.set("plugins", pluginManager.toArray()); + return tmpl; + + } +} diff --git a/src/se/hal/page/PropertyConfigWebPage.java b/src/se/hal/page/PropertyConfigWebPage.java index cc0906ff..737d2524 100644 --- a/src/se/hal/page/PropertyConfigWebPage.java +++ b/src/se/hal/page/PropertyConfigWebPage.java @@ -9,7 +9,7 @@ import zutil.parser.Templator; import java.util.*; public class PropertyConfigWebPage extends HalWebPage { - private static final String TEMPLATE = "resource/web/properties_config.tmpl"; + private static final String TEMPLATE = "resource/web/property_config.tmpl"; public PropertyConfigWebPage(){ diff --git a/src/se/hal/plugin.json b/src/se/hal/plugin.json index ecd1aded..fa9f4635 100755 --- a/src/se/hal/plugin.json +++ b/src/se/hal/plugin.json @@ -16,7 +16,8 @@ {"se.hal.intf.HalWebPage": "se.hal.page.EventConfigWebPage"}, {"se.hal.intf.HalWebPage": "se.hal.page.TriggerWebPage"}, {"se.hal.intf.HalWebPage": "se.hal.page.UserConfigWebPage"}, - {"se.hal.intf.HalWebPage": "se.hal.page.PropertySettingsPage"}, + {"se.hal.intf.HalWebPage": "se.hal.page.PropertyConfigWebPage"}, + {"se.hal.intf.HalWebPage": "se.hal.page.PluginConfigWebPage"}, {"se.hal.intf.HalTrigger": "se.hal.trigger.DateTimeTrigger"},