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

Commit 8d02c0d

Browse files
committed
Simplify quickstart
1 parent 9aa635b commit 8d02c0d

11 files changed

+24
-19
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ For some of the tests, a running naming service is required. The naming service
1616

1717
## Current ToDos not listed in code
1818

19-
### One to One Communication
20-
- [ ] Add one to one communication for datarecords
21-
2219
### Storage
23-
- [ ] Remove data that is expired
20+
- [ ] Remove data that is expired.
2421

2522
### Handling Missed Messages
26-
- [ ] Add message history cleanup functionality (on receiver and sender side)
23+
- [ ] Add message history cleanup functionality (on receiver and sender side). Currently, the message history is never cleaned.
2724

2825
### Controlling FBase with Clients
29-
- [ ] Enable encryption and authentication
26+
- [ ] Enable encryption and authentication (Currently, everyone can use the rest API of a node and do everything. However, the node has to check whether the requesting client is already registered with the naming service.)

src/main/java/client/Client.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package client;
22

3+
import crypto.CryptoProvider;
4+
import model.config.KeygroupConfig;
35
import org.apache.log4j.Logger;
46

57
import com.mashape.unirest.http.exceptions.UnirestException;
@@ -19,8 +21,13 @@ public class Client {
1921

2022
private static Logger logger = Logger.getLogger(Client.class.getName());
2123

22-
public void getScenario(String address, int port) throws UnirestException {
24+
public void quickstart_clientAction(String address, int port) throws UnirestException {
2325
KeygroupID keygroupID = new KeygroupID("smartlight", "h1", "brightness");
26+
27+
KeygroupConfig config = new KeygroupConfig(keygroupID, "a secret password", CryptoProvider.EncryptionAlgorithm.AES);
28+
KeygroupRequest keygroups = new KeygroupRequest(address, port);
29+
logger.info("Created keygroup: " + keygroups.createKeygroup(config));
30+
2431
DataIdentifier dataID = new DataIdentifier(keygroupID, "M-1");
2532

2633
DataRecord newRecord = new DataRecord(new DataIdentifier(keygroupID, "M-2"), null);
@@ -42,7 +49,7 @@ public static void main(String[] args) throws UnirestException, FBaseEncryptionE
4249
int port = 8081;
4350

4451
Client c = new Client();
45-
c.getScenario(address, port);
52+
c.quickstart_clientAction(address, port);
4653
}
4754

4855
// public boolean keygroupConfig_create(String address, int port, KeygroupConfig keygroupConfig)

src/main/java/communication/MessageIdEvaluator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ private TreeSet<Integer> getIDSet(TreeMap<String, TreeSet<Integer>> machineMap,
104104
}
105105

106106
private Runnable evaluateIDs = () -> {
107-
logger.debug("Running through all messageIDs");
108107
List<MessageID> missingIDs = getMissingMessageIDs();
109-
logger.debug("Found " + missingIDs.size() + " missing IDs");
108+
if (!missingIDs.isEmpty()) {
109+
logger.debug("Found " + missingIDs.size() + " missing IDs");
110+
}
110111
if (fBase != null) {
111112
NodeID nodeID = null;
112113
DirectMessageSender directMessageSender = null;

src/main/java/control/Starter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void main(String[] args)
1717
if (args.length == 1) {
1818
fbase = new FBase(args[0]);
1919
} else {
20-
fbase = new FBase("local.properties");
20+
fbase = new FBase("quickstart_local.properties");
2121
}
2222
fbase.startup(true, true); // TODO 2: parse from args
2323
//fbase.fillWithData();

src/main/java/tasks/background/CheckKeygroupConfigurationsOnUpdatesTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public CheckKeygroupConfigurationsOnUpdatesTask(FBase fBase, int checkInterval)
7272
public Boolean executeFunctionality() {
7373

7474
while (!Thread.currentThread().isInterrupted()) {
75-
logger.info("Checking keygroup configurations on updates");
75+
logger.debug("Checking keygroup configurations on updates");
7676

7777
currentResponsibleKeygroups.clear();
7878
currentKeygroupConfigurations.clear();

src/main/java/tasks/background/DetectLostResponsibility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public DetectLostResponsibility(FBase fBase, int checkInterval) {
5252
public Boolean executeFunctionality() {
5353

5454
while (!Thread.currentThread().isInterrupted()) {
55-
logger.info("Looking for lost responsibilities");
55+
logger.debug("Looking for lost responsibilities");
5656

5757
try {
5858
Set<KeygroupID> subscribedKeygroups =

src/main/java/tasks/background/DetectMissingHeartbeats.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public DetectMissingHeartbeats(FBase fBase, int checkInterval, int toleratedMiss
5656
public Boolean executeFunctionality() {
5757

5858
while (!Thread.currentThread().isInterrupted()) {
59-
logger.info("Looking for missing heartbeats");
59+
logger.debug("Looking for missing heartbeats");
6060

6161
try {
6262
Map<String, Pair<String, Long>> heartbeats = fBase.connector.heartbeats_listAll();

src/main/java/tasks/background/DetectMissingResponsibility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public DetectMissingResponsibility(FBase fBase, int checkInterval) {
4949
public Boolean executeFunctionality() {
5050

5151
while (!Thread.currentThread().isInterrupted()) {
52-
logger.info("Looking for missing responsibilities");
52+
logger.debug("Looking for missing responsibilities");
5353

5454
try {
5555
Map<KeygroupID, Pair<String, Integer>> responsibilities =

src/main/java/tasks/background/PollLatestConfigurationDataForResponsibleKeygroupsTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class PollLatestConfigurationDataForResponsibleKeygroupsTask extends Task
4747
Logger.getLogger(PollLatestConfigurationDataForResponsibleKeygroupsTask.class.getName());
4848

4949
static {
50-
logger.setLevel(Level.INFO);
50+
logger.setLevel(Level.WARN);
5151
}
5252

5353
/**
@@ -71,7 +71,7 @@ public Boolean executeFunctionality() {
7171

7272
while (!Thread.currentThread().isInterrupted()) {
7373

74-
logger.info("Polling latest configuration data");
74+
logger.debug("Polling latest configuration data");
7575

7676
try {
7777
// get responsible keygroupIDs

src/main/java/tasks/background/PutHeartbeatTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public PutHeartbeatTask(FBase fBase, int pulse) {
4242
public Boolean executeFunctionality() {
4343

4444
while (!Thread.currentThread().isInterrupted()) {
45-
logger.info("Putting heartbeat");
45+
logger.debug("Putting heartbeat");
4646

4747
try {
4848
fBase.connector.heartbeats_update(fBase.configuration.getMachineName(),

src/main/resources/log4j.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ log4j.appender.file.layout.ConversionPattern=%-5p [%d{HH:mm:ss, SSS}] %-25c %x -
1717

1818
# log-level config
1919
log4j.logger.com.amazonaws=WARN
20-
log4j.logger.org.apache.http=WARN
20+
log4j.logger.org.apache.http=WARN

0 commit comments

Comments
 (0)