From 9a736c72a9e990a359a5f03a01ad52f973c43efd Mon Sep 17 00:00:00 2001 From: Kai Kreuzer Date: Tue, 26 Jan 2016 10:32:09 +0100 Subject: [PATCH] Required adaptions to make code compatible with API changes in BaseThingHandler through https://github.com/eclipse/smarthome/pull/769 Signed-off-by: Kai Kreuzer --- .../META-INF/MANIFEST.MF | 1 + .../astro/handler/AstroThingHandler.java | 2 +- .../internal/handler/MaxDevicesHandler.java | 19 ++++--------------- .../binding/rfxcom/handler/RFXComHandler.java | 4 ++-- .../handler/SqueezeBoxPlayerHandler.java | 4 ++-- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/addons/binding/org.openhab.binding.astro/META-INF/MANIFEST.MF b/addons/binding/org.openhab.binding.astro/META-INF/MANIFEST.MF index f52b5e5166649..ec60417d23266 100644 --- a/addons/binding/org.openhab.binding.astro/META-INF/MANIFEST.MF +++ b/addons/binding/org.openhab.binding.astro/META-INF/MANIFEST.MF @@ -16,6 +16,7 @@ Import-Package: com.google.common.collect, org.eclipse.smarthome.core.thing, org.eclipse.smarthome.core.thing.binding, org.eclipse.smarthome.core.thing.link, + org.eclipse.smarthome.core.thing.type, org.eclipse.smarthome.core.types, org.osgi.framework, org.osgi.service.component, diff --git a/addons/binding/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/handler/AstroThingHandler.java b/addons/binding/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/handler/AstroThingHandler.java index 4a925185d11dc..0c0b19a2b874f 100644 --- a/addons/binding/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/handler/AstroThingHandler.java +++ b/addons/binding/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/handler/AstroThingHandler.java @@ -141,7 +141,7 @@ protected void publishPlanet() { * Publishes the channel with data if it's linked. */ private void publishChannelIfLinked(Channel channel) { - if (channel.isLinked()) { + if (isLinked(channel.getUID().getId())) { try { updateState(channel.getUID(), PropertyUtils.getState(channel.getUID(), getPlanet())); } catch (Exception ex) { diff --git a/addons/binding/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxDevicesHandler.java b/addons/binding/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxDevicesHandler.java index cc3c42f337ded..61a0e42fad38d 100644 --- a/addons/binding/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxDevicesHandler.java +++ b/addons/binding/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxDevicesHandler.java @@ -120,18 +120,6 @@ public void initialize() { */ @Override public void dispose() { - logger.debug("Disposed MAX! device {} {}.", getThing().getUID(), maxDeviceSerial); - super.dispose(); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.smarthome.core.thing.binding.BaseThingHandler#preDispose() - */ - @Override - public void preDispose() { logger.debug("Disposing MAX! device {} {}.", getThing().getUID(), maxDeviceSerial); if (refreshingActuals) refreshActualsRestore(); @@ -145,7 +133,8 @@ public void preDispose() { bridgeHandler.unregisterDeviceStatusListener(this); bridgeHandler = null; } - super.preDispose(); + logger.debug("Disposed MAX! device {} {}.", getThing().getUID(), maxDeviceSerial); + super.dispose(); } /* @@ -424,7 +413,7 @@ private void setDeviceConfiguration(Device device) { * org.eclipse.smarthome.core.thing.Bridge) */ @Override - protected void bridgeHandlerInitialized(ThingHandler thingHandler, Bridge bridge) { + public void bridgeHandlerInitialized(ThingHandler thingHandler, Bridge bridge) { logger.debug("Bridge {} initialized for device: {}", bridge.getUID().toString(), getThing().getUID().toString()); if (bridgeHandler != null) { @@ -446,7 +435,7 @@ protected void bridgeHandlerInitialized(ThingHandler thingHandler, Bridge bridge * org.eclipse.smarthome.core.thing.Bridge) */ @Override - protected void bridgeHandlerDisposed(ThingHandler thingHandler, Bridge bridge) { + public void bridgeHandlerDisposed(ThingHandler thingHandler, Bridge bridge) { logger.debug("Bridge {} disposed for device: {}", bridge.getUID().toString(), getThing().getUID().toString()); bridgeHandler = null; forceRefresh = true; diff --git a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/handler/RFXComHandler.java b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/handler/RFXComHandler.java index 30b6a71fcec19..fa672b44ef6e6 100644 --- a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/handler/RFXComHandler.java +++ b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/handler/RFXComHandler.java @@ -112,7 +112,7 @@ public void initialize() { } @Override - protected void bridgeHandlerInitialized(ThingHandler thingHandler, + public void bridgeHandlerInitialized(ThingHandler thingHandler, Bridge bridge) { logger.debug("Bridge initialized"); @@ -133,7 +133,7 @@ protected void bridgeHandlerInitialized(ThingHandler thingHandler, } @Override - protected void bridgeHandlerDisposed(ThingHandler thingHandler, + public void bridgeHandlerDisposed(ThingHandler thingHandler, Bridge bridge) { logger.debug("Bridge disposed"); if (bridgeHandler != null) { diff --git a/addons/binding/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/handler/SqueezeBoxPlayerHandler.java b/addons/binding/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/handler/SqueezeBoxPlayerHandler.java index 89993463f84f5..10008e5ceab80 100644 --- a/addons/binding/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/handler/SqueezeBoxPlayerHandler.java +++ b/addons/binding/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/handler/SqueezeBoxPlayerHandler.java @@ -114,7 +114,7 @@ public void initialize() { }; @Override - protected void bridgeHandlerInitialized(ThingHandler thingHandler, Bridge bridge){ + public void bridgeHandlerInitialized(ThingHandler thingHandler, Bridge bridge){ if (thingHandler instanceof SqueezeBoxServerHandler) { this.squeezeBoxServerHandler = (SqueezeBoxServerHandler)thingHandler; updateStatus(squeezeBoxServerHandler.getThing().getStatus()); @@ -122,7 +122,7 @@ protected void bridgeHandlerInitialized(ThingHandler thingHandler, Bridge bridge } @Override - protected void bridgeHandlerDisposed(ThingHandler thingHandler, Bridge bridge) { + public void bridgeHandlerDisposed(ThingHandler thingHandler, Bridge bridge) { this.squeezeBoxServerHandler = null; updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.BRIDGE_OFFLINE); }