Removed circular dependency in Home Builder and switched tiles to DS annotations (#386)
Signed-off-by: Kai Kreuzer <kai@openhab.org>pull/389/head
parent
25345a721d
commit
11acfbad82
|
@ -0,0 +1,2 @@
|
|||
/*.xml
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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
|
||||
|
||||
-->
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.openhab.ui.basicui.dashboardtile">
|
||||
<implementation class="org.openhab.ui.basicui.internal.BasicUIDashboardTile"/>
|
||||
<service>
|
||||
<provide interface="org.openhab.ui.dashboard.DashboardTile"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
/*.xml
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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
|
||||
|
||||
-->
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.openhab.ui.classicui.dashboardtile">
|
||||
<implementation class="org.openhab.ui.classicui.internal.ClassicUIDashboardTile"/>
|
||||
<service>
|
||||
<provide interface="org.openhab.ui.dashboard.DashboardTile"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
/*.xml
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2015-2017 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
|
||||
|
||||
-->
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" deactivate="deactivate" immediate="true" name="org.openhab.homebuilder">
|
||||
<implementation class="org.openhab.ui.homebuilder.internal.HomeBuilderDashboardTile"/>
|
||||
<reference bind="setHttpService" cardinality="1..1" interface="org.osgi.service.http.HttpService" name="HttpService" policy="static" unbind="unsetHttpService"/>
|
||||
<service>
|
||||
<provide interface="org.openhab.ui.dashboard.DashboardTile"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
/*.xml
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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
|
||||
|
||||
-->
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.openhab.ui.paperui.dashboardtile">
|
||||
<implementation class="org.openhab.ui.paperui.internal.PaperUIDashboardTile"/>
|
||||
<service>
|
||||
<provide interface="org.openhab.ui.dashboard.DashboardTile"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue