[hdpowerview] fix classnotfoundexception (#9224)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
parent
35528eda3b
commit
97d9bda0a1
|
@ -14,6 +14,8 @@ package org.openhab.binding.hdpowerview.internal;
|
||||||
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
|
import javax.ws.rs.client.ClientBuilder;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.discovery.HDPowerViewShadeDiscoveryService;
|
import org.openhab.binding.hdpowerview.internal.discovery.HDPowerViewShadeDiscoveryService;
|
||||||
|
@ -26,7 +28,9 @@ import org.openhab.core.thing.ThingTypeUID;
|
||||||
import org.openhab.core.thing.binding.BaseThingHandlerFactory;
|
import org.openhab.core.thing.binding.BaseThingHandlerFactory;
|
||||||
import org.openhab.core.thing.binding.ThingHandler;
|
import org.openhab.core.thing.binding.ThingHandler;
|
||||||
import org.openhab.core.thing.binding.ThingHandlerFactory;
|
import org.openhab.core.thing.binding.ThingHandlerFactory;
|
||||||
|
import org.osgi.service.component.annotations.Activate;
|
||||||
import org.osgi.service.component.annotations.Component;
|
import org.osgi.service.component.annotations.Component;
|
||||||
|
import org.osgi.service.component.annotations.Reference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link HDPowerViewHandlerFactory} is responsible for creating things and thing
|
* The {@link HDPowerViewHandlerFactory} is responsible for creating things and thing
|
||||||
|
@ -37,6 +41,12 @@ import org.osgi.service.component.annotations.Component;
|
||||||
@NonNullByDefault
|
@NonNullByDefault
|
||||||
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.hdpowerview")
|
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.hdpowerview")
|
||||||
public class HDPowerViewHandlerFactory extends BaseThingHandlerFactory {
|
public class HDPowerViewHandlerFactory extends BaseThingHandlerFactory {
|
||||||
|
private final ClientBuilder clientBuilder;
|
||||||
|
|
||||||
|
@Activate
|
||||||
|
public HDPowerViewHandlerFactory(@Reference ClientBuilder clientBuilder) {
|
||||||
|
this.clientBuilder = clientBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
||||||
|
@ -48,7 +58,7 @@ public class HDPowerViewHandlerFactory extends BaseThingHandlerFactory {
|
||||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||||
|
|
||||||
if (thingTypeUID.equals(HDPowerViewBindingConstants.THING_TYPE_HUB)) {
|
if (thingTypeUID.equals(HDPowerViewBindingConstants.THING_TYPE_HUB)) {
|
||||||
HDPowerViewHubHandler handler = new HDPowerViewHubHandler((Bridge) thing);
|
HDPowerViewHubHandler handler = new HDPowerViewHubHandler((Bridge) thing, clientBuilder);
|
||||||
registerService(new HDPowerViewShadeDiscoveryService(handler));
|
registerService(new HDPowerViewShadeDiscoveryService(handler));
|
||||||
return handler;
|
return handler;
|
||||||
} else if (thingTypeUID.equals(HDPowerViewBindingConstants.THING_TYPE_SHADE)) {
|
} else if (thingTypeUID.equals(HDPowerViewBindingConstants.THING_TYPE_SHADE)) {
|
||||||
|
|
|
@ -63,6 +63,7 @@ import com.google.gson.JsonParseException;
|
||||||
public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(HDPowerViewHubHandler.class);
|
private final Logger logger = LoggerFactory.getLogger(HDPowerViewHubHandler.class);
|
||||||
|
private final ClientBuilder clientBuilder;
|
||||||
|
|
||||||
private long refreshInterval;
|
private long refreshInterval;
|
||||||
private long hardRefreshInterval;
|
private long hardRefreshInterval;
|
||||||
|
@ -74,8 +75,9 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
||||||
private final ChannelTypeUID sceneChannelTypeUID = new ChannelTypeUID(HDPowerViewBindingConstants.BINDING_ID,
|
private final ChannelTypeUID sceneChannelTypeUID = new ChannelTypeUID(HDPowerViewBindingConstants.BINDING_ID,
|
||||||
HDPowerViewBindingConstants.CHANNELTYPE_SCENE_ACTIVATE);
|
HDPowerViewBindingConstants.CHANNELTYPE_SCENE_ACTIVATE);
|
||||||
|
|
||||||
public HDPowerViewHubHandler(Bridge bridge) {
|
public HDPowerViewHubHandler(Bridge bridge, ClientBuilder clientBuilder) {
|
||||||
super(bridge);
|
super(bridge);
|
||||||
|
this.clientBuilder = clientBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -114,7 +116,7 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
webTargets = new HDPowerViewWebTargets(ClientBuilder.newClient(), host);
|
webTargets = new HDPowerViewWebTargets(clientBuilder.build(), host);
|
||||||
refreshInterval = config.refresh;
|
refreshInterval = config.refresh;
|
||||||
hardRefreshInterval = config.hardRefresh;
|
hardRefreshInterval = config.hardRefresh;
|
||||||
schedulePoll();
|
schedulePoll();
|
||||||
|
|
Loading…
Reference in New Issue