Fixed resource path issues with gradle
This commit is contained in:
parent
b405f0b191
commit
64f2f598df
178 changed files with 52224 additions and 112 deletions
|
|
@ -24,8 +24,20 @@ public class HalContext {
|
|||
public static final String PROPERTY_HTTP_PORT = "hal.http_port";
|
||||
public static final String PROPERTY_MAP_BACKGROUND_IMAGE = "hal.map_bgimage";
|
||||
|
||||
private static final String CONF_FILE = "hal.conf";
|
||||
private static final String DB_FILE = "hal.db";
|
||||
public static final String RESOURCE_ROOT;
|
||||
static {
|
||||
if (FileUtil.find("build/resources/") != null)
|
||||
RESOURCE_ROOT = "build/resources";
|
||||
else if (FileUtil.find("resource/resource/") != null)
|
||||
RESOURCE_ROOT = "resource";
|
||||
else
|
||||
RESOURCE_ROOT = ".";
|
||||
}
|
||||
|
||||
public static final String RESOURCE_WEB_ROOT = HalContext.RESOURCE_ROOT + "/resource/web";
|
||||
|
||||
private static final String CONF_FILE = "hal.conf";
|
||||
private static final String DB_FILE = "hal.db";
|
||||
private static final String DEFAULT_DB_FILE = "hal-default.db";
|
||||
|
||||
// Variables
|
||||
|
|
|
|||
|
|
@ -121,12 +121,8 @@ public class HalServer {
|
|||
HalWebPage.getRootNav().createSubNav("Events").setWeight(100);
|
||||
HalWebPage.getRootNav().createSubNav("Settings").setWeight(200);
|
||||
|
||||
File webResourceRoot = FileUtil.find("hal-core/resource/resource/web/");
|
||||
if (webResourceRoot == null)
|
||||
webResourceRoot = FileUtil.find("resource/web/");
|
||||
|
||||
http = new HttpServer(HalContext.getIntegerProperty(HalContext.PROPERTY_HTTP_PORT));
|
||||
http.setDefaultPage(new HttpFilePage(webResourceRoot));
|
||||
http.setDefaultPage(new HttpFilePage(FileUtil.find(HalContext.RESOURCE_WEB_ROOT)));
|
||||
http.setPage("/", new HttpRedirectPage("/map"));
|
||||
http.setPage(HalAlertManager.getInstance().getUrl(), HalAlertManager.getInstance());
|
||||
for (Iterator<HalWebPage> it = pluginManager.getSingletonIterator(HalJsonPage.class); it.hasNext(); )
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
public abstract class HalWebPage implements HttpPage{
|
||||
private static final String TEMPLATE = "resource/web/main_index.tmpl";
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/main_index.tmpl";
|
||||
private static Navigation rootNav = Navigation.createRootNav();
|
||||
private static Navigation userNav = Navigation.createRootNav();
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.util.logging.Logger;
|
|||
|
||||
public class EventConfigWebPage extends HalWebPage {
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
private static final String TEMPLATE = "resource/web/event_config.tmpl";
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/event_config.tmpl";
|
||||
|
||||
private ArrayList<ClassConfigurationData> eventConfigurations;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import java.util.logging.Logger;
|
|||
public class EventOverviewWebPage extends HalWebPage {
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
private static final int HISTORY_LIMIT = 200;
|
||||
private static final String OVERVIEW_TEMPLATE = "resource/web/event_overview.tmpl";
|
||||
private static final String DETAIL_TEMPLATE = "resource/web/event_detail.tmpl";
|
||||
private static final String OVERVIEW_TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/event_overview.tmpl";
|
||||
private static final String DETAIL_TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/event_detail.tmpl";
|
||||
|
||||
|
||||
public EventOverviewWebPage(){
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package se.hal.page;
|
||||
|
||||
import se.hal.HalContext;
|
||||
import zutil.io.file.FileUtil;
|
||||
import zutil.log.LogUtil;
|
||||
import zutil.net.http.HttpHeader;
|
||||
|
|
@ -14,7 +15,7 @@ import java.util.logging.Logger;
|
|||
|
||||
public class HalAlertManager implements HttpPage {
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
private static final String TMPL_PATH = "resource/web/main_alerts.tmpl";
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/main_alerts.tmpl";
|
||||
private static final String PAGE_NAME = "alert";
|
||||
private static HalAlertManager instance;
|
||||
|
||||
|
|
@ -59,7 +60,7 @@ public class HalAlertManager implements HttpPage {
|
|||
}
|
||||
}
|
||||
|
||||
Templator tmpl = new Templator(FileUtil.find(TMPL_PATH));
|
||||
Templator tmpl = new Templator(FileUtil.find(TEMPLATE));
|
||||
tmpl.set("serviceUrl", getUrl());
|
||||
tmpl.set("alerts", alertsClone);
|
||||
return tmpl;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.sql.SQLException;
|
|||
import java.util.Map;
|
||||
|
||||
public class MapWebPage extends HalWebPage {
|
||||
private static final String TEMPLATE = "resource/web/map.tmpl";
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/map.tmpl";
|
||||
|
||||
private String bgType;
|
||||
private byte[] bgImage;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
public class PluginConfigWebPage extends HalWebPage {
|
||||
private static final String TEMPLATE = "resource/web/plugin_config.tmpl";
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/plugin_config.tmpl";
|
||||
|
||||
|
||||
public PluginConfigWebPage(){
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import zutil.parser.Templator;
|
|||
import java.util.*;
|
||||
|
||||
public class PropertyConfigWebPage extends HalWebPage {
|
||||
private static final String TEMPLATE = "resource/web/property_config.tmpl";
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/property_config.tmpl";
|
||||
|
||||
|
||||
public PropertyConfigWebPage(){
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.util.logging.Logger;
|
|||
|
||||
public class SensorConfigWebPage extends HalWebPage {
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
private static final String TEMPLATE = "resource/web/sensor_config.tmpl";
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/sensor_config.tmpl";
|
||||
|
||||
private ArrayList<ClassConfigurationData> sensorConfigurations;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ import java.util.Map;
|
|||
|
||||
public class SensorOverviewWebPage extends HalWebPage {
|
||||
private static final int HISTORY_LIMIT = 200;
|
||||
private static final String OVERVIEW_TEMPLATE = "resource/web/sensor_overview.tmpl";
|
||||
private static final String DETAIL_TEMPLATE = "resource/web/sensor_detail.tmpl";
|
||||
private static final String OVERVIEW_TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/sensor_overview.tmpl";
|
||||
private static final String DETAIL_TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/sensor_detail.tmpl";
|
||||
|
||||
|
||||
public SensorOverviewWebPage(){
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import java.util.logging.Logger;
|
|||
|
||||
public class TriggerWebPage extends HalWebPage {
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
private static final String TEMPLATE = "resource/web/trigger.tmpl";
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/trigger.tmpl";
|
||||
|
||||
private ArrayList<ClassConfigurationData> triggerConfigurators;
|
||||
private ArrayList<ClassConfigurationData> actionConfigurators;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.logging.Logger;
|
|||
|
||||
public class UserConfigWebPage extends HalWebPage {
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
private static final String TEMPLATE = "resource/web/user_config.tmpl";
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/user_config.tmpl";
|
||||
|
||||
|
||||
public UserConfigWebPage() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue