From ce2a02a088fe07b61de72c882d6e6a1f620d573b Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Tue, 29 Mar 2016 22:02:48 +0200 Subject: [PATCH] and now a dht package + cmake factoring --- .gitignore | 6 ++-- examples/java/CMakeLists.txt | 31 ++++++++++++++++--- examples/java/chord/CMakeLists.txt | 23 -------------- examples/java/chord/chord.tesh | 14 --------- examples/java/{ => dht}/chord/ChordTask.java | 4 +-- examples/java/{ => dht}/chord/Common.java | 2 +- .../chord/FindSuccessorAnswerTask.java | 2 +- .../{ => dht}/chord/FindSuccessorTask.java | 4 +-- .../chord/GetPredecessorAnswerTask.java | 2 +- .../{ => dht}/chord/GetPredecessorTask.java | 2 +- .../{chord/Chord.java => dht/chord/Main.java} | 4 +-- examples/java/{ => dht}/chord/Node.java | 2 +- examples/java/{ => dht}/chord/NotifyTask.java | 2 +- examples/java/{ => dht}/chord/chord.xml | 16 +++++----- examples/java/dht/chord/dht_chord.tesh | 14 +++++++++ examples/java/{ => dht}/kademlia/Answer.java | 2 +- examples/java/{ => dht}/kademlia/Bucket.java | 2 +- examples/java/{ => dht}/kademlia/Common.java | 2 +- examples/java/{ => dht}/kademlia/Contact.java | 2 +- .../kademlia/FindNodeAnswerTask.java | 4 +-- .../java/{ => dht}/kademlia/FindNodeTask.java | 2 +- .../java/{ => dht}/kademlia/KademliaTask.java | 4 +-- .../Kademlia.java => dht/kademlia/Main.java} | 4 +-- examples/java/{ => dht}/kademlia/Node.java | 2 +- .../{ => dht}/kademlia/PingAnswerTask.java | 2 +- .../java/{ => dht}/kademlia/PingTask.java | 2 +- .../java/{ => dht}/kademlia/RoutingTable.java | 2 +- examples/java/dht/kademlia/dht_kademlia.tesh | 16 ++++++++++ examples/java/{ => dht}/kademlia/kademlia.xml | 8 ++--- examples/java/kademlia/CMakeLists.txt | 24 -------------- examples/java/kademlia/kademlia.tesh | 16 ---------- tools/cmake/DefinePackages.cmake | 2 -- 32 files changed, 99 insertions(+), 125 deletions(-) delete mode 100644 examples/java/chord/CMakeLists.txt delete mode 100644 examples/java/chord/chord.tesh rename examples/java/{ => dht}/chord/ChordTask.java (93%) rename examples/java/{ => dht}/chord/Common.java (97%) rename examples/java/{ => dht}/chord/FindSuccessorAnswerTask.java (96%) rename examples/java/{ => dht}/chord/FindSuccessorTask.java (96%) rename examples/java/{ => dht}/chord/GetPredecessorAnswerTask.java (96%) rename examples/java/{ => dht}/chord/GetPredecessorTask.java (95%) rename examples/java/{chord/Chord.java => dht/chord/Main.java} (95%) rename examples/java/{ => dht}/chord/Node.java (99%) rename examples/java/{ => dht}/chord/NotifyTask.java (96%) rename examples/java/{ => dht}/chord/chord.xml (82%) create mode 100644 examples/java/dht/chord/dht_chord.tesh rename examples/java/{ => dht}/kademlia/Answer.java (98%) rename examples/java/{ => dht}/kademlia/Bucket.java (98%) rename examples/java/{ => dht}/kademlia/Common.java (98%) rename examples/java/{ => dht}/kademlia/Contact.java (97%) rename examples/java/{ => dht}/kademlia/FindNodeAnswerTask.java (93%) rename examples/java/{ => dht}/kademlia/FindNodeTask.java (97%) rename examples/java/{ => dht}/kademlia/KademliaTask.java (92%) rename examples/java/{kademlia/Kademlia.java => dht/kademlia/Main.java} (95%) rename examples/java/{ => dht}/kademlia/Node.java (99%) rename examples/java/{ => dht}/kademlia/PingAnswerTask.java (94%) rename examples/java/{ => dht}/kademlia/PingTask.java (94%) rename examples/java/{ => dht}/kademlia/RoutingTable.java (99%) create mode 100644 examples/java/dht/kademlia/dht_kademlia.tesh rename examples/java/{ => dht}/kademlia/kademlia.xml (76%) delete mode 100644 examples/java/kademlia/CMakeLists.txt delete mode 100644 examples/java/kademlia/kademlia.tesh diff --git a/.gitignore b/.gitignore index 9e829bd855..7e48eeda3c 100644 --- a/.gitignore +++ b/.gitignore @@ -972,17 +972,17 @@ tools/tesh/tesh ## touched files to track the dependencies of java examples examples/java/async/java_async_compiled examples/java/bittorrent/java_bittorrent_compiled -examples/java/chord/java_chord_compiled +examples/java/dht/chord/java_dht_chord_compiled +examples/java/dht/kademlia/java_dht_kademlia_compiled examples/java/cloud/java_cloud_compiled examples/java/cloud/energy/java_cloud_energy_compiled examples/java/cloud/migration/java_cloud_migration_compiled examples/java/commTime/java_commTime_compiled examples/java/energy/java_energy_compiled examples/java/io/java_io_compiled -examples/java/kademlia/java_kademlia_compiled examples/java/process/kill/java_process_kill_compiled examples/java/process/migration/java_process_migration_compiled -examples/java/process_suspend/java_process_suspend_compiled +examples/java/process/suspend/java_process_suspend_compiled examples/java/masterworker/java_masterworker_compiled examples/java/mutualExclusion/java_mutualExclusion_compiled examples/java/pingPong/java_pingPong_compiled diff --git a/examples/java/CMakeLists.txt b/examples/java/CMakeLists.txt index 407da4397d..37fca90c57 100644 --- a/examples/java/CMakeLists.txt +++ b/examples/java/CMakeLists.txt @@ -1,3 +1,24 @@ +set(dht_chord_sources ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/Main.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/ChordTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/Common.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/FindSuccessorAnswerTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/FindSuccessorTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/GetPredecessorAnswerTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/GetPredecessorTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/Node.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/NotifyTask.java) +set(dht_kademlia_sources ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/Main.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/Answer.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/Bucket.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/Common.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/Contact.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/FindNodeAnswerTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/FindNodeTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/KademliaTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/Node.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/PingAnswerTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/PingTask.java + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/RoutingTable.java) set(process_kill_sources ${CMAKE_CURRENT_SOURCE_DIR}/process/kill/Main.java ${CMAKE_CURRENT_SOURCE_DIR}/process/kill/Killer.java ${CMAKE_CURRENT_SOURCE_DIR}/process/kill/Victim.java) @@ -8,7 +29,7 @@ set(process_suspend_sources ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend/Main.j ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend/DreamMaster.java ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend/LazyGuy.java) -foreach (example process_kill process_migration process_suspend) +foreach (example dht_chord dht_kademlia process_kill process_migration process_suspend) string (REPLACE "_" "/" example_dir ${example}) if(enable_java) @@ -26,11 +47,13 @@ foreach (example process_kill process_migration process_suspend) set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir}/${example}.tesh) endforeach() -set(examples_src ${examples_src} PARENT_SCOPE) -set(tesh_files ${tesh_files} PARENT_SCOPE) +set(examples_src ${examples_src} PARENT_SCOPE) +set(tesh_files ${tesh_files} PARENT_SCOPE) +set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml + ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml PARENT_SCOPE) if(enable_java) - foreach (example process_kill process_migration process_suspend) + foreach (example dht_chord dht_kademlia process_kill process_migration process_suspend) string (REPLACE "_" "/" example_dir ${example}) ADD_TESH(java-${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh) endforeach() diff --git a/examples/java/chord/CMakeLists.txt b/examples/java/chord/CMakeLists.txt deleted file mode 100644 index 7bc76b88e2..0000000000 --- a/examples/java/chord/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -set(example java_chord) -set(sources ${CMAKE_CURRENT_SOURCE_DIR}/Chord.java ${CMAKE_CURRENT_SOURCE_DIR}/ChordTask.java - ${CMAKE_CURRENT_SOURCE_DIR}/Common.java ${CMAKE_CURRENT_SOURCE_DIR}/FindSuccessorAnswerTask.java - ${CMAKE_CURRENT_SOURCE_DIR}/FindSuccessorTask.java ${CMAKE_CURRENT_SOURCE_DIR}/GetPredecessorAnswerTask.java - ${CMAKE_CURRENT_SOURCE_DIR}/GetPredecessorTask.java ${CMAKE_CURRENT_SOURCE_DIR}/Node.java - ${CMAKE_CURRENT_SOURCE_DIR}/NotifyTask.java) - -if(enable_java) - add_custom_command( - COMMENT "Building ${example}..." - OUTPUT ${example}_compiled - DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR} - COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources} - COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled - COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled - ) - add_custom_target(${example} ALL DEPENDS ${example}_compiled) - ADD_TESH(java-chord --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/chord/chord.tesh) -endif() - -set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/chord.tesh PARENT_SCOPE) -set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/chord.xml PARENT_SCOPE) -set(examples_src ${examples_src} ${sources} PARENT_SCOPE) diff --git a/examples/java/chord/chord.tesh b/examples/java/chord/chord.tesh deleted file mode 100644 index 01dc891134..0000000000 --- a/examples/java/chord/chord.tesh +++ /dev/null @@ -1,14 +0,0 @@ -#! tesh - -! output sort 19 - -$ java -classpath ${classpath:=.} chord/Chord ${srcdir:=.}/../platforms/platform.xml ${srcdir:=.}/chord/chord.xml -> [0.000000] [jmsg/INFO] Using regular java threads. -> [652.540924] [jmsg/INFO] MSG_main finished; Cleaning up the simulation... -> [Boivin:chord.Node:(7) 0.000000] [jmsg/INFO] Joining the ring with id 8 knowing node 1 -> [Gatien:chord.Node:(1) 0.000000] [jmsg/INFO] Joining the ring with id 48 knowing node 1 -> [Geoff:chord.Node:(4) 0.000000] [jmsg/INFO] Joining the ring with id 32 knowing node 1 -> [Jean_Yves:chord.Node:(6) 0.000000] [jmsg/INFO] Joining the ring with id 14 knowing node 1 -> [McGee:chord.Node:(2) 0.000000] [jmsg/INFO] Joining the ring with id 42 knowing node 1 -> [TeX:chord.Node:(5) 0.000000] [jmsg/INFO] Joining the ring with id 21 knowing node 1 -> [iRMX:chord.Node:(3) 0.000000] [jmsg/INFO] Joining the ring with id 38 knowing node 1 diff --git a/examples/java/chord/ChordTask.java b/examples/java/dht/chord/ChordTask.java similarity index 93% rename from examples/java/chord/ChordTask.java rename to examples/java/dht/chord/ChordTask.java index b78bb8fcc3..0e5edfc8cb 100644 --- a/examples/java/chord/ChordTask.java +++ b/examples/java/dht/chord/ChordTask.java @@ -4,9 +4,9 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package chord; +package dht.chord; -import chord.Common; +import dht.chord.Common; import org.simgrid.msg.Task; public class ChordTask extends Task { diff --git a/examples/java/chord/Common.java b/examples/java/dht/chord/Common.java similarity index 97% rename from examples/java/chord/Common.java rename to examples/java/dht/chord/Common.java index 2bda08167f..25672cd466 100644 --- a/examples/java/chord/Common.java +++ b/examples/java/dht/chord/Common.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package chord; +package dht.chord; public class Common { public final static int COMM_SIZE = 10; diff --git a/examples/java/chord/FindSuccessorAnswerTask.java b/examples/java/dht/chord/FindSuccessorAnswerTask.java similarity index 96% rename from examples/java/chord/FindSuccessorAnswerTask.java rename to examples/java/dht/chord/FindSuccessorAnswerTask.java index 5dee45fef5..cb46127cac 100644 --- a/examples/java/chord/FindSuccessorAnswerTask.java +++ b/examples/java/dht/chord/FindSuccessorAnswerTask.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package chord; +package dht.chord; public class FindSuccessorAnswerTask extends ChordTask { public int answerId; diff --git a/examples/java/chord/FindSuccessorTask.java b/examples/java/dht/chord/FindSuccessorTask.java similarity index 96% rename from examples/java/chord/FindSuccessorTask.java rename to examples/java/dht/chord/FindSuccessorTask.java index b8f84c2b87..0c78f8b2c3 100644 --- a/examples/java/chord/FindSuccessorTask.java +++ b/examples/java/dht/chord/FindSuccessorTask.java @@ -4,11 +4,11 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package chord; +package dht.chord; public class FindSuccessorTask extends ChordTask { public int requestId; - + public FindSuccessorTask(String issuerHostname, String answerTo, int requestId) { super(issuerHostname, answerTo); this.requestId = requestId; diff --git a/examples/java/chord/GetPredecessorAnswerTask.java b/examples/java/dht/chord/GetPredecessorAnswerTask.java similarity index 96% rename from examples/java/chord/GetPredecessorAnswerTask.java rename to examples/java/dht/chord/GetPredecessorAnswerTask.java index d8a9a9a4e8..d0d35ab585 100644 --- a/examples/java/chord/GetPredecessorAnswerTask.java +++ b/examples/java/dht/chord/GetPredecessorAnswerTask.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package chord; +package dht.chord; public class GetPredecessorAnswerTask extends ChordTask { public int answerId; diff --git a/examples/java/chord/GetPredecessorTask.java b/examples/java/dht/chord/GetPredecessorTask.java similarity index 95% rename from examples/java/chord/GetPredecessorTask.java rename to examples/java/dht/chord/GetPredecessorTask.java index 6320d7a3ba..0909b2eaa1 100644 --- a/examples/java/chord/GetPredecessorTask.java +++ b/examples/java/dht/chord/GetPredecessorTask.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package chord; +package dht.chord; public class GetPredecessorTask extends ChordTask { public GetPredecessorTask(String issuerHostName, String answerTo) { diff --git a/examples/java/chord/Chord.java b/examples/java/dht/chord/Main.java similarity index 95% rename from examples/java/chord/Chord.java rename to examples/java/dht/chord/Main.java index 954b50fa62..44e242537b 100644 --- a/examples/java/chord/Chord.java +++ b/examples/java/dht/chord/Main.java @@ -4,11 +4,11 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package chord; +package dht.chord; import org.simgrid.msg.Msg; -public class Chord { +public class Main { public static void main(String[] args) { Msg.init(args); if(args.length < 2) { diff --git a/examples/java/chord/Node.java b/examples/java/dht/chord/Node.java similarity index 99% rename from examples/java/chord/Node.java rename to examples/java/dht/chord/Node.java index 6456b6b3c4..021610855c 100644 --- a/examples/java/chord/Node.java +++ b/examples/java/dht/chord/Node.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package chord; +package dht.chord; import org.simgrid.msg.Msg; import org.simgrid.msg.Comm; diff --git a/examples/java/chord/NotifyTask.java b/examples/java/dht/chord/NotifyTask.java similarity index 96% rename from examples/java/chord/NotifyTask.java rename to examples/java/dht/chord/NotifyTask.java index b7b69197c1..daf4129090 100644 --- a/examples/java/chord/NotifyTask.java +++ b/examples/java/dht/chord/NotifyTask.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package chord; +package dht.chord; public class NotifyTask extends ChordTask { public int requestId; diff --git a/examples/java/chord/chord.xml b/examples/java/dht/chord/chord.xml similarity index 82% rename from examples/java/chord/chord.xml rename to examples/java/dht/chord/chord.xml index 6aa3bdfe61..7ef7e66c7c 100644 --- a/examples/java/chord/chord.xml +++ b/examples/java/dht/chord/chord.xml @@ -1,49 +1,49 @@ - + - + - + - + - + - + - + - + diff --git a/examples/java/dht/chord/dht_chord.tesh b/examples/java/dht/chord/dht_chord.tesh new file mode 100644 index 0000000000..92fc55ad10 --- /dev/null +++ b/examples/java/dht/chord/dht_chord.tesh @@ -0,0 +1,14 @@ +#! tesh + +! output sort 19 + +$ java -classpath ${classpath:=.} dht/chord/Main ${srcdir:=.}/../platforms/platform.xml ${srcdir:=.}/dht/chord/chord.xml +> [0.000000] [jmsg/INFO] Using regular java threads. +> [652.540924] [jmsg/INFO] MSG_main finished; Cleaning up the simulation... +> [Boivin:dht.chord.Node:(7) 0.000000] [jmsg/INFO] Joining the ring with id 8 knowing node 1 +> [Gatien:dht.chord.Node:(1) 0.000000] [jmsg/INFO] Joining the ring with id 48 knowing node 1 +> [Geoff:dht.chord.Node:(4) 0.000000] [jmsg/INFO] Joining the ring with id 32 knowing node 1 +> [Jean_Yves:dht.chord.Node:(6) 0.000000] [jmsg/INFO] Joining the ring with id 14 knowing node 1 +> [McGee:dht.chord.Node:(2) 0.000000] [jmsg/INFO] Joining the ring with id 42 knowing node 1 +> [TeX:dht.chord.Node:(5) 0.000000] [jmsg/INFO] Joining the ring with id 21 knowing node 1 +> [iRMX:dht.chord.Node:(3) 0.000000] [jmsg/INFO] Joining the ring with id 38 knowing node 1 diff --git a/examples/java/kademlia/Answer.java b/examples/java/dht/kademlia/Answer.java similarity index 98% rename from examples/java/kademlia/Answer.java rename to examples/java/dht/kademlia/Answer.java index 24164a498c..1421529b86 100644 --- a/examples/java/kademlia/Answer.java +++ b/examples/java/dht/kademlia/Answer.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; import java.util.ArrayList; import java.util.Collections; diff --git a/examples/java/kademlia/Bucket.java b/examples/java/dht/kademlia/Bucket.java similarity index 98% rename from examples/java/kademlia/Bucket.java rename to examples/java/dht/kademlia/Bucket.java index 41d391d63c..51f6712b3f 100644 --- a/examples/java/kademlia/Bucket.java +++ b/examples/java/dht/kademlia/Bucket.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; import java.util.ArrayList; public class Bucket { diff --git a/examples/java/kademlia/Common.java b/examples/java/dht/kademlia/Common.java similarity index 98% rename from examples/java/kademlia/Common.java rename to examples/java/dht/kademlia/Common.java index 0c3d425263..9ec3d579cb 100644 --- a/examples/java/kademlia/Common.java +++ b/examples/java/dht/kademlia/Common.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; public class Common { /* Common constants used all over the simulation */ diff --git a/examples/java/kademlia/Contact.java b/examples/java/dht/kademlia/Contact.java similarity index 97% rename from examples/java/kademlia/Contact.java rename to examples/java/dht/kademlia/Contact.java index 0f95358ec1..b52dcfbc84 100644 --- a/examples/java/kademlia/Contact.java +++ b/examples/java/dht/kademlia/Contact.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; public class Contact implements Comparable { private int id; diff --git a/examples/java/kademlia/FindNodeAnswerTask.java b/examples/java/dht/kademlia/FindNodeAnswerTask.java similarity index 93% rename from examples/java/kademlia/FindNodeAnswerTask.java rename to examples/java/dht/kademlia/FindNodeAnswerTask.java index b4cad24262..e3367156bd 100644 --- a/examples/java/kademlia/FindNodeAnswerTask.java +++ b/examples/java/dht/kademlia/FindNodeAnswerTask.java @@ -4,8 +4,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; -import kademlia.Answer; +package dht.kademlia; +import dht.kademlia.Answer; public class FindNodeAnswerTask extends KademliaTask { protected int destinationId; diff --git a/examples/java/kademlia/FindNodeTask.java b/examples/java/dht/kademlia/FindNodeTask.java similarity index 97% rename from examples/java/kademlia/FindNodeTask.java rename to examples/java/dht/kademlia/FindNodeTask.java index f2020aa038..c7c2886ea4 100644 --- a/examples/java/kademlia/FindNodeTask.java +++ b/examples/java/dht/kademlia/FindNodeTask.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; /** * @brief Find node tasks sent by a node to another "Find Node" task sent by a node to another. Ask him for its closest diff --git a/examples/java/kademlia/KademliaTask.java b/examples/java/dht/kademlia/KademliaTask.java similarity index 92% rename from examples/java/kademlia/KademliaTask.java rename to examples/java/dht/kademlia/KademliaTask.java index 0a549b41fe..ebb4670b82 100644 --- a/examples/java/kademlia/KademliaTask.java +++ b/examples/java/dht/kademlia/KademliaTask.java @@ -4,8 +4,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; -import kademlia.Common; +package dht.kademlia; +import dht.kademlia.Common; import org.simgrid.msg.Task; diff --git a/examples/java/kademlia/Kademlia.java b/examples/java/dht/kademlia/Main.java similarity index 95% rename from examples/java/kademlia/Kademlia.java rename to examples/java/dht/kademlia/Main.java index 01fcef2d0c..ffb9dd46bd 100644 --- a/examples/java/kademlia/Kademlia.java +++ b/examples/java/dht/kademlia/Main.java @@ -4,11 +4,11 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; import org.simgrid.msg.Msg; import org.simgrid.msg.MsgException; -public class Kademlia { +public class Main { public static void main(String[] args) throws MsgException { Msg.init(args); if(args.length < 2) { diff --git a/examples/java/kademlia/Node.java b/examples/java/dht/kademlia/Node.java similarity index 99% rename from examples/java/kademlia/Node.java rename to examples/java/dht/kademlia/Node.java index 5dd2ae2290..5b570ec166 100644 --- a/examples/java/kademlia/Node.java +++ b/examples/java/dht/kademlia/Node.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; import org.simgrid.msg.Host; diff --git a/examples/java/kademlia/PingAnswerTask.java b/examples/java/dht/kademlia/PingAnswerTask.java similarity index 94% rename from examples/java/kademlia/PingAnswerTask.java rename to examples/java/dht/kademlia/PingAnswerTask.java index d6dd4a0ed1..5a804d5acf 100644 --- a/examples/java/kademlia/PingAnswerTask.java +++ b/examples/java/dht/kademlia/PingAnswerTask.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; public class PingAnswerTask extends KademliaTask { public PingAnswerTask(int senderId) { diff --git a/examples/java/kademlia/PingTask.java b/examples/java/dht/kademlia/PingTask.java similarity index 94% rename from examples/java/kademlia/PingTask.java rename to examples/java/dht/kademlia/PingTask.java index eacfb1d750..a9dbab30d5 100644 --- a/examples/java/kademlia/PingTask.java +++ b/examples/java/dht/kademlia/PingTask.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; public class PingTask extends KademliaTask { public PingTask(int senderId) { diff --git a/examples/java/kademlia/RoutingTable.java b/examples/java/dht/kademlia/RoutingTable.java similarity index 99% rename from examples/java/kademlia/RoutingTable.java rename to examples/java/dht/kademlia/RoutingTable.java index 961d38fe35..9dc08f8df1 100644 --- a/examples/java/kademlia/RoutingTable.java +++ b/examples/java/dht/kademlia/RoutingTable.java @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -package kademlia; +package dht.kademlia; import java.util.Collections; import java.util.Vector; diff --git a/examples/java/dht/kademlia/dht_kademlia.tesh b/examples/java/dht/kademlia/dht_kademlia.tesh new file mode 100644 index 0000000000..19dc2c333b --- /dev/null +++ b/examples/java/dht/kademlia/dht_kademlia.tesh @@ -0,0 +1,16 @@ +#! tesh + +! output sort 19 + +$ java -classpath ${classpath:=.} dht/kademlia/Main ${srcdir:=.}/../platforms/platform.xml ${srcdir:=.}/dht/kademlia/kademlia.xml +> [0.000000] [jmsg/INFO] Using regular java threads. +> [900.000000] [jmsg/INFO] MSG_main finished; Cleaning up the simulation... +> [Boivin:dht.kademlia.Node:(2) 0.000000] [jmsg/INFO] Hi, I'm going to join the network with the id 1! +> [Boivin:dht.kademlia.Node:(2) 900.000000] [jmsg/INFO] 8/8 FIND_NODE have succedded. +> [Jacquelin:dht.kademlia.Node:(1) 0.000000] [jmsg/INFO] Hi, I'm going to create the network with the id 0! +> [Jacquelin:dht.kademlia.Node:(1) 900.000000] [jmsg/INFO] 8/8 FIND_NODE have succedded. +> [Jean_Yves:dht.kademlia.Node:(3) 0.000000] [jmsg/INFO] Hi, I'm going to join the network with the id 2! +> [Jean_Yves:dht.kademlia.Node:(3) 900.000000] [jmsg/INFO] 8/8 FIND_NODE have succedded. +> [TeX:dht.kademlia.Node:(4) 0.000000] [jmsg/INFO] Hi, I'm going to join the network with the id 4! +> [TeX:dht.kademlia.Node:(4) 900.000000] [jmsg/INFO] 8/8 FIND_NODE have succedded. + diff --git a/examples/java/kademlia/kademlia.xml b/examples/java/dht/kademlia/kademlia.xml similarity index 76% rename from examples/java/kademlia/kademlia.xml rename to examples/java/dht/kademlia/kademlia.xml index 4ea655182d..61a828b530 100644 --- a/examples/java/kademlia/kademlia.xml +++ b/examples/java/dht/kademlia/kademlia.xml @@ -1,21 +1,21 @@ - + - + - + - + diff --git a/examples/java/kademlia/CMakeLists.txt b/examples/java/kademlia/CMakeLists.txt deleted file mode 100644 index bd2b6f6668..0000000000 --- a/examples/java/kademlia/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -set(example java_kademlia) -set(sources ${CMAKE_CURRENT_SOURCE_DIR}/Kademlia.java ${CMAKE_CURRENT_SOURCE_DIR}/Answer.java - ${CMAKE_CURRENT_SOURCE_DIR}/Bucket.java ${CMAKE_CURRENT_SOURCE_DIR}/Common.java - ${CMAKE_CURRENT_SOURCE_DIR}/Contact.java ${CMAKE_CURRENT_SOURCE_DIR}/FindNodeAnswerTask.java - ${CMAKE_CURRENT_SOURCE_DIR}/FindNodeTask.java ${CMAKE_CURRENT_SOURCE_DIR}/KademliaTask.java - ${CMAKE_CURRENT_SOURCE_DIR}/Node.java ${CMAKE_CURRENT_SOURCE_DIR}/PingAnswerTask.java - ${CMAKE_CURRENT_SOURCE_DIR}/PingTask.java ${CMAKE_CURRENT_SOURCE_DIR}/RoutingTable.java) - -if(enable_java) - add_custom_command( - COMMENT "Building ${example}..." - OUTPUT ${example}_compiled - DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR} - COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources} - COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled - COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled - ) - add_custom_target(${example} ALL DEPENDS ${example}_compiled) - ADD_TESH(java-kademlia --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/kademlia/kademlia.tesh) -endif() - -set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/kademlia.tesh PARENT_SCOPE) -set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/kademlia.xml PARENT_SCOPE) -set(examples_src ${examples_src} ${sources} PARENT_SCOPE) diff --git a/examples/java/kademlia/kademlia.tesh b/examples/java/kademlia/kademlia.tesh deleted file mode 100644 index 3adbb568b0..0000000000 --- a/examples/java/kademlia/kademlia.tesh +++ /dev/null @@ -1,16 +0,0 @@ -#! tesh - -! output sort 19 - -$ java -classpath ${classpath:=.} kademlia/Kademlia ${srcdir:=.}/../platforms/platform.xml ${srcdir:=.}/kademlia/kademlia.xml -> [0.000000] [jmsg/INFO] Using regular java threads. -> [900.000000] [jmsg/INFO] MSG_main finished; Cleaning up the simulation... -> [Boivin:kademlia.Node:(2) 0.000000] [jmsg/INFO] Hi, I'm going to join the network with the id 1! -> [Boivin:kademlia.Node:(2) 900.000000] [jmsg/INFO] 8/8 FIND_NODE have succedded. -> [Jacquelin:kademlia.Node:(1) 0.000000] [jmsg/INFO] Hi, I'm going to create the network with the id 0! -> [Jacquelin:kademlia.Node:(1) 900.000000] [jmsg/INFO] 8/8 FIND_NODE have succedded. -> [Jean_Yves:kademlia.Node:(3) 0.000000] [jmsg/INFO] Hi, I'm going to join the network with the id 2! -> [Jean_Yves:kademlia.Node:(3) 900.000000] [jmsg/INFO] 8/8 FIND_NODE have succedded. -> [TeX:kademlia.Node:(4) 0.000000] [jmsg/INFO] Hi, I'm going to join the network with the id 4! -> [TeX:kademlia.Node:(4) 900.000000] [jmsg/INFO] 8/8 FIND_NODE have succedded. - diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index c554038669..0f569a89b4 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -926,14 +926,12 @@ set(CMAKEFILES_TXT examples/java/CMakeLists.txt examples/java/async/CMakeLists.txt examples/java/bittorrent/CMakeLists.txt - examples/java/chord/CMakeLists.txt examples/java/cloud/CMakeLists.txt examples/java/cloud/energy/CMakeLists.txt examples/java/cloud/migration/CMakeLists.txt examples/java/commTime/CMakeLists.txt examples/java/energy/CMakeLists.txt examples/java/io/CMakeLists.txt - examples/java/kademlia/CMakeLists.txt examples/java/masterworker/CMakeLists.txt examples/java/mutualExclusion/CMakeLists.txt examples/java/pingPong/CMakeLists.txt -- 2.20.1