mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +01:00
removed dependency on ThingSetupManager (#52)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
ae2d55f9d4
commit
a2ca9c590a
@ -32,7 +32,6 @@ Import-Package: com.google.common.cache;version="10.0.1",
|
||||
org.eclipse.smarthome.core.items,
|
||||
org.eclipse.smarthome.core.thing,
|
||||
org.eclipse.smarthome.core.thing.link,
|
||||
org.eclipse.smarthome.core.thing.setup,
|
||||
org.eclipse.smarthome.core.thing.type,
|
||||
org.eclipse.smarthome.core.types,
|
||||
org.eclipse.smarthome.model.core,
|
||||
|
@ -13,5 +13,4 @@
|
||||
<implementation class="org.openhab.core.internal.inbox.AutoApproveService"/>
|
||||
<reference bind="setInbox" cardinality="1..1" interface="org.eclipse.smarthome.config.discovery.inbox.Inbox" name="Inbox" policy="static" unbind="unsetInbox"/>
|
||||
<property name="service.pid" type="String" value="org.openhab.autoapprove"/>
|
||||
<reference bind="setThingSetupManager" cardinality="1..1" interface="org.eclipse.smarthome.core.thing.setup.ThingSetupManager" name="ThingSetupManager" policy="static" unbind="unsetThingSetupManager"/>
|
||||
</scr:component>
|
||||
|
@ -8,15 +8,12 @@
|
||||
*/
|
||||
package org.openhab.core.internal.inbox;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.smarthome.config.core.Configuration;
|
||||
import org.eclipse.smarthome.config.discovery.DiscoveryResult;
|
||||
import org.eclipse.smarthome.config.discovery.DiscoveryResultFlag;
|
||||
import org.eclipse.smarthome.config.discovery.inbox.Inbox;
|
||||
import org.eclipse.smarthome.config.discovery.inbox.InboxListener;
|
||||
import org.eclipse.smarthome.core.thing.setup.ThingSetupManager;
|
||||
import org.osgi.service.cm.ConfigurationException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -34,8 +31,6 @@ public class AutoApproveService implements InboxListener {
|
||||
|
||||
final static private Logger logger = LoggerFactory.getLogger(AutoApproveService.class);
|
||||
|
||||
private ThingSetupManager thingSetupManager;
|
||||
|
||||
private Inbox inbox;
|
||||
|
||||
protected void activate(Map<String, Object> configProps) throws ConfigurationException {
|
||||
@ -64,11 +59,7 @@ public class AutoApproveService implements InboxListener {
|
||||
@Override
|
||||
public void thingAdded(Inbox source, DiscoveryResult result) {
|
||||
logger.debug("Approving inbox entry '{}'", result.toString());
|
||||
Map<String, Object> props = new HashMap<>(result.getProperties());
|
||||
|
||||
Configuration conf = new Configuration(props);
|
||||
|
||||
thingSetupManager.addThing(result.getThingUID(), conf, result.getBridgeUID(), result.getLabel());
|
||||
inbox.approve(result.getThingUID(), result.getLabel());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,12 +79,4 @@ public class AutoApproveService implements InboxListener {
|
||||
this.inbox = null;
|
||||
}
|
||||
|
||||
protected void setThingSetupManager(ThingSetupManager thingSetupManager) {
|
||||
this.thingSetupManager = thingSetupManager;
|
||||
}
|
||||
|
||||
protected void unsetThingSetupManager(ThingSetupManager thingSetupManager) {
|
||||
this.thingSetupManager = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user