Skip to content

Commit

Permalink
Removed use of 'bundleContext' from 'BaseThingHandler' as it is depre…
Browse files Browse the repository at this point in the history
…cated (#6395)

Signed-off-by: Christoph Weitkamp <[email protected]>
  • Loading branch information
cweitkamp authored and kaikreuzer committed Nov 16, 2019
1 parent 1dd0323 commit 20f4e5d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import org.eclipse.smarthome.core.transform.TransformationService;
import org.eclipse.smarthome.core.types.Command;
import org.eclipse.smarthome.core.types.RefreshType;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -56,6 +58,8 @@ public class ExecHandler extends BaseThingHandler {

private Logger logger = LoggerFactory.getLogger(ExecHandler.class);

private final BundleContext bundleContext;

// List of Configurations constants
public static final String INTERVAL = "interval";
public static final String TIME_OUT = "timeout";
Expand All @@ -73,6 +77,7 @@ public class ExecHandler extends BaseThingHandler {

public ExecHandler(Thing thing) {
super(thing);
this.bundleContext = FrameworkUtil.getBundle(ExecHandler.class).getBundleContext();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
import org.openhab.binding.globalcache.internal.command.CommandSetstate;
import org.openhab.binding.globalcache.internal.command.RequestMessage;
import org.openhab.binding.globalcache.internal.command.ResponseMessage;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -73,6 +75,8 @@
public class GlobalCacheHandler extends BaseThingHandler {
private Logger logger = LoggerFactory.getLogger(GlobalCacheHandler.class);

private final BundleContext bundleContext;

private static final String GLOBALCACHE_THREAD_POOL = "globalCacheHandler";

private InetAddress ifAddress;
Expand All @@ -97,6 +101,7 @@ public GlobalCacheHandler(@NonNull Thing gcDevice, String ipv4Address) {
commandProcessor = new CommandProcessor();
scheduledFuture = null;
this.ipv4Address = ipv4Address;
this.bundleContext = FrameworkUtil.getBundle(GlobalCacheHandler.class).getBundleContext();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
import org.openhab.io.transport.modbus.PollTask;
import org.openhab.io.transport.modbus.endpoint.ModbusSlaveEndpoint;
import org.openhab.io.transport.modbus.json.WriteRequestJsonUtilities;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -99,6 +101,8 @@ public class ModbusDataThingHandler extends BaseThingHandler implements ModbusRe

private final Logger logger = LoggerFactory.getLogger(ModbusDataThingHandler.class);

private final BundleContext bundleContext;

private static final Duration MIN_STATUS_INFO_UPDATE_INTERVAL = Duration.ofSeconds(1);
private static final Map<String, List<Class<? extends State>>> CHANNEL_ID_TO_ACCEPTED_TYPES = new HashMap<>();

Expand Down Expand Up @@ -153,6 +157,7 @@ public class ModbusDataThingHandler extends BaseThingHandler implements ModbusRe

public ModbusDataThingHandler(Thing thing) {
super(thing);
this.bundleContext = FrameworkUtil.getBundle(ModbusDataThingHandler.class).getBundleContext();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,6 @@ private ModbusDataThingHandler createDataHandler(String id, Bridge bridge,
hookLinkRegistry(dataThingHandler);
dataThing.setHandler(dataThingHandler);
dataThingHandler.setCallback(thingCallback);
if (context != null) {
dataThingHandler.setBundleContext(context);
}
dataThingHandler.initialize();
return dataThingHandler;
}
Expand Down

0 comments on commit 20f4e5d

Please sign in to comment.