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

Commit f22462e

Browse files
authored
2.0.0 (#31)
* 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
1 parent 230d9df commit f22462e

File tree

47 files changed

+3410
-444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3410
-444
lines changed

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,22 @@
33
/.classpath
44
/.project
55
/.settings
6+
/handler-message-mqtt/target/
7+
/handler-message-amqp/target/
8+
/samples/sample/target/
9+
/samples/remove_me_mqtt/target/
10+
/samples/target/
11+
/account/target/
12+
/handler-manage/target/
13+
/data-mqtt/target/
14+
/data-amqp/target/
15+
/data/data-amqp/target/
16+
/data/data-mqtt/target/
17+
/management/target/
18+
/data/common/target/
19+
/data/amqp/target/
20+
/data/mqtt/target/
21+
/data/target/
22+
/samples/mqtt/target/
23+
/.license
24+
/management/src/main/proto/

README.md

+10-39
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,17 @@
1-
# 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)
1+
# 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)
22

3-
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.
3+
This is the Java SDK for [The Things Network](https://www.thethingsnetwork.org) to interact with The Things Network backend.
44

5-
## Maven [![MAVEN](https://img.shields.io/maven-central/v/org.thethingsnetwork/java-app-lib.svg)](http://mvnrepository.com/artifact/org.thethingsnetwork/java-app-lib)
5+
**Please be aware that this sdk is under heavy development !**
66

7-
Depend on the artifact via [Maven](http://mvnrepository.com/artifact/org.thethingsnetwork/java-app-lib):
7+
## Modules
88

9-
```xml
10-
<dependency>
11-
<groupId>org.thethingsnetwork</groupId>
12-
<artifactId>java-app-lib</artifactId>
13-
<version>1.0.0</version>
14-
</dependency>
15-
```
9+
- **[WIP]** [Account](account) - Interact with The Things Network account server
10+
- **[WIP]** [Management](management) - Interact with The Things Network Handler via the API
11+
- **[WIP]** [Data AMQP](data/amqp) - Subscribe to Things Network Handler to send/receive data via AMQP
12+
- [Data MQTT](data/mqtt) - Subscribe to Things Network Handler to send/receive data via MQTT
13+
- [Samples](samples) - Samples of how to use previous libraries
1614

1715
## Documentation
1816

19-
A Quick Start and full API Reference can be found in [The Things Network Documentation](https://www.thethingsnetwork.org/docs/refactor/java/).
20-
21-
## Smaple & Test [![Build Status](https://travis-ci.org/TheThingsNetwork/java-app-lib.svg?branch=master)](https://travis-ci.org/TheThingsNetwork/java-app-lib)
22-
23-
A [sample app](sample/src/main/java/org/thethingsnetwork/java/app/sample/Test.java) is included. To run:
24-
25-
1. Install [OpenJDK](http://openjdk.java.net/install/) or [Java](https://www.java.com/en/download/).
26-
2. [Download](http://maven.apache.org/download.cgi) and [Instal](http://maven.apache.org/install.html) Maven.
27-
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.
28-
4. Build and cache the artifact:
29-
30-
```bash
31-
mvn clean package install
32-
```
33-
34-
5. export your region, Application ID and Access Key as environment variables.
35-
36-
```bash
37-
export region="eu"
38-
export appId="my-app-id"
39-
export accessKey="my-access-key"
40-
```
41-
6. Build and run the Test class:
42-
43-
```bash
44-
cd sample
45-
mvn clean compile exec:java -Dexec.mainClass="org.thethingsnetwork.java.app.sample.App"
46-
```
17+
A Quick Start and full API Reference can be found in [The Things Network Documentation](https://www.thethingsnetwork.org/docs/applications/java/).

account/pom.xml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.thethingsnetwork</groupId>
6+
<artifactId>app-sdk</artifactId>
7+
<version>2.0.0</version>
8+
</parent>
9+
<artifactId>account</artifactId>
10+
<packaging>jar</packaging>
11+
12+
<name>The Things Network Account SDK</name>
13+
<description>The Things Network Account API Client</description>
14+
15+
16+
<properties>
17+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
<maven.compiler.source>1.8</maven.compiler.source>
19+
<maven.compiler.target>1.8</maven.compiler.target>
20+
</properties>
21+
22+
23+
<dependencies>
24+
<dependency>
25+
<groupId>io.reactivex</groupId>
26+
<artifactId>rxjava</artifactId>
27+
<version>1.1.10</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>com.fasterxml.jackson.core</groupId>
31+
<artifactId>jackson-databind</artifactId>
32+
<version>2.8.3</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>com.squareup.okhttp3</groupId>
36+
<artifactId>okhttp</artifactId>
37+
<version>3.4.2</version>
38+
</dependency>
39+
</dependencies>
40+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* The MIT License
3+
*
4+
* Copyright (c) 2016 The Things Network
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
package org.thethingsnetwork.account;
25+
26+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
27+
import org.thethingsnetwork.account.auth.token.OAuth2Token;
28+
29+
/**
30+
*
31+
* @author Romain Cambier
32+
*/
33+
@JsonIgnoreProperties(ignoreUnknown = true)
34+
public interface AbstractApplication {
35+
36+
public String getId();
37+
38+
public String getName();
39+
40+
public String getCreated();
41+
42+
public void setName(String _name);
43+
44+
public void updateCredentials(OAuth2Token _creds);
45+
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* The MIT License
3+
*
4+
* Copyright (c) 2016 The Things Network
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
package org.thethingsnetwork.account;
25+
26+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
27+
import java.util.Collections;
28+
import java.util.List;
29+
30+
/**
31+
*
32+
* @author Romain Cambier
33+
*/
34+
@JsonIgnoreProperties(ignoreUnknown = true)
35+
public class AccessKey {
36+
37+
private String name;
38+
private String key;
39+
private List<String> rights;
40+
41+
public AccessKey() {
42+
43+
}
44+
45+
public AccessKey(String _name, List<String> _rights) {
46+
name = _name;
47+
rights = _rights;
48+
}
49+
50+
public String getName() {
51+
return name;
52+
}
53+
54+
public String getKey() {
55+
return key;
56+
}
57+
58+
public List<String> getRights() {
59+
return Collections.unmodifiableList(rights);
60+
}
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* The MIT License
3+
*
4+
* Copyright (c) 2016 The Things Network
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
package org.thethingsnetwork.account;
25+
26+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
27+
import java.util.Collections;
28+
import java.util.List;
29+
30+
/**
31+
*
32+
* @author Romain Cambier
33+
*/
34+
@JsonIgnoreProperties(ignoreUnknown = true)
35+
public class Collaborator {
36+
37+
private String username;
38+
private String email;
39+
private List<String> rights;
40+
41+
public Collaborator() {
42+
43+
}
44+
45+
public Collaborator(String _username, List<String> _rights) {
46+
username = _username;
47+
email = null;
48+
rights = _rights;
49+
}
50+
51+
public String getUsername() {
52+
return username;
53+
}
54+
55+
public String getEmail() {
56+
return email;
57+
}
58+
59+
public List<String> getRights() {
60+
return Collections.unmodifiableList(rights);
61+
}
62+
}

0 commit comments

Comments
 (0)