Split out core Hal stuff as plugins registered as "Hal Core"
This commit is contained in:
parent
0d0f0a4044
commit
9fd00f227a
2 changed files with 25 additions and 24 deletions
|
|
@ -1,12 +1,9 @@
|
||||||
package se.hal;
|
package se.hal;
|
||||||
|
|
||||||
|
|
||||||
import se.hal.deamon.PCDataSynchronizationClient;
|
|
||||||
import se.hal.deamon.PCDataSynchronizationDaemon;
|
|
||||||
import se.hal.deamon.SensorDataAggregatorDaemon;
|
|
||||||
import se.hal.deamon.SensorDataCleanupDaemon;
|
|
||||||
import se.hal.intf.HalDaemon;
|
import se.hal.intf.HalDaemon;
|
||||||
import se.hal.intf.HalHttpPage;
|
import se.hal.intf.HalHttpPage;
|
||||||
|
import se.hal.intf.HalJsonPage;
|
||||||
import se.hal.page.*;
|
import se.hal.page.*;
|
||||||
import se.hal.struct.Event;
|
import se.hal.struct.Event;
|
||||||
import se.hal.struct.Sensor;
|
import se.hal.struct.Sensor;
|
||||||
|
|
@ -56,14 +53,8 @@ public class HalServer {
|
||||||
|
|
||||||
// init daemons
|
// init daemons
|
||||||
daemons = new ArrayList<>();
|
daemons = new ArrayList<>();
|
||||||
daemons.addAll(Arrays.asList(new HalDaemon[]{
|
for (Iterator<HalDaemon> it=pluginManager.getObjectIterator(HalDaemon.class); it.hasNext(); )
|
||||||
new SensorDataAggregatorDaemon(),
|
|
||||||
new SensorDataCleanupDaemon(),
|
|
||||||
}));
|
|
||||||
for (Iterator<HalDaemon> it=pluginManager.getObjectIterator(HalDaemon.class);
|
|
||||||
it.hasNext(); ){
|
|
||||||
daemons.add(it.next());
|
daemons.add(it.next());
|
||||||
}
|
|
||||||
// We set only one thread for easier troubleshooting
|
// We set only one thread for easier troubleshooting
|
||||||
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
|
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
|
||||||
for(HalDaemon daemon : daemons){
|
for(HalDaemon daemon : daemons){
|
||||||
|
|
@ -75,20 +66,10 @@ public class HalServer {
|
||||||
HalHttpPage.getRootNav().createSubNav("Sensors");
|
HalHttpPage.getRootNav().createSubNav("Sensors");
|
||||||
HalHttpPage.getRootNav().createSubNav("Events").setWeight(100);
|
HalHttpPage.getRootNav().createSubNav("Events").setWeight(100);
|
||||||
pages = new ArrayList<>();
|
pages = new ArrayList<>();
|
||||||
pages.addAll(Arrays.asList(new HalHttpPage[]{
|
for (Iterator<HalHttpPage> it = pluginManager.getObjectIterator(HalJsonPage.class); it.hasNext(); )
|
||||||
new MapHttpPage(),
|
pages.add(it.next());
|
||||||
|
for (Iterator<HalHttpPage> it=pluginManager.getObjectIterator(HalHttpPage.class); it.hasNext(); )
|
||||||
new SensorOverviewHttpPage(),
|
|
||||||
new SensorConfigHttpPage(),
|
|
||||||
|
|
||||||
new EventOverviewHttpPage(),
|
|
||||||
new EventConfigHttpPage(),
|
|
||||||
new UserConfigHttpPage(),
|
|
||||||
}));
|
|
||||||
for (Iterator<HalHttpPage> it=pluginManager.getObjectIterator(HalHttpPage.class);
|
|
||||||
it.hasNext(); ){
|
|
||||||
pages.add(it.next());
|
pages.add(it.next());
|
||||||
}
|
|
||||||
|
|
||||||
HttpServer http = new HttpServer(HalContext.getIntegerProperty("http_port"));
|
HttpServer http = new HttpServer(HalContext.getIntegerProperty("http_port"));
|
||||||
http.setDefaultPage(new HttpFilePage(FileUtil.find("resource/web/")));
|
http.setDefaultPage(new HttpFilePage(FileUtil.find("resource/web/")));
|
||||||
|
|
|
||||||
20
src/se/hal/plugin.json
Executable file
20
src/se/hal/plugin.json
Executable file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"version": 1.0,
|
||||||
|
"name": "Hal Core",
|
||||||
|
"interfaces": [
|
||||||
|
{"se.hal.intf.HalDaemon": "se.hal.daemon.SensorDataAggregatorDaemon"},
|
||||||
|
{"se.hal.intf.HalDaemon": "se.hal.daemon.SensorDataCleanupDaemon"},
|
||||||
|
|
||||||
|
|
||||||
|
{"se.hal.intf.HalJsonPage": "se.hal.page.MapJsonPage"},
|
||||||
|
{"se.hal.intf.HalHttpPage": "se.hal.page.MapHttpPage"},
|
||||||
|
|
||||||
|
{"se.hal.intf.HalJsonPage": "se.hal.page.SensorJsonPage"},
|
||||||
|
{"se.hal.intf.HalHttpPage": "se.hal.page.SensorOverviewHttpPage"},
|
||||||
|
{"se.hal.intf.HalHttpPage": "se.hal.page.SensorConfigHttpPage"},
|
||||||
|
|
||||||
|
{"se.hal.intf.HalHttpPage": "se.hal.page.EventOverviewHttpPage"},
|
||||||
|
{"se.hal.intf.HalHttpPage": "se.hal.page.EventConfigHttpPage"},
|
||||||
|
{"se.hal.intf.HalHttpPage": "se.hal.page.UserConfigHttpPage"}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue