diff --git a/bundles/org.openhab.ui.basicui/OSGI-INF/.gitignore b/bundles/org.openhab.ui.basicui/OSGI-INF/.gitignore new file mode 100644 index 0000000000..2fb582e24a --- /dev/null +++ b/bundles/org.openhab.ui.basicui/OSGI-INF/.gitignore @@ -0,0 +1,2 @@ +/*.xml + diff --git a/bundles/org.openhab.ui.basicui/OSGI-INF/dashboardtile.xml b/bundles/org.openhab.ui.basicui/OSGI-INF/dashboardtile.xml deleted file mode 100644 index 8a5655189c..0000000000 --- a/bundles/org.openhab.ui.basicui/OSGI-INF/dashboardtile.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - diff --git a/bundles/org.openhab.ui.basicui/src/main/java/org/openhab/ui/basicui/internal/BasicUIDashboardTile.java b/bundles/org.openhab.ui.basicui/src/main/java/org/openhab/ui/basicui/internal/BasicUIDashboardTile.java index b89acf47af..a49b34eda3 100644 --- a/bundles/org.openhab.ui.basicui/src/main/java/org/openhab/ui/basicui/internal/BasicUIDashboardTile.java +++ b/bundles/org.openhab.ui.basicui/src/main/java/org/openhab/ui/basicui/internal/BasicUIDashboardTile.java @@ -9,6 +9,7 @@ package org.openhab.ui.basicui.internal; import org.openhab.ui.dashboard.DashboardTile; +import org.osgi.service.component.annotations.Component; /** * The dashboard tile for the Basic UI @@ -16,6 +17,7 @@ import org.openhab.ui.dashboard.DashboardTile; * @author Kai Kreuzer * */ +@Component public class BasicUIDashboardTile implements DashboardTile { @Override diff --git a/bundles/org.openhab.ui.classicui/OSGI-INF/.gitignore b/bundles/org.openhab.ui.classicui/OSGI-INF/.gitignore new file mode 100644 index 0000000000..2fb582e24a --- /dev/null +++ b/bundles/org.openhab.ui.classicui/OSGI-INF/.gitignore @@ -0,0 +1,2 @@ +/*.xml + diff --git a/bundles/org.openhab.ui.classicui/OSGI-INF/dashboardtile.xml b/bundles/org.openhab.ui.classicui/OSGI-INF/dashboardtile.xml deleted file mode 100644 index 71455f4629..0000000000 --- a/bundles/org.openhab.ui.classicui/OSGI-INF/dashboardtile.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - diff --git a/bundles/org.openhab.ui.classicui/src/main/java/org/openhab/ui/classicui/internal/ClassicUIDashboardTile.java b/bundles/org.openhab.ui.classicui/src/main/java/org/openhab/ui/classicui/internal/ClassicUIDashboardTile.java index 83bebebd0c..4d0ad97e72 100644 --- a/bundles/org.openhab.ui.classicui/src/main/java/org/openhab/ui/classicui/internal/ClassicUIDashboardTile.java +++ b/bundles/org.openhab.ui.classicui/src/main/java/org/openhab/ui/classicui/internal/ClassicUIDashboardTile.java @@ -9,6 +9,7 @@ package org.openhab.ui.classicui.internal; import org.openhab.ui.dashboard.DashboardTile; +import org.osgi.service.component.annotations.Component; /** * The dashboard tile for the Classic UI @@ -16,6 +17,7 @@ import org.openhab.ui.dashboard.DashboardTile; * @author Kai Kreuzer * */ +@Component public class ClassicUIDashboardTile implements DashboardTile { @Override diff --git a/bundles/org.openhab.ui.homebuilder/OSGI-INF/.gitignore b/bundles/org.openhab.ui.homebuilder/OSGI-INF/.gitignore new file mode 100644 index 0000000000..2fb582e24a --- /dev/null +++ b/bundles/org.openhab.ui.homebuilder/OSGI-INF/.gitignore @@ -0,0 +1,2 @@ +/*.xml + diff --git a/bundles/org.openhab.ui.homebuilder/OSGI-INF/dashboardtile.xml b/bundles/org.openhab.ui.homebuilder/OSGI-INF/dashboardtile.xml deleted file mode 100644 index 0b16bea672..0000000000 --- a/bundles/org.openhab.ui.homebuilder/OSGI-INF/dashboardtile.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - diff --git a/bundles/org.openhab.ui.homebuilder/src/main/java/org/openhab/ui/homebuilder/internal/HomeBuilderDashboardTile.java b/bundles/org.openhab.ui.homebuilder/src/main/java/org/openhab/ui/homebuilder/internal/HomeBuilderDashboardTile.java index cc8292b42a..061a9a414d 100644 --- a/bundles/org.openhab.ui.homebuilder/src/main/java/org/openhab/ui/homebuilder/internal/HomeBuilderDashboardTile.java +++ b/bundles/org.openhab.ui.homebuilder/src/main/java/org/openhab/ui/homebuilder/internal/HomeBuilderDashboardTile.java @@ -9,47 +9,17 @@ package org.openhab.ui.homebuilder.internal; import org.openhab.ui.dashboard.DashboardTile; -import org.osgi.service.http.HttpService; -import org.osgi.service.http.NamespaceException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.osgi.service.component.annotations.Component; /** - * The dashboard tile and resource registering for Home Builder + * The dashboard tile for Home Builder * * @author Kuba Wolanin - Initial contribution * */ +@Component public class HomeBuilderDashboardTile implements DashboardTile { - public static final String HOMEBUILDER_ALIAS = "/homebuilder"; - - private final Logger logger = LoggerFactory.getLogger(HomeBuilderDashboardTile.class); - - protected HttpService httpService; - - protected void activate() { - try { - httpService.registerResources(HOMEBUILDER_ALIAS, "web", null); - logger.info("Started Home Builder at {}", HOMEBUILDER_ALIAS); - } catch (NamespaceException e) { - logger.error("Error during Home Builder startup: {}", e.getMessage()); - } - } - - protected void deactivate() { - httpService.unregister(HOMEBUILDER_ALIAS); - logger.info("Stopped Home Builder"); - } - - protected void setHttpService(HttpService httpService) { - this.httpService = httpService; - } - - protected void unsetHttpService(HttpService httpService) { - this.httpService = null; - } - @Override public String getName() { return "Home Builder"; diff --git a/bundles/org.openhab.ui.homebuilder/src/main/java/org/openhab/ui/homebuilder/internal/HomeBuilderServlet.java b/bundles/org.openhab.ui.homebuilder/src/main/java/org/openhab/ui/homebuilder/internal/HomeBuilderServlet.java new file mode 100644 index 0000000000..543b1107bc --- /dev/null +++ b/bundles/org.openhab.ui.homebuilder/src/main/java/org/openhab/ui/homebuilder/internal/HomeBuilderServlet.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2015-2018 by the respective copyright holders. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.openhab.ui.homebuilder.internal; + +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.http.HttpService; +import org.osgi.service.http.NamespaceException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The resource registering for Home Builder + * + * @author Kuba Wolanin - Initial contribution + * + */ +@Component(immediate = true) +public class HomeBuilderServlet { + + public static final String HOMEBUILDER_ALIAS = "/homebuilder"; + + private final Logger logger = LoggerFactory.getLogger(HomeBuilderServlet.class); + + protected HttpService httpService; + + @Activate + protected void activate() { + try { + httpService.registerResources(HOMEBUILDER_ALIAS, "web", null); + logger.info("Started Home Builder at {}", HOMEBUILDER_ALIAS); + } catch (NamespaceException e) { + logger.error("Error during Home Builder startup: {}", e.getMessage()); + } + } + + @Deactivate + protected void deactivate() { + httpService.unregister(HOMEBUILDER_ALIAS); + logger.info("Stopped Home Builder"); + } + + @Reference + protected void setHttpService(HttpService httpService) { + this.httpService = httpService; + } + + protected void unsetHttpService(HttpService httpService) { + this.httpService = null; + } + +} diff --git a/bundles/org.openhab.ui.paperui/OSGI-INF/.gitignore b/bundles/org.openhab.ui.paperui/OSGI-INF/.gitignore new file mode 100644 index 0000000000..2fb582e24a --- /dev/null +++ b/bundles/org.openhab.ui.paperui/OSGI-INF/.gitignore @@ -0,0 +1,2 @@ +/*.xml + diff --git a/bundles/org.openhab.ui.paperui/OSGI-INF/dashboardtile.xml b/bundles/org.openhab.ui.paperui/OSGI-INF/dashboardtile.xml deleted file mode 100644 index ac784156f1..0000000000 --- a/bundles/org.openhab.ui.paperui/OSGI-INF/dashboardtile.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - diff --git a/bundles/org.openhab.ui.paperui/src/main/java/org/openhab/ui/paperui/internal/PaperUIDashboardTile.java b/bundles/org.openhab.ui.paperui/src/main/java/org/openhab/ui/paperui/internal/PaperUIDashboardTile.java index 9b05b4540a..4b9e71e898 100644 --- a/bundles/org.openhab.ui.paperui/src/main/java/org/openhab/ui/paperui/internal/PaperUIDashboardTile.java +++ b/bundles/org.openhab.ui.paperui/src/main/java/org/openhab/ui/paperui/internal/PaperUIDashboardTile.java @@ -9,6 +9,7 @@ package org.openhab.ui.paperui.internal; import org.openhab.ui.dashboard.DashboardTile; +import org.osgi.service.component.annotations.Component; /** * The dashboard tile for the Paper UI @@ -16,6 +17,7 @@ import org.openhab.ui.dashboard.DashboardTile; * @author Kai Kreuzer * */ +@Component public class PaperUIDashboardTile implements DashboardTile { @Override