Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed use of 'bundleContext' from 'BaseThingHandler' as it is deprecated #6395

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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