Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
[openhabcloud] Upgrade dependencies, use DS annotations, add license …
Browse files Browse the repository at this point in the history
…info (#4500)

Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn authored and kaikreuzer committed Jan 27, 2019
1 parent 1b67937 commit 2ef23f0
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 45 deletions.
19 changes: 9 additions & 10 deletions addons/io/org.openhab.io.openhabcloud/.classpath
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/json-20140107.jar"/>
<classpathentry kind="lib" path="lib/socket.io-client-0.8.2.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="lib/engine.io-client-0.8.2.jar"/>
<classpathentry kind="lib" path="lib/okhttp-3.4.1.jar"/>
<classpathentry kind="lib" path="lib/okhttp-ws-3.4.1.jar"/>
<classpathentry kind="lib" path="lib/okio-1.9.0.jar"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins" />
<classpathentry kind="src" path="src/main/java" />
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" />
<classpathentry kind="lib" path="lib/engine.io-client-1.0.0.jar" />
<classpathentry kind="lib" path="lib/json-20180813.jar" />
<classpathentry kind="lib" path="lib/okhttp-3.12.1.jar" />
<classpathentry kind="lib" path="lib/okio-1.15.0.jar" />
<classpathentry kind="lib" path="lib/socket.io-client-1.0.0.jar" />
<classpathentry kind="output" path="target/classes" />
</classpath>
11 changes: 5 additions & 6 deletions addons/io/org.openhab.io.openhabcloud/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ Automatic-Module-Name: org.openhab.io.openhabcloud
Bundle-ActivationPolicy: lazy
Bundle-ClassPath:
.,
lib/json-20140107.jar,
lib/engine.io-client-0.8.2.jar,
lib/okhttp-3.4.1.jar,
lib/okhttp-ws-3.4.1.jar,
lib/okio-1.9.0.jar,
lib/socket.io-client-0.8.2.jar
lib/engine.io-client-1.0.0.jar,
lib/json-20180813.jar,
lib/okhttp-3.12.1.jar,
lib/okio-1.15.0.jar,
lib/socket.io-client-1.0.0.jar
Bundle-ManifestVersion: 2
Bundle-Name: openHAB Cloud Connector Bundle
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Expand Down
27 changes: 27 additions & 0 deletions addons/io/org.openhab.io.openhabcloud/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,30 @@ https://www.eclipse.org/legal/epl-2.0/.
== Source Code

https://github.com/openhab/openhab2-addons

== Third-party Content

engine.io-client
* License: MIT License
* Project: https://socketio.github.io/engine.io-client-java/
* Source: https://github.com/socketio/engine.io-client-java

json
* License: JSON License
* Project: https://github.com/stleary/JSON-java
* Source: https://github.com/stleary/JSON-java

okhttp
* License: Apache License 2.0
* Project: https://square.github.io/okhttp/
* Source: https://github.com/square/okhttp

okio
* License: Apache License 2.0
* Project: https://github.com/square/okio
* Source: https://github.com/square/okio

socket.io-client
* License: MIT License
* Project: https://socketio.github.io/socket.io-client-java/
* Source: https://github.com/socketio/socket.io-client-java
1 change: 1 addition & 0 deletions addons/io/org.openhab.io.openhabcloud/OSGI-INF/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*.xml
28 changes: 0 additions & 28 deletions addons/io/org.openhab.io.openhabcloud/OSGI-INF/openhabcloud.xml

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
import org.eclipse.smarthome.config.core.ConfigConstants;
import org.eclipse.smarthome.config.core.ConfigurableService;
import org.eclipse.smarthome.core.events.Event;
import org.eclipse.smarthome.core.events.EventFilter;
import org.eclipse.smarthome.core.events.EventPublisher;
Expand All @@ -49,6 +50,14 @@
import org.openhab.core.OpenHAB;
import org.openhab.io.openhabcloud.NotificationAction;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Modified;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -58,7 +67,11 @@
* @author Victor Belov - Initial contribution
* @author Kai Kreuzer - migrated code to new Jetty client and ESH APIs
*/

@Component(immediate = true, service = { EventSubscriber.class, ActionService.class }, property = {
Constants.SERVICE_PID + "=org.openhab.openhabcloud",
ConfigurableService.SERVICE_PROPERTY_DESCRIPTION_URI + "=io:openhabcloud",
ConfigurableService.SERVICE_PROPERTY_LABEL + "=openHAB Cloud",
ConfigurableService.SERVICE_PROPERTY_CATEGORY + "=io" })
public class CloudService implements ActionService, CloudClientListener, EventSubscriber {

private static final String CFG_EXPOSE = "expose";
Expand Down Expand Up @@ -121,6 +134,7 @@ public void sendBroadcastNotification(String message, String icon, String severi
cloudClient.sendBroadcastNotification(message, icon, severity);
}

@Activate
protected void activate(BundleContext context, Map<String, ?> config) {
clientVersion = StringUtils.substringBefore(context.getBundle().getVersion().toString(), ".qualifier");
localPort = HttpServiceUtil.getHttpServicePort(context);
Expand Down Expand Up @@ -151,11 +165,13 @@ private void checkJavaVersion() {
}
}

@Deactivate
protected void deactivate() {
logger.debug("openHAB Cloud connector deactivated");
cloudClient.shutdown();
}

@Modified
protected void modified(Map<String, ?> config) {
if (config != null && config.get(CFG_MODE) != null) {
remoteAccessEnabled = "remote".equals(config.get(CFG_MODE));
Expand Down Expand Up @@ -308,6 +324,7 @@ public void sendCommand(String itemName, String commandString) {
}
}

@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC)
public void setItemRegistry(ItemRegistry itemRegistry) {
this.itemRegistry = itemRegistry;
}
Expand All @@ -316,6 +333,7 @@ public void unsetItemRegistry(ItemRegistry itemRegistry) {
this.itemRegistry = null;
}

@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
public void setEventPublisher(EventPublisher eventPublisher) {
this.eventPublisher = eventPublisher;
}
Expand Down

0 comments on commit 2ef23f0

Please sign in to comment.