Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.

Commit 6560e30

Browse files
committed
Add SimpleClient, update pom
1 parent cf55498 commit 6560e30

File tree

6 files changed

+341
-120
lines changed

6 files changed

+341
-120
lines changed

.idea/dictionaries/jonathanhasenburg.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 186 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,192 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
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-
<groupId>de.hasenburg</groupId>
5-
<artifactId>fbase</artifactId>
6-
<version>0.0.1-SNAPSHOT</version>
7-
<name>FBase</name>
2+
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+
<groupId>de.hasenburg</groupId>
5+
<artifactId>fbase</artifactId>
6+
<version>0.0.1-SNAPSHOT</version>
7+
<name>FBase</name>
88

9-
<build>
10-
<plugins>
11-
<plugin>
12-
<groupId>org.apache.maven.plugins</groupId>
13-
<artifactId>maven-compiler-plugin</artifactId>
14-
<version>3.6.1</version>
15-
<configuration>
16-
<source>1.8</source>
17-
<target>1.8</target>
18-
</configuration>
19-
</plugin>
20-
<plugin>
21-
<artifactId>maven-assembly-plugin</artifactId>
22-
<configuration>
23-
<descriptorRefs>
24-
<descriptorRef>jar-with-dependencies</descriptorRef>
25-
</descriptorRefs>
26-
<archive>
27-
<manifest>
28-
<mainClass>control.Starter</mainClass>
29-
</manifest>
30-
</archive>
31-
<outputDirectory>target/</outputDirectory>
32-
</configuration>
33-
<executions>
34-
<execution>
35-
<id>make-my-jar-with-dependencies</id>
36-
<phase>package</phase>
37-
<goals>
38-
<goal>single</goal>
39-
</goals>
40-
</execution>
41-
</executions>
42-
</plugin>
43-
</plugins>
44-
</build>
9+
<properties>
10+
<kotlin.version>1.3.31</kotlin.version>
11+
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
12+
</properties>
4513

46-
<dependencyManagement>
47-
<dependencies>
48-
<dependency>
49-
<groupId>com.amazonaws</groupId>
50-
<artifactId>aws-java-sdk-bom</artifactId>
51-
<version>1.11.186</version>
52-
<type>pom</type>
53-
<scope>import</scope>
54-
</dependency>
55-
</dependencies>
56-
</dependencyManagement>
14+
<build>
15+
<plugins>
16+
<!-- Kotlin -->
17+
<plugin>
18+
<groupId>org.jetbrains.kotlin</groupId>
19+
<artifactId>kotlin-maven-plugin</artifactId>
20+
<version>${kotlin.version}</version>
21+
<executions>
22+
<execution>
23+
<id>compile</id>
24+
<goals>
25+
<goal>compile</goal>
26+
</goals>
27+
<configuration>
28+
<sourceDirs>
29+
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
30+
<sourceDir>${project.basedir}/src/main/java</sourceDir>
31+
</sourceDirs>
32+
</configuration>
33+
</execution>
34+
<execution>
35+
<id>test-compile</id>
36+
<goals>
37+
<goal>test-compile</goal>
38+
</goals>
39+
<configuration>
40+
<sourceDirs>
41+
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
42+
<sourceDir>${project.basedir}/src/test/java</sourceDir>
43+
</sourceDirs>
44+
</configuration>
45+
</execution>
46+
</executions>
47+
</plugin>
48+
<plugin>
49+
<groupId>org.apache.maven.plugins</groupId>
50+
<artifactId>maven-compiler-plugin</artifactId>
51+
<version>3.6.1</version>
52+
<configuration>
53+
<source>8</source>
54+
<target>8</target>
55+
</configuration>
56+
<executions>
57+
<!-- Replacing default-compile as it is treated specially by maven -->
58+
<execution>
59+
<id>default-compile</id>
60+
<phase>none</phase>
61+
</execution>
62+
<!-- Replacing default-testCompile as it is treated specially by maven -->
63+
<execution>
64+
<id>default-testCompile</id>
65+
<phase>none</phase>
66+
</execution>
67+
<execution>
68+
<id>java-compile</id>
69+
<phase>compile</phase>
70+
<goals>
71+
<goal>compile</goal>
72+
</goals>
73+
</execution>
74+
<execution>
75+
<id>java-test-compile</id>
76+
<phase>test-compile</phase>
77+
<goals>
78+
<goal>testCompile</goal>
79+
</goals>
80+
</execution>
81+
</executions>
82+
</plugin>
83+
<!-- End Kotlin -->
84+
<plugin>
85+
<artifactId>maven-assembly-plugin</artifactId>
86+
<configuration>
87+
<descriptorRefs>
88+
<descriptorRef>jar-with-dependencies</descriptorRef>
89+
</descriptorRefs>
90+
<archive>
91+
<manifest>
92+
<mainClass>control.Starter</mainClass>
93+
</manifest>
94+
</archive>
95+
<outputDirectory>target/</outputDirectory>
96+
</configuration>
97+
<executions>
98+
<execution>
99+
<id>make-my-jar-with-dependencies</id>
100+
<phase>package</phase>
101+
<goals>
102+
<goal>single</goal>
103+
</goals>
104+
</execution>
105+
</executions>
106+
</plugin>
107+
</plugins>
108+
</build>
57109

58-
<dependencies>
59-
<dependency>
60-
<groupId>com.amazonaws</groupId>
61-
<artifactId>aws-java-sdk-s3</artifactId>
62-
</dependency>
63-
<dependency>
64-
<groupId>de.hasenburg</groupId>
65-
<artifactId>fbasecommons</artifactId>
66-
<version>0.0.5</version>
67-
</dependency>
68-
<dependency>
69-
<groupId>log4j</groupId>
70-
<artifactId>log4j</artifactId>
71-
<version>1.2.17</version>
72-
</dependency>
73-
<dependency>
74-
<groupId>org.javatuples</groupId>
75-
<artifactId>javatuples</artifactId>
76-
<version>1.2</version>
77-
</dependency>
78-
<!-- Rest -->
79-
<dependency>
80-
<groupId>org.eclipse.jetty</groupId>
81-
<artifactId>jetty-server</artifactId>
82-
<version>9.4.6.v20170531</version>
83-
</dependency>
84-
<dependency>
85-
<groupId>org.eclipse.jetty</groupId>
86-
<artifactId>jetty-servlet</artifactId>
87-
<version>9.4.6.v20170531</version>
88-
</dependency>
89-
<dependency>
90-
<groupId>org.eclipse.jetty</groupId>
91-
<artifactId>jetty-util</artifactId>
92-
<version>9.4.6.v20170531</version>
93-
</dependency>
94-
<dependency>
95-
<groupId>org.glassfish.jersey.core</groupId>
96-
<artifactId>jersey-server</artifactId>
97-
<version>2.26</version>
98-
</dependency>
99-
<dependency>
100-
<groupId>org.glassfish.jersey.containers</groupId>
101-
<artifactId>jersey-container-servlet-core</artifactId>
102-
<version>2.26</version>
103-
</dependency>
104-
<dependency>
105-
<groupId>org.glassfish.jersey.containers</groupId>
106-
<artifactId>jersey-container-jetty-http</artifactId>
107-
<version>2.26</version>
108-
</dependency>
109-
<dependency>
110-
<groupId>org.glassfish.jersey.inject</groupId>
111-
<artifactId>jersey-hk2</artifactId>
112-
<version>2.26</version>
113-
</dependency>
114-
<!-- Client -->
115-
<dependency>
116-
<groupId>com.mashape.unirest</groupId>
117-
<artifactId>unirest-java</artifactId>
118-
<version>1.4.9</version>
119-
</dependency>
120-
</dependencies>
110+
<dependencyManagement>
111+
<dependencies>
112+
<dependency>
113+
<groupId>com.amazonaws</groupId>
114+
<artifactId>aws-java-sdk-bom</artifactId>
115+
<version>1.11.186</version>
116+
<type>pom</type>
117+
<scope>import</scope>
118+
</dependency>
119+
</dependencies>
120+
</dependencyManagement>
121+
122+
<dependencies>
123+
<!-- Kotlin -->
124+
<dependency>
125+
<groupId>org.jetbrains.kotlin</groupId>
126+
<artifactId>kotlin-stdlib</artifactId>
127+
<version>${kotlin.version}</version>
128+
</dependency>
129+
<dependency>
130+
<groupId>com.amazonaws</groupId>
131+
<artifactId>aws-java-sdk-s3</artifactId>
132+
</dependency>
133+
<dependency>
134+
<groupId>de.hasenburg</groupId>
135+
<artifactId>fbasecommons</artifactId>
136+
<version>0.0.5</version>
137+
</dependency>
138+
<dependency>
139+
<groupId>log4j</groupId>
140+
<artifactId>log4j</artifactId>
141+
<version>1.2.17</version>
142+
</dependency>
143+
<dependency>
144+
<groupId>org.javatuples</groupId>
145+
<artifactId>javatuples</artifactId>
146+
<version>1.2</version>
147+
</dependency>
148+
<!-- Rest -->
149+
<dependency>
150+
<groupId>org.eclipse.jetty</groupId>
151+
<artifactId>jetty-server</artifactId>
152+
<version>9.4.20.v20190813</version>
153+
</dependency>
154+
<dependency>
155+
<groupId>org.eclipse.jetty</groupId>
156+
<artifactId>jetty-servlet</artifactId>
157+
<version>9.4.20.v20190813</version>
158+
</dependency>
159+
<dependency>
160+
<groupId>org.eclipse.jetty</groupId>
161+
<artifactId>jetty-util</artifactId>
162+
<version>9.4.20.v20190813</version>
163+
</dependency>
164+
<dependency>
165+
<groupId>org.glassfish.jersey.core</groupId>
166+
<artifactId>jersey-server</artifactId>
167+
<version>2.26</version>
168+
</dependency>
169+
<dependency>
170+
<groupId>org.glassfish.jersey.containers</groupId>
171+
<artifactId>jersey-container-servlet-core</artifactId>
172+
<version>2.26</version>
173+
</dependency>
174+
<dependency>
175+
<groupId>org.glassfish.jersey.containers</groupId>
176+
<artifactId>jersey-container-jetty-http</artifactId>
177+
<version>2.26</version>
178+
</dependency>
179+
<dependency>
180+
<groupId>org.glassfish.jersey.inject</groupId>
181+
<artifactId>jersey-hk2</artifactId>
182+
<version>2.26</version>
183+
</dependency>
184+
<!-- Client -->
185+
<dependency>
186+
<groupId>com.mashape.unirest</groupId>
187+
<artifactId>unirest-java</artifactId>
188+
<version>1.4.9</version>
189+
</dependency>
190+
</dependencies>
121191

122192
</project>

src/main/java/client/KeygroupRequest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ public boolean addClient(KeygroupID keygroupID, ClientID clientID) throws Unires
5353

5454
return handleBoolResponse(response, logger);
5555
}
56+
57+
public boolean deleteClient(KeygroupID keygroupID, ClientID clientID) throws UnirestException {
58+
String target = target(keygroupID.getApp(), keygroupID.getTenant(), keygroupID.getGroup(), "deleteClient");
59+
logger.info("Running delete request targeting " + target);
60+
61+
HttpResponse<String> response =
62+
Unirest.put(target).header("Content-Type", "application/json")
63+
.body(JSONable.toJSON(clientID)).asString();
64+
65+
return handleBoolResponse(response, logger);
66+
}
5667

5768
public boolean addReplicaNode(KeygroupID keygroupID, ReplicaNodeConfig repNC) throws UnirestException {
5869
String target = target(keygroupID.getApp(), keygroupID.getTenant(), keygroupID.getGroup(), "addReplicaNode");

src/main/java/client/Client.java renamed to src/main/java/client/QuickstartClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
import model.data.KeygroupID;
1313

1414
/**
15-
* A client implemantation which allows the usage of the FBase rest interface
15+
* A client implementation which allows the usage of the FBase rest interface
1616
*
1717
* @author jonathanhasenburg
1818
*
1919
*/
20-
public class Client {
20+
public class QuickstartClient {
2121

22-
private static Logger logger = Logger.getLogger(Client.class.getName());
22+
private static Logger logger = Logger.getLogger(QuickstartClient.class.getName());
2323

2424
public void quickstart_clientAction(String address, int port) throws UnirestException {
2525
KeygroupID keygroupID = new KeygroupID("smartlight", "h1", "brightness");
@@ -48,7 +48,7 @@ public static void main(String[] args) throws UnirestException, FBaseEncryptionE
4848
String address = "localhost";
4949
int port = 8081;
5050

51-
Client c = new Client();
51+
QuickstartClient c = new QuickstartClient();
5252
c.quickstart_clientAction(address, port);
5353
}
5454

0 commit comments

Comments
 (0)