diff --git a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAccountHandler.java b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAccountHandler.java index 17cfb65c510..bc60528b201 100644 --- a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAccountHandler.java +++ b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAccountHandler.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2010-2023 Contributors to the openHAB project + * Copyright (c) 2010-2024 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. @@ -22,7 +22,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; public interface LinkyAccountHandler { /** - * @return Returns true if the Spotify Bridge is authorized. + * @return Returns true if the Linky Bridge is authorized. */ boolean isAuthorized(); diff --git a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAuthService.java b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAuthService.java index db00174987d..237faa3c3f4 100644 --- a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAuthService.java +++ b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAuthService.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2010-2023 Contributors to the openHAB project + * Copyright (c) 2010-2024 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. @@ -51,8 +51,6 @@ public class LinkyAuthService { private final Logger logger = LoggerFactory.getLogger(LinkyAuthService.class); - // private final List handlers = new ArrayList<>(); - private @NonNullByDefault({}) HttpService httpService; private @NonNullByDefault({}) BundleContext bundleContext; private @Nullable LinkyAccountHandler accountHandler; @@ -66,7 +64,7 @@ public class LinkyAuthService { httpService.registerResources(LinkyBindingConstants.LINKY_ALIAS + LinkyBindingConstants.LINKY_IMG_ALIAS, "web", null); } catch (NamespaceException | ServletException | IOException e) { - logger.warn("Error during spotify servlet startup", e); + logger.warn("Error during linky servlet startup", e); } } @@ -77,7 +75,7 @@ public class LinkyAuthService { } /** - * Creates a new {@link SpotifyAuthServlet}. + * Creates a new {@link LinkyAuthServlet}. * * @return the newly created servlet * @throws IOException thrown when an HTML template could not be read @@ -107,13 +105,13 @@ public class LinkyAuthService { } /** - * Call with Spotify redirect uri returned State and Code values to get the refresh and access tokens and persist + * Call with Linky redirect uri returned State and Code values to get the refresh and access tokens and persist * these values * - * @param servletBaseURL the servlet base, which will be the Spotify redirect url - * @param state The Spotify returned state value - * @param code The Spotify returned code value - * @return returns the name of the Spotify user that is authorized + * @param servletBaseURL the servlet base, which will be the Linky redirect url + * @param state The Linky returned state value + * @param code The Linky returned code value + * @return returns the name of the Linky user that is authorized */ public String authorize(String servletBaseURL, String state, String code) { LinkyAccountHandler accountHandler = getLinkyAccountHandler(); @@ -148,49 +146,6 @@ public class LinkyAuthService { return this.accountHandler; } - /** - * @param listener Adds the given handler - */ - /* - * public void addSpotifyAccountHandler(SpotifyAccountHandler listener) { - * if (!handlers.contains(listener)) { - * handlers.add(listener); - * } - * } - */ - - /** - * @param handler Removes the given handler - */ - /* - * public void removeSpotifyAccountHandler(SpotifyAccountHandler handler) { - * handlers.remove(handler); - * } - */ - - /** - * @return Returns all {@link SpotifyAccountHandler}s. - */ - /* - * public List getSpotifyAccountHandlers() { - * return handlers; - * } - */ - - /** - * Get the {@link SpotifyAccountHandler} that matches the given thing UID. - * - * @param thingUID UID of the thing to match the handler with - * @return the {@link SpotifyAccountHandler} matching the thing UID or null - */ - /* - * private @Nullable SpotifyAccountHandler getSpotifyAuthListener(String thingUID) { - * final Optional maybeListener = handlers.stream().filter(l -> l.equalsThingUID(thingUID)) - * .findFirst(); - * return maybeListener.isPresent() ? maybeListener.get() : null; - * } - */ - @Reference protected void setHttpService(HttpService httpService) { this.httpService = httpService; diff --git a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAuthServlet.java b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAuthServlet.java index 75ad3d3dd98..a1c1e42303d 100644 --- a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAuthServlet.java +++ b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyAuthServlet.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2010-2023 Contributors to the openHAB project + * Copyright (c) 2010-2024 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. @@ -105,13 +105,13 @@ public class LinkyAuthServlet extends HttpServlet { } /** - * Handles a possible call from Enedis to the redirect_uri. If that is the case Spotify will pass the authorization + * Handles a possible call from Enedis to the redirect_uri. If that is the case Linky will pass the authorization * codes via the url and these are processed. In case of an error this is shown to the user. If the user was * authorized this is passed on to the handler. Based on all these different outcomes the HTML is generated to * inform the user. * * @param replaceMap a map with key String values that will be mapped in the HTML templates. - * @param servletBaseURL the servlet base, which should be used as the Spotify redirect_uri value + * @param servletBaseURL the servlet base, which should be used as the Linky redirect_uri value * @param queryString the query part of the GET request this servlet is processing */ private void handleLinkyRedirect(Map replaceMap, String servletBaseURL, @@ -132,7 +132,7 @@ public class LinkyAuthServlet extends HttpServlet { // params.isEmpty() ? "" : String.format(HTML_META_REFRESH_CONTENT, servletBaseURL) if (!StringUtil.isBlank(reqError)) { - logger.debug("Spotify redirected with an error: {}", reqError); + logger.debug("Linky redirected with an error: {}", reqError); replaceMap.put(KEY_ERROR, String.format(HTML_ERROR, reqError)); } else if (!StringUtil.isBlank(reqState)) { try { diff --git a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyBindingConstants.java b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyBindingConstants.java index 1787c67f1d6..71709ab40b6 100644 --- a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyBindingConstants.java +++ b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyBindingConstants.java @@ -73,7 +73,7 @@ public class LinkyBindingConstants { "r:locations:*", "w:locations:*", "x:locations:*", "r:scenes:*", "x:scenes:*", "r:rules:*", "w:rules:*", "r:installedapps", "w:installedapps").collect(Collectors.joining(" ")); - // List of Spotify services related urls, information + // List of Linky services related urls, information public static final String LINKY_ACCOUNT_URL = "https://www.myelectricaldata.fr/"; public static final String LINKY_AUTHORIZE_URL = LINKY_ACCOUNT_URL + "v1/oauth2/authorize"; public static final String LINKY_API_TOKEN_URL = LINKY_ACCOUNT_URL + "token"; diff --git a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyHandlerFactory.java b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyHandlerFactory.java index 0ec0c6f2f35..f7e9d83d422 100644 --- a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyHandlerFactory.java +++ b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/LinkyHandlerFactory.java @@ -220,7 +220,7 @@ public class LinkyHandlerFactory extends BaseThingHandlerFactory implements Link else { String token = EnedisHttpApi.getToken(httpClient, clientId, reqCode); - logger.debug("token:" + token); + logger.debug("token: {}", token); Collection col = this.thingRegistry.getAll(); for (Thing thing : col) { @@ -244,18 +244,6 @@ public class LinkyHandlerFactory extends BaseThingHandlerFactory implements Link } private String updateProperties(AccessTokenResponse credentials) { - /* - * if (spotifyApi != null) { - * - * final Me me = spotifyApi.getMe(); - * final String user = me.getDisplayName() == null ? me.getId() : me.getDisplayName(); - * final Map props = editProperties(); - * - * props.put(PROPERTY_SPOTIFY_USER, user); - * updateProperties(props); - * return user; - * } - */ return ""; }