]> git.basschouten.com Git - openhab-addons.git/commitdiff
[lametrictime] Move external library to internal code (#14425)
authorKai Kreuzer <kai@openhab.org>
Sat, 18 Feb 2023 14:01:41 +0000 (15:01 +0100)
committerGitHub <noreply@github.com>
Sat, 18 Feb 2023 14:01:41 +0000 (15:01 +0100)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
312 files changed:
bundles/org.openhab.binding.lametrictime/NOTICE
bundles/org.openhab.binding.lametrictime/pom.xml
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/Configuration.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/LaMetricTime.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/BasicAuthenticator.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/HttpAuthenticationFeature.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/HttpAuthenticationFilter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/RequestAuthenticationException.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/ResponseAuthenticationException.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/CloudConfiguration.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/LaMetricTimeCloud.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/impl/LaMetricTimeCloudImpl.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/Icon.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconField.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconFilter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconOrder.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconType.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/Icons.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconsMetadata.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/Thumb.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/AbstractClient.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/GsonGenerator.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/ActionTypeAdapterFactory.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/ApplicationTypeAdapterFactory.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/UpdateActionTypeAdapterFactory.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/CustomizedTypeAdapterFactory.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/DateTimeTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/DurationTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/InstantTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/JSR310TypeAdapters.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/LocalDateTimeTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/LocalDateTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/LocalTimeTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/MonthDayTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/OffsetDateTimeTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/OffsetTimeTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/PeriodTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/RuntimeTypeAdapterFactory.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/TemporalTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/YearMonthTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/YearTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/ZonedDateTimeTypeAdapter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/filter/LoggingFilter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/AbstractDataIcon.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/DataIcon.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/FileIcon.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/HTTPIcon.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/KeyIcon.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/LaMetricTimeImpl.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/ApplicationActionException.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/ApplicationActivationException.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/ApplicationNotFoundException.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/LaMetricTimeException.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/LaMetricTimeLocal.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/LocalConfiguration.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/NotificationCreationException.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/NotificationNotFoundException.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/UpdateException.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/impl/LaMetricTimeLocalImpl.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Action.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Api.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Application.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Audio.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/AudioUpdateResult.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Bluetooth.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/BluetoothUpdateResult.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/BooleanParameter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Device.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Display.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/DisplayUpdateResult.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Endpoints.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Error.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Failure.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Frame.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/GoalData.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/IntegerParameter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Modes.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Notification.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/NotificationModel.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/NotificationResult.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Parameter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Screensaver.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Sound.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/StringParameter.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/TimeBased.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/UpdateAction.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/WhenDark.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Widget.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/WidgetUpdates.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Wifi.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/ApiValue.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/ClockApp.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CoreAction.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CoreApplication.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CoreApps.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CountdownApp.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/Icon.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/Icons.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/RadioApp.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/StopwatchApp.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/WeatherApp.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/BrightnessMode.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/DisplayType.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/IconType.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/IpMode.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/Priority.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/Sound.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/SoundCategory.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/WifiEncryption.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/BasicAuthenticator.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/HttpAuthenticationFeature.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/HttpAuthenticationFilter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/RequestAuthenticationException.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/ResponseAuthenticationException.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/filter/LoggingFilter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/AllIntegrationTestsSuite.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/AllUnitTestsSuite.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/impl/FileIconTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/impl/LaMetricTimeLocalImplIT.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/ActionTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/ApplicationTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/AudioTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/BluetoothTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/FrameTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/GoalDataTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/UpdateActionTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/WidgetTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/WidgetUpdatesTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/BrightnessModeTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/DisplayTypeTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/IconTypeTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/IpModeTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/PriorityTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/SoundCategoryTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/SoundTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/WifiEncryptionTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/test/AbstractTest.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/test/TestUtil.java [deleted file]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/GsonProvider.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/LaMetricTimeConfigStatusMessage.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/LaMetricTimeUtil.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/WidgetRef.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/Configuration.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/LaMetricTime.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/CloudConfiguration.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/LaMetricTimeCloud.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/Icon.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconField.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconFilter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconOrder.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconType.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/Icons.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconsMetadata.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/Thumb.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/impl/LaMetricTimeCloudImpl.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/AbstractClient.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/GsonGenerator.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/ActionTypeAdapterFactory.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/ApplicationTypeAdapterFactory.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/UpdateActionTypeAdapterFactory.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/CustomizedTypeAdapterFactory.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/DateTimeTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/DurationTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/InstantTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/JSR310TypeAdapters.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/LocalDateTimeTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/LocalDateTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/LocalTimeTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/MonthDayTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/OffsetDateTimeTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/OffsetTimeTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/PeriodTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/RuntimeTypeAdapterFactory.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/TemporalTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/YearMonthTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/YearTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/ZonedDateTimeTypeAdapter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/ApiValue.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/ClockApp.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CoreAction.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CoreApplication.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CoreApps.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CountdownApp.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/Icon.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/Icons.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/RadioApp.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/StopwatchApp.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/WeatherApp.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/BrightnessMode.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/DisplayType.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IconType.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IpMode.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/Priority.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/Sound.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/SoundCategory.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/WifiEncryption.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/AbstractDataIcon.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/DataIcon.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/FileIcon.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/HTTPIcon.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/KeyIcon.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/LaMetricTimeImpl.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/ApplicationActionException.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/ApplicationActivationException.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/ApplicationNotFoundException.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/LaMetricTimeException.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/LaMetricTimeLocal.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/LocalConfiguration.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/NotificationCreationException.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/NotificationNotFoundException.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/UpdateException.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Action.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Api.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Application.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Audio.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/AudioUpdateResult.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Bluetooth.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/BluetoothUpdateResult.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/BooleanParameter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Device.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Display.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/DisplayUpdateResult.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Endpoints.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Error.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Failure.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Frame.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/GoalData.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/IntegerParameter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Modes.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Notification.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/NotificationModel.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/NotificationResult.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Parameter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Screensaver.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Sound.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/StringParameter.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/TimeBased.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/UpdateAction.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/WhenDark.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Widget.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/WidgetUpdates.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Wifi.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/impl/LaMetricTimeLocalImpl.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/config/LaMetricTimeAppConfiguration.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/config/LaMetricTimeConfiguration.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/discovery/LaMetricTimeAppDiscoveryService.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/discovery/LaMetricTimeDiscoveryParticipant.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/handler/AbstractLaMetricTimeAppHandler.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/handler/ClockAppHandler.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/handler/CountdownAppHandler.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/handler/LaMetricTimeAppHandler.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/handler/LaMetricTimeHandler.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/handler/RadioAppHandler.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/handler/StopwatchAppHandler.java
bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/handler/WeatherAppHandler.java
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/AllIntegrationTestsSuite.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/AllUnitTestsSuite.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/BrightnessModeTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/DisplayTypeTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IconTypeTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IpModeTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/PriorityTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/SoundCategoryTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/SoundTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/WifiEncryptionTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/impl/FileIconTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/ActionTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/ApplicationTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/AudioTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/BluetoothTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/FrameTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/GoalDataTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/UpdateActionTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/WidgetTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/WidgetUpdatesTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/impl/LaMetricTimeLocalImplIT.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/test/AbstractTest.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/test/TestUtil.java [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/README [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/info.png [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/smile.gif [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/action.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/application-all.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/application-null-maps.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/audio.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/bluetooth-address.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/bluetooth-mac-address.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/bluetooth-mac.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/frame-chart.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/frame-goal.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/frame-simple.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/goal-data.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/update-action.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/widget-updates.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/widget.json [deleted file]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/README [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/info.png [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/smile.gif [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/action.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/application-all.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/application-null-maps.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/audio.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/bluetooth-address.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/bluetooth-mac-address.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/bluetooth-mac.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/frame-chart.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/frame-goal.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/frame-simple.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/goal-data.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/update-action.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/widget-updates.json [new file with mode: 0644]
bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/widget.json [new file with mode: 0644]

index f862503998d4368dd520e988a557804a09734243..41865e02f2f45219e9483d26d76384fcc8b82d4a 100644 (file)
@@ -14,11 +14,6 @@ https://github.com/openhab/openhab-addons
 
 == Third-party Content
 
-The sources of liblametrictime-java are included in src/3rdparty/java and have been slightly adapted.
-* License: Apache 2.0 License
-* Project: https://github.com/syphr42/liblametrictime-java
-
-
-This binding includes a class from Jersey in the src/3rdparty/java folder.
+This binding includes classes from Jersey in the src/3rdparty/java folder.
 * License: CDDL License
 * Project: https://eclipse-ee4j.github.io/jersey/
\ No newline at end of file
index 47658a8b0cb46d8bd71475a3981cb46aeea07177..5a58a693cf1de5dd4ff6affcb3f15a389a2da486 100644 (file)
               </sources>
             </configuration>
           </execution>
-          <execution>
-            <id>add-test-source</id>
-            <phase>generate-sources</phase>
-            <goals>
-              <goal>add-test-source</goal>
-            </goals>
-            <configuration>
-              <sources>
-                <source>src/3rdparty/test</source>
-              </sources>
-            </configuration>
-          </execution>
         </executions>
       </plugin>
     </plugins>
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/Configuration.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/Configuration.java
deleted file mode 100644 (file)
index 08601d0..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api;
-
-import org.openhab.binding.lametrictime.api.cloud.CloudConfiguration;
-import org.openhab.binding.lametrictime.api.local.LocalConfiguration;
-
-public class Configuration
-{
-    private String deviceHost;
-    private String deviceApiKey;
-
-    private boolean ignoreDeviceCertificateValidation = true;
-    private boolean ignoreDeviceHostnameValidation = true;
-
-    private boolean logging = false;
-    private String logLevel = "INFO";
-    private int logMax = 104857600; // 100kb
-
-    public String getDeviceHost()
-    {
-        return deviceHost;
-    }
-
-    public void setDeviceHost(String deviceHost)
-    {
-        this.deviceHost = deviceHost;
-    }
-
-    public Configuration withDeviceHost(String deviceHost)
-    {
-        this.deviceHost = deviceHost;
-        return this;
-    }
-
-    public String getDeviceApiKey()
-    {
-        return deviceApiKey;
-    }
-
-    public void setDeviceApiKey(String deviceApiKey)
-    {
-        this.deviceApiKey = deviceApiKey;
-    }
-
-    public Configuration withDeviceApiKey(String deviceApiKey)
-    {
-        this.deviceApiKey = deviceApiKey;
-        return this;
-    }
-
-    public boolean isIgnoreDeviceCertificateValidation()
-    {
-        return ignoreDeviceCertificateValidation;
-    }
-
-    public void setIgnoreDeviceCertificateValidation(boolean ignoreDeviceCertificateValidation)
-    {
-        this.ignoreDeviceCertificateValidation = ignoreDeviceCertificateValidation;
-    }
-
-    public Configuration withIgnoreDeviceCertificateValidation(boolean ignoreDeviceCertificateValidation)
-    {
-        this.ignoreDeviceCertificateValidation = ignoreDeviceCertificateValidation;
-        return this;
-    }
-
-    public boolean isIgnoreDeviceHostnameValidation()
-    {
-        return ignoreDeviceHostnameValidation;
-    }
-
-    public void setIgnoreDeviceHostnameValidation(boolean ignoreDeviceHostnameValidation)
-    {
-        this.ignoreDeviceHostnameValidation = ignoreDeviceHostnameValidation;
-    }
-
-    public Configuration withIgnoreDeviceHostnameValidation(boolean ignoreDeviceHostnameValidation)
-    {
-        this.ignoreDeviceHostnameValidation = ignoreDeviceHostnameValidation;
-        return this;
-    }
-
-    public boolean isLogging()
-    {
-        return logging;
-    }
-
-    public void setLogging(boolean logging)
-    {
-        this.logging = logging;
-    }
-
-    public Configuration withLogging(boolean logging)
-    {
-        this.logging = logging;
-        return this;
-    }
-
-    public String getLogLevel()
-    {
-        return logLevel;
-    }
-
-    public void setLogLevel(String logLevel)
-    {
-        this.logLevel = logLevel;
-    }
-
-    public Configuration withLogLevel(String logLevel)
-    {
-        this.logLevel = logLevel;
-        return this;
-    }
-
-    public int getLogMax()
-    {
-        return logMax;
-    }
-
-    public void setLogMax(int logMax)
-    {
-        this.logMax = logMax;
-    }
-
-    public Configuration withLogMax(int logMax)
-    {
-        this.logMax = logMax;
-        return this;
-    }
-
-    public LocalConfiguration getLocalConfig()
-    {
-        return new LocalConfiguration().withHost(deviceHost)
-                                       .withApiKey(deviceApiKey)
-                                       .withIgnoreCertificateValidation(ignoreDeviceCertificateValidation)
-                                       .withIgnoreHostnameValidation(ignoreDeviceHostnameValidation)
-                                       .withLogging(logging)
-                                       .withLogLevel(logLevel)
-                                       .withLogMax(logMax);
-    }
-
-    public CloudConfiguration getCloudConfig()
-    {
-        return new CloudConfiguration().withLogging(logging)
-                                       .withLogLevel(logLevel)
-                                       .withLogMax(logMax);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/LaMetricTime.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/LaMetricTime.java
deleted file mode 100644 (file)
index d331f6e..0000000
+++ /dev/null
@@ -1,449 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api;
-
-import javax.ws.rs.client.ClientBuilder;
-
-import org.openhab.binding.lametrictime.api.cloud.CloudConfiguration;
-import org.openhab.binding.lametrictime.api.cloud.LaMetricTimeCloud;
-import org.openhab.binding.lametrictime.api.impl.LaMetricTimeImpl;
-import org.openhab.binding.lametrictime.api.local.ApplicationActionException;
-import org.openhab.binding.lametrictime.api.local.ApplicationActivationException;
-import org.openhab.binding.lametrictime.api.local.ApplicationNotFoundException;
-import org.openhab.binding.lametrictime.api.local.LaMetricTimeLocal;
-import org.openhab.binding.lametrictime.api.local.LocalConfiguration;
-import org.openhab.binding.lametrictime.api.local.NotificationCreationException;
-import org.openhab.binding.lametrictime.api.local.UpdateException;
-import org.openhab.binding.lametrictime.api.local.model.Application;
-import org.openhab.binding.lametrictime.api.local.model.Audio;
-import org.openhab.binding.lametrictime.api.local.model.Bluetooth;
-import org.openhab.binding.lametrictime.api.local.model.Display;
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-import org.openhab.binding.lametrictime.api.local.model.Widget;
-import org.openhab.binding.lametrictime.api.model.CoreAction;
-import org.openhab.binding.lametrictime.api.model.CoreApplication;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
-import org.openhab.binding.lametrictime.api.model.Icon;
-import org.openhab.binding.lametrictime.api.model.enums.BrightnessMode;
-import org.openhab.binding.lametrictime.api.model.enums.Priority;
-import org.openhab.binding.lametrictime.api.model.enums.Sound;
-
-public interface LaMetricTime
-{
-    /**
-     * Get the version identifier reported by the device.
-     *
-     * @return the version
-     */
-    public String getVersion();
-
-    /**
-     * Send a low priority message to the device.
-     *
-     * @param message
-     *            the text to display
-     * @return the identifier of the newly created notification
-     * @throws NotificationCreationException
-     *             if there is a communication error or malformed data
-     */
-    public String notifyInfo(String message) throws NotificationCreationException;
-
-    /**
-     * Send a medium priority message to the device.
-     *
-     * @param message
-     *            the text to display
-     * @return the identifier of the newly created notification
-     * @throws NotificationCreationException
-     *             if there is a communication error or malformed data
-     */
-    public String notifyWarning(String message) throws NotificationCreationException;
-
-    /**
-     * Send an urgent message to the device. The notification will not be
-     * automatically removed. The user will be required to dismiss this
-     * notification or it must be deleted through he API.
-     *
-     * @param message
-     *            the text to display
-     * @return the identifier of the newly created notification
-     * @throws NotificationCreationException
-     *             if there is a communication error or malformed data
-     */
-    public String notifyCritical(String message) throws NotificationCreationException;
-
-    /**
-     * Send a notification to the device.
-     *
-     * Priority is important. It defines the urgency of this notification as
-     * related to others in the queue and the current state of the device.
-     * <ol>
-     * <li>{@link Priority#INFO}: lowest priority; not shown when the
-     * screensaver is active; waits for its turn in the queue
-     * <li>{@link Priority#WARNING}: middle priority; not shown when the
-     * screensaver is active; preempts {@link Priority#INFO}
-     * <li>{@link Priority#CRITICAL}: highest priority; shown even when the
-     * screensaver is active; preempts all other notifications (to be used
-     * sparingly)
-     * </ol>
-     *
-     * @param message
-     *            the text to display
-     * @param priority
-     *            the urgency of this notification; defaults to
-     *            {@link Priority#INFO}
-     * @param icon
-     *            the icon to display next to the message; can be
-     *            <code>null</code>
-     * @param sound
-     *            the sound to play when the notification is displayed; can be
-     *            <code>null</code>
-     * @param messageRepeat
-     *            the number of times the message should be displayed before
-     *            being removed (use <code>0</code> to leave the notification on
-     *            the device until it is dismissed by the user or deleted
-     *            through the API)
-     * @param soundRepeat
-     *            the number of times to repeat the sound (use <code>0</code> to
-     *            keep the sound looping until the notification is dismissed by
-     *            the user or deleted through the API)
-     * @return the identifier of the newly created notification
-     * @throws NotificationCreationException
-     *             if there is a communication error or malformed data
-     */
-    public String notify(String message,
-                         Priority priority,
-                         Icon icon,
-                         Sound sound,
-                         int messageRepeat,
-                         int soundRepeat) throws NotificationCreationException;
-
-    /**
-     * Get the built-in clock application. This applications displays the time
-     * and date. It also provides an alarm feature.
-     *
-     * @return the clock app
-     */
-    public Application getClock();
-
-    /**
-     * Get the built-in countdown timer application. This application counts
-     * time down to zero when it sets off a beeper until it is reset. The
-     * countdown can also be paused.
-     *
-     * @return the countdown app
-     */
-    public Application getCountdown();
-
-    /**
-     * Get the built-in radio application. The radio can play streams from the
-     * Internet. The streams are set up in a list and can be navigated using
-     * 'next' and 'previous' actions. The music can be started and stopped.
-     *
-     * @return the radio app
-     */
-    public Application getRadio();
-
-    /**
-     * Get the built-in stopwatch application. The stopwatch counts time
-     * forwards and can be started, paused, and reset.
-     *
-     * @return the stopwatch app
-     */
-    public Application getStopwatch();
-
-    /**
-     * Get the built-in weather application. This application displays the
-     * current weather conditions. It can also display the forecast for today
-     * and tomorrow.
-     *
-     * @return the weather app
-     */
-    public Application getWeather();
-
-    /**
-     * Get any of the built-in applications.
-     *
-     * @param coreApp
-     *            the app to retrieve
-     * @return the requested app
-     */
-    public Application getApplication(CoreApplication coreApp);
-
-    /**
-     * Get any application installed on the device.
-     *
-     * @param name
-     *            the name of the app to retrieve
-     * @return the requested app
-     * @throws ApplicationNotFoundException
-     *             if the requested app is not found on the device
-     */
-    public Application getApplication(String name) throws ApplicationNotFoundException;
-
-    /**
-     * Display the given built-in application on the device.
-     *
-     * @param coreApp
-     *            the app to activate
-     */
-    public void activateApplication(CoreApplication coreApp);
-
-    /**
-     * Display the first instance (widget) of the given application on the
-     * device.
-     *
-     * @param app
-     *            the app to activate
-     * @throws ApplicationActivationException
-     *             if the app fails to activate
-     */
-    public void activateApplication(Application app) throws ApplicationActivationException;
-
-    /**
-     * Display the given widget on the device. A widget is simply an instance of
-     * an application. Some applications can be installed more than once (e.g.
-     * the {@link CoreApps#weather() weather} app) and each instance is assigned
-     * a widget.
-     *
-     * @param widget
-     *            the application instance (widget) to activate
-     * @throws ApplicationActivationException
-     *             if the app fails to activate
-     */
-    public void activateWidget(Widget widget) throws ApplicationActivationException;
-
-    /**
-     * Perform the given action on the first instance (widget) of the
-     * corresponding built-in application. The widget will activate
-     * automatically before carrying out the action.
-     *
-     * @param coreAction
-     *            the action to perform
-     */
-    public void doAction(CoreAction coreAction);
-
-    /**
-     * Perform the given action on the first instance (widget) of the given
-     * application. The widget will activate automatically before carrying out
-     * the action.
-     *
-     * @param app
-     *            the app which understands the requested action
-     * @param action
-     *            the action to perform
-     * @throws ApplicationActionException
-     *             if the action cannot be performed
-     */
-    public void doAction(Application app, UpdateAction action) throws ApplicationActionException;
-
-    /**
-     * Perform the given core action on the given widget. A widget is simply an
-     * instance of an application. Some applications can be installed more than
-     * once (e.g. the {@link CoreApps#weather() weather} app) and each instance
-     * is assigned a widget. The widget will activate automatically before
-     * carrying out the action.
-     *
-     * @param widget
-     *            the widget which understands the requested core action
-     * @param action
-     *            the action to perform
-     * @throws ApplicationActionException
-     *             if the action cannot be performed
-     */
-    public void doAction(Widget widget, CoreAction action) throws ApplicationActionException;
-
-    /**
-     * Perform the given action on the given widget. A widget is simply an
-     * instance of an application. Some applications can be installed more than
-     * once (e.g. the {@link CoreApps#weather() weather} app) and each instance
-     * is assigned a widget. The widget will activate automatically before
-     * carrying out the action.
-     *
-     * @param widget
-     *            the widget which understands the requested action
-     * @param action
-     *            the action to perform
-     * @throws ApplicationActionException
-     *             if the action cannot be performed
-     */
-    public void doAction(Widget widget, UpdateAction action) throws ApplicationActionException;
-
-    /**
-     * Set the display brightness. The {@link #setBrightnessMode(BrightnessMode)
-     * brightness mode} will also be set to {@link BrightnessMode#MANUAL}.
-     *
-     * @param brightness
-     *            the brightness value to set (must be between 0 and 100,
-     *            inclusive)
-     * @return the updated state of the display
-     * @throws UpdateException
-     *             if the update failed
-     */
-    public Display setBrightness(int brightness) throws UpdateException;
-
-    /**
-     * Set the brightness mode on the display. {@link BrightnessMode#MANUAL}
-     * will immediately respect the current brightness value while
-     * {@link BrightnessMode#AUTO} will ignore the brightness value and set the
-     * brightness based on ambient light intensity.
-     *
-     * @param mode
-     *            the mode to set
-     * @return the updated state of the display
-     * @throws UpdateException
-     *             if the update failed
-     */
-    public Display setBrightnessMode(BrightnessMode mode) throws UpdateException;
-
-    /**
-     * Set the speaker volume on the device.
-     *
-     * @param volume
-     *            the volume to set (must be between 0 and 100, inclusive)
-     * @return the update audio state
-     * @throws UpdateException
-     *             if the update failed
-     */
-    public Audio setVolume(int volume) throws UpdateException;
-
-    /**
-     * Mute the device's speakers. The current volume will be stored so that
-     * {@link #unmute()} will restored it. If the volume is currently at zero,
-     * no action will be taken.
-     *
-     * @return the update audio state
-     * @throws UpdateException
-     *             if the update failed
-     */
-    public Audio mute() throws UpdateException;
-
-    /**
-     * Restore the volume prior to {@link #mute()}. If the volume has not been
-     * muted previously and the volume is currently zero, it will be set to 50%.
-     *
-     * @return the update audio state
-     * @throws UpdateException
-     *             if the update failed
-     */
-    public Audio unmute() throws UpdateException;
-
-    /**
-     * Set the active state of the Bluetooth radio on the device.
-     *
-     * @param active
-     *            <code>true</code> to activate Bluetooth; <code>false</code> to
-     *            deactive it
-     * @return the updated state of Bluetooth on the device
-     * @throws UpdateException
-     *             if the update failed
-     */
-    public Bluetooth setBluetoothActive(boolean active) throws UpdateException;
-
-    /**
-     * Set the device name as seen via Bluetooth connectivity.
-     *
-     * @param name
-     *            the name to display on other devices
-     * @return the updated state of Bluetooth on the device
-     * @throws UpdateException
-     *             if the update failed
-     */
-    public Bluetooth setBluetoothName(String name) throws UpdateException;
-
-    /**
-     * Get the local API for more advanced interactions as well device inquiry.
-     *
-     * @return the local API
-     */
-    public LaMetricTimeLocal getLocalApi();
-
-    /**
-     * Get the cloud API for interacting with LaMetric's services.
-     *
-     * @return the cloud API
-     */
-    public LaMetricTimeCloud getCloudApi();
-
-    /**
-     * Create an instance of this API. For greater control over the
-     * configuration, see {@link #create(Configuration, ClientBuilder)},
-     * {@link #create(LocalConfiguration, CloudConfiguration)}, and
-     * {@link #create(LocalConfiguration, CloudConfiguration, ClientBuilder)}.
-     *
-     * @param config
-     *            the configuration parameters that the new instance will use
-     * @return the API instance
-     */
-    public static LaMetricTime create(Configuration config)
-    {
-        return new LaMetricTimeImpl(config);
-    }
-
-    /**
-     * Create an instance of this API. For greater control over the
-     * configuration, see
-     * {@link #create(LocalConfiguration, CloudConfiguration, ClientBuilder)}.
-     *
-     * @param config
-     *            the configuration parameters that the new instance will use
-     * @param clientBuilder
-     *            the builder that will be used to create clients for
-     *            communicating with the device and cloud services
-     * @return the API instance
-     */
-    public static LaMetricTime create(Configuration config, ClientBuilder clientBuilder)
-    {
-        return new LaMetricTimeImpl(config, clientBuilder);
-    }
-
-    /**
-     * Create an instance of this API specifying detailed configuration for both
-     * the local and cloud APIs. See also
-     * {@link #create(LocalConfiguration, CloudConfiguration, ClientBuilder)}.
-     *
-     * @param localConfig
-     *            the local API configuration for the new instance
-     * @param cloudConfig
-     *            the cloud API configuration for the new instance
-     * @return the API instance
-     */
-    public static LaMetricTime create(LocalConfiguration localConfig,
-                                      CloudConfiguration cloudConfig)
-    {
-        return new LaMetricTimeImpl(localConfig, cloudConfig);
-    }
-
-    /**
-     * Create an instance of this API specifying detailed configuration for both
-     * the local and cloud APIs as well as the generic client.
-     *
-     * @param localConfig
-     *            the local API configuration for the new instance
-     * @param cloudConfig
-     *            the cloud API configuration for the new instance
-     * @param clientBuilder
-     *            the builder that will be used to create clients for
-     *            communicating with the device and cloud services
-     * @return the API instance
-     */
-    public static LaMetricTime create(LocalConfiguration localConfig,
-                                      CloudConfiguration cloudConfig,
-                                      ClientBuilder clientBuilder)
-    {
-        return new LaMetricTimeImpl(localConfig, cloudConfig, clientBuilder);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/BasicAuthenticator.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/BasicAuthenticator.java
deleted file mode 100644 (file)
index 3756a90..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * http://glassfish.java.net/public/CDDL+GPL_1_1.html
- * or packager/legal/LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at packager/legal/LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-package org.openhab.binding.lametrictime.api.authentication;
-
-import java.util.Base64;
-
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.core.HttpHeaders;
-
-/**
- * Implementation of Basic Http Authentication method (RFC 2617).
- *
- * @author Miroslav Fuksa
- * @author Jakub Podlesak (jakub.podlesak at oracle.com)
- * @author Craig McClanahan
- */
-final class BasicAuthenticator {
-
-    private final HttpAuthenticationFilter.Credentials defaultCredentials;
-
-    /**
-     * Creates a new instance of basic authenticator.
-     *
-     * @param defaultCredentials Credentials. Can be {@code null} if no default credentials should be
-     *            used.
-     */
-    BasicAuthenticator(HttpAuthenticationFilter.Credentials defaultCredentials) {
-        this.defaultCredentials = defaultCredentials;
-    }
-
-    private String calculateAuthentication(HttpAuthenticationFilter.Credentials credentials) {
-        String username = credentials.getUsername();
-        byte[] password = credentials.getPassword();
-        if (username == null) {
-            username = "";
-        }
-
-        if (password == null) {
-            password = new byte[0];
-        }
-
-        final byte[] prefix = (username + ":").getBytes(HttpAuthenticationFilter.CHARACTER_SET);
-        final byte[] usernamePassword = new byte[prefix.length + password.length];
-
-        System.arraycopy(prefix, 0, usernamePassword, 0, prefix.length);
-        System.arraycopy(password, 0, usernamePassword, prefix.length, password.length);
-
-        return "Basic " + Base64.getEncoder().encodeToString(usernamePassword);
-    }
-
-    /**
-     * Adds authentication information to the request.
-     *
-     * @param request Request context.
-     * @throws RequestAuthenticationException in case that basic credentials missing or are in invalid format
-     */
-    public void filterRequest(ClientRequestContext request) throws RequestAuthenticationException {
-        HttpAuthenticationFilter.Credentials credentials = HttpAuthenticationFilter.getCredentials(request,
-                defaultCredentials, HttpAuthenticationFilter.Type.BASIC);
-        if (credentials == null) {
-            throw new RequestAuthenticationException("BasicAuth credentials are missing.");
-        }
-        request.getHeaders().add(HttpHeaders.AUTHORIZATION, calculateAuthentication(credentials));
-    }
-
-    /**
-     * Checks the response and if basic authentication is required then performs a new request
-     * with basic authentication.
-     *
-     * @param request Request context.
-     * @param response Response context (will be updated with newest response data if the request was repeated).
-     * @return {@code true} if response does not require authentication or if authentication is required,
-     *         new request was done with digest authentication information and authentication was successful.
-     * @throws ResponseAuthenticationException in case that basic credentials missing or are in invalid format
-     */
-    public boolean filterResponseAndAuthenticate(ClientRequestContext request, ClientResponseContext response) {
-        final String authenticate = response.getHeaders().getFirst(HttpHeaders.WWW_AUTHENTICATE);
-        if (authenticate != null && authenticate.trim().toUpperCase().startsWith("BASIC")) {
-            HttpAuthenticationFilter.Credentials credentials = HttpAuthenticationFilter.getCredentials(request,
-                    defaultCredentials, HttpAuthenticationFilter.Type.BASIC);
-
-            if (credentials == null) {
-                throw new ResponseAuthenticationException(null, "BasicAuth credentials are missing.");
-            }
-
-            return HttpAuthenticationFilter.repeatRequest(request, response, calculateAuthentication(credentials));
-        }
-        return false;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/HttpAuthenticationFeature.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/HttpAuthenticationFeature.java
deleted file mode 100644 (file)
index 6e6027c..0000000
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * http://glassfish.java.net/public/CDDL+GPL_1_1.html
- * or packager/legal/LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at packager/legal/LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-package org.openhab.binding.lametrictime.api.authentication;
-
-import javax.ws.rs.core.Feature;
-import javax.ws.rs.core.FeatureContext;
-
-/**
- * Features that provides Http Basic and Digest client authentication (based on RFC 2617).
- * <p>
- * The feature can work in following modes:
- * <ul>
- * <li><b>BASIC:</b> Basic preemptive authentication. In preemptive mode the authentication information
- * is send always with each HTTP request. This mode is more usual than the following non-preemptive mode
- * (if you require BASIC authentication you will probably use this preemptive mode). This mode must
- * be combined with usage of SSL/TLS as the password is send only BASE64 encoded.</li>
- * <li><i>BASIC NON-PREEMPTIVE:</i> Basic non-preemptive authentication. In non-preemptive mode the
- * authentication information is added only when server refuses the request with {@code 401} status code and
- * then the request is repeated with authentication information. This mode has negative impact on the performance.
- * The advantage is that it does not send credentials when they are not needed. This mode must
- * be combined with usage of SSL/TLS as the password is send only BASE64 encoded.
- * </li>
- * <li><b>DIGEST:</b> Http digest authentication. Does not require usage of SSL/TLS.</li>
- * <li><b>UNIVERSAL:</b> Combination of basic and digest authentication. The feature works in non-preemptive
- * mode which means that it sends requests without authentication information. If {@code 401} status
- * code is returned, the request is repeated and an appropriate authentication is used based on the
- * authentication requested in the response (defined in {@code WWW-Authenticate} HTTP header. The feature
- * remembers which authentication requests were successful for given URI and next time tries to preemptively
- * authenticate against this URI with latest successful authentication method.
- * </li>
- * </ul>
- * </p>
- * <p>
- * To initialize the feature use static method of this feature.
- * </p>
- * <p>
- * Example of building the feature in
- * Basic authentication mode:
- *
- * <pre>
- * HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("user", "superSecretPassword");
- * </pre>
- * </p>
- * <p>
- * Example of building the feature in basic non-preemptive mode:
- *
- * <pre>
- * HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder().nonPreemptive()
- *         .credentials("user", "superSecretPassword").build();
- * </pre>
- * </p>
- * <p>
- * Example of building the feature in universal mode:
- *
- * <pre>
- * HttpAuthenticationFeature feature = HttpAuthenticationFeature.universal("user", "superSecretPassword");
- * </pre>
- * </p>
- * <p>
- * Example of building the feature in universal mode with different credentials for basic and digest:
- *
- * <pre>
- * HttpAuthenticationFeature feature = HttpAuthenticationFeature.universalBuilder()
- *         .credentialsForBasic("user", "123456").credentials("adminuser", "hello").build();
- * </pre>
- * </p>
- * Example of building the feature in basic preemptive mode with no default credentials. Credentials will have
- * to be supplied with each request using request properties (see below):
- *
- * <pre>
- * HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder().build();
- * </pre>
- * </p>
- * <p>
- * Once the feature is built it needs to be registered into the {@link javax.ws.rs.client.Client},
- * {@link javax.ws.rs.client.WebTarget} or other client configurable object. Example:
- *
- * <pre>
- * final Client client = ClientBuilder.newClient();
- * client.register(feature);
- * </pre>
- * </p>
- *
- * Then you invoke requests as usual and authentication will be handled by the feature.
- * You can change the credentials for each request using properties
- *
- * <pre>
- * final Response response = client.target("http://localhost:8080/rest/homer/contact").request()
- *         .property(HTTP_AUTHENTICATION_BASIC_USERNAME, "homer")
- *         .property(HTTP_AUTHENTICATION_BASIC_PASSWORD, "p1swd745").get();
- * </pre>
- * <p>
- * This class also contains property key definitions for overriding only specific basic or digest credentials:
- * </p>
- *
- * @author Miroslav Fuksa
- *
- * @since 2.5
- */
-public class HttpAuthenticationFeature implements Feature {
-
-    /**
-     * Feature authentication mode.
-     */
-    static enum Mode {
-        /**
-         * Basic preemptive.
-         **/
-        BASIC_PREEMPTIVE,
-        /**
-         * Basic non preemptive
-         */
-        BASIC_NON_PREEMPTIVE,
-        /**
-         * Digest.
-         */
-        DIGEST,
-        /**
-         * Universal.
-         */
-        UNIVERSAL
-    }
-
-    /**
-     * Builder that creates instances of {@link HttpAuthenticationFeature}.
-     */
-    public static interface Builder {
-
-        /**
-         * Set credentials.
-         *
-         * @param username Username.
-         * @param password Password as byte array.
-         * @return This builder.
-         */
-        public Builder credentials(String username, byte[] password);
-
-        /**
-         * Set credentials.
-         *
-         * @param username Username.
-         * @param password Password as {@link String}.
-         * @return This builder.
-         */
-        public Builder credentials(String username, String password);
-
-        /**
-         * Build the feature.
-         *
-         * @return Http authentication feature configured from this builder.
-         */
-        public HttpAuthenticationFeature build();
-    }
-
-    /**
-     * Extension of {@link org.glassfish.jersey.client.authentication.HttpAuthenticationFeature.Builder}
-     * that builds the http authentication feature configured for basic authentication.
-     */
-    public static interface BasicBuilder extends Builder {
-
-        /**
-         * Configure the builder to create features in non-preemptive basic authentication mode.
-         *
-         * @return This builder.
-         */
-        public BasicBuilder nonPreemptive();
-    }
-
-    /**
-     * that builds the http authentication feature configured in universal mode that supports
-     * basic and digest authentication.
-     */
-    public static interface UniversalBuilder extends Builder {
-
-        /**
-         * Set credentials that will be used for basic authentication only.
-         *
-         * @param username Username.
-         * @param password Password as {@link String}.
-         * @return This builder.
-         */
-        public UniversalBuilder credentialsForBasic(String username, String password);
-
-        /**
-         * Set credentials that will be used for basic authentication only.
-         *
-         * @param username Username.
-         * @param password Password as {@code byte array}.
-         * @return This builder.
-         */
-        public UniversalBuilder credentialsForBasic(String username, byte[] password);
-
-        /**
-         * Set credentials that will be used for digest authentication only.
-         *
-         * @param username Username.
-         * @param password Password as {@link String}.
-         * @return This builder.
-         */
-        public UniversalBuilder credentialsForDigest(String username, String password);
-
-        /**
-         * Set credentials that will be used for digest authentication only.
-         *
-         * @param username Username.
-         * @param password Password as {@code byte array}.
-         * @return This builder.
-         */
-        public UniversalBuilder credentialsForDigest(String username, byte[] password);
-    }
-
-    /**
-     * Implementation of all authentication builders.
-     */
-    static class BuilderImpl implements UniversalBuilder, BasicBuilder {
-
-        private String usernameBasic;
-        private byte[] passwordBasic;
-        private String usernameDigest;
-        private byte[] passwordDigest;
-        private Mode mode;
-
-        /**
-         * Create a new builder.
-         *
-         * @param mode Mode in which the final authentication feature should work.
-         */
-        public BuilderImpl(Mode mode) {
-            this.mode = mode;
-        }
-
-        @Override
-        public Builder credentials(String username, String password) {
-            return credentials(username,
-                    password == null ? null : password.getBytes(HttpAuthenticationFilter.CHARACTER_SET));
-        }
-
-        @Override
-        public Builder credentials(String username, byte[] password) {
-            credentialsForBasic(username, password);
-            credentialsForDigest(username, password);
-            return this;
-        }
-
-        @Override
-        public UniversalBuilder credentialsForBasic(String username, String password) {
-            return credentialsForBasic(username,
-                    password == null ? null : password.getBytes(HttpAuthenticationFilter.CHARACTER_SET));
-        }
-
-        @Override
-        public UniversalBuilder credentialsForBasic(String username, byte[] password) {
-            this.usernameBasic = username;
-            this.passwordBasic = password;
-            return this;
-        }
-
-        @Override
-        public UniversalBuilder credentialsForDigest(String username, String password) {
-            return credentialsForDigest(username,
-                    password == null ? null : password.getBytes(HttpAuthenticationFilter.CHARACTER_SET));
-        }
-
-        @Override
-        public UniversalBuilder credentialsForDigest(String username, byte[] password) {
-            this.usernameDigest = username;
-            this.passwordDigest = password;
-            return this;
-        }
-
-        @Override
-        public HttpAuthenticationFeature build() {
-            return new HttpAuthenticationFeature(mode,
-                    usernameBasic == null ? null
-                            : new HttpAuthenticationFilter.Credentials(usernameBasic, passwordBasic),
-                    usernameDigest == null ? null
-                            : new HttpAuthenticationFilter.Credentials(usernameDigest, passwordDigest));
-        }
-
-        @Override
-        public BasicBuilder nonPreemptive() {
-            if (mode == Mode.BASIC_PREEMPTIVE) {
-                this.mode = Mode.BASIC_NON_PREEMPTIVE;
-            }
-            return this;
-        }
-    }
-
-    /**
-     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
-     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
-     * the username for http authentication feature for the request.
-     * <p>
-     * Example:
-     *
-     * <pre>
-     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
-     *         .property(HTTP_AUTHENTICATION_USERNAME, "joe").property(HTTP_AUTHENTICATION_PASSWORD, "p1swd745").get();
-     * </pre>
-     * </p>
-     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_PASSWORD} property
-     * (as shown in the example). This property pair overrides all password settings of the authentication
-     * feature for the current request.
-     * <p>
-     * The default value must be instance of {@link String}.
-     * </p>
-     * <p>
-     * The name of the configuration property is <tt>{@value}</tt>.
-     * </p>
-     */
-    public static final String HTTP_AUTHENTICATION_USERNAME = "jersey.config.client.http.auth.username";
-    /**
-     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
-     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
-     * the password for http authentication feature for the request.
-     * <p>
-     * Example:
-     *
-     * <pre>
-     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
-     *         .property(HTTP_AUTHENTICATION_USERNAME, "joe").property(HTTP_AUTHENTICATION_PASSWORD, "p1swd745").get();
-     * </pre>
-     * </p>
-     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_USERNAME} property
-     * (as shown in the example). This property pair overrides all password settings of the authentication
-     * feature for the current request.
-     * <p>
-     * The value must be instance of {@link String} or {@code byte} array ({@code byte[]}).
-     * </p>
-     * <p>
-     * The name of the configuration property is <tt>{@value}</tt>.
-     * </p>
-     */
-    public static final String HTTP_AUTHENTICATION_PASSWORD = "jersey.config.client.http.auth.password";
-
-    /**
-     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
-     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
-     * the username for http basic authentication feature for the request.
-     * <p>
-     * Example:
-     *
-     * <pre>
-     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
-     *         .property(HTTP_AUTHENTICATION_BASIC_USERNAME, "joe").property(HTTP_AUTHENTICATION_BASIC_PASSWORD, "p1swd745")
-     *         .get();
-     * </pre>
-     * </p>
-     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_PASSWORD} property
-     * (as shown in the example). The property pair influence only credentials used during basic authentication.
-     *
-     * <p>
-     * The value must be instance of {@link String}.
-     * </p>
-     * <p>
-     * The name of the configuration property is <tt>{@value}</tt>.
-     * </p>
-     *
-     */
-    public static final String HTTP_AUTHENTICATION_BASIC_USERNAME = "jersey.config.client.http.auth.basic.username";
-
-    /**
-     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
-     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
-     * the password for http basic authentication feature for the request.
-     * <p>
-     * Example:
-     *
-     * <pre>
-     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
-     *         .property(HTTP_AUTHENTICATION_BASIC_USERNAME, "joe").property(HTTP_AUTHENTICATION_BASIC_PASSWORD, "p1swd745")
-     *         .get();
-     * </pre>
-     * </p>
-     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_USERNAME} property
-     * (as shown in the example). The property pair influence only credentials used during basic authentication.
-     * <p>
-     * The value must be instance of {@link String} or {@code byte} array ({@code byte[]}).
-     * </p>
-     * <p>
-     * The name of the configuration property is <tt>{@value}</tt>.
-     * </p>
-     */
-    public static final String HTTP_AUTHENTICATION_BASIC_PASSWORD = "jersey.config.client.http.auth.basic.password";
-
-    /**
-     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
-     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
-     * the username for http digest authentication feature for the request.
-     * <p>
-     * Example:
-     *
-     * <pre>
-     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
-     *         .property(HTTP_AUTHENTICATION_DIGEST_USERNAME, "joe")
-     *         .property(HTTP_AUTHENTICATION_DIGEST_PASSWORD, "p1swd745").get();
-     * </pre>
-     * </p>
-     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_PASSWORD} property
-     * (as shown in the example). The property pair influence only credentials used during digest authentication.
-     * <p>
-     * The value must be instance of {@link String}.
-     * </p>
-     * <p>
-     * The name of the configuration property is <tt>{@value}</tt>.
-     * </p>
-     */
-    public static final String HTTP_AUTHENTICATION_DIGEST_USERNAME = "jersey.config.client.http.auth.digest.username";
-
-    /**
-     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
-     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
-     * the password for http digest authentication feature for the request.
-     * <p>
-     * Example:
-     *
-     * <pre>
-     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
-     *         .property(HTTP_AUTHENTICATION_DIGEST_USERNAME, "joe")
-     *         .property(HTTP_AUTHENTICATION_DIGEST_PASSWORD, "p1swd745").get();
-     * </pre>
-     * </p>
-     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_PASSWORD} property
-     * (as shown in the example). The property pair influence only credentials used during digest authentication.
-     * <p>
-     * The value must be instance of {@link String} or {@code byte} array ({@code byte[]}).
-     * </p>
-     * <p>
-     * The name of the configuration property is <tt>{@value}</tt>.
-     * </p>
-     */
-    public static final String HTTP_AUTHENTICATION_DIGEST_PASSWORD = "jersey.config.client.http.auth.digest.password";
-
-    /**
-     * Create the builder of the http authentication feature working in basic authentication mode. The builder
-     * can build preemptive and non-preemptive basic authentication features.
-     *
-     * @return Basic http authentication builder.
-     */
-    public static BasicBuilder basicBuilder() {
-        return new BuilderImpl(Mode.BASIC_PREEMPTIVE);
-    }
-
-    /**
-     * Create the http authentication feature in basic preemptive authentication mode initialized with credentials.
-     *
-     * @param username Username.
-     * @param password Password as {@code byte array}.
-     * @return Http authentication feature configured in basic mode.
-     */
-    public static HttpAuthenticationFeature basic(String username, byte[] password) {
-        return build(Mode.BASIC_PREEMPTIVE, username, password);
-    }
-
-    /**
-     * Create the http authentication feature in basic preemptive authentication mode initialized with credentials.
-     *
-     * @param username Username.
-     * @param password Password as {@link String}.
-     * @return Http authentication feature configured in basic mode.
-     */
-    public static HttpAuthenticationFeature basic(String username, String password) {
-        return build(Mode.BASIC_PREEMPTIVE, username, password);
-    }
-
-    /**
-     * Create the http authentication feature in digest authentication mode initialized without default
-     * credentials. Credentials will have to be supplied using request properties for each request.
-     *
-     * @return Http authentication feature configured in digest mode.
-     */
-    public static HttpAuthenticationFeature digest() {
-        return build(Mode.DIGEST);
-    }
-
-    /**
-     * Create the http authentication feature in digest authentication mode initialized with credentials.
-     *
-     * @param username Username.
-     * @param password Password as {@code byte array}.
-     * @return Http authentication feature configured in digest mode.
-     */
-    public static HttpAuthenticationFeature digest(String username, byte[] password) {
-        return build(Mode.DIGEST, username, password);
-    }
-
-    /**
-     * Create the http authentication feature in digest authentication mode initialized with credentials.
-     *
-     * @param username Username.
-     * @param password Password as {@link String}.
-     * @return Http authentication feature configured in digest mode.
-     */
-    public static HttpAuthenticationFeature digest(String username, String password) {
-        return build(Mode.DIGEST, username, password);
-    }
-
-    /**
-     * Create the builder that builds http authentication feature in combined mode supporting both,
-     * basic and digest authentication.
-     *
-     * @return Universal builder.
-     */
-    public static UniversalBuilder universalBuilder() {
-        return new BuilderImpl(Mode.UNIVERSAL);
-    }
-
-    /**
-     * Create the http authentication feature in combined mode supporting both,
-     * basic and digest authentication.
-     *
-     * @param username Username.
-     * @param password Password as {@code byte array}.
-     * @return Http authentication feature configured in digest mode.
-     */
-    public static HttpAuthenticationFeature universal(String username, byte[] password) {
-        return build(Mode.UNIVERSAL, username, password);
-    }
-
-    /**
-     * Create the http authentication feature in combined mode supporting both,
-     * basic and digest authentication.
-     *
-     * @param username Username.
-     * @param password Password as {@link String}.
-     * @return Http authentication feature configured in digest mode.
-     */
-    public static HttpAuthenticationFeature universal(String username, String password) {
-        return build(Mode.UNIVERSAL, username, password);
-    }
-
-    private static HttpAuthenticationFeature build(Mode mode) {
-        return new BuilderImpl(mode).build();
-    }
-
-    private static HttpAuthenticationFeature build(Mode mode, String username, byte[] password) {
-        return new BuilderImpl(mode).credentials(username, password).build();
-    }
-
-    private static HttpAuthenticationFeature build(Mode mode, String username, String password) {
-        return new BuilderImpl(mode).credentials(username, password).build();
-    }
-
-    private final Mode mode;
-    private final HttpAuthenticationFilter.Credentials basicCredentials;
-
-    private HttpAuthenticationFeature(Mode mode, HttpAuthenticationFilter.Credentials basicCredentials,
-            HttpAuthenticationFilter.Credentials digestCredentials) {
-        this.mode = mode;
-        this.basicCredentials = basicCredentials;
-    }
-
-    @Override
-    public boolean configure(FeatureContext context) {
-        context.register(new HttpAuthenticationFilter(mode, basicCredentials, context.getConfiguration()));
-        return true;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/HttpAuthenticationFilter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/HttpAuthenticationFilter.java
deleted file mode 100644 (file)
index c61c029..0000000
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * http://glassfish.java.net/public/CDDL+GPL_1_1.html
- * or packager/legal/LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at packager/legal/LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.openhab.binding.lametrictime.api.authentication;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.nio.charset.Charset;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Priority;
-import javax.ws.rs.Priorities;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientRequestFilter;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Configuration;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-
-/**
- * Http Authentication filter that provides basic and digest authentication (based on RFC 2617).
- *
- * @author Miroslav Fuksa
- */
-@Priority(Priorities.AUTHENTICATION)
-class HttpAuthenticationFilter implements ClientRequestFilter, ClientResponseFilter {
-
-    /**
-     * Authentication type.
-     */
-    enum Type {
-        /**
-         * Basic authentication.
-         */
-        BASIC
-    }
-
-    private static final String REQUEST_PROPERTY_FILTER_REUSED = "org.openhab.binding.lametrictime.api.authentication.HttpAuthenticationFilter.reused";
-    private static final String REQUEST_PROPERTY_OPERATION = "org.openhab.binding.lametrictime.api.authentication.HttpAuthenticationFilter.operation";
-
-    /**
-     * Encoding used for authentication calculations.
-     */
-    static final Charset CHARACTER_SET = Charset.forName("iso-8859-1");
-
-    private final HttpAuthenticationFeature.Mode mode;
-
-    private final BasicAuthenticator basicAuth;
-
-    /**
-     * Create a new filter instance.
-     *
-     * @param mode Mode.
-     * @param basicCredentials Basic credentials (can be {@code null} if this filter does not work in the
-     *            basic mode or if no default credentials are defined).
-     * @param digestCredentials Digest credentials (can be {@code null} if this filter does not work in the
-     *            digest mode or if no default credentials are defined).
-     * @param configuration Configuration (non-{@code null}).
-     */
-    HttpAuthenticationFilter(HttpAuthenticationFeature.Mode mode, Credentials basicCredentials,
-            Configuration configuration) {
-        this.mode = mode;
-        switch (mode) {
-            case BASIC_PREEMPTIVE:
-            case BASIC_NON_PREEMPTIVE:
-                this.basicAuth = new BasicAuthenticator(basicCredentials);
-                break;
-            case UNIVERSAL:
-                this.basicAuth = new BasicAuthenticator(basicCredentials);
-                break;
-            default:
-                throw new IllegalStateException("Not implemented.");
-        }
-    }
-
-    @Override
-    public void filter(ClientRequestContext request) throws IOException {
-        if ("true".equals(request.getProperty(REQUEST_PROPERTY_FILTER_REUSED))) {
-            return;
-        }
-
-        if (request.getHeaders().containsKey(HttpHeaders.AUTHORIZATION)) {
-            return;
-        }
-
-        Type operation = null;
-        if (mode == HttpAuthenticationFeature.Mode.BASIC_PREEMPTIVE) {
-            basicAuth.filterRequest(request);
-            operation = Type.BASIC;
-        } else if (mode == HttpAuthenticationFeature.Mode.BASIC_NON_PREEMPTIVE) {
-            // do nothing
-        }
-
-        if (operation != null) {
-            request.setProperty(REQUEST_PROPERTY_OPERATION, operation);
-        }
-    }
-
-    @Override
-    public void filter(ClientRequestContext request, ClientResponseContext response) throws IOException {
-        if ("true".equals(request.getProperty(REQUEST_PROPERTY_FILTER_REUSED))) {
-            return;
-        }
-
-        Type result = null; // which authentication is requested: BASIC or DIGEST
-        boolean authenticate;
-
-        if (response.getStatus() == Response.Status.UNAUTHORIZED.getStatusCode()) {
-            String authString = response.getHeaders().getFirst(HttpHeaders.WWW_AUTHENTICATE);
-            if (authString != null) {
-                final String upperCaseAuth = authString.trim().toUpperCase();
-                if (upperCaseAuth.startsWith("BASIC")) {
-                    result = Type.BASIC;
-                } else {
-                    // unknown authentication -> this filter cannot authenticate with this method
-                    return;
-                }
-            }
-            authenticate = true;
-        } else {
-            authenticate = false;
-        }
-
-        if (mode == HttpAuthenticationFeature.Mode.BASIC_PREEMPTIVE) {
-            // do nothing -> 401 will be returned to the client
-        } else if (mode == HttpAuthenticationFeature.Mode.BASIC_NON_PREEMPTIVE) {
-            if (authenticate && result == Type.BASIC) {
-                basicAuth.filterResponseAndAuthenticate(request, response);
-            }
-        } else if (mode == HttpAuthenticationFeature.Mode.UNIVERSAL) {
-            if (authenticate) {
-                boolean success = false;
-
-                // now we have the challenge response and we can authenticate
-                if (result == Type.BASIC) {
-                    success = basicAuth.filterResponseAndAuthenticate(request, response);
-                }
-            }
-        }
-    }
-
-    private String getCacheKey(ClientRequestContext request) {
-        return request.getUri().toString() + ":" + request.getMethod();
-    }
-
-    /**
-     * Repeat the {@code request} with provided {@code newAuthorizationHeader}
-     * and update the {@code response} with newest response data.
-     *
-     * @param request Request context.
-     * @param response Response context (will be updated with the new response data).
-     * @param newAuthorizationHeader {@code Authorization} header that should be added to the new request.
-     * @return {@code true} is the authentication was successful ({@code true} if 401 response code was not returned;
-     *         {@code false} otherwise).
-     */
-    static boolean repeatRequest(ClientRequestContext request, ClientResponseContext response,
-            String newAuthorizationHeader) {
-        Client client = ClientBuilder.newClient(request.getConfiguration());
-        String method = request.getMethod();
-        MediaType mediaType = request.getMediaType();
-        URI lUri = request.getUri();
-
-        WebTarget resourceTarget = client.target(lUri);
-
-        Invocation.Builder builder = resourceTarget.request(mediaType);
-
-        MultivaluedMap<String, Object> newHeaders = new MultivaluedHashMap<String, Object>();
-
-        for (Map.Entry<String, List<Object>> entry : request.getHeaders().entrySet()) {
-            if (HttpHeaders.AUTHORIZATION.equals(entry.getKey())) {
-                continue;
-            }
-            newHeaders.put(entry.getKey(), entry.getValue());
-        }
-
-        newHeaders.add(HttpHeaders.AUTHORIZATION, newAuthorizationHeader);
-        builder.headers(newHeaders);
-
-        builder.property(REQUEST_PROPERTY_FILTER_REUSED, "true");
-
-        Invocation invocation;
-        if (request.getEntity() == null) {
-            invocation = builder.build(method);
-        } else {
-            invocation = builder.build(method, Entity.entity(request.getEntity(), request.getMediaType()));
-        }
-        Response nextResponse = invocation.invoke();
-
-        if (nextResponse.hasEntity()) {
-            response.setEntityStream(nextResponse.readEntity(InputStream.class));
-        }
-        MultivaluedMap<String, String> headers = response.getHeaders();
-        headers.clear();
-        headers.putAll(nextResponse.getStringHeaders());
-        response.setStatus(nextResponse.getStatus());
-
-        return response.getStatus() != Response.Status.UNAUTHORIZED.getStatusCode();
-    }
-
-    /**
-     * Credentials (username + password).
-     */
-    static class Credentials {
-
-        private final String username;
-        private final byte[] password;
-
-        /**
-         * Create a new credentials from username and password as byte array.
-         *
-         * @param username Username.
-         * @param password Password as byte array.
-         */
-        Credentials(String username, byte[] password) {
-            this.username = username;
-            this.password = password;
-        }
-
-        /**
-         * Create a new credentials from username and password as {@link String}.
-         *
-         * @param username Username.
-         * @param password {@code String} password.
-         */
-        Credentials(String username, String password) {
-            this.username = username;
-            this.password = password == null ? null : password.getBytes(CHARACTER_SET);
-        }
-
-        /**
-         * Return username.
-         *
-         * @return username.
-         */
-        String getUsername() {
-            return username;
-        }
-
-        /**
-         * Return password as byte array.
-         *
-         * @return Password string in byte array representation.
-         */
-        byte[] getPassword() {
-            return password;
-        }
-    }
-
-    private static Credentials extractCredentials(ClientRequestContext request, Type type) {
-        String usernameKey = null;
-        String passwordKey = null;
-        if (type == null) {
-            usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME;
-            passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD;
-        } else if (type == Type.BASIC) {
-            usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME;
-            passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD;
-        }
-
-        String userName = (String) request.getProperty(usernameKey);
-        if (userName != null && !userName.equals("")) {
-            byte[] pwdBytes;
-            Object password = request.getProperty(passwordKey);
-            if (password instanceof byte[]) {
-                pwdBytes = ((byte[]) password);
-            } else if (password instanceof String) {
-                pwdBytes = ((String) password).getBytes(CHARACTER_SET);
-            } else {
-                throw new RequestAuthenticationException("Passwort invalid.");
-            }
-            return new Credentials(userName, pwdBytes);
-        }
-        return null;
-    }
-
-    /**
-     * Get credentials actual for the current request. Priorities in credentials selection are the following:
-     * <ol>
-     * <li>Basic/digest specific credentials defined in the request properties</li>
-     * <li>Common credentials defined in the request properties</li>
-     * <li>{@code defaultCredentials}</li>
-     * </ol>
-     *
-     * @param request Request from which credentials should be extracted.
-     * @param defaultCredentials Default credentials (can be {@code null}).
-     * @param type Type of requested credentials.
-     * @return Credentials or {@code null} if no credentials are found and {@code defaultCredentials} are {@code null}.
-     * @throws RequestAuthenticationException in case the {@code username} or {@code password} is invalid.
-     */
-    static Credentials getCredentials(ClientRequestContext request, Credentials defaultCredentials, Type type) {
-        Credentials commonCredentials = extractCredentials(request, type);
-
-        if (commonCredentials != null) {
-            return commonCredentials;
-        } else {
-            Credentials specificCredentials = extractCredentials(request, null);
-
-            return specificCredentials != null ? specificCredentials : defaultCredentials;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/RequestAuthenticationException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/RequestAuthenticationException.java
deleted file mode 100644 (file)
index adbb9bf..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * http://glassfish.java.net/public/CDDL+GPL_1_1.html
- * or packager/legal/LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at packager/legal/LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-package org.openhab.binding.lametrictime.api.authentication;
-
-import javax.ws.rs.ProcessingException;
-
-/**
- * Exception thrown by security request authentication.
- *
- * @author Petr Bouda (petr.bouda at oracle.com)
- */
-public class RequestAuthenticationException extends ProcessingException {
-
-    /**
-     * Creates new instance of this exception with exception cause.
-     *
-     * @param cause Exception cause.
-     */
-    public RequestAuthenticationException(Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * Creates new instance of this exception with exception message.
-     *
-     * @param message Exception message.
-     */
-    public RequestAuthenticationException(String message) {
-        super(message);
-    }
-
-    /**
-     * Creates new instance of this exception with exception message and exception cause.
-     *
-     * @param message Exception message.
-     * @param cause Exception cause.
-     */
-    public RequestAuthenticationException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/ResponseAuthenticationException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/authentication/ResponseAuthenticationException.java
deleted file mode 100644 (file)
index 03fa4aa..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * http://glassfish.java.net/public/CDDL+GPL_1_1.html
- * or packager/legal/LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at packager/legal/LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-package org.openhab.binding.lametrictime.api.authentication;
-
-import javax.ws.rs.client.ResponseProcessingException;
-import javax.ws.rs.core.Response;
-
-/**
- * Exception thrown by security response authentication.
- *
- * @author Petr Bouda (petr.bouda at oracle.com)
- */
-public class ResponseAuthenticationException extends ResponseProcessingException {
-
-    /**
-     * Creates new instance of this exception with exception cause.
-     *
-     * @param response the response instance for which the processing failed.
-     * @param cause Exception cause.
-     */
-    public ResponseAuthenticationException(Response response, Throwable cause) {
-        super(response, cause);
-    }
-
-    /**
-     * Creates new instance of this exception with exception message.
-     *
-     * @param response the response instance for which the processing failed.
-     * @param message Exception message.
-     */
-    public ResponseAuthenticationException(Response response, String message) {
-        super(response, message);
-    }
-
-    /**
-     * Creates new instance of this exception with exception message and exception cause.
-     *
-     * @param response the response instance for which the processing failed.
-     * @param message Exception message.
-     * @param cause Exception cause.
-     */
-    public ResponseAuthenticationException(Response response, String message, Throwable cause) {
-        super(response, message, cause);
-    }
-
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/CloudConfiguration.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/CloudConfiguration.java
deleted file mode 100644 (file)
index 8f217a0..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud;
-
-import java.net.URI;
-
-public class CloudConfiguration
-{
-    private URI baseUri = URI.create("https://developer.lametric.com/api/v2");
-
-    private boolean logging = false;
-    private String logLevel = "INFO";
-    private int logMax = 104857600; // 100kb
-
-    public URI getBaseUri()
-    {
-        return baseUri;
-    }
-
-    public void setBaseUri(URI baseUri)
-    {
-        this.baseUri = baseUri;
-    }
-
-    public CloudConfiguration withBaseUri(URI baseUri)
-    {
-        this.baseUri = baseUri;
-        return this;
-    }
-
-    public boolean isLogging()
-    {
-        return logging;
-    }
-
-    public void setLogging(boolean logging)
-    {
-        this.logging = logging;
-    }
-
-    public CloudConfiguration withLogging(boolean logging)
-    {
-        this.logging = logging;
-        return this;
-    }
-
-    public String getLogLevel()
-    {
-        return logLevel;
-    }
-
-    public void setLogLevel(String logLevel)
-    {
-        this.logLevel = logLevel;
-    }
-
-    public CloudConfiguration withLogLevel(String logLevel)
-    {
-        this.logLevel = logLevel;
-        return this;
-    }
-
-    public int getLogMax()
-    {
-        return logMax;
-    }
-
-    public void setLogMax(int logMax)
-    {
-        this.logMax = logMax;
-    }
-
-    public CloudConfiguration withLogMax(int logMax)
-    {
-        this.logMax = logMax;
-        return this;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/LaMetricTimeCloud.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/LaMetricTimeCloud.java
deleted file mode 100644 (file)
index 06f06ad..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud;
-
-import javax.ws.rs.client.ClientBuilder;
-
-import org.openhab.binding.lametrictime.api.cloud.impl.LaMetricTimeCloudImpl;
-import org.openhab.binding.lametrictime.api.cloud.model.IconFilter;
-import org.openhab.binding.lametrictime.api.cloud.model.Icons;
-
-public interface LaMetricTimeCloud
-{
-    public Icons getIcons();
-
-    public Icons getIcons(IconFilter filter);
-
-    public static LaMetricTimeCloud create(CloudConfiguration config)
-    {
-        return new LaMetricTimeCloudImpl(config);
-    }
-
-    public static LaMetricTimeCloud create(CloudConfiguration config, ClientBuilder clientBuilder)
-    {
-        return new LaMetricTimeCloudImpl(config, clientBuilder);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/impl/LaMetricTimeCloudImpl.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/impl/LaMetricTimeCloudImpl.java
deleted file mode 100644 (file)
index 11cdf97..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud.impl;
-
-import java.util.logging.Logger;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.core.MediaType;
-
-import org.openhab.binding.lametrictime.api.cloud.CloudConfiguration;
-import org.openhab.binding.lametrictime.api.cloud.LaMetricTimeCloud;
-import org.openhab.binding.lametrictime.api.cloud.model.IconFilter;
-import org.openhab.binding.lametrictime.api.cloud.model.Icons;
-import org.openhab.binding.lametrictime.api.common.impl.AbstractClient;
-import org.openhab.binding.lametrictime.api.filter.LoggingFilter;
-import org.openhab.binding.lametrictime.internal.GsonProvider;
-
-public class LaMetricTimeCloudImpl extends AbstractClient implements LaMetricTimeCloud {
-    private final CloudConfiguration config;
-
-    public LaMetricTimeCloudImpl(CloudConfiguration config) {
-        this.config = config;
-    }
-
-    public LaMetricTimeCloudImpl(CloudConfiguration config, ClientBuilder clientBuilder) {
-        super(clientBuilder);
-        this.config = config;
-    }
-
-    @Override
-    public Icons getIcons() {
-        return getClient().target(config.getBaseUri()).path("/icons").request(MediaType.APPLICATION_JSON_TYPE)
-                .get(Icons.class);
-    }
-
-    @Override
-    public Icons getIcons(IconFilter filter) {
-        return getClient().target(config.getBaseUri()).path("/icons").queryParam("page", filter.getPage())
-                .queryParam("page_size", filter.getPageSize()).queryParam("fields", filter.getFieldsString())
-                .queryParam("order", filter.getOrderString()).request(MediaType.APPLICATION_JSON_TYPE).get(Icons.class);
-    }
-
-    @Override
-    protected Client createClient() {
-        ClientBuilder builder = getClientBuilder();
-
-        // setup Gson (de)serialization
-        GsonProvider<Object> gsonProvider = new GsonProvider<>();
-        builder.register(gsonProvider);
-
-        // turn on logging if requested
-        if (config.isLogging()) {
-            builder.register(
-                    new LoggingFilter(Logger.getLogger(LaMetricTimeCloudImpl.class.getName()), config.getLogMax()));
-        }
-
-        return builder.build();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/Icon.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/Icon.java
deleted file mode 100644 (file)
index 99df945..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud.model;
-
-public class Icon
-{
-    private Integer id;
-    private String title;
-    private String code;
-    private IconType type;
-    private String category;
-    private String url;
-    private Thumb thumb;
-
-    public Integer getId()
-    {
-        return id;
-    }
-
-    public void setId(Integer id)
-    {
-        this.id = id;
-    }
-
-    public Icon withId(Integer id)
-    {
-        this.id = id;
-        return this;
-    }
-
-    public String getTitle()
-    {
-        return title;
-    }
-
-    public void setTitle(String title)
-    {
-        this.title = title;
-    }
-
-    public Icon withTitle(String title)
-    {
-        this.title = title;
-        return this;
-    }
-
-    public String getCode()
-    {
-        return code;
-    }
-
-    public void setCode(String code)
-    {
-        this.code = code;
-    }
-
-    public Icon withCode(String code)
-    {
-        this.code = code;
-        return this;
-    }
-
-    public IconType getType()
-    {
-        return type;
-    }
-
-    public void setType(IconType type)
-    {
-        this.type = type;
-    }
-
-    public Icon withType(IconType type)
-    {
-        this.type = type;
-        return this;
-    }
-
-    public String getCategory()
-    {
-        return category;
-    }
-
-    public void setCategory(String category)
-    {
-        this.category = category;
-    }
-
-    public Icon withCategory(String category)
-    {
-        this.category = category;
-        return this;
-    }
-
-    public String getUrl()
-    {
-        return url;
-    }
-
-    public void setUrl(String url)
-    {
-        this.url = url;
-    }
-
-    public Icon withUrl(String url)
-    {
-        this.url = url;
-        return this;
-    }
-
-    public Thumb getThumb()
-    {
-        return thumb;
-    }
-
-    public void setThumb(Thumb thumb)
-    {
-        this.thumb = thumb;
-    }
-
-    public Icon withThumb(Thumb thumb)
-    {
-        this.thumb = thumb;
-        return this;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconField.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconField.java
deleted file mode 100644 (file)
index 4ea57dc..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud.model;
-
-import com.google.gson.annotations.SerializedName;
-
-public enum IconField
-{
- @SerializedName("id")
- ID,
- @SerializedName("title")
- TITLE,
- @SerializedName("code")
- CODE,
- @SerializedName("type")
- TYPE,
- @SerializedName("url")
- URL,
- @SerializedName("thumb")
- THUMB
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconFilter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconFilter.java
deleted file mode 100644 (file)
index 2d2da0a..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud.model;
-
-import java.util.List;
-
-public class IconFilter
-{
-    private Integer page;
-    private Integer pageSize;
-    private List<IconField> fields;
-    private IconOrder order;
-
-    public Integer getPage()
-    {
-        return page;
-    }
-
-    public void setPage(Integer page)
-    {
-        this.page = page;
-    }
-
-    public IconFilter withPage(Integer page)
-    {
-        this.page = page;
-        return this;
-    }
-
-    public Integer getPageSize()
-    {
-        return pageSize;
-    }
-
-    public void setPageSize(Integer pageSize)
-    {
-        this.pageSize = pageSize;
-    }
-
-    public IconFilter withPageSize(Integer pageSize)
-    {
-        this.pageSize = pageSize;
-        return this;
-    }
-
-    public List<IconField> getFields()
-    {
-        return fields;
-    }
-
-    public String getFieldsString()
-    {
-        if (fields == null || fields.isEmpty())
-        {
-            return null;
-        }
-
-        StringBuilder builder = new StringBuilder();
-        builder.append(fields.get(0).name().toLowerCase());
-
-        for (int i = 1; i < fields.size(); i++)
-        {
-            builder.append(',').append(fields.get(i).name().toLowerCase());
-        }
-
-        return builder.toString();
-    }
-
-    public void setFields(List<IconField> fields)
-    {
-        this.fields = fields;
-    }
-
-    public IconFilter withFields(List<IconField> fields)
-    {
-        this.fields = fields;
-        return this;
-    }
-
-    public IconOrder getOrder()
-    {
-        return order;
-    }
-
-    public String getOrderString()
-    {
-        return order == null ? null : order.name().toLowerCase();
-    }
-
-    public void setOrder(IconOrder order)
-    {
-        this.order = order;
-    }
-
-    public IconFilter withOrder(IconOrder order)
-    {
-        this.order = order;
-        return this;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconOrder.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconOrder.java
deleted file mode 100644 (file)
index bad2ad3..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud.model;
-
-import com.google.gson.annotations.SerializedName;
-
-public enum IconOrder
-{
- @SerializedName("popular")
- POPULAR,
- @SerializedName("newest")
- NEWEST,
- @SerializedName("title")
- TITLE
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconType.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconType.java
deleted file mode 100644 (file)
index 8c7290f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud.model;
-
-import com.google.gson.annotations.SerializedName;
-
-public enum IconType
-{
- @SerializedName("picture")
- PICTURE,
- @SerializedName("movie")
- MOVIE
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/Icons.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/Icons.java
deleted file mode 100644 (file)
index e38a5f6..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Icons
-{
-    private IconsMetadata meta;
-    private List<Icon> data = new ArrayList<Icon>();
-
-    public IconsMetadata getMeta()
-    {
-        return meta;
-    }
-
-    public void setMeta(IconsMetadata meta)
-    {
-        this.meta = meta;
-    }
-
-    public Icons withMeta(IconsMetadata meta)
-    {
-        this.meta = meta;
-        return this;
-    }
-
-    public List<Icon> getData()
-    {
-        return data;
-    }
-
-    public void setData(List<Icon> data)
-    {
-        this.data = data;
-    }
-
-    public Icons withData(List<Icon> data)
-    {
-        this.data = data;
-        return this;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconsMetadata.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/IconsMetadata.java
deleted file mode 100644 (file)
index 2a7f639..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud.model;
-
-public class IconsMetadata
-{
-    private Integer totalIconCount;
-    private Integer page;
-    private Integer pageSize;
-    private Integer pageCount;
-
-    public Integer getTotalIconCount()
-    {
-        return totalIconCount;
-    }
-
-    public void setTotalIconCount(Integer totalIconCount)
-    {
-        this.totalIconCount = totalIconCount;
-    }
-
-    public IconsMetadata withTotalIconCount(Integer totalIconCount)
-    {
-        this.totalIconCount = totalIconCount;
-        return this;
-    }
-
-    public Integer getPage()
-    {
-        return page;
-    }
-
-    public void setPage(Integer page)
-    {
-        this.page = page;
-    }
-
-    public IconsMetadata withPage(Integer page)
-    {
-        this.page = page;
-        return this;
-    }
-
-    public Integer getPageSize()
-    {
-        return pageSize;
-    }
-
-    public void setPageSize(Integer pageSize)
-    {
-        this.pageSize = pageSize;
-    }
-
-    public IconsMetadata withPageSize(Integer pageSize)
-    {
-        this.pageSize = pageSize;
-        return this;
-    }
-
-    public Integer getPageCount()
-    {
-        return pageCount;
-    }
-
-    public void setPageCount(Integer pageCount)
-    {
-        this.pageCount = pageCount;
-    }
-
-    public IconsMetadata withPageCount(Integer pageCount)
-    {
-        this.pageCount = pageCount;
-        return this;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/Thumb.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/cloud/model/Thumb.java
deleted file mode 100644 (file)
index 6a25dc9..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.cloud.model;
-
-public class Thumb
-{
-    private String original;
-    private String small;
-    private String large;
-    private String xlarge;
-
-    public String getOriginal()
-    {
-        return original;
-    }
-
-    public void setOriginal(String original)
-    {
-        this.original = original;
-    }
-
-    public Thumb withOriginal(String original)
-    {
-        this.original = original;
-        return this;
-    }
-
-    public String getSmall()
-    {
-        return small;
-    }
-
-    public void setSmall(String small)
-    {
-        this.small = small;
-    }
-
-    public Thumb withSmall(String small)
-    {
-        this.small = small;
-        return this;
-    }
-
-    public String getLarge()
-    {
-        return large;
-    }
-
-    public void setLarge(String large)
-    {
-        this.large = large;
-    }
-
-    public Thumb withLarge(String large)
-    {
-        this.large = large;
-        return this;
-    }
-
-    public String getXlarge()
-    {
-        return xlarge;
-    }
-
-    public void setXlarge(String xlarge)
-    {
-        this.xlarge = xlarge;
-    }
-
-    public Thumb withXlarge(String xlarge)
-    {
-        this.xlarge = xlarge;
-        return this;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/AbstractClient.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/AbstractClient.java
deleted file mode 100644 (file)
index 84ec64a..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.common.impl;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-
-import com.google.gson.Gson;
-
-public abstract class AbstractClient {
-    protected final ClientBuilder clientBuilder;
-
-    private volatile Client client;
-    private volatile Gson gson;
-
-    public AbstractClient() {
-        this(ClientBuilder.newBuilder());
-    }
-
-    public AbstractClient(ClientBuilder clientBuilder) {
-        this.clientBuilder = clientBuilder;
-    }
-
-    protected Client getClient() {
-        if (client == null) {
-            synchronized (this) {
-                if (client == null) {
-                    client = createClient();
-                }
-            }
-        }
-
-        return client;
-    }
-
-    protected Gson getGson() {
-        if (gson == null) {
-            synchronized (this) {
-                if (gson == null) {
-                    gson = createGson();
-                }
-            }
-        }
-
-        return gson;
-    }
-
-    protected abstract Client createClient();
-
-    protected Gson createGson() {
-        return GsonGenerator.create();
-    }
-
-    protected ClientBuilder getClientBuilder() {
-        return clientBuilder;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/GsonGenerator.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/GsonGenerator.java
deleted file mode 100644 (file)
index b363ab8..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.common.impl;
-
-import org.openhab.binding.lametrictime.api.common.impl.typeadapters.ActionTypeAdapterFactory;
-import org.openhab.binding.lametrictime.api.common.impl.typeadapters.ApplicationTypeAdapterFactory;
-import org.openhab.binding.lametrictime.api.common.impl.typeadapters.UpdateActionTypeAdapterFactory;
-import org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported.JSR310TypeAdapters;
-import org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported.RuntimeTypeAdapterFactory;
-import org.openhab.binding.lametrictime.api.local.model.BooleanParameter;
-import org.openhab.binding.lametrictime.api.local.model.IntegerParameter;
-import org.openhab.binding.lametrictime.api.local.model.Parameter;
-import org.openhab.binding.lametrictime.api.local.model.StringParameter;
-
-import com.google.gson.FieldNamingPolicy;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-public class GsonGenerator
-{
-    public static Gson create()
-    {
-        return create(false);
-    }
-
-    public static Gson create(boolean prettyPrint)
-    {
-        GsonBuilder builder = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
-                                               .registerTypeAdapterFactory(new ApplicationTypeAdapterFactory())
-                                               .registerTypeAdapterFactory(new ActionTypeAdapterFactory())
-                                               .registerTypeAdapterFactory(new UpdateActionTypeAdapterFactory())
-                                               .registerTypeAdapterFactory(RuntimeTypeAdapterFactory.of(Parameter.class,
-                                                                                                        "data_type")
-                                                                                                    .registerSubtype(BooleanParameter.class,
-                                                                                                                     "bool")
-                                                                                                    .registerSubtype(StringParameter.class,
-                                                                                                                     "string")
-                                                                                                    .registerSubtype(IntegerParameter.class,
-                                                                                                                     "int"));
-
-        // add Java 8 Time API support
-        JSR310TypeAdapters.registerJSR310TypeAdapters(builder);
-
-        if (prettyPrint)
-        {
-            builder.setPrettyPrinting();
-        }
-
-        return builder.create();
-    }
-
-    // @formatter:off
-    private GsonGenerator() {}
-    // @formatter:on
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/ActionTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/ActionTypeAdapterFactory.java
deleted file mode 100644 (file)
index e519e86..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported.CustomizedTypeAdapterFactory;
-import org.openhab.binding.lametrictime.api.local.model.Action;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
-public class ActionTypeAdapterFactory extends CustomizedTypeAdapterFactory<Action>
-{
-    private static final String PROPERTY_ID = "id";
-    private static final String PROPERTY_PARAMETERS = "params";
-
-    public ActionTypeAdapterFactory()
-    {
-        super(Action.class);
-    }
-
-    @Override
-    protected void beforeWrite(Action source, JsonElement toSerialize)
-    {
-        if (toSerialize == null || toSerialize.isJsonNull())
-        {
-            return;
-        }
-
-        JsonObject actionObj = toSerialize.getAsJsonObject();
-        if (actionObj == null || actionObj.isJsonNull())
-        {
-            return;
-        }
-
-        // rewrite parameters from a nested object (map) to properties on the action
-        JsonElement paramsElem = actionObj.get(PROPERTY_PARAMETERS);
-        if (paramsElem != null && !paramsElem.isJsonNull())
-        {
-            JsonObject paramsObj = paramsElem.getAsJsonObject();
-            actionObj.remove(PROPERTY_PARAMETERS);
-
-            for (Entry<String, JsonElement> entry : paramsObj.entrySet())
-            {
-                actionObj.add(entry.getKey(), entry.getValue());
-            }
-        }
-    }
-
-    @Override
-    protected void afterRead(JsonElement deserialized)
-    {
-        if (deserialized == null || deserialized.isJsonNull())
-        {
-            return;
-        }
-
-        JsonObject actionObj = deserialized.getAsJsonObject();
-        if (actionObj == null || actionObj.isJsonNull())
-        {
-            return;
-        }
-
-        if (actionObj.has(PROPERTY_PARAMETERS))
-        {
-            throw new IllegalArgumentException("Attempting to deserialize Action that contains a colliding "
-                                               + PROPERTY_PARAMETERS
-                                               + " property");
-        }
-
-        // temporary list of field names
-        List<String> fields = new ArrayList<>();
-
-        // rewrite parameters to a nested object (map)
-        JsonObject paramsObj = new JsonObject();
-        for (Entry<String, JsonElement> entry : actionObj.entrySet())
-        {
-            // skip ID field
-            if (PROPERTY_ID.equals(entry.getKey()))
-            {
-                continue;
-            }
-
-            String paramId = entry.getKey();
-            fields.add(paramId); // to be removed later
-
-            paramsObj.add(paramId, entry.getValue());
-        }
-        actionObj.add(PROPERTY_PARAMETERS, paramsObj);
-
-        // remove all fields other than the list
-        fields.forEach(field -> actionObj.remove(field));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/ApplicationTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/ApplicationTypeAdapterFactory.java
deleted file mode 100644 (file)
index fed1281..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters;
-
-import java.util.Map.Entry;
-
-import org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported.CustomizedTypeAdapterFactory;
-import org.openhab.binding.lametrictime.api.local.model.Application;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
-public class ApplicationTypeAdapterFactory extends CustomizedTypeAdapterFactory<Application>
-{
-    private static final String PROPERTY_ID = "id";
-    private static final String PROPERTY_WIDGETS = "widgets";
-    private static final String PROPERTY_ACTIONS = "actions";
-
-    public ApplicationTypeAdapterFactory()
-    {
-        super(Application.class);
-    }
-
-    @Override
-    protected void beforeWrite(Application source, JsonElement toSerialize)
-    {
-        if (toSerialize == null || toSerialize.isJsonNull())
-        {
-            return;
-        }
-
-        JsonObject appObj = toSerialize.getAsJsonObject();
-        if (appObj == null || appObj.isJsonNull())
-        {
-            return;
-        }
-
-        // remove widget IDs
-        JsonElement widgetsElem = appObj.get(PROPERTY_WIDGETS);
-        if (widgetsElem != null && !widgetsElem.isJsonNull())
-        {
-            for (Entry<String, JsonElement> entry : widgetsElem.getAsJsonObject().entrySet())
-            {
-                JsonElement widgetElem = entry.getValue();
-                if (widgetElem == null || widgetElem.isJsonNull())
-                {
-                    continue;
-                }
-                widgetElem.getAsJsonObject().remove(PROPERTY_ID);
-            }
-        }
-
-        // remove action IDs
-        JsonElement actionsElem = appObj.get(PROPERTY_ACTIONS);
-        if (actionsElem != null && !actionsElem.isJsonNull())
-        {
-            for (Entry<String, JsonElement> entry : actionsElem.getAsJsonObject().entrySet())
-            {
-                JsonElement actionElem = entry.getValue();
-                if (actionElem == null || actionElem.isJsonNull())
-                {
-                    continue;
-                }
-                actionElem.getAsJsonObject().remove(PROPERTY_ID);
-            }
-        }
-    }
-
-    @Override
-    protected void afterRead(JsonElement deserialized)
-    {
-        if (deserialized == null || deserialized.isJsonNull())
-        {
-            return;
-        }
-
-        JsonObject appObj = deserialized.getAsJsonObject();
-        if (appObj == null || appObj.isJsonNull())
-        {
-            return;
-        }
-
-        // inject widget IDs
-        JsonElement widgetsElem = appObj.get(PROPERTY_WIDGETS);
-        if (widgetsElem != null && !widgetsElem.isJsonNull())
-        {
-            for (Entry<String, JsonElement> entry : widgetsElem.getAsJsonObject().entrySet())
-            {
-                JsonElement widgetElem = entry.getValue();
-                if (widgetElem == null || widgetElem.isJsonNull())
-                {
-                    continue;
-                }
-                widgetElem.getAsJsonObject().addProperty(PROPERTY_ID, entry.getKey());
-            }
-        }
-
-        // inject action IDs
-        JsonElement actionsElem = appObj.get(PROPERTY_ACTIONS);
-        if (actionsElem != null && !actionsElem.isJsonNull())
-        {
-            for (Entry<String, JsonElement> entry : actionsElem.getAsJsonObject().entrySet())
-            {
-                JsonElement actionElem = entry.getValue();
-                if (actionElem == null || actionElem.isJsonNull())
-                {
-                    continue;
-                }
-                actionElem.getAsJsonObject().addProperty(PROPERTY_ID, entry.getKey());
-            }
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/UpdateActionTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/UpdateActionTypeAdapterFactory.java
deleted file mode 100644 (file)
index a7ab0a3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters;
-
-import java.util.Map.Entry;
-
-import org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported.CustomizedTypeAdapterFactory;
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
-public class UpdateActionTypeAdapterFactory extends CustomizedTypeAdapterFactory<UpdateAction>
-{
-    private static final String PROPERTY_PARAMETERS = "params";
-    private static final String PROPERTY_VALUE = "value";
-
-    public UpdateActionTypeAdapterFactory()
-    {
-        super(UpdateAction.class);
-    }
-
-    @Override
-    protected void beforeWrite(UpdateAction source, JsonElement toSerialize)
-    {
-        if (toSerialize == null || toSerialize.isJsonNull())
-        {
-            return;
-        }
-
-        JsonObject actionObj = toSerialize.getAsJsonObject();
-        if (actionObj == null || actionObj.isJsonNull())
-        {
-            return;
-        }
-
-        // rewrite parameters map from {name => Parameter} to {name => value}
-        JsonElement paramsElem = actionObj.get(PROPERTY_PARAMETERS);
-        if (paramsElem != null && !paramsElem.isJsonNull())
-        {
-            JsonObject paramsObj = paramsElem.getAsJsonObject();
-            actionObj.remove(PROPERTY_PARAMETERS);
-
-            JsonObject newParamsObj = new JsonObject();
-            for (Entry<String, JsonElement> entry : paramsObj.entrySet())
-            {
-                newParamsObj.add(entry.getKey(),
-                                 entry.getValue()
-                                      .getAsJsonObject()
-                                      .getAsJsonPrimitive(PROPERTY_VALUE));
-            }
-            actionObj.add(PROPERTY_PARAMETERS, newParamsObj);
-        }
-    }
-
-    @Override
-    protected void afterRead(JsonElement deserialized)
-    {
-        throw new UnsupportedOperationException(UpdateAction.class.getName()
-                                                + " cannot be derialized");
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/CustomizedTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/CustomizedTypeAdapterFactory.java
deleted file mode 100644 (file)
index 3508d2a..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-/*
- * Pulled from Stack Overflow answer located here: http://stackoverflow.com/a/11272452
- * and placed in an appropriate package within this library.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.io.IOException;
-import java.io.ObjectStreamException;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.TypeAdapter;
-import com.google.gson.TypeAdapterFactory;
-import com.google.gson.reflect.TypeToken;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-
-public abstract class CustomizedTypeAdapterFactory<C> implements TypeAdapterFactory
-{
-    private final Class<C> customizedClass;
-
-    public CustomizedTypeAdapterFactory(Class<C> customizedClass)
-    {
-        this.customizedClass = customizedClass;
-    }
-
-    @Override
-    @SuppressWarnings("unchecked") // we use a runtime check to guarantee that 'C' and 'T' are equal
-    public final <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type)
-    {
-        return type.getRawType() == customizedClass
-                ? (TypeAdapter<T>)customizeMyClassAdapter(gson, (TypeToken<C>)type)
-                : null;
-    }
-
-    private TypeAdapter<C> customizeMyClassAdapter(Gson gson, TypeToken<C> type)
-    {
-        final TypeAdapter<C> delegate = gson.getDelegateAdapter(this, type);
-        final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
-        return new TypeAdapter<C>()
-        {
-            @Override
-            public void write(JsonWriter out, C value) throws IOException
-            {
-                JsonElement tree = delegate.toJsonTree(value);
-                beforeWrite(value, tree);
-                elementAdapter.write(out, tree);
-            }
-
-            @Override
-            public C read(JsonReader in) throws IOException
-            {
-                JsonElement tree = elementAdapter.read(in);
-                afterRead(tree);
-                if (tree == null) {
-                    throw new IOException("null reader");
-                }
-                return delegate.fromJsonTree(tree);
-            }
-        };
-    }
-
-    /**
-     * Override this to muck with {@code toSerialize} before it is written to
-     * the outgoing JSON stream.
-     */
-    protected void beforeWrite(C source, JsonElement toSerialize)
-    {
-    }
-
-    /**
-     * Override this to muck with {@code deserialized} before it parsed into the
-     * application type.
-     */
-    protected void afterRead(JsonElement deserialized)
-    {
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/DateTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/DateTimeTypeAdapter.java
deleted file mode 100644 (file)
index 16a4d14..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.util.function.Function;
-
-/**
- * Abstract type adapter for jsr310 date-time types.
- *
- * @author Christophe Bornet
- */
-abstract class DateTimeTypeAdapter<T> extends TemporalTypeAdapter<T> {
-
-  DateTimeTypeAdapter(Function<String, T> parseFunction) {
-    super(parseFunction);
-  }
-
-  @Override
-  public String preProcess(String in) {
-    if (in.endsWith("+0000")) {
-      return in.substring(0, in.length()-5) + "Z";
-    }
-    return in;
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/DurationTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/DurationTypeAdapter.java
deleted file mode 100644 (file)
index bb5e7d0..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.Duration;
-
-/**
- * Type adapter for jsr310 {@link Duration} class.
- *
- * @author Christophe Bornet
- */
-public class DurationTypeAdapter extends TemporalTypeAdapter<Duration> {
-
-  public DurationTypeAdapter() {
-    super(Duration::parse);
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/InstantTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/InstantTypeAdapter.java
deleted file mode 100644 (file)
index 6155e4f..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.Instant;
-
-/**
- * Type adapter for jsr310 {@link Instant} class.
- *
- * @author Christophe Bornet
- */
-public class InstantTypeAdapter extends DateTimeTypeAdapter<Instant> {
-
-  public InstantTypeAdapter() {
-    super(Instant::parse);
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/JSR310TypeAdapters.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/JSR310TypeAdapters.java
deleted file mode 100644 (file)
index de58493..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import com.google.gson.GsonBuilder;
-
-import java.time.*;
-
-/**
- * Helper methods to register JSR310 type adapters.
- *
- * @author Christophe Bornet
- */
-public class JSR310TypeAdapters {
-
-  private JSR310TypeAdapters() {
-  }
-
-  public static GsonBuilder registerDurationTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(Duration.class, new DurationTypeAdapter());
-  }
-
-  public static GsonBuilder registerInstantTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(Instant.class, new InstantTypeAdapter());
-  }
-
-  public static GsonBuilder registerLocalDateTimeTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeTypeAdapter());
-  }
-
-  public static GsonBuilder registerLocalDateTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter());
-  }
-
-  public static GsonBuilder registerLocalTimeTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(LocalTime.class, new LocalTimeTypeAdapter());
-  }
-
-  public static GsonBuilder registerMonthDayTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(MonthDay.class, new MonthDayTypeAdapter());
-  }
-
-  public static GsonBuilder registerOffsetDateTimeTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter());
-  }
-
-  public static GsonBuilder registerOffsetTimeTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(OffsetTime.class, new OffsetTimeTypeAdapter());
-  }
-
-  public static GsonBuilder registerPeriodTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(Period.class, new PeriodTypeAdapter());
-  }
-
-  public static GsonBuilder registerYearMonthTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(YearMonth.class, new YearMonthTypeAdapter());
-  }
-
-  public static GsonBuilder registerYearTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(Year.class, new YearTypeAdapter());
-  }
-
-  public static GsonBuilder registerZonedDateTimeTypeAdapter(GsonBuilder gsonBuilder) {
-    return gsonBuilder.registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeTypeAdapter());
-  }
-
-
-  /**
-   * Helper method to register all the available JSR310 adapters at once.
-   * @param gsonBuilder the gsonBuilder on which all the JSR310 adapters must be registered.
-   * @return the gsonBuilder with the JSR310 adapters registered.
-   */
-  public static GsonBuilder registerJSR310TypeAdapters(GsonBuilder gsonBuilder) {
-    registerDurationTypeAdapter(gsonBuilder);
-    registerInstantTypeAdapter(gsonBuilder);
-    registerLocalDateTimeTypeAdapter(gsonBuilder);
-    registerLocalDateTypeAdapter(gsonBuilder);
-    registerLocalTimeTypeAdapter(gsonBuilder);
-    registerMonthDayTypeAdapter(gsonBuilder);
-    registerOffsetDateTimeTypeAdapter(gsonBuilder);
-    registerOffsetTimeTypeAdapter(gsonBuilder);
-    registerPeriodTypeAdapter(gsonBuilder);
-    registerYearMonthTypeAdapter(gsonBuilder);
-    registerYearTypeAdapter(gsonBuilder);
-    registerZonedDateTimeTypeAdapter(gsonBuilder);
-
-    return gsonBuilder;
-  }
-
-
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/LocalDateTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/LocalDateTimeTypeAdapter.java
deleted file mode 100644 (file)
index 2a97d1a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.LocalDateTime;
-
-/**
- * Type adapter for jsr310 {@link LocalDateTime} class.
- *
- * @author Christophe Bornet
- */
-public class LocalDateTimeTypeAdapter extends DateTimeTypeAdapter<LocalDateTime> {
-
-  public LocalDateTimeTypeAdapter() {
-    super(LocalDateTime::parse);
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/LocalDateTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/LocalDateTypeAdapter.java
deleted file mode 100644 (file)
index 34c9978..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.LocalDate;
-
-/**
- * Type adapter for jsr310 {@link LocalDate} class.
- *
- * @author Christophe Bornet
- */
-public class LocalDateTypeAdapter extends TemporalTypeAdapter<LocalDate> {
-
-  public LocalDateTypeAdapter() {
-    super(LocalDate::parse);
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/LocalTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/LocalTimeTypeAdapter.java
deleted file mode 100644 (file)
index e2b8052..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.LocalTime;
-
-/**
- * Type adapter for jsr310 {@link LocalTime} class.
- *
- * @author Christophe Bornet
- */
-public class LocalTimeTypeAdapter extends TemporalTypeAdapter<LocalTime> {
-
-    public LocalTimeTypeAdapter() {
-        super(LocalTime::parse);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/MonthDayTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/MonthDayTypeAdapter.java
deleted file mode 100644 (file)
index e942a9b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.MonthDay;
-
-/**
- * Type adapter for jsr310 {@link MonthDay} class.
- *
- * @author Christophe Bornet
- */
-public class MonthDayTypeAdapter extends TemporalTypeAdapter<MonthDay> {
-
-  public MonthDayTypeAdapter() {
-    super(MonthDay::parse);
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/OffsetDateTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/OffsetDateTimeTypeAdapter.java
deleted file mode 100644 (file)
index fab6a92..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.OffsetDateTime;
-
-/**
- * Type adapter for jsr310 {@link OffsetDateTime} class.
- *
- * @author Christophe Bornet
- */
-public class OffsetDateTimeTypeAdapter extends DateTimeTypeAdapter<OffsetDateTime> {
-
-    public OffsetDateTimeTypeAdapter() {
-        super(OffsetDateTime::parse);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/OffsetTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/OffsetTimeTypeAdapter.java
deleted file mode 100644 (file)
index 1035cc4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.OffsetTime;
-
-/**
- * Type adapter for jsr310 {@link OffsetTime} class.
- *
- * @author Christophe Bornet
- */
-public class OffsetTimeTypeAdapter extends TemporalTypeAdapter<OffsetTime> {
-
-    public OffsetTimeTypeAdapter() {
-        super(OffsetTime::parse);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/PeriodTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/PeriodTypeAdapter.java
deleted file mode 100644 (file)
index e1a38fb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.Period;
-
-/**
- * Type adapter for jsr310 {@link Period} class.
- *
- * @author Christophe Bornet
- */
-public class PeriodTypeAdapter extends TemporalTypeAdapter<Period> {
-
-  public PeriodTypeAdapter() {
-    super(Period::parse);
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/RuntimeTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/RuntimeTypeAdapterFactory.java
deleted file mode 100644 (file)
index ae1cb75..0000000
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Copied from
- * https://raw.githubusercontent.com/google/gson/master/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java
- * and repackaged here with additional content from
- * com.google.gson.internal.{Streams,TypeAdapters,LazilyParsedNumber}
- * to avoid using the internal package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.ObjectStreamException;
-import java.math.BigDecimal;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonIOException;
-import com.google.gson.JsonNull;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParseException;
-import com.google.gson.JsonPrimitive;
-import com.google.gson.JsonSyntaxException;
-import com.google.gson.TypeAdapter;
-import com.google.gson.TypeAdapterFactory;
-import com.google.gson.reflect.TypeToken;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-import com.google.gson.stream.MalformedJsonException;
-
-/**
- * Adapts values whose runtime type may differ from their declaration type. This
- * is necessary when a field's type is not the same type that GSON should create
- * when deserializing that field. For example, consider these types:
- * <pre>   {@code
- *   abstract class Shape {
- *     int x;
- *     int y;
- *   }
- *   class Circle extends Shape {
- *     int radius;
- *   }
- *   class Rectangle extends Shape {
- *     int width;
- *     int height;
- *   }
- *   class Diamond extends Shape {
- *     int width;
- *     int height;
- *   }
- *   class Drawing {
- *     Shape bottomShape;
- *     Shape topShape;
- *   }
- * }</pre>
- * <p>Without additional type information, the serialized JSON is ambiguous. Is
- * the bottom shape in this drawing a rectangle or a diamond? <pre>   {@code
- *   {
- *     "bottomShape": {
- *       "width": 10,
- *       "height": 5,
- *       "x": 0,
- *       "y": 0
- *     },
- *     "topShape": {
- *       "radius": 2,
- *       "x": 4,
- *       "y": 1
- *     }
- *   }}</pre>
- * This class addresses this problem by adding type information to the
- * serialized JSON and honoring that type information when the JSON is
- * deserialized: <pre>   {@code
- *   {
- *     "bottomShape": {
- *       "type": "Diamond",
- *       "width": 10,
- *       "height": 5,
- *       "x": 0,
- *       "y": 0
- *     },
- *     "topShape": {
- *       "type": "Circle",
- *       "radius": 2,
- *       "x": 4,
- *       "y": 1
- *     }
- *   }}</pre>
- * Both the type field name ({@code "type"}) and the type labels ({@code
- * "Rectangle"}) are configurable.
- *
- * <h3>Registering Types</h3>
- * Create a {@code RuntimeTypeAdapterFactory} by passing the base type and type field
- * name to the {@link #of} factory method. If you don't supply an explicit type
- * field name, {@code "type"} will be used. <pre>   {@code
- *   RuntimeTypeAdapterFactory<Shape> shapeAdapterFactory
- *       = RuntimeTypeAdapterFactory.of(Shape.class, "type");
- * }</pre>
- * Next register all of your subtypes. Every subtype must be explicitly
- * registered. This protects your application from injection attacks. If you
- * don't supply an explicit type label, the type's simple name will be used.
- * <pre>   {@code
- *   shapeAdapter.registerSubtype(Rectangle.class, "Rectangle");
- *   shapeAdapter.registerSubtype(Circle.class, "Circle");
- *   shapeAdapter.registerSubtype(Diamond.class, "Diamond");
- * }</pre>
- * Finally, register the type adapter factory in your application's GSON builder:
- * <pre>   {@code
- *   Gson gson = new GsonBuilder()
- *       .registerTypeAdapterFactory(shapeAdapterFactory)
- *       .create();
- * }</pre>
- * Like {@code GsonBuilder}, this API supports chaining: <pre>   {@code
- *   RuntimeTypeAdapterFactory<Shape> shapeAdapterFactory = RuntimeTypeAdapterFactory.of(Shape.class)
- *       .registerSubtype(Rectangle.class)
- *       .registerSubtype(Circle.class)
- *       .registerSubtype(Diamond.class);
- * }</pre>
- */
-public final class RuntimeTypeAdapterFactory<T> implements TypeAdapterFactory {
-  private final Class<?> baseType;
-  private final String typeFieldName;
-  private final Map<String, Class<?>> labelToSubtype = new LinkedHashMap<String, Class<?>>();
-  private final Map<Class<?>, String> subtypeToLabel = new LinkedHashMap<Class<?>, String>();
-
-  private RuntimeTypeAdapterFactory(Class<?> baseType, String typeFieldName) {
-    if (typeFieldName == null || baseType == null) {
-      throw new NullPointerException();
-    }
-    this.baseType = baseType;
-    this.typeFieldName = typeFieldName;
-  }
-
-  /**
-   * Creates a new runtime type adapter using for {@code baseType} using {@code
-   * typeFieldName} as the type field name. Type field names are case sensitive.
-   */
-  public static <T> RuntimeTypeAdapterFactory<T> of(Class<T> baseType, String typeFieldName) {
-    return new RuntimeTypeAdapterFactory<T>(baseType, typeFieldName);
-  }
-
-  /**
-   * Creates a new runtime type adapter for {@code baseType} using {@code "type"} as
-   * the type field name.
-   */
-  public static <T> RuntimeTypeAdapterFactory<T> of(Class<T> baseType) {
-    return new RuntimeTypeAdapterFactory<T>(baseType, "type");
-  }
-
-  /**
-   * Registers {@code type} identified by {@code label}. Labels are case
-   * sensitive.
-   *
-   * @throws IllegalArgumentException if either {@code type} or {@code label}
-   *     have already been registered on this type adapter.
-   */
-  public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type, String label) {
-    if (type == null || label == null) {
-      throw new NullPointerException();
-    }
-    if (subtypeToLabel.containsKey(type) || labelToSubtype.containsKey(label)) {
-      throw new IllegalArgumentException("types and labels must be unique");
-    }
-    labelToSubtype.put(label, type);
-    subtypeToLabel.put(type, label);
-    return this;
-  }
-
-  /**
-   * Registers {@code type} identified by its {@link Class#getSimpleName simple
-   * name}. Labels are case sensitive.
-   *
-   * @throws IllegalArgumentException if either {@code type} or its simple name
-   *     have already been registered on this type adapter.
-   */
-  public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type) {
-    return registerSubtype(type, type.getSimpleName());
-  }
-
-  public <R> TypeAdapter<R> create(Gson gson, TypeToken<R> type) {
-    if (type.getRawType() != baseType) {
-      return null;
-    }
-
-    final Map<String, TypeAdapter<?>> labelToDelegate
-        = new LinkedHashMap<String, TypeAdapter<?>>();
-    final Map<Class<?>, TypeAdapter<?>> subtypeToDelegate
-        = new LinkedHashMap<Class<?>, TypeAdapter<?>>();
-    for (Map.Entry<String, Class<?>> entry : labelToSubtype.entrySet()) {
-      TypeAdapter<?> delegate = gson.getDelegateAdapter(this, TypeToken.get(entry.getValue()));
-      labelToDelegate.put(entry.getKey(), delegate);
-      subtypeToDelegate.put(entry.getValue(), delegate);
-    }
-
-    return new TypeAdapter<R>() {
-      @Override public R read(JsonReader in) throws IOException {
-        JsonElement jsonElement = RuntimeTypeAdapterFactory.parse(in);
-        JsonElement labelJsonElement = jsonElement.getAsJsonObject().remove(typeFieldName);
-        if (labelJsonElement == null) {
-          throw new JsonParseException("cannot deserialize " + baseType
-              + " because it does not define a field named " + typeFieldName);
-        }
-        String label = labelJsonElement.getAsString();
-        @SuppressWarnings("unchecked") // registration requires that subtype extends T
-        TypeAdapter<R> delegate = (TypeAdapter<R>) labelToDelegate.get(label);
-        if (delegate == null) {
-          throw new JsonParseException("cannot deserialize " + baseType + " subtype named "
-              + label + "; did you forget to register a subtype?");
-        }
-        return delegate.fromJsonTree(jsonElement);
-      }
-
-      @Override public void write(JsonWriter out, R value) throws IOException {
-        Class<?> srcType = value.getClass();
-        String label = subtypeToLabel.get(srcType);
-        @SuppressWarnings("unchecked") // registration requires that subtype extends T
-        TypeAdapter<R> delegate = (TypeAdapter<R>) subtypeToDelegate.get(srcType);
-        if (delegate == null) {
-          throw new JsonParseException("cannot serialize " + srcType.getName()
-              + "; did you forget to register a subtype?");
-        }
-        JsonObject jsonObject = delegate.toJsonTree(value).getAsJsonObject();
-        if (jsonObject.has(typeFieldName)) {
-          throw new JsonParseException("cannot serialize " + srcType.getName()
-              + " because it already defines a field named " + typeFieldName);
-        }
-        JsonObject clone = new JsonObject();
-        clone.add(typeFieldName, new JsonPrimitive(label));
-        for (Map.Entry<String, JsonElement> e : jsonObject.entrySet()) {
-          clone.add(e.getKey(), e.getValue());
-        }
-        RuntimeTypeAdapterFactory.write(clone, out);
-      }
-    }.nullSafe();
-  }
-
-  /**
-   * Takes a reader in any state and returns the next value as a JsonElement.
-   */
-  private static JsonElement parse(JsonReader reader) throws JsonParseException {
-    boolean isEmpty = true;
-    try {
-      reader.peek();
-      isEmpty = false;
-      return RuntimeTypeAdapterFactory.JSON_ELEMENT.read(reader);
-    } catch (EOFException e) {
-      /*
-       * For compatibility with JSON 1.5 and earlier, we return a JsonNull for
-       * empty documents instead of throwing.
-       */
-      if (isEmpty) {
-        return JsonNull.INSTANCE;
-      }
-      // The stream ended prematurely so it is likely a syntax error.
-      throw new JsonSyntaxException(e);
-    } catch (MalformedJsonException e) {
-      throw new JsonSyntaxException(e);
-    } catch (IOException e) {
-      throw new JsonIOException(e);
-    } catch (NumberFormatException e) {
-      throw new JsonSyntaxException(e);
-    }
-  }
-
-  /**
-   * Writes the JSON element to the writer, recursively.
-   */
-  private static void write(JsonElement element, JsonWriter writer) throws IOException {
-      RuntimeTypeAdapterFactory.JSON_ELEMENT.write(writer, element);
-  }
-
-  private static final TypeAdapter<JsonElement> JSON_ELEMENT = new TypeAdapter<JsonElement>() {
-      @Override public JsonElement read(JsonReader in) throws IOException {
-        switch (in.peek()) {
-        case STRING:
-          return new JsonPrimitive(in.nextString());
-        case NUMBER:
-          String number = in.nextString();
-          return new JsonPrimitive(new LazilyParsedNumber(number));
-        case BOOLEAN:
-          return new JsonPrimitive(in.nextBoolean());
-        case NULL:
-          in.nextNull();
-          return JsonNull.INSTANCE;
-        case BEGIN_ARRAY:
-          JsonArray array = new JsonArray();
-          in.beginArray();
-          while (in.hasNext()) {
-            array.add(read(in));
-          }
-          in.endArray();
-          return array;
-        case BEGIN_OBJECT:
-          JsonObject object = new JsonObject();
-          in.beginObject();
-          while (in.hasNext()) {
-            object.add(in.nextName(), read(in));
-          }
-          in.endObject();
-          return object;
-        case END_DOCUMENT:
-        case NAME:
-        case END_OBJECT:
-        case END_ARRAY:
-        default:
-          throw new IllegalArgumentException();
-        }
-      }
-
-      @Override public void write(JsonWriter out, JsonElement value) throws IOException {
-        if (value == null || value.isJsonNull()) {
-          out.nullValue();
-        } else if (value.isJsonPrimitive()) {
-          JsonPrimitive primitive = value.getAsJsonPrimitive();
-          if (primitive.isNumber()) {
-            out.value(primitive.getAsNumber());
-          } else if (primitive.isBoolean()) {
-            out.value(primitive.getAsBoolean());
-          } else {
-            out.value(primitive.getAsString());
-          }
-
-        } else if (value.isJsonArray()) {
-          out.beginArray();
-          for (JsonElement e : value.getAsJsonArray()) {
-            write(out, e);
-          }
-          out.endArray();
-
-        } else if (value.isJsonObject()) {
-          out.beginObject();
-          for (Map.Entry<String, JsonElement> e : value.getAsJsonObject().entrySet()) {
-            out.name(e.getKey());
-            write(out, e.getValue());
-          }
-          out.endObject();
-
-        } else {
-          throw new IllegalArgumentException("Couldn't write " + value.getClass());
-        }
-      }
-    };
-
-    /**
-     * This class holds a number value that is lazily converted to a specific number type
-     *
-     * @author Inderjeet Singh
-     */
-    public static final class LazilyParsedNumber extends Number {
-      private final String value;
-
-      public LazilyParsedNumber(String value) {
-        this.value = value;
-      }
-
-      @Override
-      public int intValue() {
-        try {
-          return Integer.parseInt(value);
-        } catch (NumberFormatException e) {
-          try {
-            return (int) Long.parseLong(value);
-          } catch (NumberFormatException nfe) {
-            return new BigDecimal(value).intValue();
-          }
-        }
-      }
-
-      @Override
-      public long longValue() {
-        try {
-          return Long.parseLong(value);
-        } catch (NumberFormatException e) {
-          return new BigDecimal(value).longValue();
-        }
-      }
-
-      @Override
-      public float floatValue() {
-        return Float.parseFloat(value);
-      }
-
-      @Override
-      public double doubleValue() {
-        return Double.parseDouble(value);
-      }
-
-      @Override
-      public String toString() {
-        return value;
-      }
-
-      /**
-       * If somebody is unlucky enough to have to serialize one of these, serialize
-       * it as a BigDecimal so that they won't need Gson on the other side to
-       * deserialize it.
-       */
-      private Object writeReplace() throws ObjectStreamException {
-        return new BigDecimal(value);
-      }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/TemporalTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/TemporalTypeAdapter.java
deleted file mode 100644 (file)
index 81dcddc..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import com.google.gson.TypeAdapter;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonToken;
-import com.google.gson.stream.JsonWriter;
-
-import java.io.IOException;
-import java.time.temporal.TemporalAccessor;
-import java.util.Objects;
-import java.util.function.Function;
-
-/**
- * Abstract type adapter for jsr310 date-time types.
- *
- * @author Christophe Bornet
- */
-abstract class TemporalTypeAdapter<T> extends TypeAdapter<T> {
-
-  Function<String, T> parseFunction;
-
-  TemporalTypeAdapter(Function<String, T> parseFunction) {
-    Objects.requireNonNull(parseFunction);
-    this.parseFunction = parseFunction;
-  }
-
-  @Override
-  public void write(JsonWriter out, T value) throws IOException {
-    if (value == null) {
-      out.nullValue();
-    } else {
-      out.value(value.toString());
-    }
-  }
-
-  @Override
-  public T read(JsonReader in) throws IOException {
-    if (in.peek() == JsonToken.NULL) {
-      in.nextNull();
-      return null;
-    }
-    String temporalString = preProcess(in.nextString());
-    return parseFunction.apply(temporalString);
-  }
-
-  public String preProcess(String in) {
-    return in;
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/YearMonthTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/YearMonthTypeAdapter.java
deleted file mode 100644 (file)
index f491e5a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.YearMonth;
-
-/**
- * Type adapter for jsr310 {@link YearMonth} class.
- *
- * @author Christophe Bornet
- */
-public class YearMonthTypeAdapter extends TemporalTypeAdapter<YearMonth> {
-
-  public YearMonthTypeAdapter() {
-    super(YearMonth::parse);
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/YearTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/YearTypeAdapter.java
deleted file mode 100644 (file)
index db40682..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.Year;
-
-/**
- * Type adapter for jsr310 {@link Year} class.
- *
- * @author Christophe Bornet
- */
-public class YearTypeAdapter extends TemporalTypeAdapter<Year> {
-
-  public YearTypeAdapter() {
-    super(Year::parse);
-  }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/ZonedDateTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/common/impl/typeadapters/imported/ZonedDateTimeTypeAdapter.java
deleted file mode 100644 (file)
index df751bd..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 Gson Type Adapter Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
- * and repackaged to avoid the default package.
- */
-package org.openhab.binding.lametrictime.api.common.impl.typeadapters.imported;
-
-import java.time.ZonedDateTime;
-
-/**
- * Type adapter for jsr310 {@link ZonedDateTime} class.
- *
- * @author Christophe Bornet
- */
-public class ZonedDateTimeTypeAdapter extends DateTimeTypeAdapter<ZonedDateTime> {
-
-    public ZonedDateTimeTypeAdapter() {
-        super(ZonedDateTime::parse);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/filter/LoggingFilter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/filter/LoggingFilter.java
deleted file mode 100644 (file)
index 7b355cb..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2011-2015 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * http://glassfish.java.net/public/CDDL+GPL_1_1.html
- * or packager/legal/LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at packager/legal/LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-package org.openhab.binding.lametrictime.api.filter;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.nio.charset.Charset;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Logger;
-
-import javax.annotation.Priority;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientRequestFilter;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.ContainerResponseContext;
-import javax.ws.rs.container.ContainerResponseFilter;
-import javax.ws.rs.container.PreMatching;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.WriterInterceptor;
-import javax.ws.rs.ext.WriterInterceptorContext;
-
-/**
- * Universal logging filter.
- * <p/>
- * Can be used on client or server side. Has the highest priority.
- *
- * @author Pavel Bucek (pavel.bucek at oracle.com)
- * @author Martin Matula
- */
-@PreMatching
-@Priority(Integer.MIN_VALUE)
-public final class LoggingFilter implements ContainerRequestFilter, ClientRequestFilter, ContainerResponseFilter,
-        ClientResponseFilter, WriterInterceptor {
-
-    public static final Charset UTF8 = Charset.forName("UTF-8");
-
-    private static final Logger LOGGER = Logger.getLogger(LoggingFilter.class.getName());
-    private static final String NOTIFICATION_PREFIX = "* ";
-    private static final String REQUEST_PREFIX = "> ";
-    private static final String RESPONSE_PREFIX = "< ";
-    private static final String ENTITY_LOGGER_PROPERTY = LoggingFilter.class.getName() + ".entityLogger";
-    private static final String LOGGING_ID_PROPERTY = LoggingFilter.class.getName() + ".id";
-
-    private static final Comparator<Map.Entry<String, List<String>>> COMPARATOR = new Comparator<Map.Entry<String, List<String>>>() {
-
-        @Override
-        public int compare(final Map.Entry<String, List<String>> o1, final Map.Entry<String, List<String>> o2) {
-            return o1.getKey().compareToIgnoreCase(o2.getKey());
-        }
-    };
-
-    private static final int DEFAULT_MAX_ENTITY_SIZE = 8 * 1024;
-
-    //
-    private final Logger logger;
-    private final AtomicLong _id = new AtomicLong(0);
-    private final boolean printEntity;
-    private final int maxEntitySize;
-
-    /**
-     * Create a logging filter logging the request and response to a default JDK
-     * logger, named as the fully qualified class name of this class. Entity
-     * logging is turned off by default.
-     */
-    public LoggingFilter() {
-        this(LOGGER, false);
-    }
-
-    /**
-     * Create a logging filter with custom logger and custom settings of entity
-     * logging.
-     *
-     * @param logger the logger to log requests and responses.
-     * @param printEntity if true, entity will be logged as well up to the default maxEntitySize, which is 8KB
-     */
-    public LoggingFilter(final Logger logger, final boolean printEntity) {
-        this.logger = logger;
-        this.printEntity = printEntity;
-        this.maxEntitySize = DEFAULT_MAX_ENTITY_SIZE;
-    }
-
-    /**
-     * Creates a logging filter with custom logger and entity logging turned on, but potentially limiting the size
-     * of entity to be buffered and logged.
-     *
-     * @param logger the logger to log requests and responses.
-     * @param maxEntitySize maximum number of entity bytes to be logged (and buffered) - if the entity is larger,
-     *            logging filter will print (and buffer in memory) only the specified number of bytes
-     *            and print "...more..." string at the end. Negative values are interpreted as zero.
-     */
-    public LoggingFilter(final Logger logger, final int maxEntitySize) {
-        this.logger = logger;
-        this.printEntity = true;
-        this.maxEntitySize = Math.max(0, maxEntitySize);
-    }
-
-    private void log(final StringBuilder b) {
-        if (logger != null) {
-            logger.info(b.toString());
-        }
-    }
-
-    private StringBuilder prefixId(final StringBuilder b, final long id) {
-        b.append(Long.toString(id)).append(" ");
-        return b;
-    }
-
-    private void printRequestLine(final StringBuilder b, final String note, final long id, final String method,
-            final URI uri) {
-        prefixId(b, id).append(NOTIFICATION_PREFIX).append(note).append(" on thread ")
-                .append(Thread.currentThread().getName()).append("\n");
-        prefixId(b, id).append(REQUEST_PREFIX).append(method).append(" ").append(uri.toASCIIString()).append("\n");
-    }
-
-    private void printResponseLine(final StringBuilder b, final String note, final long id, final int status) {
-        prefixId(b, id).append(NOTIFICATION_PREFIX).append(note).append(" on thread ")
-                .append(Thread.currentThread().getName()).append("\n");
-        prefixId(b, id).append(RESPONSE_PREFIX).append(Integer.toString(status)).append("\n");
-    }
-
-    private void printPrefixedHeaders(final StringBuilder b, final long id, final String prefix,
-            final MultivaluedMap<String, String> headers) {
-        for (final Map.Entry<String, List<String>> headerEntry : getSortedHeaders(headers.entrySet())) {
-            final List<?> val = headerEntry.getValue();
-            final String header = headerEntry.getKey();
-
-            if (val.size() == 1) {
-                prefixId(b, id).append(prefix).append(header).append(": ").append(val.get(0)).append("\n");
-            } else {
-                final StringBuilder sb = new StringBuilder();
-                boolean add = false;
-                for (final Object s : val) {
-                    if (add) {
-                        sb.append(',');
-                    }
-                    add = true;
-                    sb.append(s);
-                }
-                prefixId(b, id).append(prefix).append(header).append(": ").append(sb.toString()).append("\n");
-            }
-        }
-    }
-
-    private Set<Map.Entry<String, List<String>>> getSortedHeaders(final Set<Map.Entry<String, List<String>>> headers) {
-        final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<Map.Entry<String, List<String>>>(
-                COMPARATOR);
-        sortedHeaders.addAll(headers);
-        return sortedHeaders;
-    }
-
-    private InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
-            throws IOException {
-        if (!stream.markSupported()) {
-            stream = new BufferedInputStream(stream);
-        }
-        stream.mark(maxEntitySize + 1);
-        final byte[] entity = new byte[maxEntitySize + 1];
-        final int entitySize = stream.read(entity);
-        b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
-        if (entitySize > maxEntitySize) {
-            b.append("...more...");
-        }
-        b.append('\n');
-        stream.reset();
-        return stream;
-    }
-
-    @Override
-    public void filter(final ClientRequestContext context) throws IOException {
-        final long id = _id.incrementAndGet();
-        context.setProperty(LOGGING_ID_PROPERTY, id);
-
-        final StringBuilder b = new StringBuilder();
-
-        printRequestLine(b, "Sending client request", id, context.getMethod(), context.getUri());
-        printPrefixedHeaders(b, id, REQUEST_PREFIX, context.getStringHeaders());
-
-        if (printEntity && context.hasEntity()) {
-            final OutputStream stream = new LoggingStream(b, context.getEntityStream());
-            context.setEntityStream(stream);
-            context.setProperty(ENTITY_LOGGER_PROPERTY, stream);
-            // not calling log(b) here - it will be called by the interceptor
-        } else {
-            log(b);
-        }
-    }
-
-    @Override
-    public void filter(final ClientRequestContext requestContext, final ClientResponseContext responseContext)
-            throws IOException {
-        final Object requestId = requestContext.getProperty(LOGGING_ID_PROPERTY);
-        final long id = requestId != null ? (Long) requestId : _id.incrementAndGet();
-
-        final StringBuilder b = new StringBuilder();
-
-        printResponseLine(b, "Client response received", id, responseContext.getStatus());
-        printPrefixedHeaders(b, id, RESPONSE_PREFIX, responseContext.getHeaders());
-
-        if (printEntity && responseContext.hasEntity()) {
-            responseContext.setEntityStream(
-                    logInboundEntity(b, responseContext.getEntityStream(), getCharset(responseContext.getMediaType())));
-        }
-
-        log(b);
-    }
-
-    @Override
-    public void filter(final ContainerRequestContext context) throws IOException {
-        final long id = _id.incrementAndGet();
-        context.setProperty(LOGGING_ID_PROPERTY, id);
-
-        final StringBuilder b = new StringBuilder();
-
-        printRequestLine(b, "Server has received a request", id, context.getMethod(),
-                context.getUriInfo().getRequestUri());
-        printPrefixedHeaders(b, id, REQUEST_PREFIX, context.getHeaders());
-
-        if (printEntity && context.hasEntity()) {
-            context.setEntityStream(logInboundEntity(b, context.getEntityStream(), getCharset(context.getMediaType())));
-        }
-
-        log(b);
-    }
-
-    @Override
-    public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext)
-            throws IOException {
-        final Object requestId = requestContext.getProperty(LOGGING_ID_PROPERTY);
-        final long id = requestId != null ? (Long) requestId : _id.incrementAndGet();
-
-        final StringBuilder b = new StringBuilder();
-
-        printResponseLine(b, "Server responded with a response", id, responseContext.getStatus());
-        printPrefixedHeaders(b, id, RESPONSE_PREFIX, responseContext.getStringHeaders());
-
-        if (printEntity && responseContext.hasEntity()) {
-            final OutputStream stream = new LoggingStream(b, responseContext.getEntityStream());
-            responseContext.setEntityStream(stream);
-            requestContext.setProperty(ENTITY_LOGGER_PROPERTY, stream);
-            // not calling log(b) here - it will be called by the interceptor
-        } else {
-            log(b);
-        }
-    }
-
-    @Override
-    public void aroundWriteTo(final WriterInterceptorContext writerInterceptorContext)
-            throws IOException, WebApplicationException {
-        final LoggingStream stream = (LoggingStream) writerInterceptorContext.getProperty(ENTITY_LOGGER_PROPERTY);
-        writerInterceptorContext.proceed();
-        if (stream != null) {
-            log(stream.getStringBuilder(getCharset(writerInterceptorContext.getMediaType())));
-        }
-    }
-
-    private class LoggingStream extends FilterOutputStream {
-
-        private final StringBuilder b;
-        private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-        LoggingStream(final StringBuilder b, final OutputStream inner) {
-            super(inner);
-
-            this.b = b;
-        }
-
-        StringBuilder getStringBuilder(final Charset charset) {
-            // write entity to the builder
-            final byte[] entity = baos.toByteArray();
-
-            b.append(new String(entity, 0, Math.min(entity.length, maxEntitySize), charset));
-            if (entity.length > maxEntitySize) {
-                b.append("...more...");
-            }
-            b.append('\n');
-
-            return b;
-        }
-
-        @Override
-        public void write(final int i) throws IOException {
-            if (baos.size() <= maxEntitySize) {
-                baos.write(i);
-            }
-            out.write(i);
-        }
-    }
-
-    /**
-     * Get the character set from a media type.
-     * <p>
-     * The character set is obtained from the media type parameter "charset".
-     * If the parameter is not present the {@link #UTF8} charset is utilized.
-     *
-     * @param m the media type.
-     * @return the character set.
-     */
-    public static Charset getCharset(MediaType m) {
-        String name = (m == null) ? null : m.getParameters().get(MediaType.CHARSET_PARAMETER);
-        return (name == null) ? UTF8 : Charset.forName(name);
-    }
-
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/AbstractDataIcon.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/AbstractDataIcon.java
deleted file mode 100644 (file)
index 6658b53..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.impl;
-
-import java.util.Base64;
-
-import org.openhab.binding.lametrictime.api.model.Icon;
-
-public abstract class AbstractDataIcon implements Icon
-{
-    private volatile Object CONFIGURE_FLAG;
-
-    private String type;
-    private byte[] data;
-
-    protected void configure()
-    {
-        if (CONFIGURE_FLAG == null)
-        {
-            synchronized (this)
-            {
-                if (CONFIGURE_FLAG == null)
-                {
-                    populateFields();
-                }
-            }
-        }
-    }
-
-    protected String getType()
-    {
-        configure();
-        return type;
-    }
-
-    protected void setType(String type)
-    {
-        this.type = type;
-    }
-
-    protected byte[] getData()
-    {
-        configure();
-        return data;
-    }
-
-    protected void setData(byte[] data)
-    {
-        this.data = data;
-    }
-
-    @Override
-    public String toRaw()
-    {
-        return new StringBuilder().append("data:")
-                                  .append(getType())
-                                  .append(";base64,")
-                                  .append(Base64.getEncoder().encodeToString(getData()))
-                                  .toString();
-    }
-
-    protected abstract void populateFields();
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/DataIcon.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/DataIcon.java
deleted file mode 100644 (file)
index cbb15da..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.impl;
-
-public class DataIcon extends AbstractDataIcon
-{
-    public DataIcon(String mimeType, byte[] data)
-    {
-        setType(mimeType);
-        setData(data);
-    }
-
-    @Override
-    protected void configure()
-    {
-        // noop
-    }
-
-    @Override
-    protected void populateFields()
-    {
-        // noop
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/FileIcon.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/FileIcon.java
deleted file mode 100644 (file)
index 1b40eea..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-import javax.activation.MimetypesFileTypeMap;
-
-public class FileIcon extends AbstractDataIcon
-{
-    private final MimetypesFileTypeMap mimeTypeMap = new MimetypesFileTypeMap();
-
-    private final Path path;
-
-    public FileIcon(File file)
-    {
-        this(file.toPath());
-    }
-
-    public FileIcon(Path path)
-    {
-        this.path = path;
-        mimeTypeMap.addMimeTypes("image/png png PNG");
-    }
-
-    @Override
-    protected void populateFields()
-    {
-        setType(mimeTypeMap.getContentType(path.toFile()));
-        try
-        {
-            setData(Files.readAllBytes(path));
-        }
-        catch (IOException e)
-        {
-            throw new RuntimeException(e);
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/HTTPIcon.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/HTTPIcon.java
deleted file mode 100644 (file)
index 5a89c4b..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.impl;
-
-import java.net.URI;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.core.Response;
-
-public class HTTPIcon extends AbstractDataIcon
-{
-    private final URI uri;
-
-    public HTTPIcon(String uri)
-    {
-        this(URI.create(uri));
-    }
-
-    public HTTPIcon(URI uri)
-    {
-        this.uri = uri;
-    }
-
-    @Override
-    protected void populateFields()
-    {
-        Client client = ClientBuilder.newBuilder().build();
-        Response response = client.target(uri).request().get();
-
-        setType(response.getMediaType().toString());
-        setData(response.readEntity(byte[].class));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/KeyIcon.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/KeyIcon.java
deleted file mode 100644 (file)
index b711cac..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.impl;
-
-import org.openhab.binding.lametrictime.api.model.Icon;
-
-public class KeyIcon implements Icon
-{
-    private final String key;
-
-    public KeyIcon(String key)
-    {
-        this.key = key;
-    }
-
-    @Override
-    public String toRaw()
-    {
-        return key;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/LaMetricTimeImpl.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/impl/LaMetricTimeImpl.java
deleted file mode 100644 (file)
index cdf7f5c..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.impl;
-
-import static org.openhab.binding.lametrictime.api.model.ApiValue.raw;
-
-import java.util.Arrays;
-
-import javax.ws.rs.client.ClientBuilder;
-
-import org.openhab.binding.lametrictime.api.Configuration;
-import org.openhab.binding.lametrictime.api.LaMetricTime;
-import org.openhab.binding.lametrictime.api.cloud.CloudConfiguration;
-import org.openhab.binding.lametrictime.api.cloud.LaMetricTimeCloud;
-import org.openhab.binding.lametrictime.api.local.ApplicationActionException;
-import org.openhab.binding.lametrictime.api.local.ApplicationActivationException;
-import org.openhab.binding.lametrictime.api.local.ApplicationNotFoundException;
-import org.openhab.binding.lametrictime.api.local.LaMetricTimeLocal;
-import org.openhab.binding.lametrictime.api.local.LocalConfiguration;
-import org.openhab.binding.lametrictime.api.local.NotificationCreationException;
-import org.openhab.binding.lametrictime.api.local.UpdateException;
-import org.openhab.binding.lametrictime.api.local.model.Application;
-import org.openhab.binding.lametrictime.api.local.model.Audio;
-import org.openhab.binding.lametrictime.api.local.model.Bluetooth;
-import org.openhab.binding.lametrictime.api.local.model.Display;
-import org.openhab.binding.lametrictime.api.local.model.Frame;
-import org.openhab.binding.lametrictime.api.local.model.Notification;
-import org.openhab.binding.lametrictime.api.local.model.NotificationModel;
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-import org.openhab.binding.lametrictime.api.local.model.Widget;
-import org.openhab.binding.lametrictime.api.model.CoreAction;
-import org.openhab.binding.lametrictime.api.model.CoreApplication;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
-import org.openhab.binding.lametrictime.api.model.Icon;
-import org.openhab.binding.lametrictime.api.model.Icons;
-import org.openhab.binding.lametrictime.api.model.enums.BrightnessMode;
-import org.openhab.binding.lametrictime.api.model.enums.Priority;
-import org.openhab.binding.lametrictime.api.model.enums.Sound;
-
-public class LaMetricTimeImpl implements LaMetricTime
-{
-    private final LaMetricTimeLocal local;
-    private final LaMetricTimeCloud cloud;
-
-    private final Object muteLock = new Object();
-    private Integer volumeSaveState;
-
-    public LaMetricTimeImpl(Configuration config)
-    {
-        this(config.getLocalConfig(), config.getCloudConfig());
-    }
-
-    public LaMetricTimeImpl(Configuration config, ClientBuilder clientBuilder)
-    {
-        this(config.getLocalConfig(), config.getCloudConfig(), clientBuilder);
-    }
-
-    public LaMetricTimeImpl(LocalConfiguration localConfig, CloudConfiguration cloudConfig)
-    {
-        this.local = LaMetricTimeLocal.create(localConfig);
-        this.cloud = LaMetricTimeCloud.create(cloudConfig);
-    }
-
-    public LaMetricTimeImpl(LocalConfiguration localConfig,
-                            CloudConfiguration cloudConfig,
-                            ClientBuilder clientBuilder)
-    {
-        this.local = LaMetricTimeLocal.create(localConfig, clientBuilder);
-        this.cloud = LaMetricTimeCloud.create(cloudConfig, clientBuilder);
-    }
-
-    @Override
-    public String getVersion()
-    {
-        return local.getApi().getApiVersion();
-    }
-
-    @Override
-    public String notifyInfo(String message) throws NotificationCreationException
-    {
-        return notify(message, Priority.INFO, Icons.key("i1248"), Sound.NOTIFICATION, 1, 1);
-    }
-
-    @Override
-    public String notifyWarning(String message) throws NotificationCreationException
-    {
-        return notify(message, Priority.WARNING, Icons.key("a2098"), Sound.NOTIFICATION2, 2, 2);
-    }
-
-    @Override
-    public String notifyCritical(String message) throws NotificationCreationException
-    {
-        return notify(message, Priority.CRITICAL, Icons.key("a4787"), Sound.ALARM1, 0, 0);
-    }
-
-    @Override
-    public String notify(String message,
-                         Priority priority,
-                         Icon icon,
-                         Sound sound,
-                         int messageRepeat,
-                         int soundRepeat) throws NotificationCreationException
-    {
-        // @formatter:off
-        NotificationModel model = new NotificationModel()
-                                      .withCycles(messageRepeat)
-                                      .withFrames(Arrays.asList(new Frame().withText(message)
-                                                                           .withIcon(raw(icon))));
-        if (sound != null)
-        {
-            model.setSound(new org.openhab.binding.lametrictime.api.local.model.Sound()
-                               .withCategory(raw(sound.getCategory()))
-                               .withId(raw(sound))
-                               .withRepeat(soundRepeat));
-        }
-        // @formatter:on
-
-        Notification notification = new Notification().withPriority(raw(priority)).withModel(model);
-        return local.createNotification(notification);
-    }
-
-    @Override
-    public Application getClock()
-    {
-        return getApplication(CoreApps.clock());
-    }
-
-    @Override
-    public Application getCountdown()
-    {
-        return getApplication(CoreApps.countdown());
-    }
-
-    @Override
-    public Application getRadio()
-    {
-        return getApplication(CoreApps.radio());
-    }
-
-    @Override
-    public Application getStopwatch()
-    {
-        return getApplication(CoreApps.stopwatch());
-    }
-
-    @Override
-    public Application getWeather()
-    {
-        return getApplication(CoreApps.weather());
-    }
-
-    @Override
-    public Application getApplication(CoreApplication coreApp)
-    {
-        try
-        {
-            return getLocalApi().getApplication(coreApp.getPackageName());
-        }
-        catch (ApplicationNotFoundException e)
-        {
-            // core apps should never throw errors
-            throw new RuntimeException("Failed to retrieve core application: "
-                                       + coreApp.getPackageName(),
-                                       e);
-        }
-    }
-
-    @Override
-    public Application getApplication(String name) throws ApplicationNotFoundException
-    {
-        return getLocalApi().getApplication(name);
-    }
-
-    @Override
-    public void activateApplication(CoreApplication coreApp)
-    {
-        try
-        {
-            activateApplication(getApplication(coreApp));
-        }
-        catch (ApplicationActivationException e)
-        {
-            // core apps should never throw errors
-            throw new RuntimeException("Failed to activate core application: "
-                                       + coreApp.getPackageName(),
-                                       e);
-        }
-    }
-
-    @Override
-    public void activateApplication(Application app) throws ApplicationActivationException
-    {
-        getLocalApi().activateApplication(app.getPackageName(), getFirstWidgetId(app));
-    }
-
-    @Override
-    public void activateWidget(Widget widget) throws ApplicationActivationException
-    {
-        getLocalApi().activateApplication(widget.getPackageName(), widget.getId());
-    }
-
-    @Override
-    public void doAction(CoreAction coreAction)
-    {
-        try
-        {
-            doAction(getApplication(coreAction.getApp()), coreAction.getAction());
-        }
-        catch (ApplicationActionException e)
-        {
-            // core apps should never throw errors
-            throw new RuntimeException("Failed to execute weather forecast action", e);
-        }
-    }
-
-    @Override
-    public void doAction(Application app, UpdateAction action) throws ApplicationActionException
-    {
-        getLocalApi().doAction(app.getPackageName(), getFirstWidgetId(app), action);
-    }
-
-    @Override
-    public void doAction(Widget widget, CoreAction coreAction) throws ApplicationActionException
-    {
-        doAction(widget, coreAction.getAction());
-    }
-
-    @Override
-    public void doAction(Widget widget, UpdateAction action) throws ApplicationActionException
-    {
-        getLocalApi().doAction(widget.getPackageName(), widget.getId(), action);
-    }
-
-    protected String getFirstWidgetId(Application app)
-    {
-        return app.getWidgets().firstKey();
-    }
-
-    @Override
-    public Display setBrightness(int brightness) throws UpdateException
-    {
-        return local.updateDisplay(new Display().withBrightness(brightness)
-                                                .withBrightnessMode(raw(BrightnessMode.MANUAL)));
-    }
-
-    @Override
-    public Display setBrightnessMode(BrightnessMode mode) throws UpdateException
-    {
-        return local.updateDisplay(new Display().withBrightnessMode(raw(mode)));
-    }
-
-    @Override
-    public Audio setVolume(int volume) throws UpdateException
-    {
-        return local.updateAudio(new Audio().withVolume(volume));
-    }
-
-    @Override
-    public Audio mute() throws UpdateException
-    {
-        synchronized (muteLock)
-        {
-            Audio audio = local.getAudio();
-            if (audio.getVolume() == 0)
-            {
-                return audio;
-            }
-
-            volumeSaveState = audio.getVolume();
-            return setVolume(0);
-        }
-    }
-
-    @Override
-    public Audio unmute() throws UpdateException
-    {
-        synchronized (muteLock)
-        {
-            if (volumeSaveState == null)
-            {
-                Audio audio = local.getAudio();
-                if (audio.getVolume() == 0)
-                {
-                    return setVolume(50);
-                }
-                else
-                {
-                    return audio;
-                }
-            }
-
-            Audio audio = setVolume(volumeSaveState);
-            volumeSaveState = null;
-            return audio;
-        }
-    }
-
-    @Override
-    public Bluetooth setBluetoothActive(boolean active) throws UpdateException
-    {
-        return local.updateBluetooth(new Bluetooth().withActive(active));
-    }
-
-    @Override
-    public Bluetooth setBluetoothName(String name) throws UpdateException
-    {
-        return local.updateBluetooth(new Bluetooth().withName(name));
-    }
-
-    @Override
-    public LaMetricTimeLocal getLocalApi()
-    {
-        return local;
-    }
-
-    @Override
-    public LaMetricTimeCloud getCloudApi()
-    {
-        return cloud;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/ApplicationActionException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/ApplicationActionException.java
deleted file mode 100644 (file)
index afdce96..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local;
-
-import org.openhab.binding.lametrictime.api.local.model.Failure;
-
-public class ApplicationActionException extends LaMetricTimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public ApplicationActionException()
-    {
-        super();
-    }
-
-    public ApplicationActionException(String message)
-    {
-        super(message);
-    }
-
-    public ApplicationActionException(Throwable cause)
-    {
-        super(cause);
-    }
-
-    public ApplicationActionException(String message, Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public ApplicationActionException(String message,
-                           Throwable cause,
-                           boolean enableSuppression,
-                           boolean writableStackTrace)
-    {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-
-    public ApplicationActionException(Failure failure)
-    {
-        super(failure);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/ApplicationActivationException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/ApplicationActivationException.java
deleted file mode 100644 (file)
index 261a80f..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local;
-
-import org.openhab.binding.lametrictime.api.local.model.Failure;
-
-public class ApplicationActivationException extends LaMetricTimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public ApplicationActivationException()
-    {
-        super();
-    }
-
-    public ApplicationActivationException(String message)
-    {
-        super(message);
-    }
-
-    public ApplicationActivationException(Throwable cause)
-    {
-        super(cause);
-    }
-
-    public ApplicationActivationException(String message, Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public ApplicationActivationException(String message,
-                           Throwable cause,
-                           boolean enableSuppression,
-                           boolean writableStackTrace)
-    {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-
-    public ApplicationActivationException(Failure failure)
-    {
-        super(failure);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/ApplicationNotFoundException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/ApplicationNotFoundException.java
deleted file mode 100644 (file)
index fa41f35..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local;
-
-import org.openhab.binding.lametrictime.api.local.model.Failure;
-
-public class ApplicationNotFoundException extends LaMetricTimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public ApplicationNotFoundException()
-    {
-        super();
-    }
-
-    public ApplicationNotFoundException(String message)
-    {
-        super(message);
-    }
-
-    public ApplicationNotFoundException(Throwable cause)
-    {
-        super(cause);
-    }
-
-    public ApplicationNotFoundException(String message, Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public ApplicationNotFoundException(String message,
-                           Throwable cause,
-                           boolean enableSuppression,
-                           boolean writableStackTrace)
-    {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-
-    public ApplicationNotFoundException(Failure failure)
-    {
-        super(failure);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/LaMetricTimeException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/LaMetricTimeException.java
deleted file mode 100644 (file)
index 30f4389..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local;
-
-import java.util.List;
-
-import org.openhab.binding.lametrictime.api.local.model.Error;
-import org.openhab.binding.lametrictime.api.local.model.Failure;
-
-public class LaMetricTimeException extends Exception
-{
-    private static final long serialVersionUID = 1L;
-
-    public LaMetricTimeException()
-    {
-        super();
-    }
-
-    public LaMetricTimeException(String message)
-    {
-        super(message);
-    }
-
-    public LaMetricTimeException(Throwable cause)
-    {
-        super(cause);
-    }
-
-    public LaMetricTimeException(String message, Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public LaMetricTimeException(String message,
-                                 Throwable cause,
-                                 boolean enableSuppression,
-                                 boolean writableStackTrace)
-    {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-
-    public LaMetricTimeException(Failure failure)
-    {
-        super(buildMessage(failure));
-    }
-
-    private static String buildMessage(Failure failure)
-    {
-        StringBuilder builder = new StringBuilder();
-
-        List<Error> errors = failure.getErrors();
-        if (!errors.isEmpty())
-        {
-            builder.append(errors.get(0).getMessage());
-        }
-
-        for (int i = 1; i < errors.size(); i++)
-        {
-            builder.append("; ").append(errors.get(i).getMessage());
-        }
-
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/LaMetricTimeLocal.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/LaMetricTimeLocal.java
deleted file mode 100644 (file)
index 91c7e89..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local;
-
-import java.util.List;
-import java.util.SortedMap;
-
-import javax.ws.rs.client.ClientBuilder;
-
-import org.openhab.binding.lametrictime.api.local.impl.LaMetricTimeLocalImpl;
-import org.openhab.binding.lametrictime.api.local.model.Api;
-import org.openhab.binding.lametrictime.api.local.model.Application;
-import org.openhab.binding.lametrictime.api.local.model.Audio;
-import org.openhab.binding.lametrictime.api.local.model.Bluetooth;
-import org.openhab.binding.lametrictime.api.local.model.Device;
-import org.openhab.binding.lametrictime.api.local.model.Display;
-import org.openhab.binding.lametrictime.api.local.model.Notification;
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-import org.openhab.binding.lametrictime.api.local.model.WidgetUpdates;
-import org.openhab.binding.lametrictime.api.local.model.Wifi;
-
-public interface LaMetricTimeLocal
-{
-    public Api getApi();
-
-    public Device getDevice();
-
-    public String createNotification(Notification notification) throws NotificationCreationException;
-
-    public List<Notification> getNotifications();
-
-    public Notification getCurrentNotification();
-
-    public Notification getNotification(String id) throws NotificationNotFoundException;
-
-    public void deleteNotification(String id) throws NotificationNotFoundException;
-
-    public Display getDisplay();
-
-    public Display updateDisplay(Display display) throws UpdateException;
-
-    public Audio getAudio();
-
-    public Audio updateAudio(Audio audio) throws UpdateException;
-
-    public Bluetooth getBluetooth();
-
-    public Bluetooth updateBluetooth(Bluetooth bluetooth) throws UpdateException;
-
-    public Wifi getWifi();
-
-    public void updateApplication(String packageName,
-                                  String accessToken,
-                                  WidgetUpdates widgetUpdates) throws UpdateException;
-
-    public SortedMap<String, Application> getApplications();
-
-    public Application getApplication(String packageName) throws ApplicationNotFoundException;
-
-    public void activatePreviousApplication();
-
-    public void activateNextApplication();
-
-    public void activateApplication(String packageName,
-                                    String widgetId) throws ApplicationActivationException;
-
-    public void doAction(String packageName,
-                         String widgetId,
-                         UpdateAction action) throws ApplicationActionException;
-
-    public static LaMetricTimeLocal create(LocalConfiguration config)
-    {
-        return new LaMetricTimeLocalImpl(config);
-    }
-
-    public static LaMetricTimeLocal create(LocalConfiguration config, ClientBuilder clientBuilder)
-    {
-        return new LaMetricTimeLocalImpl(config, clientBuilder);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/LocalConfiguration.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/LocalConfiguration.java
deleted file mode 100644 (file)
index 128cea2..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-public class LocalConfiguration
-{
-    private String host;
-    private String apiKey;
-
-    private boolean secure = true;
-    private boolean ignoreCertificateValidation = true;
-    private boolean ignoreHostnameValidation = true;
-
-    private String insecureScheme = "http";
-    private int insecurePort = 8080;
-
-    private String secureScheme = "https";
-    private int securePort = 4343;
-
-    private String basePath = "/api/v2";
-
-    private String authUser = "dev";
-
-    private boolean logging = false;
-    private String logLevel = "INFO";
-    private int logMax = 104857600; // 100kb
-
-    public String getHost()
-    {
-        return host;
-    }
-
-    public void setHost(String host)
-    {
-        this.host = host;
-    }
-
-    public LocalConfiguration withHost(String host)
-    {
-        this.host = host;
-        return this;
-    }
-
-    public String getApiKey()
-    {
-        return apiKey;
-    }
-
-    public void setApiKey(String apiKey)
-    {
-        this.apiKey = apiKey;
-    }
-
-    public LocalConfiguration withApiKey(String apiKey)
-    {
-        this.apiKey = apiKey;
-        return this;
-    }
-
-    public boolean isSecure()
-    {
-        return secure;
-    }
-
-    public void setSecure(boolean secure)
-    {
-        this.secure = secure;
-    }
-
-    public LocalConfiguration withSecure(boolean secure)
-    {
-        this.secure = secure;
-        return this;
-    }
-
-    public boolean isIgnoreCertificateValidation()
-    {
-        return ignoreCertificateValidation;
-    }
-
-    public void setIgnoreCertificateValidation(boolean ignoreCertificateValidation)
-    {
-        this.ignoreCertificateValidation = ignoreCertificateValidation;
-    }
-
-    public LocalConfiguration withIgnoreCertificateValidation(boolean ignoreCertificateValidation)
-    {
-        this.ignoreCertificateValidation = ignoreCertificateValidation;
-        return this;
-    }
-
-    public boolean isIgnoreHostnameValidation()
-    {
-        return ignoreHostnameValidation;
-    }
-
-    public void setIgnoreHostnameValidation(boolean ignoreHostnameValidation)
-    {
-        this.ignoreHostnameValidation = ignoreHostnameValidation;
-    }
-
-    public LocalConfiguration withIgnoreHostnameValidation(boolean ignoreHostnameValidation)
-    {
-        this.ignoreHostnameValidation = ignoreHostnameValidation;
-        return this;
-    }
-
-    public String getInsecureScheme()
-    {
-        return insecureScheme;
-    }
-
-    public void setInsecureScheme(String insecureScheme)
-    {
-        this.insecureScheme = insecureScheme;
-    }
-
-    public LocalConfiguration withInsecureScheme(String insecureScheme)
-    {
-        this.insecureScheme = insecureScheme;
-        return this;
-    }
-
-    public int getInsecurePort()
-    {
-        return insecurePort;
-    }
-
-    public void setInsecurePort(int insecurePort)
-    {
-        this.insecurePort = insecurePort;
-    }
-
-    public LocalConfiguration withInsecurePort(int insecurePort)
-    {
-        this.insecurePort = insecurePort;
-        return this;
-    }
-
-    public String getSecureScheme()
-    {
-        return secureScheme;
-    }
-
-    public void setSecureScheme(String secureScheme)
-    {
-        this.secureScheme = secureScheme;
-    }
-
-    public LocalConfiguration withSecureScheme(String secureScheme)
-    {
-        this.secureScheme = secureScheme;
-        return this;
-    }
-
-    public int getSecurePort()
-    {
-        return securePort;
-    }
-
-    public void setSecurePort(int securePort)
-    {
-        this.securePort = securePort;
-    }
-
-    public LocalConfiguration withSecurePort(int securePort)
-    {
-        this.securePort = securePort;
-        return this;
-    }
-
-    public String getBasePath()
-    {
-        return basePath;
-    }
-
-    public void setBasePath(String basePath)
-    {
-        this.basePath = basePath;
-    }
-
-    public LocalConfiguration withBasePath(String basePath)
-    {
-        this.basePath = basePath;
-        return this;
-    }
-
-    public String getAuthUser()
-    {
-        return authUser;
-    }
-
-    public void setAuthUser(String authUser)
-    {
-        this.authUser = authUser;
-    }
-
-    public LocalConfiguration withAuthUser(String authUser)
-    {
-        this.authUser = authUser;
-        return this;
-    }
-
-    public boolean isLogging()
-    {
-        return logging;
-    }
-
-    public void setLogging(boolean logging)
-    {
-        this.logging = logging;
-    }
-
-    public LocalConfiguration withLogging(boolean logging)
-    {
-        this.logging = logging;
-        return this;
-    }
-
-    public String getLogLevel()
-    {
-        return logLevel;
-    }
-
-    public void setLogLevel(String logLevel)
-    {
-        this.logLevel = logLevel;
-    }
-
-    public LocalConfiguration withLogLevel(String logLevel)
-    {
-        this.logLevel = logLevel;
-        return this;
-    }
-
-    public int getLogMax()
-    {
-        return logMax;
-    }
-
-    public void setLogMax(int logMax)
-    {
-        this.logMax = logMax;
-    }
-
-    public LocalConfiguration withLogMax(int logMax)
-    {
-        this.logMax = logMax;
-        return this;
-    }
-
-    public URI getBaseUri()
-    {
-        String scheme = secure ? secureScheme : insecureScheme;
-        int port = secure ? securePort : insecurePort;
-        try
-        {
-            return new URI(scheme, null, host, port, basePath, null, null);
-        }
-        catch (URISyntaxException e)
-        {
-            throw new RuntimeException("Invalid configuration", e);
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/NotificationCreationException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/NotificationCreationException.java
deleted file mode 100644 (file)
index c07dc39..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local;
-
-import org.openhab.binding.lametrictime.api.local.model.Failure;
-
-public class NotificationCreationException extends LaMetricTimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public NotificationCreationException()
-    {
-        super();
-    }
-
-    public NotificationCreationException(String message)
-    {
-        super(message);
-    }
-
-    public NotificationCreationException(Throwable cause)
-    {
-        super(cause);
-    }
-
-    public NotificationCreationException(String message, Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public NotificationCreationException(String message,
-                                         Throwable cause,
-                                         boolean enableSuppression,
-                                         boolean writableStackTrace)
-    {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-
-    public NotificationCreationException(Failure failure)
-    {
-        super(failure);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/NotificationNotFoundException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/NotificationNotFoundException.java
deleted file mode 100644 (file)
index d34085f..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local;
-
-import org.openhab.binding.lametrictime.api.local.model.Failure;
-
-public class NotificationNotFoundException extends LaMetricTimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public NotificationNotFoundException()
-    {
-        super();
-    }
-
-    public NotificationNotFoundException(String message,
-                                         Throwable cause,
-                                         boolean enableSuppression,
-                                         boolean writableStackTrace)
-    {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-
-    public NotificationNotFoundException(String message, Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public NotificationNotFoundException(String message)
-    {
-        super(message);
-    }
-
-    public NotificationNotFoundException(Throwable cause)
-    {
-        super(cause);
-    }
-
-    public NotificationNotFoundException(Failure failure)
-    {
-        super(failure);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/UpdateException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/UpdateException.java
deleted file mode 100644 (file)
index 553e0a1..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local;
-
-import org.openhab.binding.lametrictime.api.local.model.Failure;
-
-public class UpdateException extends LaMetricTimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public UpdateException()
-    {
-        super();
-    }
-
-    public UpdateException(String message)
-    {
-        super(message);
-    }
-
-    public UpdateException(Throwable cause)
-    {
-        super(cause);
-    }
-
-    public UpdateException(String message, Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public UpdateException(String message,
-                           Throwable cause,
-                           boolean enableSuppression,
-                           boolean writableStackTrace)
-    {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-
-    public UpdateException(Failure failure)
-    {
-        super(failure);
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/impl/LaMetricTimeLocalImpl.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/impl/LaMetricTimeLocalImpl.java
deleted file mode 100644 (file)
index 5aea72f..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.impl;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.nio.charset.StandardCharsets;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.logging.Logger;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-
-import org.openhab.binding.lametrictime.api.authentication.HttpAuthenticationFeature;
-import org.openhab.binding.lametrictime.api.cloud.impl.LaMetricTimeCloudImpl;
-import org.openhab.binding.lametrictime.api.common.impl.AbstractClient;
-import org.openhab.binding.lametrictime.api.filter.LoggingFilter;
-import org.openhab.binding.lametrictime.api.local.ApplicationActionException;
-import org.openhab.binding.lametrictime.api.local.ApplicationActivationException;
-import org.openhab.binding.lametrictime.api.local.ApplicationNotFoundException;
-import org.openhab.binding.lametrictime.api.local.LaMetricTimeLocal;
-import org.openhab.binding.lametrictime.api.local.LocalConfiguration;
-import org.openhab.binding.lametrictime.api.local.NotificationCreationException;
-import org.openhab.binding.lametrictime.api.local.NotificationNotFoundException;
-import org.openhab.binding.lametrictime.api.local.UpdateException;
-import org.openhab.binding.lametrictime.api.local.model.Api;
-import org.openhab.binding.lametrictime.api.local.model.Application;
-import org.openhab.binding.lametrictime.api.local.model.Audio;
-import org.openhab.binding.lametrictime.api.local.model.AudioUpdateResult;
-import org.openhab.binding.lametrictime.api.local.model.Bluetooth;
-import org.openhab.binding.lametrictime.api.local.model.BluetoothUpdateResult;
-import org.openhab.binding.lametrictime.api.local.model.Device;
-import org.openhab.binding.lametrictime.api.local.model.Display;
-import org.openhab.binding.lametrictime.api.local.model.DisplayUpdateResult;
-import org.openhab.binding.lametrictime.api.local.model.Failure;
-import org.openhab.binding.lametrictime.api.local.model.Notification;
-import org.openhab.binding.lametrictime.api.local.model.NotificationResult;
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-import org.openhab.binding.lametrictime.api.local.model.WidgetUpdates;
-import org.openhab.binding.lametrictime.api.local.model.Wifi;
-import org.openhab.binding.lametrictime.internal.GsonProvider;
-
-import com.google.gson.reflect.TypeToken;
-
-public class LaMetricTimeLocalImpl extends AbstractClient implements LaMetricTimeLocal {
-    private static final String HEADER_ACCESS_TOKEN = "X-Access-Token";
-
-    private final LocalConfiguration config;
-
-    private volatile Api api;
-
-    public LaMetricTimeLocalImpl(LocalConfiguration config) {
-        this.config = config;
-    }
-
-    public LaMetricTimeLocalImpl(LocalConfiguration config, ClientBuilder clientBuilder) {
-        super(clientBuilder);
-        this.config = config;
-    }
-
-    @Override
-    public Api getApi() {
-        if (api == null) {
-            synchronized (this) {
-                if (api == null) {
-                    api = getClient().target(config.getBaseUri()).request(MediaType.APPLICATION_JSON_TYPE)
-                            .get(Api.class);
-                }
-            }
-        }
-
-        // remove support for v2.0.0 which has several errors in returned endpoints
-        if ("2.0.0".equals(api.getApiVersion())) {
-            throw new IllegalStateException(
-                    "API version 2.0.0 detected, but 2.1.0 or greater is required. Please upgrade LaMetric Time firmware to version 1.7.7 or later. See http://lametric.com/firmware for more information.");
-        }
-
-        return api;
-    }
-
-    @Override
-    public Device getDevice() {
-        return getClient().target(getApi().getEndpoints().getDeviceUrl()).request(MediaType.APPLICATION_JSON_TYPE)
-                .get(Device.class);
-    }
-
-    @Override
-    public String createNotification(Notification notification) throws NotificationCreationException {
-        Response response = getClient().target(getApi().getEndpoints().getNotificationsUrl())
-                .request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(notification));
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new NotificationCreationException(response.readEntity(Failure.class));
-        }
-
-        try {
-            return response.readEntity(NotificationResult.class).getSuccess().getId();
-        } catch (Exception e) {
-            throw new NotificationCreationException("Invalid JSON returned from service", e);
-        }
-    }
-
-    @Override
-    public List<Notification> getNotifications() {
-        Response response = getClient().target(getApi().getEndpoints().getNotificationsUrl())
-                .request(MediaType.APPLICATION_JSON_TYPE).get();
-
-        Reader entity = new BufferedReader(
-                new InputStreamReader((InputStream) response.getEntity(), StandardCharsets.UTF_8));
-
-        // @formatter:off
-        return getGson().fromJson(entity,  new TypeToken<List<Notification>>(){}.getType());
-        // @formatter:on
-    }
-
-    @Override
-    public Notification getCurrentNotification() {
-        Notification notification = getClient().target(getApi().getEndpoints().getCurrentNotificationUrl())
-                .request(MediaType.APPLICATION_JSON_TYPE).get(Notification.class);
-
-        // when there is no current notification, return null
-        if (notification.getId() == null) {
-            return null;
-        }
-
-        return notification;
-    }
-
-    @Override
-    public Notification getNotification(String id) throws NotificationNotFoundException {
-        Response response = getClient()
-                .target(getApi().getEndpoints().getConcreteNotificationUrl().replace("{:id}", id))
-                .request(MediaType.APPLICATION_JSON_TYPE).get();
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new NotificationNotFoundException(response.readEntity(Failure.class));
-        }
-
-        return response.readEntity(Notification.class);
-    }
-
-    @Override
-    public void deleteNotification(String id) throws NotificationNotFoundException {
-        Response response = getClient()
-                .target(getApi().getEndpoints().getConcreteNotificationUrl().replace("{:id}", id))
-                .request(MediaType.APPLICATION_JSON_TYPE).delete();
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new NotificationNotFoundException(response.readEntity(Failure.class));
-        }
-
-        response.close();
-    }
-
-    @Override
-    public Display getDisplay() {
-        return getClient().target(getApi().getEndpoints().getDisplayUrl()).request(MediaType.APPLICATION_JSON_TYPE)
-                .get(Display.class);
-    }
-
-    @Override
-    public Display updateDisplay(Display display) throws UpdateException {
-        Response response = getClient().target(getApi().getEndpoints().getDisplayUrl())
-                .request(MediaType.APPLICATION_JSON_TYPE).put(Entity.json(display));
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new UpdateException(response.readEntity(Failure.class));
-        }
-
-        return response.readEntity(DisplayUpdateResult.class).getSuccess().getData();
-    }
-
-    @Override
-    public Audio getAudio() {
-        return getClient().target(getApi().getEndpoints().getAudioUrl()).request(MediaType.APPLICATION_JSON_TYPE)
-                .get(Audio.class);
-    }
-
-    @Override
-    public Audio updateAudio(Audio audio) throws UpdateException {
-        Response response = getClient().target(getApi().getEndpoints().getAudioUrl())
-                .request(MediaType.APPLICATION_JSON_TYPE).put(Entity.json(audio));
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new UpdateException(response.readEntity(Failure.class));
-        }
-
-        return response.readEntity(AudioUpdateResult.class).getSuccess().getData();
-    }
-
-    @Override
-    public Bluetooth getBluetooth() {
-        return getClient().target(getApi().getEndpoints().getBluetoothUrl()).request(MediaType.APPLICATION_JSON_TYPE)
-                .get(Bluetooth.class);
-    }
-
-    @Override
-    public Bluetooth updateBluetooth(Bluetooth bluetooth) throws UpdateException {
-        Response response = getClient().target(getApi().getEndpoints().getBluetoothUrl())
-                .request(MediaType.APPLICATION_JSON_TYPE).put(Entity.json(bluetooth));
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new UpdateException(response.readEntity(Failure.class));
-        }
-
-        return response.readEntity(BluetoothUpdateResult.class).getSuccess().getData();
-    }
-
-    @Override
-    public Wifi getWifi() {
-        return getClient().target(getApi().getEndpoints().getWifiUrl()).request(MediaType.APPLICATION_JSON_TYPE)
-                .get(Wifi.class);
-    }
-
-    @Override
-    public void updateApplication(String packageName, String accessToken, WidgetUpdates widgetUpdates)
-            throws UpdateException {
-        Response response = getClient()
-                .target(getApi().getEndpoints().getWidgetUpdateUrl().replace("{:id}", packageName))
-                .request(MediaType.APPLICATION_JSON_TYPE).header(HEADER_ACCESS_TOKEN, accessToken)
-                .post(Entity.json(widgetUpdates));
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new UpdateException(response.readEntity(Failure.class));
-        }
-
-        response.close();
-    }
-
-    @Override
-    public SortedMap<String, Application> getApplications() {
-        Response response = getClient().target(getApi().getEndpoints().getAppsListUrl())
-                .request(MediaType.APPLICATION_JSON_TYPE).get();
-
-        Reader entity = new BufferedReader(
-                new InputStreamReader((InputStream) response.getEntity(), StandardCharsets.UTF_8));
-
-        // @formatter:off
-        return getGson().fromJson(entity,
-                                  new TypeToken<SortedMap<String, Application>>(){}.getType());
-        // @formatter:on
-    }
-
-    @Override
-    public Application getApplication(String packageName) throws ApplicationNotFoundException {
-        Response response = getClient().target(getApi().getEndpoints().getAppsGetUrl().replace("{:id}", packageName))
-                .request(MediaType.APPLICATION_JSON_TYPE).get();
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new ApplicationNotFoundException(response.readEntity(Failure.class));
-        }
-
-        return response.readEntity(Application.class);
-    }
-
-    @Override
-    public void activatePreviousApplication() {
-        getClient().target(getApi().getEndpoints().getAppsSwitchPrevUrl()).request(MediaType.APPLICATION_JSON_TYPE)
-                .put(Entity.json(new Object()));
-    }
-
-    @Override
-    public void activateNextApplication() {
-        getClient().target(getApi().getEndpoints().getAppsSwitchNextUrl()).request(MediaType.APPLICATION_JSON_TYPE)
-                .put(Entity.json(new Object()));
-    }
-
-    @Override
-    public void activateApplication(String packageName, String widgetId) throws ApplicationActivationException {
-        Response response = getClient().target(getApi().getEndpoints().getAppsSwitchUrl().replace("{:id}", packageName)
-                .replace("{:widget_id}", widgetId)).request(MediaType.APPLICATION_JSON_TYPE)
-                .put(Entity.json(new Object()));
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new ApplicationActivationException(response.readEntity(Failure.class));
-        }
-
-        response.close();
-    }
-
-    @Override
-    public void doAction(String packageName, String widgetId, UpdateAction action) throws ApplicationActionException {
-        Response response = getClient().target(getApi().getEndpoints().getAppsActionUrl().replace("{:id}", packageName)
-                .replace("{:widget_id}", widgetId)).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(action));
-
-        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
-            throw new ApplicationActionException(response.readEntity(Failure.class));
-        }
-
-        response.close();
-    }
-
-    @Override
-    protected Client createClient() {
-        ClientBuilder builder = clientBuilder;
-
-        // setup Gson (de)serialization
-        GsonProvider<Object> gsonProvider = new GsonProvider<>();
-        builder.register(gsonProvider);
-
-        if (config.isSecure()) {
-            /*
-             * The certificate presented by LaMetric time is self-signed.
-             * Therefore, unless the user takes action by adding the certificate
-             * chain to the Java keystore, HTTPS will fail.
-             *
-             * By setting the ignoreCertificateValidation configuration option
-             * to true (default), HTTPS will be used and the connection will be
-             * encrypted, but the validity of the certificate is not confirmed.
-             */
-            if (config.isIgnoreCertificateValidation()) {
-                try {
-                    SSLContext sslcontext = SSLContext.getInstance("TLS");
-                    sslcontext.init(null, new TrustManager[] { new X509TrustManager() {
-                        @Override
-                        public void checkClientTrusted(X509Certificate[] arg0, String arg1)
-                                throws CertificateException {
-                            // noop
-                        }
-
-                        @Override
-                        public void checkServerTrusted(X509Certificate[] arg0, String arg1)
-                                throws CertificateException {
-                            // noop
-                        }
-
-                        @Override
-                        public X509Certificate[] getAcceptedIssuers() {
-                            return new X509Certificate[0];
-                        }
-
-                    } }, new java.security.SecureRandom());
-                    builder.sslContext(sslcontext);
-                } catch (KeyManagementException | NoSuchAlgorithmException e) {
-                    throw new RuntimeException("Failed to setup secure communication", e);
-                }
-            }
-
-            /*
-             * The self-signed certificate used by LaMetric time does not match
-             * the host when configured on a network. This makes the HTTPS
-             * handshake fail.
-             *
-             * By setting the ignoreHostnameValidation configuration option to
-             * true (default), HTTPS will be used and the connection will be
-             * encrypted, but the validity of the hostname in the certificate is
-             * not confirmed.
-             */
-            if (config.isIgnoreHostnameValidation()) {
-                builder.hostnameVerifier((host, session) -> true);
-            }
-        }
-
-        // turn on logging if requested
-        if (config.isLogging()) {
-            builder.register(
-                    new LoggingFilter(Logger.getLogger(LaMetricTimeCloudImpl.class.getName()), config.getLogMax()));
-        }
-
-        // setup basic auth
-        builder.register(HttpAuthenticationFeature.basic(config.getAuthUser(), config.getApiKey()));
-
-        return builder.build();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Action.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Action.java
deleted file mode 100644 (file)
index d0fbe54..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import java.util.SortedMap;
-
-import com.google.gson.annotations.SerializedName;
-
-public class Action
-{
-    private String id;
-    @SerializedName("params")
-    private SortedMap<String, Parameter> parameters;
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId(String id)
-    {
-        this.id = id;
-    }
-
-    public Action withId(String id)
-    {
-        setId(id);
-        return this;
-    }
-
-    public SortedMap<String, Parameter> getParameters()
-    {
-        return parameters;
-    }
-
-    public void setParameters(SortedMap<String, Parameter> parameters)
-    {
-        this.parameters = parameters;
-    }
-
-    public Action withParameters(SortedMap<String, Parameter> parameters)
-    {
-        setParameters(parameters);
-        return this;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((id == null) ? 0 : id.hashCode());
-        result = prime * result + ((parameters == null) ? 0 : parameters.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj)
-    {
-        if (this == obj)
-        {
-            return true;
-        }
-        if (obj == null)
-        {
-            return false;
-        }
-        if (getClass() != obj.getClass())
-        {
-            return false;
-        }
-        Action other = (Action)obj;
-        if (id == null)
-        {
-            if (other.id != null)
-            {
-                return false;
-            }
-        }
-        else if (!id.equals(other.id))
-        {
-            return false;
-        }
-        if (parameters == null)
-        {
-            if (other.parameters != null)
-            {
-                return false;
-            }
-        }
-        else if (!parameters.equals(other.parameters))
-        {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Action [id=");
-        builder.append(id);
-        builder.append(", parameters=");
-        builder.append(parameters);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Api.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Api.java
deleted file mode 100644 (file)
index 83ba2c1..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Api
-{
-    private String apiVersion;
-    private Endpoints endpoints;
-
-    public String getApiVersion()
-    {
-        return apiVersion;
-    }
-
-    public void setApiVersion(String apiVersion)
-    {
-        this.apiVersion = apiVersion;
-    }
-
-    public Api withApiVersion(String apiVersion)
-    {
-        this.apiVersion = apiVersion;
-        return this;
-    }
-
-    public Endpoints getEndpoints()
-    {
-        return endpoints;
-    }
-
-    public void setEndpoints(Endpoints endpoints)
-    {
-        this.endpoints = endpoints;
-    }
-
-    public Api withEndpoints(Endpoints endpoints)
-    {
-        this.endpoints = endpoints;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Api [apiVersion=");
-        builder.append(apiVersion);
-        builder.append(", endpoints=");
-        builder.append(endpoints);
-        builder.append("]");
-        return builder.toString();
-    }
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Application.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Application.java
deleted file mode 100644 (file)
index 487a9ff..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import java.util.SortedMap;
-
-import com.google.gson.annotations.SerializedName;
-
-public class Application
-{
-    private SortedMap<String, Action> actions;
-    @SerializedName("package")
-    private String packageName;
-    private String vendor;
-    private String version;
-    private String versionCode;
-    private SortedMap<String, Widget> widgets;
-
-    public SortedMap<String, Action> getActions()
-    {
-        return actions;
-    }
-
-    public void setActions(SortedMap<String, Action> actions)
-    {
-        this.actions = actions;
-    }
-
-    public Application withActions(SortedMap<String, Action> actions)
-    {
-        setActions(actions);
-        return this;
-    }
-
-    public String getPackageName()
-    {
-        return packageName;
-    }
-
-    public void setPackageName(String packageName)
-    {
-        this.packageName = packageName;
-    }
-
-    public Application withPackageName(String packageName)
-    {
-        setPackageName(packageName);
-        return this;
-    }
-
-    public String getVendor()
-    {
-        return vendor;
-    }
-
-    public void setVendor(String vendor)
-    {
-        this.vendor = vendor;
-    }
-
-    public Application withVendor(String vendor)
-    {
-        setVendor(vendor);
-        return this;
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion(String version)
-    {
-        this.version = version;
-    }
-
-    public Application withVersion(String version)
-    {
-        setVersion(version);
-        return this;
-    }
-
-    public String getVersionCode()
-    {
-        return versionCode;
-    }
-
-    public void setVersionCode(String versionCode)
-    {
-        this.versionCode = versionCode;
-    }
-
-    public Application withVersionCode(String versionCode)
-    {
-        setVersionCode(versionCode);
-        return this;
-    }
-
-    public SortedMap<String, Widget> getWidgets()
-    {
-        return widgets;
-    }
-
-    public void setWidgets(SortedMap<String, Widget> widgets)
-    {
-        this.widgets = widgets;
-    }
-
-    public Application withWidgets(SortedMap<String, Widget> widgets)
-    {
-        setWidgets(widgets);
-        return this;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((packageName == null) ? 0 : packageName.hashCode());
-        result = prime * result + ((versionCode == null) ? 0 : versionCode.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj)
-    {
-        if (this == obj)
-        {
-            return true;
-        }
-        if (obj == null)
-        {
-            return false;
-        }
-        if (getClass() != obj.getClass())
-        {
-            return false;
-        }
-        Application other = (Application)obj;
-        if (packageName == null)
-        {
-            if (other.packageName != null)
-            {
-                return false;
-            }
-        }
-        else if (!packageName.equals(other.packageName))
-        {
-            return false;
-        }
-        if (versionCode == null)
-        {
-            if (other.versionCode != null)
-            {
-                return false;
-            }
-        }
-        else if (!versionCode.equals(other.versionCode))
-        {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Application [actions=");
-        builder.append(actions);
-        builder.append(", packageName=");
-        builder.append(packageName);
-        builder.append(", vendor=");
-        builder.append(vendor);
-        builder.append(", version=");
-        builder.append(version);
-        builder.append(", versionCode=");
-        builder.append(versionCode);
-        builder.append(", widgets=");
-        builder.append(widgets);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Audio.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Audio.java
deleted file mode 100644 (file)
index 1282ad9..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Audio
-{
-    private Integer volume;
-
-    public Integer getVolume()
-    {
-        return volume;
-    }
-
-    public void setVolume(Integer volume)
-    {
-        this.volume = volume;
-    }
-
-    public Audio withVolume(Integer volume)
-    {
-        this.volume = volume;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Audio [volume=");
-        builder.append(volume);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/AudioUpdateResult.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/AudioUpdateResult.java
deleted file mode 100644 (file)
index d5a5ddf..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class AudioUpdateResult
-{
-    private Success success;
-
-    public Success getSuccess()
-    {
-        return success;
-    }
-
-    public void setSuccess(Success success)
-    {
-        this.success = success;
-    }
-
-    public AudioUpdateResult withSuccess(Success success)
-    {
-        this.success = success;
-        return this;
-    }
-
-    public static class Success
-    {
-        private Audio data;
-
-        public Audio getData()
-        {
-            return data;
-        }
-
-        public void setData(Audio data)
-        {
-            this.data = data;
-        }
-
-        public Success withData(Audio data)
-        {
-            this.data = data;
-            return this;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Bluetooth.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Bluetooth.java
deleted file mode 100644 (file)
index 83f1f16..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Bluetooth
-{
-    private Boolean active;
-
-    /*
-     * API sometimes calls this field 'mac' and other times calls it 'address'.
-     * Additionally, Gson uses fields only (not methods). Therefore, if use the
-     * same instance of this class to read one value and then try to write the
-     * other without calling the setter, it won't work (the other value will be
-     * null).
-     */
-    private String mac;
-    private String address;
-
-    private Boolean available;
-    private Boolean discoverable;
-    private String name;
-    private Boolean pairable;
-
-    public Boolean isActive()
-    {
-        return active;
-    }
-
-    public void setActive(Boolean active)
-    {
-        this.active = active;
-    }
-
-    public Bluetooth withActive(Boolean active)
-    {
-        this.active = active;
-        return this;
-    }
-
-    public String getMac()
-    {
-        return mac == null ? address : mac;
-    }
-
-    public void setMac(String mac)
-    {
-        this.mac = mac;
-        this.address = mac;
-    }
-
-    public Bluetooth withMac(String mac)
-    {
-        setMac(mac);
-        return this;
-    }
-
-    public Boolean isAvailable()
-    {
-        return available;
-    }
-
-    public void setAvailable(Boolean available)
-    {
-        this.available = available;
-    }
-
-    public Bluetooth withAvailable(Boolean available)
-    {
-        this.available = available;
-        return this;
-    }
-
-    public Boolean isDiscoverable()
-    {
-        return discoverable;
-    }
-
-    public void setDiscoverable(Boolean discoverable)
-    {
-        this.discoverable = discoverable;
-    }
-
-    public Bluetooth withDiscoverable(Boolean discoverable)
-    {
-        this.discoverable = discoverable;
-        return this;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName(String name)
-    {
-        this.name = name;
-    }
-
-    public Bluetooth withName(String name)
-    {
-        this.name = name;
-        return this;
-    }
-
-    public Boolean isPairable()
-    {
-        return pairable;
-    }
-
-    public void setPairable(Boolean pairable)
-    {
-        this.pairable = pairable;
-    }
-
-    public Bluetooth withPairable(Boolean pairable)
-    {
-        this.pairable = pairable;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Bluetooth [active=");
-        builder.append(active);
-        builder.append(", mac=");
-        builder.append(getMac());
-        builder.append(", available=");
-        builder.append(available);
-        builder.append(", discoverable=");
-        builder.append(discoverable);
-        builder.append(", name=");
-        builder.append(name);
-        builder.append(", pairable=");
-        builder.append(pairable);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/BluetoothUpdateResult.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/BluetoothUpdateResult.java
deleted file mode 100644 (file)
index a28b787..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class BluetoothUpdateResult
-{
-    private Success success;
-
-    public Success getSuccess()
-    {
-        return success;
-    }
-
-    public void setSuccess(Success success)
-    {
-        this.success = success;
-    }
-
-    public BluetoothUpdateResult withSuccess(Success success)
-    {
-        this.success = success;
-        return this;
-    }
-
-    public static class Success
-    {
-        private Bluetooth data;
-
-        public Bluetooth getData()
-        {
-            return data;
-        }
-
-        public void setData(Bluetooth data)
-        {
-            this.data = data;
-        }
-
-        public Success withData(Bluetooth data)
-        {
-            this.data = data;
-            return this;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/BooleanParameter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/BooleanParameter.java
deleted file mode 100644 (file)
index cb3c3f2..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class BooleanParameter extends Parameter
-{
-    private Boolean value;
-
-    @Override
-    public BooleanParameter withName(String name)
-    {
-        super.withName(name);
-        return this;
-    }
-
-    @Override
-    public BooleanParameter withRequired(Boolean required)
-    {
-        super.withRequired(required);
-        return this;
-    }
-
-    public Boolean getValue()
-    {
-        return value;
-    }
-
-    public void setValue(Boolean value)
-    {
-        this.value = value;
-    }
-
-    public BooleanParameter withValue(Boolean value)
-    {
-        setValue(value);
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("BooleanParameter [value=");
-        builder.append(value);
-        builder.append(", getName()=");
-        builder.append(getName());
-        builder.append(", getRequired()=");
-        builder.append(getRequired());
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Device.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Device.java
deleted file mode 100644 (file)
index 61ca40a..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Device
-{
-    private Audio audio;
-    private Bluetooth bluetooth;
-    private Display display;
-    private String id;
-    private String mode;
-    private String model;
-    private String name;
-    private String osVersion;
-    private String serialNumber;
-    private Wifi wifi;
-
-    public Audio getAudio()
-    {
-        return audio;
-    }
-
-    public void setAudio(Audio audio)
-    {
-        this.audio = audio;
-    }
-
-    public Device withAudio(Audio audio)
-    {
-        this.audio = audio;
-        return this;
-    }
-
-    public Bluetooth getBluetooth()
-    {
-        return bluetooth;
-    }
-
-    public void setBluetooth(Bluetooth bluetooth)
-    {
-        this.bluetooth = bluetooth;
-    }
-
-    public Device withBluetooth(Bluetooth bluetooth)
-    {
-        this.bluetooth = bluetooth;
-        return this;
-    }
-
-    public Display getDisplay()
-    {
-        return display;
-    }
-
-    public void setDisplay(Display display)
-    {
-        this.display = display;
-    }
-
-    public Device withDisplay(Display display)
-    {
-        this.display = display;
-        return this;
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId(String id)
-    {
-        this.id = id;
-    }
-
-    public Device withId(String id)
-    {
-        this.id = id;
-        return this;
-    }
-
-    public String getMode()
-    {
-        return mode;
-    }
-
-    public void setMode(String mode)
-    {
-        this.mode = mode;
-    }
-
-    public Device withMode(String mode)
-    {
-        this.mode = mode;
-        return this;
-    }
-
-    public String getModel()
-    {
-        return model;
-    }
-
-    public void setModel(String model)
-    {
-        this.model = model;
-    }
-
-    public Device withModel(String model)
-    {
-        this.model = model;
-        return this;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName(String name)
-    {
-        this.name = name;
-    }
-
-    public Device withName(String name)
-    {
-        this.name = name;
-        return this;
-    }
-
-    public String getOsVersion()
-    {
-        return osVersion;
-    }
-
-    public void setOsVersion(String osVersion)
-    {
-        this.osVersion = osVersion;
-    }
-
-    public Device withOsVersion(String osVersion)
-    {
-        this.osVersion = osVersion;
-        return this;
-    }
-
-    public String getSerialNumber()
-    {
-        return serialNumber;
-    }
-
-    public void setSerialNumber(String serialNumber)
-    {
-        this.serialNumber = serialNumber;
-    }
-
-    public Device withSerialNumber(String serialNumber)
-    {
-        this.serialNumber = serialNumber;
-        return this;
-    }
-
-    public Wifi getWifi()
-    {
-        return wifi;
-    }
-
-    public void setWifi(Wifi wifi)
-    {
-        this.wifi = wifi;
-    }
-
-    public Device withWifi(Wifi wifi)
-    {
-        this.wifi = wifi;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Device [audio=");
-        builder.append(audio);
-        builder.append(", bluetooth=");
-        builder.append(bluetooth);
-        builder.append(", display=");
-        builder.append(display);
-        builder.append(", id=");
-        builder.append(id);
-        builder.append(", mode=");
-        builder.append(mode);
-        builder.append(", model=");
-        builder.append(model);
-        builder.append(", name=");
-        builder.append(name);
-        builder.append(", osVersion=");
-        builder.append(osVersion);
-        builder.append(", serialNumber=");
-        builder.append(serialNumber);
-        builder.append(", wifi=");
-        builder.append(wifi);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Display.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Display.java
deleted file mode 100644 (file)
index 057812a..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Display
-{
-    private Integer brightness;
-    private String brightnessMode;
-    private Integer height;
-    private Screensaver screensaver;
-    private String type;
-    private Integer width;
-
-    public Integer getBrightness()
-    {
-        return brightness;
-    }
-
-    public void setBrightness(Integer brightness)
-    {
-        this.brightness = brightness;
-    }
-
-    public Display withBrightness(Integer brightness)
-    {
-        this.brightness = brightness;
-        return this;
-    }
-
-    public String getBrightnessMode()
-    {
-        return brightnessMode;
-    }
-
-    public void setBrightnessMode(String brightnessMode)
-    {
-        this.brightnessMode = brightnessMode;
-    }
-
-    public Display withBrightnessMode(String brightnessMode)
-    {
-        this.brightnessMode = brightnessMode;
-        return this;
-    }
-
-    public Integer getHeight()
-    {
-        return height;
-    }
-
-    public void setHeight(Integer height)
-    {
-        this.height = height;
-    }
-
-    public Display withHeight(Integer height)
-    {
-        this.height = height;
-        return this;
-    }
-
-    public Screensaver getScreensaver()
-    {
-        return screensaver;
-    }
-
-    public void setScreensaver(Screensaver screensaver)
-    {
-        this.screensaver = screensaver;
-    }
-
-    public Display withScreensaver(Screensaver screensaver)
-    {
-        this.screensaver = screensaver;
-        return this;
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-
-    public void setType(String type)
-    {
-        this.type = type;
-    }
-
-    public Display withType(String type)
-    {
-        this.type = type;
-        return this;
-    }
-
-    public Integer getWidth()
-    {
-        return width;
-    }
-
-    public void setWidth(Integer width)
-    {
-        this.width = width;
-    }
-
-    public Display withWidth(Integer width)
-    {
-        this.width = width;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Display [brightness=");
-        builder.append(brightness);
-        builder.append(", brightnessMode=");
-        builder.append(brightnessMode);
-        builder.append(", height=");
-        builder.append(height);
-        builder.append(", screensaver=");
-        builder.append(screensaver);
-        builder.append(", type=");
-        builder.append(type);
-        builder.append(", width=");
-        builder.append(width);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/DisplayUpdateResult.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/DisplayUpdateResult.java
deleted file mode 100644 (file)
index 948ade7..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class DisplayUpdateResult
-{
-    private Success success;
-
-    public Success getSuccess()
-    {
-        return success;
-    }
-
-    public void setSuccess(Success success)
-    {
-        this.success = success;
-    }
-
-    public DisplayUpdateResult withSuccess(Success success)
-    {
-        this.success = success;
-        return this;
-    }
-
-    public static class Success
-    {
-        private Display data;
-
-        public Display getData()
-        {
-            return data;
-        }
-
-        public void setData(Display data)
-        {
-            this.data = data;
-        }
-
-        public Success withData(Display data)
-        {
-            this.data = data;
-            return this;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Endpoints.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Endpoints.java
deleted file mode 100644 (file)
index 827feb4..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Endpoints
-{
-    private String appsActionUrl;
-    private String appsGetUrl;
-    private String appsListUrl;
-    private String appsSwitchNextUrl;
-    private String appsSwitchPrevUrl;
-    private String appsSwitchUrl;
-    private String audioUrl;
-    private String bluetoothUrl;
-    private String concreteNotificationUrl;
-    private String currentNotificationUrl;
-    private String deviceUrl;
-    private String displayUrl;
-    private String notificationsUrl;
-    private String widgetUpdateUrl;
-    private String wifiUrl;
-
-    public String getAppsActionUrl()
-    {
-        return appsActionUrl;
-    }
-
-    public void setAppsActionUrl(String appsActionUrl)
-    {
-        this.appsActionUrl = appsActionUrl;
-    }
-
-    public Endpoints withAppsActionUrl(String appsActionUrl)
-    {
-        this.appsActionUrl = appsActionUrl;
-        return this;
-    }
-
-    public String getAppsGetUrl()
-    {
-        return appsGetUrl;
-    }
-
-    public void setAppsGetUrl(String appsGetUrl)
-    {
-        this.appsGetUrl = appsGetUrl;
-    }
-
-    public Endpoints withAppsGetUrl(String appsGetUrl)
-    {
-        this.appsGetUrl = appsGetUrl;
-        return this;
-    }
-
-    public String getAppsListUrl()
-    {
-        return appsListUrl;
-    }
-
-    public void setAppsListUrl(String appsListUrl)
-    {
-        this.appsListUrl = appsListUrl;
-    }
-
-    public Endpoints withAppsListUrl(String appsListUrl)
-    {
-        this.appsListUrl = appsListUrl;
-        return this;
-    }
-
-    public String getAppsSwitchNextUrl()
-    {
-        return appsSwitchNextUrl;
-    }
-
-    public void setAppsSwitchNextUrl(String appsSwitchNextUrl)
-    {
-        this.appsSwitchNextUrl = appsSwitchNextUrl;
-    }
-
-    public Endpoints withAppsSwitchNextUrl(String appsSwitchNextUrl)
-    {
-        this.appsSwitchNextUrl = appsSwitchNextUrl;
-        return this;
-    }
-
-    public String getAppsSwitchPrevUrl()
-    {
-        return appsSwitchPrevUrl;
-    }
-
-    public void setAppsSwitchPrevUrl(String appsSwitchPrevUrl)
-    {
-        this.appsSwitchPrevUrl = appsSwitchPrevUrl;
-    }
-
-    public Endpoints withAppsSwitchPrevUrl(String appsSwitchPrevUrl)
-    {
-        this.appsSwitchPrevUrl = appsSwitchPrevUrl;
-        return this;
-    }
-
-    public String getAppsSwitchUrl()
-    {
-        return appsSwitchUrl;
-    }
-
-    public void setAppsSwitchUrl(String appsSwitchUrl)
-    {
-        this.appsSwitchUrl = appsSwitchUrl;
-    }
-
-    public Endpoints withAppsSwitchUrl(String appsSwitchUrl)
-    {
-        this.appsSwitchUrl = appsSwitchUrl;
-        return this;
-    }
-
-    public String getAudioUrl()
-    {
-        return audioUrl;
-    }
-
-    public void setAudioUrl(String audioUrl)
-    {
-        this.audioUrl = audioUrl;
-    }
-
-    public Endpoints withAudioUrl(String audioUrl)
-    {
-        this.audioUrl = audioUrl;
-        return this;
-    }
-
-    public String getBluetoothUrl()
-    {
-        return bluetoothUrl;
-    }
-
-    public void setBluetoothUrl(String bluetoothUrl)
-    {
-        this.bluetoothUrl = bluetoothUrl;
-    }
-
-    public Endpoints withBluetoothUrl(String bluetoothUrl)
-    {
-        this.bluetoothUrl = bluetoothUrl;
-        return this;
-    }
-
-    public String getConcreteNotificationUrl()
-    {
-        return concreteNotificationUrl;
-    }
-
-    public void setConcreteNotificationUrl(String concreteNotificationUrl)
-    {
-        this.concreteNotificationUrl = concreteNotificationUrl;
-    }
-
-    public Endpoints withConcreteNotificationUrl(String concreteNotificationUrl)
-    {
-        this.concreteNotificationUrl = concreteNotificationUrl;
-        return this;
-    }
-
-    public String getCurrentNotificationUrl()
-    {
-        return currentNotificationUrl;
-    }
-
-    public void setCurrentNotificationUrl(String currentNotificationUrl)
-    {
-        this.currentNotificationUrl = currentNotificationUrl;
-    }
-
-    public Endpoints withCurrentNotificationUrl(String currentNotificationUrl)
-    {
-        this.currentNotificationUrl = currentNotificationUrl;
-        return this;
-    }
-
-    public String getDeviceUrl()
-    {
-        return deviceUrl;
-    }
-
-    public void setDeviceUrl(String deviceUrl)
-    {
-        this.deviceUrl = deviceUrl;
-    }
-
-    public Endpoints withDeviceUrl(String deviceUrl)
-    {
-        this.deviceUrl = deviceUrl;
-        return this;
-    }
-
-    public String getDisplayUrl()
-    {
-        return displayUrl;
-    }
-
-    public void setDisplayUrl(String displayUrl)
-    {
-        this.displayUrl = displayUrl;
-    }
-
-    public Endpoints withDisplayUrl(String displayUrl)
-    {
-        this.displayUrl = displayUrl;
-        return this;
-    }
-
-    public String getNotificationsUrl()
-    {
-        return notificationsUrl;
-    }
-
-    public void setNotificationsUrl(String notificationsUrl)
-    {
-        this.notificationsUrl = notificationsUrl;
-    }
-
-    public Endpoints withNotificationsUrl(String notificationsUrl)
-    {
-        this.notificationsUrl = notificationsUrl;
-        return this;
-    }
-
-    public String getWidgetUpdateUrl()
-    {
-        return widgetUpdateUrl;
-    }
-
-    public void setWidgetUpdateUrl(String widgetUpdateUrl)
-    {
-        this.widgetUpdateUrl = widgetUpdateUrl;
-    }
-
-    public Endpoints withWidgetUpdateUrl(String widgetUpdateUrl)
-    {
-        this.widgetUpdateUrl = widgetUpdateUrl;
-        return this;
-    }
-
-    public String getWifiUrl()
-    {
-        return wifiUrl;
-    }
-
-    public void setWifiUrl(String wifiUrl)
-    {
-        this.wifiUrl = wifiUrl;
-    }
-
-    public Endpoints withWifiUrl(String wifiUrl)
-    {
-        this.wifiUrl = wifiUrl;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Endpoints [appsActionUrl=");
-        builder.append(appsActionUrl);
-        builder.append(", appsGetUrl=");
-        builder.append(appsGetUrl);
-        builder.append(", appsListUrl=");
-        builder.append(appsListUrl);
-        builder.append(", appsSwitchNextUrl=");
-        builder.append(appsSwitchNextUrl);
-        builder.append(", appsSwitchPrevUrl=");
-        builder.append(appsSwitchPrevUrl);
-        builder.append(", appsSwitchUrl=");
-        builder.append(appsSwitchUrl);
-        builder.append(", audioUrl=");
-        builder.append(audioUrl);
-        builder.append(", bluetoothUrl=");
-        builder.append(bluetoothUrl);
-        builder.append(", concreteNotificationUrl=");
-        builder.append(concreteNotificationUrl);
-        builder.append(", currentNotificationUrl=");
-        builder.append(currentNotificationUrl);
-        builder.append(", deviceUrl=");
-        builder.append(deviceUrl);
-        builder.append(", displayUrl=");
-        builder.append(displayUrl);
-        builder.append(", notificationsUrl=");
-        builder.append(notificationsUrl);
-        builder.append(", widgetUpdateUrl=");
-        builder.append(widgetUpdateUrl);
-        builder.append(", wifiUrl=");
-        builder.append(wifiUrl);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Error.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Error.java
deleted file mode 100644 (file)
index d37b7b5..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Error
-{
-    private String message;
-
-    public String getMessage()
-    {
-        return message;
-    }
-
-    public void setMessage(String message)
-    {
-        this.message = message;
-    }
-
-    public Error withMessage(String message)
-    {
-        this.message = message;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Error [message=");
-        builder.append(message);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Failure.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Failure.java
deleted file mode 100644 (file)
index 32b5b3d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Failure
-{
-    private List<Error> errors = new ArrayList<Error>();
-
-    public List<Error> getErrors()
-    {
-        return errors;
-    }
-
-    public void setErrors(List<Error> errors)
-    {
-        this.errors = errors;
-    }
-
-    public Failure withErrors(List<Error> errors)
-    {
-        this.errors = errors;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Failure [errors=");
-        builder.append(errors);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Frame.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Frame.java
deleted file mode 100644 (file)
index 4e49083..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-public class Frame
-{
-    private String icon;
-    private String text;
-    @SerializedName("goalData")
-    private GoalData goalData;
-    @SerializedName("chartData")
-    private List<Integer> chartData;
-    private Integer index;
-
-    public String getIcon()
-    {
-        return icon;
-    }
-
-    public void setIcon(String icon)
-    {
-        this.icon = icon;
-    }
-
-    public Frame withIcon(String icon)
-    {
-        this.icon = icon;
-        return this;
-    }
-
-    public String getText()
-    {
-        return text;
-    }
-
-    public void setText(String text)
-    {
-        this.text = text;
-    }
-
-    public Frame withText(String text)
-    {
-        this.text = text;
-        return this;
-    }
-
-    public GoalData getGoalData()
-    {
-        return goalData;
-    }
-
-    public void setGoalData(GoalData goalData)
-    {
-        this.goalData = goalData;
-    }
-
-    public Frame withGoalData(GoalData goalData)
-    {
-        this.goalData = goalData;
-        return this;
-    }
-
-    public List<Integer> getChartData()
-    {
-        return chartData;
-    }
-
-    public void setChartData(List<Integer> chartData)
-    {
-        this.chartData = chartData;
-    }
-
-    public Frame withChartData(List<Integer> chartData)
-    {
-        this.chartData = chartData;
-        return this;
-    }
-
-    public Integer getIndex()
-    {
-        return index;
-    }
-
-    public void setIndex(Integer index)
-    {
-        this.index = index;
-    }
-
-    public Frame withIndex(Integer index)
-    {
-        this.index = index;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Frame [icon=");
-        builder.append(icon);
-        builder.append(", text=");
-        builder.append(text);
-        builder.append(", goalData=");
-        builder.append(goalData);
-        builder.append(", chartData=");
-        builder.append(chartData);
-        builder.append(", index=");
-        builder.append(index);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/GoalData.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/GoalData.java
deleted file mode 100644 (file)
index 6a9d04b..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class GoalData
-{
-    private Integer start;
-    private Integer current;
-    private Integer end;
-    private String unit;
-
-    public Integer getStart()
-    {
-        return start;
-    }
-
-    public void setStart(Integer start)
-    {
-        this.start = start;
-    }
-
-    public GoalData withStart(Integer start)
-    {
-        this.start = start;
-        return this;
-    }
-
-    public Integer getCurrent()
-    {
-        return current;
-    }
-
-    public void setCurrent(Integer current)
-    {
-        this.current = current;
-    }
-
-    public GoalData withCurrent(Integer current)
-    {
-        this.current = current;
-        return this;
-    }
-
-    public Integer getEnd()
-    {
-        return end;
-    }
-
-    public void setEnd(Integer end)
-    {
-        this.end = end;
-    }
-
-    public GoalData withEnd(Integer end)
-    {
-        this.end = end;
-        return this;
-    }
-
-    public String getUnit()
-    {
-        return unit;
-    }
-
-    public void setUnit(String unit)
-    {
-        this.unit = unit;
-    }
-
-    public GoalData withUnit(String unit)
-    {
-        this.unit = unit;
-        return this;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((current == null) ? 0 : current.hashCode());
-        result = prime * result + ((end == null) ? 0 : end.hashCode());
-        result = prime * result + ((start == null) ? 0 : start.hashCode());
-        result = prime * result + ((unit == null) ? 0 : unit.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj)
-    {
-        if (this == obj)
-        {
-            return true;
-        }
-        if (obj == null)
-        {
-            return false;
-        }
-        if (getClass() != obj.getClass())
-        {
-            return false;
-        }
-        GoalData other = (GoalData)obj;
-        if (current == null)
-        {
-            if (other.current != null)
-            {
-                return false;
-            }
-        }
-        else if (!current.equals(other.current))
-        {
-            return false;
-        }
-        if (end == null)
-        {
-            if (other.end != null)
-            {
-                return false;
-            }
-        }
-        else if (!end.equals(other.end))
-        {
-            return false;
-        }
-        if (start == null)
-        {
-            if (other.start != null)
-            {
-                return false;
-            }
-        }
-        else if (!start.equals(other.start))
-        {
-            return false;
-        }
-        if (unit == null)
-        {
-            if (other.unit != null)
-            {
-                return false;
-            }
-        }
-        else if (!unit.equals(other.unit))
-        {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("GoalData [start=");
-        builder.append(start);
-        builder.append(", current=");
-        builder.append(current);
-        builder.append(", end=");
-        builder.append(end);
-        builder.append(", unit=");
-        builder.append(unit);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/IntegerParameter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/IntegerParameter.java
deleted file mode 100644 (file)
index 6f35182..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class IntegerParameter extends Parameter
-{
-    private Integer value;
-
-    @Override
-    public IntegerParameter withName(String name)
-    {
-        super.withName(name);
-        return this;
-    }
-
-    @Override
-    public IntegerParameter withRequired(Boolean required)
-    {
-        super.withRequired(required);
-        return this;
-    }
-
-    public Integer getValue()
-    {
-        return value;
-    }
-
-    public void setValue(Integer value)
-    {
-        this.value = value;
-    }
-
-    public IntegerParameter withValue(Integer value)
-    {
-        setValue(value);
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("IntegerParameter [value=");
-        builder.append(value);
-        builder.append(", getName()=");
-        builder.append(getName());
-        builder.append(", getRequired()=");
-        builder.append(getRequired());
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Modes.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Modes.java
deleted file mode 100644 (file)
index eb73595..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Modes
-{
-    private TimeBased timeBased;
-    private WhenDark whenDark;
-
-    public TimeBased getTimeBased()
-    {
-        return timeBased;
-    }
-
-    public void setTimeBased(TimeBased timeBased)
-    {
-        this.timeBased = timeBased;
-    }
-
-    public Modes withTimeBased(TimeBased timeBased)
-    {
-        this.timeBased = timeBased;
-        return this;
-    }
-
-    public WhenDark getWhenDark()
-    {
-        return whenDark;
-    }
-
-    public void setWhenDark(WhenDark whenDark)
-    {
-        this.whenDark = whenDark;
-    }
-
-    public Modes withWhenDark(WhenDark whenDark)
-    {
-        this.whenDark = whenDark;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Modes [timeBased=");
-        builder.append(timeBased);
-        builder.append(", whenDark=");
-        builder.append(whenDark);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Notification.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Notification.java
deleted file mode 100644 (file)
index f0a57e0..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import java.time.LocalDateTime;
-
-public class Notification
-{
-    private String id;
-    private String type;
-    private LocalDateTime created;
-    private LocalDateTime expirationDate;
-    private String priority;
-    private String iconType;
-    private Integer lifetime;
-    private NotificationModel model;
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId(String id)
-    {
-        this.id = id;
-    }
-
-    public Notification withId(String id)
-    {
-        this.id = id;
-        return this;
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-
-    public void setType(String type)
-    {
-        this.type = type;
-    }
-
-    public Notification withType(String type)
-    {
-        this.type = type;
-        return this;
-    }
-
-    public LocalDateTime getCreated()
-    {
-        return created;
-    }
-
-    public void setCreated(LocalDateTime created)
-    {
-        this.created = created;
-    }
-
-    public Notification withCreated(LocalDateTime created)
-    {
-        this.created = created;
-        return this;
-    }
-
-    public LocalDateTime getExpirationDate()
-    {
-        return expirationDate;
-    }
-
-    public void setExpirationDate(LocalDateTime expirationDate)
-    {
-        this.expirationDate = expirationDate;
-    }
-
-    public Notification withExpirationDate(LocalDateTime expirationDate)
-    {
-        this.expirationDate = expirationDate;
-        return this;
-    }
-
-    public String getPriority()
-    {
-        return priority;
-    }
-
-    public void setPriority(String priority)
-    {
-        this.priority = priority;
-    }
-
-    public Notification withPriority(String priority)
-    {
-        this.priority = priority;
-        return this;
-    }
-
-    public String getIconType()
-    {
-        return iconType;
-    }
-
-    public void setIconType(String iconType)
-    {
-        this.iconType = iconType;
-    }
-
-    public Notification withIconType(String iconType)
-    {
-        this.iconType = iconType;
-        return this;
-    }
-
-    public Integer getLifetime()
-    {
-        return lifetime;
-    }
-
-    public void setLifetime(Integer lifetime)
-    {
-        this.lifetime = lifetime;
-    }
-
-    public Notification withLifetime(Integer lifetime)
-    {
-        this.lifetime = lifetime;
-        return this;
-    }
-
-    public NotificationModel getModel()
-    {
-        return model;
-    }
-
-    public void setModel(NotificationModel model)
-    {
-        this.model = model;
-    }
-
-    public Notification withModel(NotificationModel model)
-    {
-        this.model = model;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Notification [id=");
-        builder.append(id);
-        builder.append(", type=");
-        builder.append(type);
-        builder.append(", created=");
-        builder.append(created);
-        builder.append(", expirationDate=");
-        builder.append(expirationDate);
-        builder.append(", priority=");
-        builder.append(priority);
-        builder.append(", iconType=");
-        builder.append(iconType);
-        builder.append(", lifetime=");
-        builder.append(lifetime);
-        builder.append(", model=");
-        builder.append(model);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/NotificationModel.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/NotificationModel.java
deleted file mode 100644 (file)
index 48d5936..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import java.util.List;
-
-public class NotificationModel
-{
-    private Integer cycles;
-    private List<Frame> frames;
-    private Sound sound;
-
-    public Integer getCycles()
-    {
-        return cycles;
-    }
-
-    public void setCycles(Integer cycles)
-    {
-        this.cycles = cycles;
-    }
-
-    public NotificationModel withCycles(Integer cycles)
-    {
-        this.cycles = cycles;
-        return this;
-    }
-
-    public List<Frame> getFrames()
-    {
-        return frames;
-    }
-
-    public void setFrames(List<Frame> frames)
-    {
-        this.frames = frames;
-    }
-
-    public NotificationModel withFrames(List<Frame> frames)
-    {
-        this.frames = frames;
-        return this;
-    }
-
-    public Sound getSound()
-    {
-        return sound;
-    }
-
-    public void setSound(Sound sound)
-    {
-        this.sound = sound;
-    }
-
-    public NotificationModel withSound(Sound sound)
-    {
-        this.sound = sound;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("NotificationModel [cycles=");
-        builder.append(cycles);
-        builder.append(", frames=");
-        builder.append(frames);
-        builder.append(", sound=");
-        builder.append(sound);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/NotificationResult.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/NotificationResult.java
deleted file mode 100644 (file)
index 6e1ecc6..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class NotificationResult
-{
-    private Success success;
-
-    public Success getSuccess()
-    {
-        return success;
-    }
-
-    public void setSuccess(Success success)
-    {
-        this.success = success;
-    }
-
-    public NotificationResult withSuccess(Success success)
-    {
-        this.success = success;
-        return this;
-    }
-
-    public static class Success
-    {
-        private String id;
-
-        public String getId()
-        {
-            return id;
-        }
-
-        public void setId(String id)
-        {
-            this.id = id;
-        }
-
-        public Success withId(String id)
-        {
-            this.id = id;
-            return this;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Parameter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Parameter.java
deleted file mode 100644 (file)
index 38afe7f..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public abstract class Parameter
-{
-    private String name;
-    private Boolean required;
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName(String name)
-    {
-        this.name = name;
-    }
-
-    public Parameter withName(String name)
-    {
-        setName(name);
-        return this;
-    }
-
-    public Boolean getRequired()
-    {
-        return required;
-    }
-
-    public void setRequired(Boolean required)
-    {
-        this.required = required;
-    }
-
-    public Parameter withRequired(Boolean required)
-    {
-        setRequired(required);
-        return this;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Screensaver.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Screensaver.java
deleted file mode 100644 (file)
index 923cb22..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Screensaver
-{
-    private Boolean enabled;
-    private Modes modes;
-    private String widget;
-
-    public Boolean isEnabled()
-    {
-        return enabled;
-    }
-
-    public void setEnabled(Boolean enabled)
-    {
-        this.enabled = enabled;
-    }
-
-    public Screensaver withEnabled(Boolean enabled)
-    {
-        this.enabled = enabled;
-        return this;
-    }
-
-    public Modes getModes()
-    {
-        return modes;
-    }
-
-    public void setModes(Modes modes)
-    {
-        this.modes = modes;
-    }
-
-    public Screensaver withModes(Modes modes)
-    {
-        this.modes = modes;
-        return this;
-    }
-
-    public String getWidget()
-    {
-        return widget;
-    }
-
-    public void setWidget(String widget)
-    {
-        this.widget = widget;
-    }
-
-    public Screensaver withWidget(String widget)
-    {
-        this.widget = widget;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Screensaver [enabled=");
-        builder.append(enabled);
-        builder.append(", modes=");
-        builder.append(modes);
-        builder.append(", widget=");
-        builder.append(widget);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Sound.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Sound.java
deleted file mode 100644 (file)
index e0fe634..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Sound
-{
-    private String category;
-    private String id;
-    private Integer repeat;
-
-    public String getCategory()
-    {
-        return category;
-    }
-
-    public void setCategory(String category)
-    {
-        this.category = category;
-    }
-
-    public Sound withCategory(String category)
-    {
-        this.category = category;
-        return this;
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId(String id)
-    {
-        this.id = id;
-    }
-
-    public Sound withId(String id)
-    {
-        this.id = id;
-        return this;
-    }
-
-    public Integer getRepeat()
-    {
-        return repeat;
-    }
-
-    public void setRepeat(Integer repeat)
-    {
-        this.repeat = repeat;
-    }
-
-    public Sound withRepeat(Integer repeat)
-    {
-        this.repeat = repeat;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Sound [category=");
-        builder.append(category);
-        builder.append(", id=");
-        builder.append(id);
-        builder.append(", repeat=");
-        builder.append(repeat);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/StringParameter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/StringParameter.java
deleted file mode 100644 (file)
index 5029149..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class StringParameter extends Parameter
-{
-    private String format;
-    private String value;
-
-    @Override
-    public StringParameter withName(String name)
-    {
-        super.withName(name);
-        return this;
-    }
-
-    @Override
-    public StringParameter withRequired(Boolean required)
-    {
-        super.withRequired(required);
-        return this;
-    }
-
-    public String getFormat()
-    {
-        return format;
-    }
-
-    public void setFormat(String format)
-    {
-        this.format = format;
-    }
-
-    public StringParameter withFormat(String format)
-    {
-        setFormat(format);
-        return this;
-    }
-
-    public String getValue()
-    {
-        return value;
-    }
-
-    public void setValue(String value)
-    {
-        this.value = value;
-    }
-
-    public StringParameter withValue(String value)
-    {
-        setValue(value);
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("StringParameter [format=");
-        builder.append(format);
-        builder.append(", value=");
-        builder.append(value);
-        builder.append(", getName()=");
-        builder.append(getName());
-        builder.append(", getRequired()=");
-        builder.append(getRequired());
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/TimeBased.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/TimeBased.java
deleted file mode 100644 (file)
index 59e8ca1..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class TimeBased
-{
-    private Boolean enabled;
-
-    public Boolean isEnabled()
-    {
-        return enabled;
-    }
-
-    public void setEnabled(Boolean enabled)
-    {
-        this.enabled = enabled;
-    }
-
-    public TimeBased withEnabled(Boolean enabled)
-    {
-        this.enabled = enabled;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("TimeBased [enabled=");
-        builder.append(enabled);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/UpdateAction.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/UpdateAction.java
deleted file mode 100644 (file)
index c7428a6..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import java.util.SortedMap;
-
-public class UpdateAction extends Action
-{
-    @Override
-    public UpdateAction withId(String id)
-    {
-        super.setId(id);
-        return this;
-    }
-
-    @Override
-    public UpdateAction withParameters(SortedMap<String, Parameter> parameters)
-    {
-        super.setParameters(parameters);
-        return this;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/WhenDark.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/WhenDark.java
deleted file mode 100644 (file)
index b3c87da..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class WhenDark
-{
-    private Boolean enabled;
-
-    public Boolean isEnabled()
-    {
-        return enabled;
-    }
-
-    public void setEnabled(Boolean enabled)
-    {
-        this.enabled = enabled;
-    }
-
-    public WhenDark withEnabled(Boolean enabled)
-    {
-        this.enabled = enabled;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("WhenDark [enabled=");
-        builder.append(enabled);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Widget.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Widget.java
deleted file mode 100644 (file)
index 41ae519..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import java.util.Map;
-
-import com.google.gson.JsonPrimitive;
-import com.google.gson.annotations.SerializedName;
-
-public class Widget
-{
-    private String id;
-    @SerializedName("package")
-    private String packageName;
-    private Integer index;
-    private Map<String, JsonPrimitive> settings;
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId(String id)
-    {
-        this.id = id;
-    }
-
-    public Widget withId(String id)
-    {
-        setId(id);
-        return this;
-    }
-
-    public String getPackageName()
-    {
-        return packageName;
-    }
-
-    public void setPackageName(String packageName)
-    {
-        this.packageName = packageName;
-    }
-
-    public Widget withPackageName(String packageName)
-    {
-        setPackageName(packageName);
-        return this;
-    }
-
-    public Integer getIndex()
-    {
-        return index;
-    }
-
-    public void setIndex(Integer index)
-    {
-        this.index = index;
-    }
-
-    public Widget withIndex(Integer index)
-    {
-        setIndex(index);
-        return this;
-    }
-
-    public Map<String, JsonPrimitive> getSettings()
-    {
-        return settings;
-    }
-
-    public void setSettings(Map<String, JsonPrimitive> settings)
-    {
-        this.settings = settings;
-    }
-
-    public Widget withSettings(Map<String, JsonPrimitive> settings)
-    {
-        setSettings(settings);
-        return this;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((id == null) ? 0 : id.hashCode());
-        result = prime * result + ((index == null) ? 0 : index.hashCode());
-        result = prime * result + ((packageName == null) ? 0 : packageName.hashCode());
-        result = prime * result + ((settings == null) ? 0 : settings.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj)
-    {
-        if (this == obj)
-        {
-            return true;
-        }
-        if (obj == null)
-        {
-            return false;
-        }
-        if (getClass() != obj.getClass())
-        {
-            return false;
-        }
-        Widget other = (Widget)obj;
-        if (id == null)
-        {
-            if (other.id != null)
-            {
-                return false;
-            }
-        }
-        else if (!id.equals(other.id))
-        {
-            return false;
-        }
-        if (index == null)
-        {
-            if (other.index != null)
-            {
-                return false;
-            }
-        }
-        else if (!index.equals(other.index))
-        {
-            return false;
-        }
-        if (packageName == null)
-        {
-            if (other.packageName != null)
-            {
-                return false;
-            }
-        }
-        else if (!packageName.equals(other.packageName))
-        {
-            return false;
-        }
-        if (settings == null)
-        {
-            if (other.settings != null)
-            {
-                return false;
-            }
-        }
-        else if (!settings.equals(other.settings))
-        {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Widget [id=");
-        builder.append(id);
-        builder.append(", packageName=");
-        builder.append(packageName);
-        builder.append(", index=");
-        builder.append(index);
-        builder.append(", settings=");
-        builder.append(settings);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/WidgetUpdates.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/WidgetUpdates.java
deleted file mode 100644 (file)
index a3c9fd1..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import java.util.List;
-
-public class WidgetUpdates
-{
-    private List<Frame> frames;
-
-    public List<Frame> getFrames()
-    {
-        return frames;
-    }
-
-    public void setFrames(List<Frame> frames)
-    {
-        this.frames = frames;
-    }
-
-    public WidgetUpdates withFrames(List<Frame> frames)
-    {
-        this.frames = frames;
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("WidgetUpdates [frames=");
-        builder.append(frames);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Wifi.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/local/model/Wifi.java
deleted file mode 100644 (file)
index 542f603..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-public class Wifi
-{
-    private Boolean active;
-
-    /*
-     * API sometimes calls this field 'mac' and other times calls it 'address'.
-     * Additionally, Gson uses fields only (not methods). Therefore, if use the
-     * same instance of this class to read one value and then try to write the
-     * other without calling the setter, it won't work (the other value will be
-     * null).
-     */
-    private String mac;
-    private String address;
-
-    private Boolean available;
-    private String encryption;
-
-    /*
-     * API sometimes calls this field 'ssid' and other times calls it 'essid'.
-     * Additionally, Gson uses fields only (not methods). Therefore, if use the
-     * same instance of this class to read one value and then try to write the
-     * other without calling the setter, it won't work (the other value will be
-     * null).
-     */
-    private String ssid;
-    private String essid;
-
-    /*
-     * API sometimes calls this field 'ip' and other times calls it 'ipv4'.
-     * Additionally, Gson uses fields only (not methods). Therefore, if use the
-     * same instance of this class to read one value and then try to write the
-     * other without calling the setter, it won't work (the other value will be
-     * null).
-     */
-    private String ip;
-    private String ipv4;
-
-    private String mode;
-    private String netmask;
-
-    /*
-     * API sometimes calls this field 'signal_strength' and other times calls it
-     * 'strength'. Additionally, Gson uses fields only (not methods). Therefore,
-     * if use the same instance of this class to read one value and then try to
-     * write the other without calling the setter, it won't work (the other
-     * value will be null).
-     */
-    private Integer signalStrength;
-    private Integer strength;
-
-    public Boolean isActive()
-    {
-        return active;
-    }
-
-    public void setActive(Boolean active)
-    {
-        this.active = active;
-    }
-
-    public Wifi withActive(Boolean active)
-    {
-        this.active = active;
-        return this;
-    }
-
-    public String getMac()
-    {
-        return mac == null ? address : mac;
-    }
-
-    public void setMac(String mac)
-    {
-        this.mac = mac;
-        this.address = mac;
-    }
-
-    public Wifi withMac(String mac)
-    {
-        setMac(mac);
-        return this;
-    }
-
-    public Boolean isAvailable()
-    {
-        return available;
-    }
-
-    public void setAvailable(Boolean available)
-    {
-        this.available = available;
-    }
-
-    public Wifi withAvailable(Boolean available)
-    {
-        this.available = available;
-        return this;
-    }
-
-    public String getEncryption()
-    {
-        return encryption;
-    }
-
-    public void setEncryption(String encryption)
-    {
-        this.encryption = encryption;
-    }
-
-    public Wifi withEncryption(String encryption)
-    {
-        this.encryption = encryption;
-        return this;
-    }
-
-    public String getSsid()
-    {
-        return ssid == null ? essid : ssid;
-    }
-
-    public void setSsid(String ssid)
-    {
-        this.ssid = ssid;
-        this.essid = ssid;
-    }
-
-    public Wifi withSsid(String ssid)
-    {
-        setSsid(ssid);
-        return this;
-    }
-
-    public String getIp()
-    {
-        return ip == null ? ipv4 : ip;
-    }
-
-    public void setIp(String ip)
-    {
-        this.ip = ip;
-        this.ipv4 = ip;
-    }
-
-    public Wifi withIp(String ip)
-    {
-        setIp(ip);
-        return this;
-    }
-
-    public String getMode()
-    {
-        return mode;
-    }
-
-    public void setMode(String mode)
-    {
-        this.mode = mode;
-    }
-
-    public Wifi withMode(String mode)
-    {
-        this.mode = mode;
-        return this;
-    }
-
-    public String getNetmask()
-    {
-        return netmask;
-    }
-
-    public void setNetmask(String netmask)
-    {
-        this.netmask = netmask;
-    }
-
-    public Wifi withNetmask(String netmask)
-    {
-        this.netmask = netmask;
-        return this;
-    }
-
-    public Integer getSignalStrength()
-    {
-        return signalStrength == null ? strength : signalStrength;
-    }
-
-    public void setSignalStrength(Integer signalStrength)
-    {
-        this.signalStrength = signalStrength;
-        this.strength = signalStrength;
-    }
-
-    public Wifi withSignalStrength(Integer signalStrength)
-    {
-        setSignalStrength(signalStrength);
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Wifi [active=");
-        builder.append(active);
-        builder.append(", mac=");
-        builder.append(getMac());
-        builder.append(", available=");
-        builder.append(available);
-        builder.append(", encryption=");
-        builder.append(encryption);
-        builder.append(", ssid=");
-        builder.append(getSsid());
-        builder.append(", ip=");
-        builder.append(getIp());
-        builder.append(", mode=");
-        builder.append(mode);
-        builder.append(", netmask=");
-        builder.append(netmask);
-        builder.append(", signalStrength=");
-        builder.append(getSignalStrength());
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/ApiValue.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/ApiValue.java
deleted file mode 100644 (file)
index 30df553..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-public interface ApiValue
-{
-    public String toRaw();
-
-    public static String raw(ApiValue value)
-    {
-        if (value == null)
-        {
-            return null;
-        }
-
-        return value.toRaw();
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/ClockApp.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/ClockApp.java
deleted file mode 100644 (file)
index 2483e00..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.openhab.binding.lametrictime.api.local.model.BooleanParameter;
-import org.openhab.binding.lametrictime.api.local.model.Parameter;
-import org.openhab.binding.lametrictime.api.local.model.StringParameter;
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-
-public class ClockApp extends CoreApplication
-{
-    private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
-
-    private static final String NAME = "com.lametric.clock";
-
-    private static final String ACTION_ALARM = "clock.alarm";
-
-    private static final String PARAMETER_ENABLED = "enabled";
-    private static final String PARAMETER_TIME = "time";
-    private static final String PARAMETER_WAKE_WITH_RADIO = "wake_with_radio";
-
-    public ClockApp()
-    {
-        super(NAME);
-    }
-
-    public CoreAction setAlarm(Boolean enabled, LocalTime time, Boolean wakeWithRadio)
-    {
-        SortedMap<String, Parameter> parameters = new TreeMap<>();
-
-        if (enabled != null)
-        {
-            parameters.put(PARAMETER_ENABLED, new BooleanParameter().withValue(enabled));
-        }
-
-        if (time != null)
-        {
-            parameters.put(PARAMETER_TIME,
-                           new StringParameter().withValue(time.format(TIME_FORMATTER)));
-        }
-
-        if (wakeWithRadio != null)
-        {
-            parameters.put(PARAMETER_WAKE_WITH_RADIO,
-                           new BooleanParameter().withValue(wakeWithRadio));
-        }
-
-        return new CoreAction(this,
-                              new UpdateAction().withId(ACTION_ALARM).withParameters(parameters));
-    }
-
-    public CoreAction stopAlarm()
-    {
-        SortedMap<String, Parameter> parameters = new TreeMap<>();
-        parameters.put(PARAMETER_ENABLED, new BooleanParameter().withValue(false));
-
-        return new CoreAction(this,
-                              new UpdateAction().withId(ACTION_ALARM).withParameters(parameters));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CoreAction.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CoreAction.java
deleted file mode 100644 (file)
index d183cad..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-
-public class CoreAction
-{
-    private final CoreApplication app;
-    private final UpdateAction action;
-
-    protected CoreAction(CoreApplication app, UpdateAction action)
-    {
-        this.app = app;
-        this.action = action;
-    }
-
-    public CoreApplication getApp()
-    {
-        return app;
-    }
-
-    public UpdateAction getAction()
-    {
-        return action;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CoreApplication.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CoreApplication.java
deleted file mode 100644 (file)
index c01f809..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-public abstract class CoreApplication
-{
-    private final String packageName;
-
-    public CoreApplication(String packageName)
-    {
-        this.packageName = packageName;
-    }
-
-    public String getPackageName()
-    {
-        return packageName;
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CoreApps.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CoreApps.java
deleted file mode 100644 (file)
index 1f38542..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-public class CoreApps
-{
-    private static final ClockApp CLOCK = new ClockApp();
-    private static final CountdownApp COUNTDOWN = new CountdownApp();
-    private static final RadioApp RADIO = new RadioApp();
-    private static final StopwatchApp STOPWATCH = new StopwatchApp();
-    private static final WeatherApp WEATHER = new WeatherApp();
-
-    public static ClockApp clock()
-    {
-        return CLOCK;
-    }
-
-    public static CountdownApp countdown()
-    {
-        return COUNTDOWN;
-    }
-
-    public static RadioApp radio()
-    {
-        return RADIO;
-    }
-
-    public static StopwatchApp stopwatch()
-    {
-        return STOPWATCH;
-    }
-
-    public static WeatherApp weather()
-    {
-        return WEATHER;
-    }
-
-    // @formatter:off
-    private CoreApps() {}
-    // @formatter:on
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CountdownApp.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/CountdownApp.java
deleted file mode 100644 (file)
index 972df76..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.openhab.binding.lametrictime.api.local.model.BooleanParameter;
-import org.openhab.binding.lametrictime.api.local.model.IntegerParameter;
-import org.openhab.binding.lametrictime.api.local.model.Parameter;
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-
-public class CountdownApp extends CoreApplication
-{
-    private static final String NAME = "com.lametric.countdown";
-
-    private static final String ACTION_CONFIGURE = "countdown.configure";
-    private static final String ACTION_PAUSE = "countdown.pause";
-    private static final String ACTION_RESET = "countdown.reset";
-    private static final String ACTION_START = "countdown.start";
-
-    private static final String PARAMETER_DURATION = "duration";
-    private static final String PARAMETER_START_NOW = "start_now";
-
-    public CountdownApp()
-    {
-        super(NAME);
-    }
-
-    public CoreAction configure(int duration, boolean startNow)
-    {
-        SortedMap<String, Parameter> parameters = new TreeMap<>();
-        parameters.put(PARAMETER_DURATION, new IntegerParameter().withValue(duration));
-        parameters.put(PARAMETER_START_NOW, new BooleanParameter().withValue(startNow));
-
-        return new CoreAction(this,
-                              new UpdateAction().withId(ACTION_CONFIGURE)
-                                                .withParameters(parameters));
-    }
-
-    public CoreAction pause()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_PAUSE));
-    }
-
-    public CoreAction reset()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_RESET));
-    }
-
-    public CoreAction start()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_START));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/Icon.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/Icon.java
deleted file mode 100644 (file)
index c25f3f3..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-public interface Icon extends ApiValue
-{
-    // marker interface
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/Icons.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/Icons.java
deleted file mode 100644 (file)
index df09f78..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-import java.io.File;
-import java.net.URI;
-import java.nio.file.Path;
-
-import org.openhab.binding.lametrictime.api.impl.DataIcon;
-import org.openhab.binding.lametrictime.api.impl.FileIcon;
-import org.openhab.binding.lametrictime.api.impl.HTTPIcon;
-import org.openhab.binding.lametrictime.api.impl.KeyIcon;
-
-public class Icons
-{
-    public static Icon key(String key)
-    {
-        return new KeyIcon(key);
-    }
-
-    public static Icon http(String uri)
-    {
-        return http(URI.create(uri));
-    }
-
-    public static Icon http(URI uri)
-    {
-        return new HTTPIcon(uri);
-    }
-
-    public static Icon path(Path path)
-    {
-        return new FileIcon(path);
-    }
-
-    public static Icon file(File file)
-    {
-        return new FileIcon(file);
-    }
-
-    public static Icon data(String mimeType, byte[] data)
-    {
-        return new DataIcon(mimeType, data);
-    }
-
-    // @formatter:off
-    public static Icon dollar() { return key("i34"); }
-    public static Icon gmail() { return key("i43"); }
-    public static Icon confirm() { return key("i59"); }
-    public static Icon goOut() { return key("a68"); }
-    public static Icon dog() { return key("a76"); }
-    public static Icon clock() { return key("a82"); }
-    public static Icon smile() { return key("a87"); }
-    public static Icon lightning() { return key("i95"); }
-    public static Icon facebook() { return key("a128"); }
-    public static Icon home() { return key("i96"); }
-    public static Icon girl() { return key("a178"); }
-    public static Icon stop() { return key("i184"); }
-    public static Icon heart() { return key("a230"); }
-    public static Icon fade() { return key("a273"); }
-    public static Icon terminal() { return key("a315"); }
-    public static Icon usa() { return key("a413"); }
-    public static Icon switzerland() { return key("i469"); }
-    public static Icon attention() { return key("i555"); }
-    public static Icon theMatrix() { return key("a653"); }
-    public static Icon pizza() { return key("i1324"); }
-    public static Icon christmasTree() { return key("a1782"); }
-    public static Icon night() { return key("a2285"); }
-    public static Icon fireworks() { return key("a2867"); }
-    public static Icon beer() { return key("i3253"); }
-    public static Icon tetris() { return key("a3793"); }
-    public static Icon halloween() { return key("a4033"); }
-    public static Icon pacman() { return key("a4584"); }
-
-    private Icons() {}
-    // @formatter:on
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/RadioApp.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/RadioApp.java
deleted file mode 100644 (file)
index 41cac54..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-
-public class RadioApp extends CoreApplication
-{
-    private static final String NAME = "com.lametric.radio";
-
-    private static final String ACTION_NEXT = "radio.next";
-    private static final String ACTION_PLAY = "radio.play";
-    private static final String ACTION_PREV = "radio.prev";
-    private static final String ACTION_STOP = "radio.stop";
-
-    public RadioApp()
-    {
-        super(NAME);
-    }
-
-    public CoreAction next()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_NEXT));
-    }
-
-    public CoreAction play()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_PLAY));
-    }
-
-    public CoreAction previous()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_PREV));
-    }
-
-    public CoreAction stop()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_STOP));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/StopwatchApp.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/StopwatchApp.java
deleted file mode 100644 (file)
index 2af8f48..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-
-public class StopwatchApp extends CoreApplication
-{
-    private static final String NAME = "com.lametric.stopwatch";
-
-    private static final String ACTION_PAUSE = "stopwatch.pause";
-    private static final String ACTION_RESET = "stopwatch.reset";
-    private static final String ACTION_START = "stopwatch.start";
-
-    public StopwatchApp()
-    {
-        super(NAME);
-    }
-
-    public CoreAction pause()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_PAUSE));
-    }
-
-    public CoreAction reset()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_RESET));
-    }
-
-    public CoreAction start()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_START));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/WeatherApp.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/WeatherApp.java
deleted file mode 100644 (file)
index 8db4088..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model;
-
-import org.openhab.binding.lametrictime.api.local.model.UpdateAction;
-
-public class WeatherApp extends CoreApplication
-{
-    private static final String NAME = "com.lametric.weather";
-
-    private static final String ACTION_FORECAST = "weather.forecast";
-
-    public WeatherApp()
-    {
-        super(NAME);
-    }
-
-    public CoreAction forecast()
-    {
-        return new CoreAction(this, new UpdateAction().withId(ACTION_FORECAST));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/BrightnessMode.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/BrightnessMode.java
deleted file mode 100644 (file)
index be764da..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import org.openhab.binding.lametrictime.api.model.ApiValue;
-
-public enum BrightnessMode implements ApiValue
-{
-    AUTO,
-    MANUAL;
-
-    @Override
-    public String toRaw()
-    {
-        return name().toLowerCase();
-    }
-
-    public static BrightnessMode toEnum(String raw)
-    {
-        if (raw == null)
-        {
-            return null;
-        }
-
-        try
-        {
-            return valueOf(raw.toUpperCase());
-        }
-        catch (IllegalArgumentException e)
-        {
-            // not a valid raw string
-            return null;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/DisplayType.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/DisplayType.java
deleted file mode 100644 (file)
index ada22e4..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import org.openhab.binding.lametrictime.api.model.ApiValue;
-
-public enum DisplayType implements ApiValue
-{
-    MONOCHROME,
-    GRAYSCALE,
-    COLOR,
-    MIXED;
-
-    @Override
-    public String toRaw()
-    {
-        return name().toLowerCase();
-    }
-
-    public static DisplayType toEnum(String raw)
-    {
-        if (raw == null)
-        {
-            return null;
-        }
-
-        try
-        {
-            return valueOf(raw.toUpperCase());
-        }
-        catch (IllegalArgumentException e)
-        {
-            // not a valid raw string
-            return null;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/IconType.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/IconType.java
deleted file mode 100644 (file)
index 13f43ac..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import org.openhab.binding.lametrictime.api.model.ApiValue;
-
-public enum IconType implements ApiValue
-{
-    NONE,
-    INFO,
-    ALERT;
-
-    @Override
-    public String toRaw()
-    {
-        return name().toLowerCase();
-    }
-
-    public static IconType toEnum(String raw)
-    {
-        if (raw == null)
-        {
-            return null;
-        }
-
-        try
-        {
-            return valueOf(raw.toUpperCase());
-        }
-        catch (IllegalArgumentException e)
-        {
-            // not a valid raw string
-            return null;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/IpMode.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/IpMode.java
deleted file mode 100644 (file)
index bdc3630..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import org.openhab.binding.lametrictime.api.model.ApiValue;
-
-public enum IpMode implements ApiValue
-{
-    STATIC,
-    DHCP;
-
-    @Override
-    public String toRaw()
-    {
-        return name().toLowerCase();
-    }
-
-    public static IpMode toEnum(String raw)
-    {
-        if (raw == null)
-        {
-            return null;
-        }
-
-        try
-        {
-            return valueOf(raw.toUpperCase());
-        }
-        catch (IllegalArgumentException e)
-        {
-            // not a valid raw string
-            return null;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/Priority.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/Priority.java
deleted file mode 100644 (file)
index bb9cfeb..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import org.openhab.binding.lametrictime.api.model.ApiValue;
-
-public enum Priority implements ApiValue
-{
-    INFO,
-    WARNING,
-    CRITICAL;
-
-    @Override
-    public String toRaw()
-    {
-        return name().toLowerCase();
-    }
-
-    public static Priority toEnum(String raw)
-    {
-        if (raw == null)
-        {
-            return null;
-        }
-
-        try
-        {
-            return valueOf(raw.toUpperCase());
-        }
-        catch (IllegalArgumentException e)
-        {
-            // not a valid raw string
-            return null;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/Sound.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/Sound.java
deleted file mode 100644 (file)
index a9c3ea1..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import org.openhab.binding.lametrictime.api.model.ApiValue;
-
-public enum Sound implements ApiValue
-{
-    BICYCLE(SoundCategory.NOTIFICATIONS),
-    CAR(SoundCategory.NOTIFICATIONS),
-    CASH(SoundCategory.NOTIFICATIONS),
-    CAT(SoundCategory.NOTIFICATIONS),
-    DOG(SoundCategory.NOTIFICATIONS),
-    DOG2(SoundCategory.NOTIFICATIONS),
-    ENERGY(SoundCategory.NOTIFICATIONS),
-    KNOCK_KNOCK(SoundCategory.NOTIFICATIONS, "knock-knock"),
-    LETTER_EMAIL(SoundCategory.NOTIFICATIONS),
-    LOSE1(SoundCategory.NOTIFICATIONS),
-    LOSE2(SoundCategory.NOTIFICATIONS),
-    NEGATIVE1(SoundCategory.NOTIFICATIONS),
-    NEGATIVE2(SoundCategory.NOTIFICATIONS),
-    NEGATIVE3(SoundCategory.NOTIFICATIONS),
-    NEGATIVE4(SoundCategory.NOTIFICATIONS),
-    NEGATIVE5(SoundCategory.NOTIFICATIONS),
-    NOTIFICATION(SoundCategory.NOTIFICATIONS),
-    NOTIFICATION2(SoundCategory.NOTIFICATIONS),
-    NOTIFICATION3(SoundCategory.NOTIFICATIONS),
-    NOTIFICATION4(SoundCategory.NOTIFICATIONS),
-    OPEN_DOOR(SoundCategory.NOTIFICATIONS),
-    POSITIVE1(SoundCategory.NOTIFICATIONS),
-    POSITIVE2(SoundCategory.NOTIFICATIONS),
-    POSITIVE3(SoundCategory.NOTIFICATIONS),
-    POSITIVE4(SoundCategory.NOTIFICATIONS),
-    POSITIVE5(SoundCategory.NOTIFICATIONS),
-    POSITIVE6(SoundCategory.NOTIFICATIONS),
-    STATISTIC(SoundCategory.NOTIFICATIONS),
-    THUNDER(SoundCategory.NOTIFICATIONS),
-    WATER1(SoundCategory.NOTIFICATIONS),
-    WATER2(SoundCategory.NOTIFICATIONS),
-    WIN(SoundCategory.NOTIFICATIONS),
-    WIN2(SoundCategory.NOTIFICATIONS),
-    WIND(SoundCategory.NOTIFICATIONS),
-    WIND_SHORT(SoundCategory.NOTIFICATIONS),
-
-    ALARM1(SoundCategory.ALARMS),
-    ALARM2(SoundCategory.ALARMS),
-    ALARM3(SoundCategory.ALARMS),
-    ALARM4(SoundCategory.ALARMS),
-    ALARM5(SoundCategory.ALARMS),
-    ALARM6(SoundCategory.ALARMS),
-    ALARM7(SoundCategory.ALARMS),
-    ALARM8(SoundCategory.ALARMS),
-    ALARM9(SoundCategory.ALARMS),
-    ALARM10(SoundCategory.ALARMS),
-    ALARM11(SoundCategory.ALARMS),
-    ALARM12(SoundCategory.ALARMS),
-    ALARM13(SoundCategory.ALARMS);
-
-    private final SoundCategory category;
-    private final String rawValue;
-
-    private Sound(SoundCategory category)
-    {
-        this(category, null);
-    }
-
-    private Sound(SoundCategory category, String rawValue)
-    {
-        this.category = category;
-        this.rawValue = rawValue;
-    }
-
-    public SoundCategory getCategory()
-    {
-        return category;
-    }
-
-    @Override
-    public String toRaw()
-    {
-        return rawValue != null ? rawValue : name().toLowerCase();
-    }
-
-    public static Sound toEnum(String raw)
-    {
-        if (raw == null)
-        {
-            return null;
-        }
-
-        if (KNOCK_KNOCK.rawValue.equals(raw))
-        {
-            return KNOCK_KNOCK;
-        }
-
-        try
-        {
-            return valueOf(raw.toUpperCase());
-        }
-        catch (IllegalArgumentException e)
-        {
-            // not a valid raw string
-            return null;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/SoundCategory.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/SoundCategory.java
deleted file mode 100644 (file)
index d1684ed..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import org.openhab.binding.lametrictime.api.model.ApiValue;
-
-public enum SoundCategory implements ApiValue
-{
-    NOTIFICATIONS,
-    ALARMS;
-
-    @Override
-    public String toRaw()
-    {
-        return name().toLowerCase();
-    }
-
-    public static SoundCategory toEnum(String raw)
-    {
-        if (raw == null)
-        {
-            return null;
-        }
-
-        try
-        {
-            return valueOf(raw.toUpperCase());
-        }
-        catch (IllegalArgumentException e)
-        {
-            // not a valid raw string
-            return null;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/WifiEncryption.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/model/enums/WifiEncryption.java
deleted file mode 100644 (file)
index e28a676..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import org.openhab.binding.lametrictime.api.model.ApiValue;
-
-public enum WifiEncryption implements ApiValue
-{
-    OPEN,
-    WEP,
-    WPA,
-    WPA2;
-
-    @Override
-    public String toRaw()
-    {
-        return name();
-    }
-
-    public static WifiEncryption toEnum(String raw)
-    {
-        if (raw == null)
-        {
-            return null;
-        }
-
-        try
-        {
-            return valueOf(raw);
-        }
-        catch (IllegalArgumentException e)
-        {
-            // not a valid raw string
-            return null;
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/BasicAuthenticator.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/BasicAuthenticator.java
new file mode 100644 (file)
index 0000000..c5ec2b6
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").  You
+ * may not use this file except in compliance with the License.  You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt.  See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license."  If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above.  However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package org.openhab.binding.lametrictime.internal.api.authentication;
+
+import java.util.Base64;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.core.HttpHeaders;
+
+/**
+ * Implementation of Basic Http Authentication method (RFC 2617).
+ *
+ * @author Miroslav Fuksa
+ * @author Jakub Podlesak (jakub.podlesak at oracle.com)
+ * @author Craig McClanahan
+ */
+final class BasicAuthenticator {
+
+    private final HttpAuthenticationFilter.Credentials defaultCredentials;
+
+    /**
+     * Creates a new instance of basic authenticator.
+     *
+     * @param defaultCredentials Credentials. Can be {@code null} if no default credentials should be
+     *            used.
+     */
+    BasicAuthenticator(HttpAuthenticationFilter.Credentials defaultCredentials) {
+        this.defaultCredentials = defaultCredentials;
+    }
+
+    private String calculateAuthentication(HttpAuthenticationFilter.Credentials credentials) {
+        String username = credentials.getUsername();
+        byte[] password = credentials.getPassword();
+        if (username == null) {
+            username = "";
+        }
+
+        if (password == null) {
+            password = new byte[0];
+        }
+
+        final byte[] prefix = (username + ":").getBytes(HttpAuthenticationFilter.CHARACTER_SET);
+        final byte[] usernamePassword = new byte[prefix.length + password.length];
+
+        System.arraycopy(prefix, 0, usernamePassword, 0, prefix.length);
+        System.arraycopy(password, 0, usernamePassword, prefix.length, password.length);
+
+        return "Basic " + Base64.getEncoder().encodeToString(usernamePassword);
+    }
+
+    /**
+     * Adds authentication information to the request.
+     *
+     * @param request Request context.
+     * @throws RequestAuthenticationException in case that basic credentials missing or are in invalid format
+     */
+    public void filterRequest(ClientRequestContext request) throws RequestAuthenticationException {
+        HttpAuthenticationFilter.Credentials credentials = HttpAuthenticationFilter.getCredentials(request,
+                defaultCredentials, HttpAuthenticationFilter.Type.BASIC);
+        if (credentials == null) {
+            throw new RequestAuthenticationException("BasicAuth credentials are missing.");
+        }
+        request.getHeaders().add(HttpHeaders.AUTHORIZATION, calculateAuthentication(credentials));
+    }
+
+    /**
+     * Checks the response and if basic authentication is required then performs a new request
+     * with basic authentication.
+     *
+     * @param request Request context.
+     * @param response Response context (will be updated with newest response data if the request was repeated).
+     * @return {@code true} if response does not require authentication or if authentication is required,
+     *         new request was done with digest authentication information and authentication was successful.
+     * @throws ResponseAuthenticationException in case that basic credentials missing or are in invalid format
+     */
+    public boolean filterResponseAndAuthenticate(ClientRequestContext request, ClientResponseContext response) {
+        final String authenticate = response.getHeaders().getFirst(HttpHeaders.WWW_AUTHENTICATE);
+        if (authenticate != null && authenticate.trim().toUpperCase().startsWith("BASIC")) {
+            HttpAuthenticationFilter.Credentials credentials = HttpAuthenticationFilter.getCredentials(request,
+                    defaultCredentials, HttpAuthenticationFilter.Type.BASIC);
+
+            if (credentials == null) {
+                throw new ResponseAuthenticationException(null, "BasicAuth credentials are missing.");
+            }
+
+            return HttpAuthenticationFilter.repeatRequest(request, response, calculateAuthentication(credentials));
+        }
+        return false;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/HttpAuthenticationFeature.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/HttpAuthenticationFeature.java
new file mode 100644 (file)
index 0000000..bc40e81
--- /dev/null
@@ -0,0 +1,595 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").  You
+ * may not use this file except in compliance with the License.  You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt.  See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license."  If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above.  However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package org.openhab.binding.lametrictime.internal.api.authentication;
+
+import javax.ws.rs.core.Feature;
+import javax.ws.rs.core.FeatureContext;
+
+/**
+ * Features that provides Http Basic and Digest client authentication (based on RFC 2617).
+ * <p>
+ * The feature can work in following modes:
+ * <ul>
+ * <li><b>BASIC:</b> Basic preemptive authentication. In preemptive mode the authentication information
+ * is send always with each HTTP request. This mode is more usual than the following non-preemptive mode
+ * (if you require BASIC authentication you will probably use this preemptive mode). This mode must
+ * be combined with usage of SSL/TLS as the password is send only BASE64 encoded.</li>
+ * <li><i>BASIC NON-PREEMPTIVE:</i> Basic non-preemptive authentication. In non-preemptive mode the
+ * authentication information is added only when server refuses the request with {@code 401} status code and
+ * then the request is repeated with authentication information. This mode has negative impact on the performance.
+ * The advantage is that it does not send credentials when they are not needed. This mode must
+ * be combined with usage of SSL/TLS as the password is send only BASE64 encoded.
+ * </li>
+ * <li><b>DIGEST:</b> Http digest authentication. Does not require usage of SSL/TLS.</li>
+ * <li><b>UNIVERSAL:</b> Combination of basic and digest authentication. The feature works in non-preemptive
+ * mode which means that it sends requests without authentication information. If {@code 401} status
+ * code is returned, the request is repeated and an appropriate authentication is used based on the
+ * authentication requested in the response (defined in {@code WWW-Authenticate} HTTP header. The feature
+ * remembers which authentication requests were successful for given URI and next time tries to preemptively
+ * authenticate against this URI with latest successful authentication method.
+ * </li>
+ * </ul>
+ * </p>
+ * <p>
+ * To initialize the feature use static method of this feature.
+ * </p>
+ * <p>
+ * Example of building the feature in
+ * Basic authentication mode:
+ *
+ * <pre>
+ * HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("user", "superSecretPassword");
+ * </pre>
+ * </p>
+ * <p>
+ * Example of building the feature in basic non-preemptive mode:
+ *
+ * <pre>
+ * HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder().nonPreemptive()
+ *         .credentials("user", "superSecretPassword").build();
+ * </pre>
+ * </p>
+ * <p>
+ * Example of building the feature in universal mode:
+ *
+ * <pre>
+ * HttpAuthenticationFeature feature = HttpAuthenticationFeature.universal("user", "superSecretPassword");
+ * </pre>
+ * </p>
+ * <p>
+ * Example of building the feature in universal mode with different credentials for basic and digest:
+ *
+ * <pre>
+ * HttpAuthenticationFeature feature = HttpAuthenticationFeature.universalBuilder()
+ *         .credentialsForBasic("user", "123456").credentials("adminuser", "hello").build();
+ * </pre>
+ * </p>
+ * Example of building the feature in basic preemptive mode with no default credentials. Credentials will have
+ * to be supplied with each request using request properties (see below):
+ *
+ * <pre>
+ * HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder().build();
+ * </pre>
+ * </p>
+ * <p>
+ * Once the feature is built it needs to be registered into the {@link javax.ws.rs.client.Client},
+ * {@link javax.ws.rs.client.WebTarget} or other client configurable object. Example:
+ *
+ * <pre>
+ * final Client client = ClientBuilder.newClient();
+ * client.register(feature);
+ * </pre>
+ * </p>
+ *
+ * Then you invoke requests as usual and authentication will be handled by the feature.
+ * You can change the credentials for each request using properties
+ *
+ * <pre>
+ * final Response response = client.target("http://localhost:8080/rest/homer/contact").request()
+ *         .property(HTTP_AUTHENTICATION_BASIC_USERNAME, "homer")
+ *         .property(HTTP_AUTHENTICATION_BASIC_PASSWORD, "p1swd745").get();
+ * </pre>
+ * <p>
+ * This class also contains property key definitions for overriding only specific basic or digest credentials:
+ * </p>
+ *
+ * @author Miroslav Fuksa
+ *
+ * @since 2.5
+ */
+public class HttpAuthenticationFeature implements Feature {
+
+    /**
+     * Feature authentication mode.
+     */
+    static enum Mode {
+        /**
+         * Basic preemptive.
+         **/
+        BASIC_PREEMPTIVE,
+        /**
+         * Basic non preemptive
+         */
+        BASIC_NON_PREEMPTIVE,
+        /**
+         * Digest.
+         */
+        DIGEST,
+        /**
+         * Universal.
+         */
+        UNIVERSAL
+    }
+
+    /**
+     * Builder that creates instances of {@link HttpAuthenticationFeature}.
+     */
+    public static interface Builder {
+
+        /**
+         * Set credentials.
+         *
+         * @param username Username.
+         * @param password Password as byte array.
+         * @return This builder.
+         */
+        public Builder credentials(String username, byte[] password);
+
+        /**
+         * Set credentials.
+         *
+         * @param username Username.
+         * @param password Password as {@link String}.
+         * @return This builder.
+         */
+        public Builder credentials(String username, String password);
+
+        /**
+         * Build the feature.
+         *
+         * @return Http authentication feature configured from this builder.
+         */
+        public HttpAuthenticationFeature build();
+    }
+
+    /**
+     * Extension of {@link org.glassfish.jersey.client.authentication.HttpAuthenticationFeature.Builder}
+     * that builds the http authentication feature configured for basic authentication.
+     */
+    public static interface BasicBuilder extends Builder {
+
+        /**
+         * Configure the builder to create features in non-preemptive basic authentication mode.
+         *
+         * @return This builder.
+         */
+        public BasicBuilder nonPreemptive();
+    }
+
+    /**
+     * that builds the http authentication feature configured in universal mode that supports
+     * basic and digest authentication.
+     */
+    public static interface UniversalBuilder extends Builder {
+
+        /**
+         * Set credentials that will be used for basic authentication only.
+         *
+         * @param username Username.
+         * @param password Password as {@link String}.
+         * @return This builder.
+         */
+        public UniversalBuilder credentialsForBasic(String username, String password);
+
+        /**
+         * Set credentials that will be used for basic authentication only.
+         *
+         * @param username Username.
+         * @param password Password as {@code byte array}.
+         * @return This builder.
+         */
+        public UniversalBuilder credentialsForBasic(String username, byte[] password);
+
+        /**
+         * Set credentials that will be used for digest authentication only.
+         *
+         * @param username Username.
+         * @param password Password as {@link String}.
+         * @return This builder.
+         */
+        public UniversalBuilder credentialsForDigest(String username, String password);
+
+        /**
+         * Set credentials that will be used for digest authentication only.
+         *
+         * @param username Username.
+         * @param password Password as {@code byte array}.
+         * @return This builder.
+         */
+        public UniversalBuilder credentialsForDigest(String username, byte[] password);
+    }
+
+    /**
+     * Implementation of all authentication builders.
+     */
+    static class BuilderImpl implements UniversalBuilder, BasicBuilder {
+
+        private String usernameBasic;
+        private byte[] passwordBasic;
+        private String usernameDigest;
+        private byte[] passwordDigest;
+        private Mode mode;
+
+        /**
+         * Create a new builder.
+         *
+         * @param mode Mode in which the final authentication feature should work.
+         */
+        public BuilderImpl(Mode mode) {
+            this.mode = mode;
+        }
+
+        @Override
+        public Builder credentials(String username, String password) {
+            return credentials(username,
+                    password == null ? null : password.getBytes(HttpAuthenticationFilter.CHARACTER_SET));
+        }
+
+        @Override
+        public Builder credentials(String username, byte[] password) {
+            credentialsForBasic(username, password);
+            credentialsForDigest(username, password);
+            return this;
+        }
+
+        @Override
+        public UniversalBuilder credentialsForBasic(String username, String password) {
+            return credentialsForBasic(username,
+                    password == null ? null : password.getBytes(HttpAuthenticationFilter.CHARACTER_SET));
+        }
+
+        @Override
+        public UniversalBuilder credentialsForBasic(String username, byte[] password) {
+            this.usernameBasic = username;
+            this.passwordBasic = password;
+            return this;
+        }
+
+        @Override
+        public UniversalBuilder credentialsForDigest(String username, String password) {
+            return credentialsForDigest(username,
+                    password == null ? null : password.getBytes(HttpAuthenticationFilter.CHARACTER_SET));
+        }
+
+        @Override
+        public UniversalBuilder credentialsForDigest(String username, byte[] password) {
+            this.usernameDigest = username;
+            this.passwordDigest = password;
+            return this;
+        }
+
+        @Override
+        public HttpAuthenticationFeature build() {
+            return new HttpAuthenticationFeature(mode,
+                    usernameBasic == null ? null
+                            : new HttpAuthenticationFilter.Credentials(usernameBasic, passwordBasic),
+                    usernameDigest == null ? null
+                            : new HttpAuthenticationFilter.Credentials(usernameDigest, passwordDigest));
+        }
+
+        @Override
+        public BasicBuilder nonPreemptive() {
+            if (mode == Mode.BASIC_PREEMPTIVE) {
+                this.mode = Mode.BASIC_NON_PREEMPTIVE;
+            }
+            return this;
+        }
+    }
+
+    /**
+     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
+     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
+     * the username for http authentication feature for the request.
+     * <p>
+     * Example:
+     *
+     * <pre>
+     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
+     *         .property(HTTP_AUTHENTICATION_USERNAME, "joe").property(HTTP_AUTHENTICATION_PASSWORD, "p1swd745").get();
+     * </pre>
+     * </p>
+     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_PASSWORD} property
+     * (as shown in the example). This property pair overrides all password settings of the authentication
+     * feature for the current request.
+     * <p>
+     * The default value must be instance of {@link String}.
+     * </p>
+     * <p>
+     * The name of the configuration property is <tt>{@value}</tt>.
+     * </p>
+     */
+    public static final String HTTP_AUTHENTICATION_USERNAME = "jersey.config.client.http.auth.username";
+    /**
+     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
+     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
+     * the password for http authentication feature for the request.
+     * <p>
+     * Example:
+     *
+     * <pre>
+     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
+     *         .property(HTTP_AUTHENTICATION_USERNAME, "joe").property(HTTP_AUTHENTICATION_PASSWORD, "p1swd745").get();
+     * </pre>
+     * </p>
+     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_USERNAME} property
+     * (as shown in the example). This property pair overrides all password settings of the authentication
+     * feature for the current request.
+     * <p>
+     * The value must be instance of {@link String} or {@code byte} array ({@code byte[]}).
+     * </p>
+     * <p>
+     * The name of the configuration property is <tt>{@value}</tt>.
+     * </p>
+     */
+    public static final String HTTP_AUTHENTICATION_PASSWORD = "jersey.config.client.http.auth.password";
+
+    /**
+     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
+     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
+     * the username for http basic authentication feature for the request.
+     * <p>
+     * Example:
+     *
+     * <pre>
+     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
+     *         .property(HTTP_AUTHENTICATION_BASIC_USERNAME, "joe").property(HTTP_AUTHENTICATION_BASIC_PASSWORD, "p1swd745")
+     *         .get();
+     * </pre>
+     * </p>
+     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_PASSWORD} property
+     * (as shown in the example). The property pair influence only credentials used during basic authentication.
+     *
+     * <p>
+     * The value must be instance of {@link String}.
+     * </p>
+     * <p>
+     * The name of the configuration property is <tt>{@value}</tt>.
+     * </p>
+     *
+     */
+    public static final String HTTP_AUTHENTICATION_BASIC_USERNAME = "jersey.config.client.http.auth.basic.username";
+
+    /**
+     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
+     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
+     * the password for http basic authentication feature for the request.
+     * <p>
+     * Example:
+     *
+     * <pre>
+     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
+     *         .property(HTTP_AUTHENTICATION_BASIC_USERNAME, "joe").property(HTTP_AUTHENTICATION_BASIC_PASSWORD, "p1swd745")
+     *         .get();
+     * </pre>
+     * </p>
+     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_USERNAME} property
+     * (as shown in the example). The property pair influence only credentials used during basic authentication.
+     * <p>
+     * The value must be instance of {@link String} or {@code byte} array ({@code byte[]}).
+     * </p>
+     * <p>
+     * The name of the configuration property is <tt>{@value}</tt>.
+     * </p>
+     */
+    public static final String HTTP_AUTHENTICATION_BASIC_PASSWORD = "jersey.config.client.http.auth.basic.password";
+
+    /**
+     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
+     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
+     * the username for http digest authentication feature for the request.
+     * <p>
+     * Example:
+     *
+     * <pre>
+     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
+     *         .property(HTTP_AUTHENTICATION_DIGEST_USERNAME, "joe")
+     *         .property(HTTP_AUTHENTICATION_DIGEST_PASSWORD, "p1swd745").get();
+     * </pre>
+     * </p>
+     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_PASSWORD} property
+     * (as shown in the example). The property pair influence only credentials used during digest authentication.
+     * <p>
+     * The value must be instance of {@link String}.
+     * </p>
+     * <p>
+     * The name of the configuration property is <tt>{@value}</tt>.
+     * </p>
+     */
+    public static final String HTTP_AUTHENTICATION_DIGEST_USERNAME = "jersey.config.client.http.auth.digest.username";
+
+    /**
+     * Key of the property that can be set into the {@link javax.ws.rs.client.ClientRequestContext client request}
+     * using {@link javax.ws.rs.client.ClientRequestContext#setProperty(String, Object)} in order to override
+     * the password for http digest authentication feature for the request.
+     * <p>
+     * Example:
+     *
+     * <pre>
+     * Response response = client.target("http://localhost:8080/rest/joe/orders").request()
+     *         .property(HTTP_AUTHENTICATION_DIGEST_USERNAME, "joe")
+     *         .property(HTTP_AUTHENTICATION_DIGEST_PASSWORD, "p1swd745").get();
+     * </pre>
+     * </p>
+     * The property must be always combined with configuration of {@link #HTTP_AUTHENTICATION_PASSWORD} property
+     * (as shown in the example). The property pair influence only credentials used during digest authentication.
+     * <p>
+     * The value must be instance of {@link String} or {@code byte} array ({@code byte[]}).
+     * </p>
+     * <p>
+     * The name of the configuration property is <tt>{@value}</tt>.
+     * </p>
+     */
+    public static final String HTTP_AUTHENTICATION_DIGEST_PASSWORD = "jersey.config.client.http.auth.digest.password";
+
+    /**
+     * Create the builder of the http authentication feature working in basic authentication mode. The builder
+     * can build preemptive and non-preemptive basic authentication features.
+     *
+     * @return Basic http authentication builder.
+     */
+    public static BasicBuilder basicBuilder() {
+        return new BuilderImpl(Mode.BASIC_PREEMPTIVE);
+    }
+
+    /**
+     * Create the http authentication feature in basic preemptive authentication mode initialized with credentials.
+     *
+     * @param username Username.
+     * @param password Password as {@code byte array}.
+     * @return Http authentication feature configured in basic mode.
+     */
+    public static HttpAuthenticationFeature basic(String username, byte[] password) {
+        return build(Mode.BASIC_PREEMPTIVE, username, password);
+    }
+
+    /**
+     * Create the http authentication feature in basic preemptive authentication mode initialized with credentials.
+     *
+     * @param username Username.
+     * @param password Password as {@link String}.
+     * @return Http authentication feature configured in basic mode.
+     */
+    public static HttpAuthenticationFeature basic(String username, String password) {
+        return build(Mode.BASIC_PREEMPTIVE, username, password);
+    }
+
+    /**
+     * Create the http authentication feature in digest authentication mode initialized without default
+     * credentials. Credentials will have to be supplied using request properties for each request.
+     *
+     * @return Http authentication feature configured in digest mode.
+     */
+    public static HttpAuthenticationFeature digest() {
+        return build(Mode.DIGEST);
+    }
+
+    /**
+     * Create the http authentication feature in digest authentication mode initialized with credentials.
+     *
+     * @param username Username.
+     * @param password Password as {@code byte array}.
+     * @return Http authentication feature configured in digest mode.
+     */
+    public static HttpAuthenticationFeature digest(String username, byte[] password) {
+        return build(Mode.DIGEST, username, password);
+    }
+
+    /**
+     * Create the http authentication feature in digest authentication mode initialized with credentials.
+     *
+     * @param username Username.
+     * @param password Password as {@link String}.
+     * @return Http authentication feature configured in digest mode.
+     */
+    public static HttpAuthenticationFeature digest(String username, String password) {
+        return build(Mode.DIGEST, username, password);
+    }
+
+    /**
+     * Create the builder that builds http authentication feature in combined mode supporting both,
+     * basic and digest authentication.
+     *
+     * @return Universal builder.
+     */
+    public static UniversalBuilder universalBuilder() {
+        return new BuilderImpl(Mode.UNIVERSAL);
+    }
+
+    /**
+     * Create the http authentication feature in combined mode supporting both,
+     * basic and digest authentication.
+     *
+     * @param username Username.
+     * @param password Password as {@code byte array}.
+     * @return Http authentication feature configured in digest mode.
+     */
+    public static HttpAuthenticationFeature universal(String username, byte[] password) {
+        return build(Mode.UNIVERSAL, username, password);
+    }
+
+    /**
+     * Create the http authentication feature in combined mode supporting both,
+     * basic and digest authentication.
+     *
+     * @param username Username.
+     * @param password Password as {@link String}.
+     * @return Http authentication feature configured in digest mode.
+     */
+    public static HttpAuthenticationFeature universal(String username, String password) {
+        return build(Mode.UNIVERSAL, username, password);
+    }
+
+    private static HttpAuthenticationFeature build(Mode mode) {
+        return new BuilderImpl(mode).build();
+    }
+
+    private static HttpAuthenticationFeature build(Mode mode, String username, byte[] password) {
+        return new BuilderImpl(mode).credentials(username, password).build();
+    }
+
+    private static HttpAuthenticationFeature build(Mode mode, String username, String password) {
+        return new BuilderImpl(mode).credentials(username, password).build();
+    }
+
+    private final Mode mode;
+    private final HttpAuthenticationFilter.Credentials basicCredentials;
+
+    private HttpAuthenticationFeature(Mode mode, HttpAuthenticationFilter.Credentials basicCredentials,
+            HttpAuthenticationFilter.Credentials digestCredentials) {
+        this.mode = mode;
+        this.basicCredentials = basicCredentials;
+    }
+
+    @Override
+    public boolean configure(FeatureContext context) {
+        context.register(new HttpAuthenticationFilter(mode, basicCredentials, context.getConfiguration()));
+        return true;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/HttpAuthenticationFilter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/HttpAuthenticationFilter.java
new file mode 100644 (file)
index 0000000..f457624
--- /dev/null
@@ -0,0 +1,348 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").  You
+ * may not use this file except in compliance with the License.  You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt.  See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license."  If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above.  However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package org.openhab.binding.lametrictime.internal.api.authentication;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.nio.charset.Charset;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Priority;
+import javax.ws.rs.Priorities;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Configuration;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+
+/**
+ * Http Authentication filter that provides basic and digest authentication (based on RFC 2617).
+ *
+ * @author Miroslav Fuksa
+ */
+@Priority(Priorities.AUTHENTICATION)
+class HttpAuthenticationFilter implements ClientRequestFilter, ClientResponseFilter {
+
+    /**
+     * Authentication type.
+     */
+    enum Type {
+        /**
+         * Basic authentication.
+         */
+        BASIC
+    }
+
+    private static final String REQUEST_PROPERTY_FILTER_REUSED = "org.openhab.binding.lametrictime.api.authentication.HttpAuthenticationFilter.reused";
+    private static final String REQUEST_PROPERTY_OPERATION = "org.openhab.binding.lametrictime.api.authentication.HttpAuthenticationFilter.operation";
+
+    /**
+     * Encoding used for authentication calculations.
+     */
+    static final Charset CHARACTER_SET = Charset.forName("iso-8859-1");
+
+    private final HttpAuthenticationFeature.Mode mode;
+
+    private final BasicAuthenticator basicAuth;
+
+    /**
+     * Create a new filter instance.
+     *
+     * @param mode Mode.
+     * @param basicCredentials Basic credentials (can be {@code null} if this filter does not work in the
+     *            basic mode or if no default credentials are defined).
+     * @param digestCredentials Digest credentials (can be {@code null} if this filter does not work in the
+     *            digest mode or if no default credentials are defined).
+     * @param configuration Configuration (non-{@code null}).
+     */
+    HttpAuthenticationFilter(HttpAuthenticationFeature.Mode mode, Credentials basicCredentials,
+            Configuration configuration) {
+        this.mode = mode;
+        switch (mode) {
+            case BASIC_PREEMPTIVE:
+            case BASIC_NON_PREEMPTIVE:
+                this.basicAuth = new BasicAuthenticator(basicCredentials);
+                break;
+            case UNIVERSAL:
+                this.basicAuth = new BasicAuthenticator(basicCredentials);
+                break;
+            default:
+                throw new IllegalStateException("Not implemented.");
+        }
+    }
+
+    @Override
+    public void filter(ClientRequestContext request) throws IOException {
+        if ("true".equals(request.getProperty(REQUEST_PROPERTY_FILTER_REUSED))) {
+            return;
+        }
+
+        if (request.getHeaders().containsKey(HttpHeaders.AUTHORIZATION)) {
+            return;
+        }
+
+        Type operation = null;
+        if (mode == HttpAuthenticationFeature.Mode.BASIC_PREEMPTIVE) {
+            basicAuth.filterRequest(request);
+            operation = Type.BASIC;
+        } else if (mode == HttpAuthenticationFeature.Mode.BASIC_NON_PREEMPTIVE) {
+            // do nothing
+        }
+
+        if (operation != null) {
+            request.setProperty(REQUEST_PROPERTY_OPERATION, operation);
+        }
+    }
+
+    @Override
+    public void filter(ClientRequestContext request, ClientResponseContext response) throws IOException {
+        if ("true".equals(request.getProperty(REQUEST_PROPERTY_FILTER_REUSED))) {
+            return;
+        }
+
+        Type result = null; // which authentication is requested: BASIC or DIGEST
+        boolean authenticate;
+
+        if (response.getStatus() == Response.Status.UNAUTHORIZED.getStatusCode()) {
+            String authString = response.getHeaders().getFirst(HttpHeaders.WWW_AUTHENTICATE);
+            if (authString != null) {
+                final String upperCaseAuth = authString.trim().toUpperCase();
+                if (upperCaseAuth.startsWith("BASIC")) {
+                    result = Type.BASIC;
+                } else {
+                    // unknown authentication -> this filter cannot authenticate with this method
+                    return;
+                }
+            }
+            authenticate = true;
+        } else {
+            authenticate = false;
+        }
+
+        if (mode == HttpAuthenticationFeature.Mode.BASIC_PREEMPTIVE) {
+            // do nothing -> 401 will be returned to the client
+        } else if (mode == HttpAuthenticationFeature.Mode.BASIC_NON_PREEMPTIVE) {
+            if (authenticate && result == Type.BASIC) {
+                basicAuth.filterResponseAndAuthenticate(request, response);
+            }
+        } else if (mode == HttpAuthenticationFeature.Mode.UNIVERSAL) {
+            if (authenticate) {
+                boolean success = false;
+
+                // now we have the challenge response and we can authenticate
+                if (result == Type.BASIC) {
+                    success = basicAuth.filterResponseAndAuthenticate(request, response);
+                }
+            }
+        }
+    }
+
+    private String getCacheKey(ClientRequestContext request) {
+        return request.getUri().toString() + ":" + request.getMethod();
+    }
+
+    /**
+     * Repeat the {@code request} with provided {@code newAuthorizationHeader}
+     * and update the {@code response} with newest response data.
+     *
+     * @param request Request context.
+     * @param response Response context (will be updated with the new response data).
+     * @param newAuthorizationHeader {@code Authorization} header that should be added to the new request.
+     * @return {@code true} is the authentication was successful ({@code true} if 401 response code was not returned;
+     *         {@code false} otherwise).
+     */
+    static boolean repeatRequest(ClientRequestContext request, ClientResponseContext response,
+            String newAuthorizationHeader) {
+        Client client = ClientBuilder.newClient(request.getConfiguration());
+        String method = request.getMethod();
+        MediaType mediaType = request.getMediaType();
+        URI lUri = request.getUri();
+
+        WebTarget resourceTarget = client.target(lUri);
+
+        Invocation.Builder builder = resourceTarget.request(mediaType);
+
+        MultivaluedMap<String, Object> newHeaders = new MultivaluedHashMap<String, Object>();
+
+        for (Map.Entry<String, List<Object>> entry : request.getHeaders().entrySet()) {
+            if (HttpHeaders.AUTHORIZATION.equals(entry.getKey())) {
+                continue;
+            }
+            newHeaders.put(entry.getKey(), entry.getValue());
+        }
+
+        newHeaders.add(HttpHeaders.AUTHORIZATION, newAuthorizationHeader);
+        builder.headers(newHeaders);
+
+        builder.property(REQUEST_PROPERTY_FILTER_REUSED, "true");
+
+        Invocation invocation;
+        if (request.getEntity() == null) {
+            invocation = builder.build(method);
+        } else {
+            invocation = builder.build(method, Entity.entity(request.getEntity(), request.getMediaType()));
+        }
+        Response nextResponse = invocation.invoke();
+
+        if (nextResponse.hasEntity()) {
+            response.setEntityStream(nextResponse.readEntity(InputStream.class));
+        }
+        MultivaluedMap<String, String> headers = response.getHeaders();
+        headers.clear();
+        headers.putAll(nextResponse.getStringHeaders());
+        response.setStatus(nextResponse.getStatus());
+
+        return response.getStatus() != Response.Status.UNAUTHORIZED.getStatusCode();
+    }
+
+    /**
+     * Credentials (username + password).
+     */
+    static class Credentials {
+
+        private final String username;
+        private final byte[] password;
+
+        /**
+         * Create a new credentials from username and password as byte array.
+         *
+         * @param username Username.
+         * @param password Password as byte array.
+         */
+        Credentials(String username, byte[] password) {
+            this.username = username;
+            this.password = password;
+        }
+
+        /**
+         * Create a new credentials from username and password as {@link String}.
+         *
+         * @param username Username.
+         * @param password {@code String} password.
+         */
+        Credentials(String username, String password) {
+            this.username = username;
+            this.password = password == null ? null : password.getBytes(CHARACTER_SET);
+        }
+
+        /**
+         * Return username.
+         *
+         * @return username.
+         */
+        String getUsername() {
+            return username;
+        }
+
+        /**
+         * Return password as byte array.
+         *
+         * @return Password string in byte array representation.
+         */
+        byte[] getPassword() {
+            return password;
+        }
+    }
+
+    private static Credentials extractCredentials(ClientRequestContext request, Type type) {
+        String usernameKey = null;
+        String passwordKey = null;
+        if (type == null) {
+            usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME;
+            passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD;
+        } else if (type == Type.BASIC) {
+            usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME;
+            passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD;
+        }
+
+        String userName = (String) request.getProperty(usernameKey);
+        if (userName != null && !userName.equals("")) {
+            byte[] pwdBytes;
+            Object password = request.getProperty(passwordKey);
+            if (password instanceof byte[]) {
+                pwdBytes = ((byte[]) password);
+            } else if (password instanceof String) {
+                pwdBytes = ((String) password).getBytes(CHARACTER_SET);
+            } else {
+                throw new RequestAuthenticationException("Passwort invalid.");
+            }
+            return new Credentials(userName, pwdBytes);
+        }
+        return null;
+    }
+
+    /**
+     * Get credentials actual for the current request. Priorities in credentials selection are the following:
+     * <ol>
+     * <li>Basic/digest specific credentials defined in the request properties</li>
+     * <li>Common credentials defined in the request properties</li>
+     * <li>{@code defaultCredentials}</li>
+     * </ol>
+     *
+     * @param request Request from which credentials should be extracted.
+     * @param defaultCredentials Default credentials (can be {@code null}).
+     * @param type Type of requested credentials.
+     * @return Credentials or {@code null} if no credentials are found and {@code defaultCredentials} are {@code null}.
+     * @throws RequestAuthenticationException in case the {@code username} or {@code password} is invalid.
+     */
+    static Credentials getCredentials(ClientRequestContext request, Credentials defaultCredentials, Type type) {
+        Credentials commonCredentials = extractCredentials(request, type);
+
+        if (commonCredentials != null) {
+            return commonCredentials;
+        } else {
+            Credentials specificCredentials = extractCredentials(request, null);
+
+            return specificCredentials != null ? specificCredentials : defaultCredentials;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/RequestAuthenticationException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/RequestAuthenticationException.java
new file mode 100644 (file)
index 0000000..9d42fea
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").  You
+ * may not use this file except in compliance with the License.  You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt.  See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license."  If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above.  However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package org.openhab.binding.lametrictime.internal.api.authentication;
+
+import javax.ws.rs.ProcessingException;
+
+/**
+ * Exception thrown by security request authentication.
+ *
+ * @author Petr Bouda (petr.bouda at oracle.com)
+ */
+public class RequestAuthenticationException extends ProcessingException {
+
+    /**
+     * Creates new instance of this exception with exception cause.
+     *
+     * @param cause Exception cause.
+     */
+    public RequestAuthenticationException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Creates new instance of this exception with exception message.
+     *
+     * @param message Exception message.
+     */
+    public RequestAuthenticationException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates new instance of this exception with exception message and exception cause.
+     *
+     * @param message Exception message.
+     * @param cause Exception cause.
+     */
+    public RequestAuthenticationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/ResponseAuthenticationException.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/authentication/ResponseAuthenticationException.java
new file mode 100644 (file)
index 0000000..d71f2d0
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").  You
+ * may not use this file except in compliance with the License.  You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt.  See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license."  If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above.  However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package org.openhab.binding.lametrictime.internal.api.authentication;
+
+import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.core.Response;
+
+/**
+ * Exception thrown by security response authentication.
+ *
+ * @author Petr Bouda (petr.bouda at oracle.com)
+ */
+public class ResponseAuthenticationException extends ResponseProcessingException {
+
+    /**
+     * Creates new instance of this exception with exception cause.
+     *
+     * @param response the response instance for which the processing failed.
+     * @param cause Exception cause.
+     */
+    public ResponseAuthenticationException(Response response, Throwable cause) {
+        super(response, cause);
+    }
+
+    /**
+     * Creates new instance of this exception with exception message.
+     *
+     * @param response the response instance for which the processing failed.
+     * @param message Exception message.
+     */
+    public ResponseAuthenticationException(Response response, String message) {
+        super(response, message);
+    }
+
+    /**
+     * Creates new instance of this exception with exception message and exception cause.
+     *
+     * @param response the response instance for which the processing failed.
+     * @param message Exception message.
+     * @param cause Exception cause.
+     */
+    public ResponseAuthenticationException(Response response, String message, Throwable cause) {
+        super(response, message, cause);
+    }
+
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/filter/LoggingFilter.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/internal/api/filter/LoggingFilter.java
new file mode 100644 (file)
index 0000000..f57ea20
--- /dev/null
@@ -0,0 +1,355 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2011-2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").  You
+ * may not use this file except in compliance with the License.  You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt.  See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license."  If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above.  However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package org.openhab.binding.lametrictime.internal.api.filter;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.nio.charset.Charset;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.logging.Logger;
+
+import javax.annotation.Priority;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
+import javax.ws.rs.container.PreMatching;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.WriterInterceptor;
+import javax.ws.rs.ext.WriterInterceptorContext;
+
+/**
+ * Universal logging filter.
+ * <p/>
+ * Can be used on client or server side. Has the highest priority.
+ *
+ * @author Pavel Bucek (pavel.bucek at oracle.com)
+ * @author Martin Matula
+ */
+@PreMatching
+@Priority(Integer.MIN_VALUE)
+public final class LoggingFilter implements ContainerRequestFilter, ClientRequestFilter, ContainerResponseFilter,
+        ClientResponseFilter, WriterInterceptor {
+
+    public static final Charset UTF8 = Charset.forName("UTF-8");
+
+    private static final Logger LOGGER = Logger.getLogger(LoggingFilter.class.getName());
+    private static final String NOTIFICATION_PREFIX = "* ";
+    private static final String REQUEST_PREFIX = "> ";
+    private static final String RESPONSE_PREFIX = "< ";
+    private static final String ENTITY_LOGGER_PROPERTY = LoggingFilter.class.getName() + ".entityLogger";
+    private static final String LOGGING_ID_PROPERTY = LoggingFilter.class.getName() + ".id";
+
+    private static final Comparator<Map.Entry<String, List<String>>> COMPARATOR = new Comparator<Map.Entry<String, List<String>>>() {
+
+        @Override
+        public int compare(final Map.Entry<String, List<String>> o1, final Map.Entry<String, List<String>> o2) {
+            return o1.getKey().compareToIgnoreCase(o2.getKey());
+        }
+    };
+
+    private static final int DEFAULT_MAX_ENTITY_SIZE = 8 * 1024;
+
+    //
+    private final Logger logger;
+    private final AtomicLong _id = new AtomicLong(0);
+    private final boolean printEntity;
+    private final int maxEntitySize;
+
+    /**
+     * Create a logging filter logging the request and response to a default JDK
+     * logger, named as the fully qualified class name of this class. Entity
+     * logging is turned off by default.
+     */
+    public LoggingFilter() {
+        this(LOGGER, false);
+    }
+
+    /**
+     * Create a logging filter with custom logger and custom settings of entity
+     * logging.
+     *
+     * @param logger the logger to log requests and responses.
+     * @param printEntity if true, entity will be logged as well up to the default maxEntitySize, which is 8KB
+     */
+    public LoggingFilter(final Logger logger, final boolean printEntity) {
+        this.logger = logger;
+        this.printEntity = printEntity;
+        this.maxEntitySize = DEFAULT_MAX_ENTITY_SIZE;
+    }
+
+    /**
+     * Creates a logging filter with custom logger and entity logging turned on, but potentially limiting the size
+     * of entity to be buffered and logged.
+     *
+     * @param logger the logger to log requests and responses.
+     * @param maxEntitySize maximum number of entity bytes to be logged (and buffered) - if the entity is larger,
+     *            logging filter will print (and buffer in memory) only the specified number of bytes
+     *            and print "...more..." string at the end. Negative values are interpreted as zero.
+     */
+    public LoggingFilter(final Logger logger, final int maxEntitySize) {
+        this.logger = logger;
+        this.printEntity = true;
+        this.maxEntitySize = Math.max(0, maxEntitySize);
+    }
+
+    private void log(final StringBuilder b) {
+        if (logger != null) {
+            logger.info(b.toString());
+        }
+    }
+
+    private StringBuilder prefixId(final StringBuilder b, final long id) {
+        b.append(Long.toString(id)).append(" ");
+        return b;
+    }
+
+    private void printRequestLine(final StringBuilder b, final String note, final long id, final String method,
+            final URI uri) {
+        prefixId(b, id).append(NOTIFICATION_PREFIX).append(note).append(" on thread ")
+                .append(Thread.currentThread().getName()).append("\n");
+        prefixId(b, id).append(REQUEST_PREFIX).append(method).append(" ").append(uri.toASCIIString()).append("\n");
+    }
+
+    private void printResponseLine(final StringBuilder b, final String note, final long id, final int status) {
+        prefixId(b, id).append(NOTIFICATION_PREFIX).append(note).append(" on thread ")
+                .append(Thread.currentThread().getName()).append("\n");
+        prefixId(b, id).append(RESPONSE_PREFIX).append(Integer.toString(status)).append("\n");
+    }
+
+    private void printPrefixedHeaders(final StringBuilder b, final long id, final String prefix,
+            final MultivaluedMap<String, String> headers) {
+        for (final Map.Entry<String, List<String>> headerEntry : getSortedHeaders(headers.entrySet())) {
+            final List<?> val = headerEntry.getValue();
+            final String header = headerEntry.getKey();
+
+            if (val.size() == 1) {
+                prefixId(b, id).append(prefix).append(header).append(": ").append(val.get(0)).append("\n");
+            } else {
+                final StringBuilder sb = new StringBuilder();
+                boolean add = false;
+                for (final Object s : val) {
+                    if (add) {
+                        sb.append(',');
+                    }
+                    add = true;
+                    sb.append(s);
+                }
+                prefixId(b, id).append(prefix).append(header).append(": ").append(sb.toString()).append("\n");
+            }
+        }
+    }
+
+    private Set<Map.Entry<String, List<String>>> getSortedHeaders(final Set<Map.Entry<String, List<String>>> headers) {
+        final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<Map.Entry<String, List<String>>>(
+                COMPARATOR);
+        sortedHeaders.addAll(headers);
+        return sortedHeaders;
+    }
+
+    private InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
+            throws IOException {
+        if (!stream.markSupported()) {
+            stream = new BufferedInputStream(stream);
+        }
+        stream.mark(maxEntitySize + 1);
+        final byte[] entity = new byte[maxEntitySize + 1];
+        final int entitySize = stream.read(entity);
+        b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
+        if (entitySize > maxEntitySize) {
+            b.append("...more...");
+        }
+        b.append('\n');
+        stream.reset();
+        return stream;
+    }
+
+    @Override
+    public void filter(final ClientRequestContext context) throws IOException {
+        final long id = _id.incrementAndGet();
+        context.setProperty(LOGGING_ID_PROPERTY, id);
+
+        final StringBuilder b = new StringBuilder();
+
+        printRequestLine(b, "Sending client request", id, context.getMethod(), context.getUri());
+        printPrefixedHeaders(b, id, REQUEST_PREFIX, context.getStringHeaders());
+
+        if (printEntity && context.hasEntity()) {
+            final OutputStream stream = new LoggingStream(b, context.getEntityStream());
+            context.setEntityStream(stream);
+            context.setProperty(ENTITY_LOGGER_PROPERTY, stream);
+            // not calling log(b) here - it will be called by the interceptor
+        } else {
+            log(b);
+        }
+    }
+
+    @Override
+    public void filter(final ClientRequestContext requestContext, final ClientResponseContext responseContext)
+            throws IOException {
+        final Object requestId = requestContext.getProperty(LOGGING_ID_PROPERTY);
+        final long id = requestId != null ? (Long) requestId : _id.incrementAndGet();
+
+        final StringBuilder b = new StringBuilder();
+
+        printResponseLine(b, "Client response received", id, responseContext.getStatus());
+        printPrefixedHeaders(b, id, RESPONSE_PREFIX, responseContext.getHeaders());
+
+        if (printEntity && responseContext.hasEntity()) {
+            responseContext.setEntityStream(
+                    logInboundEntity(b, responseContext.getEntityStream(), getCharset(responseContext.getMediaType())));
+        }
+
+        log(b);
+    }
+
+    @Override
+    public void filter(final ContainerRequestContext context) throws IOException {
+        final long id = _id.incrementAndGet();
+        context.setProperty(LOGGING_ID_PROPERTY, id);
+
+        final StringBuilder b = new StringBuilder();
+
+        printRequestLine(b, "Server has received a request", id, context.getMethod(),
+                context.getUriInfo().getRequestUri());
+        printPrefixedHeaders(b, id, REQUEST_PREFIX, context.getHeaders());
+
+        if (printEntity && context.hasEntity()) {
+            context.setEntityStream(logInboundEntity(b, context.getEntityStream(), getCharset(context.getMediaType())));
+        }
+
+        log(b);
+    }
+
+    @Override
+    public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext)
+            throws IOException {
+        final Object requestId = requestContext.getProperty(LOGGING_ID_PROPERTY);
+        final long id = requestId != null ? (Long) requestId : _id.incrementAndGet();
+
+        final StringBuilder b = new StringBuilder();
+
+        printResponseLine(b, "Server responded with a response", id, responseContext.getStatus());
+        printPrefixedHeaders(b, id, RESPONSE_PREFIX, responseContext.getStringHeaders());
+
+        if (printEntity && responseContext.hasEntity()) {
+            final OutputStream stream = new LoggingStream(b, responseContext.getEntityStream());
+            responseContext.setEntityStream(stream);
+            requestContext.setProperty(ENTITY_LOGGER_PROPERTY, stream);
+            // not calling log(b) here - it will be called by the interceptor
+        } else {
+            log(b);
+        }
+    }
+
+    @Override
+    public void aroundWriteTo(final WriterInterceptorContext writerInterceptorContext)
+            throws IOException, WebApplicationException {
+        final LoggingStream stream = (LoggingStream) writerInterceptorContext.getProperty(ENTITY_LOGGER_PROPERTY);
+        writerInterceptorContext.proceed();
+        if (stream != null) {
+            log(stream.getStringBuilder(getCharset(writerInterceptorContext.getMediaType())));
+        }
+    }
+
+    private class LoggingStream extends FilterOutputStream {
+
+        private final StringBuilder b;
+        private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+        LoggingStream(final StringBuilder b, final OutputStream inner) {
+            super(inner);
+
+            this.b = b;
+        }
+
+        StringBuilder getStringBuilder(final Charset charset) {
+            // write entity to the builder
+            final byte[] entity = baos.toByteArray();
+
+            b.append(new String(entity, 0, Math.min(entity.length, maxEntitySize), charset));
+            if (entity.length > maxEntitySize) {
+                b.append("...more...");
+            }
+            b.append('\n');
+
+            return b;
+        }
+
+        @Override
+        public void write(final int i) throws IOException {
+            if (baos.size() <= maxEntitySize) {
+                baos.write(i);
+            }
+            out.write(i);
+        }
+    }
+
+    /**
+     * Get the character set from a media type.
+     * <p>
+     * The character set is obtained from the media type parameter "charset".
+     * If the parameter is not present the {@link #UTF8} charset is utilized.
+     *
+     * @param m the media type.
+     * @return the character set.
+     */
+    public static Charset getCharset(MediaType m) {
+        String name = (m == null) ? null : m.getParameters().get(MediaType.CHARSET_PARAMETER);
+        return (name == null) ? UTF8 : Charset.forName(name);
+    }
+
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/AllIntegrationTestsSuite.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/AllIntegrationTestsSuite.java
deleted file mode 100644 (file)
index 6c5ae8e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api;
-
-import org.junit.runner.RunWith;
-
-import com.googlecode.junittoolbox.SuiteClasses;
-import com.googlecode.junittoolbox.WildcardPatternSuite;
-
-@RunWith(WildcardPatternSuite.class)
-@SuiteClasses({ "**/*IT.class" })
-public class AllIntegrationTestsSuite
-{
-    // Execute all integration tests
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/AllUnitTestsSuite.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/AllUnitTestsSuite.java
deleted file mode 100644 (file)
index d85021c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api;
-
-import org.junit.runner.RunWith;
-
-import com.googlecode.junittoolbox.ParallelSuite;
-import com.googlecode.junittoolbox.SuiteClasses;
-
-@RunWith(ParallelSuite.class)
-@SuiteClasses({ "**/*Test.class" })
-public class AllUnitTestsSuite {
-    // Execute all unit tests
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/impl/FileIconTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/impl/FileIconTest.java
deleted file mode 100644 (file)
index beca8b4..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.impl;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-public class FileIconTest extends AbstractTest
-{
-    @Test
-    public void testLocalPathGif()
-    {
-        FileIcon icon = new FileIcon(getTestDataPath("smile.gif"));
-        assertEquals("data:image/gif;base64,R0lGODlhCAAIAPEAAPz+BPz+/AAAAAAAACH5BAkKAAIAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAACAAIAAACEZSAYJfIElREIdaGs3PPNFMAACH5BAkKAAIALAAAAAAIAAgAAAIRlIBgl8gSVEQh1oazU4szJxQAIfkECTIAAgAsAAAAAAgACAAAAhKUgGCXyBJURCHWhlU7fCmzCQUAIfkECRQAAgAsAAAAAAgACAAAAhGUgGCXyBIaClFa1Y5eymRRAAAh+QQJMgACACwAAAAACAAIAAACEpSAYJfIElREIdaGVTt8KbMJBQA7",
-                     icon.toRaw());
-    }
-
-    @Test
-    public void testLocalPathPng()
-    {
-        FileIcon icon = new FileIcon(getTestDataPath("info.png"));
-        assertEquals("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAL0lEQVQYlWN0NPv3nwEPYIEx9p1kRJFwMofoY0IXQGczMRAAVFSA7EhkNiMhbwIAA/sN+bH1CpgAAAAASUVORK5CYII=",
-                     icon.toRaw());
-    }
-
-    @Test
-    public void testLocalFileGif()
-    {
-        FileIcon icon = new FileIcon(getTestDataFile("smile.gif"));
-        assertEquals("data:image/gif;base64,R0lGODlhCAAIAPEAAPz+BPz+/AAAAAAAACH5BAkKAAIAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAACAAIAAACEZSAYJfIElREIdaGs3PPNFMAACH5BAkKAAIALAAAAAAIAAgAAAIRlIBgl8gSVEQh1oazU4szJxQAIfkECTIAAgAsAAAAAAgACAAAAhKUgGCXyBJURCHWhlU7fCmzCQUAIfkECRQAAgAsAAAAAAgACAAAAhGUgGCXyBIaClFa1Y5eymRRAAAh+QQJMgACACwAAAAACAAIAAACEpSAYJfIElREIdaGVTt8KbMJBQA7",
-                     icon.toRaw());
-    }
-
-    @Test
-    public void testLocalFilePng()
-    {
-        FileIcon icon = new FileIcon(getTestDataFile("info.png"));
-        assertEquals("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAL0lEQVQYlWN0NPv3nwEPYIEx9p1kRJFwMofoY0IXQGczMRAAVFSA7EhkNiMhbwIAA/sN+bH1CpgAAAAASUVORK5CYII=",
-                     icon.toRaw());
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/impl/LaMetricTimeLocalImplIT.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/impl/LaMetricTimeLocalImplIT.java
deleted file mode 100644 (file)
index 5dfb057..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.impl;
-
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Properties;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.local.ApplicationActionException;
-import org.openhab.binding.lametrictime.api.local.ApplicationActivationException;
-import org.openhab.binding.lametrictime.api.local.ApplicationNotFoundException;
-import org.openhab.binding.lametrictime.api.local.LocalConfiguration;
-import org.openhab.binding.lametrictime.api.local.NotificationCreationException;
-import org.openhab.binding.lametrictime.api.local.NotificationNotFoundException;
-import org.openhab.binding.lametrictime.api.local.UpdateException;
-import org.openhab.binding.lametrictime.api.local.model.Audio;
-import org.openhab.binding.lametrictime.api.local.model.Bluetooth;
-import org.openhab.binding.lametrictime.api.local.model.Display;
-import org.openhab.binding.lametrictime.api.local.model.Frame;
-import org.openhab.binding.lametrictime.api.local.model.GoalData;
-import org.openhab.binding.lametrictime.api.local.model.Notification;
-import org.openhab.binding.lametrictime.api.local.model.NotificationModel;
-import org.openhab.binding.lametrictime.api.local.model.Sound;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
-import org.openhab.binding.lametrictime.api.model.enums.BrightnessMode;
-import org.openhab.binding.lametrictime.api.model.enums.Priority;
-import org.openhab.binding.lametrictime.api.model.enums.SoundCategory;
-import org.openhab.binding.lametrictime.api.test.TestUtil;
-
-/**
- * <p>
- * This test is excluded from the normal battery of tests because it is not a
- * unit test, but rather a live test against an actual device. The purpose of
- * this test is to make sure that after a firmware upgrade, the device still
- * responds in a backwards compatible way.
- * </p>
- * <br>
- * <p>
- * To run this test, first create a file called 'device.properties' in the
- * matching package as this class under 'src/test/resources' with two
- * properties: 'host' and 'apiKey'. After putting the configuration in place,
- * either execute the test via your IDE or run 'mvn -DskipITs=false
- * integration-test'.
- * </p>
- */
-@Disabled
-public class LaMetricTimeLocalImplIT {
-    private static final String PROP_HOST = "host";
-    private static final String PROP_API_KEY = "apiKey";
-
-    private static LaMetricTimeLocalImpl local;
-
-    @BeforeAll
-    public static void setup() throws IOException {
-        File file = TestUtil.getTestDataPath(LaMetricTimeLocalImplIT.class, "device.properties").toFile();
-        if (!file.exists()) {
-            throw new IllegalStateException("Device configuration properties missing at " + file.getAbsolutePath());
-        }
-
-        try (InputStream in = new FileInputStream(file)) {
-            Properties properties = new Properties();
-            properties.load(in);
-
-            if (!properties.containsKey(PROP_HOST)) {
-                throw new IllegalStateException("Device configuration property " + PROP_HOST + " was not found");
-            }
-
-            if (!properties.containsKey(PROP_API_KEY)) {
-                throw new IllegalStateException("Device configuration property " + PROP_API_KEY + " was not found");
-            }
-
-            LocalConfiguration config = new LocalConfiguration().withHost(properties.getProperty(PROP_HOST))
-                    .withApiKey(properties.getProperty(PROP_API_KEY)).withLogging(true);
-            local = new LaMetricTimeLocalImpl(config);
-        }
-    }
-
-    @Test
-    public void testGetApi() {
-        local.getApi();
-    }
-
-    @Test
-    public void testGetDevice() {
-        local.getDevice();
-    }
-
-    @Test
-    public void testCreateAndGetNotification() throws NotificationCreationException, NotificationNotFoundException {
-        String id = local.createNotification(buildSimpleNotification(1));
-        local.getCurrentNotification();
-        local.getNotification(id);
-    }
-
-    @Test
-    public void testCreateGoalNotification() throws NotificationCreationException, NotificationNotFoundException {
-        local.createNotification(buildGoalNotification(1));
-    }
-
-    @Test
-    public void testCreateChartNotification() throws NotificationCreationException, NotificationNotFoundException {
-        local.createNotification(buildChartNotification(1));
-    }
-
-    @Test
-    public void testGetNotifications() {
-        local.getNotifications();
-    }
-
-    @Test
-    public void testGetInvalidNotification() {
-        assertThrows(NotificationNotFoundException.class, () -> local.getNotification("invalid"));
-    }
-
-    @Test
-    public void testCreateAndDeleteNotification() throws NotificationCreationException, NotificationNotFoundException {
-        String id = local.createNotification(buildSimpleNotification(0));
-        local.deleteNotification(id);
-    }
-
-    @Test
-    public void testGetDisplay() {
-        local.getDisplay();
-    }
-
-    @Test
-    public void testUpdateDisplay() throws UpdateException {
-        local.updateDisplay(new Display().withBrightnessMode(BrightnessMode.AUTO.toRaw()));
-    }
-
-    @Test
-    public void testGetAudio() {
-        local.getAudio();
-    }
-
-    @Test
-    public void testUpdateAudio() throws UpdateException {
-        local.updateAudio(new Audio().withVolume(25));
-    }
-
-    @Test
-    public void testGetBluetooth() {
-        local.getBluetooth();
-    }
-
-    @Test
-    public void testUpdateBluetooth() throws UpdateException {
-        local.updateBluetooth(new Bluetooth().withActive(false));
-    }
-
-    @Test
-    public void testGetWifi() {
-        local.getWifi();
-    }
-
-    @Test
-    public void testGetApplications() {
-        local.getApplications();
-    }
-
-    @Test
-    public void testGetClockApplication() throws ApplicationNotFoundException {
-        local.getApplication(CoreApps.clock().getPackageName());
-    }
-
-    @Test
-    public void testGetCountdownApplication() throws ApplicationNotFoundException {
-        local.getApplication(CoreApps.countdown().getPackageName());
-    }
-
-    @Test
-    public void testGetRadioApplication() throws ApplicationNotFoundException {
-        local.getApplication(CoreApps.radio().getPackageName());
-    }
-
-    @Test
-    public void testGetStopwatchApplication() throws ApplicationNotFoundException {
-        local.getApplication(CoreApps.stopwatch().getPackageName());
-    }
-
-    @Test
-    public void testGetWeatherApplication() throws ApplicationNotFoundException {
-        local.getApplication(CoreApps.weather().getPackageName());
-    }
-
-    @Test
-    public void testGetInvalidApplication() {
-        assertThrows(ApplicationNotFoundException.class, () -> local.getApplication("invalid"));
-    }
-
-    @Test
-    public void testActivatePreviousApplication() {
-        local.activatePreviousApplication();
-    }
-
-    @Test
-    public void testActivateNextApplication() {
-        local.activateNextApplication();
-    }
-
-    @Test
-    public void testActivateApplication() throws ApplicationActivationException, ApplicationNotFoundException {
-        // delete any notifications on the device or else the activate fails
-        local.getNotifications().stream().forEach(n -> {
-            try {
-                local.deleteNotification(n.getId());
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        });
-
-        local.activateApplication(CoreApps.clock().getPackageName(),
-                local.getApplication(CoreApps.clock().getPackageName()).getWidgets().firstKey());
-    }
-
-    @Test
-    public void testDoAction() throws ApplicationActionException, ApplicationNotFoundException {
-        local.doAction(CoreApps.weather().getPackageName(),
-                local.getApplication(CoreApps.weather().getPackageName()).getWidgets().firstKey(),
-                CoreApps.weather().forecast().getAction());
-    }
-
-    private Notification buildSimpleNotification(int cycles) {
-        return new Notification().withPriority(Priority.CRITICAL.toRaw()).withModel(new NotificationModel()
-                .withCycles(cycles)
-                .withSound(new Sound().withCategory(SoundCategory.NOTIFICATIONS.toRaw())
-                        .withId(org.openhab.binding.lametrictime.api.model.enums.Sound.CAT.toRaw()))
-                .withFrames(Arrays.asList(new Frame().withText("CAT!").withIcon(
-                        "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAUklEQVQYlWNUVFBgYGBgYBC98uE/AxJ4rSPAyMDAwMCETRJZjAnGgOlAZote+fCfCV0nOmA0+yKAYTwygJuAzQoGBgYGRkUFBQZ0dyDzGQl5EwCTESNpFb6zEwAAAABJRU5ErkJggg=="))));
-    }
-
-    private Notification buildGoalNotification(int cycles) {
-        return new Notification().withPriority(Priority.CRITICAL.toRaw())
-                .withModel(new NotificationModel().withCycles(cycles).withFrames(Arrays.asList(new Frame()
-                        .withGoalData(new GoalData().withStart(0).withCurrent(50).withEnd(100).withUnit("%")).withIcon(
-                                "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAUklEQVQYlWNUVFBgYGBgYBC98uE/AxJ4rSPAyMDAwMCETRJZjAnGgOlAZote+fCfCV0nOmA0+yKAYTwygJuAzQoGBgYGRkUFBQZ0dyDzGQl5EwCTESNpFb6zEwAAAABJRU5ErkJggg=="))));
-    }
-
-    private Notification buildChartNotification(int cycles) {
-        return new Notification().withPriority(Priority.CRITICAL.toRaw()).withModel(new NotificationModel()
-                .withCycles(cycles)
-                .withFrames(Arrays.asList(new Frame().withChartData(Arrays.asList(1, 2, 3, 4, 5, 6, 7)).withIcon(
-                        "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAUklEQVQYlWNUVFBgYGBgYBC98uE/AxJ4rSPAyMDAwMCETRJZjAnGgOlAZote+fCfCV0nOmA0+yKAYTwygJuAzQoGBgYGRkUFBQZ0dyDzGQl5EwCTESNpFb6zEwAAAABJRU5ErkJggg=="))));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/ActionTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/ActionTest.java
deleted file mode 100644 (file)
index a8c71a2..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.FileReader;
-import java.util.Iterator;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-import com.google.gson.Gson;
-
-public class ActionTest extends AbstractTest
-{
-    private static Gson gson;
-
-    @BeforeAll
-    public static void setUpBeforeClass()
-    {
-        gson = GsonGenerator.create(true);
-    }
-
-    @Test
-    @SuppressWarnings("serial")
-    public void testSerialize() throws Exception
-    {
-        // @formatter:off
-        Action action = new Action().withParameters(new TreeMap<String, Parameter>(){{put("enabled", new BooleanParameter());
-                                                                                      put("time", new StringParameter());}});
-        // @formatter:on
-        assertEquals(readJson("action.json"), gson.toJson(action));
-    }
-
-    @Test
-    public void testDeserialize() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("action.json")))
-        {
-            Action action = gson.fromJson(reader, Action.class);
-            SortedMap<String, Parameter> parameters = action.getParameters();
-            assertNotNull(parameters);
-            assertEquals(2, parameters.size());
-
-            Iterator<String> parametersIter = parameters.keySet().iterator();
-            assertEquals("enabled", parametersIter.next());
-            assertEquals("time", parametersIter.next());
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/ApplicationTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/ApplicationTest.java
deleted file mode 100644 (file)
index a450205..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.FileReader;
-import java.util.Iterator;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-import com.google.gson.Gson;
-
-public class ApplicationTest extends AbstractTest
-{
-    private static Gson gson;
-
-    @BeforeAll
-    public static void setUpBeforeClass()
-    {
-        gson = GsonGenerator.create(true);
-    }
-
-    @Test
-    @SuppressWarnings("serial")
-    public void testSerializeAllFields() throws Exception
-    {
-        Application app = new Application().withPackageName("com.lametric.radio")
-                                           .withVendor("LaMetric")
-                                           .withVersion("1.0.10")
-                                           .withVersionCode("22")
-                                           // @formatter:off
-                                           .withWidgets(new TreeMap<String, Widget>(){{put("589ed1b3fcdaa5180bf4848e55ba8061", new Widget());}})
-                                           .withActions(new TreeMap<String, Action>(){{put("radio.next", new Action());
-                                                                                       put("radio.play", new Action());
-                                                                                       put("radio.prev", new Action());
-                                                                                       put("radio.stop", new Action());}});
-                                           // @formatter:on
-        assertEquals(readJson("application-all.json"), gson.toJson(app));
-    }
-
-    @Test
-    public void testSerializeNullLists() throws Exception
-    {
-        Application app = new Application().withPackageName("com.lametric.radio")
-                                           .withVendor("LaMetric")
-                                           .withVersion("1.0.10")
-                                           .withVersionCode("22");
-        assertEquals(readJson("application-null-maps.json"), gson.toJson(app));
-    }
-
-    @Test
-    public void testDeserializeAllFields() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("application-all.json")))
-        {
-            Application app = gson.fromJson(reader, Application.class);
-            assertEquals("com.lametric.radio", app.getPackageName());
-            assertEquals("LaMetric", app.getVendor());
-            assertEquals("1.0.10", app.getVersion());
-            assertEquals("22", app.getVersionCode());
-
-            SortedMap<String, Widget> widgets = app.getWidgets();
-            assertNotNull(widgets);
-            assertEquals(1, widgets.size());
-            assertEquals("589ed1b3fcdaa5180bf4848e55ba8061", widgets.keySet().iterator().next());
-
-            SortedMap<String, Action> actions = app.getActions();
-            assertNotNull(actions);
-            assertEquals(4, actions.size());
-
-            Iterator<String> actionsIter = actions.keySet().iterator();
-            assertEquals("radio.next", actionsIter.next());
-            assertEquals("radio.play", actionsIter.next());
-            assertEquals("radio.prev", actionsIter.next());
-            assertEquals("radio.stop", actionsIter.next());
-        }
-    }
-
-    @Test
-    public void testDeserializeNullLists() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("application-null-maps.json")))
-        {
-            Application app = gson.fromJson(reader, Application.class);
-            assertEquals("com.lametric.radio", app.getPackageName());
-            assertEquals("LaMetric", app.getVendor());
-            assertEquals("1.0.10", app.getVersion());
-            assertEquals("22", app.getVersionCode());
-            assertNull(app.getWidgets());
-            assertNull(app.getActions());
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/AudioTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/AudioTest.java
deleted file mode 100644 (file)
index d44394f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.FileReader;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-import com.google.gson.Gson;
-
-public class AudioTest extends AbstractTest
-{
-    private static Gson gson;
-
-    @BeforeAll
-    public static void setUpBeforeClass()
-    {
-        gson = GsonGenerator.create(true);
-    }
-
-    @Test
-    public void testSerializeAllFields() throws Exception
-    {
-        Audio audio = new Audio().withVolume(42);
-        assertEquals(readJson("audio.json"), gson.toJson(audio));
-    }
-
-    @Test
-    public void testDeserializeAllFields() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("audio.json")))
-        {
-            Audio audio = gson.fromJson(reader, Audio.class);
-            assertEquals(Integer.valueOf(42), audio.getVolume());
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/BluetoothTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/BluetoothTest.java
deleted file mode 100644 (file)
index b9de4e4..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.FileReader;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-import com.google.gson.Gson;
-
-public class BluetoothTest extends AbstractTest
-{
-    private static Gson gson;
-
-    @BeforeAll
-    public static void setUpBeforeClass()
-    {
-        gson = GsonGenerator.create(true);
-    }
-
-    @Test
-    public void testSerializeAllFields() throws Exception
-    {
-        Bluetooth bluetooth = new Bluetooth().withActive(false)
-                                             .withAvailable(true)
-                                             .withDiscoverable(false)
-                                             .withMac("AA:AA:AA:AA:AA:AA")
-                                             .withName("LM9999")
-                                             .withPairable(true);
-        assertEquals(readJson("bluetooth-mac-address.json"), gson.toJson(bluetooth));
-    }
-
-    @Test
-    public void testDeserializeMac() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("bluetooth-mac.json")))
-        {
-            Bluetooth bluetooth = gson.fromJson(reader, Bluetooth.class);
-            assertEquals(false, bluetooth.isActive());
-            assertEquals(true, bluetooth.isAvailable());
-            assertEquals(false, bluetooth.isDiscoverable());
-            assertEquals("AA:AA:AA:AA:AA:AA", bluetooth.getMac());
-            assertEquals("LM9999", bluetooth.getName());
-            assertEquals(true, bluetooth.isPairable());
-        }
-    }
-
-    @Test
-    public void testDeserializeAddress() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("bluetooth-address.json")))
-        {
-            Bluetooth bluetooth = gson.fromJson(reader, Bluetooth.class);
-            assertEquals(false, bluetooth.isActive());
-            assertEquals(true, bluetooth.isAvailable());
-            assertEquals(false, bluetooth.isDiscoverable());
-            assertEquals("AA:AA:AA:AA:AA:AA", bluetooth.getMac());
-            assertEquals("LM9999", bluetooth.getName());
-            assertEquals(true, bluetooth.isPairable());
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/FrameTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/FrameTest.java
deleted file mode 100644 (file)
index 7cebb03..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.FileReader;
-import java.util.Arrays;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-import com.google.gson.Gson;
-
-public class FrameTest extends AbstractTest
-{
-    private static Gson gson;
-
-    @BeforeAll
-    public static void setUpBeforeClass()
-    {
-        gson = GsonGenerator.create(true);
-    }
-
-    @Test
-    public void testSerializeSimple() throws Exception
-    {
-        Frame frame = new Frame().withIcon("i87").withText("Hello world!");
-        assertEquals(readJson("frame-simple.json"), gson.toJson(frame));
-    }
-
-    @Test
-    public void testSerializeGoal() throws Exception
-    {
-        Frame frame = new Frame().withIcon("i120").withGoalData(new GoalData());
-        assertEquals(readJson("frame-goal.json"), gson.toJson(frame));
-    }
-
-    @Test
-    public void testSerializeChart() throws Exception
-    {
-        Frame frame = new Frame().withChartData(Arrays.asList(1, 2, 3, 4, 5, 6, 7));
-        assertEquals(readJson("frame-chart.json"), gson.toJson(frame));
-    }
-
-    @Test
-    public void testDeserializeSimple() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("frame-simple.json")))
-        {
-            Frame frame = gson.fromJson(reader, Frame.class);
-            assertEquals("i87", frame.getIcon());
-            assertEquals("Hello world!", frame.getText());
-            assertEquals(null, frame.getGoalData());
-            assertEquals(null, frame.getChartData());
-        }
-    }
-
-    @Test
-    public void testDeserializeGoal() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("frame-goal.json")))
-        {
-            Frame frame = gson.fromJson(reader, Frame.class);
-            assertEquals("i120", frame.getIcon());
-            assertEquals(new GoalData(), frame.getGoalData());
-        }
-    }
-
-    @Test
-    public void testDeserializeChart() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("frame-chart.json")))
-        {
-            Frame frame = gson.fromJson(reader, Frame.class);
-            assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7), frame.getChartData());
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/GoalDataTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/GoalDataTest.java
deleted file mode 100644 (file)
index 1324688..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.FileReader;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-import com.google.gson.Gson;
-
-public class GoalDataTest extends AbstractTest
-{
-    private static Gson gson;
-
-    @BeforeAll
-    public static void setUpBeforeClass()
-    {
-        gson = GsonGenerator.create(true);
-    }
-
-    @Test
-    public void testSerializeSimple() throws Exception
-    {
-        GoalData goalData = new GoalData().withStart(0).withEnd(100).withCurrent(50).withUnit("%");
-        assertEquals(readJson("goal-data.json"), gson.toJson(goalData));
-    }
-
-    @Test
-    public void testDeserializeSimple() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("goal-data.json")))
-        {
-            GoalData goalData = gson.fromJson(reader, GoalData.class);
-            assertEquals(Integer.valueOf(0), goalData.getStart());
-            assertEquals(Integer.valueOf(100), goalData.getEnd());
-            assertEquals(Integer.valueOf(50), goalData.getCurrent());
-            assertEquals("%", goalData.getUnit());
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/UpdateActionTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/UpdateActionTest.java
deleted file mode 100644 (file)
index 03f283c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.FileReader;
-import java.util.TreeMap;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-import com.google.gson.Gson;
-
-public class UpdateActionTest extends AbstractTest {
-    private static Gson gson;
-
-    @BeforeAll
-    public static void setUpBeforeClass() {
-        gson = GsonGenerator.create(true);
-    }
-
-    @Test
-    @SuppressWarnings("serial")
-    public void testSerialize() throws Exception {
-        UpdateAction action = new UpdateAction().withId("countdown.configure")
-        // @formatter:off
-                                                .withParameters(new TreeMap<String, Parameter>(){{put("duration", new IntegerParameter().withValue(30));}});
-                                                // @formatter:on
-        assertEquals(readJson("update-action.json"), gson.toJson(action));
-    }
-
-    @Test
-    public void testDeserialize() throws Exception {
-        try (FileReader reader = new FileReader(getTestDataFile("update-action.json"))) {
-            assertThrows(UnsupportedOperationException.class, () -> gson.fromJson(reader, UpdateAction.class));
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/WidgetTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/WidgetTest.java
deleted file mode 100644 (file)
index b3dc05e..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.FileReader;
-import java.util.HashMap;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonPrimitive;
-
-public class WidgetTest extends AbstractTest
-{
-    private static Gson gson;
-
-    @BeforeAll
-    public static void setUpBeforeClass()
-    {
-        gson = GsonGenerator.create(true);
-    }
-
-    @Test
-    @SuppressWarnings("serial")
-    public void testSerialize() throws Exception
-    {
-        Widget widget = new Widget().withPackageName("com.lametric.radio")
-                                    .withIndex(Integer.valueOf(-1))
-                                    .withSettings(new HashMap<String, JsonPrimitive>()
-                                    {
-                                        {
-                                            put("_title", new JsonPrimitive("Radio"));
-                                        }
-                                    });
-        assertEquals(readJson("widget.json"), gson.toJson(widget));
-    }
-
-    @Test
-    @SuppressWarnings("serial")
-    public void testDeserialize() throws Exception
-    {
-        try (FileReader reader = new FileReader(getTestDataFile("widget.json")))
-        {
-            Widget widget = gson.fromJson(reader, Widget.class);
-            assertEquals("com.lametric.radio", widget.getPackageName());
-            assertEquals(Integer.valueOf(-1), widget.getIndex());
-            assertEquals(new HashMap<String, JsonPrimitive>()
-            {
-                {
-                    put("_title", new JsonPrimitive("Radio"));
-                }
-            }, widget.getSettings());
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/WidgetUpdatesTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/local/model/WidgetUpdatesTest.java
deleted file mode 100644 (file)
index c59ea62..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.local.model;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
-import org.openhab.binding.lametrictime.api.test.AbstractTest;
-
-import com.google.gson.Gson;
-
-public class WidgetUpdatesTest extends AbstractTest {
-    private static Gson gson;
-
-    @BeforeAll
-    public static void setUpBeforeClass() {
-        gson = GsonGenerator.create(true);
-    }
-
-    @Test
-    public void testSerialize() throws Exception {
-        WidgetUpdates widgetUpdates = new WidgetUpdates()
-                .withFrames(Arrays.asList(new Frame().withIcon("i120").withText("12°").withIndex(0)));
-
-        assertEquals(readJson("widget-updates.json"), gson.toJson(widgetUpdates));
-    }
-
-    @Test
-    public void testDeserialize() throws Exception {
-        try (InputStreamReader reader = new InputStreamReader(
-                new FileInputStream(getTestDataFile("widget-updates.json")), StandardCharsets.UTF_8)) {
-            WidgetUpdates widgetUpdates = gson.fromJson(reader, WidgetUpdates.class);
-            assertEquals("i120", widgetUpdates.getFrames().get(0).getIcon());
-            assertEquals("12°", widgetUpdates.getFrames().get(0).getText());
-            assertEquals(null, widgetUpdates.getFrames().get(0).getGoalData());
-            assertEquals(null, widgetUpdates.getFrames().get(0).getChartData());
-        }
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/BrightnessModeTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/BrightnessModeTest.java
deleted file mode 100644 (file)
index d65608d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-
-public class BrightnessModeTest {
-    @Test
-    public void testConversion() {
-        for (BrightnessMode value : BrightnessMode.values()) {
-            assertEquals(value, BrightnessMode.toEnum(value.toRaw()));
-        }
-    }
-
-    @Test
-    public void testInvalidRawValue() {
-        assertNull(BrightnessMode.toEnum("invalid raw value"));
-    }
-
-    @Test
-    public void testNullRawValue() {
-        assertNull(BrightnessMode.toEnum(null));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/DisplayTypeTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/DisplayTypeTest.java
deleted file mode 100644 (file)
index bfdd907..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-
-public class DisplayTypeTest {
-    @Test
-    public void testConversion() {
-        for (DisplayType value : DisplayType.values()) {
-            assertEquals(value, DisplayType.toEnum(value.toRaw()));
-        }
-    }
-
-    @Test
-    public void testInvalidRawValue() {
-        assertNull(DisplayType.toEnum("invalid raw value"));
-    }
-
-    @Test
-    public void testNullRawValue() {
-        assertNull(DisplayType.toEnum(null));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/IconTypeTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/IconTypeTest.java
deleted file mode 100644 (file)
index 5bba625..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-
-public class IconTypeTest {
-    @Test
-    public void testConversion() {
-        for (IconType value : IconType.values()) {
-            assertEquals(value, IconType.toEnum(value.toRaw()));
-        }
-    }
-
-    @Test
-    public void testInvalidRawValue() {
-        assertNull(IconType.toEnum("invalid raw value"));
-    }
-
-    @Test
-    public void testNullRawValue() {
-        assertNull(IconType.toEnum(null));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/IpModeTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/IpModeTest.java
deleted file mode 100644 (file)
index 9598236..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-
-public class IpModeTest {
-    @Test
-    public void testConversion() {
-        for (IpMode value : IpMode.values()) {
-            assertEquals(value, IpMode.toEnum(value.toRaw()));
-        }
-    }
-
-    @Test
-    public void testInvalidRawValue() {
-        assertNull(IpMode.toEnum("invalid raw value"));
-    }
-
-    @Test
-    public void testNullRawValue() {
-        assertNull(IpMode.toEnum(null));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/PriorityTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/PriorityTest.java
deleted file mode 100644 (file)
index c6ff152..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-
-public class PriorityTest {
-    @Test
-    public void testConversion() {
-        for (Priority value : Priority.values()) {
-            assertEquals(value, Priority.toEnum(value.toRaw()));
-        }
-    }
-
-    @Test
-    public void testInvalidRawValue() {
-        assertNull(Priority.toEnum("invalid raw value"));
-    }
-
-    @Test
-    public void testNullRawValue() {
-        assertNull(Priority.toEnum(null));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/SoundCategoryTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/SoundCategoryTest.java
deleted file mode 100644 (file)
index bef0a94..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-
-public class SoundCategoryTest {
-    @Test
-    public void testConversion() {
-        for (SoundCategory value : SoundCategory.values()) {
-            assertEquals(value, SoundCategory.toEnum(value.toRaw()));
-        }
-    }
-
-    @Test
-    public void testInvalidRawValue() {
-        assertNull(SoundCategory.toEnum("invalid raw value"));
-    }
-
-    @Test
-    public void testNullRawValue() {
-        assertNull(SoundCategory.toEnum(null));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/SoundTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/SoundTest.java
deleted file mode 100644 (file)
index 1e3c895..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-
-public class SoundTest {
-    @Test
-    public void testConversion() {
-        for (Sound value : Sound.values()) {
-            assertEquals(value, Sound.toEnum(value.toRaw()));
-        }
-    }
-
-    @Test
-    public void testInvalidRawValue() {
-        assertNull(Sound.toEnum("invalid raw value"));
-    }
-
-    @Test
-    public void testNullRawValue() {
-        assertNull(Sound.toEnum(null));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/WifiEncryptionTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/model/enums/WifiEncryptionTest.java
deleted file mode 100644 (file)
index 724efee..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.model.enums;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-
-public class WifiEncryptionTest {
-    @Test
-    public void testConversion() {
-        for (WifiEncryption value : WifiEncryption.values()) {
-            assertEquals(value, WifiEncryption.toEnum(value.toRaw()));
-        }
-    }
-
-    @Test
-    public void testInvalidRawValue() {
-        assertNull(WifiEncryption.toEnum("invalid raw value"));
-    }
-
-    @Test
-    public void testNullRawValue() {
-        assertNull(WifiEncryption.toEnum(null));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/test/AbstractTest.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/test/AbstractTest.java
deleted file mode 100644 (file)
index 18b0f81..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.test;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-public abstract class AbstractTest {
-    protected File getTestDataFile(String name) {
-        return getTestDataPath(name).toFile();
-    }
-
-    protected Path getTestDataPath(String name) {
-        return TestUtil.getTestDataPath(this.getClass(), name);
-    }
-
-    protected String readJson(String jsonFileName) throws IOException {
-        return String.join("\n", Files.readAllLines(getTestDataPath(jsonFileName)));
-    }
-}
diff --git a/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/test/TestUtil.java b/bundles/org.openhab.binding.lametrictime/src/3rdparty/test/org/openhab/binding/lametrictime/api/test/TestUtil.java
deleted file mode 100644 (file)
index 1862e62..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright 2017-2018 Gregory Moyer and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openhab.binding.lametrictime.api.test;
-
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class TestUtil
-{
-    private static final String RESOURCES_PATH = "src/test/resources/";
-
-    public static Path getTestDataPath(Class<?> clazz, String name)
-    {
-        String packageName = clazz.getPackage().getName();
-
-        List<String> paths = new ArrayList<>();
-        paths.addAll(Arrays.asList(packageName.split("\\.")));
-        paths.add(name);
-
-        return Paths.get(RESOURCES_PATH, paths.toArray(new String[paths.size()]));
-    }
-
-    // @formatter:off
-    private TestUtil() {}
-    // @formatter:on
-}
index 83dd5bdcb19971e35a819a1730431215f8253ce2..99d905416d64ac4a5e66e5c6ea348ef173066c8f 100644 (file)
@@ -29,7 +29,8 @@ import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
-import org.openhab.binding.lametrictime.api.common.impl.GsonGenerator;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
 import org.osgi.service.component.annotations.Component;
 
 import com.google.gson.Gson;
@@ -54,18 +55,21 @@ public class GsonProvider<T> implements MessageBodyReader<T>, MessageBodyWriter<
     }
 
     @Override
-    public long getSize(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    public long getSize(T t, @Nullable Class<?> type, @Nullable Type genericType, Annotation @Nullable [] annotations,
+            @Nullable MediaType mediaType) {
         return -1;
     }
 
     @Override
-    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    public boolean isWriteable(@Nullable Class<?> type, @Nullable Type genericType, Annotation @Nullable [] annotations,
+            @Nullable MediaType mediaType) {
         return true;
     }
 
     @Override
-    public void writeTo(T object, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
-            MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
+    public void writeTo(T object, @Nullable Class<?> type, @Nullable Type genericType,
+            Annotation @Nullable [] annotations, @Nullable MediaType mediaType,
+            @Nullable MultivaluedMap<String, Object> httpHeaders, @Nullable OutputStream entityStream)
             throws IOException, WebApplicationException {
         try (OutputStream stream = entityStream) {
             entityStream.write(gson.toJson(object).getBytes(StandardCharsets.UTF_8));
@@ -74,14 +78,15 @@ public class GsonProvider<T> implements MessageBodyReader<T>, MessageBodyWriter<
     }
 
     @Override
-    public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    public boolean isReadable(@Nullable Class<?> type, @Nullable Type genericType, Annotation @Nullable [] annotations,
+            @Nullable MediaType mediaType) {
         return true;
     }
 
     @Override
-    public T readFrom(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType,
-            MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
-            throws IOException, WebApplicationException {
+    public T readFrom(@Nullable Class<T> type, @Nullable Type genericType, Annotation @Nullable [] annotations,
+            @Nullable MediaType mediaType, @Nullable MultivaluedMap<String, String> httpHeaders,
+            @Nullable InputStream entityStream) throws IOException, WebApplicationException {
         try (InputStreamReader reader = new InputStreamReader(entityStream, StandardCharsets.UTF_8)) {
             return gson.fromJson(reader, type);
         }
index 5a2c2724a914f6c785befc7ff3c4bd27ce087d45..ca40a7da7944bd828678f07225a48167193bb548 100644 (file)
  */
 package org.openhab.binding.lametrictime.internal;
 
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
 /**
  * The {@link LaMetricTimeConfigStatusMessage} defines the keys to be used for configuration status messages.
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class LaMetricTimeConfigStatusMessage {
     public static final String HOST_MISSING = "missing-host-configuration";
     public static final String API_KEY_MISSING = "missing-api-key-configuration";
index c533a9ccfc83b0f5d8187b4a471e448c2f857c34..5eff62b7e1d27e85f3759daefb7071c45165802a 100644 (file)
@@ -15,9 +15,10 @@ package org.openhab.binding.lametrictime.internal;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.openhab.binding.lametrictime.api.local.model.Application;
-import org.openhab.binding.lametrictime.api.local.model.Widget;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Application;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Widget;
 
 import com.google.gson.JsonPrimitive;
 
@@ -26,6 +27,7 @@ import com.google.gson.JsonPrimitive;
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class LaMetricTimeUtil {
     private static final Map<String, String> CORE_APP_LABELS = new HashMap<>();
     static {
index 26011f778afc2f31b75bde7d476e78e24d502605..6836e0dc33b615644251e60fcf47887cca3de5b7 100644 (file)
  */
 package org.openhab.binding.lametrictime.internal;
 
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
 /**
  * This bean represents the information necessary to uniquely reference a widget on the LaMetric Time platform.
  *
  * @author Gregor Moyer - Initial contribution
  */
+@NonNullByDefault
 public class WidgetRef {
     private final String packageName;
     private final String widgetId;
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/Configuration.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/Configuration.java
new file mode 100644 (file)
index 0000000..8d1e4f9
--- /dev/null
@@ -0,0 +1,140 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.cloud.CloudConfiguration;
+import org.openhab.binding.lametrictime.internal.api.local.LocalConfiguration;
+
+/**
+ * Configuration class for LaMetric Time.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class Configuration {
+    @Nullable
+    private String deviceHost;
+    @Nullable
+    private String deviceApiKey;
+
+    private boolean ignoreDeviceCertificateValidation = true;
+    private boolean ignoreDeviceHostnameValidation = true;
+
+    private boolean logging = false;
+    private String logLevel = "INFO";
+    private int logMax = 104857600; // 100kb
+
+    public @Nullable String getDeviceHost() {
+        return deviceHost;
+    }
+
+    public void setDeviceHost(String deviceHost) {
+        this.deviceHost = deviceHost;
+    }
+
+    public Configuration withDeviceHost(@Nullable String deviceHost) {
+        this.deviceHost = deviceHost;
+        return this;
+    }
+
+    public @Nullable String getDeviceApiKey() {
+        return deviceApiKey;
+    }
+
+    public void setDeviceApiKey(String deviceApiKey) {
+        this.deviceApiKey = deviceApiKey;
+    }
+
+    public Configuration withDeviceApiKey(@Nullable String deviceApiKey) {
+        this.deviceApiKey = deviceApiKey;
+        return this;
+    }
+
+    public boolean isIgnoreDeviceCertificateValidation() {
+        return ignoreDeviceCertificateValidation;
+    }
+
+    public void setIgnoreDeviceCertificateValidation(boolean ignoreDeviceCertificateValidation) {
+        this.ignoreDeviceCertificateValidation = ignoreDeviceCertificateValidation;
+    }
+
+    public Configuration withIgnoreDeviceCertificateValidation(boolean ignoreDeviceCertificateValidation) {
+        this.ignoreDeviceCertificateValidation = ignoreDeviceCertificateValidation;
+        return this;
+    }
+
+    public boolean isIgnoreDeviceHostnameValidation() {
+        return ignoreDeviceHostnameValidation;
+    }
+
+    public void setIgnoreDeviceHostnameValidation(boolean ignoreDeviceHostnameValidation) {
+        this.ignoreDeviceHostnameValidation = ignoreDeviceHostnameValidation;
+    }
+
+    public Configuration withIgnoreDeviceHostnameValidation(boolean ignoreDeviceHostnameValidation) {
+        this.ignoreDeviceHostnameValidation = ignoreDeviceHostnameValidation;
+        return this;
+    }
+
+    public boolean isLogging() {
+        return logging;
+    }
+
+    public void setLogging(boolean logging) {
+        this.logging = logging;
+    }
+
+    public Configuration withLogging(boolean logging) {
+        this.logging = logging;
+        return this;
+    }
+
+    public String getLogLevel() {
+        return logLevel;
+    }
+
+    public void setLogLevel(String logLevel) {
+        this.logLevel = logLevel;
+    }
+
+    public Configuration withLogLevel(String logLevel) {
+        this.logLevel = logLevel;
+        return this;
+    }
+
+    public int getLogMax() {
+        return logMax;
+    }
+
+    public void setLogMax(int logMax) {
+        this.logMax = logMax;
+    }
+
+    public Configuration withLogMax(int logMax) {
+        this.logMax = logMax;
+        return this;
+    }
+
+    public LocalConfiguration getLocalConfig() {
+        return new LocalConfiguration().withHost(deviceHost).withApiKey(deviceApiKey)
+                .withIgnoreCertificateValidation(ignoreDeviceCertificateValidation)
+                .withIgnoreHostnameValidation(ignoreDeviceHostnameValidation).withLogging(logging)
+                .withLogLevel(logLevel).withLogMax(logMax);
+    }
+
+    public CloudConfiguration getCloudConfig() {
+        return new CloudConfiguration().withLogging(logging).withLogLevel(logLevel).withLogMax(logMax);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/LaMetricTime.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/LaMetricTime.java
new file mode 100644 (file)
index 0000000..86214b6
--- /dev/null
@@ -0,0 +1,443 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api;
+
+import javax.ws.rs.client.ClientBuilder;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.cloud.CloudConfiguration;
+import org.openhab.binding.lametrictime.internal.api.cloud.LaMetricTimeCloud;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreAction;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApplication;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.dto.Icon;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.BrightnessMode;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.Priority;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.Sound;
+import org.openhab.binding.lametrictime.internal.api.impl.LaMetricTimeImpl;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActionException;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActivationException;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationNotFoundException;
+import org.openhab.binding.lametrictime.internal.api.local.LaMetricTimeLocal;
+import org.openhab.binding.lametrictime.internal.api.local.LocalConfiguration;
+import org.openhab.binding.lametrictime.internal.api.local.NotificationCreationException;
+import org.openhab.binding.lametrictime.internal.api.local.UpdateException;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Application;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Audio;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Bluetooth;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Display;
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Widget;
+
+/**
+ * Interface for LaMetric Time devices.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public interface LaMetricTime {
+    /**
+     * Get the version identifier reported by the device.
+     *
+     * @return the version
+     */
+    public String getVersion();
+
+    /**
+     * Send a low priority message to the device.
+     *
+     * @param message
+     *            the text to display
+     * @return the identifier of the newly created notification
+     * @throws NotificationCreationException
+     *             if there is a communication error or malformed data
+     */
+    public String notifyInfo(String message) throws NotificationCreationException;
+
+    /**
+     * Send a medium priority message to the device.
+     *
+     * @param message
+     *            the text to display
+     * @return the identifier of the newly created notification
+     * @throws NotificationCreationException
+     *             if there is a communication error or malformed data
+     */
+    public String notifyWarning(String message) throws NotificationCreationException;
+
+    /**
+     * Send an urgent message to the device. The notification will not be
+     * automatically removed. The user will be required to dismiss this
+     * notification or it must be deleted through he API.
+     *
+     * @param message
+     *            the text to display
+     * @return the identifier of the newly created notification
+     * @throws NotificationCreationException
+     *             if there is a communication error or malformed data
+     */
+    public String notifyCritical(String message) throws NotificationCreationException;
+
+    /**
+     * Send a notification to the device.
+     *
+     * Priority is important. It defines the urgency of this notification as
+     * related to others in the queue and the current state of the device.
+     * <ol>
+     * <li>{@link Priority#INFO}: lowest priority; not shown when the
+     * screensaver is active; waits for its turn in the queue
+     * <li>{@link Priority#WARNING}: middle priority; not shown when the
+     * screensaver is active; preempts {@link Priority#INFO}
+     * <li>{@link Priority#CRITICAL}: highest priority; shown even when the
+     * screensaver is active; preempts all other notifications (to be used
+     * sparingly)
+     * </ol>
+     *
+     * @param message
+     *            the text to display
+     * @param priority
+     *            the urgency of this notification; defaults to
+     *            {@link Priority#INFO}
+     * @param icon
+     *            the icon to display next to the message; can be
+     *            <code>null</code>
+     * @param sound
+     *            the sound to play when the notification is displayed; can be
+     *            <code>null</code>
+     * @param messageRepeat
+     *            the number of times the message should be displayed before
+     *            being removed (use <code>0</code> to leave the notification on
+     *            the device until it is dismissed by the user or deleted
+     *            through the API)
+     * @param soundRepeat
+     *            the number of times to repeat the sound (use <code>0</code> to
+     *            keep the sound looping until the notification is dismissed by
+     *            the user or deleted through the API)
+     * @return the identifier of the newly created notification
+     * @throws NotificationCreationException
+     *             if there is a communication error or malformed data
+     */
+    public String notify(String message, Priority priority, Icon icon, Sound sound, int messageRepeat, int soundRepeat)
+            throws NotificationCreationException;
+
+    /**
+     * Get the built-in clock application. This applications displays the time
+     * and date. It also provides an alarm feature.
+     *
+     * @return the clock app
+     */
+    public @Nullable Application getClock();
+
+    /**
+     * Get the built-in countdown timer application. This application counts
+     * time down to zero when it sets off a beeper until it is reset. The
+     * countdown can also be paused.
+     *
+     * @return the countdown app
+     */
+    public @Nullable Application getCountdown();
+
+    /**
+     * Get the built-in radio application. The radio can play streams from the
+     * Internet. The streams are set up in a list and can be navigated using
+     * 'next' and 'previous' actions. The music can be started and stopped.
+     *
+     * @return the radio app
+     */
+    public @Nullable Application getRadio();
+
+    /**
+     * Get the built-in stopwatch application. The stopwatch counts time
+     * forwards and can be started, paused, and reset.
+     *
+     * @return the stopwatch app
+     */
+    public @Nullable Application getStopwatch();
+
+    /**
+     * Get the built-in weather application. This application displays the
+     * current weather conditions. It can also display the forecast for today
+     * and tomorrow.
+     *
+     * @return the weather app
+     */
+    public @Nullable Application getWeather();
+
+    /**
+     * Get any of the built-in applications.
+     *
+     * @param coreApp
+     *            the app to retrieve
+     * @return the requested app
+     */
+    public @Nullable Application getApplication(CoreApplication coreApp);
+
+    /**
+     * Get any application installed on the device.
+     *
+     * @param name
+     *            the name of the app to retrieve
+     * @return the requested app
+     * @throws ApplicationNotFoundException
+     *             if the requested app is not found on the device
+     */
+    public @Nullable Application getApplication(@Nullable String name) throws ApplicationNotFoundException;
+
+    /**
+     * Display the given built-in application on the device.
+     *
+     * @param coreApp
+     *            the app to activate
+     */
+    public void activateApplication(CoreApplication coreApp);
+
+    /**
+     * Display the first instance (widget) of the given application on the
+     * device.
+     *
+     * @param app
+     *            the app to activate
+     * @throws ApplicationActivationException
+     *             if the app fails to activate
+     */
+    public void activateApplication(Application app) throws ApplicationActivationException;
+
+    /**
+     * Display the given widget on the device. A widget is simply an instance of
+     * an application. Some applications can be installed more than once (e.g.
+     * the {@link CoreApps#weather() weather} app) and each instance is assigned
+     * a widget.
+     *
+     * @param widget
+     *            the application instance (widget) to activate
+     * @throws ApplicationActivationException
+     *             if the app fails to activate
+     */
+    public void activateWidget(Widget widget) throws ApplicationActivationException;
+
+    /**
+     * Perform the given action on the first instance (widget) of the
+     * corresponding built-in application. The widget will activate
+     * automatically before carrying out the action.
+     *
+     * @param coreAction
+     *            the action to perform
+     */
+    public void doAction(CoreAction coreAction);
+
+    /**
+     * Perform the given action on the first instance (widget) of the given
+     * application. The widget will activate automatically before carrying out
+     * the action.
+     *
+     * @param app
+     *            the app which understands the requested action
+     * @param action
+     *            the action to perform
+     * @throws ApplicationActionException
+     *             if the action cannot be performed
+     */
+    public void doAction(Application app, UpdateAction action) throws ApplicationActionException;
+
+    /**
+     * Perform the given core action on the given widget. A widget is simply an
+     * instance of an application. Some applications can be installed more than
+     * once (e.g. the {@link CoreApps#weather() weather} app) and each instance
+     * is assigned a widget. The widget will activate automatically before
+     * carrying out the action.
+     *
+     * @param widget
+     *            the widget which understands the requested core action
+     * @param action
+     *            the action to perform
+     * @throws ApplicationActionException
+     *             if the action cannot be performed
+     */
+    public void doAction(@Nullable Widget widget, CoreAction action) throws ApplicationActionException;
+
+    /**
+     * Perform the given action on the given widget. A widget is simply an
+     * instance of an application. Some applications can be installed more than
+     * once (e.g. the {@link CoreApps#weather() weather} app) and each instance
+     * is assigned a widget. The widget will activate automatically before
+     * carrying out the action.
+     *
+     * @param widget
+     *            the widget which understands the requested action
+     * @param action
+     *            the action to perform
+     * @throws ApplicationActionException
+     *             if the action cannot be performed
+     */
+    public void doAction(Widget widget, UpdateAction action) throws ApplicationActionException;
+
+    /**
+     * Set the display brightness. The {@link #setBrightnessMode(BrightnessMode)
+     * brightness mode} will also be set to {@link BrightnessMode#MANUAL}.
+     *
+     * @param brightness
+     *            the brightness value to set (must be between 0 and 100,
+     *            inclusive)
+     * @return the updated state of the display
+     * @throws UpdateException
+     *             if the update failed
+     */
+    public Display setBrightness(int brightness) throws UpdateException;
+
+    /**
+     * Set the brightness mode on the display. {@link BrightnessMode#MANUAL}
+     * will immediately respect the current brightness value while
+     * {@link BrightnessMode#AUTO} will ignore the brightness value and set the
+     * brightness based on ambient light intensity.
+     *
+     * @param mode
+     *            the mode to set
+     * @return the updated state of the display
+     * @throws UpdateException
+     *             if the update failed
+     */
+    public Display setBrightnessMode(BrightnessMode mode) throws UpdateException;
+
+    /**
+     * Set the speaker volume on the device.
+     *
+     * @param volume
+     *            the volume to set (must be between 0 and 100, inclusive)
+     * @return the update audio state
+     * @throws UpdateException
+     *             if the update failed
+     */
+    public Audio setVolume(int volume) throws UpdateException;
+
+    /**
+     * Mute the device's speakers. The current volume will be stored so that
+     * {@link #unmute()} will restored it. If the volume is currently at zero,
+     * no action will be taken.
+     *
+     * @return the update audio state
+     * @throws UpdateException
+     *             if the update failed
+     */
+    public Audio mute() throws UpdateException;
+
+    /**
+     * Restore the volume prior to {@link #mute()}. If the volume has not been
+     * muted previously and the volume is currently zero, it will be set to 50%.
+     *
+     * @return the update audio state
+     * @throws UpdateException
+     *             if the update failed
+     */
+    public Audio unmute() throws UpdateException;
+
+    /**
+     * Set the active state of the Bluetooth radio on the device.
+     *
+     * @param active
+     *            <code>true</code> to activate Bluetooth; <code>false</code> to
+     *            deactive it
+     * @return the updated state of Bluetooth on the device
+     * @throws UpdateException
+     *             if the update failed
+     */
+    public Bluetooth setBluetoothActive(boolean active) throws UpdateException;
+
+    /**
+     * Set the device name as seen via Bluetooth connectivity.
+     *
+     * @param name
+     *            the name to display on other devices
+     * @return the updated state of Bluetooth on the device
+     * @throws UpdateException
+     *             if the update failed
+     */
+    public Bluetooth setBluetoothName(String name) throws UpdateException;
+
+    /**
+     * Get the local API for more advanced interactions as well device inquiry.
+     *
+     * @return the local API
+     */
+    public LaMetricTimeLocal getLocalApi();
+
+    /**
+     * Get the cloud API for interacting with LaMetric's services.
+     *
+     * @return the cloud API
+     */
+    public LaMetricTimeCloud getCloudApi();
+
+    /**
+     * Create an instance of this API. For greater control over the
+     * configuration, see {@link #create(Configuration, ClientBuilder)},
+     * {@link #create(LocalConfiguration, CloudConfiguration)}, and
+     * {@link #create(LocalConfiguration, CloudConfiguration, ClientBuilder)}.
+     *
+     * @param config
+     *            the configuration parameters that the new instance will use
+     * @return the API instance
+     */
+    public static LaMetricTime create(Configuration config) {
+        return new LaMetricTimeImpl(config);
+    }
+
+    /**
+     * Create an instance of this API. For greater control over the
+     * configuration, see
+     * {@link #create(LocalConfiguration, CloudConfiguration, ClientBuilder)}.
+     *
+     * @param config
+     *            the configuration parameters that the new instance will use
+     * @param clientBuilder
+     *            the builder that will be used to create clients for
+     *            communicating with the device and cloud services
+     * @return the API instance
+     */
+    public static LaMetricTime create(Configuration config, ClientBuilder clientBuilder) {
+        return new LaMetricTimeImpl(config, clientBuilder);
+    }
+
+    /**
+     * Create an instance of this API specifying detailed configuration for both
+     * the local and cloud APIs. See also
+     * {@link #create(LocalConfiguration, CloudConfiguration, ClientBuilder)}.
+     *
+     * @param localConfig
+     *            the local API configuration for the new instance
+     * @param cloudConfig
+     *            the cloud API configuration for the new instance
+     * @return the API instance
+     */
+    public static LaMetricTime create(LocalConfiguration localConfig, CloudConfiguration cloudConfig) {
+        return new LaMetricTimeImpl(localConfig, cloudConfig);
+    }
+
+    /**
+     * Create an instance of this API specifying detailed configuration for both
+     * the local and cloud APIs as well as the generic client.
+     *
+     * @param localConfig
+     *            the local API configuration for the new instance
+     * @param cloudConfig
+     *            the cloud API configuration for the new instance
+     * @param clientBuilder
+     *            the builder that will be used to create clients for
+     *            communicating with the device and cloud services
+     * @return the API instance
+     */
+    public static LaMetricTime create(LocalConfiguration localConfig, CloudConfiguration cloudConfig,
+            ClientBuilder clientBuilder) {
+        return new LaMetricTimeImpl(localConfig, cloudConfig, clientBuilder);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/CloudConfiguration.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/CloudConfiguration.java
new file mode 100644 (file)
index 0000000..fb62ae4
--- /dev/null
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud;
+
+import java.net.URI;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Cloud configuration class for LaMetric Time.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class CloudConfiguration {
+    private URI baseUri = URI.create("https://developer.lametric.com/api/v2");
+
+    private boolean logging = false;
+    private String logLevel = "INFO";
+    private int logMax = 104857600; // 100kb
+
+    public URI getBaseUri() {
+        return baseUri;
+    }
+
+    public void setBaseUri(URI baseUri) {
+        this.baseUri = baseUri;
+    }
+
+    public CloudConfiguration withBaseUri(URI baseUri) {
+        this.baseUri = baseUri;
+        return this;
+    }
+
+    public boolean isLogging() {
+        return logging;
+    }
+
+    public void setLogging(boolean logging) {
+        this.logging = logging;
+    }
+
+    public CloudConfiguration withLogging(boolean logging) {
+        this.logging = logging;
+        return this;
+    }
+
+    public String getLogLevel() {
+        return logLevel;
+    }
+
+    public void setLogLevel(String logLevel) {
+        this.logLevel = logLevel;
+    }
+
+    public CloudConfiguration withLogLevel(String logLevel) {
+        this.logLevel = logLevel;
+        return this;
+    }
+
+    public int getLogMax() {
+        return logMax;
+    }
+
+    public void setLogMax(int logMax) {
+        this.logMax = logMax;
+    }
+
+    public CloudConfiguration withLogMax(int logMax) {
+        this.logMax = logMax;
+        return this;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/LaMetricTimeCloud.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/LaMetricTimeCloud.java
new file mode 100644 (file)
index 0000000..7a948a9
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud;
+
+import javax.ws.rs.client.ClientBuilder;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.cloud.dto.IconFilter;
+import org.openhab.binding.lametrictime.internal.api.cloud.dto.Icons;
+import org.openhab.binding.lametrictime.internal.api.cloud.impl.LaMetricTimeCloudImpl;
+
+/**
+ * Interface for LaMetric Time cloud.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public interface LaMetricTimeCloud {
+    public Icons getIcons();
+
+    public Icons getIcons(IconFilter filter);
+
+    public static LaMetricTimeCloud create(CloudConfiguration config) {
+        return new LaMetricTimeCloudImpl(config);
+    }
+
+    public static LaMetricTimeCloud create(CloudConfiguration config, ClientBuilder clientBuilder) {
+        return new LaMetricTimeCloudImpl(config, clientBuilder);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/Icon.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/Icon.java
new file mode 100644 (file)
index 0000000..5efa3aa
--- /dev/null
@@ -0,0 +1,119 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud.dto;
+
+/**
+ * Pojo for icon.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Icon {
+    private Integer id;
+    private String title;
+    private String code;
+    private IconType type;
+    private String category;
+    private String url;
+    private Thumb thumb;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Icon withId(Integer id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public Icon withTitle(String title) {
+        this.title = title;
+        return this;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public Icon withCode(String code) {
+        this.code = code;
+        return this;
+    }
+
+    public IconType getType() {
+        return type;
+    }
+
+    public void setType(IconType type) {
+        this.type = type;
+    }
+
+    public Icon withType(IconType type) {
+        this.type = type;
+        return this;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public Icon withCategory(String category) {
+        this.category = category;
+        return this;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public Icon withUrl(String url) {
+        this.url = url;
+        return this;
+    }
+
+    public Thumb getThumb() {
+        return thumb;
+    }
+
+    public void setThumb(Thumb thumb) {
+        this.thumb = thumb;
+    }
+
+    public Icon withThumb(Thumb thumb) {
+        this.thumb = thumb;
+        return this;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconField.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconField.java
new file mode 100644 (file)
index 0000000..bfc31ba
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud.dto;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Pojo for icon field.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum IconField {
+    @SerializedName("id")
+    ID,
+    @SerializedName("title")
+    TITLE,
+    @SerializedName("code")
+    CODE,
+    @SerializedName("type")
+    TYPE,
+    @SerializedName("url")
+    URL,
+    @SerializedName("thumb")
+    THUMB
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconFilter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconFilter.java
new file mode 100644 (file)
index 0000000..21b0f14
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud.dto;
+
+import java.util.List;
+
+/**
+ * Pojo for icon filter.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class IconFilter {
+    private Integer page;
+    private Integer pageSize;
+    private List<IconField> fields;
+    private IconOrder order;
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public IconFilter withPage(Integer page) {
+        this.page = page;
+        return this;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public IconFilter withPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+        return this;
+    }
+
+    public List<IconField> getFields() {
+        return fields;
+    }
+
+    public String getFieldsString() {
+        if (fields == null || fields.isEmpty()) {
+            return null;
+        }
+
+        StringBuilder builder = new StringBuilder();
+        builder.append(fields.get(0).name().toLowerCase());
+
+        for (int i = 1; i < fields.size(); i++) {
+            builder.append(',').append(fields.get(i).name().toLowerCase());
+        }
+
+        return builder.toString();
+    }
+
+    public void setFields(List<IconField> fields) {
+        this.fields = fields;
+    }
+
+    public IconFilter withFields(List<IconField> fields) {
+        this.fields = fields;
+        return this;
+    }
+
+    public IconOrder getOrder() {
+        return order;
+    }
+
+    public String getOrderString() {
+        return order == null ? null : order.name().toLowerCase();
+    }
+
+    public void setOrder(IconOrder order) {
+        this.order = order;
+    }
+
+    public IconFilter withOrder(IconOrder order) {
+        this.order = order;
+        return this;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconOrder.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconOrder.java
new file mode 100644 (file)
index 0000000..e745dd0
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud.dto;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Enum for icon order.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum IconOrder {
+    @SerializedName("popular")
+    POPULAR,
+    @SerializedName("newest")
+    NEWEST,
+    @SerializedName("title")
+    TITLE
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconType.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconType.java
new file mode 100644 (file)
index 0000000..ee388a9
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud.dto;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Enum for icon type.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum IconType {
+    @SerializedName("picture")
+    PICTURE,
+    @SerializedName("movie")
+    MOVIE
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/Icons.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/Icons.java
new file mode 100644 (file)
index 0000000..d269f56
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Pojo for icons.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Icons {
+    private IconsMetadata meta;
+    private List<Icon> data = new ArrayList<Icon>();
+
+    public IconsMetadata getMeta() {
+        return meta;
+    }
+
+    public void setMeta(IconsMetadata meta) {
+        this.meta = meta;
+    }
+
+    public Icons withMeta(IconsMetadata meta) {
+        this.meta = meta;
+        return this;
+    }
+
+    public List<Icon> getData() {
+        return data;
+    }
+
+    public void setData(List<Icon> data) {
+        this.data = data;
+    }
+
+    public Icons withData(List<Icon> data) {
+        this.data = data;
+        return this;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconsMetadata.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/IconsMetadata.java
new file mode 100644 (file)
index 0000000..5e0d6c4
--- /dev/null
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud.dto;
+
+/**
+ * Pojo for icons metadata.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class IconsMetadata {
+    private Integer totalIconCount;
+    private Integer page;
+    private Integer pageSize;
+    private Integer pageCount;
+
+    public Integer getTotalIconCount() {
+        return totalIconCount;
+    }
+
+    public void setTotalIconCount(Integer totalIconCount) {
+        this.totalIconCount = totalIconCount;
+    }
+
+    public IconsMetadata withTotalIconCount(Integer totalIconCount) {
+        this.totalIconCount = totalIconCount;
+        return this;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public IconsMetadata withPage(Integer page) {
+        this.page = page;
+        return this;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public IconsMetadata withPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+        return this;
+    }
+
+    public Integer getPageCount() {
+        return pageCount;
+    }
+
+    public void setPageCount(Integer pageCount) {
+        this.pageCount = pageCount;
+    }
+
+    public IconsMetadata withPageCount(Integer pageCount) {
+        this.pageCount = pageCount;
+        return this;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/Thumb.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/dto/Thumb.java
new file mode 100644 (file)
index 0000000..9c87f5c
--- /dev/null
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud.dto;
+
+/**
+ * Pojo for thumb.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Thumb {
+    private String original;
+    private String small;
+    private String large;
+    private String xlarge;
+
+    public String getOriginal() {
+        return original;
+    }
+
+    public void setOriginal(String original) {
+        this.original = original;
+    }
+
+    public Thumb withOriginal(String original) {
+        this.original = original;
+        return this;
+    }
+
+    public String getSmall() {
+        return small;
+    }
+
+    public void setSmall(String small) {
+        this.small = small;
+    }
+
+    public Thumb withSmall(String small) {
+        this.small = small;
+        return this;
+    }
+
+    public String getLarge() {
+        return large;
+    }
+
+    public void setLarge(String large) {
+        this.large = large;
+    }
+
+    public Thumb withLarge(String large) {
+        this.large = large;
+        return this;
+    }
+
+    public String getXlarge() {
+        return xlarge;
+    }
+
+    public void setXlarge(String xlarge) {
+        this.xlarge = xlarge;
+    }
+
+    public Thumb withXlarge(String xlarge) {
+        this.xlarge = xlarge;
+        return this;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/impl/LaMetricTimeCloudImpl.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/cloud/impl/LaMetricTimeCloudImpl.java
new file mode 100644 (file)
index 0000000..bb48c5c
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.cloud.impl;
+
+import java.util.logging.Logger;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.core.MediaType;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.GsonProvider;
+import org.openhab.binding.lametrictime.internal.api.cloud.CloudConfiguration;
+import org.openhab.binding.lametrictime.internal.api.cloud.LaMetricTimeCloud;
+import org.openhab.binding.lametrictime.internal.api.cloud.dto.IconFilter;
+import org.openhab.binding.lametrictime.internal.api.cloud.dto.Icons;
+import org.openhab.binding.lametrictime.internal.api.common.impl.AbstractClient;
+import org.openhab.binding.lametrictime.internal.api.filter.LoggingFilter;
+
+/**
+ * Implementation class for LaMetricTimeCloud interface.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class LaMetricTimeCloudImpl extends AbstractClient implements LaMetricTimeCloud {
+    private final CloudConfiguration config;
+
+    public LaMetricTimeCloudImpl(CloudConfiguration config) {
+        this.config = config;
+    }
+
+    public LaMetricTimeCloudImpl(CloudConfiguration config, ClientBuilder clientBuilder) {
+        super(clientBuilder);
+        this.config = config;
+    }
+
+    @Override
+    public Icons getIcons() {
+        return getClient().target(config.getBaseUri()).path("/icons").request(MediaType.APPLICATION_JSON_TYPE)
+                .get(Icons.class);
+    }
+
+    @Override
+    public Icons getIcons(@Nullable IconFilter filter) {
+        return getClient().target(config.getBaseUri()).path("/icons").queryParam("page", filter.getPage())
+                .queryParam("page_size", filter.getPageSize()).queryParam("fields", filter.getFieldsString())
+                .queryParam("order", filter.getOrderString()).request(MediaType.APPLICATION_JSON_TYPE).get(Icons.class);
+    }
+
+    @Override
+    protected Client createClient() {
+        ClientBuilder builder = getClientBuilder();
+
+        // setup Gson (de)serialization
+        GsonProvider<Object> gsonProvider = new GsonProvider<>();
+        builder.register(gsonProvider);
+
+        // turn on logging if requested
+        if (config.isLogging()) {
+            builder.register(
+                    new LoggingFilter(Logger.getLogger(LaMetricTimeCloudImpl.class.getName()), config.getLogMax()));
+        }
+
+        return builder.build();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/AbstractClient.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/AbstractClient.java
new file mode 100644 (file)
index 0000000..0e5bfa8
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.gson.Gson;
+
+/**
+ * Abstract class for clients.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public abstract class AbstractClient {
+    protected final ClientBuilder clientBuilder;
+
+    @Nullable
+    private volatile Client client;
+    @Nullable
+    private volatile Gson gson;
+
+    public AbstractClient() {
+        this(ClientBuilder.newBuilder());
+    }
+
+    public AbstractClient(ClientBuilder clientBuilder) {
+        this.clientBuilder = clientBuilder;
+    }
+
+    protected @Nullable Client getClient() {
+        if (client == null) {
+            synchronized (this) {
+                if (client == null) {
+                    client = createClient();
+                }
+            }
+        }
+
+        return client;
+    }
+
+    protected @Nullable Gson getGson() {
+        if (gson == null) {
+            synchronized (this) {
+                if (gson == null) {
+                    gson = createGson();
+                }
+            }
+        }
+
+        return gson;
+    }
+
+    protected abstract Client createClient();
+
+    protected Gson createGson() {
+        return GsonGenerator.create();
+    }
+
+    protected ClientBuilder getClientBuilder() {
+        return clientBuilder;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/GsonGenerator.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/GsonGenerator.java
new file mode 100644 (file)
index 0000000..2d5b74d
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.ActionTypeAdapterFactory;
+import org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.ApplicationTypeAdapterFactory;
+import org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.UpdateActionTypeAdapterFactory;
+import org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported.JSR310TypeAdapters;
+import org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported.RuntimeTypeAdapterFactory;
+import org.openhab.binding.lametrictime.internal.api.local.dto.BooleanParameter;
+import org.openhab.binding.lametrictime.internal.api.local.dto.IntegerParameter;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Parameter;
+import org.openhab.binding.lametrictime.internal.api.local.dto.StringParameter;
+
+import com.google.gson.FieldNamingPolicy;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+/**
+ * Class for json generation support.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class GsonGenerator {
+    public static Gson create() {
+        return create(false);
+    }
+
+    public static Gson create(boolean prettyPrint) {
+        GsonBuilder builder = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
+                .registerTypeAdapterFactory(new ApplicationTypeAdapterFactory())
+                .registerTypeAdapterFactory(new ActionTypeAdapterFactory())
+                .registerTypeAdapterFactory(new UpdateActionTypeAdapterFactory())
+                .registerTypeAdapterFactory(RuntimeTypeAdapterFactory.of(Parameter.class, "data_type")
+                        .registerSubtype(BooleanParameter.class, "bool")
+                        .registerSubtype(StringParameter.class, "string")
+                        .registerSubtype(IntegerParameter.class, "int"));
+
+        // add Java 8 Time API support
+        JSR310TypeAdapters.registerJSR310TypeAdapters(builder);
+
+        if (prettyPrint) {
+            builder.setPrettyPrinting();
+        }
+
+        return builder.create();
+    }
+
+    // @formatter:off
+    private GsonGenerator() {}
+    // @formatter:on
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/ActionTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/ActionTypeAdapterFactory.java
new file mode 100644 (file)
index 0000000..d8eae7c
--- /dev/null
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported.CustomizedTypeAdapterFactory;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Action;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+/**
+ * Adapter factory for actions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class ActionTypeAdapterFactory extends CustomizedTypeAdapterFactory<Action> {
+    private static final String PROPERTY_ID = "id";
+    private static final String PROPERTY_PARAMETERS = "params";
+
+    public ActionTypeAdapterFactory() {
+        super(Action.class);
+    }
+
+    @Override
+    protected void beforeWrite(Action source, JsonElement toSerialize) {
+        if (toSerialize == null || toSerialize.isJsonNull()) {
+            return;
+        }
+
+        JsonObject actionObj = toSerialize.getAsJsonObject();
+        if (actionObj == null || actionObj.isJsonNull()) {
+            return;
+        }
+
+        // rewrite parameters from a nested object (map) to properties on the action
+        JsonElement paramsElem = actionObj.get(PROPERTY_PARAMETERS);
+        if (paramsElem != null && !paramsElem.isJsonNull()) {
+            JsonObject paramsObj = paramsElem.getAsJsonObject();
+            actionObj.remove(PROPERTY_PARAMETERS);
+
+            for (Entry<String, JsonElement> entry : paramsObj.entrySet()) {
+                actionObj.add(entry.getKey(), entry.getValue());
+            }
+        }
+    }
+
+    @Override
+    protected void afterRead(@Nullable JsonElement deserialized) {
+        if (deserialized == null || deserialized.isJsonNull()) {
+            return;
+        }
+
+        JsonObject actionObj = deserialized.getAsJsonObject();
+        if (actionObj == null || actionObj.isJsonNull()) {
+            return;
+        }
+
+        if (actionObj.has(PROPERTY_PARAMETERS)) {
+            throw new IllegalArgumentException(
+                    "Attempting to deserialize Action that contains a colliding " + PROPERTY_PARAMETERS + " property");
+        }
+
+        // temporary list of field names
+        List<String> fields = new ArrayList<>();
+
+        // rewrite parameters to a nested object (map)
+        JsonObject paramsObj = new JsonObject();
+        for (Entry<String, JsonElement> entry : actionObj.entrySet()) {
+            // skip ID field
+            if (PROPERTY_ID.equals(entry.getKey())) {
+                continue;
+            }
+
+            String paramId = entry.getKey();
+            fields.add(paramId); // to be removed later
+
+            paramsObj.add(paramId, entry.getValue());
+        }
+        actionObj.add(PROPERTY_PARAMETERS, paramsObj);
+
+        // remove all fields other than the list
+        fields.forEach(field -> actionObj.remove(field));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/ApplicationTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/ApplicationTypeAdapterFactory.java
new file mode 100644 (file)
index 0000000..caa6296
--- /dev/null
@@ -0,0 +1,111 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters;
+
+import java.util.Map.Entry;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported.CustomizedTypeAdapterFactory;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Application;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+/**
+ * Adapter factory for applications.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class ApplicationTypeAdapterFactory extends CustomizedTypeAdapterFactory<Application> {
+    private static final String PROPERTY_ID = "id";
+    private static final String PROPERTY_WIDGETS = "widgets";
+    private static final String PROPERTY_ACTIONS = "actions";
+
+    public ApplicationTypeAdapterFactory() {
+        super(Application.class);
+    }
+
+    @Override
+    protected void beforeWrite(Application source, JsonElement toSerialize) {
+        if (toSerialize == null || toSerialize.isJsonNull()) {
+            return;
+        }
+
+        JsonObject appObj = toSerialize.getAsJsonObject();
+        if (appObj == null || appObj.isJsonNull()) {
+            return;
+        }
+
+        // remove widget IDs
+        JsonElement widgetsElem = appObj.get(PROPERTY_WIDGETS);
+        if (widgetsElem != null && !widgetsElem.isJsonNull()) {
+            for (Entry<String, JsonElement> entry : widgetsElem.getAsJsonObject().entrySet()) {
+                JsonElement widgetElem = entry.getValue();
+                if (widgetElem == null || widgetElem.isJsonNull()) {
+                    continue;
+                }
+                widgetElem.getAsJsonObject().remove(PROPERTY_ID);
+            }
+        }
+
+        // remove action IDs
+        JsonElement actionsElem = appObj.get(PROPERTY_ACTIONS);
+        if (actionsElem != null && !actionsElem.isJsonNull()) {
+            for (Entry<String, JsonElement> entry : actionsElem.getAsJsonObject().entrySet()) {
+                JsonElement actionElem = entry.getValue();
+                if (actionElem == null || actionElem.isJsonNull()) {
+                    continue;
+                }
+                actionElem.getAsJsonObject().remove(PROPERTY_ID);
+            }
+        }
+    }
+
+    @Override
+    protected void afterRead(@Nullable JsonElement deserialized) {
+        if (deserialized == null || deserialized.isJsonNull()) {
+            return;
+        }
+
+        JsonObject appObj = deserialized.getAsJsonObject();
+        if (appObj == null || appObj.isJsonNull()) {
+            return;
+        }
+
+        // inject widget IDs
+        JsonElement widgetsElem = appObj.get(PROPERTY_WIDGETS);
+        if (widgetsElem != null && !widgetsElem.isJsonNull()) {
+            for (Entry<String, JsonElement> entry : widgetsElem.getAsJsonObject().entrySet()) {
+                JsonElement widgetElem = entry.getValue();
+                if (widgetElem == null || widgetElem.isJsonNull()) {
+                    continue;
+                }
+                widgetElem.getAsJsonObject().addProperty(PROPERTY_ID, entry.getKey());
+            }
+        }
+
+        // inject action IDs
+        JsonElement actionsElem = appObj.get(PROPERTY_ACTIONS);
+        if (actionsElem != null && !actionsElem.isJsonNull()) {
+            for (Entry<String, JsonElement> entry : actionsElem.getAsJsonObject().entrySet()) {
+                JsonElement actionElem = entry.getValue();
+                if (actionElem == null || actionElem.isJsonNull()) {
+                    continue;
+                }
+                actionElem.getAsJsonObject().addProperty(PROPERTY_ID, entry.getKey());
+            }
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/UpdateActionTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/UpdateActionTypeAdapterFactory.java
new file mode 100644 (file)
index 0000000..b6bd525
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters;
+
+import java.util.Map.Entry;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported.CustomizedTypeAdapterFactory;
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+/**
+ * Adapter factory for update actions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class UpdateActionTypeAdapterFactory extends CustomizedTypeAdapterFactory<UpdateAction> {
+    private static final String PROPERTY_PARAMETERS = "params";
+    private static final String PROPERTY_VALUE = "value";
+
+    public UpdateActionTypeAdapterFactory() {
+        super(UpdateAction.class);
+    }
+
+    @Override
+    protected void beforeWrite(UpdateAction source, JsonElement toSerialize) {
+        if (toSerialize == null || toSerialize.isJsonNull()) {
+            return;
+        }
+
+        JsonObject actionObj = toSerialize.getAsJsonObject();
+        if (actionObj == null || actionObj.isJsonNull()) {
+            return;
+        }
+
+        // rewrite parameters map from {name => Parameter} to {name => value}
+        JsonElement paramsElem = actionObj.get(PROPERTY_PARAMETERS);
+        if (paramsElem != null && !paramsElem.isJsonNull()) {
+            JsonObject paramsObj = paramsElem.getAsJsonObject();
+            actionObj.remove(PROPERTY_PARAMETERS);
+
+            JsonObject newParamsObj = new JsonObject();
+            for (Entry<String, JsonElement> entry : paramsObj.entrySet()) {
+                newParamsObj.add(entry.getKey(), entry.getValue().getAsJsonObject().getAsJsonPrimitive(PROPERTY_VALUE));
+            }
+            actionObj.add(PROPERTY_PARAMETERS, newParamsObj);
+        }
+    }
+
+    @Override
+    protected void afterRead(@Nullable JsonElement deserialized) {
+        throw new UnsupportedOperationException(UpdateAction.class.getName() + " cannot be derialized");
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/CustomizedTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/CustomizedTypeAdapterFactory.java
new file mode 100644 (file)
index 0000000..bc7946a
--- /dev/null
@@ -0,0 +1,90 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Pulled from Stack Overflow answer located here: http://stackoverflow.com/a/11272452
+ * and placed in an appropriate package within this library.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.io.IOException;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.TypeAdapter;
+import com.google.gson.TypeAdapterFactory;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+
+/**
+ * Abstract type adapter factory.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public abstract class CustomizedTypeAdapterFactory<C> implements TypeAdapterFactory {
+    private final Class<C> customizedClass;
+
+    public CustomizedTypeAdapterFactory(Class<C> customizedClass) {
+        this.customizedClass = customizedClass;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked") // we use a runtime check to guarantee that 'C' and 'T' are equal
+    @Nullable
+    public final <T> TypeAdapter<T> create(@Nullable Gson gson, @Nullable TypeToken<T> type) {
+        return type.getRawType() == customizedClass
+                ? (TypeAdapter<T>) customizeMyClassAdapter(gson, (TypeToken<C>) type)
+                : null;
+    }
+
+    private TypeAdapter<C> customizeMyClassAdapter(@Nullable Gson gson, TypeToken<C> type) {
+        final TypeAdapter<C> delegate = gson.getDelegateAdapter(this, type);
+        final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
+        return new TypeAdapter<C>() {
+            @Override
+            public void write(JsonWriter out, @Nullable C value) throws IOException {
+                JsonElement tree = delegate.toJsonTree(value);
+                beforeWrite(value, tree);
+                elementAdapter.write(out, tree);
+            }
+
+            @Override
+            public @Nullable C read(JsonReader in) throws IOException {
+                JsonElement tree = elementAdapter.read(in);
+                afterRead(tree);
+                if (tree == null) {
+                    throw new IOException("null reader");
+                }
+                return delegate.fromJsonTree(tree);
+            }
+        };
+    }
+
+    /**
+     * Override this to muck with {@code toSerialize} before it is written to
+     * the outgoing JSON stream.
+     */
+    protected void beforeWrite(C source, JsonElement toSerialize) {
+    }
+
+    /**
+     * Override this to muck with {@code deserialized} before it parsed into the
+     * application type.
+     */
+    protected void afterRead(@Nullable JsonElement deserialized) {
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/DateTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/DateTimeTypeAdapter.java
new file mode 100644 (file)
index 0000000..482056d
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.util.function.Function;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * Abstract type adapter for jsr310 date-time types.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+abstract class DateTimeTypeAdapter<T> extends TemporalTypeAdapter<T> {
+
+    DateTimeTypeAdapter(Function<String, T> parseFunction) {
+        super(parseFunction);
+    }
+
+    @Override
+    public String preProcess(@Nullable String in) {
+        if (in.endsWith("+0000")) {
+            return in.substring(0, in.length() - 5) + "Z";
+        }
+        return in;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/DurationTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/DurationTypeAdapter.java
new file mode 100644 (file)
index 0000000..1f27d40
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.Duration;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link Duration} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class DurationTypeAdapter extends TemporalTypeAdapter<Duration> {
+
+    public DurationTypeAdapter() {
+        super(Duration::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/InstantTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/InstantTypeAdapter.java
new file mode 100644 (file)
index 0000000..9e337f2
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.Instant;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link Instant} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class InstantTypeAdapter extends DateTimeTypeAdapter<Instant> {
+
+    public InstantTypeAdapter() {
+        super(Instant::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/JSR310TypeAdapters.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/JSR310TypeAdapters.java
new file mode 100644 (file)
index 0000000..bb2ab97
--- /dev/null
@@ -0,0 +1,117 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.MonthDay;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.Period;
+import java.time.Year;
+import java.time.YearMonth;
+import java.time.ZonedDateTime;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+import com.google.gson.GsonBuilder;
+
+/**
+ * Helper methods to register JSR310 type adapters.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class JSR310TypeAdapters {
+
+    private JSR310TypeAdapters() {
+    }
+
+    public static GsonBuilder registerDurationTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(Duration.class, new DurationTypeAdapter());
+    }
+
+    public static GsonBuilder registerInstantTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(Instant.class, new InstantTypeAdapter());
+    }
+
+    public static GsonBuilder registerLocalDateTimeTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeTypeAdapter());
+    }
+
+    public static GsonBuilder registerLocalDateTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter());
+    }
+
+    public static GsonBuilder registerLocalTimeTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(LocalTime.class, new LocalTimeTypeAdapter());
+    }
+
+    public static GsonBuilder registerMonthDayTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(MonthDay.class, new MonthDayTypeAdapter());
+    }
+
+    public static GsonBuilder registerOffsetDateTimeTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter());
+    }
+
+    public static GsonBuilder registerOffsetTimeTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(OffsetTime.class, new OffsetTimeTypeAdapter());
+    }
+
+    public static GsonBuilder registerPeriodTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(Period.class, new PeriodTypeAdapter());
+    }
+
+    public static GsonBuilder registerYearMonthTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(YearMonth.class, new YearMonthTypeAdapter());
+    }
+
+    public static GsonBuilder registerYearTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(Year.class, new YearTypeAdapter());
+    }
+
+    public static GsonBuilder registerZonedDateTimeTypeAdapter(GsonBuilder gsonBuilder) {
+        return gsonBuilder.registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeTypeAdapter());
+    }
+
+    /**
+     * Helper method to register all the available JSR310 adapters at once.
+     *
+     * @param gsonBuilder the gsonBuilder on which all the JSR310 adapters must be registered.
+     * @return the gsonBuilder with the JSR310 adapters registered.
+     */
+    public static GsonBuilder registerJSR310TypeAdapters(GsonBuilder gsonBuilder) {
+        registerDurationTypeAdapter(gsonBuilder);
+        registerInstantTypeAdapter(gsonBuilder);
+        registerLocalDateTimeTypeAdapter(gsonBuilder);
+        registerLocalDateTypeAdapter(gsonBuilder);
+        registerLocalTimeTypeAdapter(gsonBuilder);
+        registerMonthDayTypeAdapter(gsonBuilder);
+        registerOffsetDateTimeTypeAdapter(gsonBuilder);
+        registerOffsetTimeTypeAdapter(gsonBuilder);
+        registerPeriodTypeAdapter(gsonBuilder);
+        registerYearMonthTypeAdapter(gsonBuilder);
+        registerYearTypeAdapter(gsonBuilder);
+        registerZonedDateTimeTypeAdapter(gsonBuilder);
+
+        return gsonBuilder;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/LocalDateTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/LocalDateTimeTypeAdapter.java
new file mode 100644 (file)
index 0000000..332561b
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.LocalDateTime;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link LocalDateTime} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class LocalDateTimeTypeAdapter extends DateTimeTypeAdapter<LocalDateTime> {
+
+    public LocalDateTimeTypeAdapter() {
+        super(LocalDateTime::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/LocalDateTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/LocalDateTypeAdapter.java
new file mode 100644 (file)
index 0000000..f8fee7e
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.LocalDate;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link LocalDate} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class LocalDateTypeAdapter extends TemporalTypeAdapter<LocalDate> {
+
+    public LocalDateTypeAdapter() {
+        super(LocalDate::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/LocalTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/LocalTimeTypeAdapter.java
new file mode 100644 (file)
index 0000000..552d67f
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.LocalTime;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link LocalTime} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class LocalTimeTypeAdapter extends TemporalTypeAdapter<LocalTime> {
+
+    public LocalTimeTypeAdapter() {
+        super(LocalTime::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/MonthDayTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/MonthDayTypeAdapter.java
new file mode 100644 (file)
index 0000000..1a6b87d
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.MonthDay;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link MonthDay} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class MonthDayTypeAdapter extends TemporalTypeAdapter<MonthDay> {
+
+    public MonthDayTypeAdapter() {
+        super(MonthDay::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/OffsetDateTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/OffsetDateTimeTypeAdapter.java
new file mode 100644 (file)
index 0000000..d1e6ed7
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.OffsetDateTime;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link OffsetDateTime} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class OffsetDateTimeTypeAdapter extends DateTimeTypeAdapter<OffsetDateTime> {
+
+    public OffsetDateTimeTypeAdapter() {
+        super(OffsetDateTime::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/OffsetTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/OffsetTimeTypeAdapter.java
new file mode 100644 (file)
index 0000000..703d63d
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.OffsetTime;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link OffsetTime} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class OffsetTimeTypeAdapter extends TemporalTypeAdapter<OffsetTime> {
+
+    public OffsetTimeTypeAdapter() {
+        super(OffsetTime::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/PeriodTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/PeriodTypeAdapter.java
new file mode 100644 (file)
index 0000000..67b35dc
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.Period;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link Period} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class PeriodTypeAdapter extends TemporalTypeAdapter<Period> {
+
+    public PeriodTypeAdapter() {
+        super(Period::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/RuntimeTypeAdapterFactory.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/RuntimeTypeAdapterFactory.java
new file mode 100644 (file)
index 0000000..e918953
--- /dev/null
@@ -0,0 +1,455 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Copied from
+ * https://raw.githubusercontent.com/google/gson/master/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java
+ * and repackaged here with additional content from
+ * com.google.gson.internal.{Streams,TypeAdapters,LazilyParsedNumber}
+ * to avoid using the internal package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.ObjectStreamException;
+import java.math.BigDecimal;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonIOException;
+import com.google.gson.JsonNull;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSyntaxException;
+import com.google.gson.TypeAdapter;
+import com.google.gson.TypeAdapterFactory;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import com.google.gson.stream.MalformedJsonException;
+
+/**
+ * Adapts values whose runtime type may differ from their declaration type. This
+ * is necessary when a field's type is not the same type that GSON should create
+ * when deserializing that field. For example, consider these types:
+ *
+ * <pre>
+ * {
+ *     &#64;code
+ *     abstract class Shape {
+ *         int x;
+ *         int y;
+ *     }
+ *     class Circle extends Shape {
+ *         int radius;
+ *     }
+ *     class Rectangle extends Shape {
+ *         int width;
+ *         int height;
+ *     }
+ *     class Diamond extends Shape {
+ *         int width;
+ *         int height;
+ *     }
+ *     class Drawing {
+ *         Shape bottomShape;
+ *         Shape topShape;
+ *     }
+ * }
+ * </pre>
+ * <p>
+ * Without additional type information, the serialized JSON is ambiguous. Is
+ * the bottom shape in this drawing a rectangle or a diamond?
+ *
+ * <pre>
+ *    {@code
+ *   {
+ *     "bottomShape": {
+ *       "width": 10,
+ *       "height": 5,
+ *       "x": 0,
+ *       "y": 0
+ *     },
+ *     "topShape": {
+ *       "radius": 2,
+ *       "x": 4,
+ *       "y": 1
+ *     }
+ *   }}
+ * </pre>
+ *
+ * This class addresses this problem by adding type information to the
+ * serialized JSON and honoring that type information when the JSON is
+ * deserialized:
+ *
+ * <pre>
+ *    {@code
+ *   {
+ *     "bottomShape": {
+ *       "type": "Diamond",
+ *       "width": 10,
+ *       "height": 5,
+ *       "x": 0,
+ *       "y": 0
+ *     },
+ *     "topShape": {
+ *       "type": "Circle",
+ *       "radius": 2,
+ *       "x": 4,
+ *       "y": 1
+ *     }
+ *   }}
+ * </pre>
+ *
+ * Both the type field name ({@code "type"}) and the type labels ({@code
+ * "Rectangle"}) are configurable.
+ *
+ * <h3>Registering Types</h3>
+ * Create a {@code RuntimeTypeAdapterFactory} by passing the base type and type field
+ * name to the {@link #of} factory method. If you don't supply an explicit type
+ * field name, {@code "type"} will be used.
+ *
+ * <pre>
+ * {
+ *     &#64;code
+ *     RuntimeTypeAdapterFactory<Shape> shapeAdapterFactory = RuntimeTypeAdapterFactory.of(Shape.class, "type");
+ * }
+ * </pre>
+ *
+ * Next register all of your subtypes. Every subtype must be explicitly
+ * registered. This protects your application from injection attacks. If you
+ * don't supply an explicit type label, the type's simple name will be used.
+ *
+ * <pre>
+ *    {@code
+ *   shapeAdapter.registerSubtype(Rectangle.class, "Rectangle");
+ *   shapeAdapter.registerSubtype(Circle.class, "Circle");
+ *   shapeAdapter.registerSubtype(Diamond.class, "Diamond");
+ * }
+ * </pre>
+ *
+ * Finally, register the type adapter factory in your application's GSON builder:
+ *
+ * <pre>
+ * {
+ *     &#64;code
+ *     Gson gson = new GsonBuilder().registerTypeAdapterFactory(shapeAdapterFactory).create();
+ * }
+ * </pre>
+ *
+ * Like {@code GsonBuilder}, this API supports chaining:
+ *
+ * <pre>
+ * {
+ *     &#64;code
+ *     RuntimeTypeAdapterFactory<Shape> shapeAdapterFactory = RuntimeTypeAdapterFactory.of(Shape.class)
+ *             .registerSubtype(Rectangle.class).registerSubtype(Circle.class).registerSubtype(Diamond.class);
+ * }
+ * </pre>
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public final class RuntimeTypeAdapterFactory<T> implements TypeAdapterFactory {
+    private final Class<?> baseType;
+    private final String typeFieldName;
+    private final Map<String, Class<?>> labelToSubtype = new LinkedHashMap<String, Class<?>>();
+    private final Map<Class<?>, String> subtypeToLabel = new LinkedHashMap<Class<?>, String>();
+
+    private RuntimeTypeAdapterFactory(Class<?> baseType, String typeFieldName) {
+        if (typeFieldName == null || baseType == null) {
+            throw new IllegalArgumentException();
+        }
+        this.baseType = baseType;
+        this.typeFieldName = typeFieldName;
+    }
+
+    /**
+     * Creates a new runtime type adapter using for {@code baseType} using {@code
+     * typeFieldName} as the type field name. Type field names are case sensitive.
+     */
+    public static <T> RuntimeTypeAdapterFactory<T> of(Class<T> baseType, String typeFieldName) {
+        return new RuntimeTypeAdapterFactory<T>(baseType, typeFieldName);
+    }
+
+    /**
+     * Creates a new runtime type adapter for {@code baseType} using {@code "type"} as
+     * the type field name.
+     */
+    public static <T> RuntimeTypeAdapterFactory<T> of(Class<T> baseType) {
+        return new RuntimeTypeAdapterFactory<T>(baseType, "type");
+    }
+
+    /**
+     * Registers {@code type} identified by {@code label}. Labels are case
+     * sensitive.
+     *
+     * @throws IllegalArgumentException if either {@code type} or {@code label}
+     *             have already been registered on this type adapter.
+     */
+    public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type, String label) {
+        if (type == null || label == null) {
+            throw new IllegalArgumentException();
+        }
+        if (subtypeToLabel.containsKey(type) || labelToSubtype.containsKey(label)) {
+            throw new IllegalArgumentException("types and labels must be unique");
+        }
+        labelToSubtype.put(label, type);
+        subtypeToLabel.put(type, label);
+        return this;
+    }
+
+    /**
+     * Registers {@code type} identified by its {@link Class#getSimpleName simple
+     * name}. Labels are case sensitive.
+     *
+     * @throws IllegalArgumentException if either {@code type} or its simple name
+     *             have already been registered on this type adapter.
+     */
+    public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type) {
+        return registerSubtype(type, type.getSimpleName());
+    }
+
+    @Override
+    public @Nullable <R> TypeAdapter<R> create(@Nullable Gson gson, @Nullable TypeToken<R> type) {
+        if (type.getRawType() != baseType) {
+            return null;
+        }
+
+        final Map<String, TypeAdapter<?>> labelToDelegate = new LinkedHashMap<String, TypeAdapter<?>>();
+        final Map<Class<?>, TypeAdapter<?>> subtypeToDelegate = new LinkedHashMap<Class<?>, TypeAdapter<?>>();
+        for (Map.Entry<String, Class<?>> entry : labelToSubtype.entrySet()) {
+            TypeAdapter<?> delegate = gson.getDelegateAdapter(this, TypeToken.get(entry.getValue()));
+            labelToDelegate.put(entry.getKey(), delegate);
+            subtypeToDelegate.put(entry.getValue(), delegate);
+        }
+
+        return new TypeAdapter<R>() {
+            @Override
+            public @Nullable R read(JsonReader in) throws IOException {
+                JsonElement jsonElement = RuntimeTypeAdapterFactory.parse(in);
+                JsonElement labelJsonElement = jsonElement.getAsJsonObject().remove(typeFieldName);
+                if (labelJsonElement == null) {
+                    throw new JsonParseException("cannot deserialize " + baseType
+                            + " because it does not define a field named " + typeFieldName);
+                }
+                String label = labelJsonElement.getAsString();
+                @SuppressWarnings("unchecked") // registration requires that subtype extends T
+                TypeAdapter<R> delegate = (TypeAdapter<R>) labelToDelegate.get(label);
+                if (delegate == null) {
+                    throw new JsonParseException("cannot deserialize " + baseType + " subtype named " + label
+                            + "; did you forget to register a subtype?");
+                }
+                return delegate.fromJsonTree(jsonElement);
+            }
+
+            @Override
+            public void write(JsonWriter out, @Nullable R value) throws IOException {
+                Class<?> srcType = value.getClass();
+                String label = subtypeToLabel.get(srcType);
+                @SuppressWarnings("unchecked") // registration requires that subtype extends T
+                TypeAdapter<R> delegate = (TypeAdapter<R>) subtypeToDelegate.get(srcType);
+                if (delegate == null) {
+                    throw new JsonParseException(
+                            "cannot serialize " + srcType.getName() + "; did you forget to register a subtype?");
+                }
+                JsonObject jsonObject = delegate.toJsonTree(value).getAsJsonObject();
+                if (jsonObject.has(typeFieldName)) {
+                    throw new JsonParseException("cannot serialize " + srcType.getName()
+                            + " because it already defines a field named " + typeFieldName);
+                }
+                JsonObject clone = new JsonObject();
+                clone.add(typeFieldName, new JsonPrimitive(label));
+                for (Map.Entry<String, JsonElement> e : jsonObject.entrySet()) {
+                    clone.add(e.getKey(), e.getValue());
+                }
+                RuntimeTypeAdapterFactory.write(clone, out);
+            }
+        }.nullSafe();
+    }
+
+    /**
+     * Takes a reader in any state and returns the next value as a JsonElement.
+     */
+    private static @Nullable JsonElement parse(JsonReader reader) throws JsonParseException {
+        boolean isEmpty = true;
+        try {
+            reader.peek();
+            isEmpty = false;
+            return RuntimeTypeAdapterFactory.JSON_ELEMENT.read(reader);
+        } catch (EOFException e) {
+            /*
+             * For compatibility with JSON 1.5 and earlier, we return a JsonNull for
+             * empty documents instead of throwing.
+             */
+            if (isEmpty) {
+                return JsonNull.INSTANCE;
+            }
+            // The stream ended prematurely so it is likely a syntax error.
+            throw new JsonSyntaxException(e);
+        } catch (MalformedJsonException e) {
+            throw new JsonSyntaxException(e);
+        } catch (IOException e) {
+            throw new JsonIOException(e);
+        } catch (NumberFormatException e) {
+            throw new JsonSyntaxException(e);
+        }
+    }
+
+    /**
+     * Writes the JSON element to the writer, recursively.
+     */
+    private static void write(JsonElement element, JsonWriter writer) throws IOException {
+        RuntimeTypeAdapterFactory.JSON_ELEMENT.write(writer, element);
+    }
+
+    private static final TypeAdapter<JsonElement> JSON_ELEMENT = new TypeAdapter<JsonElement>() {
+        @Override
+        public @Nullable JsonElement read(@Nullable JsonReader in) throws IOException {
+            switch (in.peek()) {
+                case STRING:
+                    return new JsonPrimitive(in.nextString());
+                case NUMBER:
+                    String number = in.nextString();
+                    return new JsonPrimitive(new LazilyParsedNumber(number));
+                case BOOLEAN:
+                    return new JsonPrimitive(in.nextBoolean());
+                case NULL:
+                    in.nextNull();
+                    return JsonNull.INSTANCE;
+                case BEGIN_ARRAY:
+                    JsonArray array = new JsonArray();
+                    in.beginArray();
+                    while (in.hasNext()) {
+                        array.add(read(in));
+                    }
+                    in.endArray();
+                    return array;
+                case BEGIN_OBJECT:
+                    JsonObject object = new JsonObject();
+                    in.beginObject();
+                    while (in.hasNext()) {
+                        object.add(in.nextName(), read(in));
+                    }
+                    in.endObject();
+                    return object;
+                case END_DOCUMENT:
+                case NAME:
+                case END_OBJECT:
+                case END_ARRAY:
+                default:
+                    throw new IllegalArgumentException();
+            }
+        }
+
+        @Override
+        public void write(JsonWriter out, @Nullable JsonElement value) throws IOException {
+            if (value == null || value.isJsonNull()) {
+                out.nullValue();
+            } else if (value.isJsonPrimitive()) {
+                JsonPrimitive primitive = value.getAsJsonPrimitive();
+                if (primitive.isNumber()) {
+                    out.value(primitive.getAsNumber());
+                } else if (primitive.isBoolean()) {
+                    out.value(primitive.getAsBoolean());
+                } else {
+                    out.value(primitive.getAsString());
+                }
+
+            } else if (value.isJsonArray()) {
+                out.beginArray();
+                for (JsonElement e : value.getAsJsonArray()) {
+                    write(out, e);
+                }
+                out.endArray();
+
+            } else if (value.isJsonObject()) {
+                out.beginObject();
+                for (Map.Entry<String, JsonElement> e : value.getAsJsonObject().entrySet()) {
+                    out.name(e.getKey());
+                    write(out, e.getValue());
+                }
+                out.endObject();
+
+            } else {
+                throw new IllegalArgumentException("Couldn't write " + value.getClass());
+            }
+        }
+    };
+
+    /**
+     * This class holds a number value that is lazily converted to a specific number type
+     *
+     * @author Inderjeet Singh
+     */
+    public static final class LazilyParsedNumber extends Number {
+        private final String value;
+
+        public LazilyParsedNumber(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public int intValue() {
+            try {
+                return Integer.parseInt(value);
+            } catch (NumberFormatException e) {
+                try {
+                    return (int) Long.parseLong(value);
+                } catch (NumberFormatException nfe) {
+                    return new BigDecimal(value).intValue();
+                }
+            }
+        }
+
+        @Override
+        public long longValue() {
+            try {
+                return Long.parseLong(value);
+            } catch (NumberFormatException e) {
+                return new BigDecimal(value).longValue();
+            }
+        }
+
+        @Override
+        public float floatValue() {
+            return Float.parseFloat(value);
+        }
+
+        @Override
+        public double doubleValue() {
+            return Double.parseDouble(value);
+        }
+
+        @Override
+        public String toString() {
+            return value;
+        }
+
+        /**
+         * If somebody is unlucky enough to have to serialize one of these, serialize
+         * it as a BigDecimal so that they won't need Gson on the other side to
+         * deserialize it.
+         */
+        private Object writeReplace() throws ObjectStreamException {
+            return new BigDecimal(value);
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/TemporalTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/TemporalTypeAdapter.java
new file mode 100644 (file)
index 0000000..496bd2f
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.io.IOException;
+import java.util.Objects;
+import java.util.function.Function;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.gson.TypeAdapter;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonToken;
+import com.google.gson.stream.JsonWriter;
+
+/**
+ * Abstract type adapter for jsr310 date-time types.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+abstract class TemporalTypeAdapter<T> extends TypeAdapter<T> {
+
+    Function<String, T> parseFunction;
+
+    TemporalTypeAdapter(Function<String, T> parseFunction) {
+        Objects.requireNonNull(parseFunction);
+        this.parseFunction = parseFunction;
+    }
+
+    @Override
+    public void write(JsonWriter out, @Nullable T value) throws IOException {
+        if (value == null) {
+            out.nullValue();
+        } else {
+            out.value(value.toString());
+        }
+    }
+
+    @Override
+    public @Nullable T read(JsonReader in) throws IOException {
+        if (in.peek() == JsonToken.NULL) {
+            in.nextNull();
+            return null;
+        }
+        String temporalString = preProcess(in.nextString());
+        return parseFunction.apply(temporalString);
+    }
+
+    public String preProcess(String in) {
+        return in;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/YearMonthTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/YearMonthTypeAdapter.java
new file mode 100644 (file)
index 0000000..83b8a9f
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.YearMonth;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link YearMonth} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class YearMonthTypeAdapter extends TemporalTypeAdapter<YearMonth> {
+
+    public YearMonthTypeAdapter() {
+        super(YearMonth::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/YearTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/YearTypeAdapter.java
new file mode 100644 (file)
index 0000000..bc58f09
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.Year;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link Year} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class YearTypeAdapter extends TemporalTypeAdapter<Year> {
+
+    public YearTypeAdapter() {
+        super(Year::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/ZonedDateTimeTypeAdapter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/common/impl/typeadapters/imported/ZonedDateTimeTypeAdapter.java
new file mode 100644 (file)
index 0000000..7ec3303
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+/*
+ * Imported from https://github.com/google-gson/typeadapters/tree/master/jsr310/src
+ * and repackaged to avoid the default package.
+ */
+package org.openhab.binding.lametrictime.internal.api.common.impl.typeadapters.imported;
+
+import java.time.ZonedDateTime;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Type adapter for jsr310 {@link ZonedDateTime} class.
+ *
+ * @author Christophe Bornet - Initial contribution
+ */
+@NonNullByDefault
+public class ZonedDateTimeTypeAdapter extends DateTimeTypeAdapter<ZonedDateTime> {
+
+    public ZonedDateTimeTypeAdapter() {
+        super(ZonedDateTime::parse);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/ApiValue.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/ApiValue.java
new file mode 100644 (file)
index 0000000..a3f90e0
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+/**
+ * Interface for api value.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public interface ApiValue {
+    public String toRaw();
+
+    public static String raw(ApiValue value) {
+        if (value == null) {
+            return null;
+        }
+
+        return value.toRaw();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/ClockApp.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/ClockApp.java
new file mode 100644 (file)
index 0000000..b075fac
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.openhab.binding.lametrictime.internal.api.local.dto.BooleanParameter;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Parameter;
+import org.openhab.binding.lametrictime.internal.api.local.dto.StringParameter;
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+
+/**
+ * Implementation class for the ClockApp.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class ClockApp extends CoreApplication {
+    private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
+
+    private static final String NAME = "com.lametric.clock";
+
+    private static final String ACTION_ALARM = "clock.alarm";
+
+    private static final String PARAMETER_ENABLED = "enabled";
+    private static final String PARAMETER_TIME = "time";
+    private static final String PARAMETER_WAKE_WITH_RADIO = "wake_with_radio";
+
+    public ClockApp() {
+        super(NAME);
+    }
+
+    public CoreAction setAlarm(Boolean enabled, LocalTime time, Boolean wakeWithRadio) {
+        SortedMap<String, Parameter> parameters = new TreeMap<>();
+
+        if (enabled != null) {
+            parameters.put(PARAMETER_ENABLED, new BooleanParameter().withValue(enabled));
+        }
+
+        if (time != null) {
+            parameters.put(PARAMETER_TIME, new StringParameter().withValue(time.format(TIME_FORMATTER)));
+        }
+
+        if (wakeWithRadio != null) {
+            parameters.put(PARAMETER_WAKE_WITH_RADIO, new BooleanParameter().withValue(wakeWithRadio));
+        }
+
+        return new CoreAction(this, new UpdateAction().withId(ACTION_ALARM).withParameters(parameters));
+    }
+
+    public CoreAction stopAlarm() {
+        SortedMap<String, Parameter> parameters = new TreeMap<>();
+        parameters.put(PARAMETER_ENABLED, new BooleanParameter().withValue(false));
+
+        return new CoreAction(this, new UpdateAction().withId(ACTION_ALARM).withParameters(parameters));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CoreAction.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CoreAction.java
new file mode 100644 (file)
index 0000000..691693e
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+
+/**
+ * Class for managing the core actions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class CoreAction {
+    private final CoreApplication app;
+    private final UpdateAction action;
+
+    protected CoreAction(CoreApplication app, UpdateAction action) {
+        this.app = app;
+        this.action = action;
+    }
+
+    public CoreApplication getApp() {
+        return app;
+    }
+
+    public UpdateAction getAction() {
+        return action;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CoreApplication.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CoreApplication.java
new file mode 100644 (file)
index 0000000..94a3a2f
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+/**
+ * Abstract class for the core applications.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public abstract class CoreApplication {
+    private final String packageName;
+
+    public CoreApplication(String packageName) {
+        this.packageName = packageName;
+    }
+
+    public String getPackageName() {
+        return packageName;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CoreApps.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CoreApps.java
new file mode 100644 (file)
index 0000000..526f07a
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+/**
+ * Class for managing the core apps.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class CoreApps {
+    private static final ClockApp CLOCK = new ClockApp();
+    private static final CountdownApp COUNTDOWN = new CountdownApp();
+    private static final RadioApp RADIO = new RadioApp();
+    private static final StopwatchApp STOPWATCH = new StopwatchApp();
+    private static final WeatherApp WEATHER = new WeatherApp();
+
+    public static ClockApp clock() {
+        return CLOCK;
+    }
+
+    public static CountdownApp countdown() {
+        return COUNTDOWN;
+    }
+
+    public static RadioApp radio() {
+        return RADIO;
+    }
+
+    public static StopwatchApp stopwatch() {
+        return STOPWATCH;
+    }
+
+    public static WeatherApp weather() {
+        return WEATHER;
+    }
+
+    // @formatter:off
+    private CoreApps() {}
+    // @formatter:on
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CountdownApp.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/CountdownApp.java
new file mode 100644 (file)
index 0000000..951e21e
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.openhab.binding.lametrictime.internal.api.local.dto.BooleanParameter;
+import org.openhab.binding.lametrictime.internal.api.local.dto.IntegerParameter;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Parameter;
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+
+/**
+ * Implementation class for the CountdownApp.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class CountdownApp extends CoreApplication {
+    private static final String NAME = "com.lametric.countdown";
+
+    private static final String ACTION_CONFIGURE = "countdown.configure";
+    private static final String ACTION_PAUSE = "countdown.pause";
+    private static final String ACTION_RESET = "countdown.reset";
+    private static final String ACTION_START = "countdown.start";
+
+    private static final String PARAMETER_DURATION = "duration";
+    private static final String PARAMETER_START_NOW = "start_now";
+
+    public CountdownApp() {
+        super(NAME);
+    }
+
+    public CoreAction configure(int duration, boolean startNow) {
+        SortedMap<String, Parameter> parameters = new TreeMap<>();
+        parameters.put(PARAMETER_DURATION, new IntegerParameter().withValue(duration));
+        parameters.put(PARAMETER_START_NOW, new BooleanParameter().withValue(startNow));
+
+        return new CoreAction(this, new UpdateAction().withId(ACTION_CONFIGURE).withParameters(parameters));
+    }
+
+    public CoreAction pause() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_PAUSE));
+    }
+
+    public CoreAction reset() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_RESET));
+    }
+
+    public CoreAction start() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_START));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/Icon.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/Icon.java
new file mode 100644 (file)
index 0000000..2011464
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+/**
+ * Marker Interface for icon.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public interface Icon extends ApiValue {
+    // marker interface
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/Icons.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/Icons.java
new file mode 100644 (file)
index 0000000..c3f4cdf
--- /dev/null
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+import java.io.File;
+import java.net.URI;
+import java.nio.file.Path;
+
+import org.openhab.binding.lametrictime.internal.api.impl.DataIcon;
+import org.openhab.binding.lametrictime.internal.api.impl.FileIcon;
+import org.openhab.binding.lametrictime.internal.api.impl.HTTPIcon;
+import org.openhab.binding.lametrictime.internal.api.impl.KeyIcon;
+
+/**
+ * Class for managing the core icons.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Icons {
+    public static Icon key(String key) {
+        return new KeyIcon(key);
+    }
+
+    public static Icon http(String uri) {
+        return http(URI.create(uri));
+    }
+
+    public static Icon http(URI uri) {
+        return new HTTPIcon(uri);
+    }
+
+    public static Icon path(Path path) {
+        return new FileIcon(path);
+    }
+
+    public static Icon file(File file) {
+        return new FileIcon(file);
+    }
+
+    public static Icon data(String mimeType, byte[] data) {
+        return new DataIcon(mimeType, data);
+    }
+
+    // @formatter:off
+    public static Icon dollar() { return key("i34"); }
+    public static Icon gmail() { return key("i43"); }
+    public static Icon confirm() { return key("i59"); }
+    public static Icon goOut() { return key("a68"); }
+    public static Icon dog() { return key("a76"); }
+    public static Icon clock() { return key("a82"); }
+    public static Icon smile() { return key("a87"); }
+    public static Icon lightning() { return key("i95"); }
+    public static Icon facebook() { return key("a128"); }
+    public static Icon home() { return key("i96"); }
+    public static Icon girl() { return key("a178"); }
+    public static Icon stop() { return key("i184"); }
+    public static Icon heart() { return key("a230"); }
+    public static Icon fade() { return key("a273"); }
+    public static Icon terminal() { return key("a315"); }
+    public static Icon usa() { return key("a413"); }
+    public static Icon switzerland() { return key("i469"); }
+    public static Icon attention() { return key("i555"); }
+    public static Icon theMatrix() { return key("a653"); }
+    public static Icon pizza() { return key("i1324"); }
+    public static Icon christmasTree() { return key("a1782"); }
+    public static Icon night() { return key("a2285"); }
+    public static Icon fireworks() { return key("a2867"); }
+    public static Icon beer() { return key("i3253"); }
+    public static Icon tetris() { return key("a3793"); }
+    public static Icon halloween() { return key("a4033"); }
+    public static Icon pacman() { return key("a4584"); }
+
+    private Icons() {}
+    // @formatter:on
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/RadioApp.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/RadioApp.java
new file mode 100644 (file)
index 0000000..e38fbe3
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+
+/**
+ * Implementation class for the RadioApp.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class RadioApp extends CoreApplication {
+    private static final String NAME = "com.lametric.radio";
+
+    private static final String ACTION_NEXT = "radio.next";
+    private static final String ACTION_PLAY = "radio.play";
+    private static final String ACTION_PREV = "radio.prev";
+    private static final String ACTION_STOP = "radio.stop";
+
+    public RadioApp() {
+        super(NAME);
+    }
+
+    public CoreAction next() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_NEXT));
+    }
+
+    public CoreAction play() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_PLAY));
+    }
+
+    public CoreAction previous() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_PREV));
+    }
+
+    public CoreAction stop() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_STOP));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/StopwatchApp.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/StopwatchApp.java
new file mode 100644 (file)
index 0000000..2475139
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+
+/**
+ * Implementation class for the StopwatchApp.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class StopwatchApp extends CoreApplication {
+    private static final String NAME = "com.lametric.stopwatch";
+
+    private static final String ACTION_PAUSE = "stopwatch.pause";
+    private static final String ACTION_RESET = "stopwatch.reset";
+    private static final String ACTION_START = "stopwatch.start";
+
+    public StopwatchApp() {
+        super(NAME);
+    }
+
+    public CoreAction pause() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_PAUSE));
+    }
+
+    public CoreAction reset() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_RESET));
+    }
+
+    public CoreAction start() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_START));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/WeatherApp.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/WeatherApp.java
new file mode 100644 (file)
index 0000000..2a8917a
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto;
+
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+
+/**
+ * Implementation class for the WeatherApp.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class WeatherApp extends CoreApplication {
+    private static final String NAME = "com.lametric.weather";
+
+    private static final String ACTION_FORECAST = "weather.forecast";
+
+    public WeatherApp() {
+        super(NAME);
+    }
+
+    public CoreAction forecast() {
+        return new CoreAction(this, new UpdateAction().withId(ACTION_FORECAST));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/BrightnessMode.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/BrightnessMode.java
new file mode 100644 (file)
index 0000000..0b53e63
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import org.openhab.binding.lametrictime.internal.api.dto.ApiValue;
+
+/**
+ * Enum for brightness mode.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum BrightnessMode implements ApiValue {
+    AUTO,
+    MANUAL;
+
+    @Override
+    public String toRaw() {
+        return name().toLowerCase();
+    }
+
+    public static BrightnessMode toEnum(String raw) {
+        if (raw == null) {
+            return null;
+        }
+
+        try {
+            return valueOf(raw.toUpperCase());
+        } catch (IllegalArgumentException e) {
+            // not a valid raw string
+            return null;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/DisplayType.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/DisplayType.java
new file mode 100644 (file)
index 0000000..87d27c0
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import org.openhab.binding.lametrictime.internal.api.dto.ApiValue;
+
+/**
+ * Enum for display type.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum DisplayType implements ApiValue {
+    MONOCHROME,
+    GRAYSCALE,
+    COLOR,
+    MIXED;
+
+    @Override
+    public String toRaw() {
+        return name().toLowerCase();
+    }
+
+    public static DisplayType toEnum(String raw) {
+        if (raw == null) {
+            return null;
+        }
+
+        try {
+            return valueOf(raw.toUpperCase());
+        } catch (IllegalArgumentException e) {
+            // not a valid raw string
+            return null;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IconType.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IconType.java
new file mode 100644 (file)
index 0000000..2a57273
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import org.openhab.binding.lametrictime.internal.api.dto.ApiValue;
+
+/**
+ * Enum for icon type.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum IconType implements ApiValue {
+    NONE,
+    INFO,
+    ALERT;
+
+    @Override
+    public String toRaw() {
+        return name().toLowerCase();
+    }
+
+    public static IconType toEnum(String raw) {
+        if (raw == null) {
+            return null;
+        }
+
+        try {
+            return valueOf(raw.toUpperCase());
+        } catch (IllegalArgumentException e) {
+            // not a valid raw string
+            return null;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IpMode.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IpMode.java
new file mode 100644 (file)
index 0000000..d740446
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import org.openhab.binding.lametrictime.internal.api.dto.ApiValue;
+
+/**
+ * Enum for ip mode.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum IpMode implements ApiValue {
+    STATIC,
+    DHCP;
+
+    @Override
+    public String toRaw() {
+        return name().toLowerCase();
+    }
+
+    public static IpMode toEnum(String raw) {
+        if (raw == null) {
+            return null;
+        }
+
+        try {
+            return valueOf(raw.toUpperCase());
+        } catch (IllegalArgumentException e) {
+            // not a valid raw string
+            return null;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/Priority.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/Priority.java
new file mode 100644 (file)
index 0000000..309ebe5
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import org.openhab.binding.lametrictime.internal.api.dto.ApiValue;
+
+/**
+ * Enum for priority.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum Priority implements ApiValue {
+    INFO,
+    WARNING,
+    CRITICAL;
+
+    @Override
+    public String toRaw() {
+        return name().toLowerCase();
+    }
+
+    public static Priority toEnum(String raw) {
+        if (raw == null) {
+            return null;
+        }
+
+        try {
+            return valueOf(raw.toUpperCase());
+        } catch (IllegalArgumentException e) {
+            // not a valid raw string
+            return null;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/Sound.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/Sound.java
new file mode 100644 (file)
index 0000000..c807017
--- /dev/null
@@ -0,0 +1,110 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import org.openhab.binding.lametrictime.internal.api.dto.ApiValue;
+
+/**
+ * Enum for sound.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum Sound implements ApiValue {
+    BICYCLE(SoundCategory.NOTIFICATIONS),
+    CAR(SoundCategory.NOTIFICATIONS),
+    CASH(SoundCategory.NOTIFICATIONS),
+    CAT(SoundCategory.NOTIFICATIONS),
+    DOG(SoundCategory.NOTIFICATIONS),
+    DOG2(SoundCategory.NOTIFICATIONS),
+    ENERGY(SoundCategory.NOTIFICATIONS),
+    KNOCK_KNOCK(SoundCategory.NOTIFICATIONS, "knock-knock"),
+    LETTER_EMAIL(SoundCategory.NOTIFICATIONS),
+    LOSE1(SoundCategory.NOTIFICATIONS),
+    LOSE2(SoundCategory.NOTIFICATIONS),
+    NEGATIVE1(SoundCategory.NOTIFICATIONS),
+    NEGATIVE2(SoundCategory.NOTIFICATIONS),
+    NEGATIVE3(SoundCategory.NOTIFICATIONS),
+    NEGATIVE4(SoundCategory.NOTIFICATIONS),
+    NEGATIVE5(SoundCategory.NOTIFICATIONS),
+    NOTIFICATION(SoundCategory.NOTIFICATIONS),
+    NOTIFICATION2(SoundCategory.NOTIFICATIONS),
+    NOTIFICATION3(SoundCategory.NOTIFICATIONS),
+    NOTIFICATION4(SoundCategory.NOTIFICATIONS),
+    OPEN_DOOR(SoundCategory.NOTIFICATIONS),
+    POSITIVE1(SoundCategory.NOTIFICATIONS),
+    POSITIVE2(SoundCategory.NOTIFICATIONS),
+    POSITIVE3(SoundCategory.NOTIFICATIONS),
+    POSITIVE4(SoundCategory.NOTIFICATIONS),
+    POSITIVE5(SoundCategory.NOTIFICATIONS),
+    POSITIVE6(SoundCategory.NOTIFICATIONS),
+    STATISTIC(SoundCategory.NOTIFICATIONS),
+    THUNDER(SoundCategory.NOTIFICATIONS),
+    WATER1(SoundCategory.NOTIFICATIONS),
+    WATER2(SoundCategory.NOTIFICATIONS),
+    WIN(SoundCategory.NOTIFICATIONS),
+    WIN2(SoundCategory.NOTIFICATIONS),
+    WIND(SoundCategory.NOTIFICATIONS),
+    WIND_SHORT(SoundCategory.NOTIFICATIONS),
+
+    ALARM1(SoundCategory.ALARMS),
+    ALARM2(SoundCategory.ALARMS),
+    ALARM3(SoundCategory.ALARMS),
+    ALARM4(SoundCategory.ALARMS),
+    ALARM5(SoundCategory.ALARMS),
+    ALARM6(SoundCategory.ALARMS),
+    ALARM7(SoundCategory.ALARMS),
+    ALARM8(SoundCategory.ALARMS),
+    ALARM9(SoundCategory.ALARMS),
+    ALARM10(SoundCategory.ALARMS),
+    ALARM11(SoundCategory.ALARMS),
+    ALARM12(SoundCategory.ALARMS),
+    ALARM13(SoundCategory.ALARMS);
+
+    private final SoundCategory category;
+    private final String rawValue;
+
+    private Sound(SoundCategory category) {
+        this(category, null);
+    }
+
+    private Sound(SoundCategory category, String rawValue) {
+        this.category = category;
+        this.rawValue = rawValue;
+    }
+
+    public SoundCategory getCategory() {
+        return category;
+    }
+
+    @Override
+    public String toRaw() {
+        return rawValue != null ? rawValue : name().toLowerCase();
+    }
+
+    public static Sound toEnum(String raw) {
+        if (raw == null) {
+            return null;
+        }
+
+        if (KNOCK_KNOCK.rawValue.equals(raw)) {
+            return KNOCK_KNOCK;
+        }
+
+        try {
+            return valueOf(raw.toUpperCase());
+        } catch (IllegalArgumentException e) {
+            // not a valid raw string
+            return null;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/SoundCategory.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/SoundCategory.java
new file mode 100644 (file)
index 0000000..0b8380c
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import org.openhab.binding.lametrictime.internal.api.dto.ApiValue;
+
+/**
+ * Enum for sound category.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum SoundCategory implements ApiValue {
+    NOTIFICATIONS,
+    ALARMS;
+
+    @Override
+    public String toRaw() {
+        return name().toLowerCase();
+    }
+
+    public static SoundCategory toEnum(String raw) {
+        if (raw == null) {
+            return null;
+        }
+
+        try {
+            return valueOf(raw.toUpperCase());
+        } catch (IllegalArgumentException e) {
+            // not a valid raw string
+            return null;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/WifiEncryption.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/dto/enums/WifiEncryption.java
new file mode 100644 (file)
index 0000000..a98b60d
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import org.openhab.binding.lametrictime.internal.api.dto.ApiValue;
+
+/**
+ * Enum for wifi encryption.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public enum WifiEncryption implements ApiValue {
+    OPEN,
+    WEP,
+    WPA,
+    WPA2;
+
+    @Override
+    public String toRaw() {
+        return name();
+    }
+
+    public static WifiEncryption toEnum(String raw) {
+        if (raw == null) {
+            return null;
+        }
+
+        try {
+            return valueOf(raw);
+        } catch (IllegalArgumentException e) {
+            // not a valid raw string
+            return null;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/AbstractDataIcon.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/AbstractDataIcon.java
new file mode 100644 (file)
index 0000000..a0485d9
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.impl;
+
+import java.util.Base64;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.dto.Icon;
+
+/**
+ * Implementation class for icons.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public abstract class AbstractDataIcon implements Icon {
+    @Nullable
+    private volatile Object CONFIGURE_FLAG;
+
+    @Nullable
+    private String type;
+
+    private byte @Nullable [] data;
+
+    protected void configure() {
+        if (CONFIGURE_FLAG == null) {
+            synchronized (this) {
+                if (CONFIGURE_FLAG == null) {
+                    populateFields();
+                }
+            }
+        }
+    }
+
+    protected @Nullable String getType() {
+        configure();
+        return type;
+    }
+
+    protected void setType(String type) {
+        this.type = type;
+    }
+
+    protected byte @Nullable [] getData() {
+        configure();
+        return data;
+    }
+
+    protected void setData(byte[] data) {
+        this.data = data;
+    }
+
+    @Override
+    public String toRaw() {
+        return new StringBuilder().append("data:").append(getType()).append(";base64,")
+                .append(Base64.getEncoder().encodeToString(getData())).toString();
+    }
+
+    protected abstract void populateFields();
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/DataIcon.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/DataIcon.java
new file mode 100644 (file)
index 0000000..357c496
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.impl;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Implementation class for data icons.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class DataIcon extends AbstractDataIcon {
+    public DataIcon(String mimeType, byte[] data) {
+        setType(mimeType);
+        setData(data);
+    }
+
+    @Override
+    protected void configure() {
+        // noop
+    }
+
+    @Override
+    protected void populateFields() {
+        // noop
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/FileIcon.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/FileIcon.java
new file mode 100644 (file)
index 0000000..8489fe9
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import javax.activation.MimetypesFileTypeMap;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation class for file icons.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class FileIcon extends AbstractDataIcon {
+    private final Logger logger = LoggerFactory.getLogger(FileIcon.class);
+
+    private final MimetypesFileTypeMap mimeTypeMap = new MimetypesFileTypeMap();
+
+    private final Path path;
+
+    public FileIcon(File file) {
+        this(file.toPath());
+    }
+
+    public FileIcon(Path path) {
+        this.path = path;
+        mimeTypeMap.addMimeTypes("image/png png PNG");
+    }
+
+    @Override
+    protected void populateFields() {
+        setType(mimeTypeMap.getContentType(path.toFile()));
+        try {
+            setData(Files.readAllBytes(path));
+        } catch (IOException e) {
+            logger.warn("Failed reading icon content.", e);
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/HTTPIcon.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/HTTPIcon.java
new file mode 100644 (file)
index 0000000..026a522
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.impl;
+
+import java.net.URI;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.core.Response;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Implementation class for http icons.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class HTTPIcon extends AbstractDataIcon {
+    private final URI uri;
+
+    public HTTPIcon(String uri) {
+        this(URI.create(uri));
+    }
+
+    public HTTPIcon(URI uri) {
+        this.uri = uri;
+    }
+
+    @Override
+    protected void populateFields() {
+        Client client = ClientBuilder.newBuilder().build();
+        Response response = client.target(uri).request().get();
+
+        setType(response.getMediaType().toString());
+        setData(response.readEntity(byte[].class));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/KeyIcon.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/KeyIcon.java
new file mode 100644 (file)
index 0000000..8481018
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.impl;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.dto.Icon;
+
+/**
+ * Implementation class for key icons.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class KeyIcon implements Icon {
+    private final String key;
+
+    public KeyIcon(String key) {
+        this.key = key;
+    }
+
+    @Override
+    public String toRaw() {
+        return key;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/LaMetricTimeImpl.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/impl/LaMetricTimeImpl.java
new file mode 100644 (file)
index 0000000..0c8088b
--- /dev/null
@@ -0,0 +1,291 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.impl;
+
+import static org.openhab.binding.lametrictime.internal.api.dto.ApiValue.raw;
+
+import java.util.Arrays;
+
+import javax.ws.rs.client.ClientBuilder;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.Configuration;
+import org.openhab.binding.lametrictime.internal.api.LaMetricTime;
+import org.openhab.binding.lametrictime.internal.api.cloud.CloudConfiguration;
+import org.openhab.binding.lametrictime.internal.api.cloud.LaMetricTimeCloud;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreAction;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApplication;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.dto.Icon;
+import org.openhab.binding.lametrictime.internal.api.dto.Icons;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.BrightnessMode;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.Priority;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.Sound;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActionException;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActivationException;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationNotFoundException;
+import org.openhab.binding.lametrictime.internal.api.local.LaMetricTimeLocal;
+import org.openhab.binding.lametrictime.internal.api.local.LocalConfiguration;
+import org.openhab.binding.lametrictime.internal.api.local.NotificationCreationException;
+import org.openhab.binding.lametrictime.internal.api.local.UpdateException;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Application;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Audio;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Bluetooth;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Display;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Frame;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Notification;
+import org.openhab.binding.lametrictime.internal.api.local.dto.NotificationModel;
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Widget;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation class for LaMetricTime interface.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class LaMetricTimeImpl implements LaMetricTime {
+
+    private final Logger logger = LoggerFactory.getLogger(LaMetricTimeImpl.class);
+
+    private final LaMetricTimeLocal local;
+    private final LaMetricTimeCloud cloud;
+
+    private final Object muteLock = new Object();
+    @Nullable
+    private Integer volumeSaveState;
+
+    public LaMetricTimeImpl(Configuration config) {
+        this(config.getLocalConfig(), config.getCloudConfig());
+    }
+
+    public LaMetricTimeImpl(Configuration config, ClientBuilder clientBuilder) {
+        this(config.getLocalConfig(), config.getCloudConfig(), clientBuilder);
+    }
+
+    public LaMetricTimeImpl(LocalConfiguration localConfig, CloudConfiguration cloudConfig) {
+        this.local = LaMetricTimeLocal.create(localConfig);
+        this.cloud = LaMetricTimeCloud.create(cloudConfig);
+    }
+
+    public LaMetricTimeImpl(LocalConfiguration localConfig, CloudConfiguration cloudConfig,
+            ClientBuilder clientBuilder) {
+        this.local = LaMetricTimeLocal.create(localConfig, clientBuilder);
+        this.cloud = LaMetricTimeCloud.create(cloudConfig, clientBuilder);
+    }
+
+    @Override
+    public String getVersion() {
+        return local.getApi().getApiVersion();
+    }
+
+    @Override
+    public String notifyInfo(@Nullable String message) throws NotificationCreationException {
+        return notify(message, Priority.INFO, Icons.key("i1248"), Sound.NOTIFICATION, 1, 1);
+    }
+
+    @Override
+    public String notifyWarning(@Nullable String message) throws NotificationCreationException {
+        return notify(message, Priority.WARNING, Icons.key("a2098"), Sound.NOTIFICATION2, 2, 2);
+    }
+
+    @Override
+    public String notifyCritical(@Nullable String message) throws NotificationCreationException {
+        return notify(message, Priority.CRITICAL, Icons.key("a4787"), Sound.ALARM1, 0, 0);
+    }
+
+    @Override
+    public String notify(@Nullable String message, @Nullable Priority priority, @Nullable Icon icon,
+            @Nullable Sound sound, int messageRepeat, int soundRepeat) throws NotificationCreationException {
+        // @formatter:off
+        NotificationModel model = new NotificationModel()
+                                      .withCycles(messageRepeat)
+                                      .withFrames(Arrays.asList(new Frame().withText(message)
+                                                                           .withIcon(raw(icon))));
+        if (sound != null)
+        {
+            model.setSound(new org.openhab.binding.lametrictime.internal.api.local.dto.Sound()
+                               .withCategory(raw(sound.getCategory()))
+                               .withId(raw(sound))
+                               .withRepeat(soundRepeat));
+        }
+        // @formatter:on
+
+        Notification notification = new Notification().withPriority(raw(priority)).withModel(model);
+        return local.createNotification(notification);
+    }
+
+    @Override
+    public @Nullable Application getClock() {
+        return getApplication(CoreApps.clock());
+    }
+
+    @Override
+    public @Nullable Application getCountdown() {
+        return getApplication(CoreApps.countdown());
+    }
+
+    @Override
+    public @Nullable Application getRadio() {
+        return getApplication(CoreApps.radio());
+    }
+
+    @Override
+    public @Nullable Application getStopwatch() {
+        return getApplication(CoreApps.stopwatch());
+    }
+
+    @Override
+    public @Nullable Application getWeather() {
+        return getApplication(CoreApps.weather());
+    }
+
+    @Override
+    public @Nullable Application getApplication(@Nullable CoreApplication coreApp) {
+        try {
+            return getLocalApi().getApplication(coreApp.getPackageName());
+        } catch (ApplicationNotFoundException e) {
+            // core apps should never throw errors
+            logger.error("Failed to retrieve core application: {}", coreApp.getPackageName(), e);
+            return null;
+        }
+    }
+
+    @Override
+    public @Nullable Application getApplication(@Nullable String name) throws ApplicationNotFoundException {
+        if (name != null) {
+            return getLocalApi().getApplication(name);
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public void activateApplication(@Nullable CoreApplication coreApp) {
+        try {
+            activateApplication(getApplication(coreApp));
+        } catch (ApplicationActivationException e) {
+            // core apps should never throw errors
+            logger.error("Failed to activate core application: {}", coreApp.getPackageName(), e);
+        }
+    }
+
+    @Override
+    public void activateApplication(@Nullable Application app) throws ApplicationActivationException {
+        getLocalApi().activateApplication(app.getPackageName(), getFirstWidgetId(app));
+    }
+
+    @Override
+    public void activateWidget(@Nullable Widget widget) throws ApplicationActivationException {
+        getLocalApi().activateApplication(widget.getPackageName(), widget.getId());
+    }
+
+    @Override
+    public void doAction(@Nullable CoreAction coreAction) {
+        try {
+            doAction(getApplication(coreAction.getApp()), coreAction.getAction());
+        } catch (ApplicationActionException e) {
+            // core apps should never throw errors
+            logger.error("Failed to execute weather forecast action", e);
+        }
+    }
+
+    @Override
+    public void doAction(@Nullable Application app, @Nullable UpdateAction action) throws ApplicationActionException {
+        getLocalApi().doAction(app.getPackageName(), getFirstWidgetId(app), action);
+    }
+
+    @Override
+    public void doAction(@Nullable Widget widget, @Nullable CoreAction coreAction) throws ApplicationActionException {
+        doAction(widget, coreAction.getAction());
+    }
+
+    @Override
+    public void doAction(@Nullable Widget widget, @Nullable UpdateAction action) throws ApplicationActionException {
+        getLocalApi().doAction(widget.getPackageName(), widget.getId(), action);
+    }
+
+    protected String getFirstWidgetId(Application app) {
+        return app.getWidgets().firstKey();
+    }
+
+    @Override
+    public Display setBrightness(int brightness) throws UpdateException {
+        return local
+                .updateDisplay(new Display().withBrightness(brightness).withBrightnessMode(raw(BrightnessMode.MANUAL)));
+    }
+
+    @Override
+    public Display setBrightnessMode(@Nullable BrightnessMode mode) throws UpdateException {
+        return local.updateDisplay(new Display().withBrightnessMode(raw(mode)));
+    }
+
+    @Override
+    public Audio setVolume(int volume) throws UpdateException {
+        return local.updateAudio(new Audio().withVolume(volume));
+    }
+
+    @Override
+    public Audio mute() throws UpdateException {
+        synchronized (muteLock) {
+            Audio audio = local.getAudio();
+            if (audio.getVolume() == 0) {
+                return audio;
+            }
+
+            volumeSaveState = audio.getVolume();
+            return setVolume(0);
+        }
+    }
+
+    @Override
+    public Audio unmute() throws UpdateException {
+        synchronized (muteLock) {
+            if (volumeSaveState == null) {
+                Audio audio = local.getAudio();
+                if (audio.getVolume() == 0) {
+                    return setVolume(50);
+                } else {
+                    return audio;
+                }
+            }
+
+            Audio audio = setVolume(volumeSaveState);
+            volumeSaveState = null;
+            return audio;
+        }
+    }
+
+    @Override
+    public Bluetooth setBluetoothActive(boolean active) throws UpdateException {
+        return local.updateBluetooth(new Bluetooth().withActive(active));
+    }
+
+    @Override
+    public Bluetooth setBluetoothName(@Nullable String name) throws UpdateException {
+        return local.updateBluetooth(new Bluetooth().withName(name));
+    }
+
+    @Override
+    public LaMetricTimeLocal getLocalApi() {
+        return local;
+    }
+
+    @Override
+    public LaMetricTimeCloud getCloudApi() {
+        return cloud;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/ApplicationActionException.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/ApplicationActionException.java
new file mode 100644 (file)
index 0000000..c08521b
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Failure;
+
+/**
+ * Implementation class for application action exceptions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class ApplicationActionException extends LaMetricTimeException {
+    private static final long serialVersionUID = 1L;
+
+    public ApplicationActionException() {
+        super();
+    }
+
+    public ApplicationActionException(String message) {
+        super(message);
+    }
+
+    public ApplicationActionException(Throwable cause) {
+        super(cause);
+    }
+
+    public ApplicationActionException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ApplicationActionException(String message, Throwable cause, boolean enableSuppression,
+            boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+
+    public ApplicationActionException(Failure failure) {
+        super(failure);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/ApplicationActivationException.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/ApplicationActivationException.java
new file mode 100644 (file)
index 0000000..f14ef5d
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Failure;
+
+/**
+ * Implementation class for application activation exceptions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class ApplicationActivationException extends LaMetricTimeException {
+    private static final long serialVersionUID = 1L;
+
+    public ApplicationActivationException() {
+        super();
+    }
+
+    public ApplicationActivationException(String message) {
+        super(message);
+    }
+
+    public ApplicationActivationException(Throwable cause) {
+        super(cause);
+    }
+
+    public ApplicationActivationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ApplicationActivationException(String message, Throwable cause, boolean enableSuppression,
+            boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+
+    public ApplicationActivationException(Failure failure) {
+        super(failure);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/ApplicationNotFoundException.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/ApplicationNotFoundException.java
new file mode 100644 (file)
index 0000000..96b3ddf
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Failure;
+
+/**
+ * Implementation class for application not found exceptions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class ApplicationNotFoundException extends LaMetricTimeException {
+    private static final long serialVersionUID = 1L;
+
+    public ApplicationNotFoundException() {
+        super();
+    }
+
+    public ApplicationNotFoundException(String message) {
+        super(message);
+    }
+
+    public ApplicationNotFoundException(Throwable cause) {
+        super(cause);
+    }
+
+    public ApplicationNotFoundException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ApplicationNotFoundException(String message, Throwable cause, boolean enableSuppression,
+            boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+
+    public ApplicationNotFoundException(Failure failure) {
+        super(failure);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/LaMetricTimeException.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/LaMetricTimeException.java
new file mode 100644 (file)
index 0000000..0af0278
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Error;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Failure;
+
+/**
+ * Parent class for LaMetricTime exceptions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class LaMetricTimeException extends Exception {
+    private static final long serialVersionUID = 1L;
+
+    public LaMetricTimeException() {
+        super();
+    }
+
+    public LaMetricTimeException(String message) {
+        super(message);
+    }
+
+    public LaMetricTimeException(Throwable cause) {
+        super(cause);
+    }
+
+    public LaMetricTimeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public LaMetricTimeException(String message, Throwable cause, boolean enableSuppression,
+            boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+
+    public LaMetricTimeException(Failure failure) {
+        super(buildMessage(failure));
+    }
+
+    private static String buildMessage(Failure failure) {
+        StringBuilder builder = new StringBuilder();
+
+        List<Error> errors = failure.getErrors();
+        if (!errors.isEmpty()) {
+            builder.append(errors.get(0).getMessage());
+        }
+
+        for (int i = 1; i < errors.size(); i++) {
+            builder.append("; ").append(errors.get(i).getMessage());
+        }
+
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/LaMetricTimeLocal.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/LaMetricTimeLocal.java
new file mode 100644 (file)
index 0000000..72bce64
--- /dev/null
@@ -0,0 +1,92 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local;
+
+import java.util.List;
+import java.util.SortedMap;
+
+import javax.ws.rs.client.ClientBuilder;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Api;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Application;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Audio;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Bluetooth;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Device;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Display;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Notification;
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+import org.openhab.binding.lametrictime.internal.api.local.dto.WidgetUpdates;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Wifi;
+import org.openhab.binding.lametrictime.internal.api.local.impl.LaMetricTimeLocalImpl;
+
+/**
+ * Interface for local device access.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public interface LaMetricTimeLocal {
+    public Api getApi();
+
+    public Device getDevice();
+
+    public String createNotification(Notification notification) throws NotificationCreationException;
+
+    public List<Notification> getNotifications();
+
+    public @Nullable Notification getCurrentNotification();
+
+    public Notification getNotification(String id) throws NotificationNotFoundException;
+
+    public void deleteNotification(String id) throws NotificationNotFoundException;
+
+    public Display getDisplay();
+
+    public Display updateDisplay(Display display) throws UpdateException;
+
+    public Audio getAudio();
+
+    public Audio updateAudio(Audio audio) throws UpdateException;
+
+    public Bluetooth getBluetooth();
+
+    public Bluetooth updateBluetooth(Bluetooth bluetooth) throws UpdateException;
+
+    public Wifi getWifi();
+
+    public void updateApplication(String packageName, String accessToken, WidgetUpdates widgetUpdates)
+            throws UpdateException;
+
+    public SortedMap<String, Application> getApplications();
+
+    public @Nullable Application getApplication(String packageName) throws ApplicationNotFoundException;
+
+    public void activatePreviousApplication();
+
+    public void activateNextApplication();
+
+    public void activateApplication(String packageName, String widgetId) throws ApplicationActivationException;
+
+    public void doAction(String packageName, String widgetId, @Nullable UpdateAction action)
+            throws ApplicationActionException;
+
+    public static LaMetricTimeLocal create(LocalConfiguration config) {
+        return new LaMetricTimeLocalImpl(config);
+    }
+
+    public static LaMetricTimeLocal create(LocalConfiguration config, ClientBuilder clientBuilder) {
+        return new LaMetricTimeLocalImpl(config, clientBuilder);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/LocalConfiguration.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/LocalConfiguration.java
new file mode 100644 (file)
index 0000000..09580d9
--- /dev/null
@@ -0,0 +1,243 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * Configuration class for local access.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class LocalConfiguration {
+    @Nullable
+    private String host;
+
+    @Nullable
+    private String apiKey;
+
+    private boolean secure = true;
+    private boolean ignoreCertificateValidation = true;
+    private boolean ignoreHostnameValidation = true;
+
+    private String insecureScheme = "http";
+    private int insecurePort = 8080;
+
+    private String secureScheme = "https";
+    private int securePort = 4343;
+
+    private String basePath = "/api/v2";
+
+    private String authUser = "dev";
+
+    private boolean logging = false;
+    private String logLevel = "INFO";
+    private int logMax = 104857600; // 100kb
+
+    public @Nullable String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public LocalConfiguration withHost(@Nullable String host) {
+        this.host = host;
+        return this;
+    }
+
+    public @Nullable String getApiKey() {
+        return apiKey;
+    }
+
+    public void setApiKey(String apiKey) {
+        this.apiKey = apiKey;
+    }
+
+    public LocalConfiguration withApiKey(@Nullable String apiKey) {
+        this.apiKey = apiKey;
+        return this;
+    }
+
+    public boolean isSecure() {
+        return secure;
+    }
+
+    public void setSecure(boolean secure) {
+        this.secure = secure;
+    }
+
+    public LocalConfiguration withSecure(boolean secure) {
+        this.secure = secure;
+        return this;
+    }
+
+    public boolean isIgnoreCertificateValidation() {
+        return ignoreCertificateValidation;
+    }
+
+    public void setIgnoreCertificateValidation(boolean ignoreCertificateValidation) {
+        this.ignoreCertificateValidation = ignoreCertificateValidation;
+    }
+
+    public LocalConfiguration withIgnoreCertificateValidation(boolean ignoreCertificateValidation) {
+        this.ignoreCertificateValidation = ignoreCertificateValidation;
+        return this;
+    }
+
+    public boolean isIgnoreHostnameValidation() {
+        return ignoreHostnameValidation;
+    }
+
+    public void setIgnoreHostnameValidation(boolean ignoreHostnameValidation) {
+        this.ignoreHostnameValidation = ignoreHostnameValidation;
+    }
+
+    public LocalConfiguration withIgnoreHostnameValidation(boolean ignoreHostnameValidation) {
+        this.ignoreHostnameValidation = ignoreHostnameValidation;
+        return this;
+    }
+
+    public String getInsecureScheme() {
+        return insecureScheme;
+    }
+
+    public void setInsecureScheme(String insecureScheme) {
+        this.insecureScheme = insecureScheme;
+    }
+
+    public LocalConfiguration withInsecureScheme(String insecureScheme) {
+        this.insecureScheme = insecureScheme;
+        return this;
+    }
+
+    public int getInsecurePort() {
+        return insecurePort;
+    }
+
+    public void setInsecurePort(int insecurePort) {
+        this.insecurePort = insecurePort;
+    }
+
+    public LocalConfiguration withInsecurePort(int insecurePort) {
+        this.insecurePort = insecurePort;
+        return this;
+    }
+
+    public String getSecureScheme() {
+        return secureScheme;
+    }
+
+    public void setSecureScheme(String secureScheme) {
+        this.secureScheme = secureScheme;
+    }
+
+    public LocalConfiguration withSecureScheme(String secureScheme) {
+        this.secureScheme = secureScheme;
+        return this;
+    }
+
+    public int getSecurePort() {
+        return securePort;
+    }
+
+    public void setSecurePort(int securePort) {
+        this.securePort = securePort;
+    }
+
+    public LocalConfiguration withSecurePort(int securePort) {
+        this.securePort = securePort;
+        return this;
+    }
+
+    public String getBasePath() {
+        return basePath;
+    }
+
+    public void setBasePath(String basePath) {
+        this.basePath = basePath;
+    }
+
+    public LocalConfiguration withBasePath(String basePath) {
+        this.basePath = basePath;
+        return this;
+    }
+
+    public String getAuthUser() {
+        return authUser;
+    }
+
+    public void setAuthUser(String authUser) {
+        this.authUser = authUser;
+    }
+
+    public LocalConfiguration withAuthUser(String authUser) {
+        this.authUser = authUser;
+        return this;
+    }
+
+    public boolean isLogging() {
+        return logging;
+    }
+
+    public void setLogging(boolean logging) {
+        this.logging = logging;
+    }
+
+    public LocalConfiguration withLogging(boolean logging) {
+        this.logging = logging;
+        return this;
+    }
+
+    public String getLogLevel() {
+        return logLevel;
+    }
+
+    public void setLogLevel(String logLevel) {
+        this.logLevel = logLevel;
+    }
+
+    public LocalConfiguration withLogLevel(String logLevel) {
+        this.logLevel = logLevel;
+        return this;
+    }
+
+    public int getLogMax() {
+        return logMax;
+    }
+
+    public void setLogMax(int logMax) {
+        this.logMax = logMax;
+    }
+
+    public LocalConfiguration withLogMax(int logMax) {
+        this.logMax = logMax;
+        return this;
+    }
+
+    public URI getBaseUri() {
+        String scheme = secure ? secureScheme : insecureScheme;
+        int port = secure ? securePort : insecurePort;
+        try {
+            return new URI(scheme, null, host, port, basePath, null, null);
+        } catch (URISyntaxException e) {
+            throw new IllegalStateException("Invalid configuration", e);
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/NotificationCreationException.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/NotificationCreationException.java
new file mode 100644 (file)
index 0000000..7848c54
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Failure;
+
+/**
+ * Implementation class for notification creation exceptions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class NotificationCreationException extends LaMetricTimeException {
+    private static final long serialVersionUID = 1L;
+
+    public NotificationCreationException() {
+        super();
+    }
+
+    public NotificationCreationException(String message) {
+        super(message);
+    }
+
+    public NotificationCreationException(Throwable cause) {
+        super(cause);
+    }
+
+    public NotificationCreationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public NotificationCreationException(String message, Throwable cause, boolean enableSuppression,
+            boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+
+    public NotificationCreationException(Failure failure) {
+        super(failure);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/NotificationNotFoundException.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/NotificationNotFoundException.java
new file mode 100644 (file)
index 0000000..a873a32
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Failure;
+
+/**
+ * Implementation class for notification not found exceptions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class NotificationNotFoundException extends LaMetricTimeException {
+    private static final long serialVersionUID = 1L;
+
+    public NotificationNotFoundException() {
+        super();
+    }
+
+    public NotificationNotFoundException(String message, Throwable cause, boolean enableSuppression,
+            boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+
+    public NotificationNotFoundException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public NotificationNotFoundException(String message) {
+        super(message);
+    }
+
+    public NotificationNotFoundException(Throwable cause) {
+        super(cause);
+    }
+
+    public NotificationNotFoundException(Failure failure) {
+        super(failure);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/UpdateException.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/UpdateException.java
new file mode 100644 (file)
index 0000000..7bc5905
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Failure;
+
+/**
+ * Implementation class for update exceptions.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class UpdateException extends LaMetricTimeException {
+    private static final long serialVersionUID = 1L;
+
+    public UpdateException() {
+        super();
+    }
+
+    public UpdateException(String message) {
+        super(message);
+    }
+
+    public UpdateException(Throwable cause) {
+        super(cause);
+    }
+
+    public UpdateException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public UpdateException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+
+    public UpdateException(Failure failure) {
+        super(failure);
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Action.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Action.java
new file mode 100644 (file)
index 0000000..a930a60
--- /dev/null
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import java.util.SortedMap;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Pojo for action.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Action {
+    private String id;
+    @SerializedName("params")
+    private SortedMap<String, Parameter> parameters;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Action withId(String id) {
+        setId(id);
+        return this;
+    }
+
+    public SortedMap<String, Parameter> getParameters() {
+        return parameters;
+    }
+
+    public void setParameters(SortedMap<String, Parameter> parameters) {
+        this.parameters = parameters;
+    }
+
+    public Action withParameters(SortedMap<String, Parameter> parameters) {
+        setParameters(parameters);
+        return this;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((id == null) ? 0 : id.hashCode());
+        result = prime * result + ((parameters == null) ? 0 : parameters.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        Action other = (Action) obj;
+        if (id == null) {
+            if (other.id != null) {
+                return false;
+            }
+        } else if (!id.equals(other.id)) {
+            return false;
+        }
+        if (parameters == null) {
+            if (other.parameters != null) {
+                return false;
+            }
+        } else if (!parameters.equals(other.parameters)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Action [id=");
+        builder.append(id);
+        builder.append(", parameters=");
+        builder.append(parameters);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Api.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Api.java
new file mode 100644 (file)
index 0000000..361ba0d
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for api.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Api {
+    private String apiVersion;
+    private Endpoints endpoints;
+
+    public String getApiVersion() {
+        return apiVersion;
+    }
+
+    public void setApiVersion(String apiVersion) {
+        this.apiVersion = apiVersion;
+    }
+
+    public Api withApiVersion(String apiVersion) {
+        this.apiVersion = apiVersion;
+        return this;
+    }
+
+    public Endpoints getEndpoints() {
+        return endpoints;
+    }
+
+    public void setEndpoints(Endpoints endpoints) {
+        this.endpoints = endpoints;
+    }
+
+    public Api withEndpoints(Endpoints endpoints) {
+        this.endpoints = endpoints;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Api [apiVersion=");
+        builder.append(apiVersion);
+        builder.append(", endpoints=");
+        builder.append(endpoints);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Application.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Application.java
new file mode 100644 (file)
index 0000000..c5b4a4f
--- /dev/null
@@ -0,0 +1,167 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import java.util.SortedMap;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Pojo for application.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Application {
+    private SortedMap<String, Action> actions;
+    @SerializedName("package")
+    private String packageName;
+    private String vendor;
+    private String version;
+    private String versionCode;
+    private SortedMap<String, Widget> widgets;
+
+    public SortedMap<String, Action> getActions() {
+        return actions;
+    }
+
+    public void setActions(SortedMap<String, Action> actions) {
+        this.actions = actions;
+    }
+
+    public Application withActions(SortedMap<String, Action> actions) {
+        setActions(actions);
+        return this;
+    }
+
+    public String getPackageName() {
+        return packageName;
+    }
+
+    public void setPackageName(String packageName) {
+        this.packageName = packageName;
+    }
+
+    public Application withPackageName(String packageName) {
+        setPackageName(packageName);
+        return this;
+    }
+
+    public String getVendor() {
+        return vendor;
+    }
+
+    public void setVendor(String vendor) {
+        this.vendor = vendor;
+    }
+
+    public Application withVendor(String vendor) {
+        setVendor(vendor);
+        return this;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public Application withVersion(String version) {
+        setVersion(version);
+        return this;
+    }
+
+    public String getVersionCode() {
+        return versionCode;
+    }
+
+    public void setVersionCode(String versionCode) {
+        this.versionCode = versionCode;
+    }
+
+    public Application withVersionCode(String versionCode) {
+        setVersionCode(versionCode);
+        return this;
+    }
+
+    public SortedMap<String, Widget> getWidgets() {
+        return widgets;
+    }
+
+    public void setWidgets(SortedMap<String, Widget> widgets) {
+        this.widgets = widgets;
+    }
+
+    public Application withWidgets(SortedMap<String, Widget> widgets) {
+        setWidgets(widgets);
+        return this;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((packageName == null) ? 0 : packageName.hashCode());
+        result = prime * result + ((versionCode == null) ? 0 : versionCode.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        Application other = (Application) obj;
+        if (packageName == null) {
+            if (other.packageName != null) {
+                return false;
+            }
+        } else if (!packageName.equals(other.packageName)) {
+            return false;
+        }
+        if (versionCode == null) {
+            if (other.versionCode != null) {
+                return false;
+            }
+        } else if (!versionCode.equals(other.versionCode)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Application [actions=");
+        builder.append(actions);
+        builder.append(", packageName=");
+        builder.append(packageName);
+        builder.append(", vendor=");
+        builder.append(vendor);
+        builder.append(", version=");
+        builder.append(version);
+        builder.append(", versionCode=");
+        builder.append(versionCode);
+        builder.append(", widgets=");
+        builder.append(widgets);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Audio.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Audio.java
new file mode 100644 (file)
index 0000000..b2db22c
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for audio.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Audio {
+    private Integer volume;
+
+    public Integer getVolume() {
+        return volume;
+    }
+
+    public void setVolume(Integer volume) {
+        this.volume = volume;
+    }
+
+    public Audio withVolume(Integer volume) {
+        this.volume = volume;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Audio [volume=");
+        builder.append(volume);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/AudioUpdateResult.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/AudioUpdateResult.java
new file mode 100644 (file)
index 0000000..898117f
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for audio update result.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class AudioUpdateResult {
+    private Success success;
+
+    public Success getSuccess() {
+        return success;
+    }
+
+    public void setSuccess(Success success) {
+        this.success = success;
+    }
+
+    public AudioUpdateResult withSuccess(Success success) {
+        this.success = success;
+        return this;
+    }
+
+    public static class Success {
+        private Audio data;
+
+        public Audio getData() {
+            return data;
+        }
+
+        public void setData(Audio data) {
+            this.data = data;
+        }
+
+        public Success withData(Audio data) {
+            this.data = data;
+            return this;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Bluetooth.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Bluetooth.java
new file mode 100644 (file)
index 0000000..03217a6
--- /dev/null
@@ -0,0 +1,135 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for bluetooth.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Bluetooth {
+    private Boolean active;
+
+    /*
+     * API sometimes calls this field 'mac' and other times calls it 'address'.
+     * Additionally, Gson uses fields only (not methods). Therefore, if use the
+     * same instance of this class to read one value and then try to write the
+     * other without calling the setter, it won't work (the other value will be
+     * null).
+     */
+    private String mac;
+    private String address;
+
+    private Boolean available;
+    private Boolean discoverable;
+    private String name;
+    private Boolean pairable;
+
+    public Boolean isActive() {
+        return active;
+    }
+
+    public void setActive(Boolean active) {
+        this.active = active;
+    }
+
+    public Bluetooth withActive(Boolean active) {
+        this.active = active;
+        return this;
+    }
+
+    public String getMac() {
+        return mac == null ? address : mac;
+    }
+
+    public void setMac(String mac) {
+        this.mac = mac;
+        this.address = mac;
+    }
+
+    public Bluetooth withMac(String mac) {
+        setMac(mac);
+        return this;
+    }
+
+    public Boolean isAvailable() {
+        return available;
+    }
+
+    public void setAvailable(Boolean available) {
+        this.available = available;
+    }
+
+    public Bluetooth withAvailable(Boolean available) {
+        this.available = available;
+        return this;
+    }
+
+    public Boolean isDiscoverable() {
+        return discoverable;
+    }
+
+    public void setDiscoverable(Boolean discoverable) {
+        this.discoverable = discoverable;
+    }
+
+    public Bluetooth withDiscoverable(Boolean discoverable) {
+        this.discoverable = discoverable;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Bluetooth withName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public Boolean isPairable() {
+        return pairable;
+    }
+
+    public void setPairable(Boolean pairable) {
+        this.pairable = pairable;
+    }
+
+    public Bluetooth withPairable(Boolean pairable) {
+        this.pairable = pairable;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Bluetooth [active=");
+        builder.append(active);
+        builder.append(", mac=");
+        builder.append(getMac());
+        builder.append(", available=");
+        builder.append(available);
+        builder.append(", discoverable=");
+        builder.append(discoverable);
+        builder.append(", name=");
+        builder.append(name);
+        builder.append(", pairable=");
+        builder.append(pairable);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/BluetoothUpdateResult.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/BluetoothUpdateResult.java
new file mode 100644 (file)
index 0000000..258ea11
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for bluetooth update result.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class BluetoothUpdateResult {
+    private Success success;
+
+    public Success getSuccess() {
+        return success;
+    }
+
+    public void setSuccess(Success success) {
+        this.success = success;
+    }
+
+    public BluetoothUpdateResult withSuccess(Success success) {
+        this.success = success;
+        return this;
+    }
+
+    public static class Success {
+        private Bluetooth data;
+
+        public Bluetooth getData() {
+            return data;
+        }
+
+        public void setData(Bluetooth data) {
+            this.data = data;
+        }
+
+        public Success withData(Bluetooth data) {
+            this.data = data;
+            return this;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/BooleanParameter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/BooleanParameter.java
new file mode 100644 (file)
index 0000000..cea6abe
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for boolean parameter.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class BooleanParameter extends Parameter {
+    private Boolean value;
+
+    @Override
+    public BooleanParameter withName(String name) {
+        super.withName(name);
+        return this;
+    }
+
+    @Override
+    public BooleanParameter withRequired(Boolean required) {
+        super.withRequired(required);
+        return this;
+    }
+
+    public Boolean getValue() {
+        return value;
+    }
+
+    public void setValue(Boolean value) {
+        this.value = value;
+    }
+
+    public BooleanParameter withValue(Boolean value) {
+        setValue(value);
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("BooleanParameter [value=");
+        builder.append(value);
+        builder.append(", getName()=");
+        builder.append(getName());
+        builder.append(", getRequired()=");
+        builder.append(getRequired());
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Device.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Device.java
new file mode 100644 (file)
index 0000000..d7e951f
--- /dev/null
@@ -0,0 +1,188 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for device.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Device {
+    private Audio audio;
+    private Bluetooth bluetooth;
+    private Display display;
+    private String id;
+    private String mode;
+    private String model;
+    private String name;
+    private String osVersion;
+    private String serialNumber;
+    private Wifi wifi;
+
+    public Audio getAudio() {
+        return audio;
+    }
+
+    public void setAudio(Audio audio) {
+        this.audio = audio;
+    }
+
+    public Device withAudio(Audio audio) {
+        this.audio = audio;
+        return this;
+    }
+
+    public Bluetooth getBluetooth() {
+        return bluetooth;
+    }
+
+    public void setBluetooth(Bluetooth bluetooth) {
+        this.bluetooth = bluetooth;
+    }
+
+    public Device withBluetooth(Bluetooth bluetooth) {
+        this.bluetooth = bluetooth;
+        return this;
+    }
+
+    public Display getDisplay() {
+        return display;
+    }
+
+    public void setDisplay(Display display) {
+        this.display = display;
+    }
+
+    public Device withDisplay(Display display) {
+        this.display = display;
+        return this;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Device withId(String id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getMode() {
+        return mode;
+    }
+
+    public void setMode(String mode) {
+        this.mode = mode;
+    }
+
+    public Device withMode(String mode) {
+        this.mode = mode;
+        return this;
+    }
+
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    public Device withModel(String model) {
+        this.model = model;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Device withName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public String getOsVersion() {
+        return osVersion;
+    }
+
+    public void setOsVersion(String osVersion) {
+        this.osVersion = osVersion;
+    }
+
+    public Device withOsVersion(String osVersion) {
+        this.osVersion = osVersion;
+        return this;
+    }
+
+    public String getSerialNumber() {
+        return serialNumber;
+    }
+
+    public void setSerialNumber(String serialNumber) {
+        this.serialNumber = serialNumber;
+    }
+
+    public Device withSerialNumber(String serialNumber) {
+        this.serialNumber = serialNumber;
+        return this;
+    }
+
+    public Wifi getWifi() {
+        return wifi;
+    }
+
+    public void setWifi(Wifi wifi) {
+        this.wifi = wifi;
+    }
+
+    public Device withWifi(Wifi wifi) {
+        this.wifi = wifi;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Device [audio=");
+        builder.append(audio);
+        builder.append(", bluetooth=");
+        builder.append(bluetooth);
+        builder.append(", display=");
+        builder.append(display);
+        builder.append(", id=");
+        builder.append(id);
+        builder.append(", mode=");
+        builder.append(mode);
+        builder.append(", model=");
+        builder.append(model);
+        builder.append(", name=");
+        builder.append(name);
+        builder.append(", osVersion=");
+        builder.append(osVersion);
+        builder.append(", serialNumber=");
+        builder.append(serialNumber);
+        builder.append(", wifi=");
+        builder.append(wifi);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Display.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Display.java
new file mode 100644 (file)
index 0000000..672681f
--- /dev/null
@@ -0,0 +1,124 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for display.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Display {
+    private Integer brightness;
+    private String brightnessMode;
+    private Integer height;
+    private Screensaver screensaver;
+    private String type;
+    private Integer width;
+
+    public Integer getBrightness() {
+        return brightness;
+    }
+
+    public void setBrightness(Integer brightness) {
+        this.brightness = brightness;
+    }
+
+    public Display withBrightness(Integer brightness) {
+        this.brightness = brightness;
+        return this;
+    }
+
+    public String getBrightnessMode() {
+        return brightnessMode;
+    }
+
+    public void setBrightnessMode(String brightnessMode) {
+        this.brightnessMode = brightnessMode;
+    }
+
+    public Display withBrightnessMode(String brightnessMode) {
+        this.brightnessMode = brightnessMode;
+        return this;
+    }
+
+    public Integer getHeight() {
+        return height;
+    }
+
+    public void setHeight(Integer height) {
+        this.height = height;
+    }
+
+    public Display withHeight(Integer height) {
+        this.height = height;
+        return this;
+    }
+
+    public Screensaver getScreensaver() {
+        return screensaver;
+    }
+
+    public void setScreensaver(Screensaver screensaver) {
+        this.screensaver = screensaver;
+    }
+
+    public Display withScreensaver(Screensaver screensaver) {
+        this.screensaver = screensaver;
+        return this;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Display withType(String type) {
+        this.type = type;
+        return this;
+    }
+
+    public Integer getWidth() {
+        return width;
+    }
+
+    public void setWidth(Integer width) {
+        this.width = width;
+    }
+
+    public Display withWidth(Integer width) {
+        this.width = width;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Display [brightness=");
+        builder.append(brightness);
+        builder.append(", brightnessMode=");
+        builder.append(brightnessMode);
+        builder.append(", height=");
+        builder.append(height);
+        builder.append(", screensaver=");
+        builder.append(screensaver);
+        builder.append(", type=");
+        builder.append(type);
+        builder.append(", width=");
+        builder.append(width);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/DisplayUpdateResult.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/DisplayUpdateResult.java
new file mode 100644 (file)
index 0000000..578178b
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for display update result.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class DisplayUpdateResult {
+    private Success success;
+
+    public Success getSuccess() {
+        return success;
+    }
+
+    public void setSuccess(Success success) {
+        this.success = success;
+    }
+
+    public DisplayUpdateResult withSuccess(Success success) {
+        this.success = success;
+        return this;
+    }
+
+    public static class Success {
+        private Display data;
+
+        public Display getData() {
+            return data;
+        }
+
+        public void setData(Display data) {
+            this.data = data;
+        }
+
+        public Success withData(Display data) {
+            this.data = data;
+            return this;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Endpoints.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Endpoints.java
new file mode 100644 (file)
index 0000000..64381c5
--- /dev/null
@@ -0,0 +1,268 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for endpoints.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Endpoints {
+    private String appsActionUrl;
+    private String appsGetUrl;
+    private String appsListUrl;
+    private String appsSwitchNextUrl;
+    private String appsSwitchPrevUrl;
+    private String appsSwitchUrl;
+    private String audioUrl;
+    private String bluetoothUrl;
+    private String concreteNotificationUrl;
+    private String currentNotificationUrl;
+    private String deviceUrl;
+    private String displayUrl;
+    private String notificationsUrl;
+    private String widgetUpdateUrl;
+    private String wifiUrl;
+
+    public String getAppsActionUrl() {
+        return appsActionUrl;
+    }
+
+    public void setAppsActionUrl(String appsActionUrl) {
+        this.appsActionUrl = appsActionUrl;
+    }
+
+    public Endpoints withAppsActionUrl(String appsActionUrl) {
+        this.appsActionUrl = appsActionUrl;
+        return this;
+    }
+
+    public String getAppsGetUrl() {
+        return appsGetUrl;
+    }
+
+    public void setAppsGetUrl(String appsGetUrl) {
+        this.appsGetUrl = appsGetUrl;
+    }
+
+    public Endpoints withAppsGetUrl(String appsGetUrl) {
+        this.appsGetUrl = appsGetUrl;
+        return this;
+    }
+
+    public String getAppsListUrl() {
+        return appsListUrl;
+    }
+
+    public void setAppsListUrl(String appsListUrl) {
+        this.appsListUrl = appsListUrl;
+    }
+
+    public Endpoints withAppsListUrl(String appsListUrl) {
+        this.appsListUrl = appsListUrl;
+        return this;
+    }
+
+    public String getAppsSwitchNextUrl() {
+        return appsSwitchNextUrl;
+    }
+
+    public void setAppsSwitchNextUrl(String appsSwitchNextUrl) {
+        this.appsSwitchNextUrl = appsSwitchNextUrl;
+    }
+
+    public Endpoints withAppsSwitchNextUrl(String appsSwitchNextUrl) {
+        this.appsSwitchNextUrl = appsSwitchNextUrl;
+        return this;
+    }
+
+    public String getAppsSwitchPrevUrl() {
+        return appsSwitchPrevUrl;
+    }
+
+    public void setAppsSwitchPrevUrl(String appsSwitchPrevUrl) {
+        this.appsSwitchPrevUrl = appsSwitchPrevUrl;
+    }
+
+    public Endpoints withAppsSwitchPrevUrl(String appsSwitchPrevUrl) {
+        this.appsSwitchPrevUrl = appsSwitchPrevUrl;
+        return this;
+    }
+
+    public String getAppsSwitchUrl() {
+        return appsSwitchUrl;
+    }
+
+    public void setAppsSwitchUrl(String appsSwitchUrl) {
+        this.appsSwitchUrl = appsSwitchUrl;
+    }
+
+    public Endpoints withAppsSwitchUrl(String appsSwitchUrl) {
+        this.appsSwitchUrl = appsSwitchUrl;
+        return this;
+    }
+
+    public String getAudioUrl() {
+        return audioUrl;
+    }
+
+    public void setAudioUrl(String audioUrl) {
+        this.audioUrl = audioUrl;
+    }
+
+    public Endpoints withAudioUrl(String audioUrl) {
+        this.audioUrl = audioUrl;
+        return this;
+    }
+
+    public String getBluetoothUrl() {
+        return bluetoothUrl;
+    }
+
+    public void setBluetoothUrl(String bluetoothUrl) {
+        this.bluetoothUrl = bluetoothUrl;
+    }
+
+    public Endpoints withBluetoothUrl(String bluetoothUrl) {
+        this.bluetoothUrl = bluetoothUrl;
+        return this;
+    }
+
+    public String getConcreteNotificationUrl() {
+        return concreteNotificationUrl;
+    }
+
+    public void setConcreteNotificationUrl(String concreteNotificationUrl) {
+        this.concreteNotificationUrl = concreteNotificationUrl;
+    }
+
+    public Endpoints withConcreteNotificationUrl(String concreteNotificationUrl) {
+        this.concreteNotificationUrl = concreteNotificationUrl;
+        return this;
+    }
+
+    public String getCurrentNotificationUrl() {
+        return currentNotificationUrl;
+    }
+
+    public void setCurrentNotificationUrl(String currentNotificationUrl) {
+        this.currentNotificationUrl = currentNotificationUrl;
+    }
+
+    public Endpoints withCurrentNotificationUrl(String currentNotificationUrl) {
+        this.currentNotificationUrl = currentNotificationUrl;
+        return this;
+    }
+
+    public String getDeviceUrl() {
+        return deviceUrl;
+    }
+
+    public void setDeviceUrl(String deviceUrl) {
+        this.deviceUrl = deviceUrl;
+    }
+
+    public Endpoints withDeviceUrl(String deviceUrl) {
+        this.deviceUrl = deviceUrl;
+        return this;
+    }
+
+    public String getDisplayUrl() {
+        return displayUrl;
+    }
+
+    public void setDisplayUrl(String displayUrl) {
+        this.displayUrl = displayUrl;
+    }
+
+    public Endpoints withDisplayUrl(String displayUrl) {
+        this.displayUrl = displayUrl;
+        return this;
+    }
+
+    public String getNotificationsUrl() {
+        return notificationsUrl;
+    }
+
+    public void setNotificationsUrl(String notificationsUrl) {
+        this.notificationsUrl = notificationsUrl;
+    }
+
+    public Endpoints withNotificationsUrl(String notificationsUrl) {
+        this.notificationsUrl = notificationsUrl;
+        return this;
+    }
+
+    public String getWidgetUpdateUrl() {
+        return widgetUpdateUrl;
+    }
+
+    public void setWidgetUpdateUrl(String widgetUpdateUrl) {
+        this.widgetUpdateUrl = widgetUpdateUrl;
+    }
+
+    public Endpoints withWidgetUpdateUrl(String widgetUpdateUrl) {
+        this.widgetUpdateUrl = widgetUpdateUrl;
+        return this;
+    }
+
+    public String getWifiUrl() {
+        return wifiUrl;
+    }
+
+    public void setWifiUrl(String wifiUrl) {
+        this.wifiUrl = wifiUrl;
+    }
+
+    public Endpoints withWifiUrl(String wifiUrl) {
+        this.wifiUrl = wifiUrl;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Endpoints [appsActionUrl=");
+        builder.append(appsActionUrl);
+        builder.append(", appsGetUrl=");
+        builder.append(appsGetUrl);
+        builder.append(", appsListUrl=");
+        builder.append(appsListUrl);
+        builder.append(", appsSwitchNextUrl=");
+        builder.append(appsSwitchNextUrl);
+        builder.append(", appsSwitchPrevUrl=");
+        builder.append(appsSwitchPrevUrl);
+        builder.append(", appsSwitchUrl=");
+        builder.append(appsSwitchUrl);
+        builder.append(", audioUrl=");
+        builder.append(audioUrl);
+        builder.append(", bluetoothUrl=");
+        builder.append(bluetoothUrl);
+        builder.append(", concreteNotificationUrl=");
+        builder.append(concreteNotificationUrl);
+        builder.append(", currentNotificationUrl=");
+        builder.append(currentNotificationUrl);
+        builder.append(", deviceUrl=");
+        builder.append(deviceUrl);
+        builder.append(", displayUrl=");
+        builder.append(displayUrl);
+        builder.append(", notificationsUrl=");
+        builder.append(notificationsUrl);
+        builder.append(", widgetUpdateUrl=");
+        builder.append(widgetUpdateUrl);
+        builder.append(", wifiUrl=");
+        builder.append(wifiUrl);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Error.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Error.java
new file mode 100644 (file)
index 0000000..fa87d02
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for error.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Error {
+    private String message;
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public Error withMessage(String message) {
+        this.message = message;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Error [message=");
+        builder.append(message);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Failure.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Failure.java
new file mode 100644 (file)
index 0000000..0612f31
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Pojo for failure.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Failure {
+    private List<Error> errors = new ArrayList<Error>();
+
+    public List<Error> getErrors() {
+        return errors;
+    }
+
+    public void setErrors(List<Error> errors) {
+        this.errors = errors;
+    }
+
+    public Failure withErrors(List<Error> errors) {
+        this.errors = errors;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Failure [errors=");
+        builder.append(errors);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Frame.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Frame.java
new file mode 100644 (file)
index 0000000..e1c770d
--- /dev/null
@@ -0,0 +1,114 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Pojo for frame.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Frame {
+    private String icon;
+    private String text;
+    @SerializedName("goalData")
+    private GoalData goalData;
+    @SerializedName("chartData")
+    private List<Integer> chartData;
+    private Integer index;
+
+    public String getIcon() {
+        return icon;
+    }
+
+    public void setIcon(String icon) {
+        this.icon = icon;
+    }
+
+    public Frame withIcon(String icon) {
+        this.icon = icon;
+        return this;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public Frame withText(String text) {
+        this.text = text;
+        return this;
+    }
+
+    public GoalData getGoalData() {
+        return goalData;
+    }
+
+    public void setGoalData(GoalData goalData) {
+        this.goalData = goalData;
+    }
+
+    public Frame withGoalData(GoalData goalData) {
+        this.goalData = goalData;
+        return this;
+    }
+
+    public List<Integer> getChartData() {
+        return chartData;
+    }
+
+    public void setChartData(List<Integer> chartData) {
+        this.chartData = chartData;
+    }
+
+    public Frame withChartData(List<Integer> chartData) {
+        this.chartData = chartData;
+        return this;
+    }
+
+    public Integer getIndex() {
+        return index;
+    }
+
+    public void setIndex(Integer index) {
+        this.index = index;
+    }
+
+    public Frame withIndex(Integer index) {
+        this.index = index;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Frame [icon=");
+        builder.append(icon);
+        builder.append(", text=");
+        builder.append(text);
+        builder.append(", goalData=");
+        builder.append(goalData);
+        builder.append(", chartData=");
+        builder.append(chartData);
+        builder.append(", index=");
+        builder.append(index);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/GoalData.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/GoalData.java
new file mode 100644 (file)
index 0000000..f78f016
--- /dev/null
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for goal data.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class GoalData {
+    private Integer start;
+    private Integer current;
+    private Integer end;
+    private String unit;
+
+    public Integer getStart() {
+        return start;
+    }
+
+    public void setStart(Integer start) {
+        this.start = start;
+    }
+
+    public GoalData withStart(Integer start) {
+        this.start = start;
+        return this;
+    }
+
+    public Integer getCurrent() {
+        return current;
+    }
+
+    public void setCurrent(Integer current) {
+        this.current = current;
+    }
+
+    public GoalData withCurrent(Integer current) {
+        this.current = current;
+        return this;
+    }
+
+    public Integer getEnd() {
+        return end;
+    }
+
+    public void setEnd(Integer end) {
+        this.end = end;
+    }
+
+    public GoalData withEnd(Integer end) {
+        this.end = end;
+        return this;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public GoalData withUnit(String unit) {
+        this.unit = unit;
+        return this;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((current == null) ? 0 : current.hashCode());
+        result = prime * result + ((end == null) ? 0 : end.hashCode());
+        result = prime * result + ((start == null) ? 0 : start.hashCode());
+        result = prime * result + ((unit == null) ? 0 : unit.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        GoalData other = (GoalData) obj;
+        if (current == null) {
+            if (other.current != null) {
+                return false;
+            }
+        } else if (!current.equals(other.current)) {
+            return false;
+        }
+        if (end == null) {
+            if (other.end != null) {
+                return false;
+            }
+        } else if (!end.equals(other.end)) {
+            return false;
+        }
+        if (start == null) {
+            if (other.start != null) {
+                return false;
+            }
+        } else if (!start.equals(other.start)) {
+            return false;
+        }
+        if (unit == null) {
+            if (other.unit != null) {
+                return false;
+            }
+        } else if (!unit.equals(other.unit)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("GoalData [start=");
+        builder.append(start);
+        builder.append(", current=");
+        builder.append(current);
+        builder.append(", end=");
+        builder.append(end);
+        builder.append(", unit=");
+        builder.append(unit);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/IntegerParameter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/IntegerParameter.java
new file mode 100644 (file)
index 0000000..9c5291d
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for integer parameter.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class IntegerParameter extends Parameter {
+    private Integer value;
+
+    @Override
+    public IntegerParameter withName(String name) {
+        super.withName(name);
+        return this;
+    }
+
+    @Override
+    public IntegerParameter withRequired(Boolean required) {
+        super.withRequired(required);
+        return this;
+    }
+
+    public Integer getValue() {
+        return value;
+    }
+
+    public void setValue(Integer value) {
+        this.value = value;
+    }
+
+    public IntegerParameter withValue(Integer value) {
+        setValue(value);
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("IntegerParameter [value=");
+        builder.append(value);
+        builder.append(", getName()=");
+        builder.append(getName());
+        builder.append(", getRequired()=");
+        builder.append(getRequired());
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Modes.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Modes.java
new file mode 100644 (file)
index 0000000..7735c62
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for modes.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Modes {
+    private TimeBased timeBased;
+    private WhenDark whenDark;
+
+    public TimeBased getTimeBased() {
+        return timeBased;
+    }
+
+    public void setTimeBased(TimeBased timeBased) {
+        this.timeBased = timeBased;
+    }
+
+    public Modes withTimeBased(TimeBased timeBased) {
+        this.timeBased = timeBased;
+        return this;
+    }
+
+    public WhenDark getWhenDark() {
+        return whenDark;
+    }
+
+    public void setWhenDark(WhenDark whenDark) {
+        this.whenDark = whenDark;
+    }
+
+    public Modes withWhenDark(WhenDark whenDark) {
+        this.whenDark = whenDark;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Modes [timeBased=");
+        builder.append(timeBased);
+        builder.append(", whenDark=");
+        builder.append(whenDark);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Notification.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Notification.java
new file mode 100644 (file)
index 0000000..02ab0df
--- /dev/null
@@ -0,0 +1,158 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import java.time.LocalDateTime;
+
+/**
+ * Pojo for notification.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Notification {
+    private String id;
+    private String type;
+    private LocalDateTime created;
+    private LocalDateTime expirationDate;
+    private String priority;
+    private String iconType;
+    private Integer lifetime;
+    private NotificationModel model;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Notification withId(String id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Notification withType(String type) {
+        this.type = type;
+        return this;
+    }
+
+    public LocalDateTime getCreated() {
+        return created;
+    }
+
+    public void setCreated(LocalDateTime created) {
+        this.created = created;
+    }
+
+    public Notification withCreated(LocalDateTime created) {
+        this.created = created;
+        return this;
+    }
+
+    public LocalDateTime getExpirationDate() {
+        return expirationDate;
+    }
+
+    public void setExpirationDate(LocalDateTime expirationDate) {
+        this.expirationDate = expirationDate;
+    }
+
+    public Notification withExpirationDate(LocalDateTime expirationDate) {
+        this.expirationDate = expirationDate;
+        return this;
+    }
+
+    public String getPriority() {
+        return priority;
+    }
+
+    public void setPriority(String priority) {
+        this.priority = priority;
+    }
+
+    public Notification withPriority(String priority) {
+        this.priority = priority;
+        return this;
+    }
+
+    public String getIconType() {
+        return iconType;
+    }
+
+    public void setIconType(String iconType) {
+        this.iconType = iconType;
+    }
+
+    public Notification withIconType(String iconType) {
+        this.iconType = iconType;
+        return this;
+    }
+
+    public Integer getLifetime() {
+        return lifetime;
+    }
+
+    public void setLifetime(Integer lifetime) {
+        this.lifetime = lifetime;
+    }
+
+    public Notification withLifetime(Integer lifetime) {
+        this.lifetime = lifetime;
+        return this;
+    }
+
+    public NotificationModel getModel() {
+        return model;
+    }
+
+    public void setModel(NotificationModel model) {
+        this.model = model;
+    }
+
+    public Notification withModel(NotificationModel model) {
+        this.model = model;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Notification [id=");
+        builder.append(id);
+        builder.append(", type=");
+        builder.append(type);
+        builder.append(", created=");
+        builder.append(created);
+        builder.append(", expirationDate=");
+        builder.append(expirationDate);
+        builder.append(", priority=");
+        builder.append(priority);
+        builder.append(", iconType=");
+        builder.append(iconType);
+        builder.append(", lifetime=");
+        builder.append(lifetime);
+        builder.append(", model=");
+        builder.append(model);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/NotificationModel.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/NotificationModel.java
new file mode 100644 (file)
index 0000000..1be01be
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import java.util.List;
+
+/**
+ * Pojo for notification model.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class NotificationModel {
+    private Integer cycles;
+    private List<Frame> frames;
+    private Sound sound;
+
+    public Integer getCycles() {
+        return cycles;
+    }
+
+    public void setCycles(Integer cycles) {
+        this.cycles = cycles;
+    }
+
+    public NotificationModel withCycles(Integer cycles) {
+        this.cycles = cycles;
+        return this;
+    }
+
+    public List<Frame> getFrames() {
+        return frames;
+    }
+
+    public void setFrames(List<Frame> frames) {
+        this.frames = frames;
+    }
+
+    public NotificationModel withFrames(List<Frame> frames) {
+        this.frames = frames;
+        return this;
+    }
+
+    public Sound getSound() {
+        return sound;
+    }
+
+    public void setSound(Sound sound) {
+        this.sound = sound;
+    }
+
+    public NotificationModel withSound(Sound sound) {
+        this.sound = sound;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("NotificationModel [cycles=");
+        builder.append(cycles);
+        builder.append(", frames=");
+        builder.append(frames);
+        builder.append(", sound=");
+        builder.append(sound);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/NotificationResult.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/NotificationResult.java
new file mode 100644 (file)
index 0000000..4b8dda0
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for notification result.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class NotificationResult {
+    private Success success;
+
+    public Success getSuccess() {
+        return success;
+    }
+
+    public void setSuccess(Success success) {
+        this.success = success;
+    }
+
+    public NotificationResult withSuccess(Success success) {
+        this.success = success;
+        return this;
+    }
+
+    public static class Success {
+        private String id;
+
+        public String getId() {
+            return id;
+        }
+
+        public void setId(String id) {
+            this.id = id;
+        }
+
+        public Success withId(String id) {
+            this.id = id;
+            return this;
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Parameter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Parameter.java
new file mode 100644 (file)
index 0000000..6723d21
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for parameter.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public abstract class Parameter {
+    private String name;
+    private Boolean required;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Parameter withName(String name) {
+        setName(name);
+        return this;
+    }
+
+    public Boolean getRequired() {
+        return required;
+    }
+
+    public void setRequired(Boolean required) {
+        this.required = required;
+    }
+
+    public Parameter withRequired(Boolean required) {
+        setRequired(required);
+        return this;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Screensaver.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Screensaver.java
new file mode 100644 (file)
index 0000000..0a7cd62
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for screensaver.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Screensaver {
+    private Boolean enabled;
+    private Modes modes;
+    private String widget;
+
+    public Boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(Boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public Screensaver withEnabled(Boolean enabled) {
+        this.enabled = enabled;
+        return this;
+    }
+
+    public Modes getModes() {
+        return modes;
+    }
+
+    public void setModes(Modes modes) {
+        this.modes = modes;
+    }
+
+    public Screensaver withModes(Modes modes) {
+        this.modes = modes;
+        return this;
+    }
+
+    public String getWidget() {
+        return widget;
+    }
+
+    public void setWidget(String widget) {
+        this.widget = widget;
+    }
+
+    public Screensaver withWidget(String widget) {
+        this.widget = widget;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Screensaver [enabled=");
+        builder.append(enabled);
+        builder.append(", modes=");
+        builder.append(modes);
+        builder.append(", widget=");
+        builder.append(widget);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Sound.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Sound.java
new file mode 100644 (file)
index 0000000..91b6222
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for sound.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Sound {
+    private String category;
+    private String id;
+    private Integer repeat;
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public Sound withCategory(String category) {
+        this.category = category;
+        return this;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Sound withId(String id) {
+        this.id = id;
+        return this;
+    }
+
+    public Integer getRepeat() {
+        return repeat;
+    }
+
+    public void setRepeat(Integer repeat) {
+        this.repeat = repeat;
+    }
+
+    public Sound withRepeat(Integer repeat) {
+        this.repeat = repeat;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Sound [category=");
+        builder.append(category);
+        builder.append(", id=");
+        builder.append(id);
+        builder.append(", repeat=");
+        builder.append(repeat);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/StringParameter.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/StringParameter.java
new file mode 100644 (file)
index 0000000..81ad6e1
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for stringparameter.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class StringParameter extends Parameter {
+    private String format;
+    private String value;
+
+    @Override
+    public StringParameter withName(String name) {
+        super.withName(name);
+        return this;
+    }
+
+    @Override
+    public StringParameter withRequired(Boolean required) {
+        super.withRequired(required);
+        return this;
+    }
+
+    public String getFormat() {
+        return format;
+    }
+
+    public void setFormat(String format) {
+        this.format = format;
+    }
+
+    public StringParameter withFormat(String format) {
+        setFormat(format);
+        return this;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public StringParameter withValue(String value) {
+        setValue(value);
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("StringParameter [format=");
+        builder.append(format);
+        builder.append(", value=");
+        builder.append(value);
+        builder.append(", getName()=");
+        builder.append(getName());
+        builder.append(", getRequired()=");
+        builder.append(getRequired());
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/TimeBased.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/TimeBased.java
new file mode 100644 (file)
index 0000000..0c25991
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for time based.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class TimeBased {
+    private Boolean enabled;
+
+    public Boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(Boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public TimeBased withEnabled(Boolean enabled) {
+        this.enabled = enabled;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("TimeBased [enabled=");
+        builder.append(enabled);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/UpdateAction.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/UpdateAction.java
new file mode 100644 (file)
index 0000000..6796490
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import java.util.SortedMap;
+
+/**
+ * Pojo for update action.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class UpdateAction extends Action {
+    @Override
+    public UpdateAction withId(String id) {
+        super.setId(id);
+        return this;
+    }
+
+    @Override
+    public UpdateAction withParameters(SortedMap<String, Parameter> parameters) {
+        super.setParameters(parameters);
+        return this;
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/WhenDark.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/WhenDark.java
new file mode 100644 (file)
index 0000000..50258fa
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for when dark.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class WhenDark {
+    private Boolean enabled;
+
+    public Boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(Boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public WhenDark withEnabled(Boolean enabled) {
+        this.enabled = enabled;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("WhenDark [enabled=");
+        builder.append(enabled);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Widget.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Widget.java
new file mode 100644 (file)
index 0000000..d1f3133
--- /dev/null
@@ -0,0 +1,152 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import java.util.Map;
+
+import com.google.gson.JsonPrimitive;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Pojo for widget.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Widget {
+    private String id;
+    @SerializedName("package")
+    private String packageName;
+    private Integer index;
+    private Map<String, JsonPrimitive> settings;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Widget withId(String id) {
+        setId(id);
+        return this;
+    }
+
+    public String getPackageName() {
+        return packageName;
+    }
+
+    public void setPackageName(String packageName) {
+        this.packageName = packageName;
+    }
+
+    public Widget withPackageName(String packageName) {
+        setPackageName(packageName);
+        return this;
+    }
+
+    public Integer getIndex() {
+        return index;
+    }
+
+    public void setIndex(Integer index) {
+        this.index = index;
+    }
+
+    public Widget withIndex(Integer index) {
+        setIndex(index);
+        return this;
+    }
+
+    public Map<String, JsonPrimitive> getSettings() {
+        return settings;
+    }
+
+    public void setSettings(Map<String, JsonPrimitive> settings) {
+        this.settings = settings;
+    }
+
+    public Widget withSettings(Map<String, JsonPrimitive> settings) {
+        setSettings(settings);
+        return this;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((id == null) ? 0 : id.hashCode());
+        result = prime * result + ((index == null) ? 0 : index.hashCode());
+        result = prime * result + ((packageName == null) ? 0 : packageName.hashCode());
+        result = prime * result + ((settings == null) ? 0 : settings.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        Widget other = (Widget) obj;
+        if (id == null) {
+            if (other.id != null) {
+                return false;
+            }
+        } else if (!id.equals(other.id)) {
+            return false;
+        }
+        if (index == null) {
+            if (other.index != null) {
+                return false;
+            }
+        } else if (!index.equals(other.index)) {
+            return false;
+        }
+        if (packageName == null) {
+            if (other.packageName != null) {
+                return false;
+            }
+        } else if (!packageName.equals(other.packageName)) {
+            return false;
+        }
+        if (settings == null) {
+            if (other.settings != null) {
+                return false;
+            }
+        } else if (!settings.equals(other.settings)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Widget [id=");
+        builder.append(id);
+        builder.append(", packageName=");
+        builder.append(packageName);
+        builder.append(", index=");
+        builder.append(index);
+        builder.append(", settings=");
+        builder.append(settings);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/WidgetUpdates.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/WidgetUpdates.java
new file mode 100644 (file)
index 0000000..2aabc30
--- /dev/null
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import java.util.List;
+
+/**
+ * Pojo for widget updates.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class WidgetUpdates {
+    private List<Frame> frames;
+
+    public List<Frame> getFrames() {
+        return frames;
+    }
+
+    public void setFrames(List<Frame> frames) {
+        this.frames = frames;
+    }
+
+    public WidgetUpdates withFrames(List<Frame> frames) {
+        this.frames = frames;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("WidgetUpdates [frames=");
+        builder.append(frames);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Wifi.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/dto/Wifi.java
new file mode 100644 (file)
index 0000000..6160519
--- /dev/null
@@ -0,0 +1,214 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+/**
+ * Pojo for wifi.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class Wifi {
+    private Boolean active;
+
+    /*
+     * API sometimes calls this field 'mac' and other times calls it 'address'.
+     * Additionally, Gson uses fields only (not methods). Therefore, if use the
+     * same instance of this class to read one value and then try to write the
+     * other without calling the setter, it won't work (the other value will be
+     * null).
+     */
+    private String mac;
+    private String address;
+
+    private Boolean available;
+    private String encryption;
+
+    /*
+     * API sometimes calls this field 'ssid' and other times calls it 'essid'.
+     * Additionally, Gson uses fields only (not methods). Therefore, if use the
+     * same instance of this class to read one value and then try to write the
+     * other without calling the setter, it won't work (the other value will be
+     * null).
+     */
+    private String ssid;
+    private String essid;
+
+    /*
+     * API sometimes calls this field 'ip' and other times calls it 'ipv4'.
+     * Additionally, Gson uses fields only (not methods). Therefore, if use the
+     * same instance of this class to read one value and then try to write the
+     * other without calling the setter, it won't work (the other value will be
+     * null).
+     */
+    private String ip;
+    private String ipv4;
+
+    private String mode;
+    private String netmask;
+
+    /*
+     * API sometimes calls this field 'signal_strength' and other times calls it
+     * 'strength'. Additionally, Gson uses fields only (not methods). Therefore,
+     * if use the same instance of this class to read one value and then try to
+     * write the other without calling the setter, it won't work (the other
+     * value will be null).
+     */
+    private Integer signalStrength;
+    private Integer strength;
+
+    public Boolean isActive() {
+        return active;
+    }
+
+    public void setActive(Boolean active) {
+        this.active = active;
+    }
+
+    public Wifi withActive(Boolean active) {
+        this.active = active;
+        return this;
+    }
+
+    public String getMac() {
+        return mac == null ? address : mac;
+    }
+
+    public void setMac(String mac) {
+        this.mac = mac;
+        this.address = mac;
+    }
+
+    public Wifi withMac(String mac) {
+        setMac(mac);
+        return this;
+    }
+
+    public Boolean isAvailable() {
+        return available;
+    }
+
+    public void setAvailable(Boolean available) {
+        this.available = available;
+    }
+
+    public Wifi withAvailable(Boolean available) {
+        this.available = available;
+        return this;
+    }
+
+    public String getEncryption() {
+        return encryption;
+    }
+
+    public void setEncryption(String encryption) {
+        this.encryption = encryption;
+    }
+
+    public Wifi withEncryption(String encryption) {
+        this.encryption = encryption;
+        return this;
+    }
+
+    public String getSsid() {
+        return ssid == null ? essid : ssid;
+    }
+
+    public void setSsid(String ssid) {
+        this.ssid = ssid;
+        this.essid = ssid;
+    }
+
+    public Wifi withSsid(String ssid) {
+        setSsid(ssid);
+        return this;
+    }
+
+    public String getIp() {
+        return ip == null ? ipv4 : ip;
+    }
+
+    public void setIp(String ip) {
+        this.ip = ip;
+        this.ipv4 = ip;
+    }
+
+    public Wifi withIp(String ip) {
+        setIp(ip);
+        return this;
+    }
+
+    public String getMode() {
+        return mode;
+    }
+
+    public void setMode(String mode) {
+        this.mode = mode;
+    }
+
+    public Wifi withMode(String mode) {
+        this.mode = mode;
+        return this;
+    }
+
+    public String getNetmask() {
+        return netmask;
+    }
+
+    public void setNetmask(String netmask) {
+        this.netmask = netmask;
+    }
+
+    public Wifi withNetmask(String netmask) {
+        this.netmask = netmask;
+        return this;
+    }
+
+    public Integer getSignalStrength() {
+        return signalStrength == null ? strength : signalStrength;
+    }
+
+    public void setSignalStrength(Integer signalStrength) {
+        this.signalStrength = signalStrength;
+        this.strength = signalStrength;
+    }
+
+    public Wifi withSignalStrength(Integer signalStrength) {
+        setSignalStrength(signalStrength);
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Wifi [active=");
+        builder.append(active);
+        builder.append(", mac=");
+        builder.append(getMac());
+        builder.append(", available=");
+        builder.append(available);
+        builder.append(", encryption=");
+        builder.append(encryption);
+        builder.append(", ssid=");
+        builder.append(getSsid());
+        builder.append(", ip=");
+        builder.append(getIp());
+        builder.append(", mode=");
+        builder.append(mode);
+        builder.append(", netmask=");
+        builder.append(netmask);
+        builder.append(", signalStrength=");
+        builder.append(getSignalStrength());
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/impl/LaMetricTimeLocalImpl.java b/bundles/org.openhab.binding.lametrictime/src/main/java/org/openhab/binding/lametrictime/internal/api/local/impl/LaMetricTimeLocalImpl.java
new file mode 100644 (file)
index 0000000..ff5ad98
--- /dev/null
@@ -0,0 +1,405 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.impl;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.StandardCharsets;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.List;
+import java.util.SortedMap;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.GsonProvider;
+import org.openhab.binding.lametrictime.internal.api.authentication.HttpAuthenticationFeature;
+import org.openhab.binding.lametrictime.internal.api.cloud.impl.LaMetricTimeCloudImpl;
+import org.openhab.binding.lametrictime.internal.api.common.impl.AbstractClient;
+import org.openhab.binding.lametrictime.internal.api.filter.LoggingFilter;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActionException;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActivationException;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationNotFoundException;
+import org.openhab.binding.lametrictime.internal.api.local.LaMetricTimeLocal;
+import org.openhab.binding.lametrictime.internal.api.local.LocalConfiguration;
+import org.openhab.binding.lametrictime.internal.api.local.NotificationCreationException;
+import org.openhab.binding.lametrictime.internal.api.local.NotificationNotFoundException;
+import org.openhab.binding.lametrictime.internal.api.local.UpdateException;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Api;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Application;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Audio;
+import org.openhab.binding.lametrictime.internal.api.local.dto.AudioUpdateResult;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Bluetooth;
+import org.openhab.binding.lametrictime.internal.api.local.dto.BluetoothUpdateResult;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Device;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Display;
+import org.openhab.binding.lametrictime.internal.api.local.dto.DisplayUpdateResult;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Failure;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Notification;
+import org.openhab.binding.lametrictime.internal.api.local.dto.NotificationResult;
+import org.openhab.binding.lametrictime.internal.api.local.dto.UpdateAction;
+import org.openhab.binding.lametrictime.internal.api.local.dto.WidgetUpdates;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Wifi;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.reflect.TypeToken;
+
+/**
+ * Implementation class for LaMeticTimeLocal interface.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class LaMetricTimeLocalImpl extends AbstractClient implements LaMetricTimeLocal {
+    private final Logger logger = LoggerFactory.getLogger(LaMetricTimeLocalImpl.class);
+
+    private static final String HEADER_ACCESS_TOKEN = "X-Access-Token";
+
+    private final LocalConfiguration config;
+
+    @Nullable
+    private volatile Api api;
+
+    public LaMetricTimeLocalImpl(LocalConfiguration config) {
+        this.config = config;
+    }
+
+    public LaMetricTimeLocalImpl(LocalConfiguration config, ClientBuilder clientBuilder) {
+        super(clientBuilder);
+        this.config = config;
+    }
+
+    @Override
+    public Api getApi() {
+        Api localApi = api;
+        if (localApi == null) {
+            synchronized (this) {
+                localApi = getClient().target(config.getBaseUri()).request(MediaType.APPLICATION_JSON_TYPE)
+                        .get(Api.class);
+                // remove support for v2.0.0 which has several errors in returned endpoints
+                if ("2.0.0".equals(localApi.getApiVersion())) {
+                    throw new IllegalStateException(
+                            "API version 2.0.0 detected, but 2.1.0 or greater is required. Please upgrade LaMetric Time firmware to version 1.7.7 or later. See http://lametric.com/firmware for more information.");
+                }
+                return localApi;
+            }
+        } else {
+            return localApi;
+        }
+    }
+
+    @Override
+    public Device getDevice() {
+        return getClient().target(getApi().getEndpoints().getDeviceUrl()).request(MediaType.APPLICATION_JSON_TYPE)
+                .get(Device.class);
+    }
+
+    @Override
+    public String createNotification(@Nullable Notification notification) throws NotificationCreationException {
+        Response response = getClient().target(getApi().getEndpoints().getNotificationsUrl())
+                .request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(notification));
+
+        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+            throw new NotificationCreationException(response.readEntity(Failure.class));
+        }
+
+        try {
+            return response.readEntity(NotificationResult.class).getSuccess().getId();
+        } catch (Exception e) {
+            throw new NotificationCreationException("Invalid JSON returned from service", e);
+        }
+    }
+
+    @Override
+    public List<Notification> getNotifications() {
+        Response response = getClient().target(getApi().getEndpoints().getNotificationsUrl())
+                .request(MediaType.APPLICATION_JSON_TYPE).get();
+
+        Reader entity = new BufferedReader(
+                new InputStreamReader((InputStream) response.getEntity(), StandardCharsets.UTF_8));
+
+        // @formatter:off
+        return getGson().fromJson(entity,  new TypeToken<List<Notification>>(){}.getType());
+        // @formatter:on
+    }
+
+    @Override
+    public @Nullable Notification getCurrentNotification() {
+        Notification notification = getClient().target(getApi().getEndpoints().getCurrentNotificationUrl())
+                .request(MediaType.APPLICATION_JSON_TYPE).get(Notification.class);
+
+        // when there is no current notification, return null
+        if (notification.getId() == null) {
+            return null;
+        }
+
+        return notification;
+    }
+
+    @Override
+    public Notification getNotification(String id) throws NotificationNotFoundException {
+        Response response = getClient()
+                .target(getApi().getEndpoints().getConcreteNotificationUrl().replace("{:id}", id))
+                .request(MediaType.APPLICATION_JSON_TYPE).get();
+
+        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+            throw new NotificationNotFoundException(response.readEntity(Failure.class));
+        }
+
+        return response.readEntity(Notification.class);
+    }
+
+    @Override
+    public void deleteNotification(String id) throws NotificationNotFoundException {
+        Response response = getClient()
+                .target(getApi().getEndpoints().getConcreteNotificationUrl().replace("{:id}", id))
+                .request(MediaType.APPLICATION_JSON_TYPE).delete();
+
+        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+            throw new NotificationNotFoundException(response.readEntity(Failure.class));
+        }
+
+        response.close();
+    }
+
+    @Override
+    public Display getDisplay() {
+        return getClient().target(getApi().getEndpoints().getDisplayUrl()).request(MediaType.APPLICATION_JSON_TYPE)
+                .get(Display.class);
+    }
+
+    @Override
+    public Display updateDisplay(Display display) throws UpdateException {
+        Response response = getClient().target(getApi().getEndpoints().getDisplayUrl())
+                .request(MediaType.APPLICATION_JSON_TYPE).put(Entity.json(display));
+
+        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+            throw new UpdateException(response.readEntity(Failure.class));
+        }
+
+        return response.readEntity(DisplayUpdateResult.class).getSuccess().getData();
+    }
+
+    @Override
+    public Audio getAudio() {
+        return getClient().target(getApi().getEndpoints().getAudioUrl()).request(MediaType.APPLICATION_JSON_TYPE)
+                .get(Audio.class);
+    }
+
+    @Override
+    public Audio updateAudio(Audio audio) throws UpdateException {
+        Response response = getClient().target(getApi().getEndpoints().getAudioUrl())
+                .request(MediaType.APPLICATION_JSON_TYPE).put(Entity.json(audio));
+
+        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+            throw new UpdateException(response.readEntity(Failure.class));
+        }
+
+        return response.readEntity(AudioUpdateResult.class).getSuccess().getData();
+    }
+
+    @Override
+    public Bluetooth getBluetooth() {
+        return getClient().target(getApi().getEndpoints().getBluetoothUrl()).request(MediaType.APPLICATION_JSON_TYPE)
+                .get(Bluetooth.class);
+    }
+
+    @Override
+    public Bluetooth updateBluetooth(Bluetooth bluetooth) throws UpdateException {
+        Response response = getClient().target(getApi().getEndpoints().getBluetoothUrl())
+                .request(MediaType.APPLICATION_JSON_TYPE).put(Entity.json(bluetooth));
+
+        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+            throw new UpdateException(response.readEntity(Failure.class));
+        }
+
+        return response.readEntity(BluetoothUpdateResult.class).getSuccess().getData();
+    }
+
+    @Override
+    public Wifi getWifi() {
+        return getClient().target(getApi().getEndpoints().getWifiUrl()).request(MediaType.APPLICATION_JSON_TYPE)
+                .get(Wifi.class);
+    }
+
+    @Override
+    public void updateApplication(String packageName, String accessToken, WidgetUpdates widgetUpdates)
+            throws UpdateException {
+        Response response = getClient()
+                .target(getApi().getEndpoints().getWidgetUpdateUrl().replace("{:id}", packageName))
+                .request(MediaType.APPLICATION_JSON_TYPE).header(HEADER_ACCESS_TOKEN, accessToken)
+                .post(Entity.json(widgetUpdates));
+
+        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+            throw new UpdateException(response.readEntity(Failure.class));
+        }
+
+        response.close();
+    }
+
+    @Override
+    public SortedMap<String, Application> getApplications() {
+        Response response = getClient().target(getApi().getEndpoints().getAppsListUrl())
+                .request(MediaType.APPLICATION_JSON_TYPE).get();
+
+        Reader entity = new BufferedReader(
+                new InputStreamReader((InputStream) response.getEntity(), StandardCharsets.UTF_8));
+
+        // @formatter:off
+        return getGson().fromJson(entity,
+                                  new TypeToken<SortedMap<String, Application>>(){}.getType());
+        // @formatter:on
+    }
+
+    @Override
+    public @Nullable Application getApplication(@Nullable String packageName) throws ApplicationNotFoundException {
+        if (packageName != null) {
+            Response response = getClient()
+                    .target(getApi().getEndpoints().getAppsGetUrl().replace("{:id}", packageName))
+                    .request(MediaType.APPLICATION_JSON_TYPE).get();
+
+            if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+                throw new ApplicationNotFoundException(response.readEntity(Failure.class));
+            }
+
+            return response.readEntity(Application.class);
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public void activatePreviousApplication() {
+        getClient().target(getApi().getEndpoints().getAppsSwitchPrevUrl()).request(MediaType.APPLICATION_JSON_TYPE)
+                .put(Entity.json(new Object()));
+    }
+
+    @Override
+    public void activateNextApplication() {
+        getClient().target(getApi().getEndpoints().getAppsSwitchNextUrl()).request(MediaType.APPLICATION_JSON_TYPE)
+                .put(Entity.json(new Object()));
+    }
+
+    @Override
+    public void activateApplication(String packageName, String widgetId) throws ApplicationActivationException {
+        Response response = getClient().target(getApi().getEndpoints().getAppsSwitchUrl().replace("{:id}", packageName)
+                .replace("{:widget_id}", widgetId)).request(MediaType.APPLICATION_JSON_TYPE)
+                .put(Entity.json(new Object()));
+
+        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+            throw new ApplicationActivationException(response.readEntity(Failure.class));
+        }
+
+        response.close();
+    }
+
+    @Override
+    public void doAction(String packageName, String widgetId, @Nullable UpdateAction action)
+            throws ApplicationActionException {
+        Response response = getClient().target(getApi().getEndpoints().getAppsActionUrl().replace("{:id}", packageName)
+                .replace("{:widget_id}", widgetId)).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(action));
+
+        if (!Status.Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
+            throw new ApplicationActionException(response.readEntity(Failure.class));
+        }
+
+        response.close();
+    }
+
+    @Override
+    protected Client createClient() {
+        ClientBuilder builder = clientBuilder;
+
+        // setup Gson (de)serialization
+        GsonProvider<Object> gsonProvider = new GsonProvider<>();
+        builder.register(gsonProvider);
+
+        if (config.isSecure()) {
+            /*
+             * The certificate presented by LaMetric time is self-signed.
+             * Therefore, unless the user takes action by adding the certificate
+             * chain to the Java keystore, HTTPS will fail.
+             *
+             * By setting the ignoreCertificateValidation configuration option
+             * to true (default), HTTPS will be used and the connection will be
+             * encrypted, but the validity of the certificate is not confirmed.
+             */
+            if (config.isIgnoreCertificateValidation()) {
+                try {
+                    SSLContext sslcontext = SSLContext.getInstance("TLS");
+                    sslcontext.init(null, new TrustManager[] { new X509TrustManager() {
+                        @Override
+                        public void checkClientTrusted(X509Certificate @Nullable [] arg0, @Nullable String arg1)
+                                throws CertificateException {
+                            // noop
+                        }
+
+                        @Override
+                        public void checkServerTrusted(X509Certificate @Nullable [] arg0, @Nullable String arg1)
+                                throws CertificateException {
+                            // noop
+                        }
+
+                        @Override
+                        public X509Certificate[] getAcceptedIssuers() {
+                            return new X509Certificate[0];
+                        }
+                    } }, new java.security.SecureRandom());
+                    builder.sslContext(sslcontext);
+                } catch (KeyManagementException | NoSuchAlgorithmException e) {
+                    logger.error("Failed to setup secure communication", e);
+                }
+            }
+
+            /*
+             * The self-signed certificate used by LaMetric time does not match
+             * the host when configured on a network. This makes the HTTPS
+             * handshake fail.
+             *
+             * By setting the ignoreHostnameValidation configuration option to
+             * true (default), HTTPS will be used and the connection will be
+             * encrypted, but the validity of the hostname in the certificate is
+             * not confirmed.
+             */
+            if (config.isIgnoreHostnameValidation()) {
+                builder.hostnameVerifier((host, session) -> true);
+            }
+        }
+
+        // turn on logging if requested
+        if (config.isLogging()) {
+            builder.register(new LoggingFilter(
+                    java.util.logging.Logger.getLogger(LaMetricTimeCloudImpl.class.getName()), config.getLogMax()));
+        }
+
+        // setup basic auth
+        builder.register(HttpAuthenticationFeature.basic(config.getAuthUser(), config.getApiKey()));
+
+        return builder.build();
+    }
+}
index a8632073fa04b2334c5a54a8e67717838ea7e56b..ef26bb8a59c41e00733de0ca505dd47fc78f4cbd 100644 (file)
  */
 package org.openhab.binding.lametrictime.internal.config;
 
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
 /**
  * Configuration class for LaMetric Time apps.
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class LaMetricTimeAppConfiguration {
 
     public static final String PACKAGE_NAME = "packageName";
     public static final String WIDGET_ID = "widgetId";
     public static final String ACCESS_TOKEN = "accessToken";
 
+    @Nullable
     public String packageName;
+
+    @Nullable
     public String widgetId;
+
+    @Nullable
     public String accessToken;
 }
index b47d140a47c8827e7019e5879c668955498baa0b..d68b7cdabbc8d8c96e8b397c50191bc5d00c0d9b 100644 (file)
  */
 package org.openhab.binding.lametrictime.internal.config;
 
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
 /**
  * Configuration class for LaMetric Time device.
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class LaMetricTimeConfiguration {
 
     public static final String HOST = "host";
     public static final String API_KEY = "apiKey";
 
+    @Nullable
     public String host;
+
+    @Nullable
     public String apiKey;
 }
index e5deaef18a09bc4a1f3033c4e341136765e4bb1b..9a078f1b9065072ac6533a0073ad67d33d5b287a 100644 (file)
@@ -17,11 +17,12 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 
-import org.openhab.binding.lametrictime.api.local.model.Application;
-import org.openhab.binding.lametrictime.api.local.model.Widget;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
+import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.openhab.binding.lametrictime.internal.LaMetricTimeBindingConstants;
 import org.openhab.binding.lametrictime.internal.LaMetricTimeUtil;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Application;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Widget;
 import org.openhab.binding.lametrictime.internal.config.LaMetricTimeAppConfiguration;
 import org.openhab.binding.lametrictime.internal.handler.LaMetricTimeAppHandler;
 import org.openhab.binding.lametrictime.internal.handler.LaMetricTimeHandler;
@@ -43,6 +44,7 @@ import com.google.gson.JsonPrimitive;
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class LaMetricTimeAppDiscoveryService extends AbstractDiscoveryService {
 
     private static final Map<String, ThingTypeUID> CORE_APP_THING_TYPE_UIDS = new HashMap<>();
index 59405a5a3b4d8c77068f96758da7f95a6cf19aa0..a961051dc4cb11a4f0212182273cdc615276d623 100644 (file)
@@ -20,6 +20,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.jupnp.model.meta.RemoteDevice;
 import org.openhab.core.config.discovery.DiscoveryResult;
 import org.openhab.core.config.discovery.DiscoveryResultBuilder;
@@ -37,6 +39,7 @@ import org.slf4j.LoggerFactory;
  * @author Gregory Moyer - Initial contribution
  */
 @Component
+@NonNullByDefault
 public class LaMetricTimeDiscoveryParticipant implements UpnpDiscoveryParticipant {
 
     private Logger logger = LoggerFactory.getLogger(LaMetricTimeDiscoveryParticipant.class);
@@ -47,7 +50,7 @@ public class LaMetricTimeDiscoveryParticipant implements UpnpDiscoveryParticipan
     }
 
     @Override
-    public DiscoveryResult createResult(RemoteDevice device) {
+    public @Nullable DiscoveryResult createResult(RemoteDevice device) {
         ThingUID uid = getThingUID(device);
         if (uid == null) {
             return null;
@@ -67,7 +70,7 @@ public class LaMetricTimeDiscoveryParticipant implements UpnpDiscoveryParticipan
     }
 
     @Override
-    public ThingUID getThingUID(RemoteDevice device) {
+    public @Nullable ThingUID getThingUID(RemoteDevice device) {
         try {
             String manufacturer = device.getDetails().getManufacturerDetails().getManufacturer();
             String modelName = device.getDetails().getModelDetails().getModelName();
index ed4e8b98066d6a7f7f94c04fe42885d0b09f7ea0..594794356bed74f24eaf848ac3fd53c21901dc28 100644 (file)
@@ -14,11 +14,13 @@ package org.openhab.binding.lametrictime.internal.handler;
 
 import java.util.SortedMap;
 
-import org.openhab.binding.lametrictime.api.LaMetricTime;
-import org.openhab.binding.lametrictime.api.local.ApplicationNotFoundException;
-import org.openhab.binding.lametrictime.api.local.model.Application;
-import org.openhab.binding.lametrictime.api.local.model.Widget;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.binding.lametrictime.internal.WidgetRef;
+import org.openhab.binding.lametrictime.internal.api.LaMetricTime;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationNotFoundException;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Application;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Widget;
 import org.openhab.binding.lametrictime.internal.config.LaMetricTimeAppConfiguration;
 import org.openhab.core.thing.Bridge;
 import org.openhab.core.thing.ChannelUID;
@@ -39,10 +41,12 @@ import org.slf4j.LoggerFactory;
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public abstract class AbstractLaMetricTimeAppHandler extends BaseThingHandler implements LaMetricTimeAppHandler {
 
     private final Logger logger = LoggerFactory.getLogger(AbstractLaMetricTimeAppHandler.class);
 
+    @Nullable
     private Widget widget;
 
     public AbstractLaMetricTimeAppHandler(Thing thing) {
@@ -78,7 +82,7 @@ public abstract class AbstractLaMetricTimeAppHandler extends BaseThingHandler im
         }
     }
 
-    private void updateWidget(ThingHandler handler) {
+    private void updateWidget(@Nullable ThingHandler handler) {
         if (!(handler instanceof LaMetricTimeHandler)) {
             updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Incorrect bridge thing found");
             return;
@@ -116,7 +120,7 @@ public abstract class AbstractLaMetricTimeAppHandler extends BaseThingHandler im
         ((LaMetricTimeHandler) getBridge().getHandler()).updateActiveApp(widgetId);
     }
 
-    protected String getPackageName(LaMetricTimeAppConfiguration config) {
+    protected @Nullable String getPackageName(LaMetricTimeAppConfiguration config) {
         return config.packageName;
     }
 
@@ -126,7 +130,7 @@ public abstract class AbstractLaMetricTimeAppHandler extends BaseThingHandler im
     }
 
     @Override
-    public Widget getWidget() {
+    public @Nullable Widget getWidget() {
         if (widget == null) {
             getBridge().getHandler().initialize();
         }
index 3868df1237775becff97504170f418813e8f6d3a..c3621a119da19bd7511032f4f7e376555b4e1a6f 100644 (file)
@@ -16,8 +16,10 @@ import static org.openhab.binding.lametrictime.internal.LaMetricTimeBindingConst
 
 import java.time.LocalTime;
 
-import org.openhab.binding.lametrictime.api.local.ApplicationActionException;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActionException;
 import org.openhab.binding.lametrictime.internal.config.LaMetricTimeAppConfiguration;
 import org.openhab.core.library.types.DateTimeType;
 import org.openhab.core.library.types.StringType;
@@ -34,6 +36,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class ClockAppHandler extends AbstractLaMetricTimeAppHandler {
     private static final String PACKAGE_NAME = "com.lametric.clock";
 
@@ -72,7 +75,7 @@ public class ClockAppHandler extends AbstractLaMetricTimeAppHandler {
     }
 
     @Override
-    protected String getPackageName(LaMetricTimeAppConfiguration config) {
+    protected @Nullable String getPackageName(LaMetricTimeAppConfiguration config) {
         return PACKAGE_NAME;
     }
 
index 8d30b45ea2989eaa197396acfee255ac3cb4de13..4c53b9341bfff048e2f4a04ec210040922130541 100644 (file)
@@ -14,8 +14,10 @@ package org.openhab.binding.lametrictime.internal.handler;
 
 import static org.openhab.binding.lametrictime.internal.LaMetricTimeBindingConstants.*;
 
-import org.openhab.binding.lametrictime.api.local.ApplicationActionException;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActionException;
 import org.openhab.binding.lametrictime.internal.config.LaMetricTimeAppConfiguration;
 import org.openhab.core.library.types.StringType;
 import org.openhab.core.thing.ChannelUID;
@@ -31,6 +33,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class CountdownAppHandler extends AbstractLaMetricTimeAppHandler {
     private static final String PACKAGE_NAME = "com.lametric.countdown";
 
@@ -71,7 +74,7 @@ public class CountdownAppHandler extends AbstractLaMetricTimeAppHandler {
     }
 
     @Override
-    protected String getPackageName(LaMetricTimeAppConfiguration config) {
+    protected @Nullable String getPackageName(LaMetricTimeAppConfiguration config) {
         return PACKAGE_NAME;
     }
 
index 64f905f0253dd29a7581a5cc5fdb039541ace72b..d984e55b05b53a0d2271bb2d38e4695fef24007f 100644 (file)
  */
 package org.openhab.binding.lametrictime.internal.handler;
 
-import org.openhab.binding.lametrictime.api.local.model.Widget;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Widget;
 
 /**
  * The {@link LaMetricTimeAppHandler} provides a common contract for all app handlers available for the device.
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public interface LaMetricTimeAppHandler {
 
     /**
@@ -26,5 +29,5 @@ public interface LaMetricTimeAppHandler {
      *
      * @return the {@link Widget}
      */
-    public Widget getWidget();
+    public @Nullable Widget getWidget();
 }
index 94d92e4c05542aa7c0bd535aee546c625fe95568..26690b6529a37c2ec25997acd43dcc297c5b1971 100644 (file)
@@ -25,24 +25,26 @@ import java.util.concurrent.TimeUnit;
 
 import javax.ws.rs.client.ClientBuilder;
 
-import org.openhab.binding.lametrictime.api.Configuration;
-import org.openhab.binding.lametrictime.api.LaMetricTime;
-import org.openhab.binding.lametrictime.api.local.ApplicationActivationException;
-import org.openhab.binding.lametrictime.api.local.LaMetricTimeLocal;
-import org.openhab.binding.lametrictime.api.local.NotificationCreationException;
-import org.openhab.binding.lametrictime.api.local.UpdateException;
-import org.openhab.binding.lametrictime.api.local.model.Application;
-import org.openhab.binding.lametrictime.api.local.model.Audio;
-import org.openhab.binding.lametrictime.api.local.model.Bluetooth;
-import org.openhab.binding.lametrictime.api.local.model.Device;
-import org.openhab.binding.lametrictime.api.local.model.Display;
-import org.openhab.binding.lametrictime.api.local.model.Widget;
-import org.openhab.binding.lametrictime.api.model.enums.BrightnessMode;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.binding.lametrictime.internal.LaMetricTimeBindingConstants;
 import org.openhab.binding.lametrictime.internal.LaMetricTimeConfigStatusMessage;
 import org.openhab.binding.lametrictime.internal.LaMetricTimeUtil;
 import org.openhab.binding.lametrictime.internal.StateDescriptionOptionsProvider;
 import org.openhab.binding.lametrictime.internal.WidgetRef;
+import org.openhab.binding.lametrictime.internal.api.Configuration;
+import org.openhab.binding.lametrictime.internal.api.LaMetricTime;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.BrightnessMode;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActivationException;
+import org.openhab.binding.lametrictime.internal.api.local.LaMetricTimeLocal;
+import org.openhab.binding.lametrictime.internal.api.local.NotificationCreationException;
+import org.openhab.binding.lametrictime.internal.api.local.UpdateException;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Application;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Audio;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Bluetooth;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Device;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Display;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Widget;
 import org.openhab.binding.lametrictime.internal.config.LaMetricTimeConfiguration;
 import org.openhab.core.config.core.status.ConfigStatusMessage;
 import org.openhab.core.library.types.OnOffType;
@@ -68,6 +70,7 @@ import org.slf4j.LoggerFactory;
  * @author Gregory Moyer - Initial contribution
  * @author Kai Kreuzer - Improved status handling, introduced refresh job and app state update
  */
+@NonNullByDefault
 public class LaMetricTimeHandler extends ConfigStatusBridgeHandler {
 
     private static final long CONNECTION_CHECK_INTERVAL = 60;
@@ -78,8 +81,10 @@ public class LaMetricTimeHandler extends ConfigStatusBridgeHandler {
 
     private final ClientBuilder clientBuilder;
 
+    @NonNullByDefault({})
     private LaMetricTime clock;
 
+    @Nullable
     private ScheduledFuture<?> connectionJob;
 
     public LaMetricTimeHandler(Bridge bridge, StateDescriptionOptionsProvider stateDescriptionProvider,
@@ -87,10 +92,6 @@ public class LaMetricTimeHandler extends ConfigStatusBridgeHandler {
         super(bridge);
         this.clientBuilder = clientBuilder;
         this.stateDescriptionProvider = stateDescriptionProvider;
-
-        if (stateDescriptionProvider == null) {
-            logger.warn("State description provider is null");
-        }
     }
 
     @Override
index db81eb526ab95bde83e15b45b3f414f4433c6b93..a34b5980e33012c40a68a17e1149624c8eeff6e4 100644 (file)
@@ -14,8 +14,10 @@ package org.openhab.binding.lametrictime.internal.handler;
 
 import static org.openhab.binding.lametrictime.internal.LaMetricTimeBindingConstants.CHANNEL_APP_CONTROL;
 
-import org.openhab.binding.lametrictime.api.local.ApplicationActionException;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActionException;
 import org.openhab.binding.lametrictime.internal.config.LaMetricTimeAppConfiguration;
 import org.openhab.core.library.types.NextPreviousType;
 import org.openhab.core.library.types.PlayPauseType;
@@ -32,6 +34,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class RadioAppHandler extends AbstractLaMetricTimeAppHandler {
     private static final String PACKAGE_NAME = "com.lametric.radio";
 
@@ -107,7 +110,7 @@ public class RadioAppHandler extends AbstractLaMetricTimeAppHandler {
     }
 
     @Override
-    protected String getPackageName(LaMetricTimeAppConfiguration config) {
+    protected @Nullable String getPackageName(LaMetricTimeAppConfiguration config) {
         return PACKAGE_NAME;
     }
 }
index c926f6b26044860d67ffd0c2690e6b1d17d889c4..29519c903341a214360bc084e3821ec9af4583ca 100644 (file)
@@ -14,8 +14,10 @@ package org.openhab.binding.lametrictime.internal.handler;
 
 import static org.openhab.binding.lametrictime.internal.LaMetricTimeBindingConstants.CHANNEL_APP_COMMAND;
 
-import org.openhab.binding.lametrictime.api.local.ApplicationActionException;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActionException;
 import org.openhab.binding.lametrictime.internal.config.LaMetricTimeAppConfiguration;
 import org.openhab.core.library.types.StringType;
 import org.openhab.core.thing.ChannelUID;
@@ -31,6 +33,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class StopwatchAppHandler extends AbstractLaMetricTimeAppHandler {
     private static final String PACKAGE_NAME = "com.lametric.stopwatch";
 
@@ -65,7 +68,7 @@ public class StopwatchAppHandler extends AbstractLaMetricTimeAppHandler {
     }
 
     @Override
-    protected String getPackageName(LaMetricTimeAppConfiguration config) {
+    protected @Nullable String getPackageName(LaMetricTimeAppConfiguration config) {
         return PACKAGE_NAME;
     }
 
index e8564004ae856a0f6d2312d406410ea3a4bd0f84..360a536ef289aab9f44d735d887f032e8de1268d 100644 (file)
@@ -14,8 +14,10 @@ package org.openhab.binding.lametrictime.internal.handler;
 
 import static org.openhab.binding.lametrictime.internal.LaMetricTimeBindingConstants.CHANNEL_APP_COMMAND;
 
-import org.openhab.binding.lametrictime.api.local.ApplicationActionException;
-import org.openhab.binding.lametrictime.api.model.CoreApps;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActionException;
 import org.openhab.binding.lametrictime.internal.config.LaMetricTimeAppConfiguration;
 import org.openhab.core.library.types.StringType;
 import org.openhab.core.thing.ChannelUID;
@@ -31,6 +33,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Gregory Moyer - Initial contribution
  */
+@NonNullByDefault
 public class WeatherAppHandler extends AbstractLaMetricTimeAppHandler {
     private static final String PACKAGE_NAME = "com.lametric.weather";
 
@@ -63,7 +66,7 @@ public class WeatherAppHandler extends AbstractLaMetricTimeAppHandler {
     }
 
     @Override
-    protected String getPackageName(LaMetricTimeAppConfiguration config) {
+    protected @Nullable String getPackageName(LaMetricTimeAppConfiguration config) {
         return PACKAGE_NAME;
     }
 
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/AllIntegrationTestsSuite.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/AllIntegrationTestsSuite.java
new file mode 100644 (file)
index 0000000..544da37
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.junit.runner.RunWith;
+
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+/**
+ * Integration test suit.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses({ "**/*IT.class" })
+@NonNullByDefault
+public class AllIntegrationTestsSuite {
+    // Execute all integration tests
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/AllUnitTestsSuite.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/AllUnitTestsSuite.java
new file mode 100644 (file)
index 0000000..35ada1a
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.junit.runner.RunWith;
+
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+/**
+ * Unit test suit.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses({ "**/*Test.class" })
+@NonNullByDefault
+public class AllUnitTestsSuite {
+    // Execute all unit tests
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/BrightnessModeTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/BrightnessModeTest.java
new file mode 100644 (file)
index 0000000..09717a8
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * brightness mode test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class BrightnessModeTest {
+    @Test
+    public void testConversion() {
+        for (BrightnessMode value : BrightnessMode.values()) {
+            assertEquals(value, BrightnessMode.toEnum(value.toRaw()));
+        }
+    }
+
+    @Test
+    public void testInvalidRawValue() {
+        assertNull(BrightnessMode.toEnum("invalid raw value"));
+    }
+
+    @Test
+    public void testNullRawValue() {
+        assertNull(BrightnessMode.toEnum(null));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/DisplayTypeTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/DisplayTypeTest.java
new file mode 100644 (file)
index 0000000..34bd78a
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * display type test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class DisplayTypeTest {
+    @Test
+    public void testConversion() {
+        for (DisplayType value : DisplayType.values()) {
+            assertEquals(value, DisplayType.toEnum(value.toRaw()));
+        }
+    }
+
+    @Test
+    public void testInvalidRawValue() {
+        assertNull(DisplayType.toEnum("invalid raw value"));
+    }
+
+    @Test
+    public void testNullRawValue() {
+        assertNull(DisplayType.toEnum(null));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IconTypeTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IconTypeTest.java
new file mode 100644 (file)
index 0000000..771e7ac
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * icon type test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class IconTypeTest {
+    @Test
+    public void testConversion() {
+        for (IconType value : IconType.values()) {
+            assertEquals(value, IconType.toEnum(value.toRaw()));
+        }
+    }
+
+    @Test
+    public void testInvalidRawValue() {
+        assertNull(IconType.toEnum("invalid raw value"));
+    }
+
+    @Test
+    public void testNullRawValue() {
+        assertNull(IconType.toEnum(null));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IpModeTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/IpModeTest.java
new file mode 100644 (file)
index 0000000..77e01bc
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * ip mode test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class IpModeTest {
+    @Test
+    public void testConversion() {
+        for (IpMode value : IpMode.values()) {
+            assertEquals(value, IpMode.toEnum(value.toRaw()));
+        }
+    }
+
+    @Test
+    public void testInvalidRawValue() {
+        assertNull(IpMode.toEnum("invalid raw value"));
+    }
+
+    @Test
+    public void testNullRawValue() {
+        assertNull(IpMode.toEnum(null));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/PriorityTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/PriorityTest.java
new file mode 100644 (file)
index 0000000..c574282
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * priority test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class PriorityTest {
+    @Test
+    public void testConversion() {
+        for (Priority value : Priority.values()) {
+            assertEquals(value, Priority.toEnum(value.toRaw()));
+        }
+    }
+
+    @Test
+    public void testInvalidRawValue() {
+        assertNull(Priority.toEnum("invalid raw value"));
+    }
+
+    @Test
+    public void testNullRawValue() {
+        assertNull(Priority.toEnum(null));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/SoundCategoryTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/SoundCategoryTest.java
new file mode 100644 (file)
index 0000000..36b76e6
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * sound category test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class SoundCategoryTest {
+    @Test
+    public void testConversion() {
+        for (SoundCategory value : SoundCategory.values()) {
+            assertEquals(value, SoundCategory.toEnum(value.toRaw()));
+        }
+    }
+
+    @Test
+    public void testInvalidRawValue() {
+        assertNull(SoundCategory.toEnum("invalid raw value"));
+    }
+
+    @Test
+    public void testNullRawValue() {
+        assertNull(SoundCategory.toEnum(null));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/SoundTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/SoundTest.java
new file mode 100644 (file)
index 0000000..b52a914
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * sound test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class SoundTest {
+    @Test
+    public void testConversion() {
+        for (Sound value : Sound.values()) {
+            assertEquals(value, Sound.toEnum(value.toRaw()));
+        }
+    }
+
+    @Test
+    public void testInvalidRawValue() {
+        assertNull(Sound.toEnum("invalid raw value"));
+    }
+
+    @Test
+    public void testNullRawValue() {
+        assertNull(Sound.toEnum(null));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/WifiEncryptionTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/dto/enums/WifiEncryptionTest.java
new file mode 100644 (file)
index 0000000..c936e3b
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.dto.enums;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * wifi encryption test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class WifiEncryptionTest {
+    @Test
+    public void testConversion() {
+        for (WifiEncryption value : WifiEncryption.values()) {
+            assertEquals(value, WifiEncryption.toEnum(value.toRaw()));
+        }
+    }
+
+    @Test
+    public void testInvalidRawValue() {
+        assertNull(WifiEncryption.toEnum("invalid raw value"));
+    }
+
+    @Test
+    public void testNullRawValue() {
+        assertNull(WifiEncryption.toEnum(null));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/impl/FileIconTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/impl/FileIconTest.java
new file mode 100644 (file)
index 0000000..3f1e25b
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.impl;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+/**
+ * file icon test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class FileIconTest extends AbstractTest {
+    @Test
+    public void testLocalPathGif() {
+        FileIcon icon = new FileIcon(getTestDataPath("smile.gif"));
+        assertEquals(
+                "data:image/gif;base64,R0lGODlhCAAIAPEAAPz+BPz+/AAAAAAAACH5BAkKAAIAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAACAAIAAACEZSAYJfIElREIdaGs3PPNFMAACH5BAkKAAIALAAAAAAIAAgAAAIRlIBgl8gSVEQh1oazU4szJxQAIfkECTIAAgAsAAAAAAgACAAAAhKUgGCXyBJURCHWhlU7fCmzCQUAIfkECRQAAgAsAAAAAAgACAAAAhGUgGCXyBIaClFa1Y5eymRRAAAh+QQJMgACACwAAAAACAAIAAACEpSAYJfIElREIdaGVTt8KbMJBQA7",
+                icon.toRaw());
+    }
+
+    @Test
+    public void testLocalPathPng() {
+        FileIcon icon = new FileIcon(getTestDataPath("info.png"));
+        assertEquals(
+                "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAL0lEQVQYlWN0NPv3nwEPYIEx9p1kRJFwMofoY0IXQGczMRAAVFSA7EhkNiMhbwIAA/sN+bH1CpgAAAAASUVORK5CYII=",
+                icon.toRaw());
+    }
+
+    @Test
+    public void testLocalFileGif() {
+        FileIcon icon = new FileIcon(getTestDataFile("smile.gif"));
+        assertEquals(
+                "data:image/gif;base64,R0lGODlhCAAIAPEAAPz+BPz+/AAAAAAAACH5BAkKAAIAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAACAAIAAACEZSAYJfIElREIdaGs3PPNFMAACH5BAkKAAIALAAAAAAIAAgAAAIRlIBgl8gSVEQh1oazU4szJxQAIfkECTIAAgAsAAAAAAgACAAAAhKUgGCXyBJURCHWhlU7fCmzCQUAIfkECRQAAgAsAAAAAAgACAAAAhGUgGCXyBIaClFa1Y5eymRRAAAh+QQJMgACACwAAAAACAAIAAACEpSAYJfIElREIdaGVTt8KbMJBQA7",
+                icon.toRaw());
+    }
+
+    @Test
+    public void testLocalFilePng() {
+        FileIcon icon = new FileIcon(getTestDataFile("info.png"));
+        assertEquals(
+                "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAL0lEQVQYlWN0NPv3nwEPYIEx9p1kRJFwMofoY0IXQGczMRAAVFSA7EhkNiMhbwIAA/sN+bH1CpgAAAAASUVORK5CYII=",
+                icon.toRaw());
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/ActionTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/ActionTest.java
new file mode 100644 (file)
index 0000000..d4c1701
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import java.io.FileReader;
+import java.util.Iterator;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+import com.google.gson.Gson;
+
+/**
+ * action test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class ActionTest extends AbstractTest {
+    private static Gson gson;
+
+    @BeforeAll
+    public static void setUpBeforeClass() {
+        gson = GsonGenerator.create(true);
+    }
+
+    @Test
+    @SuppressWarnings("serial")
+    public void testSerialize() throws Exception {
+        // @formatter:off
+        Action action = new Action().withParameters(new TreeMap<String, Parameter>(){{put("enabled", new BooleanParameter());
+                                                                                      put("time", new StringParameter());}});
+        // @formatter:on
+        assertEquals(readJson("action.json"), gson.toJson(action));
+    }
+
+    @Test
+    public void testDeserialize() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("action.json"))) {
+            Action action = gson.fromJson(reader, Action.class);
+            SortedMap<String, Parameter> parameters = action.getParameters();
+            assertNotNull(parameters);
+            assertEquals(2, parameters.size());
+
+            Iterator<String> parametersIter = parameters.keySet().iterator();
+            assertEquals("enabled", parametersIter.next());
+            assertEquals("time", parametersIter.next());
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/ApplicationTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/ApplicationTest.java
new file mode 100644 (file)
index 0000000..617ad9a
--- /dev/null
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import java.io.FileReader;
+import java.util.Iterator;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+import com.google.gson.Gson;
+
+/**
+ * application test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class ApplicationTest extends AbstractTest {
+    private static Gson gson;
+
+    @BeforeAll
+    public static void setUpBeforeClass() {
+        gson = GsonGenerator.create(true);
+    }
+
+    @Test
+    @SuppressWarnings("serial")
+    public void testSerializeAllFields() throws Exception {
+        Application app = new Application().withPackageName("com.lametric.radio").withVendor("LaMetric")
+                .withVersion("1.0.10").withVersionCode("22")
+                // @formatter:off
+                                           .withWidgets(new TreeMap<String, Widget>(){{put("589ed1b3fcdaa5180bf4848e55ba8061", new Widget());}})
+                                           .withActions(new TreeMap<String, Action>(){{put("radio.next", new Action());
+                                                                                       put("radio.play", new Action());
+                                                                                       put("radio.prev", new Action());
+                                                                                       put("radio.stop", new Action());}});
+                                           // @formatter:on
+        assertEquals(readJson("application-all.json"), gson.toJson(app));
+    }
+
+    @Test
+    public void testSerializeNullLists() throws Exception {
+        Application app = new Application().withPackageName("com.lametric.radio").withVendor("LaMetric")
+                .withVersion("1.0.10").withVersionCode("22");
+        assertEquals(readJson("application-null-maps.json"), gson.toJson(app));
+    }
+
+    @Test
+    public void testDeserializeAllFields() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("application-all.json"))) {
+            Application app = gson.fromJson(reader, Application.class);
+            assertEquals("com.lametric.radio", app.getPackageName());
+            assertEquals("LaMetric", app.getVendor());
+            assertEquals("1.0.10", app.getVersion());
+            assertEquals("22", app.getVersionCode());
+
+            SortedMap<String, Widget> widgets = app.getWidgets();
+            assertNotNull(widgets);
+            assertEquals(1, widgets.size());
+            assertEquals("589ed1b3fcdaa5180bf4848e55ba8061", widgets.keySet().iterator().next());
+
+            SortedMap<String, Action> actions = app.getActions();
+            assertNotNull(actions);
+            assertEquals(4, actions.size());
+
+            Iterator<String> actionsIter = actions.keySet().iterator();
+            assertEquals("radio.next", actionsIter.next());
+            assertEquals("radio.play", actionsIter.next());
+            assertEquals("radio.prev", actionsIter.next());
+            assertEquals("radio.stop", actionsIter.next());
+        }
+    }
+
+    @Test
+    public void testDeserializeNullLists() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("application-null-maps.json"))) {
+            Application app = gson.fromJson(reader, Application.class);
+            assertEquals("com.lametric.radio", app.getPackageName());
+            assertEquals("LaMetric", app.getVendor());
+            assertEquals("1.0.10", app.getVersion());
+            assertEquals("22", app.getVersionCode());
+            assertNull(app.getWidgets());
+            assertNull(app.getActions());
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/AudioTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/AudioTest.java
new file mode 100644 (file)
index 0000000..2ff6e34
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.FileReader;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+import com.google.gson.Gson;
+
+/**
+ * audio test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class AudioTest extends AbstractTest {
+    private static Gson gson;
+
+    @BeforeAll
+    public static void setUpBeforeClass() {
+        gson = GsonGenerator.create(true);
+    }
+
+    @Test
+    public void testSerializeAllFields() throws Exception {
+        Audio audio = new Audio().withVolume(42);
+        assertEquals(readJson("audio.json"), gson.toJson(audio));
+    }
+
+    @Test
+    public void testDeserializeAllFields() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("audio.json"))) {
+            Audio audio = gson.fromJson(reader, Audio.class);
+            assertEquals(Integer.valueOf(42), audio.getVolume());
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/BluetoothTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/BluetoothTest.java
new file mode 100644 (file)
index 0000000..1fbae8e
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.FileReader;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+import com.google.gson.Gson;
+
+/**
+ * bluetooth test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class BluetoothTest extends AbstractTest {
+    private static Gson gson;
+
+    @BeforeAll
+    public static void setUpBeforeClass() {
+        gson = GsonGenerator.create(true);
+    }
+
+    @Test
+    public void testSerializeAllFields() throws Exception {
+        Bluetooth bluetooth = new Bluetooth().withActive(false).withAvailable(true).withDiscoverable(false)
+                .withMac("AA:AA:AA:AA:AA:AA").withName("LM9999").withPairable(true);
+        assertEquals(readJson("bluetooth-mac-address.json"), gson.toJson(bluetooth));
+    }
+
+    @Test
+    public void testDeserializeMac() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("bluetooth-mac.json"))) {
+            Bluetooth bluetooth = gson.fromJson(reader, Bluetooth.class);
+            assertEquals(false, bluetooth.isActive());
+            assertEquals(true, bluetooth.isAvailable());
+            assertEquals(false, bluetooth.isDiscoverable());
+            assertEquals("AA:AA:AA:AA:AA:AA", bluetooth.getMac());
+            assertEquals("LM9999", bluetooth.getName());
+            assertEquals(true, bluetooth.isPairable());
+        }
+    }
+
+    @Test
+    public void testDeserializeAddress() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("bluetooth-address.json"))) {
+            Bluetooth bluetooth = gson.fromJson(reader, Bluetooth.class);
+            assertEquals(false, bluetooth.isActive());
+            assertEquals(true, bluetooth.isAvailable());
+            assertEquals(false, bluetooth.isDiscoverable());
+            assertEquals("AA:AA:AA:AA:AA:AA", bluetooth.getMac());
+            assertEquals("LM9999", bluetooth.getName());
+            assertEquals(true, bluetooth.isPairable());
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/FrameTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/FrameTest.java
new file mode 100644 (file)
index 0000000..e04f6d7
--- /dev/null
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.FileReader;
+import java.util.Arrays;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+import com.google.gson.Gson;
+
+/**
+ * frame test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class FrameTest extends AbstractTest {
+    private static Gson gson;
+
+    @BeforeAll
+    public static void setUpBeforeClass() {
+        gson = GsonGenerator.create(true);
+    }
+
+    @Test
+    public void testSerializeSimple() throws Exception {
+        Frame frame = new Frame().withIcon("i87").withText("Hello world!");
+        assertEquals(readJson("frame-simple.json"), gson.toJson(frame));
+    }
+
+    @Test
+    public void testSerializeGoal() throws Exception {
+        Frame frame = new Frame().withIcon("i120").withGoalData(new GoalData());
+        assertEquals(readJson("frame-goal.json"), gson.toJson(frame));
+    }
+
+    @Test
+    public void testSerializeChart() throws Exception {
+        Frame frame = new Frame().withChartData(Arrays.asList(1, 2, 3, 4, 5, 6, 7));
+        assertEquals(readJson("frame-chart.json"), gson.toJson(frame));
+    }
+
+    @Test
+    public void testDeserializeSimple() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("frame-simple.json"))) {
+            Frame frame = gson.fromJson(reader, Frame.class);
+            assertEquals("i87", frame.getIcon());
+            assertEquals("Hello world!", frame.getText());
+            assertEquals(null, frame.getGoalData());
+            assertEquals(null, frame.getChartData());
+        }
+    }
+
+    @Test
+    public void testDeserializeGoal() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("frame-goal.json"))) {
+            Frame frame = gson.fromJson(reader, Frame.class);
+            assertEquals("i120", frame.getIcon());
+            assertEquals(new GoalData(), frame.getGoalData());
+        }
+    }
+
+    @Test
+    public void testDeserializeChart() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("frame-chart.json"))) {
+            Frame frame = gson.fromJson(reader, Frame.class);
+            assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7), frame.getChartData());
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/GoalDataTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/GoalDataTest.java
new file mode 100644 (file)
index 0000000..e8a7522
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.FileReader;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+import com.google.gson.Gson;
+
+/**
+ * goal data test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class GoalDataTest extends AbstractTest {
+    private static Gson gson;
+
+    @BeforeAll
+    public static void setUpBeforeClass() {
+        gson = GsonGenerator.create(true);
+    }
+
+    @Test
+    public void testSerializeSimple() throws Exception {
+        GoalData goalData = new GoalData().withStart(0).withEnd(100).withCurrent(50).withUnit("%");
+        assertEquals(readJson("goal-data.json"), gson.toJson(goalData));
+    }
+
+    @Test
+    public void testDeserializeSimple() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("goal-data.json"))) {
+            GoalData goalData = gson.fromJson(reader, GoalData.class);
+            assertEquals(Integer.valueOf(0), goalData.getStart());
+            assertEquals(Integer.valueOf(100), goalData.getEnd());
+            assertEquals(Integer.valueOf(50), goalData.getCurrent());
+            assertEquals("%", goalData.getUnit());
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/UpdateActionTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/UpdateActionTest.java
new file mode 100644 (file)
index 0000000..0cfde32
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import java.io.FileReader;
+import java.util.TreeMap;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+import com.google.gson.Gson;
+
+/**
+ * update action test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class UpdateActionTest extends AbstractTest {
+    private static Gson gson;
+
+    @BeforeAll
+    public static void setUpBeforeClass() {
+        gson = GsonGenerator.create(true);
+    }
+
+    @Test
+    @SuppressWarnings("serial")
+    public void testSerialize() throws Exception {
+        UpdateAction action = new UpdateAction().withId("countdown.configure")
+        // @formatter:off
+                                                .withParameters(new TreeMap<String, Parameter>(){{put("duration", new IntegerParameter().withValue(30));}});
+                                                // @formatter:on
+        assertEquals(readJson("update-action.json"), gson.toJson(action));
+    }
+
+    @Test
+    public void testDeserialize() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("update-action.json"))) {
+            assertThrows(UnsupportedOperationException.class, () -> gson.fromJson(reader, UpdateAction.class));
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/WidgetTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/WidgetTest.java
new file mode 100644 (file)
index 0000000..cd74fb1
--- /dev/null
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.FileReader;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonPrimitive;
+
+/**
+ * widget test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class WidgetTest extends AbstractTest {
+    private static Gson gson;
+
+    @BeforeAll
+    public static void setUpBeforeClass() {
+        gson = GsonGenerator.create(true);
+    }
+
+    @Test
+    @SuppressWarnings("serial")
+    public void testSerialize() throws Exception {
+        Widget widget = new Widget().withPackageName("com.lametric.radio").withIndex(Integer.valueOf(-1))
+                .withSettings(new HashMap<String, JsonPrimitive>() {
+                    {
+                        put("_title", new JsonPrimitive("Radio"));
+                    }
+                });
+        assertEquals(readJson("widget.json"), gson.toJson(widget));
+    }
+
+    @Test
+    @SuppressWarnings("serial")
+    public void testDeserialize() throws Exception {
+        try (FileReader reader = new FileReader(getTestDataFile("widget.json"))) {
+            Widget widget = gson.fromJson(reader, Widget.class);
+            assertEquals("com.lametric.radio", widget.getPackageName());
+            assertEquals(Integer.valueOf(-1), widget.getIndex());
+            assertEquals(new HashMap<String, JsonPrimitive>() {
+                {
+                    put("_title", new JsonPrimitive("Radio"));
+                }
+            }, widget.getSettings());
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/WidgetUpdatesTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/dto/WidgetUpdatesTest.java
new file mode 100644 (file)
index 0000000..f797add
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.dto;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.common.impl.GsonGenerator;
+import org.openhab.binding.lametrictime.internal.api.test.AbstractTest;
+
+import com.google.gson.Gson;
+
+/**
+ * widget updates test.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+public class WidgetUpdatesTest extends AbstractTest {
+    private static Gson gson;
+
+    @BeforeAll
+    public static void setUpBeforeClass() {
+        gson = GsonGenerator.create(true);
+    }
+
+    @Test
+    public void testSerialize() throws Exception {
+        WidgetUpdates widgetUpdates = new WidgetUpdates()
+                .withFrames(Arrays.asList(new Frame().withIcon("i120").withText("12°").withIndex(0)));
+
+        assertEquals(readJson("widget-updates.json"), gson.toJson(widgetUpdates));
+    }
+
+    @Test
+    public void testDeserialize() throws Exception {
+        try (InputStreamReader reader = new InputStreamReader(
+                new FileInputStream(getTestDataFile("widget-updates.json")), StandardCharsets.UTF_8)) {
+            WidgetUpdates widgetUpdates = gson.fromJson(reader, WidgetUpdates.class);
+            assertEquals("i120", widgetUpdates.getFrames().get(0).getIcon());
+            assertEquals("12°", widgetUpdates.getFrames().get(0).getText());
+            assertEquals(null, widgetUpdates.getFrames().get(0).getGoalData());
+            assertEquals(null, widgetUpdates.getFrames().get(0).getChartData());
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/impl/LaMetricTimeLocalImplIT.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/local/impl/LaMetricTimeLocalImplIT.java
new file mode 100644 (file)
index 0000000..92f3d66
--- /dev/null
@@ -0,0 +1,269 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.local.impl;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.lametrictime.internal.api.dto.CoreApps;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.BrightnessMode;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.Priority;
+import org.openhab.binding.lametrictime.internal.api.dto.enums.SoundCategory;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActionException;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationActivationException;
+import org.openhab.binding.lametrictime.internal.api.local.ApplicationNotFoundException;
+import org.openhab.binding.lametrictime.internal.api.local.LocalConfiguration;
+import org.openhab.binding.lametrictime.internal.api.local.NotificationCreationException;
+import org.openhab.binding.lametrictime.internal.api.local.NotificationNotFoundException;
+import org.openhab.binding.lametrictime.internal.api.local.UpdateException;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Audio;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Bluetooth;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Display;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Frame;
+import org.openhab.binding.lametrictime.internal.api.local.dto.GoalData;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Notification;
+import org.openhab.binding.lametrictime.internal.api.local.dto.NotificationModel;
+import org.openhab.binding.lametrictime.internal.api.local.dto.Sound;
+import org.openhab.binding.lametrictime.internal.api.test.TestUtil;
+
+/**
+ * <p>
+ * This test is excluded from the normal battery of tests because it is not a
+ * unit test, but rather a live test against an actual device. The purpose of
+ * this test is to make sure that after a firmware upgrade, the device still
+ * responds in a backwards compatible way.
+ * </p>
+ * <br>
+ * <p>
+ * To run this test, first create a file called 'device.properties' in the
+ * matching package as this class under 'src/test/resources' with two
+ * properties: 'host' and 'apiKey'. After putting the configuration in place,
+ * either execute the test via your IDE or run 'mvn -DskipITs=false
+ * integration-test'.
+ * </p>
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@Disabled
+@NonNullByDefault
+public class LaMetricTimeLocalImplIT {
+    private static final String PROP_HOST = "host";
+    private static final String PROP_API_KEY = "apiKey";
+
+    @Nullable
+    private static LaMetricTimeLocalImpl local;
+
+    @BeforeAll
+    public static void setup() throws IOException {
+        File file = TestUtil.getTestDataPath(LaMetricTimeLocalImplIT.class, "device.properties").toFile();
+        if (!file.exists()) {
+            throw new IllegalStateException("Device configuration properties missing at " + file.getAbsolutePath());
+        }
+
+        try (InputStream in = new FileInputStream(file)) {
+            Properties properties = new Properties();
+            properties.load(in);
+
+            if (!properties.containsKey(PROP_HOST)) {
+                throw new IllegalStateException("Device configuration property " + PROP_HOST + " was not found");
+            }
+
+            if (!properties.containsKey(PROP_API_KEY)) {
+                throw new IllegalStateException("Device configuration property " + PROP_API_KEY + " was not found");
+            }
+
+            LocalConfiguration config = new LocalConfiguration().withHost(properties.getProperty(PROP_HOST))
+                    .withApiKey(properties.getProperty(PROP_API_KEY)).withLogging(true);
+            local = new LaMetricTimeLocalImpl(config);
+        }
+    }
+
+    @Test
+    public void testGetApi() {
+        local.getApi();
+    }
+
+    @Test
+    public void testGetDevice() {
+        local.getDevice();
+    }
+
+    @Test
+    public void testCreateAndGetNotification() throws NotificationCreationException, NotificationNotFoundException {
+        String id = local.createNotification(buildSimpleNotification(1));
+        local.getCurrentNotification();
+        local.getNotification(id);
+    }
+
+    @Test
+    public void testCreateGoalNotification() throws NotificationCreationException, NotificationNotFoundException {
+        local.createNotification(buildGoalNotification(1));
+    }
+
+    @Test
+    public void testCreateChartNotification() throws NotificationCreationException, NotificationNotFoundException {
+        local.createNotification(buildChartNotification(1));
+    }
+
+    @Test
+    public void testGetNotifications() {
+        local.getNotifications();
+    }
+
+    @Test
+    public void testGetInvalidNotification() {
+        assertThrows(NotificationNotFoundException.class, () -> local.getNotification("invalid"));
+    }
+
+    @Test
+    public void testCreateAndDeleteNotification() throws NotificationCreationException, NotificationNotFoundException {
+        String id = local.createNotification(buildSimpleNotification(0));
+        local.deleteNotification(id);
+    }
+
+    @Test
+    public void testGetDisplay() {
+        local.getDisplay();
+    }
+
+    @Test
+    public void testUpdateDisplay() throws UpdateException {
+        local.updateDisplay(new Display().withBrightnessMode(BrightnessMode.AUTO.toRaw()));
+    }
+
+    @Test
+    public void testGetAudio() {
+        local.getAudio();
+    }
+
+    @Test
+    public void testUpdateAudio() throws UpdateException {
+        local.updateAudio(new Audio().withVolume(25));
+    }
+
+    @Test
+    public void testGetBluetooth() {
+        local.getBluetooth();
+    }
+
+    @Test
+    public void testUpdateBluetooth() throws UpdateException {
+        local.updateBluetooth(new Bluetooth().withActive(false));
+    }
+
+    @Test
+    public void testGetWifi() {
+        local.getWifi();
+    }
+
+    @Test
+    public void testGetApplications() {
+        local.getApplications();
+    }
+
+    @Test
+    public void testGetClockApplication() throws ApplicationNotFoundException {
+        local.getApplication(CoreApps.clock().getPackageName());
+    }
+
+    @Test
+    public void testGetCountdownApplication() throws ApplicationNotFoundException {
+        local.getApplication(CoreApps.countdown().getPackageName());
+    }
+
+    @Test
+    public void testGetRadioApplication() throws ApplicationNotFoundException {
+        local.getApplication(CoreApps.radio().getPackageName());
+    }
+
+    @Test
+    public void testGetStopwatchApplication() throws ApplicationNotFoundException {
+        local.getApplication(CoreApps.stopwatch().getPackageName());
+    }
+
+    @Test
+    public void testGetWeatherApplication() throws ApplicationNotFoundException {
+        local.getApplication(CoreApps.weather().getPackageName());
+    }
+
+    @Test
+    public void testGetInvalidApplication() {
+        assertThrows(ApplicationNotFoundException.class, () -> local.getApplication("invalid"));
+    }
+
+    @Test
+    public void testActivatePreviousApplication() {
+        local.activatePreviousApplication();
+    }
+
+    @Test
+    public void testActivateNextApplication() {
+        local.activateNextApplication();
+    }
+
+    @Test
+    public void testActivateApplication() throws ApplicationActivationException, ApplicationNotFoundException {
+        // delete any notifications on the device or else the activate fails
+        local.getNotifications().stream().forEach(n -> {
+            try {
+                local.deleteNotification(n.getId());
+            } catch (NotificationNotFoundException e) {
+                // ignore
+            }
+        });
+
+        local.activateApplication(CoreApps.clock().getPackageName(),
+                local.getApplication(CoreApps.clock().getPackageName()).getWidgets().firstKey());
+    }
+
+    @Test
+    public void testDoAction() throws ApplicationActionException, ApplicationNotFoundException {
+        local.doAction(CoreApps.weather().getPackageName(),
+                local.getApplication(CoreApps.weather().getPackageName()).getWidgets().firstKey(),
+                CoreApps.weather().forecast().getAction());
+    }
+
+    private Notification buildSimpleNotification(int cycles) {
+        return new Notification().withPriority(Priority.CRITICAL.toRaw()).withModel(new NotificationModel()
+                .withCycles(cycles)
+                .withSound(new Sound().withCategory(SoundCategory.NOTIFICATIONS.toRaw())
+                        .withId(org.openhab.binding.lametrictime.internal.api.dto.enums.Sound.CAT.toRaw()))
+                .withFrames(Arrays.asList(new Frame().withText("CAT!").withIcon(
+                        "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAUklEQVQYlWNUVFBgYGBgYBC98uE/AxJ4rSPAyMDAwMCETRJZjAnGgOlAZote+fCfCV0nOmA0+yKAYTwygJuAzQoGBgYGRkUFBQZ0dyDzGQl5EwCTESNpFb6zEwAAAABJRU5ErkJggg=="))));
+    }
+
+    private Notification buildGoalNotification(int cycles) {
+        return new Notification().withPriority(Priority.CRITICAL.toRaw())
+                .withModel(new NotificationModel().withCycles(cycles).withFrames(Arrays.asList(new Frame()
+                        .withGoalData(new GoalData().withStart(0).withCurrent(50).withEnd(100).withUnit("%")).withIcon(
+                                "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAUklEQVQYlWNUVFBgYGBgYBC98uE/AxJ4rSPAyMDAwMCETRJZjAnGgOlAZote+fCfCV0nOmA0+yKAYTwygJuAzQoGBgYGRkUFBQZ0dyDzGQl5EwCTESNpFb6zEwAAAABJRU5ErkJggg=="))));
+    }
+
+    private Notification buildChartNotification(int cycles) {
+        return new Notification().withPriority(Priority.CRITICAL.toRaw()).withModel(new NotificationModel()
+                .withCycles(cycles)
+                .withFrames(Arrays.asList(new Frame().withChartData(Arrays.asList(1, 2, 3, 4, 5, 6, 7)).withIcon(
+                        "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAUklEQVQYlWNUVFBgYGBgYBC98uE/AxJ4rSPAyMDAwMCETRJZjAnGgOlAZote+fCfCV0nOmA0+yKAYTwygJuAzQoGBgYGRkUFBQZ0dyDzGQl5EwCTESNpFb6zEwAAAABJRU5ErkJggg=="))));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/test/AbstractTest.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/test/AbstractTest.java
new file mode 100644 (file)
index 0000000..1ba9dcb
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * abstract test class.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public abstract class AbstractTest {
+    protected File getTestDataFile(String name) {
+        return getTestDataPath(name).toFile();
+    }
+
+    protected Path getTestDataPath(String name) {
+        return TestUtil.getTestDataPath(this.getClass(), name);
+    }
+
+    protected String readJson(String jsonFileName) throws IOException {
+        return String.join("\n", Files.readAllLines(getTestDataPath(jsonFileName)));
+    }
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/test/TestUtil.java b/bundles/org.openhab.binding.lametrictime/src/test/java/org/openhab/binding/lametrictime/internal/api/test/TestUtil.java
new file mode 100644 (file)
index 0000000..b290072
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.lametrictime.internal.api.test;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Test utility class.
+ *
+ * @author Gregory Moyer - Initial contribution
+ */
+@NonNullByDefault
+public class TestUtil {
+    private static final String RESOURCES_PATH = "src/test/resources/";
+
+    public static Path getTestDataPath(Class<?> clazz, String name) {
+        String packageName = clazz.getPackage().getName();
+
+        List<String> paths = new ArrayList<>();
+        paths.addAll(Arrays.asList(packageName.split("\\.")));
+        paths.add(name);
+
+        return Paths.get(RESOURCES_PATH, paths.toArray(new String[paths.size()]));
+    }
+
+    // @formatter:off
+    private TestUtil() {}
+    // @formatter:on
+}
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/README b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/README
deleted file mode 100644 (file)
index f8dc614..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Test images were pulled from LaMetric's developer portal.
-
-info.png:   https://developer.lametric.com/content/apps/icon_thumbs/1248.png
-smile.gif:  https://developer.lametric.com/content/apps/icon_thumbs/87.gif
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/info.png b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/info.png
deleted file mode 100644 (file)
index c1b8c80..0000000
Binary files a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/info.png and /dev/null differ
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/smile.gif b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/smile.gif
deleted file mode 100644 (file)
index 566c38a..0000000
Binary files a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/impl/smile.gif and /dev/null differ
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/action.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/action.json
deleted file mode 100644 (file)
index 2f5de43..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "enabled": {
-    "data_type": "bool"
-  },
-  "time": {
-    "data_type": "string"
-  }
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/application-all.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/application-all.json
deleted file mode 100644 (file)
index df03fc3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "actions": {
-    "radio.next": {},
-    "radio.play": {},
-    "radio.prev": {},
-    "radio.stop": {}
-  },
-  "package": "com.lametric.radio",
-  "vendor": "LaMetric",
-  "version": "1.0.10",
-  "version_code": "22",
-  "widgets": {
-    "589ed1b3fcdaa5180bf4848e55ba8061": {}
-  }
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/application-null-maps.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/application-null-maps.json
deleted file mode 100644 (file)
index f79ed2d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  "package": "com.lametric.radio",
-  "vendor": "LaMetric",
-  "version": "1.0.10",
-  "version_code": "22"
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/audio.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/audio.json
deleted file mode 100644 (file)
index 32019b9..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "volume": 42
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/bluetooth-address.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/bluetooth-address.json
deleted file mode 100644 (file)
index cdf5e7a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "active": false,
-  "address": "AA:AA:AA:AA:AA:AA",
-  "available": true,
-  "discoverable": false,
-  "name": "LM9999",
-  "pairable": true
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/bluetooth-mac-address.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/bluetooth-mac-address.json
deleted file mode 100644 (file)
index d0ea1c3..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-  "active": false,
-  "mac": "AA:AA:AA:AA:AA:AA",
-  "address": "AA:AA:AA:AA:AA:AA",
-  "available": true,
-  "discoverable": false,
-  "name": "LM9999",
-  "pairable": true
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/bluetooth-mac.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/bluetooth-mac.json
deleted file mode 100644 (file)
index 7efad14..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "active": false,
-  "mac": "AA:AA:AA:AA:AA:AA",
-  "available": true,
-  "discoverable": false,
-  "name": "LM9999",
-  "pairable": true
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/frame-chart.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/frame-chart.json
deleted file mode 100644 (file)
index 1072d2e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{
-  "chartData": [
-    1,
-    2,
-    3,
-    4,
-    5,
-    6,
-    7
-  ]
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/frame-goal.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/frame-goal.json
deleted file mode 100644 (file)
index f3c8706..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "icon": "i120",
-  "goalData": {}
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/frame-simple.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/frame-simple.json
deleted file mode 100644 (file)
index 9f73440..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "icon": "i87",
-  "text": "Hello world!"
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/goal-data.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/goal-data.json
deleted file mode 100644 (file)
index ff57ecf..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  "start": 0,
-  "current": 50,
-  "end": 100,
-  "unit": "%"
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/update-action.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/update-action.json
deleted file mode 100644 (file)
index 5bcfa96..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  "id": "countdown.configure",
-  "params": {
-    "duration": 30
-  }
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/widget-updates.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/widget-updates.json
deleted file mode 100644 (file)
index 403a188..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-  "frames": [
-    {
-      "icon": "i120",
-      "text": "12°",
-      "index": 0
-    }
-  ]
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/widget.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/api/local/model/widget.json
deleted file mode 100644 (file)
index 8313910..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "package": "com.lametric.radio",
-  "index": -1,
-  "settings": {
-    "_title": "Radio"
-  }
-}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/README b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/README
new file mode 100644 (file)
index 0000000..f8dc614
--- /dev/null
@@ -0,0 +1,4 @@
+Test images were pulled from LaMetric's developer portal.
+
+info.png:   https://developer.lametric.com/content/apps/icon_thumbs/1248.png
+smile.gif:  https://developer.lametric.com/content/apps/icon_thumbs/87.gif
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/info.png b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/info.png
new file mode 100644 (file)
index 0000000..c1b8c80
Binary files /dev/null and b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/info.png differ
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/smile.gif b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/smile.gif
new file mode 100644 (file)
index 0000000..566c38a
Binary files /dev/null and b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/impl/smile.gif differ
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/action.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/action.json
new file mode 100644 (file)
index 0000000..2f5de43
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "enabled": {
+    "data_type": "bool"
+  },
+  "time": {
+    "data_type": "string"
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/application-all.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/application-all.json
new file mode 100644 (file)
index 0000000..df03fc3
--- /dev/null
@@ -0,0 +1,15 @@
+{
+  "actions": {
+    "radio.next": {},
+    "radio.play": {},
+    "radio.prev": {},
+    "radio.stop": {}
+  },
+  "package": "com.lametric.radio",
+  "vendor": "LaMetric",
+  "version": "1.0.10",
+  "version_code": "22",
+  "widgets": {
+    "589ed1b3fcdaa5180bf4848e55ba8061": {}
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/application-null-maps.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/application-null-maps.json
new file mode 100644 (file)
index 0000000..f79ed2d
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "package": "com.lametric.radio",
+  "vendor": "LaMetric",
+  "version": "1.0.10",
+  "version_code": "22"
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/audio.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/audio.json
new file mode 100644 (file)
index 0000000..32019b9
--- /dev/null
@@ -0,0 +1,3 @@
+{
+  "volume": 42
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/bluetooth-address.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/bluetooth-address.json
new file mode 100644 (file)
index 0000000..cdf5e7a
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "active": false,
+  "address": "AA:AA:AA:AA:AA:AA",
+  "available": true,
+  "discoverable": false,
+  "name": "LM9999",
+  "pairable": true
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/bluetooth-mac-address.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/bluetooth-mac-address.json
new file mode 100644 (file)
index 0000000..d0ea1c3
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "active": false,
+  "mac": "AA:AA:AA:AA:AA:AA",
+  "address": "AA:AA:AA:AA:AA:AA",
+  "available": true,
+  "discoverable": false,
+  "name": "LM9999",
+  "pairable": true
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/bluetooth-mac.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/bluetooth-mac.json
new file mode 100644 (file)
index 0000000..7efad14
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "active": false,
+  "mac": "AA:AA:AA:AA:AA:AA",
+  "available": true,
+  "discoverable": false,
+  "name": "LM9999",
+  "pairable": true
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/frame-chart.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/frame-chart.json
new file mode 100644 (file)
index 0000000..1072d2e
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "chartData": [
+    1,
+    2,
+    3,
+    4,
+    5,
+    6,
+    7
+  ]
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/frame-goal.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/frame-goal.json
new file mode 100644 (file)
index 0000000..f3c8706
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "icon": "i120",
+  "goalData": {}
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/frame-simple.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/frame-simple.json
new file mode 100644 (file)
index 0000000..9f73440
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "icon": "i87",
+  "text": "Hello world!"
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/goal-data.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/goal-data.json
new file mode 100644 (file)
index 0000000..ff57ecf
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "start": 0,
+  "current": 50,
+  "end": 100,
+  "unit": "%"
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/update-action.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/update-action.json
new file mode 100644 (file)
index 0000000..5bcfa96
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "id": "countdown.configure",
+  "params": {
+    "duration": 30
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/widget-updates.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/widget-updates.json
new file mode 100644 (file)
index 0000000..403a188
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "frames": [
+    {
+      "icon": "i120",
+      "text": "12°",
+      "index": 0
+    }
+  ]
+}
\ No newline at end of file
diff --git a/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/widget.json b/bundles/org.openhab.binding.lametrictime/src/test/resources/org/openhab/binding/lametrictime/internal/api/local/dto/widget.json
new file mode 100644 (file)
index 0000000..8313910
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "package": "com.lametric.radio",
+  "index": -1,
+  "settings": {
+    "_title": "Radio"
+  }
+}
\ No newline at end of file