[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11439: made sure that node names are unique in a network (in puppetor/trunk/src/de/uniba/wiai/lspi/puppetor: . impl)
Author: kloesing
Date: 2007-09-14 09:43:39 -0400 (Fri, 14 Sep 2007)
New Revision: 11439
Modified:
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/Network.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java
Log:
made sure that node names are unique in a network
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/Network.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/Network.java 2007-09-13 17:40:11 UTC (rev 11438)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/Network.java 2007-09-14 13:43:39 UTC (rev 11439)
@@ -109,7 +109,8 @@
* The name for this node, which is used as name for the working
* directory, for logging purposes, and as node nickname. May
* neither be <code>null</code> or have zero or more than 19
- * alpha-numeric characters.
+ * alpha-numeric characters. The node name needs to be unique in
+ * this network.
* @return Reference to the created directory node.
* @throws IllegalStateException
* Thrown if network is not in state
@@ -129,7 +130,8 @@
* The name for this node, which is used as name for the working
* directory, for logging purposes, and as node nickname. May
* neither be <code>null</code> or have zero or more than 19
- * alpha-numeric characters.
+ * alpha-numeric characters. The node name needs to be unique in
+ * this network.
* @param controlPort
* The TCP port on which the corresponding Tor process will wait
* for a controller. May not be negative or greater than 65535.
@@ -165,7 +167,7 @@
* The name for this node, which is only used as name for the
* working directory and for logging purposes. May neither be
* <code>null</code> or have zero or more than 19 alpha-numeric
- * characters.
+ * characters. The node name needs to be unique in this network.
* @return Reference to the created proxy node.
* @throws IllegalArgumentException
* Thrown if an invalid value is given as node name.
@@ -181,7 +183,7 @@
* The name for this node, which is only used as name for the
* working directory and for logging purposes. May neither be
* <code>null</code> or have zero or more than 19 alpha-numeric
- * characters.
+ * characters. The node name needs to be unique in this network.
* @param controlPort
* The TCP port on which the corresponding Tor process will wait
* for a controller. May not be negative or greater than 65535.
@@ -206,7 +208,8 @@
* The name for this node, which is used as name for the working
* directory, for logging purposes, and as node nickname. May
* neither be <code>null</code> or have zero or more than 19
- * alpha-numeric characters.
+ * alpha-numeric characters. The node name needs to be unique in
+ * this network.
* @return Reference to the created router node.
* @throws IllegalArgumentException
* Thrown if an invalid value is given as node name.
@@ -222,7 +225,8 @@
* The name for this node, which is used as name for the working
* directory, for logging purposes, and as node nickname. May
* neither be <code>null</code> or have zero or more than 19
- * alpha-numeric characters.
+ * alpha-numeric characters. The node name needs to be unique in
+ * this network.
* @param controlPort
* The TCP port on which the corresponding Tor process will wait
* for a controller. May not be negative or greater than 65535.
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java 2007-09-13 17:40:11 UTC (rev 11438)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java 2007-09-14 13:43:39 UTC (rev 11439)
@@ -448,6 +448,15 @@
throw e;
}
+ // check if there is already a node with this name
+ if (this.nodes.containsKey(nodeName)) {
+ IllegalArgumentException e = new IllegalArgumentException(
+ "There is already a node with name " + nodeName);
+ this.logger.throwing(this.getClass().getName(), "createDirectory",
+ e);
+ throw e;
+ }
+
// create directory node; parameter checking is done in constructor
DirectoryNode dir = new DirectoryNodeImpl(this, nodeName, controlPort,
socksPort, orPort, dirPort);
@@ -482,6 +491,14 @@
this.logger.entering(this.getClass().getName(), "createProxy",
new Object[] { nodeName, controlPort, socksPort });
+ // check if there is already a node with this name
+ if (this.nodes.containsKey(nodeName)) {
+ IllegalArgumentException e = new IllegalArgumentException(
+ "There is already a node with name " + nodeName);
+ this.logger.throwing(this.getClass().getName(), "createProxy", e);
+ throw e;
+ }
+
// create proxy node; parameter checking is done in constructor
ProxyNode proxy = new ProxyNodeImpl(this, nodeName, controlPort,
socksPort);
@@ -517,6 +534,14 @@
new Object[] { nodeName, controlPort, socksPort, orPort,
dirPort });
+ // check if there is already a node with this name
+ if (this.nodes.containsKey(nodeName)) {
+ IllegalArgumentException e = new IllegalArgumentException(
+ "There is already a node with name " + nodeName);
+ this.logger.throwing(this.getClass().getName(), "createRouter", e);
+ throw e;
+ }
+
// create router node; parameter checking is done in constructor
RouterNode router = new RouterNodeImpl(this, nodeName, controlPort,
socksPort, orPort, dirPort);