This repository has been archived by the owner on Oct 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Re-organized repo for #26 * updated existing mqtt lib to the new repo structure * ready to start working on it ! * Create README.md * renamed main artifact (pom project) from sdk to app-sdk (see #26 and #27) * started moving mqtt client stuff to common so that they can be shared with amqp * first draft of th amqp data impl. * fixed data pom file * started draft impl * added java version config * updated global java version config * first draft of a complete implementation * now even working ! * added access-keys * added access-keys constructors * added getRawToken() method * Created abstract client interface for live-data refactored the javadoc fixed a lot of small glitches in the mqtt client moved some stuff from account to management changed version to 2.0.0 * Small tweaks * changed maven artifact name for mqtt client * management wip * added warning message about dev status * Fix links * updated docs for v2 * updated ttn repo branch * Use relative links * Fix sample class * fixed a typo in mqtt sample
- Loading branch information
Showing
47 changed files
with
3,410 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,17 @@ | ||
# The Things Network Java Client [![Build Status](https://travis-ci.org/TheThingsNetwork/java-app-lib.svg?branch=master)](https://travis-ci.org/TheThingsNetwork/java-app-lib) [![MAVEN](https://img.shields.io/maven-central/v/org.thethingsnetwork/java-app-lib.svg)](http://mvnrepository.com/artifact/org.thethingsnetwork/java-app-lib) | ||
# The Things Network Java SDK [![Build Status](https://travis-ci.org/TheThingsNetwork/java-app-sdk.svg?branch=master)](https://travis-ci.org/TheThingsNetwork/java-app-sdk) | ||
|
||
This is the Java client for [The Things Network](https://www.thethingsnetwork.org) to receive activations and messages from IoT devices via The Things Network and send messages as well. | ||
This is the Java SDK for [The Things Network](https://www.thethingsnetwork.org) to interact with The Things Network backend. | ||
|
||
## Maven [![MAVEN](https://img.shields.io/maven-central/v/org.thethingsnetwork/java-app-lib.svg)](http://mvnrepository.com/artifact/org.thethingsnetwork/java-app-lib) | ||
**Please be aware that this sdk is under heavy development !** | ||
|
||
Depend on the artifact via [Maven](http://mvnrepository.com/artifact/org.thethingsnetwork/java-app-lib): | ||
## Modules | ||
|
||
```xml | ||
<dependency> | ||
<groupId>org.thethingsnetwork</groupId> | ||
<artifactId>java-app-lib</artifactId> | ||
<version>1.0.0</version> | ||
</dependency> | ||
``` | ||
- **[WIP]** [Account](account) - Interact with The Things Network account server | ||
- **[WIP]** [Management](management) - Interact with The Things Network Handler via the API | ||
- **[WIP]** [Data AMQP](data/amqp) - Subscribe to Things Network Handler to send/receive data via AMQP | ||
- [Data MQTT](data/mqtt) - Subscribe to Things Network Handler to send/receive data via MQTT | ||
- [Samples](samples) - Samples of how to use previous libraries | ||
|
||
## Documentation | ||
|
||
A Quick Start and full API Reference can be found in [The Things Network Documentation](https://www.thethingsnetwork.org/docs/refactor/java/). | ||
|
||
## Smaple & Test [![Build Status](https://travis-ci.org/TheThingsNetwork/java-app-lib.svg?branch=master)](https://travis-ci.org/TheThingsNetwork/java-app-lib) | ||
|
||
A [sample app](sample/src/main/java/org/thethingsnetwork/java/app/sample/Test.java) is included. To run: | ||
|
||
1. Install [OpenJDK](http://openjdk.java.net/install/) or [Java](https://www.java.com/en/download/). | ||
2. [Download](http://maven.apache.org/download.cgi) and [Instal](http://maven.apache.org/install.html) Maven. | ||
3. [Download](https://github.com/TheThingsNetwork/java-app-lib/archive/master.zip) or [clone](https://help.github.com/articles/which-remote-url-should-i-use/) the repository. | ||
4. Build and cache the artifact: | ||
|
||
```bash | ||
mvn clean package install | ||
``` | ||
|
||
5. export your region, Application ID and Access Key as environment variables. | ||
|
||
```bash | ||
export region="eu" | ||
export appId="my-app-id" | ||
export accessKey="my-access-key" | ||
``` | ||
6. Build and run the Test class: | ||
|
||
```bash | ||
cd sample | ||
mvn clean compile exec:java -Dexec.mainClass="org.thethingsnetwork.java.app.sample.App" | ||
``` | ||
A Quick Start and full API Reference can be found in [The Things Network Documentation](https://www.thethingsnetwork.org/docs/applications/java/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.thethingsnetwork</groupId> | ||
<artifactId>app-sdk</artifactId> | ||
<version>2.0.0</version> | ||
</parent> | ||
<artifactId>account</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>The Things Network Account SDK</name> | ||
<description>The Things Network Account API Client</description> | ||
|
||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.reactivex</groupId> | ||
<artifactId>rxjava</artifactId> | ||
<version>1.1.10</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.8.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.squareup.okhttp3</groupId> | ||
<artifactId>okhttp</artifactId> | ||
<version>3.4.2</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
46 changes: 46 additions & 0 deletions
46
account/src/main/java/org/thethingsnetwork/account/AbstractApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2016 The Things Network | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.thethingsnetwork.account; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import org.thethingsnetwork.account.auth.token.OAuth2Token; | ||
|
||
/** | ||
* | ||
* @author Romain Cambier | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public interface AbstractApplication { | ||
|
||
public String getId(); | ||
|
||
public String getName(); | ||
|
||
public String getCreated(); | ||
|
||
public void setName(String _name); | ||
|
||
public void updateCredentials(OAuth2Token _creds); | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
account/src/main/java/org/thethingsnetwork/account/AccessKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2016 The Things Network | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.thethingsnetwork.account; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* | ||
* @author Romain Cambier | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class AccessKey { | ||
|
||
private String name; | ||
private String key; | ||
private List<String> rights; | ||
|
||
public AccessKey() { | ||
|
||
} | ||
|
||
public AccessKey(String _name, List<String> _rights) { | ||
name = _name; | ||
rights = _rights; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getKey() { | ||
return key; | ||
} | ||
|
||
public List<String> getRights() { | ||
return Collections.unmodifiableList(rights); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
account/src/main/java/org/thethingsnetwork/account/Collaborator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2016 The Things Network | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.thethingsnetwork.account; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* | ||
* @author Romain Cambier | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class Collaborator { | ||
|
||
private String username; | ||
private String email; | ||
private List<String> rights; | ||
|
||
public Collaborator() { | ||
|
||
} | ||
|
||
public Collaborator(String _username, List<String> _rights) { | ||
username = _username; | ||
email = null; | ||
rights = _rights; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public List<String> getRights() { | ||
return Collections.unmodifiableList(rights); | ||
} | ||
} |
Oops, something went wrong.