2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.webthing.internal.client;
15 import java.io.IOException;
17 import java.util.concurrent.ScheduledExecutorService;
18 import java.util.function.Consumer;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jetty.client.HttpClient;
22 import org.eclipse.jetty.websocket.client.WebSocketClient;
25 * Factory to create new instances of the WebThing client-side proxy
27 * @author Gregor Roth - Initial contribution
30 public interface ConsumedThingFactory {
33 * @param webSocketClient the webSocketClient to use
34 * @param httpClient the http client to use
35 * @param webThingURI the identifier of a WebThing resource
36 * @param executor executor
37 * @param errorHandler the error handler
38 * @return the newly created WebThing
39 * @throws IOException if the WebThing can not be connected
41 ConsumedThing create(WebSocketClient webSocketClient, HttpClient httpClient, URI webThingURI,
42 ScheduledExecutorService executor, Consumer<String> errorHandler) throws IOException;
45 * @return the default instance of the factory
47 static ConsumedThingFactory instance() {
48 return ConsumedThingImpl::new;