aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/gnunet/arm
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-10-08 21:22:43 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-10-08 21:22:43 +0000
commit5b4933f12a3eadedf84e6adf00e1c1ac15924f6d (patch)
tree5824cf1236dbdbca515cc7d1f5f7bce1ee3eba6b /src/main/java/org/gnunet/arm
parenta8c1c65a00dce604ff829dfe10568cd06c8f8bda (diff)
downloadgnunet-java-5b4933f12a3eadedf84e6adf00e1c1ac15924f6d.tar.gz
gnunet-java-5b4933f12a3eadedf84e6adf00e1c1ac15924f6d.zip
- identity service implemented
- started with arm implementation - removed locking from scheduler - separated TaskConfiguration and TaskIdentifier - implemented proper message stream tokenizer - work on voting
Diffstat (limited to 'src/main/java/org/gnunet/arm')
-rw-r--r--src/main/java/org/gnunet/arm/Arm.java70
-rw-r--r--src/main/java/org/gnunet/arm/ArmMonitor.java27
-rw-r--r--src/main/java/org/gnunet/arm/ResultHandler.java31
-rw-r--r--src/main/java/org/gnunet/arm/ServiceListHandler.java28
-rw-r--r--src/main/java/org/gnunet/arm/ServiceStatusHandler.java25
-rw-r--r--src/main/java/org/gnunet/arm/messages/ListResultMessage.java41
-rw-r--r--src/main/java/org/gnunet/arm/messages/RequestMessage.java25
-rw-r--r--src/main/java/org/gnunet/arm/messages/ResultMessage.java35
-rw-r--r--src/main/java/org/gnunet/arm/messages/StatusMessage.java61
9 files changed, 343 insertions, 0 deletions
diff --git a/src/main/java/org/gnunet/arm/Arm.java b/src/main/java/org/gnunet/arm/Arm.java
new file mode 100644
index 0000000..503413f
--- /dev/null
+++ b/src/main/java/org/gnunet/arm/Arm.java
@@ -0,0 +1,70 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.arm;
22
23import org.gnunet.util.Client;
24import org.gnunet.util.Configuration;
25
26/**
27 * API for the Automatic Restart Manager (ARM)
28 */
29public class Arm {
30 private final Configuration configuration;
31 private Client client;
32 public Arm(Configuration configuration) {
33 this.configuration = configuration;
34 client = new Client("arm", configuration);
35 }
36
37 /**
38 * Disconnect from ARM, the Arm object may not be used afterwards.
39 */
40 public void disconnect() {
41 client.disconnect();
42 }
43 public void requestServiceList(ServiceListHandler serviceListHandler) {
44
45 }
46
47 /**
48 * Request a service to be stopped.
49 * Stopping arm itself will not invalidate its handle, and
50 * ARM API will try to restore connection to the ARM service,
51 * even if ARM connection was lost because you asked for ARM to be stopped.
52 * Call Arm.disconnect to free the handle and prevent
53 * further connection attempts.
54 *
55 * @param serviceName name of the service
56 * @param resultHandler called with the result of the request
57 */
58 public void requestServiceStop(String serviceName, ResultHandler resultHandler) {
59
60 }
61
62 /**
63 * Request for a service to be started.
64 *
65 * @param serviceName name of the service
66 */
67 public void requestServiceStart(String serviceName, ResultHandler resultHandler) {
68
69 }
70}
diff --git a/src/main/java/org/gnunet/arm/ArmMonitor.java b/src/main/java/org/gnunet/arm/ArmMonitor.java
new file mode 100644
index 0000000..641b862
--- /dev/null
+++ b/src/main/java/org/gnunet/arm/ArmMonitor.java
@@ -0,0 +1,27 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.arm;
22
23/**
24 * API for monitoring ARM services.
25 */
26public class ArmMonitor {
27}
diff --git a/src/main/java/org/gnunet/arm/ResultHandler.java b/src/main/java/org/gnunet/arm/ResultHandler.java
new file mode 100644
index 0000000..05c34f9
--- /dev/null
+++ b/src/main/java/org/gnunet/arm/ResultHandler.java
@@ -0,0 +1,31 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.arm;
22
23/**
24 * Created with IntelliJ IDEA.
25 * User: dold
26 * Date: 10/7/13
27 * Time: 4:00 PM
28 * To change this template use File | Settings | File Templates.
29 */
30public interface ResultHandler {
31}
diff --git a/src/main/java/org/gnunet/arm/ServiceListHandler.java b/src/main/java/org/gnunet/arm/ServiceListHandler.java
new file mode 100644
index 0000000..8d9de04
--- /dev/null
+++ b/src/main/java/org/gnunet/arm/ServiceListHandler.java
@@ -0,0 +1,28 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.arm;
22
23
24import java.util.List;
25
26public interface ServiceListHandler {
27 void onServiceList(List<String> services);
28}
diff --git a/src/main/java/org/gnunet/arm/ServiceStatusHandler.java b/src/main/java/org/gnunet/arm/ServiceStatusHandler.java
new file mode 100644
index 0000000..cedcc48
--- /dev/null
+++ b/src/main/java/org/gnunet/arm/ServiceStatusHandler.java
@@ -0,0 +1,25 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.arm;
22
23public interface ServiceStatusHandler {
24
25}
diff --git a/src/main/java/org/gnunet/arm/messages/ListResultMessage.java b/src/main/java/org/gnunet/arm/messages/ListResultMessage.java
new file mode 100644
index 0000000..03f995f
--- /dev/null
+++ b/src/main/java/org/gnunet/arm/messages/ListResultMessage.java
@@ -0,0 +1,41 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.arm.messages;
22
23import org.gnunet.construct.*;
24import org.gnunet.util.GnunetMessage;
25
26@UnionCase(13)
27public class ListResultMessage implements GnunetMessage.Body {
28 public class StringMessage implements Message {
29 @ZeroTerminatedString
30 public String string;
31 }
32
33 @UInt64
34 public long requestId;
35
36 @UInt16
37 public int count;
38
39 @FillWith
40 public StringMessage[] services;
41}
diff --git a/src/main/java/org/gnunet/arm/messages/RequestMessage.java b/src/main/java/org/gnunet/arm/messages/RequestMessage.java
new file mode 100644
index 0000000..fa0c18c
--- /dev/null
+++ b/src/main/java/org/gnunet/arm/messages/RequestMessage.java
@@ -0,0 +1,25 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.arm.messages;
22
23
24public class RequestMessage {
25}
diff --git a/src/main/java/org/gnunet/arm/messages/ResultMessage.java b/src/main/java/org/gnunet/arm/messages/ResultMessage.java
new file mode 100644
index 0000000..4883c14
--- /dev/null
+++ b/src/main/java/org/gnunet/arm/messages/ResultMessage.java
@@ -0,0 +1,35 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.arm.messages;
22
23import org.gnunet.construct.UInt32;
24import org.gnunet.construct.UInt64;
25import org.gnunet.construct.UnionCase;
26import org.gnunet.util.GnunetMessage;
27
28@UnionCase(10)
29public class ResultMessage implements GnunetMessage.Body {
30 @UInt64
31 public long requestId;
32
33 @UInt32
34 public int result;
35}
diff --git a/src/main/java/org/gnunet/arm/messages/StatusMessage.java b/src/main/java/org/gnunet/arm/messages/StatusMessage.java
new file mode 100644
index 0000000..cdfde6c
--- /dev/null
+++ b/src/main/java/org/gnunet/arm/messages/StatusMessage.java
@@ -0,0 +1,61 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21/*
22 This file is part of GNUnet.
23 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
24
25 GNUnet is free software; you can redistribute it and/or modify
26 it under the terms of the GNU General Public License as published
27 by the Free Software Foundation; either version 3, or (at your
28 option) any later version.
29
30 GNUnet is distributed in the hope that it will be useful, but
31 WITHOUT ANY WARRANTY; without even the implied warranty of
32 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33 General Public License for more details.
34
35 You should have received a copy of the GNU General Public License
36 along with GNUnet; see the file COPYING. If not, write to the
37 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
38 Boston, MA 02111-1307, USA.
39 */
40
41package org.gnunet.arm.messages;
42
43import org.gnunet.construct.*;
44import org.gnunet.util.GnunetMessage;
45
46@UnionCase(11)
47public class StatusMessage implements GnunetMessage.Body {
48 public class StringMessage implements Message {
49 @ZeroTerminatedString
50 public String string;
51 }
52
53 @UInt64
54 public long requestId;
55
56 @UInt32
57 public int status;
58
59 @ZeroTerminatedString
60 public String serviceName;
61}