Skip to content

Commit

Permalink
[sleepiq] Removed Jersey dependencies (openhab#7562)
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn authored and markus7017 committed Sep 18, 2020
1 parent 03c88d6 commit 560440a
Show file tree
Hide file tree
Showing 68 changed files with 5,254 additions and 32 deletions.
6 changes: 4 additions & 2 deletions bundles/org.openhab.binding.sleepiq/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<classpathentry kind="src" path="src/3rdparty/java"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/3rdparty/test">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
Expand Down
9 changes: 4 additions & 5 deletions bundles/org.openhab.binding.sleepiq/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ https://github.com/openhab/openhab-addons

== Third-party Content

libsleepiq-java
The sources of libsleepiq-java are included in src/3rdparty/java and have been slightly adapted.
* License: Apache 2.0 License
* Project: https://github.com/syphr42/libsleepiq-java
* Source: https://github.com/syphr42/libsleepiq-java

provider-gson
* License: EPL 1.0 License
* Project: https://github.com/hstaudacher/osgi-jax-rs-connector
* Source: https://github.com/hstaudacher/osgi-jax-rs-connector
This binding includes a class from Jersey in the src/3rdparty/java folder.
* License: CDDL License
* Project: https://eclipse-ee4j.github.io/jersey/
48 changes: 38 additions & 10 deletions bundles/org.openhab.binding.sleepiq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,45 @@

<dependencies>
<dependency>
<groupId>org.syphr</groupId>
<artifactId>sleepiq-api</artifactId>
<version>0.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.eclipsesource.jaxrs</groupId>
<artifactId>provider-gson</artifactId>
<version>2.3</version>
<scope>compile</scope>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>add-source</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<sources>
<source>src/3rdparty/java</source>
</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>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2017 Gregory Moyer
*
* 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.sleepiq.api;

import org.openhab.binding.sleepiq.api.model.Failure;

public class BedNotFoundException extends SleepIQException
{
private static final long serialVersionUID = 1L;

public BedNotFoundException(Failure failure)
{
super(failure);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
/*
* Copyright 2017 Gregory Moyer
*
* 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.sleepiq.api;

import java.net.URI;
import java.util.logging.Level;

/**
* This class represents configuration parameters for using {@link SleepIQ}.
*
* @author Gregory Moyer
*/
public class Configuration
{
private String username;
private String password;

private URI baseUri = URI.create("https://api.sleepiq.sleepnumber.com/rest");

private boolean logging = false;

/**
* Get the username on the account.
*
* @return the username
*/
public String getUsername()
{
return username;
}

/**
* Set the username on the account. This should be the username used to
* register with SleepIQ.
*
* @param username
* the value to set
*/
public void setUsername(String username)
{
this.username = username;
}

/**
* Set the username on the account. This should be the username used to
* register with SleepIQ.
*
* @param username
* the value to set
* @return this configuration instance
*/
public Configuration withUsername(String username)
{
setUsername(username);
return this;
}

/**
* Get the password on the account.
*
* @return the password
*/
public String getPassword()
{
return password;
}

/**
* Set the password on the account. This should be the password used to
* register with SleepIQ.
*
* @param password
* the value to set
*/
public void setPassword(String password)
{
this.password = password;
}

/**
* Set the password on the account. This should be the password used to
* register with SleepIQ.
*
* @param password
* the value to set
* @return this configuration instance
*/
public Configuration withPassword(String password)
{
setPassword(password);
return this;
}

/**
* Get the base URI of the SleepIQ cloud service.
*
* @return the base URI
*/
public URI getBaseUri()
{
return baseUri;
}

/**
* Set the base URI of the SleepIQ cloud service. It is unlikely that this
* will need to be changed from its default value.
*
* @param baseUri
* the value to set
*/
public void setBaseUri(URI baseUri)
{
this.baseUri = baseUri;
}

/**
* Set the base URI of the SleepIQ cloud service. It is unlikely that this
* will need to be changed from its default value.
*
* @param baseUri
* the value to set
* @return this configuration instance
*/
public Configuration withBaseUri(URI baseUri)
{
setBaseUri(baseUri);
return this;
}

/**
* Get the logging flag.
*
* @return the logging flag
*/
public boolean isLogging()
{
return logging;
}

/**
* Set the logging flag. When this is set to <code>true</code>, all requests
* and responses will be logged at the {@link Level#INFO} level. <b>This
* includes usernames and passwords!</b>
*
* @param logging
* the value to set
*/
public void setLogging(boolean logging)
{
this.logging = logging;
}

/**
* Set the logging flag. When this is set to <code>true</code>, all requests
* and responses will be logged at the {@link Level#INFO} level. <b>This
* includes usernames and passwords!</b>
*
* @param logging
* the value to set
* @return this configuration instance
*/
public Configuration withLogging(boolean logging)
{
setLogging(logging);
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2017 Gregory Moyer
*
* 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.sleepiq.api;

import org.openhab.binding.sleepiq.api.model.Failure;

public class LoginException extends SleepIQException
{
private static final long serialVersionUID = 1L;

public LoginException(Failure failure)
{
super(failure);
}
}
Loading

0 comments on commit 560440a

Please sign in to comment.