[or-cvs] r15873: Add a first version of the test executing infrastructre. Sti (in puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor: . examples impl rmi rmi/execute rmi/impl rmi/tasks)

sebastian at seul.org sebastian at seul.org
Sun Jul 13 16:05:31 UTC 2008


Author: sebastian
Date: 2008-07-13 12:05:31 -0400 (Sun, 13 Jul 2008)
New Revision: 15873

Added:
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Network.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/NetworkDescription.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Task.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TaskResult.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TorInstance.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/AbstractTaskImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/NetworkDescriptionImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/NetworkImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TaskResultImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TestImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TorInstanceImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/tasks/
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/tasks/CreateNetworkTask.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/tasks/TerminateTask.java
Removed:
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/CreateNetwork.java
Modified:
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ClientApplication.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ClientEventType.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/DirectoryNode.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/Event.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventListener.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventManager.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventType.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/HiddenService.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/HiddenServiceEventType.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/Network.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NetworkFactory.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NodeEventType.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NodeState.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ProxyNode.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/PuppeTorException.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/RouterNode.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ServerApplication.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ServerEventType.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AccessingPublicWebServerOverTor.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ClientApplicationImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/DirectoryNodeImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/EventImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/EventManagerImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/HiddenServiceImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ProxyNodeImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/RouterNodeImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ServerApplicationImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/AbstractMasterFactory.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/AbstractSlaveFactory.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/LocalMaster.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Master.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/MasterConnector.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/RemoteMaster.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Slave.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Test.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TestExecutor.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TestResult.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/execute/PuppeTorMasterProgram.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/execute/PuppeTorSlaveProgram.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/MasterImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/MasterImplFactory.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/SlaveImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/SlaveImplFactory.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TestExecutorImpl.java
Log:
Add a first version of the test executing infrastructre. Still misses a lot of javadoc and features. use tabs, not spaces.

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ClientApplication.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ClientApplication.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ClientApplication.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -37,7 +37,7 @@
  * address and a port are given to which the client shall connect. Requests are
  * performed by a background thread, so that multiple requests could be
  * performed at the same time.
- * 
+ *
  * @author kloesing
  */
 public interface ClientApplication {
@@ -54,7 +54,7 @@
 	 * set to <code>true</code>, the thread will quit performing requests
 	 * immediately after the first successful request.
 	 * </p>
-	 * 
+	 *
 	 * <p>
 	 * For each sent request the application fires a
 	 * <event>ClientEventType.CLIENT_SENDING_REQUEST</code> event. On receiving
@@ -64,9 +64,9 @@
 	 * successfully, or not) an event of type <code>ClientEventType.CLIENT_REQUESTS_PERFORMED</code>
 	 * is fired.
 	 * </p>
-	 * 
+	 *
 	 * TODO may this method only be invoked once?!
-	 * 
+	 *
 	 * @param retries
 	 *            The number of retries that this client will perform. Must be
 	 *            <code>1</code> or greater.
@@ -88,7 +88,7 @@
 
 	/**
 	 * Stops all requests that are currently running.
-	 * 
+	 *
 	 * @throws IllegalStateException
 	 *             Thrown if no requests have been started before.
 	 */
@@ -96,14 +96,14 @@
 
 	/**
 	 * Returns the name of this client.
-	 * 
+	 *
 	 * @return The name of this client.
 	 */
 	public abstract String getClientApplicationName();
 
 	/**
 	 * Returns the SOCKS port of the local Tor node to which requests are sent.
-	 * 
+	 *
 	 * @return The SOCKS port of the local Tor node to which requests are sent.
 	 */
 	public abstract int getSocksPort();
@@ -111,7 +111,7 @@
 	/**
 	 * Returns the target name for the requests sent by this client; can be
 	 * either a server name/address or an onion address.
-	 * 
+	 *
 	 * @return The target name for the requests sent by this client.
 	 */
 	public abstract String getTargetName();
@@ -119,7 +119,7 @@
 	/**
 	 * Returns the target port for the requests sent by this client; can be
 	 * either a server port or a virtual port of a hidden service.
-	 * 
+	 *
 	 * @return The target port for the requests sent by this client.
 	 */
 	public abstract int getTargetPort();

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ClientEventType.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ClientEventType.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ClientEventType.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -45,46 +45,46 @@
 
 	/**
 	 * Creates a new event type with the given type string.
-	 * 
+	 *
 	 * @param typeString
 	 *            String identifying the type of the event type.
 	 */
-	public ClientEventType(String typeString) {
+	public ClientEventType(final String typeString) {
 		this.typeString = typeString;
 	}
 
 	public String getTypeName() {
-		return this.typeString;
+		return typeString;
 	}
 
 	/**
 	 * The client application is sending a request; this event is fired
 	 * internally and not parsed from a log statement from Tor.
 	 */
-	public static final ClientEventType CLIENT_SENDING_REQUEST = new ClientEventType(
-			"CLIENT_SENDING_REQUEST");
+	public static final ClientEventType CLIENT_SENDING_REQUEST =
+			new ClientEventType("CLIENT_SENDING_REQUEST");
 
 	/**
 	 * The client application has received a reply to a previously sent request;
 	 * this event is fired internally and not parsed from a log statement from
 	 * Tor.
 	 */
-	public static final ClientEventType CLIENT_REPLY_RECEIVED = new ClientEventType(
-			"CLIENT_REPLY_RECEIVED");
+	public static final ClientEventType CLIENT_REPLY_RECEIVED =
+			new ClientEventType("CLIENT_REPLY_RECEIVED");
 
 	/**
 	 * The client application has given up waiting for the reply to a previously
 	 * sent request; this event is fired internally and not parsed from a log
 	 * statement from Tor.
 	 */
-	public static final ClientEventType CLIENT_GAVE_UP_REQUEST = new ClientEventType(
-			"CLIENT_GAVE_UP_REQUEST");
+	public static final ClientEventType CLIENT_GAVE_UP_REQUEST =
+			new ClientEventType("CLIENT_GAVE_UP_REQUEST");
 
 	/**
 	 * The client application has completed a series of requests, whether they
 	 * were successful or not; this event is fired internally and not parsed
 	 * from a log statement from Tor.
 	 */
-	public static final ClientEventType CLIENT_REQUESTS_PERFORMED = new ClientEventType(
-			"CLIENT_REQUESTS_PERFORMED");
+	public static final ClientEventType CLIENT_REQUESTS_PERFORMED =
+			new ClientEventType("CLIENT_REQUESTS_PERFORMED");
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/DirectoryNode.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/DirectoryNode.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/DirectoryNode.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -39,7 +39,7 @@
  * server for the (private) Tor network. It inherits most of the configuration
  * and behavior from <code>RouterNode</code> and adds some directory-specific
  * configurations and behavior.
- * 
+ *
  * @author kloesing
  */
 public interface DirectoryNode extends RouterNode {
@@ -48,7 +48,7 @@
 	 * Combines the fingerprint of this node to a <code>DirServer</code>
 	 * string that can be used to configure this or other nodes to use this node
 	 * as directory server.
-	 * 
+	 *
 	 * @return <code>DirServer</code> string to configure a node to use this
 	 *         node as directory server.
 	 * @throws PuppeTorException
@@ -63,7 +63,7 @@
 	 * routers can be trusted. Changes are only stored locally and not written
 	 * to the <code>approved-routers</code> file to disk which will be done
 	 * when writing the configuration of this node.
-	 * 
+	 *
 	 * @param approvedRouters
 	 *            The set of approved routers to be added. Each provided string
 	 *            must be formatted as

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/Event.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/Event.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/Event.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -42,7 +42,7 @@
  * certain process or application. Some events can be fired only once, others
  * possibly multiple times. All management operations for events are contained
  * in the <code>EventManager</code>.
- * 
+ *
  * @author kloesing
  */
 public interface Event extends Serializable {
@@ -50,21 +50,21 @@
 	/**
 	 * Returns the name of the source of this event, which can be a Tor process
 	 * or a client/server application running as thread in the background.
-	 * 
+	 *
 	 * @return The event source.
 	 */
 	public abstract String getSource();
 
 	/**
 	 * Returns the event type.
-	 * 
+	 *
 	 * @return The event type.
 	 */
 	public abstract EventType getType();
 
 	/**
 	 * Returns the original message that lead to firing this event.
-	 * 
+	 *
 	 * @return The original message.
 	 */
 	public abstract String getMessage();
@@ -73,7 +73,7 @@
 	 * Returns the occurrence time of this event, which is either the parsed
 	 * time from a Tor log statement, or the current system time when a
 	 * client/server application fired this event.
-	 * 
+	 *
 	 * @return The occurrence time.
 	 */
 	public abstract long getOccurrenceTime();

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventListener.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventListener.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventListener.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,7 +34,7 @@
 /**
  * This interface must be implemented by any object in a test application that
  * shall be registered as event listener.
- * 
+ *
  * @author kloesing
  */
 public interface EventListener {
@@ -42,7 +42,7 @@
 	/**
 	 * Is invoked when an asynchronous event is fired by the source (or one of
 	 * the sources) for which this listener was registered.
-	 * 
+	 *
 	 * @param event
 	 *            The event that was fired.
 	 */

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventManager.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventManager.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventManager.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -39,7 +39,7 @@
  * running as threads in the background. A test application can either register
  * event listeners to be notified asynchronously about events when they occur,
  * or synchronize with an event by being blocked until a certain event occurs.
- * 
+ *
  * @author kloesing
  */
 public interface EventManager {
@@ -53,7 +53,7 @@
 	 * This prevents race conditions by eliminating the gap between registration
 	 * of an event handler and asking if an event has been fired before
 	 * registering.
-	 * 
+	 *
 	 * @param source
 	 *            The name of the source of events that the listener is
 	 *            interested in. May not be <code>null</code> and must be the
@@ -78,7 +78,7 @@
 	/**
 	 * Registers the given <code>listener</code> as event listener for future
 	 * events originating from any source.
-	 * 
+	 *
 	 * @param listener
 	 *            The listener that wants to be notified about events from the
 	 *            given <code>source</code>. If the <code>listener</code>
@@ -93,7 +93,7 @@
 	/**
 	 * Returns the list of all previously observed events from the given
 	 * <code>source</code>.
-	 * 
+	 *
 	 * @param source
 	 *            The source of the events that the invoking thread is
 	 *            interested in. May not be <code>null</code> and must be the
@@ -109,7 +109,7 @@
 	/**
 	 * Returns whether the given <code>eventType</code> has been observed from
 	 * the given <code>source</code> before, or not.
-	 * 
+	 *
 	 * @param source
 	 *            The source of the event that the invoking thread is interested
 	 *            in. May not be <code>null</code> and must be the name of a
@@ -123,13 +123,13 @@
 	 * @return <code>true</code> if the event has been observed from the
 	 *         source before, <code>false</code> otherwise.
 	 */
-	public abstract boolean hasEventOccured(String source, EventType eventType);          
+	public abstract boolean hasEventOccured(String source, EventType eventType);
 
 	/**
 	 * Removes the given <code>listener</code> as event listener from all
 	 * previously registered sources. If this listener is not registered for any
 	 * source, nothing happens.
-	 * 
+	 *
 	 * @param listener
 	 *            The listener that shall be removed from the list of registered
 	 *            listeners. May not be <code>null</code>.
@@ -144,7 +144,7 @@
 	 * until the next event of this type is fired from that source. Note that
 	 * this method does not restrict waiting to a timeout, so that it could
 	 * potentially block forever!
-	 * 
+	 *
 	 * @param source
 	 *            The source of the event that the invoking thread is willing to
 	 *            wait for. May not be <code>null</code> and must be the name
@@ -157,8 +157,7 @@
 	 *             Thrown if <code>null</code> is passed for either of the
 	 *             parameters or if the <code>source</code> is unknown.
 	 */
-	public abstract void waitForAnyOccurence(String source,
-			EventType eventType);
+	public abstract void waitForAnyOccurence(String source, EventType eventType);
 
 	/**
 	 * Checks if the given <code>eventType</code> has been observed from the
@@ -166,7 +165,7 @@
 	 * until the next event of this type is fired from that source or the given
 	 * timeout of <code>maximumTimeToWaitInMillis</code> milliseconds has
 	 * expired.
-	 * 
+	 *
 	 * @param source
 	 *            The source of the event that the invoking thread is willing to
 	 *            wait for. May not be <code>null</code> and must be the name
@@ -195,7 +194,7 @@
 	 * next occurence of an event, regardless of previous occurrences. Note that
 	 * this method does not restrict waiting to a timeout, so that it could
 	 * potentially block forever!
-	 * 
+	 *
 	 * @param source
 	 *            The source of the event that the invoking thread is willing to
 	 *            wait for. May not be <code>null</code> and must be the name
@@ -213,10 +212,10 @@
 	/**
 	 * Blocks the invoking thread until the next <code>event</code> is fired
 	 * from the given <code>source</code> or the given timeout of
-	 * <code>maximumTimeToWaitInMillis</code> milliseconds has expired. This method
-	 * only waits for the next occurence of an event, regardless of previous
-	 * occurrences.
-	 * 
+	 * <code>maximumTimeToWaitInMillis</code> milliseconds has expired. This
+	 * method only waits for the next occurence of an event, regardless of
+	 * previous occurrences.
+	 *
 	 * @param source
 	 *            The source of the event that the invoking thread is willing to
 	 *            wait for. May not be <code>null</code> and must be the name
@@ -245,7 +244,7 @@
 	 * useful for log statements that are only included in modified Tor
 	 * versions. Therefore, the event type may be an instance of a self-defined
 	 * class that implements <code>EventType</code>.
-	 * 
+	 *
 	 * @param patternString
 	 *            The pattern string that will be used for parsing Tor log
 	 *            statements; the syntax corresponds to java.util.regex.Pattern.

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventType.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventType.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/EventType.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -37,7 +37,7 @@
  * The super interface of possible event types that are fired on a state change
  * of an asynchronous system component, e.g. a Tor process or a client/server
  * application running as thread in the background.
- * 
+ *
  * @author kloesing
  */
 public interface EventType extends Serializable {
@@ -45,7 +45,7 @@
 	/**
 	 * Returns a string representation of the event type name for display
 	 * purposes.
-	 * 
+	 *
 	 * @return String representation of the event type name.
 	 */
 	public abstract String getTypeName();

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/HiddenService.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/HiddenService.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/HiddenService.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -3,7 +3,7 @@
 /**
  * A <code>HiddenService</code> instance contains all configurations of a
  * hidden service that is registered at a node.
- * 
+ *
  * @author kloesing
  */
 public interface HiddenService {
@@ -13,7 +13,7 @@
 	 * name <code>serviceName</code>. Requires that the node has been
 	 * started, i.e. is in state <code>NodeState.RUNNING</code>, and is
 	 * configured to provide this hidden service.
-	 * 
+	 *
 	 * @return The onion address string consisting of 16 base32 chars plus
 	 *         ".onion" for hidden service versions 0 and 1 or 16 base32 chars
 	 *         plus "." plus 24 base32 chars plus ".onion" for hidden service
@@ -34,14 +34,14 @@
 
 	/**
 	 * Returns the name of the hidden service.
-	 * 
+	 *
 	 * @return The name of the hidden service.
 	 */
 	public String getServiceName();
 
 	/**
 	 * Returns the port on which the service listens for requests.
-	 * 
+	 *
 	 * @return The port on which the service listens for requests.
 	 */
 	public int getServicePort();
@@ -49,7 +49,7 @@
 	/**
 	 * Returns the virtual port that this hidden service runs on as it is
 	 * announced to clients.
-	 * 
+	 *
 	 * @return The virtual port of this hidden service.
 	 */
 	public int getVirtualPort();

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/HiddenServiceEventType.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/HiddenServiceEventType.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/HiddenServiceEventType.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -45,56 +45,57 @@
 
 	/**
 	 * Creates a new event type with the given type string.
-	 * 
+	 *
 	 * @param typeString
 	 *            String identifying the type of the event type.
 	 */
-	public HiddenServiceEventType(String typeString) {
+	public HiddenServiceEventType(final String typeString) {
 		this.typeString = typeString;
 	}
 
 	public String getTypeName() {
-		return this.typeString;
+		return typeString;
 	}
 
 	/**
 	 * Alice has received an onion request; this event is parsed from a log
 	 * statement in connection_ap_handshake_rewrite_and_attach().
 	 */
-	public static final HiddenServiceEventType ALICE_ONION_REQUEST_RECEIVED = new HiddenServiceEventType(
-			"ALICE_ONION_REQUEST_RECEIVED");
+	public static final HiddenServiceEventType ALICE_ONION_REQUEST_RECEIVED =
+			new HiddenServiceEventType("ALICE_ONION_REQUEST_RECEIVED");
 
 	/**
 	 * Alice sends a fetch request for a hidden service descriptor to a
 	 * directory server; this event is parsed from a log statement in
 	 * rend_client_refetch_renddesc().
 	 */
-	public static final HiddenServiceEventType ALICE_SENDING_FETCH_DESC = new HiddenServiceEventType(
-			"ALICE_SENDING_FETCH_DESC");
+	public static final HiddenServiceEventType ALICE_SENDING_FETCH_DESC =
+			new HiddenServiceEventType("ALICE_SENDING_FETCH_DESC");
 
 	/**
 	 * Alice receives a reply to a previous fetch request for a hidden service
 	 * descriptors from a directory server; this event is parsed from a log
 	 * statement in connection_dir_client_reached_eof().
 	 */
-	public static final HiddenServiceEventType ALICE_DESC_FETCHED_RECEIVED = new HiddenServiceEventType(
-			"ALICE_DESC_FETCHED_RECEIVED");
+	public static final HiddenServiceEventType ALICE_DESC_FETCHED_RECEIVED =
+			new HiddenServiceEventType("ALICE_DESC_FETCHED_RECEIVED");
 
 	/**
 	 * Alice has built a circuit to a rendezvous point and sends an
 	 * ESTABLISH_RENDEZVOUS cell; this event is parsed from a log statement in
 	 * rend_client_send_establish_rendezvous().
 	 */
-	public static final HiddenServiceEventType ALICE_BUILT_REND_CIRC_SENDING_ESTABLISH_RENDEZVOUS = new HiddenServiceEventType(
-			"ALICE_BUILT_REND_CIRC_SENDING_ESTABLISH_RENDEZVOUS");
+	public static final HiddenServiceEventType ALICE_BUILT_REND_CIRC_SENDING_ESTABLISH_RENDEZVOUS =
+			new HiddenServiceEventType(
+					"ALICE_BUILT_REND_CIRC_SENDING_ESTABLISH_RENDEZVOUS");
 
 	/**
 	 * Alice receives a RENDEZVOUS_ESTABLISHED cell from a rendezvous point;
 	 * this event is parsed from a log statement in
 	 * rend_client_rendezvous_acked().
 	 */
-	public static final HiddenServiceEventType ALICE_RENDEZVOUS_ESTABLISHED_RECEIVED = new HiddenServiceEventType(
-			"ALICE_RENDEZVOUS_ESTABLISHED_RECEIVED");
+	public static final HiddenServiceEventType ALICE_RENDEZVOUS_ESTABLISHED_RECEIVED =
+			new HiddenServiceEventType("ALICE_RENDEZVOUS_ESTABLISHED_RECEIVED");
 
 	/**
 	 * Alice has built a circuit to an introduction point (which does not
@@ -102,62 +103,64 @@
 	 * circuit might not be ready); this event is parsed from a log statement in
 	 * rend_client_introcirc_has_opened().
 	 */
-	public static final HiddenServiceEventType ALICE_BUILT_INTRO_CIRC = new HiddenServiceEventType(
-			"ALICE_BUILT_INTRO_CIRC");
+	public static final HiddenServiceEventType ALICE_BUILT_INTRO_CIRC =
+			new HiddenServiceEventType("ALICE_BUILT_INTRO_CIRC");
 
 	/**
 	 * Alice sends an INTRODUCE1 cell to an introduction point; this event is
 	 * parsed from a log statement in rend_client_send_introduction().
 	 */
-	public static final HiddenServiceEventType ALICE_SENDING_INTRODUCE1 = new HiddenServiceEventType(
-			"ALICE_SENDING_INTRODUCE1");
+	public static final HiddenServiceEventType ALICE_SENDING_INTRODUCE1 =
+			new HiddenServiceEventType("ALICE_SENDING_INTRODUCE1");
 
 	/**
 	 * Alice has received an INTRODUCE_ACK cell as an acknowledgement to a
 	 * previously sent INTRODUCE1 cell; this event is parsed from a log
 	 * statement in rend_client_introduction_acked().
 	 */
-	public static final HiddenServiceEventType ALICE_INTRODUCE_ACK_RECEIVED = new HiddenServiceEventType(
-			"ALICE_INTRODUCE_ACK_RECEIVED");
+	public static final HiddenServiceEventType ALICE_INTRODUCE_ACK_RECEIVED =
+			new HiddenServiceEventType("ALICE_INTRODUCE_ACK_RECEIVED");
 
 	/**
 	 * Alice has received a RENDEZVOUS2 cell and can now open an application
 	 * connection to the client; this event is parsed from a log statement in
 	 * rend_client_receive_rendezvous().
 	 */
-	public static final HiddenServiceEventType ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED = new HiddenServiceEventType(
-			"ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED");
+	public static final HiddenServiceEventType ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED =
+			new HiddenServiceEventType(
+					"ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED");
 
 	/**
 	 * Bob has built a circuit to an introduction point and sends an
 	 * ESTABLISH_INTRO cell; this event is parsed from a log statement in
 	 * rend_service_intro_has_opened().
 	 */
-	public static final HiddenServiceEventType BOB_BUILT_INTRO_CIRC_SENDING_ESTABLISH_INTRO = new HiddenServiceEventType(
-			"BOB_BUILT_INTRO_CIRC_SENDING_ESTABLISH_INTRO");
+	public static final HiddenServiceEventType BOB_BUILT_INTRO_CIRC_SENDING_ESTABLISH_INTRO =
+			new HiddenServiceEventType(
+					"BOB_BUILT_INTRO_CIRC_SENDING_ESTABLISH_INTRO");
 
 	/**
 	 * Bob has received an INTRO_ESTABLISHED cell, i.e. a node has confirmed to
 	 * work as introduction point; this event is parsed from a log statement in
 	 * rend_service_intro_established().
 	 */
-	public static final HiddenServiceEventType BOB_INTRO_ESTABLISHED_RECEIVED = new HiddenServiceEventType(
-			"BOB_INTRO_ESTABLISHED_RECEIVED");
+	public static final HiddenServiceEventType BOB_INTRO_ESTABLISHED_RECEIVED =
+			new HiddenServiceEventType("BOB_INTRO_ESTABLISHED_RECEIVED");
 
 	/**
 	 * Bob posts a hidden service descriptor to the directory servers; this
 	 * event is parsed from a log statement in upload_service_descriptor().
 	 */
-	public static final HiddenServiceEventType BOB_SENDING_PUBLISH_DESC = new HiddenServiceEventType(
-			"BOB_SENDING_PUBLISH_DESC");
+	public static final HiddenServiceEventType BOB_SENDING_PUBLISH_DESC =
+			new HiddenServiceEventType("BOB_SENDING_PUBLISH_DESC");
 
 	/**
 	 * Bob received a response from a directory server to a previous publish
 	 * request; this event is parsed from a log statement in
 	 * connection_dir_client_reached_eof().
 	 */
-	public static final HiddenServiceEventType BOB_DESC_PUBLISHED_RECEIVED = new HiddenServiceEventType(
-			"BOB_DESC_PUBLISHED_RECEIVED");
+	public static final HiddenServiceEventType BOB_DESC_PUBLISHED_RECEIVED =
+			new HiddenServiceEventType("BOB_DESC_PUBLISHED_RECEIVED");
 
 	/**
 	 * Bob has received an INTRODUCE2 cell, i.e. a node wants to establish a
@@ -165,53 +168,56 @@
 	 * rendezvous point; this event is parsed from a log statement in
 	 * rend_service_introduce().
 	 */
-	public static final HiddenServiceEventType BOB_INTRODUCE2_RECEIVED = new HiddenServiceEventType(
-			"BOB_INTRODUCE2_RECEIVED");
+	public static final HiddenServiceEventType BOB_INTRODUCE2_RECEIVED =
+			new HiddenServiceEventType("BOB_INTRODUCE2_RECEIVED");
 
 	/**
 	 * Bob has built a circuit to a rendezvous point and sends a RENDEZVOUS1
 	 * cell; this event is parsed from a log statement in
 	 * rend_service_rendezvous_has_opened().
 	 */
-	public static final HiddenServiceEventType BOB_BUILT_REND_CIRC_SENDING_RENDEZVOUS1 = new HiddenServiceEventType(
-			"BOB_BUILT_REND_CIRC_SENDING_RENDEZVOUS1");
+	public static final HiddenServiceEventType BOB_BUILT_REND_CIRC_SENDING_RENDEZVOUS1 =
+			new HiddenServiceEventType(
+					"BOB_BUILT_REND_CIRC_SENDING_RENDEZVOUS1");
 
 	/**
 	 * Bob opens a connection to the actual hidden server; this event is parsed
 	 * from a log statement in connection_exit_begin_conn().
 	 */
-	public static final HiddenServiceEventType BOB_APP_CONN_OPENED = new HiddenServiceEventType(
-			"BOB_APP_CONN_OPENED");
+	public static final HiddenServiceEventType BOB_APP_CONN_OPENED =
+			new HiddenServiceEventType("BOB_APP_CONN_OPENED");
 
 	/**
 	 * The directory server has received a descriptor post request; this event
 	 * is parsed from a log statement in directory_handle_command_post().
 	 */
-	public static final HiddenServiceEventType DIR_PUBLISH_DESC_RECEIVED = new HiddenServiceEventType(
-			"DIR_PUBLISH_DESC_RECEIVED");
+	public static final HiddenServiceEventType DIR_PUBLISH_DESC_RECEIVED =
+			new HiddenServiceEventType("DIR_PUBLISH_DESC_RECEIVED");
 
 	/**
 	 * The directory server has received a descriptor fetch request; this event
 	 * is parsed from a log statement in directory_handle_command_get().
 	 */
-	public static final HiddenServiceEventType DIR_FETCH_DESC_RECEIVED = new HiddenServiceEventType(
-			"DIR_FETCH_DESC_RECEIVED");
+	public static final HiddenServiceEventType DIR_FETCH_DESC_RECEIVED =
+			new HiddenServiceEventType("DIR_FETCH_DESC_RECEIVED");
 
 	/**
 	 * The node received an ESTABLISH_INTRO cell, i.e. was requested to work as
 	 * introduction point, and replies with an INTRO_ESTABLISHED cell; this
 	 * event is parsed from a log statement in rend_mid_establish_intro().
 	 */
-	public static final HiddenServiceEventType IPO_RECEIVED_ESTABLISH_INTRO_SENDING_INTRO_ESTABLISHED = new HiddenServiceEventType(
-			"IPO_RECEIVED_ESTABLISH_INTRO_SENDING_INTRO_ESTABLISHED");
+	public static final HiddenServiceEventType IPO_RECEIVED_ESTABLISH_INTRO_SENDING_INTRO_ESTABLISHED =
+			new HiddenServiceEventType(
+					"IPO_RECEIVED_ESTABLISH_INTRO_SENDING_INTRO_ESTABLISHED");
 
 	/**
 	 * The introduction point received an INTRODUCE1 cell and reacts by sending
 	 * an INTRODUCE2 cell to Bob and an INTRODUCE_ACK cell to Alice; this event
 	 * is parsed from a log statement in rend_mid_introduce().
 	 */
-	public static final HiddenServiceEventType IPO_RECEIVED_INTRODUCE1_SENDING_INTRODUCE2_AND_INTRODUCE_ACK = new HiddenServiceEventType(
-			"IPO_RECEIVED_INTRODUCE1_SENDING_INTRODUCE2_AND_INTRODUCE_ACK");
+	public static final HiddenServiceEventType IPO_RECEIVED_INTRODUCE1_SENDING_INTRODUCE2_AND_INTRODUCE_ACK =
+			new HiddenServiceEventType(
+					"IPO_RECEIVED_INTRODUCE1_SENDING_INTRODUCE2_AND_INTRODUCE_ACK");
 
 	/**
 	 * The node received an ESTABLISH_RENDEZVOUS cell, i.e. was requested to
@@ -219,15 +225,17 @@
 	 * this event is parsed from a log statement in
 	 * rend_mid_establish_rendezvous().
 	 */
-	public static final HiddenServiceEventType RPO_RECEIVED_ESTABLISH_RENDEZVOUS_SENDING_RENDEZVOUS_ESTABLISHED = new HiddenServiceEventType(
-			"RPO_RECEIVED_ESTABLISH_RENDEZVOUS_SENDING_RENDEZVOUS_ESTABLISHED");
+	public static final HiddenServiceEventType RPO_RECEIVED_ESTABLISH_RENDEZVOUS_SENDING_RENDEZVOUS_ESTABLISHED =
+			new HiddenServiceEventType(
+					"RPO_RECEIVED_ESTABLISH_RENDEZVOUS_SENDING_RENDEZVOUS_ESTABLISHED");
 
 	/**
 	 * The rendezvous point received a RENDEZVOUS1 cell and reacts by sending a
 	 * RENDEZVOUS2 cell to Alice; this event is parsed from a log statement in
 	 * rend_mid_rendezvous().
 	 */
-	public static final HiddenServiceEventType RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2 = new HiddenServiceEventType(
-			"RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2");
+	public static final HiddenServiceEventType RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2 =
+			new HiddenServiceEventType(
+					"RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2");
 
 }
\ No newline at end of file

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/Network.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/Network.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/Network.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -41,7 +41,7 @@
  * and is able to perform common operations on these nodes. Apart from the
  * factory methods, all other operations could also be performed manually by an
  * application using the appropriate interfaces.
- * 
+ *
  * @author kloesing
  */
 public interface Network {
@@ -53,7 +53,7 @@
 	 * Afterwards, the nodes will be able to run a private Tor network,
 	 * separated from public directory servers and onion routers.
 	 * </p>
-	 * 
+	 *
 	 * <p>
 	 * The configuration is done in two steps:
 	 * <ol>
@@ -63,7 +63,7 @@
 	 * the <code>approved-routers</code> files of the directory nodes.</li>
 	 * </ol>
 	 * </p>
-	 * 
+	 *
 	 * <p>
 	 * This operation may be invoked in any state of the contained nodes.
 	 * However, a network that does not have directory nodes of its own but
@@ -73,19 +73,19 @@
 	 * private Tor network. However, it may also be invoked at a later time,
 	 * e.g. to admit new nodes.
 	 * </p>
-	 * 
+	 *
 	 * <p>
 	 * This operation does not write any configurations to disk and neither
 	 * starts a nodes nor sends HUP signals to running nodes. These operations
 	 * are left to the application, so that they have more control over the
 	 * network behavior.
 	 * </p>
-	 * 
+	 *
 	 * <p>
 	 * Applications need to ensure that there are enough directory nodes (2) and
 	 * router nodes (3) in the network to allow normal operation.
 	 * </p>
-	 * 
+	 *
 	 * @throws PuppeTorException
 	 *             Thrown if an I/O problem occurs while determining the nodes'
 	 *             fingerprints.
@@ -94,7 +94,7 @@
 
 	/**
 	 * Creates a new client application, but does not yet perform a request.
-	 * 
+	 *
 	 * @param clientApplicationName
 	 *            The name for this client application, which is used for
 	 *            logging purposes and as event source. May neither be
@@ -126,7 +126,7 @@
 	 * Creates a new directory node with automatically assigned ports and adds
 	 * it to the network, but does not yet write its configuration to disk or
 	 * start the corresponding Tor process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, as node nickname, and as
@@ -144,7 +144,7 @@
 	 * listen on the given IP address and adds it to the network, but does not
 	 * yet write its configuration to disk or start the corresponding Tor
 	 * process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, as node nickname, and as
@@ -165,7 +165,7 @@
 	/**
 	 * Creates a new directory node and adds it to the network, but does not yet
 	 * write its configuration to disk or start the corresponding Tor process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, as node nickname, and as
@@ -199,7 +199,7 @@
 	 * Creates a new directory node that will listen on the given IP address and
 	 * adds it to the network, but does not yet write its configuration to disk
 	 * or start the corresponding Tor process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, as node nickname, and as
@@ -238,7 +238,7 @@
 	 * Creates a new <code>ProxyNode</code> with automatically assigned ports
 	 * and adds it to the network, but does not yet write its configuration to
 	 * disk or start the corresponding Tor process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, and as event source. May
@@ -255,7 +255,7 @@
 	 * Creates a new <code>ProxyNode</code> and adds it to the network, but
 	 * does not yet write its configuration to disk or start the corresponding
 	 * Tor process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, and as event source. May
@@ -281,7 +281,7 @@
 	 * Creates a new <code>RouterNode</code> with automatically assigned ports
 	 * and adds it to the network, but does not yet write its configuration to
 	 * disk or start the corresponding Tor process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, as node nickname, and as
@@ -298,7 +298,7 @@
 	 * Creates a new <code>RouterNode</code> and adds it to the network, but
 	 * does not yet write its configuration to disk or start the corresponding
 	 * Tor process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, as node nickname, and as
@@ -334,7 +334,7 @@
 	 * that will listen on the given IP address and adds it to the network, but
 	 * does not yet write its configuration to disk or start the corresponding
 	 * Tor process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, as node nickname, and as
@@ -356,7 +356,7 @@
 	 * Creates a new <code>RouterNode</code> that will listen on the given IP
 	 * address and adds it to the network, but does not yet write its
 	 * configuration to disk or start the corresponding Tor process.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The name for this node, which is used as name for the working
 	 *            directory, for logging purposes, as node nickname, and as
@@ -394,7 +394,7 @@
 	/**
 	 * Creates a new <code>ServerApplication</code> with automatically
 	 * assigned ports, but does not start listening for incoming requests.
-	 * 
+	 *
 	 * @param serverApplicationName
 	 *            The name for this server application, which is used for
 	 *            logging purposes and as event source. May neither be
@@ -405,13 +405,12 @@
 	 *             Thrown if an invalid value is given as server application
 	 *             name.
 	 */
-	public abstract ServerApplication createServer(
-	       String serverApplicationName);
+	public abstract ServerApplication createServer(String serverApplicationName);
 
 	/**
 	 * Creates a new <code>ServerApplication</code>, but does not start
 	 * listening for incoming requests.
-	 * 
+	 *
 	 * @param serverApplicationName
 	 *            The name for this server application, which is used for
 	 *            logging purposes and as event source. May neither be
@@ -430,7 +429,7 @@
 
 	/**
 	 * Returns a reference on the (single) event manager for this network.
-	 * 
+	 *
 	 * @return Reference on the (single) event manager for this network.
 	 */
 	public abstract EventManager getEventManager();
@@ -438,7 +437,7 @@
 	/**
 	 * Returns (a copy of) the map containing the names of all directory nodes
 	 * as keys and the corresponding directory nodes as values.
-	 * 
+	 *
 	 * @return Map containing all directory nodes.
 	 */
 	public abstract Map<String, DirectoryNode> getAllDirectoryNodes();
@@ -447,7 +446,7 @@
 	 * Returns (a copy of) the map containing the names of all router nodes
 	 * (only those that are not acting as directory nodes at the same time) as
 	 * keys and the corresponding router nodes as values.
-	 * 
+	 *
 	 * @return Map containing all router nodes.
 	 */
 	public abstract Map<String, RouterNode> getAllRouterNodes();
@@ -456,7 +455,7 @@
 	 * Returns (a copy of) the map containing the names of all proxy nodes (only
 	 * those that are not acting as router or directory nodes at the same time)
 	 * as keys and the corresponding proxy nodes as values.
-	 * 
+	 *
 	 * @return Map containing all proxy nodes.
 	 */
 	public abstract Map<String, ProxyNode> getAllProxyNodes();
@@ -464,7 +463,7 @@
 	/**
 	 * Returns (a copy of) the map containing the names of all nodes as keys and
 	 * the corresponding proxy nodes as values.
-	 * 
+	 *
 	 * @return Map containing all nodes.
 	 */
 	public abstract Map<String, ProxyNode> getAllNodes();
@@ -472,7 +471,7 @@
 	/**
 	 * Returns the node with name <code>nodeName</code> or <code>null</code>
 	 * if no such node exists.
-	 * 
+	 *
 	 * @param nodeName
 	 *            The node name to look up.
 	 * @return The node with name <code>nodeName</code>.
@@ -485,7 +484,7 @@
 	 * blocks the invoking thread until all nodes have reported to have
 	 * successfully opened a circuit.
 	 * </p>
-	 * 
+	 *
 	 * <p>
 	 * First, the method waits for <code>hupInterval</code> milliseconds for
 	 * the nodes to have successfully opened a circuit. If they do not succeed
@@ -498,7 +497,7 @@
 	 * <code>true</code>. This operation can only be invoked, if all nodes in
 	 * the network are in state <code>NodeState.RUNNING</code>.
 	 * </p>
-	 * 
+	 *
 	 * @param tries
 	 *            The maximum number of HUP signals that are sent to the Tor
 	 *            processes. Negative values are not allowed. A value of zero
@@ -529,7 +528,7 @@
 	 * Sends a HUP signal to all nodes in the network once. This operation can
 	 * only be invoked, if all nodes in the network are in state
 	 * <code>NodeState.RUNNING</code>.
-	 * 
+	 *
 	 * @throws IllegalStateException
 	 *             Thrown if at least one node is not in state
 	 *             <code>NodeState.RUNNING</code>.
@@ -542,7 +541,7 @@
 	 * Sends a HUP signal to all directory nodes in the network once. This
 	 * operation can only be invoked, if all directory nodes in the network are
 	 * in state <code>NodeState.RUNNING</code>.
-	 * 
+	 *
 	 * @throws IllegalStateException
 	 *             Thrown if at least one directory node is not in state
 	 *             <code>NodeState.RUNNING</code>.
@@ -557,7 +556,7 @@
 	 * exception that has been observed when shutting down nodes. The method can
 	 * be assumed to return very quickly. If there are no running nodes in this
 	 * network, this operation has no effect.
-	 * 
+	 *
 	 * @throws PuppeTorException
 	 *             Thrown if an I/O problem occurs while shutting down the
 	 *             nodes.
@@ -572,7 +571,7 @@
 	 * operation was either successful or has timed out. This operation can only
 	 * be invoked, if all nodes in the network have written their configuration,
 	 * i.e. are not in state <code>NodeState.CONFIGURING</code> anymore.
-	 * 
+	 *
 	 * @param maximumTimeToWaitInMillis
 	 *            The maximum time to wait in milliseconds. A positive value or
 	 *            zero restricts waiting to this time. Negative values are not
@@ -597,7 +596,7 @@
 	 * method is assumed to return very quickly. In case of a private network,
 	 * <code>configureAsPrivateNetwork</code> should be invoked in advance to
 	 * this method!
-	 * 
+	 *
 	 * @throws PuppeTorException
 	 *             Thrown if an I/O problem occurs while writing to the nodes'
 	 *             working directories.
@@ -607,7 +606,7 @@
 	/**
 	 * Returns the working directory of this network configuration which is in
 	 * <code>test-env/networkName/</code>.
-	 * 
+	 *
 	 * @return Working directory of this network.
 	 */
 	public abstract File getWorkingDirectory();
@@ -618,7 +617,7 @@
 	 * Note that the result only contains those configuration strings that are
 	 * added by this node class to possible superclasses and that parameterized
 	 * configuration strings, e.g. port configurations, are not included.
-	 * 
+	 *
 	 * @param nodeClass
 	 *            The class which will be configured with the returned template
 	 *            configuration; may not be <code>null</code>.
@@ -632,7 +631,7 @@
 	/**
 	 * Adds a configuration string to the template of a node class, so that it
 	 * will be added to future instances of this node class and its subclasses.
-	 * 
+	 *
 	 * @param nodeClass
 	 *            The class of nodes of which future instances will have the
 	 *            given configuration string; may not be <code>null</code>.
@@ -652,7 +651,7 @@
 	 * Removes a configuration string from the template of a node class, so that
 	 * it will not be added to future instances of this node class and its
 	 * subclasses.
-	 * 
+	 *
 	 * @param nodeClass
 	 *            The class of nodes of which future instances will have the
 	 *            given configuration string; may not be <code>null</code>.
@@ -669,7 +668,7 @@
 
 	/**
 	 * Returns the name of this network.
-	 * 
+	 *
 	 * @return The name of this network.
 	 */
 	public abstract String getNetworkName();

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NetworkFactory.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NetworkFactory.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NetworkFactory.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -39,34 +39,35 @@
 /**
  * The <code>NetworkFactory</code> is a concrete factory that can create
  * <code>Network</code> instances.
- * 
+ *
  * TODO At the moment, this class uses the concrete class NetworkImpl to
  * implement its only factory method. If we want to make this a real abstract
  * factory, we need to replace the concrete constructor by reading the class
  * name of the class implementing Network from a property file and invoking its
  * constructor using reflection. Currently, this is the only place where we
  * reference a class from the impl package.
- * 
+ *
  * @author kloesing
  */
 public abstract class NetworkFactory {
 
-    final private static ConcurrentMap<String, Network> networks = new ConcurrentHashMap<String,Network>();
-    
+	final private static ConcurrentMap<String, Network> networks =
+			new ConcurrentHashMap<String, Network>();
+
 	/**
 	 * Creates a new network that is required for a test run. The new network is
 	 * initially unpopulated and creates its own working directory at
 	 * test-env/randomTestID/. The network automatically assigns port numbers to
 	 * newly created nodes starting at <code>7000</code>.
-	 * 
+	 *
 	 * @param networkName
 	 *            Name of this network configuration.
 	 * @return A new network instance.
 	 */
-	public static Network createNetwork(String networkName) {
-		Network network = new NetworkImpl(networkName);
+	public static Network createNetwork(final String networkName) {
+		final Network network = new NetworkImpl(networkName);
 		networks.put(networkName, network);
-	    return network;
+		return network;
 	}
 
 	/**
@@ -74,7 +75,7 @@
 	 * initially unpopulated and creates its own working directory at
 	 * test-env/randomTestID/. The network automatically assigns port numbers to
 	 * newly created nodes starting at <code>startPort</code>.
-	 * 
+	 *
 	 * @param networkName
 	 *            Name of this network configuration.
 	 * @param startPort
@@ -86,20 +87,21 @@
 	 *            created nodes.
 	 * @return A new network instance.
 	 */
-	public static Network createNetwork(String networkName, int startPort) {
-	    Network network = new NetworkImpl(networkName, startPort);
-	    networks.put(networkName, network);
-	    return network;
+	public static Network createNetwork(final String networkName, final int startPort) {
+		final Network network = new NetworkImpl(networkName, startPort);
+		networks.put(networkName, network);
+		return network;
 	}
-	
+
 	/**
-	 * 
+	 *
 	 */
-    public static Network getNetworkByName( String networkName ) {
-        Network network = networks.get(networkName);
-        if( network == null)
-            throw new IllegalStateException("BUG: The network with name " 
-                    + networkName + " must exist and be non-null!");
-        return network;
-    }
+	public static Network getNetworkByName(final String networkName) {
+		final Network network = networks.get(networkName);
+		if (network == null) {
+			throw new IllegalStateException("BUG: The network with name "
+					+ networkName + " must exist and be non-null!");
+		}
+		return network;
+	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NodeEventType.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NodeEventType.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NodeEventType.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -44,43 +44,43 @@
 
 	/**
 	 * Creates a new event type with the given type string.
-	 * 
+	 *
 	 * @param typeString
 	 *            String identifying the type of the event type.
 	 */
-	public NodeEventType(String typeString) {
+	public NodeEventType(final String typeString) {
 		this.typeString = typeString;
 	}
 
 	public String getTypeName() {
-		return this.typeString;
+		return typeString;
 	}
 
 	/**
 	 * The node was started and we managed to connect to its control port; this
 	 * event is fired internally and not parsed from a log statement from Tor.
 	 */
-	public static final NodeEventType NODE_STARTED = new NodeEventType(
-			"NODE_STARTED");
+	public static final NodeEventType NODE_STARTED =
+			new NodeEventType("NODE_STARTED");
 
 	/**
 	 * The node has opened its control port; this event is parsed from a log
 	 * statement in connection_create_listener().
 	 */
-	public static final NodeEventType NODE_CONTROL_PORT_OPENED = new NodeEventType(
-			"NODE_CONTROL_PORT_OPENED");
+	public static final NodeEventType NODE_CONTROL_PORT_OPENED =
+			new NodeEventType("NODE_CONTROL_PORT_OPENED");
 
 	/**
 	 * The node which has successfully opened a circuit; this event is parsed
 	 * from a log statement in circuit_send_next_onion_skin().
 	 */
-	public static final NodeEventType NODE_CIRCUIT_OPENED = new NodeEventType(
-			"NODE_CIRCUIT_OPENED");
+	public static final NodeEventType NODE_CIRCUIT_OPENED =
+			new NodeEventType("NODE_CIRCUIT_OPENED");
 
 	/**
 	 * The node was stopped; this event is fired internally and not parsed from
 	 * a log statement from Tor.
 	 */
-	public static final NodeEventType NODE_STOPPED = new NodeEventType(
-			"NODE_STOPPED");
+	public static final NodeEventType NODE_STOPPED =
+			new NodeEventType("NODE_STOPPED");
 }
\ No newline at end of file

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NodeState.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NodeState.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/NodeState.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -39,7 +39,7 @@
  * require a certain <code>NodeState</code> as precondition and may ensure
  * another <code>NodeState</code> as postcondition. There is a prescribed
  * order of states.
- * 
+ *
  * @author kloesing
  */
 public enum NodeState {

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ProxyNode.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ProxyNode.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ProxyNode.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -41,7 +41,7 @@
  * applications. It is the superclass for other node types that extend the
  * configuration of a </code>ProxyNode</code>.
  * </p>
- * 
+ *
  * <p>
  * <b>Pay extra attention when using in private network!</b> Using proxy nodes
  * in private networks in the same way as router nodes will fail! Tor has two
@@ -55,7 +55,7 @@
  * router descriptors. You have at least the following options to cope with this
  * problem:
  * </p>
- * 
+ *
  * <ul>
  * <li>Use router nodes instead of proxy nodes,</li>
  * <li>start proxy nodes with a delay of at least 10 minutes to be sure that
@@ -65,14 +65,14 @@
  * <code>NETWORKSTATUS_CLIENT_DL_INTERVAL</code> in Tor to values smaller than
  * your overall HUP time for starting the network.</li>
  * </ul>
- * 
+ *
  * @author kloesing
  */
 public interface ProxyNode {
 
 	/**
 	 * Adds the entries for a hidden service to the configuration of this node.
-	 * 
+	 *
 	 * @param serviceName
 	 *            Name of the hidden service that will be used as name for the
 	 *            hidden service directory. May neither be <code>null</code>
@@ -98,7 +98,7 @@
 	/**
 	 * Adds the entries for a hidden service with virtual port 80 to the
 	 * configuration of this node.
-	 * 
+	 *
 	 * @param serviceName
 	 *            Name of the hidden service that will be used as name for the
 	 *            hidden service directory. May neither be <code>null</code>
@@ -120,9 +120,9 @@
 	/**
 	 * Adds the entries for a hidden service with an automatically assigned
 	 * service port and virtual port 80 to the configuration of this node.
-	 * 
+	 *
 	 * service port automatically assigned virtual port 80
-	 * 
+	 *
 	 * @param serviceName
 	 *            Name of the hidden service that will be used as name for the
 	 *            hidden service directory. May neither be <code>null</code>
@@ -137,7 +137,7 @@
 	/**
 	 * Adds the given configuration string, consisting of "<configuration key>
 	 * <configuration value>", to the configuration of this node.
-	 * 
+	 *
 	 * @param configurationString
 	 *            The configuration string to be added.
 	 * @throws IllegalArgumentException
@@ -150,7 +150,7 @@
 	/**
 	 * Adds the given configuration strings, each consisting of "<configuration
 	 * key> <configuration value>", to the configuration of this node.
-	 * 
+	 *
 	 * @param configurationStrings
 	 *            A list of the configuration strings to be added.
 	 * @throws IllegalArgumentException
@@ -168,7 +168,7 @@
 	 * multiple occurrences of the given configuration key are found, only the
 	 * first occurrence is replaced; if no configuration can be found, the
 	 * configuration string is appended.
-	 * 
+	 *
 	 * @param configurationString
 	 *            The replacing configuration string.
 	 * @throws IllegalArgumentException
@@ -182,7 +182,7 @@
 	 * Removes all configuration strings containing the given configuration key
 	 * in "<configuration key> <configuration value>", regardless of their
 	 * configuration value.
-	 * 
+	 *
 	 * @param configurationKey
 	 *            The configuration key to remove.
 	 * @throws IllegalArgumentException
@@ -193,14 +193,14 @@
 
 	/**
 	 * Returns the name of this node.
-	 * 
+	 *
 	 * @return The name of this node.
 	 */
 	public abstract String getNodeName();
 
 	/**
 	 * Returns the state of this node.
-	 * 
+	 *
 	 * @return The state of this node.
 	 */
 	public abstract NodeState getNodeState();
@@ -209,7 +209,7 @@
 	 * Sends a HUP command to the process via its control port to restart it;
 	 * can only be done if the node has already been started, i.e. is in state
 	 * <code>NodeState.RUNNING</code>!
-	 * 
+	 *
 	 * @throws PuppeTorException
 	 *             Thrown if an I/O problem occurs while sending the HUP signal.
 	 * @throws IllegalStateException
@@ -222,7 +222,7 @@
 	 * is done by sending the <code>SHUTDOWN</code> signal twice, so that
 	 * those nodes extending <code>ProxyNode</code> which have opened their OR
 	 * port shutdown immediately, too.
-	 * 
+	 *
 	 * @throws IllegalStateException
 	 *             Thrown if this node is not in state
 	 *             <code>NodeState.RUNNING</code>.
@@ -238,7 +238,7 @@
 	 * absolutely necessary, that logging on the console is not changed in the
 	 * configuration of this node to a higher level than NOTICE, because the
 	 * output is parsed to see when the control port is opened.</b>
-	 * 
+	 *
 	 * @param maximumTimeToWaitInMillis
 	 *            Maximum time in milliseconds we will wait for the Tor process
 	 *            to be started and the control port being opened. If this value
@@ -262,7 +262,7 @@
 	 * its working directory and changes the state to
 	 * <code>NodeState.CONFIGURATION_WRITTEN</code>, if it was in state
 	 * <code>NodeState.CONFIGURING</code> before.
-	 * 
+	 *
 	 * @throws PuppeTorException
 	 *             Thrown if the configuration file <code>torrc</code> cannot
 	 *             be written to disk.
@@ -271,14 +271,14 @@
 
 	/**
 	 * Returns the SOCKS port of this node.
-	 * 
+	 *
 	 * @return The SOCKS port of this node.
 	 */
 	public abstract int getSocksPort();
 
 	/**
 	 * Returns the control port of this node.
-	 * 
+	 *
 	 * @return The control port of this node.
 	 */
 	public abstract int getControlPort();
@@ -286,7 +286,7 @@
 	/**
 	 * Returns (a copy of) the list of strings containing the configuration of
 	 * this node.
-	 * 
+	 *
 	 * @return (A copy of) the list of strings containing the configuration of
 	 *         this node.
 	 */

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/PuppeTorException.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/PuppeTorException.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/PuppeTorException.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -40,7 +40,7 @@
  * an application using this API (invoking a method with wrong parameter values,
  * in wrong state, etc.) will instead cause appropriate runtime exceptions from
  * the Java API.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
@@ -57,35 +57,35 @@
 	/**
 	 * Creates a <code>PuppeTorException</code> with the given detail
 	 * <code>message</code> and <code>cause</code>.
-	 * 
+	 *
 	 * @param message
 	 *            The detail message of this exception.
 	 * @param cause
 	 *            The cause for this exception.
 	 */
-	public PuppeTorException(String message, Throwable cause) {
+	public PuppeTorException(final String message, final Throwable cause) {
 		super(message, cause);
 	}
 
 	/**
 	 * Creates a <code>PuppeTorException</code> with the given detail
 	 * <code>message</code>, but without a <code>cause</code>.
-	 * 
+	 *
 	 * @param message
 	 *            The detail message of this exception.
 	 */
-	public PuppeTorException(String message) {
+	public PuppeTorException(final String message) {
 		super(message);
 	}
 
 	/**
 	 * Creates a <code>PuppeTorException</code> with the given
 	 * <code>cause</code>, but without a detail message.
-	 * 
+	 *
 	 * @param cause
 	 *            The cause for this exception.
 	 */
-	public PuppeTorException(Throwable cause) {
+	public PuppeTorException(final Throwable cause) {
 		super(cause);
 	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/RouterNode.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/RouterNode.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/RouterNode.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -37,21 +37,21 @@
  * traffic on behalf of remote applications. It inherits most of its
  * configuration and behavior from its superclass <code>ProxyNode</code> and
  * adds some router-specific configurations and behavior.
- * 
+ *
  * @author kloesing
  */
 public interface RouterNode extends ProxyNode {
 
 	/**
 	 * Returns the dir port of this node.
-	 * 
+	 *
 	 * @return The dir port of this node.
 	 */
 	public abstract int getDirPort();
 
 	/**
 	 * Returns the onion port of this node.
-	 * 
+	 *
 	 * @return The onion port of this node.
 	 */
 	public abstract int getOrPort();
@@ -61,7 +61,7 @@
 	 * Returns the fingerprint string of this node, formatted like
 	 * <code>nickname 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000</code>.
 	 * </p>
-	 * 
+	 *
 	 * <p>
 	 * The fingerprint is determined by a background thread that is started as
 	 * soon as the node is instantiated. If this background thread has not
@@ -69,7 +69,7 @@
 	 * until the fingerprint is available (or determining it has failed,
 	 * whereupon an exception will be thrown).
 	 * </p>
-	 * 
+	 *
 	 * @return The fingerprint of this node.
 	 * @throws PuppeTorException
 	 *             Thrown if either the temporary <code>torrc.temp</code>

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ServerApplication.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ServerApplication.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ServerApplication.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * answers all <code>HTTP GET</code> requests by empty <code>HTTP OK</code>
  * replies. Therefore, a thread will be started to listen for incoming requests
  * in the background.
- * 
+ *
  * @author kloesing
  */
 public interface ServerApplication {
@@ -46,7 +46,7 @@
 	 * clients. Any incoming request is answered by an empty
 	 * <code>HTTP OK</code> reply. This method may only be invoked when the
 	 * server is currently not in listening state!
-	 * 
+	 *
 	 * @throws IllegalStateException
 	 *             Thrown if the server is currently not in listening state.
 	 */
@@ -55,7 +55,7 @@
 	/**
 	 * Stops listening for requests. This method may only be invoked when the
 	 * server is currently in listening state!
-	 * 
+	 *
 	 * @throws IllegalStateException
 	 *             Thrown if the server is currently in listening state.
 	 */
@@ -63,21 +63,21 @@
 
 	/**
 	 * Returns whether this server is currently in listening state.
-	 * 
+	 *
 	 * @return The listening state of this server.
 	 */
 	public abstract boolean isListening();
 
 	/**
 	 * Returns the name of this server.
-	 * 
+	 *
 	 * @return The name of this server.
 	 */
 	public abstract String getServerApplicationName();
 
 	/**
 	 * Returns the port on which this server listens.
-	 * 
+	 *
 	 * @return The port on which this server listens.
 	 */
 	public abstract int getServerPort();

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ServerEventType.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ServerEventType.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/ServerEventType.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -45,16 +45,16 @@
 
 	/**
 	 * Creates a new event type with the given type string.
-	 * 
+	 *
 	 * @param typeString
 	 *            String identifying the type of the event type.
 	 */
-	public ServerEventType(String typeString) {
+	public ServerEventType(final String typeString) {
 		this.typeString = typeString;
 	}
 
 	public String getTypeName() {
-		return this.typeString;
+		return typeString;
 	}
 
 	/**
@@ -62,6 +62,6 @@
 	 * this event is fired internally and not parsed from a log statement from
 	 * Tor.
 	 */
-	public static final ServerEventType SERVER_RECEIVING_REQUEST_SENDING_REPLY = new ServerEventType(
-			"SERVER_RECEIVING_REQUEST_SENDING_REPLY");
+	public static final ServerEventType SERVER_RECEIVING_REQUEST_SENDING_REPLY =
+			new ServerEventType("SERVER_RECEIVING_REQUEST_SENDING_REPLY");
 }
\ No newline at end of file

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AccessingPublicWebServerOverTor.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AccessingPublicWebServerOverTor.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AccessingPublicWebServerOverTor.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -44,28 +44,28 @@
 /**
  * Example for accessing a public web server (here: <code>www.google.com</code>)
  * over Tor to measure the access time.
- * 
+ *
  * @author kloesing
  */
 public class AccessingPublicWebServerOverTor {
 
 	/**
 	 * Sets up and runs the test.
-	 * 
+	 *
 	 * @param args
 	 *            Command-line arguments (ignored).
 	 * @throws PuppeTorException
 	 *             Thrown if there is a problem with the JVM-external Tor
 	 *             processes that we cannot handle.
 	 */
-	public static void main(String[] args) throws PuppeTorException {
+	public static void main(final String[] args) throws PuppeTorException {
 
 		// though we only need a single proxy, we always need to create a
 		// network to initialize a test case.
-		Network network = NetworkFactory.createNetwork("example1");
+		final Network network = NetworkFactory.createNetwork("example1");
 
 		// create a single proxy node with name "proxy"
-		ProxyNode proxy = network.createProxy("proxy");
+		final ProxyNode proxy = network.createProxy("proxy");
 
 		// write configuration of proxy node
 		network.writeConfigurations();
@@ -91,11 +91,12 @@
 		System.out.println("Successfully built circuits!");
 
 		// create client application
-		ClientApplication client = network.createClient("client",
-				"www.google.com", 80, proxy.getSocksPort());
+		final ClientApplication client =
+				network.createClient("client", "www.google.com", 80, proxy
+						.getSocksPort());
 
 		// create event listener to listen for client application events
-		EventListener clientEventListener = new EventListener() {
+		final EventListener clientEventListener = new EventListener() {
 
 			// remember time when request was sent
 			private long before;
@@ -112,7 +113,7 @@
 		};
 
 		// obtain reference to event manager to be able to respond to events
-		EventManager manager = network.getEventManager();
+		final EventManager manager = network.getEventManager();
 
 		// register event handler for client application events
 		manager.addEventListener(client.getClientApplicationName(),
@@ -128,8 +129,7 @@
 		// wait a second before shutting down the proxy
 		try {
 			Thread.sleep(1000);
-		} catch (InterruptedException e) {
-		}
+		} catch (final InterruptedException e) {}
 
 		// shut down proxy
 		network.shutdownNodes();
@@ -137,8 +137,7 @@
 		// wait another second before exiting the application
 		try {
 			Thread.sleep(1000);
-		} catch (InterruptedException e) {
-		}
+		} catch (final InterruptedException e) {}
 
 		// Shut down the JVM
 		System.out.println("Goodbye.");

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -47,35 +47,35 @@
 /**
  * Example for advertising and accessing a hidden service over a private Tor
  * network.
- * 
+ *
  * @author kloesing
  */
 public class AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork {
 
 	/**
 	 * Sets up and runs the test.
-	 * 
+	 *
 	 * @param args
 	 *            Command-line arguments (ignored).
 	 * @throws PuppeTorException
 	 *             Thrown if there is a problem with the JVM-external Tor
 	 *             processes that we cannot handle.
 	 */
-	public static void main(String[] args) throws PuppeTorException {
+	public static void main(final String[] args) throws PuppeTorException {
 
 		// create a network to initialize the test case
-		Network network = NetworkFactory.createNetwork("example4");
+		final Network network = NetworkFactory.createNetwork("example4");
 
 		// create three router nodes
-		RouterNode router1 = network.createRouter("router1");
+		final RouterNode router1 = network.createRouter("router1");
 		network.createRouter("router2");
-		RouterNode router3 = network.createRouter("router3");
+		final RouterNode router3 = network.createRouter("router3");
 
 		// create only one directory node
 		network.createDirectory("dir1");
 
 		// add hidden service
-		HiddenService hidServ1 = router1.addHiddenService("hidServ");
+		final HiddenService hidServ1 = router1.addHiddenService("hidServ");
 
 		// configure nodes of this network to be part of a private network
 		network.configureAsPrivateNetwork();
@@ -104,7 +104,7 @@
 		System.out.println("Successfully built circuits!");
 
 		// obtain reference to event manager to be able to respond to events
-		EventManager manager = network.getEventManager();
+		final EventManager manager = network.getEventManager();
 
 		// wait for 1 hour that the proxy has published its first RSD
 		if (!manager.waitForAnyOccurence(router1.getNodeName(),
@@ -117,16 +117,17 @@
 		System.out.println("Successfully published an RSD!");
 
 		// create server application
-		ServerApplication server = network.createServer("server", hidServ1
-				.getServicePort());
+		final ServerApplication server =
+				network.createServer("server", hidServ1.getServicePort());
 
 		// create client application
-		ClientApplication client = network.createClient("client", hidServ1
-				.determineOnionAddress(), hidServ1.getVirtualPort(), router3
-				.getSocksPort());
+		final ClientApplication client =
+				network.createClient("client",
+						hidServ1.determineOnionAddress(), hidServ1
+								.getVirtualPort(), router3.getSocksPort());
 
 		// register event listener
-		EventListener clientAndServerEventListener = new EventListener() {
+		final EventListener clientAndServerEventListener = new EventListener() {
 			public void handleEvent(Event event) {
 				System.out.println("Handling event: " + event.getMessage());
 			}

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -48,31 +48,31 @@
 /**
  * Example for advertising and accessing a hidden service over the public Tor
  * network.
- * 
+ *
  * @author kloesing
  */
 public class AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork {
 
 	/**
 	 * Sets up and runs the test.
-	 * 
+	 *
 	 * @param args
 	 *            Command-line arguments (ignored).
 	 * @throws PuppeTorException
 	 *             Thrown if there is a problem with the JVM-external Tor
 	 *             processes that we cannot handle.
 	 */
-	public static void main(String[] args) throws PuppeTorException {
+	public static void main(final String[] args) throws PuppeTorException {
 
 		// create a network to initialize the test case
-		Network network = NetworkFactory.createNetwork("example3");
+		final Network network = NetworkFactory.createNetwork("example3");
 
 		// create two proxy nodes
-		ProxyNode proxy1 = network.createProxy("proxy1");
-		ProxyNode proxy2 = network.createProxy("proxy2");
+		final ProxyNode proxy1 = network.createProxy("proxy1");
+		final ProxyNode proxy2 = network.createProxy("proxy2");
 
 		// add hidden service to the configuration of proxy1
-		HiddenService hidServ1 = proxy1.addHiddenService("hidServ");
+		final HiddenService hidServ1 = proxy1.addHiddenService("hidServ");
 
 		// write configuration of proxy nodes
 		network.writeConfigurations();
@@ -98,7 +98,7 @@
 		System.out.println("Successfully built circuits!");
 
 		// obtain reference to event manager to be able to respond to events
-		EventManager manager = network.getEventManager();
+		final EventManager manager = network.getEventManager();
 
 		// wait for 3 minutes that the proxy has published its first RSD
 		if (!manager.waitForAnyOccurence(proxy1.getNodeName(),
@@ -112,17 +112,18 @@
 		System.out.println("Successfully published an RSD!");
 
 		// create server application
-		ServerApplication server = network.createServer("server", hidServ1
-				.getServicePort());
+		final ServerApplication server =
+				network.createServer("server", hidServ1.getServicePort());
 
 		// create client application
-		ClientApplication client = network.createClient("client", hidServ1
-				.determineOnionAddress(), hidServ1.getVirtualPort(), proxy2
-				.getSocksPort());
+		final ClientApplication client =
+				network.createClient("client",
+						hidServ1.determineOnionAddress(), hidServ1
+								.getVirtualPort(), proxy2.getSocksPort());
 
 		// create event listener to listen for client and server application
 		// events
-		EventListener clientAndServerEventListener = new EventListener() {
+		final EventListener clientAndServerEventListener = new EventListener() {
 
 			private long requestReceivedAtServer;
 

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -44,26 +44,26 @@
 /**
  * Example for advertising a hidden service to the public Tor network and
  * observing the publication of rendezvous service descriptors.
- * 
+ *
  * @author kloesing
  */
 public class AdvertisingHiddenServiceToPublicTorNetwork {
 
 	/**
 	 * Sets up and runs the test.
-	 * 
+	 *
 	 * @param args
 	 *            Command-line arguments (ignored).
 	 * @throws PuppeTorException
 	 *             Thrown if there is a problem with the JVM-external Tor
 	 *             processes that we cannot handle.
 	 */
-	public static void main(String[] args) throws PuppeTorException {
+	public static void main(final String[] args) throws PuppeTorException {
 		// create a network to initialize the test case
-		Network network = NetworkFactory.createNetwork("example2");
-		
+		final Network network = NetworkFactory.createNetwork("example2");
+
 		// create a single proxy node
-		ProxyNode proxy = network.createProxy("proxy");
+		final ProxyNode proxy = network.createProxy("proxy");
 
 		// add hidden service to the configuration
 		proxy.addHiddenService("hidServ");
@@ -72,7 +72,7 @@
 		network.writeConfigurations();
 
 		// create event listener to listen for events from our proxy
-		EventListener proxyEventListener = new EventListener() {
+		final EventListener proxyEventListener = new EventListener() {
 
 			// remember time when request was sent
 			private long circuitOpened = -1;
@@ -91,7 +91,7 @@
 		};
 
 		// obtain reference to event manager to be able to respond to events
-		EventManager manager = network.getEventManager();
+		final EventManager manager = network.getEventManager();
 
 		// register event handler for proxy events
 		manager.addEventListener(proxy.getNodeName(), proxyEventListener);
@@ -122,7 +122,7 @@
 
 		try {
 			Thread.sleep(2L * 60L * 1000L);
-		} catch (InterruptedException e) {
+		} catch (final InterruptedException e) {
 			// do nothing
 		}
 

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ClientApplicationImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ClientApplicationImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ClientApplicationImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -48,12 +48,11 @@
 
 /**
  * Implementation of <code>ClientApplication</code>.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
-public class ClientApplicationImpl implements
-		ClientApplication {
+public class ClientApplicationImpl implements ClientApplication {
 
 	/**
 	 * Internal thread class that is used to perform requests.
@@ -69,22 +68,22 @@
 		/**
 		 * Number of retries to be performed.
 		 */
-		private int retries;
+		private final int retries;
 
 		/**
 		 * Flag that determines whether requests shall be stopped after the
 		 * first successful reply (<code>true</code>), or not (<code>false</code>).
 		 */
-		private boolean stopOnSuccess;
+		private final boolean stopOnSuccess;
 
 		/**
 		 * Timeout in milliseconds for each retry.
 		 */
-		private long timeoutForEachRetry;
+		private final long timeoutForEachRetry;
 
 		/**
 		 * Creates a new thread, but does not start performing requests, yet.
-		 * 
+		 *
 		 * @param retries
 		 *            Number of retries to be performed.
 		 * @param timeoutForEachRetry
@@ -94,8 +93,8 @@
 		 *            after the first successful reply (<code>true</code>),
 		 *            or not (<code>false</code>).
 		 */
-		RequestThread(int retries, long timeoutForEachRetry,
-				boolean stopOnSuccess) {
+		RequestThread(final int retries, final long timeoutForEachRetry,
+				final boolean stopOnSuccess) {
 
 			// log entering
 			logger
@@ -105,7 +104,7 @@
 
 			// check parameters
 			if (retries < 0 || timeoutForEachRetry < 0) {
-				IllegalArgumentException e = new IllegalArgumentException();
+				final IllegalArgumentException e = new IllegalArgumentException();
 				logger.throwing(this.getClass().getName(), "RequestThread", e);
 				throw e;
 			}
@@ -116,7 +115,7 @@
 			this.stopOnSuccess = stopOnSuccess;
 
 			// start connected
-			this.connected = true;
+			connected = true;
 
 			// log exiting
 			logger.exiting(this.getClass().getName(), "RequestThread");
@@ -134,14 +133,15 @@
 			try {
 
 				// set Tor as proxy
-				InetSocketAddress isa = new InetSocketAddress("127.0.0.1",
-						socksPort);
-				Proxy p = new Proxy(Type.SOCKS, isa);
+				final InetSocketAddress isa =
+						new InetSocketAddress("127.0.0.1", socksPort);
+				final Proxy p = new Proxy(Type.SOCKS, isa);
 
 				// create target address for socket -- don't resolve the target
 				// name to an IP address!
-				InetSocketAddress hs = InetSocketAddress.createUnresolved(
-						targetName, targetPort);
+				final InetSocketAddress hs =
+						InetSocketAddress.createUnresolved(targetName,
+								targetPort);
 
 				// start retry loop
 				for (int i = 0; connected && i < retries; i++) {
@@ -150,14 +150,13 @@
 					logger.log(Level.FINE, "Trying to perform request");
 
 					// remember when we started
-					long timeBeforeConnectionAttempt = System
-							.currentTimeMillis();
+					final long timeBeforeConnectionAttempt =
+							System.currentTimeMillis();
 
 					// send event to event manager
 					eventManager.observeInternalEvent(
 							timeBeforeConnectionAttempt,
-							ClientApplicationImpl.this
-									.getClientApplicationName(),
+							getClientApplicationName(),
 							ClientEventType.CLIENT_SENDING_REQUEST,
 							"Sending request.");
 
@@ -171,12 +170,13 @@
 						s.connect(hs, (int) timeoutForEachRetry);
 
 						// open output stream to write request
-						PrintStream out = new PrintStream(s.getOutputStream());
+						final PrintStream out = new PrintStream(s.getOutputStream());
 						out.print("GET / HTTP/1.0\r\n\r\n");
 
 						// open input stream to read reply
-						BufferedReader in = new BufferedReader(
-								new InputStreamReader(s.getInputStream()));
+						final BufferedReader in =
+								new BufferedReader(new InputStreamReader(s
+										.getInputStream()));
 
 						// only read the first char in the response; this method
 						// blocks until there is a response
@@ -185,15 +185,14 @@
 						// send event to event manager
 						eventManager.observeInternalEvent(System
 								.currentTimeMillis(),
-								ClientApplicationImpl.this
-										.getClientApplicationName(),
+								getClientApplicationName(),
 								ClientEventType.CLIENT_REPLY_RECEIVED,
 								"Received response.");
 
 						// if we should stop on success, stop further connection
 						// attempts
-						if (this.stopOnSuccess) {
-							this.connected = false;
+						if (stopOnSuccess) {
+							connected = false;
 						}
 
 						// clean up socket
@@ -201,7 +200,7 @@
 						out.close();
 						s.close();
 
-					} catch (SocketTimeoutException e) {
+					} catch (final SocketTimeoutException e) {
 
 						// log warning
 						logger.log(Level.WARNING,
@@ -210,14 +209,13 @@
 						// send event to event manager
 						eventManager.observeInternalEvent(System
 								.currentTimeMillis(),
-								ClientApplicationImpl.this
-										.getClientApplicationName(),
+								getClientApplicationName(),
 								ClientEventType.CLIENT_GAVE_UP_REQUEST,
 								"Giving up request.");
 
 						// try again immediately, if there are retries left
 
-					} catch (IOException e) {
+					} catch (final IOException e) {
 
 						// log warning
 						logger.log(Level.WARNING,
@@ -227,44 +225,48 @@
 						// send event to event manager
 						eventManager.observeInternalEvent(System
 								.currentTimeMillis(),
-								ClientApplicationImpl.this
-										.getClientApplicationName(),
+								getClientApplicationName(),
 								ClientEventType.CLIENT_GAVE_UP_REQUEST,
 								"Giving up request.");
 
 						// wait for the rest of the timeout
-						long timeOfTimeoutLeft = timeBeforeConnectionAttempt
-								+ this.timeoutForEachRetry
-								- System.currentTimeMillis();
+						final long timeOfTimeoutLeft =
+								timeBeforeConnectionAttempt
+										+ timeoutForEachRetry
+										- System.currentTimeMillis();
 						if (timeOfTimeoutLeft > 0) {
 							try {
 								Thread.sleep(timeOfTimeoutLeft);
-							} catch (InterruptedException ex) {
+							} catch (final InterruptedException ex) {
 								// do nothing
 							}
 						}
 
 					} finally {
+						if (s != null) {
+							// close connection
+							try {
 
-						// close connection
-						try {
+								// try to close socket
+								logger.log(Level.FINER,
+										"Trying to close socket.");
+								s.close();
+								logger.log(Level.FINE, "Socket closed.");
 
-							// try to close socket
-							logger.log(Level.FINER, "Trying to close socket.");
-							s.close();
-							logger.log(Level.FINE, "Socket closed.");
+							} catch (final Exception e1) {
 
-						} catch (Exception e1) {
-
-							// log warning
-							logger.log(Level.WARNING,
-									"Exception when trying to close socket!",
-									e1);
+								// log warning
+								logger
+										.log(
+												Level.WARNING,
+												"Exception when trying to close socket!",
+												e1);
+							}
 						}
 					}
 				}
 
-			} catch (Exception e) {
+			} catch (final Exception e) {
 
 				// log that we have been interrupted
 				logger.log(Level.WARNING, "Client has been interrupted!", e);
@@ -276,7 +278,7 @@
 
 				// send event to event manager
 				eventManager.observeInternalEvent(System.currentTimeMillis(),
-						ClientApplicationImpl.this.getClientApplicationName(),
+						getClientApplicationName(),
 						ClientEventType.CLIENT_REQUESTS_PERFORMED,
 						"Requests performed.");
 
@@ -294,8 +296,8 @@
 			logger.entering(this.getClass().getName(), "stopRequest");
 
 			// change connected state to false and interrupt thread
-			this.connected = false;
-			this.interrupt();
+			connected = false;
+			interrupt();
 
 			// log exiting
 			logger.exiting(this.getClass().getName(), "stopRequest");
@@ -305,7 +307,7 @@
 	/**
 	 * Name of this client application that is used as logger name of this node.
 	 */
-	private String clientApplicationName;
+	private final String clientApplicationName;
 
 	/**
 	 * Thread that performs the requests in the background.
@@ -315,35 +317,35 @@
 	/**
 	 * Event manager that handles all events concerning this client application.
 	 */
-	private EventManagerImpl eventManager;
+	private final EventManagerImpl eventManager;
 
 	/**
 	 * Logger for this client which is called "client." plus the name of this
 	 * client application.
 	 */
-	private Logger logger;
+	private final Logger logger;
 
 	/**
 	 * SOCKS port of the local Tor node to which requests are sent.
 	 */
-	private int socksPort;
+	private final int socksPort;
 
 	/**
 	 * Target name for the requests sent by this client; can be a publicly
 	 * available URL or an onion address.
 	 */
-	private String targetName;
+	private final String targetName;
 
 	/**
 	 * Target port for the requests sent by this client; can be either a server
 	 * port or a virtual port of a hidden service.
 	 */
-	private int targetPort;
+	private final int targetPort;
 
 	/**
 	 * Creates a new HTTP client within this JVM, but does not start sending
 	 * requests.
-	 * 
+	 *
 	 * @param network
 	 *            Network to which this HTTP client belongs; at the moment this
 	 *            is only used to determine the event manager instance.
@@ -361,8 +363,8 @@
 	 *             If at least one of the parameters is <code>null</code> or
 	 *             has an invalid value.
 	 */
-	ClientApplicationImpl(NetworkImpl network, String clientApplicationName,
-			String targetName, int targetPort, int socksPort) {
+	ClientApplicationImpl(final NetworkImpl network, final String clientApplicationName,
+			final String targetName, final int targetPort, final int socksPort) {
 
 		// check if clientApplicationName can be used as logger name
 		if (clientApplicationName == null
@@ -372,10 +374,10 @@
 		}
 
 		// create logger
-		this.logger = Logger.getLogger("client." + clientApplicationName);
+		logger = Logger.getLogger("client." + clientApplicationName);
 
 		// log entering
-		this.logger.entering(this.getClass().getName(),
+		logger.entering(this.getClass().getName(),
 				"ClientApplicationImpl", new Object[] { network,
 						clientApplicationName, targetName, targetPort,
 						socksPort });
@@ -384,8 +386,8 @@
 		if (network == null || targetName == null || targetName.length() == 0
 				|| targetPort < 0 || targetPort > 65535 || socksPort < 0
 				|| socksPort > 65535) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"ClientApplicationImpl", e);
 			throw e;
 		}
@@ -397,77 +399,79 @@
 		this.socksPort = socksPort;
 
 		// obtain and store reference on event manager
-		this.eventManager = network.getEventManagerImpl();
+		eventManager = network.getEventManagerImpl();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "ClientApplicationImpl");
+		logger.exiting(this.getClass().getName(), "ClientApplicationImpl");
 	}
 
-	public synchronized void startRequests(int retries,
-			long timeoutForEachRetry, boolean stopOnSuccess) {
+	public synchronized void startRequests(final int retries,
+			final long timeoutForEachRetry, final boolean stopOnSuccess) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "performRequest",
+		logger.entering(this.getClass().getName(), "performRequest",
 				new Object[] { retries, timeoutForEachRetry, stopOnSuccess });
 
 		// check parameters
 		if (retries <= 0 || timeoutForEachRetry < 0) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger
 					.throwing(this.getClass().getName(), "performRequest", e);
 			throw e;
 		}
 
 		// check if we already have started a request (TODO change this to allow
 		// multiple requests in parallel? would be possible)
-		if (this.clientThread != null) {
-			IllegalStateException e = new IllegalStateException(
-					"Another request has already been started!");
-			this.logger
+		if (clientThread != null) {
+			final IllegalStateException e =
+					new IllegalStateException(
+							"Another request has already been started!");
+			logger
 					.throwing(this.getClass().getName(), "performRequest", e);
 			throw e;
 		}
 
 		// create a thread that performs requests in the background
-		this.clientThread = new RequestThread(retries, timeoutForEachRetry,
-				stopOnSuccess);
-		this.clientThread.setName("Request Thread");
-		this.clientThread.setDaemon(true);
-		this.clientThread.start();
+		clientThread =
+				new RequestThread(retries, timeoutForEachRetry, stopOnSuccess);
+		clientThread.setName("Request Thread");
+		clientThread.setDaemon(true);
+		clientThread.start();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "performRequest");
+		logger.exiting(this.getClass().getName(), "performRequest");
 	}
 
 	public synchronized void stopRequest() {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "stopRequest");
+		logger.entering(this.getClass().getName(), "stopRequest");
 
 		// check if a request is running
-		if (this.clientThread == null) {
-			IllegalStateException e = new IllegalStateException("Cannot stop "
-					+ "request, because no request has been started!");
-			this.logger.throwing(this.getClass().getName(), "stopRequest", e);
+		if (clientThread == null) {
+			final IllegalStateException e =
+					new IllegalStateException("Cannot stop "
+							+ "request, because no request has been started!");
+			logger.throwing(this.getClass().getName(), "stopRequest", e);
 			throw e;
 		}
 
 		// log this event
-		this.logger.log(Level.FINE, "Shutting down client");
+		logger.log(Level.FINE, "Shutting down client");
 
 		// interrupt thread
-		this.clientThread.stopRequest();
+		clientThread.stopRequest();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "stopRequest");
+		logger.exiting(this.getClass().getName(), "stopRequest");
 	}
 
 	@Override
 	public String toString() {
 		return this.getClass().getSimpleName() + ": clientApplicationName=\""
-				+ this.clientApplicationName + "\", targetAddress=\""
-				+ this.targetName + "\", targetPort=" + this.targetPort
-				+ ", socksPort=" + this.socksPort;
+				+ clientApplicationName + "\", targetAddress=\""
+				+ targetName + "\", targetPort=" + targetPort
+				+ ", socksPort=" + socksPort;
 	}
 
 	public String getClientApplicationName() {

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/DirectoryNodeImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/DirectoryNodeImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/DirectoryNodeImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -52,7 +52,7 @@
 
 /**
  * Implementation of <code>DirectoryNode</code>.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
@@ -60,11 +60,10 @@
 
 	/**
 	 * Executable file for generating v3 directory authority certificates.
-	 * 
+	 *
 	 * TODO make this configurable!
 	 */
-	protected static final File torGencertExecutable = new File(
-			"tor-gencert");
+	protected static final File torGencertExecutable = new File("tor-gencert");
 
 	/**
 	 * Internal thread class that is used to generate v3 directory authority
@@ -79,12 +78,14 @@
 			logger.entering(this.getClass().getName(), "run");
 
 			// run tor-gencert
-			ProcessBuilder processBuilder = new ProcessBuilder(
-					torGencertExecutable.getPath(), "--create-identity-key"// );
-					, "--passphrase-fd", "0");
-			File workingDirectory = new File(DirectoryNodeImpl.this.workingDir
-					.getAbsolutePath()
-					+ File.separator + "keys" + File.separator);
+			final ProcessBuilder processBuilder =
+					new ProcessBuilder(torGencertExecutable.getPath(),
+							"--create-identity-key"// );
+							, "--passphrase-fd", "0");
+			final File workingDirectory =
+					new File(workingDir
+							.getAbsolutePath()
+							+ File.separator + "keys" + File.separator);
 
 			// create working directory
 			workingDirectory.mkdirs();
@@ -94,36 +95,40 @@
 			Process tmpProcess = null;
 			try {
 				tmpProcess = processBuilder.start();
-			} catch (IOException e) {
-				PuppeTorException ex = new PuppeTorException(
-						"Could not start tor-gencert process for generating a "
-								+ "v3 directory authority certificate!", e);
+			} catch (final IOException e) {
+				final PuppeTorException ex =
+						new PuppeTorException(
+								"Could not start tor-gencert process for generating a "
+										+ "v3 directory authority certificate!",
+								e);
 				logger.log(Level.WARNING, "Could not start tor-gencert "
 						+ "process for generating a v3 directory authority "
 						+ "certificate!", ex);
-				DirectoryNodeImpl.this.setCaughtException(ex);
+				setCaughtException(ex);
 				return;
 			}
 
-			BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
-					tmpProcess.getOutputStream()));
+			final BufferedWriter writer =
+					new BufferedWriter(new OutputStreamWriter(tmpProcess
+							.getOutputStream()));
 			try {
 				writer.write("somepassword\n");
 				writer.close();
-			} catch (IOException e1) {
+			} catch (final IOException e1) {
 				System.out.println("Exception at write! " + e1.getMessage());
 				e1.printStackTrace();
 			}
-			//final InputStream read = tmpProcess.getErrorStream();
+			// final InputStream read = tmpProcess.getErrorStream();
 
-			InputStream stderr = tmpProcess.getInputStream();
-			InputStreamReader isr = new InputStreamReader(stderr);
-			BufferedReader br = new BufferedReader(isr);
+			final InputStream stderr = tmpProcess.getInputStream();
+			final InputStreamReader isr = new InputStreamReader(stderr);
+			final BufferedReader br = new BufferedReader(isr);
 			String line = null;
 			try {
-				while ((line = br.readLine()) != null)
+				while ((line = br.readLine()) != null) {
 					;
-			} catch (IOException e1) {
+				}
+			} catch (final IOException e1) {
 				e1.printStackTrace();
 			}
 
@@ -131,59 +136,65 @@
 			int exitValue = 0;
 			try {
 				exitValue = tmpProcess.waitFor();
-			} catch (InterruptedException e) {
-				PuppeTorException ex = new PuppeTorException(
-						"Interrupted while waiting for tor-gencert process to exit!",
-						e);
+			} catch (final InterruptedException e) {
+				final PuppeTorException ex =
+						new PuppeTorException(
+								"Interrupted while waiting for tor-gencert process to exit!",
+								e);
 				logger.log(Level.WARNING,
 						"tor-gencert process was interrupted!", ex);
-				DirectoryNodeImpl.this.setCaughtException(ex);
+				setCaughtException(ex);
 				return;
 			}
 
 			if (exitValue != 0) {
-				PuppeTorException ex = new PuppeTorException(
-						"Could not start tor-gencert process! tor-gencert exited with "
-								+ "exit value " + exitValue + "!");
+				final PuppeTorException ex =
+						new PuppeTorException(
+								"Could not start tor-gencert process! tor-gencert exited with "
+										+ "exit value " + exitValue + "!");
 				logger.log(Level.WARNING,
 						"Could not start tor-gencert process!", ex);
-				DirectoryNodeImpl.this.setCaughtException(ex);
+				setCaughtException(ex);
 				return;
 			}
 
 			// read fingerprint from file
-			File authorityCertificateFile = new File(workingDirectory
-					.getAbsolutePath()
-					+ File.separator + "authority_certificate");
+			final File authorityCertificateFile =
+					new File(workingDirectory.getAbsolutePath()
+							+ File.separator + "authority_certificate");
 			String identity;
 			try {
-				BufferedReader br2 = new BufferedReader(new FileReader(
-						authorityCertificateFile));
+				final BufferedReader br2 =
+						new BufferedReader(new FileReader(
+								authorityCertificateFile));
 				while ((line = br2.readLine()) != null
-						&& !line.startsWith("fingerprint "))
+						&& !line.startsWith("fingerprint ")) {
 					;
+				}
 				if (line == null) {
-					PuppeTorException ex = new PuppeTorException(
-							"Could not find fingerprint line in file "
-									+ "authority_certificate!");
+					final PuppeTorException ex =
+							new PuppeTorException(
+									"Could not find fingerprint line in file "
+											+ "authority_certificate!");
 					logger.log(Level.WARNING,
 							"Could not find fingerprint line in file "
 									+ "authority_certificate!", ex);
-					DirectoryNodeImpl.this.setCaughtException(ex);
+					setCaughtException(ex);
 					return;
 				}
 				identity = line.substring(line.indexOf(" ") + 1);
 				br2.close();
-			} catch (IOException e) {
-				PuppeTorException ex = new PuppeTorException(
-						"Could not read fingerprint from file!", e);
+			} catch (final IOException e) {
+				final PuppeTorException ex =
+						new PuppeTorException(
+								"Could not read fingerprint from file!", e);
 				logger.log(Level.WARNING, "Could not read fingerprint file!",
 						ex);
-				DirectoryNodeImpl.this.setCaughtException(ex);
+				setCaughtException(ex);
 				return;
 			}
 
-			DirectoryNodeImpl.this.setV3Identity(identity);
+			setV3Identity(identity);
 
 			// log exiting
 			logger.exiting(this.getClass().getName(), "run");
@@ -193,13 +204,13 @@
 	/**
 	 * Set of routers that are approved by this directory node.
 	 */
-	private SortedSet<String> approvedRouters;
+	private final SortedSet<String> approvedRouters;
 
 	/**
 	 * Creates a <code>DirectoryNodeImpl</code> and adds it to the given
 	 * <code>network</code>, but does not yet write its configuration to disk
 	 * or start the corresponding Tor process.
-	 * 
+	 *
 	 * @param network
 	 *            Network configuration to which this node belongs.
 	 * @param nodeName
@@ -231,46 +242,46 @@
 	 *             Thrown if an I/O problem occurs while writing the temporary
 	 *             <code>approved-routers</code> file.
 	 */
-	DirectoryNodeImpl(NetworkImpl network, String nodeName, int controlPort,
-			int socksPort, int orPort, int dirPort, String serverIpAddress) {
+	DirectoryNodeImpl(final NetworkImpl network, final String nodeName, final int controlPort,
+			final int socksPort, final int orPort, final int dirPort, final String serverIpAddress) {
 		// create superclass instance; parameter checking is done in super
 		// constructor
 		super(network, nodeName, controlPort, socksPort, orPort, dirPort,
 				serverIpAddress);
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "DirectoryNodeImpl",
+		logger.entering(this.getClass().getName(), "DirectoryNodeImpl",
 				new Object[] { network, nodeName, controlPort, socksPort,
 						orPort, dirPort });
 
 		// initialize attribute
-		this.approvedRouters = new TreeSet<String>();
+		approvedRouters = new TreeSet<String>();
 
 		// extend configuration by template configuration of directory nodes
-		this.configuration.addAll(templateConfiguration);
+		configuration.addAll(templateConfiguration);
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "DirectoryNodeImpl");
+		logger.exiting(this.getClass().getName(), "DirectoryNodeImpl");
 	}
 
 	/**
 	 * Invoked by the certificate generating thread: sets the generated v3
 	 * identity string.
-	 * 
+	 *
 	 * @param v3Identity
 	 *            The generated v3 identity string.
 	 */
-	private synchronized void setV3Identity(String v3Identity) {
+	private synchronized void setV3Identity(final String v3Identity) {
 		// log entering
-		this.logger.entering(this.getClass().getName(), "setV3Identity",
+		logger.entering(this.getClass().getName(), "setV3Identity",
 				v3Identity);
 
 		// remember fingerprint and notify all waiting threads
 		this.v3Identity = v3Identity;
-		this.notifyAll();
+		notifyAll();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "setV3Identity");
+		logger.exiting(this.getClass().getName(), "setV3Identity");
 	}
 
 	/**
@@ -281,107 +292,112 @@
 	public synchronized String getV3Identity() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "getV3Identity");
+		logger.entering(this.getClass().getName(), "getV3Identity");
 
 		// wait until either the v3 identity has been determined or an exception
 		// was caught
-		while (this.v3Identity == null && this.caughtException == null) {
+		while (v3Identity == null && caughtException == null) {
 
 			try {
 				wait(500);
-			} catch (InterruptedException e) {
+			} catch (final InterruptedException e) {
 				// do nothing
 			}
 		}
 
-		if (this.caughtException != null) {
-			this.logger.throwing(this.getClass().getName(), "getV3Identity",
-					this.caughtException);
-			throw this.caughtException;
+		if (caughtException != null) {
+			logger.throwing(this.getClass().getName(), "getV3Identity",
+					caughtException);
+			throw caughtException;
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "getV3Identity",
-				this.v3Identity);
-		return this.v3Identity;
+		logger.exiting(this.getClass().getName(), "getV3Identity",
+				v3Identity);
+		return v3Identity;
 	}
 
 	public synchronized String getDirServerString() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "getDirServerString");
+		logger.entering(this.getClass().getName(), "getDirServerString");
 
 		// determine fingerprint
-		String fingerprint = this.getFingerprint();
+		String fingerprint = getFingerprint();
 
 		// cut off router nickname
 		fingerprint = fingerprint.substring(fingerprint.indexOf(" ") + 1);
 
 		// determine v3 identity
-		String determinedV3Identity = this.getV3Identity();
+		final String determinedV3Identity = getV3Identity();
 
 		// put everything together
-		String dirServerString = "DirServer " + this.nodeName + " v3ident="
-				+ determinedV3Identity + " orport=" + this.orPort + " "
-				+ this.serverIpAddress + ":" + this.dirPort + " " + fingerprint;
+		final String dirServerString =
+				"DirServer " + nodeName + " v3ident="
+						+ determinedV3Identity + " orport=" + orPort + " "
+						+ serverIpAddress + ":" + dirPort + " "
+						+ fingerprint;
 
 		// log exiting and return dir server string
-		this.logger.exiting(this.getClass().getName(), "getDirServerString",
+		logger.exiting(this.getClass().getName(), "getDirServerString",
 				dirServerString);
 		return dirServerString;
 	}
 
-	public void addApprovedRouters(Set<String> routers) {
+	public void addApprovedRouters(final Set<String> routers) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "addApprovedRouters",
+		logger.entering(this.getClass().getName(), "addApprovedRouters",
 				routers);
 
 		// check parameter
 		if (routers == null) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"addApprovedRouters", e);
 			throw e;
 		}
 
 		// add the given approved router strings to the sorted set of already
 		// known strings (if any)
-		this.approvedRouters.addAll(routers);
+		approvedRouters.addAll(routers);
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "addApprovedRouters");
+		logger.exiting(this.getClass().getName(), "addApprovedRouters");
 	}
 
 	@Override
 	protected synchronized void determineFingerprint() {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "determineFingerprint");
+		logger.entering(this.getClass().getName(), "determineFingerprint");
 
 		// start a thread to generate the directory's certificate
-		GenerateCertificateThread certificateThread = new GenerateCertificateThread();
+		final GenerateCertificateThread certificateThread =
+				new GenerateCertificateThread();
 		certificateThread.setName(nodeName + " Certificate Generator");
 		certificateThread.start();
 
 		// wait (non-blocking) for the v3 identity string
 		try {
-			this.getV3Identity();
-		} catch (PuppeTorException e1) {
-			PuppeTorException ex = new PuppeTorException(
-					"Could not read v3 identity string!", e1);
-			this.caughtException = ex;
+			getV3Identity();
+		} catch (final PuppeTorException e1) {
+			final PuppeTorException ex =
+					new PuppeTorException("Could not read v3 identity string!",
+							e1);
+			caughtException = ex;
 			return;
 		}
 
 		// create an empty approved-routers file to make Tor happy
 		try {
-			new File(this.workingDir.getAbsolutePath() + File.separator
+			new File(workingDir.getAbsolutePath() + File.separator
 					+ "approved-routers").createNewFile();
-		} catch (IOException e) {
-			PuppeTorException ex = new PuppeTorException(
-					"Could not write empty approved-routers file!", e);
-			this.caughtException = ex;
+		} catch (final IOException e) {
+			final PuppeTorException ex =
+					new PuppeTorException(
+							"Could not write empty approved-routers file!", e);
+			caughtException = ex;
 			return;
 		}
 
@@ -393,22 +409,22 @@
 	public synchronized void writeConfiguration() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "writeConfiguration");
+		logger.entering(this.getClass().getName(), "writeConfiguration");
 
 		// write approved-routers file
 		try {
-			File approvedRoutersFile = new File(this.workingDir
-					.getAbsolutePath()
-					+ File.separator + "approved-routers");
-			BufferedWriter bw = new BufferedWriter(new FileWriter(
-					approvedRoutersFile));
-			for (String approvedRouter : this.approvedRouters) {
+			final File approvedRoutersFile =
+					new File(workingDir.getAbsolutePath() + File.separator
+							+ "approved-routers");
+			final BufferedWriter bw =
+					new BufferedWriter(new FileWriter(approvedRoutersFile));
+			for (final String approvedRouter : approvedRouters) {
 				bw.write(approvedRouter + "\n");
 			}
 			bw.close();
-		} catch (IOException e) {
-			PuppeTorException ex = new PuppeTorException(e);
-			this.logger.throwing(this.getClass().getName(),
+		} catch (final IOException e) {
+			final PuppeTorException ex = new PuppeTorException(e);
+			logger.throwing(this.getClass().getName(),
 					"writeConfiguration", ex);
 			throw ex;
 		}
@@ -417,7 +433,7 @@
 		super.writeConfiguration();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "writeConfiguration");
+		logger.exiting(this.getClass().getName(), "writeConfiguration");
 	}
 
 	/**
@@ -434,12 +450,12 @@
 		templateConfiguration.add("V3AuthoritativeDirectory 1");
 		templateConfiguration.add("DirAllowPrivateAddresses 1");
 		templateConfiguration.add("MinUptimeHidServDirectoryV2 0 minutes");
-		
+
 		// TODO This is now contained in proposal 135.
-		//templateConfiguration.add("AuthDirMaxServersPerAddr 0");
-		//templateConfiguration.add("AuthDirMaxServersPerAuthAddr 0");
-		//templateConfiguration.add("V3AuthVotingInterval 5 minutes");
-		//templateConfiguration.add("V3AuthVoteDelay 20 seconds");
-		//templateConfiguration.add("V3AuthDistDelay 20 seconds");
+		// templateConfiguration.add("AuthDirMaxServersPerAddr 0");
+		// templateConfiguration.add("AuthDirMaxServersPerAuthAddr 0");
+		// templateConfiguration.add("V3AuthVotingInterval 5 minutes");
+		// templateConfiguration.add("V3AuthVoteDelay 20 seconds");
+		// templateConfiguration.add("V3AuthDistDelay 20 seconds");
 	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/EventImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/EventImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/EventImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -38,7 +38,7 @@
 
 /**
  * Implementation of <code>Event</code>.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
@@ -47,7 +47,7 @@
 	/**
 	 * The source of this event.
 	 */
-	private String source;
+	private final String source;
 
 	/**
 	 * The type of this event.
@@ -58,7 +58,7 @@
 	 * Either the log message that led to firing this event, or an internal
 	 * message.
 	 */
-	private String message;
+	private final String message;
 
 	/**
 	 * The occurrence time of the event or of the corresponding log statement.
@@ -67,7 +67,7 @@
 
 	/**
 	 * Creates a new <code>EventImpl</code>.
-	 * 
+	 *
 	 * @param occurrenceTime
 	 *            The occurrence time of the event or of the corresponding log
 	 *            statement.
@@ -79,7 +79,7 @@
 	 *            Either the log message that led to firing this event, or an
 	 *            internal message.
 	 */
-	EventImpl(long occurrenceTime, String source, EventType type, String message) {
+	EventImpl(final long occurrenceTime, final String source, final EventType type, final String message) {
 		this.occurrenceTime = occurrenceTime;
 		this.source = source;
 		this.type = type;
@@ -88,60 +88,60 @@
 
 	/**
 	 * Creates a new <code>EventImpl</code>.
-	 * 
+	 *
 	 * @param source
 	 *            The source of this event.
 	 * @param message
 	 *            Either the log message that led to firing this event, or an
 	 *            internal message.
 	 */
-	EventImpl(String source, String message) {
+	EventImpl(final String source, final String message) {
 		this.source = source;
 		this.message = message;
 	}
 
 	public String getSource() {
-		return this.source;
+		return source;
 	}
 
 	public EventType getType() {
-		return this.type;
+		return type;
 	}
 
 	/**
 	 * Sets the event type to the given type.
-	 * 
+	 *
 	 * @param type
 	 *            The type of this event.
 	 */
-	void setType(EventType type) {
+	void setType(final EventType type) {
 		this.type = type;
 	}
 
 	public String getMessage() {
-		return this.message;
+		return message;
 	}
 
 	public long getOccurrenceTime() {
-		return this.occurrenceTime;
+		return occurrenceTime;
 	}
 
 	@Override
 	public String toString() {
 		return this.getClass().getSimpleName() + ": occurenceTime="
-				+ new Date(this.occurrenceTime) + ", source=\"" + this.source
-				+ "\", type=" + this.type.getTypeName() + ", message=\""
-				+ this.message + "\"";
+				+ new Date(occurrenceTime) + ", source=\"" + source
+				+ "\", type=" + type.getTypeName() + ", message=\""
+				+ message + "\"";
 	}
 
 	/**
 	 * Sets the occurrence time to the given time.
-	 * 
+	 *
 	 * @param occurrenceTime
 	 *            The occurrence time of the event or of the corresponding log
 	 *            statement.
 	 */
-	void setOccurenceTime(long occurrenceTime) {
+	void setOccurenceTime(final long occurrenceTime) {
 		this.occurrenceTime = occurrenceTime;
 	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/EventManagerImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/EventManagerImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/EventManagerImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -58,7 +58,7 @@
 
 /**
  * Implementation of <code>EventManager</code>.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
@@ -67,34 +67,34 @@
 	/**
 	 * Registered event handlers for specific sources.
 	 */
-	private Map<String, Set<EventListener>> eventHandlers;
+	private final Map<String, Set<EventListener>> eventHandlers;
 
 	/**
 	 * Registered event handlers for all sources.
 	 */
-	private Set<EventListener> eventHandlersForAllSources;
+	private final Set<EventListener> eventHandlersForAllSources;
 
 	/**
 	 * Logger for this event manager which is called "event." plus the name of
 	 * the network.
 	 */
-	private Logger logger;
+	private final Logger logger;
 
 	/**
 	 * Events observed so far.
 	 */
-	private Map<String, List<Event>> observedEvents;
+	private final Map<String, List<Event>> observedEvents;
 
 	/**
 	 * Set of all registered event sources. This is required to ensure that
 	 * requests for events from a given source specify valid event sources.
 	 */
-	private Set<String> eventSources;
+	private final Set<String> eventSources;
 
 	/**
 	 * Creates a new <code>EventManagerImpl</code> for the network with name
 	 * <code>networkName</code> and initializes it.
-	 * 
+	 *
 	 * @param networkName
 	 *            Name of this event manager that is used as part of the logger
 	 *            name.
@@ -102,7 +102,7 @@
 	 *             Thrown if the given <code>networkName</code> is either
 	 *             <code>null</code> or a zero-length string.
 	 */
-	EventManagerImpl(String networkName) {
+	EventManagerImpl(final String networkName) {
 
 		// check if networkName can be used as logger name
 		if (networkName == null || networkName.length() == 0) {
@@ -111,20 +111,20 @@
 		}
 
 		// create logger
-		this.logger = Logger.getLogger("event." + networkName);
+		logger = Logger.getLogger("event." + networkName);
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "EventManagerImpl",
+		logger.entering(this.getClass().getName(), "EventManagerImpl",
 				networkName);
 
 		// create data structures
-		this.observedEvents = new HashMap<String, List<Event>>();
-		this.eventHandlers = new HashMap<String, Set<EventListener>>();
-		this.eventHandlersForAllSources = new HashSet<EventListener>();
-		this.eventSources = new HashSet<String>();
+		observedEvents = new HashMap<String, List<Event>>();
+		eventHandlers = new HashMap<String, Set<EventListener>>();
+		eventHandlersForAllSources = new HashSet<EventListener>();
+		eventSources = new HashSet<String>();
 
 		// start thread to parse events
-		Thread eventParseThread = new Thread() {
+		final Thread eventParseThread = new Thread() {
 			@Override
 			public void run() {
 				while (true) {
@@ -139,117 +139,117 @@
 		initializeEventTypePatterns();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "EventManagerImpl");
+		logger.exiting(this.getClass().getName(), "EventManagerImpl");
 	}
 
-	public synchronized List<Event> addEventListener(String source,
-			EventListener listener) {
+	public synchronized List<Event> addEventListener(final String source,
+			final EventListener listener) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "addEventListener",
+		logger.entering(this.getClass().getName(), "addEventListener",
 				new Object[] { source, listener });
 
 		// check parameters
 		if (source == null || listener == null
-				|| !this.eventSources.contains(source)) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(), "addEventListener",
+				|| !eventSources.contains(source)) {
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(), "addEventListener",
 					e);
 			throw e;
 		}
 
 		// if necessary, create new event listener set for source
-		if (!this.eventHandlers.containsKey(source)) {
-			this.eventHandlers.put(source, new HashSet<EventListener>());
+		if (!eventHandlers.containsKey(source)) {
+			eventHandlers.put(source, new HashSet<EventListener>());
 		}
 
 		// add listener
-		this.eventHandlers.get(source).add(listener);
+		eventHandlers.get(source).add(listener);
 
 		// log change
-		this.logger
+		logger
 				.log(Level.FINE, "Added event listener for source " + source);
 
 		// log exiting and return
-		List<Event> result = getEventHistory(source);
-		this.logger.exiting(this.getClass().getName(), "addEventListener",
+		final List<Event> result = getEventHistory(source);
+		logger.exiting(this.getClass().getName(), "addEventListener",
 				result);
 		return result;
 	}
 
-	public synchronized void addEventListener(EventListener listener) {
+	public synchronized void addEventListener(final EventListener listener) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "addEventListener",
+		logger.entering(this.getClass().getName(), "addEventListener",
 				new Object[] { listener });
 
 		// check parameters
 		if (listener == null) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(), "addEventListener",
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(), "addEventListener",
 					e);
 			throw e;
 		}
 
 		// add listener
-		this.eventHandlersForAllSources.add(listener);
+		eventHandlersForAllSources.add(listener);
 
 		// log change
-		this.logger.log(Level.FINE, "Added event listener for all sources.");
+		logger.log(Level.FINE, "Added event listener for all sources.");
 
 		// log exiting and return
-		this.logger.exiting(this.getClass().getName(), "addEventListener");
+		logger.exiting(this.getClass().getName(), "addEventListener");
 		return;
 	}
 
-	public synchronized List<Event> getEventHistory(String source) {
+	public synchronized List<Event> getEventHistory(final String source) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "getEventHistory",
+		logger.entering(this.getClass().getName(), "getEventHistory",
 				source);
 
 		// check parameter
-		if (source == null || !this.eventSources.contains(source)) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(), "getEventHistory",
+		if (source == null || !eventSources.contains(source)) {
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(), "getEventHistory",
 					e);
 			throw e;
 		}
 
 		// prepare result
-		List<Event> result = new ArrayList<Event>();
+		final List<Event> result = new ArrayList<Event>();
 
 		// did we already observe events for this source?
-		if (this.observedEvents.containsKey(source)) {
+		if (observedEvents.containsKey(source)) {
 			// yes, add all events to result list
-			result.addAll(this.observedEvents.get(source));
+			result.addAll(observedEvents.get(source));
 		}
 
 		// log exiting and return result
-		this.logger.exiting(this.getClass().getName(), "getEventHistory",
+		logger.exiting(this.getClass().getName(), "getEventHistory",
 				result);
 		return result;
 	}
 
-	public synchronized boolean hasEventOccured(String source, EventType type) {
+	public synchronized boolean hasEventOccured(final String source, final EventType type) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "hasEventOccured",
+		logger.entering(this.getClass().getName(), "hasEventOccured",
 				new Object[] { source, type });
 
 		// check parameters
 		if (source == null || type == null
-				|| !this.eventSources.contains(source)) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(), "hasEventOccured",
+				|| !eventSources.contains(source)) {
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(), "hasEventOccured",
 					e);
 			throw e;
 		}
 
 		// determine result
 		boolean result = false;
-		if (this.observedEvents.containsKey(source)) {
-			for (Event event : this.observedEvents.get(source)) {
+		if (observedEvents.containsKey(source)) {
+			for (final Event event : observedEvents.get(source)) {
 				if (event.getType() == type) {
 					result = true;
 					break;
@@ -258,7 +258,7 @@
 		}
 
 		// log exiting and return result
-		this.logger.exiting(this.getClass().getName(), "hasEventOccured",
+		logger.exiting(this.getClass().getName(), "hasEventOccured",
 				result);
 		return result;
 	}
@@ -266,7 +266,7 @@
 	/**
 	 * An ordered list of all log statements that are still unparsed.
 	 */
-	private List<EventImpl> unparsedLogStatements = new LinkedList<EventImpl>();
+	private final List<EventImpl> unparsedLogStatements = new LinkedList<EventImpl>();
 
 	/**
 	 * Stores the occurrence of an unparsed Tor log events that might result in
@@ -274,7 +274,7 @@
 	 * thread in invocation order. Then, the occurrence time and the event type
 	 * will be parsed from the log message; if the log message does not contain
 	 * anything of interest, the event will be discarded.
-	 * 
+	 *
 	 * @param source
 	 *            The event source.
 	 * @param logMessage
@@ -282,14 +282,14 @@
 	 * @throws IllegalArgumentException
 	 *             Thrown if the source is unknown.
 	 */
-	synchronized void observeUnparsedEvent(String source, String logMessage) {
-		this.unparsedLogStatements.add(new EventImpl(source, logMessage));
+	synchronized void observeUnparsedEvent(final String source, final String logMessage) {
+		unparsedLogStatements.add(new EventImpl(source, logMessage));
 		notifyAll();
 	}
 
 	/**
 	 * Add an internal event to the event queue.
-	 * 
+	 *
 	 * @param occurrenceTime
 	 *            The occurrence time of the event.
 	 * @param source
@@ -301,17 +301,17 @@
 	 * @throws IllegalArgumentException
 	 *             Thrown if the source is unknown.
 	 */
-	synchronized void observeInternalEvent(long occurrenceTime, String source,
-			EventType type, String message) {
+	synchronized void observeInternalEvent(final long occurrenceTime, final String source,
+			final EventType type, final String message) {
 
-		if (!this.eventSources.contains(source)) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+		if (!eventSources.contains(source)) {
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"observeInternalEvent", e);
 			throw e;
 		}
 
-		this.unparsedLogStatements.add(new EventImpl(occurrenceTime, source,
+		unparsedLogStatements.add(new EventImpl(occurrenceTime, source,
 				type, message));
 		notifyAll();
 	}
@@ -325,18 +325,17 @@
 		// wait for the next event in the queue
 		EventImpl event = null;
 		synchronized (this) {
-			while (this.unparsedLogStatements.isEmpty()) {
+			while (unparsedLogStatements.isEmpty()) {
 				try {
 					wait();
-				} catch (InterruptedException e) {
-				}
+				} catch (final InterruptedException e) {}
 			}
-			event = this.unparsedLogStatements.remove(0);
+			event = unparsedLogStatements.remove(0);
 		}
 
 		// does the event contain a known source? if not, discard it
-		if (!this.eventSources.contains(event.getSource())) {
-			this.logger.log(Level.WARNING,
+		if (!eventSources.contains(event.getSource())) {
+			logger.log(Level.WARNING,
 					"Unknown event source while parsing an event: "
 							+ event.getSource());
 			return;
@@ -346,7 +345,7 @@
 		if (event.getType() != null) {
 			observeEvent(event);
 		} else {
-			String line = event.getMessage();
+			final String line = event.getMessage();
 
 			/*
 			 * the logging output of Tor does not contain a year component; put
@@ -354,19 +353,20 @@
 			 * after the logging took place) in the good hope that this tool is
 			 * not run at midnight on New Year's Eve...
 			 */
-			Calendar c = Calendar.getInstance();
-			int currentYear = c.get(Calendar.YEAR);
+			final Calendar c = Calendar.getInstance();
+			final int currentYear = c.get(Calendar.YEAR);
 
 			// try to apply one of the event type patterns
-			for (Entry<Pattern, EventType> entry : eventTypePatterns.entrySet()) {
-				Matcher matcher = entry.getKey().matcher(line);
+			for (final Entry<Pattern, EventType> entry : eventTypePatterns.entrySet()) {
+				final Matcher matcher = entry.getKey().matcher(line);
 				if (matcher.find()) {
-					SimpleDateFormat sdf = new SimpleDateFormat(
-							"MMM dd HH:mm:ss.SSS", Locale.US);
-					Date logTime = sdf.parse(line, new ParsePosition(0));
+					final SimpleDateFormat sdf =
+							new SimpleDateFormat("MMM dd HH:mm:ss.SSS",
+									Locale.US);
+					final Date logTime = sdf.parse(line, new ParsePosition(0));
 					c.setTimeInMillis(logTime.getTime());
 					c.set(Calendar.YEAR, currentYear);
-					long t = c.getTimeInMillis();
+					final long t = c.getTimeInMillis();
 					event.setOccurenceTime(t);
 					event.setType(entry.getValue());
 					observeEvent(event);
@@ -383,8 +383,8 @@
 	 */
 	Map<Pattern, EventType> eventTypePatterns;
 
-	public synchronized void registerEventTypePattern(String patternString,
-			EventType eventType) {
+	public synchronized void registerEventTypePattern(final String patternString,
+			final EventType eventType) {
 		eventTypePatterns.put(Pattern.compile(patternString), eventType);
 	}
 
@@ -461,107 +461,107 @@
 	 * Stores the given <code>event</code> from <code>source</code> to the
 	 * event history and propagates its occurrence to all registered event
 	 * handlers.
-	 * 
+	 *
 	 * @param event
 	 *            The observed event.
 	 */
-	private synchronized void observeEvent(Event event) {
+	private synchronized void observeEvent(final Event event) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "observeEvent", event);
+		logger.entering(this.getClass().getName(), "observeEvent", event);
 
-		String source = event.getSource();
-		this.logger.log(Level.FINE, "Observed event " + event + " from source "
+		final String source = event.getSource();
+		logger.log(Level.FINE, "Observed event " + event + " from source "
 				+ source + "!");
 
 		// remember observed event
-		if (!this.observedEvents.containsKey(event.getSource())) {
-			this.observedEvents.put(source, new ArrayList<Event>());
+		if (!observedEvents.containsKey(event.getSource())) {
+			observedEvents.put(source, new ArrayList<Event>());
 		}
-		this.observedEvents.get(source).add(event);
+		observedEvents.get(source).add(event);
 
 		// notify waiting threads
 		notifyAll();
 
 		// inform event listeners
-		if (this.eventHandlers.containsKey(source)) {
+		if (eventHandlers.containsKey(source)) {
 
 			// make a copy of the event handler set, because some event handlers
 			// might want to remove themselves from this set while handling the
 			// event
-			Set<EventListener> copyOfEventHandlers = new HashSet<EventListener>(
-					this.eventHandlers.get(source));
+			final Set<EventListener> copyOfEventHandlers =
+					new HashSet<EventListener>(eventHandlers.get(source));
 
-			for (EventListener eventHandler : copyOfEventHandlers) {
+			for (final EventListener eventHandler : copyOfEventHandlers) {
 
-				this.logger.log(Level.FINE, "Informing event listener "
+				logger.log(Level.FINE, "Informing event listener "
 						+ eventHandler + " about recently observed event "
 						+ event + " from source " + source + "!");
 				eventHandler.handleEvent(event);
-				
+
 			}
 		}
 
 		// make a copy of the event handler set for all sources, because some
 		// event handlers might want to remove themselves from this set while
 		// handling the event
-		Set<EventListener> copyOfEventHandlersForAllSources = new HashSet<EventListener>(
-				this.eventHandlersForAllSources);
+		final Set<EventListener> copyOfEventHandlersForAllSources =
+				new HashSet<EventListener>(eventHandlersForAllSources);
 
-		for (EventListener eventHandler : copyOfEventHandlersForAllSources) {
+		for (final EventListener eventHandler : copyOfEventHandlersForAllSources) {
 
-			this.logger.log(Level.FINE, "Informing event listener "
+			logger.log(Level.FINE, "Informing event listener "
 					+ eventHandler + " about recently observed event " + event
 					+ " from source " + source + "!");
 			eventHandler.handleEvent(event);
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "observeEvent");
+		logger.exiting(this.getClass().getName(), "observeEvent");
 	}
 
-	public synchronized void removeEventListener(EventListener eventListener) {
+	public synchronized void removeEventListener(final EventListener eventListener) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "removeEventListener",
+		logger.entering(this.getClass().getName(), "removeEventListener",
 				eventListener);
 
 		// check parameters
 		if (eventListener == null) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"removeEventListener", e);
 			throw e;
 		}
 
 		// don't know to which source this listener has been added (may to more
 		// than one), so remove it from all possible sets
-		for (Set<EventListener> set : eventHandlers.values()) {
+		for (final Set<EventListener> set : eventHandlers.values()) {
 			if (set.remove(eventListener)) {
 				logger.log(Level.FINE, "Removed event listener!");
 			}
 		}
 
 		// remove from event listeners for all sources
-		if (this.eventHandlersForAllSources.remove(eventListener)) {
+		if (eventHandlersForAllSources.remove(eventListener)) {
 			logger.log(Level.FINE, "Removed event listener!");
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "removeEventListener");
+		logger.exiting(this.getClass().getName(), "removeEventListener");
 	}
 
-	public synchronized void waitForAnyOccurence(String source, EventType event) {
+	public synchronized void waitForAnyOccurence(final String source, final EventType event) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "waitForAnyOccurence",
+		logger.entering(this.getClass().getName(), "waitForAnyOccurence",
 				new Object[] { source, event });
 
 		// check parameters
 		if (source == null || event == null
-				|| !this.eventSources.contains(source)) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+				|| !eventSources.contains(source)) {
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"waitForAnyOccurence", e);
 			throw e;
 		}
@@ -571,56 +571,56 @@
 		waitForAnyOccurence(source, event, -1L);
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "waitForAnyOccurence");
+		logger.exiting(this.getClass().getName(), "waitForAnyOccurence");
 
 	}
 
-	public synchronized boolean waitForAnyOccurence(String source,
-			EventType event, long maximumTimeToWaitInMillis) {
+	public synchronized boolean waitForAnyOccurence(final String source,
+			final EventType event, final long maximumTimeToWaitInMillis) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "waitForAnyOccurence",
+		logger.entering(this.getClass().getName(), "waitForAnyOccurence",
 				new Object[] { source, event, maximumTimeToWaitInMillis });
 
 		// check parameters
 		if (source == null || event == null
-				|| !this.eventSources.contains(source)) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+				|| !eventSources.contains(source)) {
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"waitForAnyOccurence", e);
 			throw e;
 		}
 
 		// check if we have already observed the event
-		if (this.hasEventOccured(source, event)) {
-			this.logger.log(Level.FINE, "Waiting for any occurence of event "
+		if (hasEventOccured(source, event)) {
+			logger.log(Level.FINE, "Waiting for any occurence of event "
 					+ event + " returned immediately!");
-			this.logger.exiting(this.getClass().getName(),
+			logger.exiting(this.getClass().getName(),
 					"waitForAnyOccurence", true);
 			return true;
 		}
 
 		// invoke method that waits for next occurence of the event
-		boolean result = waitForNextOccurence(source, event,
-				maximumTimeToWaitInMillis);
+		final boolean result =
+				waitForNextOccurence(source, event, maximumTimeToWaitInMillis);
 
 		// log exiting and return result
-		this.logger.exiting(this.getClass().getName(), "waitForAnyOccurence",
+		logger.exiting(this.getClass().getName(), "waitForAnyOccurence",
 				result);
 		return result;
 	}
 
-	public synchronized void waitForNextOccurence(String source, EventType event) {
+	public synchronized void waitForNextOccurence(final String source, final EventType event) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "waitForNextOccurence",
+		logger.entering(this.getClass().getName(), "waitForNextOccurence",
 				new Object[] { source, event });
 
 		// check parameters
 		if (source == null || event == null
-				|| !this.eventSources.contains(source)) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+				|| !eventSources.contains(source)) {
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"waitForNextOccurence", e);
 			throw e;
 		}
@@ -630,21 +630,21 @@
 		waitForNextOccurence(source, event, -1L);
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "waitForNextOccurence");
+		logger.exiting(this.getClass().getName(), "waitForNextOccurence");
 	}
 
-	public synchronized boolean waitForNextOccurence(String source,
-			EventType type, long maximumTimeToWaitInMillis) {
+	public synchronized boolean waitForNextOccurence(final String source,
+			final EventType type, final long maximumTimeToWaitInMillis) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "waitForNextOccurence",
+		logger.entering(this.getClass().getName(), "waitForNextOccurence",
 				new Object[] { source, type, maximumTimeToWaitInMillis });
 
 		// check parameters
 		if (source == null || type == null
-				|| !this.eventSources.contains(source)) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+				|| !eventSources.contains(source)) {
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"waitForNextOccurence", e);
 			throw e;
 		}
@@ -654,19 +654,19 @@
 		if (maximumTimeToWaitInMillis < 0) {
 
 			// wait forever
-			while (!this.hasEventOccured(source, type)) {
+			while (!hasEventOccured(source, type)) {
 
-				this.logger.log(Level.FINEST,
+				logger.log(Level.FINEST,
 						"We will wait infinetely for the next occurence of "
 								+ "event type " + type + " from source "
 								+ source + "...");
 				try {
 					wait();
-				} catch (InterruptedException e) {
+				} catch (final InterruptedException e) {
 					// don't handle
 				}
 
-				this.logger.log(Level.FINEST,
+				logger.log(Level.FINEST,
 						"We have been notified about an observed event while "
 								+ "waiting for events of type " + type
 								+ " from source " + source
@@ -674,85 +674,83 @@
 								+ "is what we are looking for...");
 			}
 
-			this.logger.log(Level.FINE, "Waiting for occurence of event type "
+			logger.log(Level.FINE, "Waiting for occurence of event type "
 					+ type + " succeeded!");
 
 			// log exiting and return result
-			this.logger.exiting(this.getClass().getName(),
+			logger.exiting(this.getClass().getName(),
 					"waitForNextOccurence", true);
 			return true;
 
-		} else {
+		}
 
-			// wait for the given time at most
-			long endOfTime = System.currentTimeMillis()
-					+ maximumTimeToWaitInMillis;
-			long timeLeft = 0;
-			while (!this.hasEventOccured(source, type)
-					&& (timeLeft = endOfTime - System.currentTimeMillis()) > 0) {
+		// wait for the given time at most
+		final long endOfTime = System.currentTimeMillis() + maximumTimeToWaitInMillis;
+		long timeLeft = 0;
+		while (!hasEventOccured(source, type)
+				&& (timeLeft = endOfTime - System.currentTimeMillis()) > 0) {
 
-				this.logger.log(Level.FINEST, "We will wait for " + timeLeft
-						+ " milliseconds for the next occurence of event type "
-						+ type + " from source " + source + "...");
+			logger.log(Level.FINEST, "We will wait for " + timeLeft
+					+ " milliseconds for the next occurence of event type "
+					+ type + " from source " + source + "...");
 
-				try {
-					wait(timeLeft);
-				} catch (InterruptedException e) {
-					// don't handle
-				}
-
-				this.logger.log(Level.FINEST,
-						"We have been notified about an observed event while "
-								+ "waiting for events of type " + type
-								+ " from source " + source
-								+ "; need to check whether the observed event "
-								+ "is what we are looking for...");
+			try {
+				wait(timeLeft);
+			} catch (final InterruptedException e) {
+				// don't handle
 			}
 
-			// determine result
-			boolean result = this.hasEventOccured(source, type);
-
-			this.logger.log(Level.FINE,
-					"Waiting for next occurence of event type " + type
+			logger.log(Level.FINEST,
+					"We have been notified about an observed event while "
+							+ "waiting for events of type " + type
 							+ " from source " + source
-							+ (result ? " succeeded!" : " did not succeed!"));
-
-			// log exiting and return result
-			this.logger.exiting(this.getClass().getName(),
-					"waitForNextOccurence", result);
-			return result;
+							+ "; need to check whether the observed event "
+							+ "is what we are looking for...");
 		}
+
+		// determine result
+		final boolean result = hasEventOccured(source, type);
+
+		logger.log(Level.FINE, "Waiting for next occurence of event type "
+				+ type + " from source " + source
+				+ (result ? " succeeded!" : " did not succeed!"));
+
+		// log exiting and return result
+		logger.exiting(this.getClass().getName(), "waitForNextOccurence",
+				result);
+		return result;
 	}
 
 	/**
 	 * Adds the given <code>source</code> as possible event source.
-	 * 
+	 *
 	 * @param source
 	 *            The name of the node, client, or server to add.
 	 * @throws IllegalArgumentException
 	 *             Thrown if there is already an event source with this name.
 	 */
-	void addEventSource(String source) {
+	void addEventSource(final String source) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "addEventSource",
+		logger.entering(this.getClass().getName(), "addEventSource",
 				source);
 
 		// check if source name is unique in this network
-		if (this.eventSources.contains(source)) {
-			IllegalArgumentException e = new IllegalArgumentException(
-					"There is already an event source with name " + source
-							+ " in this network!");
-			this.logger
+		if (eventSources.contains(source)) {
+			final IllegalArgumentException e =
+					new IllegalArgumentException(
+							"There is already an event source with name "
+									+ source + " in this network!");
+			logger
 					.throwing(this.getClass().getName(), "addEventSource", e);
 			throw e;
 		}
 
 		// add event source name
-		this.eventSources.add(source);
+		eventSources.add(source);
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "addEventSource");
+		logger.exiting(this.getClass().getName(), "addEventSource");
 	}
 
 	@Override

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/HiddenServiceImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/HiddenServiceImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/HiddenServiceImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -12,7 +12,7 @@
 
 /**
  * Implementation of <code>HiddenService</code>.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
@@ -27,30 +27,30 @@
 	/**
 	 * The node at which this hidden service is configured.
 	 */
-	private ProxyNodeImpl node;
+	private final ProxyNodeImpl node;
 
 	/**
 	 * Name of the hidden service that will be used as name for the hidden
 	 * service directory.
 	 */
-	private String serviceName;
+	private final String serviceName;
 
 	/**
 	 * The TCP port on which the service will be available for requests.
 	 */
-	private int servicePort;
+	private final int servicePort;
 
 	/**
 	 * The virtual TCP port that this hidden service runs on as it is announced
 	 * to clients.
 	 */
-	private int virtualPort;
+	private final int virtualPort;
 
 	/**
 	 * Adds the entries for a hidden service to the configuration of this node.
-	 * 
+	 *
 	 * Creates a new <code>HiddenServiceImpl</code>.
-	 * 
+	 *
 	 * @param node
 	 *            The node at which this hidden service is configured.
 	 * @param serviceName
@@ -70,8 +70,8 @@
 	 *             Thrown if an invalid value is given for either of the
 	 *             parameters.
 	 */
-	HiddenServiceImpl(ProxyNodeImpl node, String serviceName, int servicePort,
-			int virtualPort) {
+	HiddenServiceImpl(final ProxyNodeImpl node, final String serviceName, final int servicePort,
+			final int virtualPort) {
 
 		// check if networkName can be used as logger name
 		if (serviceName == null || serviceName.length() == 0) {
@@ -80,20 +80,19 @@
 		}
 
 		// create logger
-		this.logger = Logger.getLogger("hidserv." + serviceName);
+		logger = Logger.getLogger("hidserv." + serviceName);
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "HiddenServiceImpl",
+		logger.entering(this.getClass().getName(), "HiddenServiceImpl",
 				new Object[] { node, serviceName, servicePort, virtualPort });
 
 		// check parameters
-		if (serviceName == null || serviceName.length() == 0 || servicePort < 0
-				|| servicePort > 65535 || virtualPort < 0
+		if (servicePort < 0 || servicePort > 65535 || virtualPort < 0
 				|| virtualPort > 65535) {
-			this.logger.log(Level.SEVERE,
+			logger.log(Level.SEVERE,
 					"Illegal argument when adding hidden service!");
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(), "addHiddenService",
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(), "addHiddenService",
 					e);
 			throw e;
 		}
@@ -105,30 +104,29 @@
 		this.virtualPort = virtualPort;
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "HiddenServiceImpl");
+		logger.exiting(this.getClass().getName(), "HiddenServiceImpl");
 	}
 
 	public String determineOnionAddress() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "getOnionAddress");
+		logger.entering(this.getClass().getName(), "getOnionAddress");
 
 		// check if hidden service directory exists
-		File hiddenServiceFile = new File(this.node.getWorkingDir()
-				.getAbsolutePath()
-				+ File.separator
-				+ this.serviceName
-				+ File.separator
-				+ "hostname");
+		final File hiddenServiceFile =
+				new File(node.getWorkingDir().getAbsolutePath()
+						+ File.separator + serviceName + File.separator
+						+ "hostname");
 		if (!hiddenServiceFile.exists()) {
-			this.logger.log(Level.SEVERE,
+			logger.log(Level.SEVERE,
 					"Hidden service directory or hostname file does not exist: "
 							+ hiddenServiceFile.getAbsolutePath());
 
-			PuppeTorException e = new PuppeTorException(
-					"Hidden service directory or hostname file does not exist: "
-							+ hiddenServiceFile.getAbsolutePath());
-			this.logger.throwing(this.getClass().getName(), "getOnionAddress",
+			final PuppeTorException e =
+					new PuppeTorException(
+							"Hidden service directory or hostname file does not exist: "
+									+ hiddenServiceFile.getAbsolutePath());
+			logger.throwing(this.getClass().getName(), "getOnionAddress",
 					e);
 			throw e;
 		}
@@ -136,20 +134,20 @@
 		// read hostname from file
 		String address = null;
 		try {
-			BufferedReader br = new BufferedReader(new FileReader(
-					hiddenServiceFile));
+			final BufferedReader br =
+					new BufferedReader(new FileReader(hiddenServiceFile));
 			address = br.readLine();
 			br.close();
-		} catch (IOException e) {
-			PuppeTorException ex = new PuppeTorException(
-					"Could not read hostname file!", e);
-			this.logger.throwing(this.getClass().getName(), "getOnionAddress",
+		} catch (final IOException e) {
+			final PuppeTorException ex =
+					new PuppeTorException("Could not read hostname file!", e);
+			logger.throwing(this.getClass().getName(), "getOnionAddress",
 					ex);
 			throw ex;
 		}
 
 		// log exiting and return address
-		this.logger.exiting(this.getClass().getName(), "getOnionAddress",
+		logger.exiting(this.getClass().getName(), "getOnionAddress",
 				address);
 		return address;
 	}

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -56,7 +56,7 @@
 
 /**
  * Implementation of <code>Network</code>.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
@@ -76,12 +76,12 @@
 		 * The maximum time to wait for the Tor process to start in
 		 * milliseconds.
 		 */
-		private long maximumTimeToWaitInMillis;
+		private final long maximumTimeToWaitInMillis;
 
 		/**
 		 * The node for which the Tor process shall be started.
 		 */
-		private ProxyNode node;
+		private final ProxyNode node;
 
 		/**
 		 * Flag that denotes whether starting the Tor process was successful.
@@ -92,14 +92,14 @@
 		 * Creates a new <code>NodeStarter</code> for node <code>node</code>
 		 * that will wait for <code>maximumTimeToWaitInMillis</code>
 		 * milliseconds to start a Tor process, but that is not started, yet.
-		 * 
+		 *
 		 * @param node
 		 *            The node for which the Tor process shall be started.
 		 * @param maximumTimeToWaitInMillis
 		 *            The maximum time to wait for the Tor process to start in
 		 *            milliseconds.
 		 */
-		NodeStarter(ProxyNode node, long maximumTimeToWaitInMillis) {
+		NodeStarter(final ProxyNode node, final long maximumTimeToWaitInMillis) {
 
 			// log entering
 			logger.entering(this.getClass().getName(), "NodeStarter",
@@ -121,13 +121,13 @@
 
 			try {
 				// try to start node
-				this.success = this.node
-						.startNode(this.maximumTimeToWaitInMillis);
-			} catch (PuppeTorException e) {
+				success =
+						node.startNode(maximumTimeToWaitInMillis);
+			} catch (final PuppeTorException e) {
 				logger.log(Level.SEVERE,
 						"Caught an exception while starting node "
 								+ node.toString() + "!");
-				this.caughtException = e;
+				caughtException = e;
 			}
 
 			// log exiting
@@ -138,30 +138,30 @@
 	/**
 	 * Event manager to which all events concerning this network are notified.
 	 */
-	private EventManagerImpl eventManager;
+	private final EventManagerImpl eventManager;
 
 	/**
 	 * Logger for this network which is called "network." plus the name of this
 	 * network.
 	 */
-	private Logger logger;
+	private final Logger logger;
 
 	/**
 	 * Contains the name of this network configuration which is the String
 	 * conversion of System.currentTimeMillis() of the network creation time.
 	 */
-	private String networkName;
+	private final String networkName;
 
 	/**
 	 * All nodes contained in this network.
 	 */
-	private Map<String, ProxyNode> nodes;
+	private final Map<String, ProxyNode> nodes;
 
 	/**
 	 * Directory that contains status information of all nodes contained in this
 	 * network.
 	 */
-	private File workingDir;
+	private final File workingDir;
 
 	/**
 	 * The counter for automatically assigned port numbers created by this
@@ -172,7 +172,7 @@
 	/**
 	 * Creates an initially unpopulated Tor network and creates a new working
 	 * directory for it at test-env/randomTestID/.
-	 * 
+	 *
 	 * @param networkName
 	 *            Name of this network configuration. May neither be
 	 *            <code>null</code> or a zero-length string.
@@ -185,7 +185,7 @@
 	 *             <code>null</code> or a zero-length string, or if an illegal
 	 *             number is given for <code>startPort</code>.
 	 */
-	public NetworkImpl(String networkName, int startPort) {
+	public NetworkImpl(final String networkName, final int startPort) {
 		// initialize using overloaded constructor
 		this(networkName);
 
@@ -196,16 +196,16 @@
 		}
 
 		// remember parameter
-		this.portCounter = startPort;
+		portCounter = startPort;
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "NetworkImpl");
+		logger.exiting(this.getClass().getName(), "NetworkImpl");
 	}
 
 	/**
 	 * Creates an initially unpopulated Tor network and creates a new working
 	 * directory for it at test-env/randomTestID/.
-	 * 
+	 *
 	 * @param networkName
 	 *            Name of this network configuration. May neither be
 	 *            <code>null</code> or a zero-length string.
@@ -213,7 +213,7 @@
 	 *             Thrown if the given <code>networkName</code> is either
 	 *             <code>null</code> or a zero-length string.
 	 */
-	public NetworkImpl(String networkName) {
+	public NetworkImpl(final String networkName) {
 
 		// check if networkName can be used as logger name
 		if (networkName == null || networkName.length() == 0) {
@@ -222,71 +222,71 @@
 		}
 
 		// create logger
-		this.logger = Logger.getLogger("network." + networkName);
+		logger = Logger.getLogger("network." + networkName);
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "NetworkImpl",
+		logger.entering(this.getClass().getName(), "NetworkImpl",
 				networkName);
 
 		// TODO is this necessary?!
-		this.logger.setLevel(Level.ALL);
+		logger.setLevel(Level.ALL);
 
 		// remember parameter
 		this.networkName = networkName;
 
 		// create working directory
-		this.workingDir = new File("test-env/" + System.currentTimeMillis());
-		this.workingDir.mkdirs();
-		this.logger.log(Level.FINE, "Created working directory \""
-				+ this.workingDir.getAbsolutePath() + "\"");
+		workingDir = new File("test-env/" + System.currentTimeMillis());
+		workingDir.mkdirs();
+		logger.log(Level.FINE, "Created working directory \""
+				+ workingDir.getAbsolutePath() + "\"");
 
 		// TODO if we want to log to file, set this... somehow...
 		// this.logFile = new File(this.workingDir.getAbsolutePath()
 		// + "\\events.log");
 
 		// initialize data structures
-		this.nodes = new HashMap<String, ProxyNode>();
+		nodes = new HashMap<String, ProxyNode>();
 
 		// create event manager
-		this.eventManager = new EventManagerImpl(this.networkName);
+		eventManager = new EventManagerImpl(this.networkName);
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "NetworkImpl");
+		logger.exiting(this.getClass().getName(), "NetworkImpl");
 	}
 
 	/**
 	 * Returns whether all nodes in this network are up, or not.
-	 * 
+	 *
 	 * @return <code>true</code> if all nodes are up, <code>false</code> if
 	 *         at least one node is not up.
 	 */
 	private boolean allNodesUp() {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "allNodesUp");
+		logger.entering(this.getClass().getName(), "allNodesUp");
 
 		// fail on first node that is not up
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (!eventManager.hasEventOccured(node.getNodeName(),
 					NodeEventType.NODE_CIRCUIT_OPENED)) {
 
 				// log exiting and return false
-				this.logger.exiting(this.getClass().getName(), "allNodesUp");
+				logger.exiting(this.getClass().getName(), "allNodesUp");
 				return false;
 			}
 		}
 
 		// log exiting and return true
-		this.logger.exiting(this.getClass().getName(), "allNodesUp");
+		logger.exiting(this.getClass().getName(), "allNodesUp");
 		return true;
 	}
 
 	public void configureAsPrivateNetwork() throws PuppeTorException {
 		// log entering
-		this.logger.entering(this.getClass().getName(),
+		logger.entering(this.getClass().getName(),
 				"configureAsPrivateNetwork");
 
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (node.getNodeState() == NodeState.CONFIGURING) {
 				// add to configuration
 				node.addConfiguration("TestingTorNetwork 1");
@@ -294,17 +294,18 @@
 		}
 
 		// read DirServer strings for all directories
-		List<String> authorizedDirectoriesFingerprints = new ArrayList<String>();
-		for (ProxyNode node : this.nodes.values()) {
+		final List<String> authorizedDirectoriesFingerprints =
+				new ArrayList<String>();
+		for (final ProxyNode node : nodes.values()) {
 			if (node instanceof DirectoryNode) {
-				DirectoryNode dirNode = (DirectoryNode) node;
+				final DirectoryNode dirNode = (DirectoryNode) node;
 				authorizedDirectoriesFingerprints.add(dirNode
 						.getDirServerString());
 			}
 		}
 
 		// configure nodes
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (node.getNodeState() == NodeState.CONFIGURING) {
 
 				// add to configuration
@@ -313,10 +314,10 @@
 		}
 
 		// read fingerprints for all directories and routers
-		HashSet<String> approvedRoutersFingerprints = new HashSet<String>();
-		for (ProxyNode node : this.nodes.values()) {
+		final HashSet<String> approvedRoutersFingerprints = new HashSet<String>();
+		for (final ProxyNode node : nodes.values()) {
 			if (node instanceof RouterNode) {
-				RouterNode routerOrDirNode = (RouterNode) node;
+				final RouterNode routerOrDirNode = (RouterNode) node;
 				approvedRoutersFingerprints.add(routerOrDirNode
 						.getFingerprint());
 			}
@@ -324,275 +325,286 @@
 
 		// write fingerprints for all directories and routers to the
 		// approved-routers file
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (node instanceof DirectoryNode) {
-				DirectoryNode dirNode = (DirectoryNode) node;
+				final DirectoryNode dirNode = (DirectoryNode) node;
 				dirNode.addApprovedRouters(approvedRoutersFingerprints);
 			}
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(),
+		logger.exiting(this.getClass().getName(),
 				"configureAsPrivateNetwork");
 	}
 
-	public ClientApplication createClient(String clientApplicationName,
-			String targetAddress, int targetPort, int socksPort) {
+	public ClientApplication createClient(final String clientApplicationName,
+			final String targetAddress, final int targetPort, final int socksPort) {
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createClient",
+		logger.entering(this.getClass().getName(), "createClient",
 				new Object[] { clientApplicationName, targetAddress,
 						targetPort, socksPort });
 
 		// create client; parameter checking is done in constructor
-		ClientApplicationImpl client = new ClientApplicationImpl(this,
-				clientApplicationName, targetAddress, targetPort, socksPort);
+		final ClientApplicationImpl client =
+				new ClientApplicationImpl(this, clientApplicationName,
+						targetAddress, targetPort, socksPort);
 
 		// add name to event manager as event source
-		this.eventManager.addEventSource(clientApplicationName);
+		eventManager.addEventSource(clientApplicationName);
 
 		// log exiting and return client
-		this.logger.exiting(this.getClass().getName(), "createClient", client);
+		logger.exiting(this.getClass().getName(), "createClient", client);
 		return client;
 	}
 
-	public DirectoryNode createDirectory(String nodeName, int controlPort,
-			int socksPort, int orPort, int dirPort, String serverIpAddress) {
+	public DirectoryNode createDirectory(final String nodeName, final int controlPort,
+			final int socksPort, final int orPort, final int dirPort, final String serverIpAddress) {
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createDirectory",
+		logger.entering(this.getClass().getName(), "createDirectory",
 				new Object[] { nodeName, controlPort, socksPort, orPort,
 						dirPort, serverIpAddress });
 
 		// create directory node; parameter checking is done in constructor
-		DirectoryNode dir = new DirectoryNodeImpl(this, nodeName, controlPort,
-				socksPort, orPort, dirPort, serverIpAddress);
+		final DirectoryNode dir =
+				new DirectoryNodeImpl(this, nodeName, controlPort, socksPort,
+						orPort, dirPort, serverIpAddress);
 
 		// add new directory node to nodes collection
-		this.nodes.put(nodeName, dir);
+		nodes.put(nodeName, dir);
 
 		// add name to event manager as event source
-		this.eventManager.addEventSource(nodeName);
+		eventManager.addEventSource(nodeName);
 
 		// log exiting and return directory node
-		this.logger.exiting(this.getClass().getName(), "createDirectory", dir);
+		logger.exiting(this.getClass().getName(), "createDirectory", dir);
 		return dir;
 	}
 
-	public DirectoryNode createDirectory(String nodeName, int controlPort,
-			int socksPort, int orPort, int dirPort) {
+	public DirectoryNode createDirectory(final String nodeName, final int controlPort,
+			final int socksPort, final int orPort, final int dirPort) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createDirectory",
+		logger.entering(this.getClass().getName(), "createDirectory",
 				new Object[] { nodeName, controlPort, socksPort, orPort,
 						dirPort });
 
 		// invoke overloaded method
-		DirectoryNode dir = this.createDirectory(nodeName, controlPort,
-				socksPort, orPort, dirPort, "127.0.0.1");
+		final DirectoryNode dir =
+				this.createDirectory(nodeName, controlPort, socksPort, orPort,
+						dirPort, "127.0.0.1");
 
 		// log exiting and return directory node
-		this.logger.exiting(this.getClass().getName(), "createDirectory", dir);
+		logger.exiting(this.getClass().getName(), "createDirectory", dir);
 		return dir;
 	}
 
-	public DirectoryNode createDirectory(String nodeName, String serverIpAddress) {
+	public DirectoryNode createDirectory(final String nodeName, final String serverIpAddress) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createDirectory",
+		logger.entering(this.getClass().getName(), "createDirectory",
 				new Object[] { nodeName, serverIpAddress });
 
 		// invoke overloaded method
-		DirectoryNode dir = this.createDirectory(nodeName, this.portCounter++,
-				this.portCounter++, this.portCounter++, this.portCounter++,
-				serverIpAddress);
+		final DirectoryNode dir =
+				this.createDirectory(nodeName, portCounter++,
+						portCounter++, portCounter++,
+						portCounter++, serverIpAddress);
 
 		// log exiting and return directory node
-		this.logger.exiting(this.getClass().getName(), "createDirectory", dir);
+		logger.exiting(this.getClass().getName(), "createDirectory", dir);
 		return dir;
 	}
 
-	public DirectoryNode createDirectory(String nodeName) {
+	public DirectoryNode createDirectory(final String nodeName) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createDirectory",
+		logger.entering(this.getClass().getName(), "createDirectory",
 				nodeName);
 
 		// invoke overloaded method
-		DirectoryNode dir = this.createDirectory(nodeName, this.portCounter++,
-				this.portCounter++, this.portCounter++, this.portCounter++,
-				"127.0.0.1");
+		final DirectoryNode dir =
+				this.createDirectory(nodeName, portCounter++,
+						portCounter++, portCounter++,
+						portCounter++, "127.0.0.1");
 
 		// log exiting and return directory node
-		this.logger.exiting(this.getClass().getName(), "createDirectory", dir);
+		logger.exiting(this.getClass().getName(), "createDirectory", dir);
 		return dir;
 	}
 
-	public ProxyNode createProxy(String nodeName, int controlPort, int socksPort) {
+	public ProxyNode createProxy(final String nodeName, final int controlPort, final int socksPort) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createProxy",
+		logger.entering(this.getClass().getName(), "createProxy",
 				new Object[] { nodeName, controlPort, socksPort });
 
 		// create proxy node; parameter checking is done in constructor
-		ProxyNode proxy = new ProxyNodeImpl(this, nodeName, controlPort,
-				socksPort);
+		final ProxyNode proxy =
+				new ProxyNodeImpl(this, nodeName, controlPort, socksPort);
 
 		// add new proxy node to nodes collection
-		this.nodes.put(nodeName, proxy);
+		nodes.put(nodeName, proxy);
 
 		// add name to event manager as event source
-		this.eventManager.addEventSource(nodeName);
+		eventManager.addEventSource(nodeName);
 
 		// log exiting and return proxy node
-		this.logger.exiting(this.getClass().getName(), "createProxy", proxy);
+		logger.exiting(this.getClass().getName(), "createProxy", proxy);
 		return proxy;
 	}
 
-	public ProxyNode createProxy(String nodeName) {
+	public ProxyNode createProxy(final String nodeName) {
 
 		// log entering
-		this.logger
+		logger
 				.entering(this.getClass().getName(), "createProxy", nodeName);
 
 		// invoke overloaded method
-		ProxyNode proxy = this.createProxy(nodeName, this.portCounter++,
-				this.portCounter++);
+		final ProxyNode proxy =
+				this.createProxy(nodeName, portCounter++,
+						portCounter++);
 
 		// log exiting and return proxy node
-		this.logger.exiting(this.getClass().getName(), "createProxy", proxy);
+		logger.exiting(this.getClass().getName(), "createProxy", proxy);
 		return proxy;
 	}
 
-	public RouterNode createRouter(String nodeName, int controlPort,
-			int socksPort, int orPort, int dirPort, String serverIpAddress) {
+	public RouterNode createRouter(final String nodeName, final int controlPort,
+			final int socksPort, final int orPort, final int dirPort, final String serverIpAddress) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createRouter",
+		logger.entering(this.getClass().getName(), "createRouter",
 				new Object[] { nodeName, controlPort, socksPort, orPort,
 						dirPort, serverIpAddress });
 
 		// create router node; parameter checking is done in constructor
-		RouterNode router = new RouterNodeImpl(this, nodeName, controlPort,
-				socksPort, orPort, dirPort, serverIpAddress);
+		final RouterNode router =
+				new RouterNodeImpl(this, nodeName, controlPort, socksPort,
+						orPort, dirPort, serverIpAddress);
 
 		// add new router node to nodes collection
-		this.nodes.put(nodeName, router);
+		nodes.put(nodeName, router);
 
 		// add name to event manager as event source
-		this.eventManager.addEventSource(nodeName);
+		eventManager.addEventSource(nodeName);
 
 		// log exiting and return router node
-		this.logger.exiting(this.getClass().getName(), "createRouter", router);
+		logger.exiting(this.getClass().getName(), "createRouter", router);
 		return router;
 	}
 
-	public RouterNode createRouter(String nodeName, int controlPort,
-			int socksPort, int orPort, int dirPort) {
+	public RouterNode createRouter(final String nodeName, final int controlPort,
+			final int socksPort, final int orPort, final int dirPort) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createRouter",
+		logger.entering(this.getClass().getName(), "createRouter",
 				new Object[] { nodeName, controlPort, socksPort, orPort,
 						dirPort });
 
 		// invoke overloaded method
-		DirectoryNode dir = this.createDirectory(nodeName, controlPort,
-				socksPort, orPort, dirPort, "127.0.0.1");
+		final DirectoryNode dir =
+				this.createDirectory(nodeName, controlPort, socksPort, orPort,
+						dirPort, "127.0.0.1");
 
 		// log exiting and return directory node
-		this.logger.exiting(this.getClass().getName(), "createRouter", dir);
+		logger.exiting(this.getClass().getName(), "createRouter", dir);
 		return dir;
 	}
 
-	public RouterNode createRouter(String nodeName, String serverIpAddress) {
+	public RouterNode createRouter(final String nodeName, final String serverIpAddress) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createRouter",
+		logger.entering(this.getClass().getName(), "createRouter",
 				new Object[] { nodeName, serverIpAddress });
 
 		// invoke overloaded method
-		RouterNode dir = this.createRouter(nodeName, this.portCounter++,
-				this.portCounter++, this.portCounter++, this.portCounter++,
-				serverIpAddress);
+		final RouterNode dir =
+				this.createRouter(nodeName, portCounter++,
+						portCounter++, portCounter++,
+						portCounter++, serverIpAddress);
 
 		// log exiting and return directory node
-		this.logger.exiting(this.getClass().getName(), "createRouter", dir);
+		logger.exiting(this.getClass().getName(), "createRouter", dir);
 		return dir;
 	}
 
-	public RouterNode createRouter(String nodeName) {
+	public RouterNode createRouter(final String nodeName) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createRouter",
+		logger.entering(this.getClass().getName(), "createRouter",
 				nodeName);
 
 		// invoke overloaded method
-		RouterNode router = this.createRouter(nodeName, this.portCounter++,
-				this.portCounter++, this.portCounter++, this.portCounter++,
-				"127.0.0.1");
+		final RouterNode router =
+				this.createRouter(nodeName, portCounter++,
+						portCounter++, portCounter++,
+						portCounter++, "127.0.0.1");
 
 		// log exiting and return router node
-		this.logger.exiting(this.getClass().getName(), "createRouter", router);
+		logger.exiting(this.getClass().getName(), "createRouter", router);
 		return router;
 	}
 
-	public ServerApplication createServer(String serverApplicationName,
-			int serverPort) {
+	public ServerApplication createServer(final String serverApplicationName,
+			final int serverPort) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createServer",
+		logger.entering(this.getClass().getName(), "createServer",
 				new Object[] { serverApplicationName, serverPort });
 
 		// create server; parameter checking is done in constructor
-		ServerApplicationImpl server = new ServerApplicationImpl(this,
-				serverApplicationName, serverPort);
+		final ServerApplicationImpl server =
+				new ServerApplicationImpl(this, serverApplicationName,
+						serverPort);
 
 		// add name to event manager as event source
-		this.eventManager.addEventSource(serverApplicationName);
+		eventManager.addEventSource(serverApplicationName);
 
 		// log exiting and return server
-		this.logger.exiting(this.getClass().getName(), "createServer", server);
+		logger.exiting(this.getClass().getName(), "createServer", server);
 		return server;
 	}
 
-	public ServerApplication createServer(String serverApplicationName) {
+	public ServerApplication createServer(final String serverApplicationName) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "createServer",
+		logger.entering(this.getClass().getName(), "createServer",
 				serverApplicationName);
 
 		// invoke overloaded method
-		ServerApplication server = this.createServer(serverApplicationName,
-				this.portCounter++);
+		final ServerApplication server =
+				this.createServer(serverApplicationName, portCounter++);
 
 		// log exiting and return server
-		this.logger.exiting(this.getClass().getName(), "createServer", server);
+		logger.exiting(this.getClass().getName(), "createServer", server);
 		return server;
 	}
 
 	public EventManager getEventManager() {
-		return this.eventManager;
+		return eventManager;
 	}
 
 	/**
 	 * Returns the implementation instance of the event manager of this network.
-	 * 
+	 *
 	 * @return The implementation instance of the event manager of this network.
 	 */
 	EventManagerImpl getEventManagerImpl() {
-		return this.eventManager;
+		return eventManager;
 	}
 
 	public File getWorkingDirectory() {
-		return this.workingDir;
+		return workingDir;
 	}
 
-	public ProxyNode getNode(String nodeName) {
-		return this.nodes.get(nodeName);
+	public ProxyNode getNode(final String nodeName) {
+		return nodes.get(nodeName);
 	}
 
 	public Map<String, ProxyNode> getAllProxyNodes() {
-		Map<String, ProxyNode> result = new HashMap<String, ProxyNode>();
-		for (String nodeName : this.nodes.keySet()) {
-			ProxyNode node = this.nodes.get(nodeName);
+		final Map<String, ProxyNode> result = new HashMap<String, ProxyNode>();
+		for (final String nodeName : nodes.keySet()) {
+			final ProxyNode node = nodes.get(nodeName);
 			if (!(node instanceof RouterNode)) {
 				result.put(nodeName, node);
 			}
@@ -601,9 +613,9 @@
 	}
 
 	public Map<String, RouterNode> getAllRouterNodes() {
-		Map<String, RouterNode> result = new HashMap<String, RouterNode>();
-		for (String nodeName : this.nodes.keySet()) {
-			ProxyNode node = this.nodes.get(nodeName);
+		final Map<String, RouterNode> result = new HashMap<String, RouterNode>();
+		for (final String nodeName : nodes.keySet()) {
+			final ProxyNode node = nodes.get(nodeName);
 			if (node instanceof RouterNode && !(node instanceof DirectoryNode)) {
 				result.put(nodeName, (RouterNode) node);
 			}
@@ -612,9 +624,10 @@
 	}
 
 	public Map<String, DirectoryNode> getAllDirectoryNodes() {
-		Map<String, DirectoryNode> result = new HashMap<String, DirectoryNode>();
-		for (String nodeName : this.nodes.keySet()) {
-			ProxyNode node = this.nodes.get(nodeName);
+		final Map<String, DirectoryNode> result =
+				new HashMap<String, DirectoryNode>();
+		for (final String nodeName : nodes.keySet()) {
+			final ProxyNode node = nodes.get(nodeName);
 			if (node instanceof DirectoryNode) {
 				result.put(nodeName, (DirectoryNode) node);
 			}
@@ -626,20 +639,21 @@
 		return new HashMap<String, ProxyNode>(nodes);
 	}
 
-	public boolean hupUntilUp(int tries, long hupInterval)
+	public boolean hupUntilUp(final int tries, final long hupInterval)
 			throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "hupUntilUp",
+		logger.entering(this.getClass().getName(), "hupUntilUp",
 				new Object[] { tries, hupInterval });
 
 		// check if all nodes are running
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (node.getNodeState() != NodeState.RUNNING) {
-				IllegalStateException e = new IllegalStateException(
-						"All nodes must be running before sending them HUP "
-								+ "commands!");
-				this.logger
+				final IllegalStateException e =
+						new IllegalStateException(
+								"All nodes must be running before sending them HUP "
+										+ "commands!");
+				logger
 						.throwing(this.getClass().getName(), "hupUntilUp", e);
 				throw e;
 			}
@@ -649,16 +663,16 @@
 		if (allNodesUp()) {
 
 			// log exiting and return true
-			this.logger.exiting(this.getClass().getName(), "hupUntilUp", true);
+			logger.exiting(this.getClass().getName(), "hupUntilUp", true);
 			return true;
 		}
 
 		// create and register a new event handler for each node
 		final Thread sleepingThread = Thread.currentThread();
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			eventManager.addEventListener(node.getNodeName(),
 					new EventListener() {
-						public void handleEvent(Event event) {
+						public void handleEvent(final Event event) {
 							if (event.getType() == NodeEventType.NODE_CIRCUIT_OPENED) {
 								sleepingThread.interrupt();
 								eventManager.removeEventListener(this);
@@ -671,7 +685,7 @@
 		for (int i = 0; i < tries; i++) {
 
 			// determine how long to sleep
-			long endOfSleeping = System.currentTimeMillis() + hupInterval;
+			final long endOfSleeping = System.currentTimeMillis() + hupInterval;
 			long now;
 
 			// unless all nodes have reported to be up, wait for the given
@@ -681,7 +695,7 @@
 				// sleep
 				try {
 					Thread.sleep(endOfSleeping - now);
-				} catch (InterruptedException e) {
+				} catch (final InterruptedException e) {
 					// do nothing about it
 				}
 
@@ -689,16 +703,16 @@
 				if (allNodesUp()) {
 
 					// log exiting and return true
-					this.logger.exiting(this.getClass().getName(),
+					logger.exiting(this.getClass().getName(),
 							"hupUntilUp", true);
 					return true;
 				}
 			}
 
-			this.logger.log(Level.FINE, "Sending HUP to nodes");
+			logger.log(Level.FINE, "Sending HUP to nodes");
 			// send a HUP signal to all nodes
-			for (ProxyNode node : this.nodes.values()) {
-				this.logger.log(Level.FINE, "Sending HUP to node "
+			for (final ProxyNode node : nodes.values()) {
+				logger.log(Level.FINE, "Sending HUP to node "
 						+ node.toString());
 				node.hup();
 			}
@@ -708,61 +722,63 @@
 
 		// no retries left and not all nodes are up; log exiting and return
 		// failure
-		this.logger.exiting(this.getClass().getName(), "hupUntilUp", false);
+		logger.exiting(this.getClass().getName(), "hupUntilUp", false);
 		return false;
 	}
 
 	public void hupAllNodes() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "hupAllNodes");
+		logger.entering(this.getClass().getName(), "hupAllNodes");
 
 		// check if all nodes are running
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (node.getNodeState() != NodeState.RUNNING) {
-				IllegalStateException e = new IllegalStateException(
-						"All nodes must be running before sending them HUP "
-								+ "commands!");
-				this.logger.throwing(this.getClass().getName(), "hupAllNodes",
+				final IllegalStateException e =
+						new IllegalStateException(
+								"All nodes must be running before sending them HUP "
+										+ "commands!");
+				logger.throwing(this.getClass().getName(), "hupAllNodes",
 						e);
 				throw e;
 			}
 		}
 
 		// send a HUP signal to all nodes
-		for (ProxyNode node : this.nodes.values()) {
-			this.logger.log(Level.FINE, "Sending HUP to node "
+		for (final ProxyNode node : nodes.values()) {
+			logger.log(Level.FINE, "Sending HUP to node "
 					+ node.toString());
 			node.hup();
 		}
 
 		// no retries left and not all nodes are up; log exiting and return
 		// failure
-		this.logger.exiting(this.getClass().getName(), "hupAllNodes");
+		logger.exiting(this.getClass().getName(), "hupAllNodes");
 	}
 
 	public void hupAllDirectories() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "hupAllDirectories");
+		logger.entering(this.getClass().getName(), "hupAllDirectories");
 
 		// check if all directory nodes are running
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (node instanceof DirectoryNode
 					&& node.getNodeState() != NodeState.RUNNING) {
-				IllegalStateException e = new IllegalStateException(
-						"All directory nodes must be running before sending "
-								+ "them HUP commands!");
-				this.logger.throwing(this.getClass().getName(),
+				final IllegalStateException e =
+						new IllegalStateException(
+								"All directory nodes must be running before sending "
+										+ "them HUP commands!");
+				logger.throwing(this.getClass().getName(),
 						"hupAllDirectories", e);
 				throw e;
 			}
 		}
 
 		// send a HUP signal to all nodes
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (node instanceof DirectoryNode) {
-				this.logger.log(Level.FINE, "Sending HUP to node "
+				logger.log(Level.FINE, "Sending HUP to node "
 						+ node.toString());
 				node.hup();
 			}
@@ -770,23 +786,23 @@
 
 		// no retries left and not all nodes are up; log exiting and return
 		// failure
-		this.logger.exiting(this.getClass().getName(), "hupAllDirectories");
+		logger.exiting(this.getClass().getName(), "hupAllDirectories");
 	}
 
 	public void shutdownNodes() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "shutdownNodes");
+		logger.entering(this.getClass().getName(), "shutdownNodes");
 
 		// iteratively shut down all running nodes; if an exception is caught,
 		// continue shutting down the other nodes and throw the first exception
 		// subsequently
 		PuppeTorException firstCaughtException = null;
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (node.getNodeState() == NodeState.RUNNING) {
 				try {
 					node.shutdown();
-				} catch (PuppeTorException e) {
+				} catch (final PuppeTorException e) {
 					if (firstCaughtException == null) {
 						firstCaughtException = e;
 					}
@@ -797,29 +813,30 @@
 		// if an exception was caught during shutting down nodes, throw the
 		// first caught exception
 		if (firstCaughtException != null) {
-			this.logger.throwing(this.getClass().getName(), "shutdownNodes",
+			logger.throwing(this.getClass().getName(), "shutdownNodes",
 					firstCaughtException);
 			throw firstCaughtException;
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "shutdownNodes");
+		logger.exiting(this.getClass().getName(), "shutdownNodes");
 	}
 
-	public boolean startNodes(long maximumTimeToWaitInMillis)
+	public boolean startNodes(final long maximumTimeToWaitInMillis)
 			throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "startNodes",
+		logger.entering(this.getClass().getName(), "startNodes",
 				maximumTimeToWaitInMillis);
 
 		// check node states
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			if (node.getNodeState() != NodeState.CONFIGURATION_WRITTEN) {
-				IllegalStateException e = new IllegalStateException(
-						"All configurations must be written before starting "
-								+ "nodes!");
-				this.logger
+				final IllegalStateException e =
+						new IllegalStateException(
+								"All configurations must be written before starting "
+										+ "nodes!");
+				logger
 						.throwing(this.getClass().getName(), "startNodes", e);
 				throw e;
 			}
@@ -827,102 +844,102 @@
 
 		// check parameter
 		if (maximumTimeToWaitInMillis < 0) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(), "startNodes", e);
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(), "startNodes", e);
 			throw e;
 		}
 
 		// remember time when we begin starting the nodes
-		long before = System.currentTimeMillis();
+		final long before = System.currentTimeMillis();
 
 		// start nodes in parallel
-		Set<NodeStarter> allNodeStarters = new HashSet<NodeStarter>();
-		for (ProxyNode node : this.nodes.values()) {
-			NodeStarter nodeStarter = new NodeStarter(node,
-					maximumTimeToWaitInMillis);
+		final Set<NodeStarter> allNodeStarters = new HashSet<NodeStarter>();
+		for (final ProxyNode node : nodes.values()) {
+			final NodeStarter nodeStarter =
+					new NodeStarter(node, maximumTimeToWaitInMillis);
 			allNodeStarters.add(nodeStarter);
 			nodeStarter.start();
 		}
 
 		// wait for all node starts to complete
-		for (NodeStarter nodeStarter : allNodeStarters) {
+		for (final NodeStarter nodeStarter : allNodeStarters) {
 
 			// join node starts one after the other
 			try {
 				nodeStarter.join();
-			} catch (InterruptedException e) {
+			} catch (final InterruptedException e) {
 				// this happens?! we have some kind of problem here!
-				this.logger.log(Level.WARNING,
+				logger.log(Level.WARNING,
 						"Interrupt while joining node starter!");
 
 				// log exiting and return false
-				this.logger.exiting(this.getClass().getName(), "startNodes",
+				logger.exiting(this.getClass().getName(), "startNodes",
 						false);
 				return false;
 			}
 
 			// if any thread has caught an exception, throw that exception now
-			Exception caughtException = nodeStarter.caughtException;
+			final Exception caughtException = nodeStarter.caughtException;
 			if (caughtException != null) {
-				PuppeTorException ex = new PuppeTorException(
-						"Exception while starting node "
+				final PuppeTorException ex =
+						new PuppeTorException("Exception while starting node "
 								+ nodeStarter.node.getNodeName(),
-						caughtException);
-				this.logger.throwing(this.getClass().getName(), "startNodes",
+								caughtException);
+				logger.throwing(this.getClass().getName(), "startNodes",
 						ex);
 				throw ex;
 			}
 
 			// if node start did not succeed in the given time, fail
 			if (!nodeStarter.success) {
-				this.logger.log(Level.WARNING,
+				logger.log(Level.WARNING,
 						"Starting nodes was not successful in "
-								+ (maximumTimeToWaitInMillis / 1000)
-								+ " seconds.", this.networkName);
+								+ maximumTimeToWaitInMillis / 1000
+								+ " seconds.", networkName);
 
 				// log exiting and return false
-				this.logger.exiting(this.getClass().getName(), "startNodes",
+				logger.exiting(this.getClass().getName(), "startNodes",
 						false);
 				return false;
 			}
 		}
 
 		// determine how long we took to start all nodes
-		long after = System.currentTimeMillis();
-		this.logger.log(Level.FINE, "Starting nodes was successful and took "
-				+ ((after - before) / 1000) + " seconds.", this.networkName);
+		final long after = System.currentTimeMillis();
+		logger.log(Level.FINE, "Starting nodes was successful and took "
+				+ (after - before) / 1000 + " seconds.", networkName);
 
 		// log exiting and return true
-		this.logger.exiting(this.getClass().getName(), "startNodes", true);
+		logger.exiting(this.getClass().getName(), "startNodes", true);
 		return true;
 	}
 
 	@Override
 	public String toString() {
 		return this.getClass().getSimpleName() + ": networkName=\""
-				+ this.networkName;
+				+ networkName;
 	}
 
 	public String getNetworkName() {
-		return this.networkName;
+		return networkName;
 	}
 
 	public void writeConfigurations() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "writeConfigurations");
+		logger.entering(this.getClass().getName(), "writeConfigurations");
 
 		// write configurations for all nodes
-		for (ProxyNode node : this.nodes.values()) {
+		for (final ProxyNode node : nodes.values()) {
 			node.writeConfiguration();
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "writeConfigurations");
+		logger.exiting(this.getClass().getName(), "writeConfigurations");
 	}
 
-	public void addTemplateConfiguration(Class<? extends ProxyNode> nodeClass,
-			String templateConfigurationString) {
+	public void addTemplateConfiguration(final Class<? extends ProxyNode> nodeClass,
+			final String templateConfigurationString) {
 
 		// log entering
 		logger.entering(this.getClass().getName(), "addTemplateConfiguration",
@@ -932,8 +949,8 @@
 		if (nodeClass == null || templateConfigurationString == null
 				|| templateConfigurationString.length() < 1
 				|| !templateConfigurationString.contains(" ")) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"addTemplateConfiguration", e);
 			throw e;
 		}
@@ -949,8 +966,8 @@
 			DirectoryNodeImpl.templateConfiguration
 					.add(templateConfigurationString);
 		} else {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"addTemplateConfiguration", e);
 			throw e;
 		}
@@ -960,7 +977,7 @@
 	}
 
 	public List<String> getTemplateConfiguration(
-			Class<? extends ProxyNode> nodeClass) {
+			final Class<? extends ProxyNode> nodeClass) {
 
 		// log entering
 		logger.entering(this.getClass().getName(), "getTemplateConfiguration",
@@ -968,8 +985,8 @@
 
 		// check parameter
 		if (nodeClass == null) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"getTemplateConfiguration", e);
 			throw e;
 		}
@@ -979,13 +996,15 @@
 		if (nodeClass == ProxyNode.class) {
 			result = new ArrayList<String>(ProxyNodeImpl.templateConfiguration);
 		} else if (nodeClass == RouterNode.class) {
-			result = new ArrayList<String>(RouterNodeImpl.templateConfiguration);
+			result =
+					new ArrayList<String>(RouterNodeImpl.templateConfiguration);
 		} else if (nodeClass == DirectoryNode.class) {
-			result = new ArrayList<String>(
-					DirectoryNodeImpl.templateConfiguration);
+			result =
+					new ArrayList<String>(
+							DirectoryNodeImpl.templateConfiguration);
 		} else {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"getTemplateConfiguration", e);
 			throw e;
 		}
@@ -997,8 +1016,8 @@
 	}
 
 	public void removeTemplateConfiguration(
-			Class<? extends ProxyNode> nodeClass,
-			String templateConfigurationKey) {
+			final Class<? extends ProxyNode> nodeClass,
+			final String templateConfigurationKey) {
 
 		// log entering
 		logger.entering(this.getClass().getName(),
@@ -1008,8 +1027,8 @@
 		// check parameters
 		if (nodeClass == null || templateConfigurationKey == null
 				|| templateConfigurationKey.length() < 1) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"removeTemplateConfiguration", e);
 			throw e;
 		}
@@ -1023,18 +1042,19 @@
 		} else if (nodeClass == DirectoryNode.class) {
 			templateConfig = DirectoryNodeImpl.templateConfiguration;
 		} else {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"removeTemplateConfiguration", e);
 			throw e;
 		}
 
 		// iterate over existing template configuration strings and remove all
 		// configuration strings that have the given configuration key
-		List<String> configurationStringsToRemove = new ArrayList<String>();
-		for (String currentConfigurationString : templateConfig) {
-			String currentConfigurationKey = currentConfigurationString
-					.substring(0, currentConfigurationString.indexOf(" "));
+		final List<String> configurationStringsToRemove = new ArrayList<String>();
+		for (final String currentConfigurationString : templateConfig) {
+			final String currentConfigurationKey =
+					currentConfigurationString.substring(0,
+							currentConfigurationString.indexOf(" "));
 			if (currentConfigurationKey.equals(templateConfigurationKey)) {
 				configurationStringsToRemove.add(currentConfigurationString);
 			}
@@ -1049,10 +1069,10 @@
 
 	/**
 	 * Returns the current port number and increments it afterwards.
-	 * 
+	 *
 	 * @return The current port number.
 	 */
 	int getNextPortNumber() {
-		return this.portCounter++;
+		return portCounter++;
 	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ProxyNodeImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ProxyNodeImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ProxyNodeImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -41,6 +41,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -53,7 +54,7 @@
 
 /**
  * Implementation of <code>ProxyNode</code>.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
@@ -61,7 +62,7 @@
 
 	/**
 	 * Executable file containing Tor.
-	 * 
+	 *
 	 * TODO make this configurable!
 	 */
 	protected static final File torExecutable = new File("tor");
@@ -90,7 +91,7 @@
 	/**
 	 * Event manager to which all events concerning this node are notified.
 	 */
-	private EventManagerImpl eventManager;
+	private final EventManagerImpl eventManager;
 
 	/**
 	 * Logger for this node which is called "node." plus the name of this node.
@@ -131,18 +132,18 @@
 
 	/**
 	 * Returns this node's working directory.
-	 * 
+	 *
 	 * @return This node's working directory.
 	 */
 	File getWorkingDir() {
-		return this.workingDir;
+		return workingDir;
 	}
 
 	/**
 	 * Creates a new <code>ProxyNodeImpl</code> and adds it to the given
 	 * <code>network</code>, but does not yet write its configuration to disk
 	 * or start the corresponding Tor process.
-	 * 
+	 *
 	 * @param network
 	 *            Network configuration to which this node belongs.
 	 * @param nodeName
@@ -159,32 +160,32 @@
 	 *             If at least one of the parameters is <code>null</code> or
 	 *             has an invalid value.
 	 */
-	ProxyNodeImpl(NetworkImpl network, String nodeName, int controlPort,
-			int socksPort) {
+	ProxyNodeImpl(final NetworkImpl network, final String nodeName, final int controlPort,
+			final int socksPort) {
 
 		// make sure that nodeName is a valid logger name
 		if (nodeName == null || nodeName.length() < 1 || nodeName.length() > 19
 				|| !nodeName.matches("[a-zA-Z0-9]*")) {
-			String reason = "\"" + nodeName + "\" is not a valid node name!";
-			IllegalArgumentException e = new IllegalArgumentException(reason);
+			final String reason = "\"" + nodeName + "\" is not a valid node name!";
+			final IllegalArgumentException e = new IllegalArgumentException(reason);
 			throw e;
 		}
 
 		// create logger
-		this.logger = Logger.getLogger(nodeName + "."
-				+ this.getClass().getName());
+		logger =
+				Logger.getLogger(nodeName + "." + this.getClass().getName());
 
-		this.logger.setLevel(Level.ALL);
+		logger.setLevel(Level.ALL);
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "ProxyNodeImpl",
+		logger.entering(this.getClass().getName(), "ProxyNodeImpl",
 				new Object[] { network, nodeName, controlPort, socksPort });
 
 		// check remaining parameters
 		if (network == null || controlPort < 0 || controlPort > 65535
 				|| socksPort < 0 || socksPort > 65535) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(), "ProxyNodeImpl", e);
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(), "ProxyNodeImpl", e);
 			throw e;
 		}
 
@@ -195,106 +196,109 @@
 		this.socksPort = socksPort;
 
 		// obtain reference on event manager from network
-		this.eventManager = network.getEventManagerImpl();
+		eventManager = network.getEventManagerImpl();
 
 		// create working directory
-		this.workingDir = new File(this.network.getWorkingDirectory()
-				.getAbsolutePath()
-				+ File.separator + nodeName + File.separator);
-		this.workingDir.mkdirs();
-		this.logger.log(Level.FINE, "Created working directory \""
-				+ this.workingDir.getAbsolutePath() + "\"");
+		workingDir =
+				new File(this.network.getWorkingDirectory().getAbsolutePath()
+						+ File.separator + nodeName + File.separator);
+		workingDir.mkdirs();
+		logger.log(Level.FINE, "Created working directory \""
+				+ workingDir.getAbsolutePath() + "\"");
 
 		// create reference on config file
-		this.configFile = new File(this.workingDir.getAbsolutePath()
-				+ File.separator + "torrc");
+		configFile =
+				new File(workingDir.getAbsolutePath() + File.separator
+						+ "torrc");
 
 		// initialize configuration
-		this.configuration = new ArrayList<String>(templateConfiguration);
-		this.configuration.add("ControlPort " + controlPort);
-		this.configuration.add("SocksPort " + socksPort);
+		configuration = new ArrayList<String>(templateConfiguration);
+		configuration.add("ControlPort " + controlPort);
+		configuration.add("SocksPort " + socksPort);
 
 		// initialize state
-		this.nodeState = NodeState.CONFIGURING;
+		nodeState = NodeState.CONFIGURING;
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "ProxyNodeImpl");
+		logger.exiting(this.getClass().getName(), "ProxyNodeImpl");
 	}
 
-	public void addConfiguration(String configurationString) {
+	public void addConfiguration(final String configurationString) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "addConfiguration",
+		logger.entering(this.getClass().getName(), "addConfiguration",
 				configurationString);
 
 		// check parameter
 		if (configurationString == null || configurationString.length() < 1
 				|| !configurationString.contains(" ")) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(), "addConfiguration",
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(), "addConfiguration",
 					e);
 			throw e;
 		}
 
 		// add configuration string
-		this.configuration.add(configurationString);
+		configuration.add(configurationString);
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "addConfiguration");
+		logger.exiting(this.getClass().getName(), "addConfiguration");
 	}
 
-	public void addConfigurations(List<String> configurationStrings) {
+	public void addConfigurations(final List<String> configurationStrings) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "addConfigurations",
+		logger.entering(this.getClass().getName(), "addConfigurations",
 				configurationStrings);
 
 		// check parameter
 		if (configurationStrings == null) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"addConfigurations", e);
 			throw e;
 		}
 
 		// add configuration strings one by one
-		for (String conf : configurationStrings) {
-			this.addConfiguration(conf);
+		for (final String conf : configurationStrings) {
+			addConfiguration(conf);
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "addConfigurations");
+		logger.exiting(this.getClass().getName(), "addConfigurations");
 	}
 
-	public void replaceConfiguration(String configurationString) {
+	public void replaceConfiguration(final String configurationString) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "replaceConfiguration",
+		logger.entering(this.getClass().getName(), "replaceConfiguration",
 				configurationString);
 
 		// check parameter
 		if (configurationString == null || configurationString.length() < 1
 				|| !configurationString.contains(" ")) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"replaceConfiguration", e);
 			throw e;
 		}
 
 		// extract configuration key
-		String configurationKey = configurationString.substring(0,
-				configurationString.indexOf(" "));
+		final String configurationKey =
+				configurationString.substring(0, configurationString
+						.indexOf(" "));
 
 		// iterate over existing configuration strings and replace the first
 		// occurrence of configuration key with new configuration string
-		Iterator<String> it = this.configuration.listIterator();
+		final Iterator<String> it = configuration.listIterator();
 		boolean replaced = false;
 		for (int counter = 0; !replaced && it.hasNext(); counter++) {
-			String currentConfigurationString = it.next();
-			String currentConfigurationKey = currentConfigurationString
-					.substring(0, currentConfigurationString.indexOf(" "));
+			final String currentConfigurationString = it.next();
+			final String currentConfigurationKey =
+					currentConfigurationString.substring(0,
+							currentConfigurationString.indexOf(" "));
 			if (currentConfigurationKey.equals(configurationKey)) {
-				this.configuration.set(counter, configurationString);
+				configuration.set(counter, configurationString);
 				replaced = true;
 			}
 		}
@@ -302,153 +306,159 @@
 		// if no such configuration key was found, append the configuration
 		// string
 		if (!replaced) {
-			this.configuration.add(configurationString);
+			configuration.add(configurationString);
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "replaceConfiguration");
+		logger.exiting(this.getClass().getName(), "replaceConfiguration");
 	}
 
-	public void removeConfiguration(String configurationKey) {
+	public void removeConfiguration(final String configurationKey) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "deleteConfiguration",
+		logger.entering(this.getClass().getName(), "deleteConfiguration",
 				configurationKey);
 
 		// check parameter
 		if (configurationKey == null || configurationKey.length() < 1) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"deleteConfiguration", e);
 			throw e;
 		}
 
 		// iterate over existing configuration strings and remove all
 		// configuration strings that have the given configuration key
-		List<String> configurationStringsToRemove = new ArrayList<String>();
-		for (String currentConfigurationString : this.configuration) {
-			String currentConfigurationKey = currentConfigurationString
-					.substring(0, currentConfigurationString.indexOf(" "));
+		final List<String> configurationStringsToRemove = new ArrayList<String>();
+		for (final String currentConfigurationString : configuration) {
+			final String currentConfigurationKey =
+					currentConfigurationString.substring(0,
+							currentConfigurationString.indexOf(" "));
 			if (currentConfigurationKey.equals(configurationKey)) {
 				configurationStringsToRemove.add(currentConfigurationString);
 			}
 		}
-		this.configuration.removeAll(configurationStringsToRemove);
+		configuration.removeAll(configurationStringsToRemove);
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "deleteConfiguration");
+		logger.exiting(this.getClass().getName(), "deleteConfiguration");
 	}
 
-	public synchronized HiddenService addHiddenService(String serviceName,
-			int servicePort, int virtualPort) {
+	public synchronized HiddenService addHiddenService(final String serviceName,
+			final int servicePort, final int virtualPort) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "addHiddenService",
+		logger.entering(this.getClass().getName(), "addHiddenService",
 				new Object[] { serviceName, servicePort, virtualPort });
 
 		// create hidden service object; parameter checking is done in
 		// constructor
-		HiddenService result = new HiddenServiceImpl(this, serviceName,
-				servicePort, virtualPort);
+		final HiddenService result =
+				new HiddenServiceImpl(this, serviceName, servicePort,
+						virtualPort);
 
 		// add hidden service using Tor controller
-		this.configuration.add("HiddenServiceDir "
+		configuration.add("HiddenServiceDir "
 				+ workingDir.getAbsolutePath() + File.separator + serviceName
 				+ "\nHiddenServicePort " + virtualPort + " 127.0.0.1:"
 				+ servicePort);
 
 		// log exiting and return hidden service object
-		this.logger.exiting(this.getClass().getName(), "addHiddenService",
+		logger.exiting(this.getClass().getName(), "addHiddenService",
 				result);
 		return result;
 	}
 
-	public synchronized HiddenService addHiddenService(String serviceName,
-			int servicePort) {
+	public synchronized HiddenService addHiddenService(final String serviceName,
+			final int servicePort) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "addHiddenService",
+		logger.entering(this.getClass().getName(), "addHiddenService",
 				new Object[] { serviceName, servicePort });
 
 		// invoke overloaded method
-		HiddenService result = this.addHiddenService(serviceName, servicePort,
-				80);
+		final HiddenService result =
+				this.addHiddenService(serviceName, servicePort, 80);
 
 		// log exiting and return hidden service
-		this.logger.exiting(this.getClass().getName(), "addHiddenService",
+		logger.exiting(this.getClass().getName(), "addHiddenService",
 				result);
 		return result;
 	}
 
-	public synchronized HiddenService addHiddenService(String serviceName) {
+	public synchronized HiddenService addHiddenService(final String serviceName) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "addHiddenService",
+		logger.entering(this.getClass().getName(), "addHiddenService",
 				serviceName);
 
 		// invoke overloaded method
-		HiddenService result = this.addHiddenService(serviceName, this.network
-				.getNextPortNumber(), 80);
+		final HiddenService result =
+				this.addHiddenService(serviceName, network
+						.getNextPortNumber(), 80);
 
 		// log exiting and return hidden service
-		this.logger.exiting(this.getClass().getName(), "addHiddenService",
+		logger.exiting(this.getClass().getName(), "addHiddenService",
 				result);
 		return result;
 	}
 
 	public String getNodeName() {
-		return this.nodeName;
+		return nodeName;
 	}
 
 	public synchronized NodeState getNodeState() {
-		return this.nodeState;
+		return nodeState;
 	}
 
 	public synchronized void hup() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "hup");
+		logger.entering(this.getClass().getName(), "hup");
 
 		// check state
-		if (this.nodeState != NodeState.RUNNING || this.conn == null) {
-			IllegalStateException e = new IllegalStateException(
-					"Cannot hup a process when it's not running or there is "
-							+ "no connection to its control port!");
-			this.logger.throwing(this.getClass().getName(), "hup", e);
+		if (nodeState != NodeState.RUNNING || conn == null) {
+			final IllegalStateException e =
+					new IllegalStateException(
+							"Cannot hup a process when it's not running or there is "
+									+ "no connection to its control port!");
+			logger.throwing(this.getClass().getName(), "hup", e);
 			throw e;
 		}
 
 		// send HUP signal to Tor process
 		try {
-			this.conn.signal("HUP");
-		} catch (IOException e) {
-			PuppeTorException ex = new PuppeTorException(
-					"Could not send the command HUP to the Tor process!", e);
-			this.logger.throwing(this.getClass().getName(), "hup", ex);
+			conn.signal("HUP");
+		} catch (final IOException e) {
+			final PuppeTorException ex =
+					new PuppeTorException(
+							"Could not send the command HUP to the Tor process!",
+							e);
+			logger.throwing(this.getClass().getName(), "hup", ex);
 			throw ex;
-		} catch (NullPointerException e) {
+		} catch (final NullPointerException e) {
 			// TODO sometimes, this throws a NullPointerException...
-			this.logger.log(Level.SEVERE, "is conn null? "
-					+ (this.conn == null));
-			this.logger.log(Level.SEVERE,
+			logger.log(Level.SEVERE, "is conn null? "
+					+ (conn == null));
+			logger.log(Level.SEVERE,
 					"NullPointerException while sending HUP signal to node "
-							+ this.toString());
+							+ toString());
 			throw e;
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "hup");
+		logger.exiting(this.getClass().getName(), "hup");
 	}
 
 	public synchronized void shutdown() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "shutdown");
+		logger.entering(this.getClass().getName(), "shutdown");
 
 		// check state
-		if (this.nodeState != NodeState.RUNNING) {
-			IllegalStateException e = new IllegalStateException();
-			this.logger.throwing(this.getClass().getName(), "shutdown", e);
+		if (nodeState != NodeState.RUNNING) {
+			final IllegalStateException e = new IllegalStateException();
+			logger.throwing(this.getClass().getName(), "shutdown", e);
 			throw e;
 		}
 
@@ -456,24 +466,25 @@
 		// controller connection to it which would interpret a closed socket as
 		// failure and throw a RuntimeException
 		try {
-			this.conn.shutdownTor("SHUTDOWN");
-			this.conn.shutdownTor("SHUTDOWN");
-		} catch (IOException e) {
-			PuppeTorException ex = new PuppeTorException(
-					"Could not send shutdown command to Tor process!", e);
-			this.logger.throwing(this.getClass().getName(), "shutdown", ex);
+			conn.shutdownTor("SHUTDOWN");
+			conn.shutdownTor("SHUTDOWN");
+		} catch (final IOException e) {
+			final PuppeTorException ex =
+					new PuppeTorException(
+							"Could not send shutdown command to Tor process!",
+							e);
+			logger.throwing(this.getClass().getName(), "shutdown", ex);
 			throw ex;
 		}
 
 		// change state
-		this.nodeState = NodeState.SHUT_DOWN;
+		nodeState = NodeState.SHUT_DOWN;
 
 		// fire event
-		eventManager.observeInternalEvent(System.currentTimeMillis(), this
-				.getNodeName(), NodeEventType.NODE_STOPPED, "Node stopped.");
+		eventManager.observeInternalEvent(System.currentTimeMillis(), getNodeName(), NodeEventType.NODE_STOPPED, "Node stopped.");
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "shutdown");
+		logger.exiting(this.getClass().getName(), "shutdown");
 	}
 
 	/**
@@ -482,91 +493,93 @@
 	 * either the process terminates cleanly within this timeout, or does not
 	 * terminate, the exit value will be 0; otherwise it will contain the exit
 	 * code of the terminated process. This functionality is added, because it
-	 * is not provided by Process.
-	 * This class is not threadsafe.
+	 * is not provided by Process. XXX Some stuff in here looks still dodgy.
+	 * What happens if we get an InterruptedException in run and thus don't set
+	 * exitValue?-SH
 	 */
-	private class ProcessWaiter extends Thread {
+	private static class ProcessWaiter extends Thread {
 
 		/** The process to wait for. */
-		private Process process;
+		private final Process process;
 
 		/** The exit value or 0 if the process is still running. */
-		private int exitValue;
+		private final AtomicInteger exitValue;
 
 		/**
 		 * Creates a new <code>ProcessWaiter</code> for process
 		 * <code>process</code>, but does not start it, yet.
-		 * 
+		 *
 		 * @param process
 		 *            The process to wait for.
 		 */
-		ProcessWaiter(Process process) {
+		ProcessWaiter(final Process process) {
 			this.process = process;
+			exitValue = new AtomicInteger(0);
 		}
 
 		@Override
 		public void run() {
 			try {
-				this.exitValue = process.waitFor();
-			} catch (InterruptedException e) {
-			}
+				exitValue.set(process.waitFor());
+			} catch (final InterruptedException e) {}
 		}
 
 		/**
 		 * Causes the current thread to wait until the process has terminated or
 		 * the <code>timeoutInMillis</code> has expired. This method returns
 		 * immediately if the subprocess has already terminated.
-		 * 
+		 *
 		 * @param timeoutInMillis
 		 *            The maximum time to wait for the process to terminate.
 		 * @return The exit value of the terminated process or 0 if the process
 		 *         is still running.
 		 */
-		public int waitFor(long timeoutInMillis) {
+		public int waitFor(final long timeoutInMillis) {
 			try {
 				sleep(timeoutInMillis);
-			} catch (InterruptedException e) {
-			}
-			this.interrupt();
-			return this.exitValue;
+			} catch (final InterruptedException e) {}
+			interrupt();
+			return exitValue.get();
 		}
 	}
 
-	public synchronized boolean startNode(long maximumTimeToWaitInMillis)
+	public synchronized boolean startNode(final long maximumTimeToWaitInMillis)
 			throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "startNode",
+		logger.entering(this.getClass().getName(), "startNode",
 				maximumTimeToWaitInMillis);
 
 		// check state
-		if (this.nodeState != NodeState.CONFIGURATION_WRITTEN) {
-			String reason = "Node is not in state "
-					+ "NodeState.CONFIGURATION_WRITTEN!";
-			IllegalStateException e = new IllegalStateException(reason);
-			this.logger.throwing(this.getClass().getName(), "startNode", e);
+		if (nodeState != NodeState.CONFIGURATION_WRITTEN) {
+			final String reason =
+					"Node is not in state "
+							+ "NodeState.CONFIGURATION_WRITTEN!";
+			final IllegalStateException e = new IllegalStateException(reason);
+			logger.throwing(this.getClass().getName(), "startNode", e);
 			throw e;
 		}
 
 		// start process
-		ProcessBuilder processBuilder = new ProcessBuilder(torExecutable
-				.getPath(), "-f", "torrc");
-		processBuilder.directory(this.workingDir);
+		final ProcessBuilder processBuilder =
+				new ProcessBuilder(torExecutable.getPath(), "-f", "torrc");
+		processBuilder.directory(workingDir);
 		processBuilder.redirectErrorStream(true);
 		try {
-			this.torProcess = processBuilder.start();
-			this.logger.log(Level.FINE, "Started Tor process successfully!");
-		} catch (IOException e) {
-			String reason = "Could not start Tor process!";
-			PuppeTorException ex = new PuppeTorException(reason, e);
-			this.logger.throwing(this.getClass().getName(), "startNode", ex);
+			torProcess = processBuilder.start();
+			logger.log(Level.FINE, "Started Tor process successfully!");
+		} catch (final IOException e) {
+			final String reason = "Could not start Tor process!";
+			final PuppeTorException ex = new PuppeTorException(reason, e);
+			logger.throwing(this.getClass().getName(), "startNode", ex);
 			throw ex;
 		}
 
 		// start thread to parse output
-		final BufferedReader br = new BufferedReader(new InputStreamReader(
-				this.torProcess.getInputStream()));
-		Thread outputThread = new Thread() {
+		final BufferedReader br =
+				new BufferedReader(new InputStreamReader(torProcess
+						.getInputStream()));
+		final Thread outputThread = new Thread() {
 			@Override
 			public void run() {
 
@@ -585,10 +598,11 @@
 					// only print out a warning for this exception if this node
 					// is running; otherwise, silently ignore it...
 					if (nodeState == NodeState.RUNNING) {
-						String reason = "IOException when reading output from Tor "
-								+ "process "
-								+ ProxyNodeImpl.this.getNodeName()
-								+ "!";
+						String reason =
+								"IOException when reading output from Tor "
+										+ "process "
+										+ ProxyNodeImpl.this.getNodeName()
+										+ "!";
 						logger.log(Level.WARNING, reason, e);
 					}
 				}
@@ -598,12 +612,12 @@
 			}
 		};
 		outputThread.setDaemon(true);
-		outputThread.setName(this.nodeName + " Output Parser");
+		outputThread.setName(nodeName + " Output Parser");
 		outputThread.start();
-		this.logger.log(Level.FINE, "Started thread to parse output!");
+		logger.log(Level.FINE, "Started thread to parse output!");
 
 		// add shutdown hook that kills the process on JVM exit
-		final Process p = this.torProcess;
+		final Process p = torProcess;
 		Runtime.getRuntime().addShutdownHook(new Thread() {
 			@Override
 			public void run() {
@@ -618,122 +632,123 @@
 				logger.exiting(this.getClass().getName(), "run");
 			}
 		});
-		this.logger.log(Level.FINER,
+		logger.log(Level.FINER,
 				"Started shutdown hook that will destroy the Tor process on "
 						+ "JVM exit!");
 
 		// wait to see if the process is started or exited immediately; wait for
 		// one second to be sure that Tor terminates if there is an error,
 		// especially if the computer is very busy and many nodes are created
-		ProcessWaiter waiter = new ProcessWaiter(this.torProcess);
+		final ProcessWaiter waiter = new ProcessWaiter(torProcess);
 		waiter.start();
-		int exitValue = waiter.waitFor(1000);
+		final int exitValue = waiter.waitFor(1000);
 		if (exitValue != 0) {
 			// Tor did not manage to start correctly
-			this.logger.log(Level.WARNING, "Could not start Tor process! Tor "
+			logger.log(Level.WARNING, "Could not start Tor process! Tor "
 					+ "exited with exit value " + exitValue
 					+ "! Please go check the config options in "
-					+ this.configFile + " manually!");
+					+ configFile + " manually!");
 
 			// log exiting
-			this.logger.exiting(this.getClass().getName(), "startNode", false);
+			logger.exiting(this.getClass().getName(), "startNode", false);
 			return false;
 		}
 
 		// wait for Tor to open the control port
-		this.logger.log(Level.FINER,
+		logger.log(Level.FINER,
 				"Waiting for Tor to open its control port...");
-		if (!this.eventManager.waitForAnyOccurence(this.nodeName,
+		if (!eventManager.waitForAnyOccurence(nodeName,
 				NodeEventType.NODE_CONTROL_PORT_OPENED,
 				maximumTimeToWaitInMillis)) {
 
 			// Tor did not open its control port
-			this.logger.log(Level.WARNING, "Tor node " + this.nodeName
+			logger.log(Level.WARNING, "Tor node " + nodeName
 					+ " did not manage to open its control port within "
 					+ maximumTimeToWaitInMillis + " milliseconds!");
 
 			// log exiting
-			this.logger.exiting(this.getClass().getName(), "startNode", false);
+			logger.exiting(this.getClass().getName(), "startNode", false);
 			return false;
 		}
-		this.logger.log(Level.FINE,
+		logger.log(Level.FINE,
 				"Tor has successfully opened its control port and told us "
 						+ "about that!");
 
 		// connect to the controller
-		this.logger.log(Level.FINER, "Connecting to control port...");
+		logger.log(Level.FINER, "Connecting to control port...");
 		try {
-			Socket controlSocket = new java.net.Socket("127.0.0.1", controlPort);
-			this.conn = TorControlConnection.getConnection(controlSocket);
-			this.conn.authenticate(new byte[0]);
-		} catch (IOException e) {
-			String reason = "Could not connect to control port " + controlPort
-					+ "!";
-			PuppeTorException ex = new PuppeTorException(reason, e);
-			this.logger.throwing(this.getClass().getName(), "startNode", ex);
+			final Socket controlSocket =
+					new java.net.Socket("127.0.0.1", controlPort);
+			conn = TorControlConnection.getConnection(controlSocket);
+			conn.authenticate(new byte[0]);
+		} catch (final IOException e) {
+			final String reason =
+					"Could not connect to control port " + controlPort + "!";
+			final PuppeTorException ex = new PuppeTorException(reason, e);
+			logger.throwing(this.getClass().getName(), "startNode", ex);
 			throw ex;
 		}
-		this.logger.log(Level.FINE, "Connected to control port successfully!");
+		logger.log(Level.FINE, "Connected to control port successfully!");
 
 		// set state to RUNNING
-		this.nodeState = NodeState.RUNNING;
+		nodeState = NodeState.RUNNING;
 
 		// fire event
-		eventManager.observeInternalEvent(System.currentTimeMillis(), this
-				.getNodeName(), NodeEventType.NODE_STARTED, "Node started.");
+		eventManager.observeInternalEvent(System.currentTimeMillis(), getNodeName(), NodeEventType.NODE_STARTED, "Node started.");
 
 		// log exiting and return with success
-		this.logger.exiting(this.getClass().getName(), "startNode", true);
+		logger.exiting(this.getClass().getName(), "startNode", true);
 		return true;
 	}
 
 	@Override
 	public String toString() {
 		return this.getClass().getSimpleName() + ": nodeName=\""
-				+ this.nodeName + "\", controlPort=" + this.controlPort
-				+ ", socksPort=" + this.socksPort;
+				+ nodeName + "\", controlPort=" + controlPort
+				+ ", socksPort=" + socksPort;
 	}
 
 	public synchronized void writeConfiguration() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "writeConfiguration");
+		logger.entering(this.getClass().getName(), "writeConfiguration");
 
 		// write config file
 		try {
-			BufferedWriter bw = new BufferedWriter(new FileWriter(
-					this.configFile));
-			for (String c : this.configuration) {
+			final BufferedWriter bw =
+					new BufferedWriter(new FileWriter(configFile));
+			for (final String c : configuration) {
 				bw.write(c + "\n");
 			}
 			bw.close();
-		} catch (IOException e) {
-			PuppeTorException ex = new PuppeTorException(
-					"Could not write configuration file!", e);
-			this.logger.throwing(this.getClass().getName(),
+		} catch (final IOException e) {
+			final PuppeTorException ex =
+					new PuppeTorException(
+							"Could not write configuration file!", e);
+			logger.throwing(this.getClass().getName(),
 					"writeConfigurationFile", ex);
 			throw ex;
 		}
 
 		// change state, if necessary
-		if (this.nodeState == NodeState.CONFIGURING) {
-			this.nodeState = NodeState.CONFIGURATION_WRITTEN;
+		if (nodeState == NodeState.CONFIGURING) {
+			nodeState = NodeState.CONFIGURATION_WRITTEN;
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "writeConfiguration");
+		logger.exiting(this.getClass().getName(), "writeConfiguration");
 	}
 
 	public int getSocksPort() {
-		return this.socksPort;
+		return socksPort;
 	}
 
 	public int getControlPort() {
-		return this.controlPort;
+		return controlPort;
 	}
 
 	public List<String> getConfiguration() {
-		return new ArrayList<String>(this.configuration);
+		return new ArrayList<String>(configuration);
 	}
 
 	/**
@@ -752,7 +767,7 @@
 		templateConfiguration.add("Log info file log");
 
 		// TODO This is now contained in proposal 135.
-		//templateConfiguration.add("EnforceDistinctSubnets 0");
-		//templateConfiguration.add("ClientDNSRejectInternalAddresses 0");
+		// templateConfiguration.add("EnforceDistinctSubnets 0");
+		// templateConfiguration.add("ClientDNSRejectInternalAddresses 0");
 	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/RouterNodeImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/RouterNodeImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/RouterNodeImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -47,7 +47,7 @@
 
 /**
  * Implementation of <code>RouterNode</code>.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
@@ -66,52 +66,57 @@
 			logger.entering(this.getClass().getName(), "run");
 
 			// create file reference for temporary config file
-			File tempConfigFile = new File(RouterNodeImpl.this.workingDir
-					.getAbsolutePath()
-					+ File.separator + "torrc.tmp");
+			final File tempConfigFile =
+					new File(workingDir.getAbsolutePath()
+							+ File.separator + "torrc.tmp");
 
 			// compose a modified config file, including a DirServer option with
 			// false fingerprint; this is necessary, because otherwise Tor
 			// would not accept that this router node might have a private IP
 			// address, but connects to the public directory servers
-			List<String> copyOfConfig = new ArrayList<String>(
-					RouterNodeImpl.this.configuration);
-			String fakeDirServerString = "DirServer "
-					+ RouterNodeImpl.this.nodeName + " 127.0.0.1:"
-					+ RouterNodeImpl.this.dirPort
-					+ " 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000";
+			final List<String> copyOfConfig =
+					new ArrayList<String>(configuration);
+			final String fakeDirServerString =
+					"DirServer "
+							+ nodeName
+							+ " 127.0.0.1:"
+							+ dirPort
+							+ " 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000";
 			copyOfConfig.add(fakeDirServerString);
 
 			// write config file
 			try {
-				BufferedWriter bw = new BufferedWriter(new FileWriter(
-						tempConfigFile));
-				for (String c : copyOfConfig) {
+				final BufferedWriter bw =
+						new BufferedWriter(new FileWriter(tempConfigFile));
+				for (final String c : copyOfConfig) {
 					bw.write(c + "\n");
 				}
 				bw.close();
-			} catch (IOException e) {
-				PuppeTorException ex = new PuppeTorException(
-						"Could not write configuration file!", e);
+			} catch (final IOException e) {
+				final PuppeTorException ex =
+						new PuppeTorException(
+								"Could not write configuration file!", e);
 				logger.log(Level.WARNING, "Could not start Tor process!", ex);
-				RouterNodeImpl.this.setCaughtException(ex);
+				setCaughtException(ex);
 				return;
 			}
 
 			// start process with option --list-fingerprint
-			ProcessBuilder processBuilder = new ProcessBuilder(torExecutable
-					.getPath(), "--list-fingerprint", "-f", "torrc.tmp");
-			processBuilder.directory(RouterNodeImpl.this.workingDir);
+			final ProcessBuilder processBuilder =
+					new ProcessBuilder(torExecutable.getPath(),
+							"--list-fingerprint", "-f", "torrc.tmp");
+			processBuilder.directory(workingDir);
 			processBuilder.redirectErrorStream(true);
 			Process tmpProcess = null;
 			try {
 				tmpProcess = processBuilder.start();
-			} catch (IOException e) {
-				PuppeTorException ex = new PuppeTorException(
-						"Could not start Tor process temporarily with "
-								+ "--list-fingerprint option!", e);
+			} catch (final IOException e) {
+				final PuppeTorException ex =
+						new PuppeTorException(
+								"Could not start Tor process temporarily with "
+										+ "--list-fingerprint option!", e);
 				logger.log(Level.WARNING, "Could not start Tor process!", ex);
-				RouterNodeImpl.this.setCaughtException(ex);
+				setCaughtException(ex);
 				return;
 			}
 
@@ -119,42 +124,47 @@
 			int exitValue = 0;
 			try {
 				exitValue = tmpProcess.waitFor();
-			} catch (InterruptedException e) {
-				PuppeTorException ex = new PuppeTorException(
-						"Interrupted while waiting for Tor process to exit!", e);
+			} catch (final InterruptedException e) {
+				final PuppeTorException ex =
+						new PuppeTorException(
+								"Interrupted while waiting for Tor process to exit!",
+								e);
 				logger.log(Level.WARNING,
 						"Temporary Tor process was interrupted!", ex);
-				RouterNodeImpl.this.setCaughtException(ex);
+				setCaughtException(ex);
 				return;
 			}
 
 			if (exitValue != 0) {
-				PuppeTorException ex = new PuppeTorException(
-						"Could not start Tor process temporarily with "
-								+ "--list-fingerprint option! Tor exited with "
-								+ "exit value " + exitValue
-								+ "! Please go check the config options in "
-								+ tempConfigFile + " manually!");
+				final PuppeTorException ex =
+						new PuppeTorException(
+								"Could not start Tor process temporarily with "
+										+ "--list-fingerprint option! Tor exited with "
+										+ "exit value "
+										+ exitValue
+										+ "! Please go check the config options in "
+										+ tempConfigFile + " manually!");
 				logger.log(Level.WARNING, "Could not start Tor process!", ex);
-				RouterNodeImpl.this.setCaughtException(ex);
+				setCaughtException(ex);
 				return;
 			}
 
 			// read fingerprint from file
-			File fingerprintFile = new File(RouterNodeImpl.this.workingDir
-					.getAbsolutePath()
-					+ File.separator + "fingerprint");
+			final File fingerprintFile =
+					new File(workingDir.getAbsolutePath()
+							+ File.separator + "fingerprint");
 			try {
-				BufferedReader br2 = new BufferedReader(new FileReader(
-						fingerprintFile));
-				RouterNodeImpl.this.setFingerprint(br2.readLine());
+				final BufferedReader br2 =
+						new BufferedReader(new FileReader(fingerprintFile));
+				setFingerprint(br2.readLine());
 				br2.close();
-			} catch (IOException e) {
-				PuppeTorException ex = new PuppeTorException(
-						"Could not read fingerprint from file!", e);
+			} catch (final IOException e) {
+				final PuppeTorException ex =
+						new PuppeTorException(
+								"Could not read fingerprint from file!", e);
 				logger.log(Level.WARNING, "Could not read fingerprint file!",
 						ex);
-				RouterNodeImpl.this.setCaughtException(ex);
+				setCaughtException(ex);
 				return;
 			}
 
@@ -168,45 +178,45 @@
 
 	/**
 	 * Invoked by the fingerprint thread: sets the determined fingerprint string
-	 * 
+	 *
 	 * @param fingerprint
 	 *            The determined fingerprint string.
 	 */
-	private synchronized void setFingerprint(String fingerprint) {
+	private synchronized void setFingerprint(final String fingerprint) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "setFingerprint",
+		logger.entering(this.getClass().getName(), "setFingerprint",
 				fingerprint);
 
 		// remember fingerprint and notify all waiting threads
 		this.fingerprint = fingerprint;
-		this.notifyAll();
+		notifyAll();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "setFingerprint");
+		logger.exiting(this.getClass().getName(), "setFingerprint");
 	}
 
 	/**
 	 * Invoked by the fingerprint thread: sets the exception that occurred when
 	 * trying to determine the fingerprint.
-	 * 
+	 *
 	 * @param caughtException
 	 *            The exception that occurred when trying to determine the
 	 *            fingerprint.
 	 */
 	protected synchronized void setCaughtException(
-			PuppeTorException caughtException) {
+			final PuppeTorException caughtException) {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "setCaughtException",
+		logger.entering(this.getClass().getName(), "setCaughtException",
 				caughtException);
 
 		// remember caught exception and notify all waiting threads
 		this.caughtException = caughtException;
-		this.notifyAll();
+		notifyAll();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "setCaughtException");
+		logger.exiting(this.getClass().getName(), "setCaughtException");
 	}
 
 	/**
@@ -237,9 +247,10 @@
 	/**
 	 * The pattern for valid IP v4 addresses in dotted decimal notation.
 	 */
-	private static final Pattern validIpAddressPattern = Pattern
-			.compile("([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
-					+ "(\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){1,3}");
+	private static final Pattern validIpAddressPattern =
+			Pattern
+					.compile("([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
+							+ "(\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){1,3}");
 
 	/**
 	 * Port on which the Tor node will be listening for onion requests by other
@@ -251,7 +262,7 @@
 	 * Creates a new <code>RouterNodeImpl</code> and adds it to the given
 	 * <code>network</code>, but does not yet write its configuration to disk
 	 * or start the corresponding Tor process.
-	 * 
+	 *
 	 * @param network
 	 *            Network configuration to which this node belongs.
 	 * @param nodeName
@@ -280,15 +291,15 @@
 	 *             If at least one of the parameters is <code>null</code> or
 	 *             has an invalid value.
 	 */
-	RouterNodeImpl(NetworkImpl network, String nodeName, int controlPort,
-			int socksPort, int orPort, int dirPort, String serverIpAddress) {
+	RouterNodeImpl(final NetworkImpl network, final String nodeName, final int controlPort,
+			final int socksPort, final int orPort, final int dirPort, final String serverIpAddress) {
 
 		// create superclass instance; parameter checking is done in super
 		// constructor
 		super(network, nodeName, controlPort, socksPort);
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "RouterNodeImpl",
+		logger.entering(this.getClass().getName(), "RouterNodeImpl",
 				new Object[] { network, nodeName, controlPort, socksPort,
 						orPort, dirPort, serverIpAddress });
 
@@ -296,12 +307,13 @@
 		if (orPort < 0 || orPort > 65535 || dirPort < 0 || dirPort > 65535
 				|| serverIpAddress == null
 				|| !validIpAddressPattern.matcher(serverIpAddress).matches()) {
-			IllegalArgumentException e = new IllegalArgumentException(
-					"nodeName=" + nodeName + ", controlPort=" + controlPort
-							+ ", socksPort=" + socksPort + ", orPort="
-							+ orPort + ", dirPort=" + dirPort
-							+ ", serverIpAddress='" + serverIpAddress + "'");
-			this.logger
+			final IllegalArgumentException e =
+					new IllegalArgumentException("nodeName=" + nodeName
+							+ ", controlPort=" + controlPort + ", socksPort="
+							+ socksPort + ", orPort=" + orPort + ", dirPort="
+							+ dirPort + ", serverIpAddress='" + serverIpAddress
+							+ "'");
+			logger
 					.throwing(this.getClass().getName(), "RouterNodeImpl", e);
 			throw e;
 		}
@@ -312,72 +324,72 @@
 		this.serverIpAddress = serverIpAddress;
 
 		// extend configuration by template configuration of router nodes
-		this.configuration.addAll(templateConfiguration);
+		configuration.addAll(templateConfiguration);
 
 		// add further configuration to make this node a router node
-		this.configuration.add("ORPort " + orPort);
-		this.configuration.add("Nickname " + nodeName);
+		configuration.add("ORPort " + orPort);
+		configuration.add("Nickname " + nodeName);
 
 		// all routers mirror the directory
-		this.configuration.add("DirPort " + dirPort);
+		configuration.add("DirPort " + dirPort);
 
 		// the address of this node should be manually specified and not guessed
 		// by Tor
-		this.configuration.add("Address " + serverIpAddress);
+		configuration.add("Address " + serverIpAddress);
 
 		// the OR port may only be contacted locally
-		this.configuration.add("ORListenAddress " + serverIpAddress);
+		configuration.add("ORListenAddress " + serverIpAddress);
 
 		// offer directory only locally (either by being an authority, or by
 		// mirroring it)
-		this.configuration.add("DirListenAddress " + serverIpAddress);
+		configuration.add("DirListenAddress " + serverIpAddress);
 
 		// start a thread to determine the node's fingerprint in the background
-		this.determineFingerprint();
+		determineFingerprint();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "RouterNodeImpl");
+		logger.exiting(this.getClass().getName(), "RouterNodeImpl");
 	}
 
 	public synchronized String getFingerprint() throws PuppeTorException {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "getFingerprint");
+		logger.entering(this.getClass().getName(), "getFingerprint");
 
 		// wait until either the fingerprint has been determined or an exception
 		// was caught
-		while (this.fingerprint == null && this.caughtException == null) {
+		while (fingerprint == null && caughtException == null) {
 			try {
 				wait();
-			} catch (InterruptedException e) {
+			} catch (final InterruptedException e) {
 				// do nothing
 			}
 		}
 
-		if (this.caughtException != null) {
-			this.logger.throwing(this.getClass().getName(), "getFingerprint",
-					this.caughtException);
-			throw this.caughtException;
+		if (caughtException != null) {
+			logger.throwing(this.getClass().getName(), "getFingerprint",
+					caughtException);
+			throw caughtException;
 		}
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "getFingerprint",
-				this.fingerprint);
-		return this.fingerprint;
+		logger.exiting(this.getClass().getName(), "getFingerprint",
+				fingerprint);
+		return fingerprint;
 	}
 
 	@Override
 	public String toString() {
-		return super.toString() + ", orPort=" + this.orPort + ", dirPort="
-				+ this.dirPort;
+		return super.toString() + ", orPort=" + orPort + ", dirPort="
+				+ dirPort;
 	}
 
 	public int getDirPort() {
-		return this.dirPort;
+		return dirPort;
 	}
 
 	public int getOrPort() {
-		return this.orPort;
+		return orPort;
 	}
 
 	/**
@@ -387,15 +399,15 @@
 	protected synchronized void determineFingerprint() {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "determineFingerprint");
+		logger.entering(this.getClass().getName(), "determineFingerprint");
 
 		// start a thread to determine this node's fingerprint
-		FingerprintThread fingerprintThread = new FingerprintThread();
+		final FingerprintThread fingerprintThread = new FingerprintThread();
 		fingerprintThread.setName(nodeName + " Fingerprint Resolver");
 		fingerprintThread.start();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "determineFingerprint");
+		logger.exiting(this.getClass().getName(), "determineFingerprint");
 	}
 
 	/**
@@ -410,8 +422,8 @@
 		templateConfiguration.add("HidServDirectoryV2 1");
 
 		// TODO This is now contained in proposal 135.
-		//templateConfiguration.add("ExitPolicyRejectPrivate 0");
-		//templateConfiguration.add("AssumeReachable 1");
-		//templateConfiguration.add("ServerDNSAllowBrokenResolvConf 1");
+		// templateConfiguration.add("ExitPolicyRejectPrivate 0");
+		// templateConfiguration.add("AssumeReachable 1");
+		// templateConfiguration.add("ServerDNSAllowBrokenResolvConf 1");
 	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ServerApplicationImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ServerApplicationImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/impl/ServerApplicationImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -7,16 +7,16 @@
  *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  *     * Redistributions in binary form must reproduce the above
  * copyright notice, this list of conditions and the following disclaimer
  * in the documentation and/or other materials provided with the
  * distribution.
- * 
+ *
  *     * Neither the names of the copyright owners nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -45,7 +45,7 @@
 
 /**
  * Implementation of <code>ServerApplication</code>.
- * 
+ *
  * @author kloesing
  */
 @SuppressWarnings("serial")
@@ -64,11 +64,11 @@
 		/**
 		 * Creates a new thread to handle the request coming in on
 		 * <code>handleSocket</code>, but does not start handling it.
-		 * 
+		 *
 		 * @param handleSocket
 		 *            Accepted socket on which the request came in.
 		 */
-		public HandlerThread(Socket handleSocket) {
+		public HandlerThread(final Socket handleSocket) {
 
 			// log entering
 			logger.entering(this.getClass().getName(), "HandlerThread",
@@ -90,22 +90,23 @@
 			try {
 
 				// wait for request (don't mind the content)
-				BufferedReader in = new BufferedReader(new InputStreamReader(
-						handleSocket.getInputStream()));
+				final BufferedReader in =
+						new BufferedReader(new InputStreamReader(handleSocket
+								.getInputStream()));
 				in.read();
 
 				// send event to event manager
 				eventManager.observeInternalEvent(System.currentTimeMillis(),
-						ServerApplicationImpl.this.getServerApplicationName(),
+						getServerApplicationName(),
 						ServerEventType.SERVER_RECEIVING_REQUEST_SENDING_REPLY,
 						"Receiving request.");
 
 				// write response
-				PrintStream out = new PrintStream(handleSocket
-						.getOutputStream());
+				final PrintStream out =
+						new PrintStream(handleSocket.getOutputStream());
 				out.print("HTTP/1.0 200 OK\r\n");
 
-			} catch (IOException e) {
+			} catch (final IOException e) {
 				logger.log(Level.SEVERE,
 						"I/O exception while handling incoming request!");
 				// we can't do more, because nobody takes notice of this thread.
@@ -119,7 +120,7 @@
 			// close socket
 			try {
 				handleSocket.close();
-			} catch (IOException e) {
+			} catch (final IOException e) {
 				logger
 						.log(Level.WARNING,
 								"I/O exception while closing socket!");
@@ -155,7 +156,7 @@
 			logger.entering(this.getClass().getName(), "ListenThread");
 
 			// start connected
-			this.connected = true;
+			connected = true;
 
 			// log exiting
 			logger.exiting(this.getClass().getName(), "ListenThread");
@@ -173,7 +174,7 @@
 				ServerSocket serverSocket = null;
 				try {
 					serverSocket = new ServerSocket(serverPort);
-				} catch (IOException ioe) {
+				} catch (final IOException ioe) {
 					logger.log(Level.SEVERE,
 							"Can't open server socket on port " + serverPort
 									+ "!");
@@ -190,7 +191,7 @@
 					Socket incomingConnection = null;
 					try {
 						incomingConnection = serverSocket.accept();
-					} catch (Exception e) {
+					} catch (final Exception e) {
 						logger
 								.log(
 										Level.SEVERE,
@@ -201,14 +202,14 @@
 					new HandlerThread(incomingConnection).start();
 				}
 
-			} catch (Exception e) {
+			} catch (final Exception e) {
 
 				// log that we have been interrupted
 				logger.log(Level.WARNING, "Server has been interrupted!", e);
 			}
 
 			// mark as disconnected
-			this.connected = false;
+			connected = false;
 
 			// log exiting
 			logger.exiting(this.getClass().getName(), "run");
@@ -223,8 +224,8 @@
 			logger.entering(this.getClass().getName(), "stopListening");
 
 			// change connected state to false and interrupt thread
-			this.connected = false;
-			this.interrupt();
+			connected = false;
+			interrupt();
 
 			// log exiting
 			logger.exiting(this.getClass().getName(), "stopListening");
@@ -234,23 +235,23 @@
 	/**
 	 * Event manager that handles all events concerning this server application.
 	 */
-	private EventManagerImpl eventManager;
+	private final EventManagerImpl eventManager;
 
 	/**
 	 * Logger for this server which is called "server." plus the name of this
 	 * server application.
 	 */
-	private Logger logger;
+	private final Logger logger;
 
 	/**
 	 * Name of this server application that is used as logger name of this node.
 	 */
-	private String serverApplicationName;
+	private final String serverApplicationName;
 
 	/**
 	 * Port on which this server will listen for incoming requests.
 	 */
-	private int serverPort;
+	private final int serverPort;
 
 	/**
 	 * Thread that listens for requests in the background.
@@ -260,7 +261,7 @@
 	/**
 	 * Creates a new HTTP server application within this JVM, but does not yet
 	 * listen for incoming requests.
-	 * 
+	 *
 	 * @param network
 	 *            Network to which this HTTP server belongs; at the moment this
 	 *            is only used to determine the event manager instance.
@@ -272,8 +273,8 @@
 	 *             If at least one of the parameters is <code>null</code> or
 	 *             has an invalid value.
 	 */
-	ServerApplicationImpl(NetworkImpl network, String serverApplicationName,
-			int serverPort) {
+	ServerApplicationImpl(final NetworkImpl network, final String serverApplicationName,
+			final int serverPort) {
 
 		// check if serverApplicationName can be used as logger name
 		if (serverApplicationName == null
@@ -283,17 +284,17 @@
 		}
 
 		// create logger
-		this.logger = Logger.getLogger("server." + serverApplicationName);
+		logger = Logger.getLogger("server." + serverApplicationName);
 
 		// log entering
-		this.logger.entering(this.getClass().getName(),
+		logger.entering(this.getClass().getName(),
 				"ServerApplicationImpl", new Object[] { network,
 						serverApplicationName, serverPort });
 
 		// check parameters
 		if (network == null || serverPort < 0 || serverPort > 65535) {
-			IllegalArgumentException e = new IllegalArgumentException();
-			this.logger.throwing(this.getClass().getName(),
+			final IllegalArgumentException e = new IllegalArgumentException();
+			logger.throwing(this.getClass().getName(),
 					"ServerApplicationImpl", e);
 			throw e;
 		}
@@ -303,77 +304,77 @@
 		this.serverPort = serverPort;
 
 		// obtain reference on event manager
-		this.eventManager = network.getEventManagerImpl();
+		eventManager = network.getEventManagerImpl();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "ServerApplicationImpl");
+		logger.exiting(this.getClass().getName(), "ServerApplicationImpl");
 	}
 
 	public synchronized void startListening() {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "listen");
+		logger.entering(this.getClass().getName(), "listen");
 
 		// check if we are already listening
-		if (this.serverThread != null) {
-			IllegalStateException e = new IllegalStateException(
-					"We are already listening!");
-			this.logger.throwing(this.getClass().getName(), "listen", e);
+		if (serverThread != null) {
+			final IllegalStateException e =
+					new IllegalStateException("We are already listening!");
+			logger.throwing(this.getClass().getName(), "listen", e);
 			throw e;
 		}
 
 		// create a thread that listens in the background
-		this.serverThread = new ListenThread();
-		this.serverThread.setName("Reply Thread");
-		this.serverThread.setDaemon(true);
-		this.serverThread.start();
+		serverThread = new ListenThread();
+		serverThread.setName("Reply Thread");
+		serverThread.setDaemon(true);
+		serverThread.start();
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "listen");
+		logger.exiting(this.getClass().getName(), "listen");
 	}
 
 	public synchronized void stopListening() {
 
 		// log entering
-		this.logger.entering(this.getClass().getName(), "stopListening");
+		logger.entering(this.getClass().getName(), "stopListening");
 
 		// check if we are listening
-		if (this.serverThread == null) {
-			IllegalStateException e = new IllegalStateException(
-					"We are not listening!");
-			this.logger.throwing(this.getClass().getName(), "stopListening", e);
+		if (serverThread == null) {
+			final IllegalStateException e =
+					new IllegalStateException("We are not listening!");
+			logger.throwing(this.getClass().getName(), "stopListening", e);
 			throw e;
 		}
 
 		// log this event
-		this.logger.log(Level.FINE, "Shutting down server");
+		logger.log(Level.FINE, "Shutting down server");
 
 		// interrupt thread
-		this.serverThread.interrupt();
+		serverThread.interrupt();
 
 		// unset listening thread
-		this.serverThread = null;
+		serverThread = null;
 
 		// log exiting
-		this.logger.exiting(this.getClass().getName(), "stopListening");
+		logger.exiting(this.getClass().getName(), "stopListening");
 	}
 
 	public synchronized boolean isListening() {
-		return (this.serverThread != null);
+		return serverThread != null;
 	}
 
 	@Override
 	public String toString() {
 		return this.getClass().getSimpleName() + ": serverApplicationName=\""
-				+ this.serverApplicationName + "\", serverPort="
-				+ this.serverPort;
+				+ serverApplicationName + "\", serverPort="
+				+ serverPort;
 	}
 
 	public String getServerApplicationName() {
-		return this.serverApplicationName;
+		return serverApplicationName;
 	}
 
 	public int getServerPort() {
-		return this.serverPort;
+		return serverPort;
 	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/AbstractMasterFactory.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/AbstractMasterFactory.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/AbstractMasterFactory.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -41,47 +41,62 @@
  */
 public abstract class AbstractMasterFactory {
 
-    /**
-     * Hold the concrete RemotePuppeTorFactory that will be used to create the
-     * implementation classes. Use
-     * <code>AbstractMasterFactory.class</code> for locking.
-     */
-    private static AbstractMasterFactory factory;
+	/**
+	 * Hold the concrete RemotePuppeTorFactory that will be used to create the
+	 * implementation classes. Use <code>AbstractMasterFactory.class</code>
+	 * for locking.
+	 */
+	private static AbstractMasterFactory factory;
 
-    /**
-     * @return a new concrete
-     *         <code>AbstractRemotePuppeTorFactory<code>subclass as
-     *     specified by the initialization
-     */
-    final public synchronized static AbstractMasterFactory getInstance() {
-        return factory;
-    }
+	/**
+	 * @return a new concrete
+	 *         <code>AbstractRemotePuppeTorFactory<code>subclass as
+	 *     specified by the initialization
+	 */
+	final public synchronized static AbstractMasterFactory getInstance() {
+		return factory;
+	}
 
-    /**
-     * @param factory
-     *            save this as the factory if this hasn't been called before.
-     */
-    final public synchronized static void initialize(
-            final AbstractMasterFactory factory) {
-        if (AbstractMasterFactory.factory == null) {
-            AbstractMasterFactory.factory = factory;
-        }
-    }
+	/**
+	 * @param factory
+	 *            save this as the factory if this hasn't been called before.
+	 */
+	final public synchronized static void initialize(
+			final AbstractMasterFactory factory) {
+		if (AbstractMasterFactory.factory == null) {
+			AbstractMasterFactory.factory = factory;
+		}
+	}
 
-    /**
-     * Override this to create a subclass of <code>RemotePuppeTor</code>
-     *
-     * @param slave
-     *            Create the server represantation for this connected slave
-     * @return The new <code>RemotePuppeTor</code> instance
-     */
-    public abstract Master createMaster(Slave slave)
-            throws RemoteException;
+	/**
+	 * Override this to create a subclass of <code>RemotePuppeTor</code>
+	 *
+	 * @param slave
+	 *            Create the server represantation for this connected slave
+	 * @return The new <code>RemotePuppeTor</code> instance
+	 */
+	public abstract Master createMaster(Slave slave) throws RemoteException;
 
-    /**
-     * Override this to create a subclass of <code>TestExecutor</code>.
-     *
-     * @return The <code>TestExecutor</code> instance.
-     */
-    public abstract TestExecutor getTestExecutorInstance();
+	/**
+	 * Override this to create a subclass of <code>TestExecutor</code>.
+	 *
+	 * @return The <code>TestExecutor</code> instance.
+	 */
+	public abstract TestExecutor getTestExecutorInstance();
+
+	/**
+	 * Create a new test that uses the public Tor network without additional
+	 * relays. XXX Maybe this should have its own Factory together with a way to
+	 * make network descriptions. This is all the test-writer will use as an
+	 * interface.
+	 */
+	public abstract Test createPublicNetworkTestForClientsOnly(
+			String description);
+
+	/**
+	 * XXX just for now so I don't forget.-SH
+	 */
+	public abstract NetworkDescription createNetworkDescription();
+
+	public abstract Network createNetwork(String name);
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/AbstractSlaveFactory.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/AbstractSlaveFactory.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/AbstractSlaveFactory.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -44,41 +44,75 @@
  */
 public abstract class AbstractSlaveFactory {
 
-    /**
-     * Hold the concrete RemotePuppeTorFactory that will be used to create
-     * <code>Slave</code> instances. Uses
-     * <code>AbstractSlaveFactory.class</code> for locking.
-     */
-    private static AbstractSlaveFactory factory;
+	/**
+	 * Hold the concrete RemotePuppeTorFactory that will be used to create
+	 * <code>Slave</code> instances. Uses
+	 * <code>AbstractSlaveFactory.class</code> for locking.
+	 */
+	private static AbstractSlaveFactory factory;
 
-    /**
-     * @return a new concrete
-     *         <code>AbstractSlaveFactory<code>subclass as
-     *     specified by the initialization
-     */
-    final public synchronized static AbstractSlaveFactory getInstance() {
-        return factory;
-    }
+	/**
+	 * Hold the remote master object. We only have one per slave. XXX Maybe this
+	 * entire thing is more like a SlaveManager, not a factory. Oh well. Rename
+	 * later, I guess -SH
+	 */
+	private static RemoteMaster master;
 
-    /**
-     * @param factory
-     *            save this as the factory if this hasn't been called before.
-     *            XXX - We could throw an exception here, too. I will think
-     *            about that.-SH
-     */
-    final public synchronized static void initialize(
-            final AbstractSlaveFactory factory) {
-        if (AbstractSlaveFactory.factory == null) {
-            AbstractSlaveFactory.factory = factory;
-        }
-    }
+	/**
+	 * @return a new concrete <code>AbstractSlaveFactory<code>subclass as
+	 *     specified by the initialization
+	 */
+	final public synchronized static AbstractSlaveFactory getInstance() {
+		return factory;
+	}
 
-    /**
-     * Override this to create a subclass of <code>Slave</code>
-     *
-     * @return The new <code>Slave</code> instance
-     */
-    public abstract Slave createSlave(final String slaveName,
-            final OS os, final String ip, final Set<Integer> ports,
-            final Set<Integer> availableRevisions) throws NullPointerException;
+	/**
+	 * @param factory
+	 *            save this as the factory if this hasn't been called before.
+	 *            XXX - We could throw an exception here, too. I will think
+	 *            about that.-SH
+	 */
+	final public synchronized static void initialize(
+			final AbstractSlaveFactory factory) {
+		if (AbstractSlaveFactory.factory == null) {
+			AbstractSlaveFactory.factory = factory;
+		}
+	}
+
+	/**
+	 * Register a new master. Note that calling this twice for different master
+	 * doesn't indicate an error, but trying to to set the same master again is
+	 * a bug.
+	 *
+	 * @param master
+	 *            The master that should be used from now on.
+	 */
+	final public synchronized static void setMaster(final RemoteMaster master) {
+		if (AbstractSlaveFactory.master == null) {
+			AbstractSlaveFactory.master = master;
+		} else if (AbstractSlaveFactory.master.equals(master)) {
+			throw new IllegalStateException("This master was already "
+					+ "registered!");
+		}
+	}
+
+	/**
+	 * @return the RemoteMaster currently registered.
+	 */
+	final public synchronized static RemoteMaster getMaster() {
+		if (AbstractSlaveFactory.master == null) {
+			throw new IllegalStateException("No master set yet!");
+		}
+		return AbstractSlaveFactory.master;
+	}
+
+	/**
+	 * Override this to create a subclass of <code>Slave</code>
+	 *
+	 * @return The new <code>Slave</code> instance
+	 */
+	public abstract Slave createSlave(final String slaveName, final OS os,
+			final String ip, final Set<Integer> ports,
+			final Set<Integer> availableRevisions) throws NullPointerException;
+
 }

Deleted: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/CreateNetwork.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/CreateNetwork.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/CreateNetwork.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2008, Sebastian Hahn
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- *     * Neither the names of the copyright owners nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package de.uniba.wiai.lspi.puppetor.rmi;
-
-import java.rmi.RemoteException;
-
-import de.uniba.wiai.lspi.puppetor.ClientApplication;
-import de.uniba.wiai.lspi.puppetor.ClientEventType;
-import de.uniba.wiai.lspi.puppetor.Event;
-import de.uniba.wiai.lspi.puppetor.EventListener;
-import de.uniba.wiai.lspi.puppetor.EventManager;
-import de.uniba.wiai.lspi.puppetor.Network;
-import de.uniba.wiai.lspi.puppetor.NetworkFactory;
-import de.uniba.wiai.lspi.puppetor.ProxyNode;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
-
-public class CreateNetwork implements Test {
-    private static final long serialVersionUID = 1L;
-
-    public Object doJob() throws RemoteException, PuppeTorException {
-        final Network network = NetworkFactory.createNetwork("example1");
-
-        final ProxyNode proxy0 = network.createProxy("proxy0");
-        network.writeConfigurations();
-        if (!network.startNodes(500000)) {
-            System.out.println("Failed to start the node!");
-            return null;
-        }
-        System.out.println("Successfully started the nodes!");
-        if (!network.hupUntilUp(10, 500000)) {
-            System.out.println("Failed to build circuits!");
-            System.exit(0);
-        }
-        System.out.println("Successfully built circuits!");
-        final ClientApplication client =
-                network.createClient("client", "www.google.com", 80, proxy0
-                        .getSocksPort());
-
-        // create event listener to listen for client application events
-        final EventListener clientEventListener = new EventListener() {
-
-            // remember time when request was sent
-            private long before;
-
-            public void handleEvent(Event event) {
-                if (event.getType() == ClientEventType.CLIENT_SENDING_REQUEST) {
-                    before = System.currentTimeMillis();
-                } else if (event.getType() == ClientEventType.CLIENT_REPLY_RECEIVED) {
-                    System.out.println("Request took "
-                            + (System.currentTimeMillis() - before)
-                            + " milliseconds");
-                }
-            }
-        };
-
-        // obtain reference to event manager to be able to respond to events
-        final EventManager manager = network.getEventManager();
-
-        // register event handler for client application events
-        manager.addEventListener(client.getClientApplicationName(),
-                clientEventListener);
-
-        // perform at most three request with a timeout of 20 seconds each
-        client.startRequests(3, 20000, true);
-
-        // block this thread as long as client requests are running
-        manager.waitForAnyOccurence(client.getClientApplicationName(),
-                ClientEventType.CLIENT_REQUESTS_PERFORMED);
-
-        // wait a second before shutting down the proxy
-        try {
-            Thread.sleep(1000);
-        } catch (final InterruptedException e) {
-        }
-
-        // shut down proxy
-        network.shutdownNodes();
-        System.out.println("Goodbye.");
-
-        try {
-            Thread.sleep(1000);
-        } catch (final InterruptedException e) {
-        }
-        return null;
-    }
-}

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/LocalMaster.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/LocalMaster.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/LocalMaster.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -31,21 +31,37 @@
  */
 package de.uniba.wiai.lspi.puppetor.rmi;
 
+import de.uniba.wiai.lspi.puppetor.rmi.impl.AbstractTaskImpl;
+
 /**
  * Represent a connection between the locally running PuppeTor network Master
- * and a slave. This is the master part of the <code>Master</code>
- * interface.
+ * and a slave. This is the master part of the <code>Master</code> interface.
  *
  * @author Sebastian Hahn
  */
 public interface LocalMaster {
-    /**
-     * @return the slave instance this connection refers to.
-     */
-    public Slave getSlave();
+	/**
+	 * @return the slave instance this connection refers to.
+	 */
+	public Slave getSlave();
 
-    /**
-     * Register with the TestExecutor
-     */
-    public void registerWithTestExecutor();
+	/**
+	 * Register with the TestExecutor
+	 */
+	public void registerWithTestExecutor();
+
+	/**
+	 * Add a new AbstractTaskImpl for the connected slave.
+	 *
+	 * @param abstractTaskImpl
+	 */
+	public void addTask(AbstractTaskImpl abstractTaskImpl);
+
+	/**
+	 * @return Get the latest TestResult for this slave.
+	 * @throws InterruptedException
+	 *             if interrupted while waiting for the next TestResult
+	 */
+	public TaskResult getTaskResult() throws InterruptedException;
+
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Master.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Master.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Master.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -33,9 +33,9 @@
 
 /**
  * Any subclass implementing this must also implement <code>RemoteMaster</code>
- * and <code>LocalMaster</code>.
- * XXX This isn't a good way to do it. Think about it more later-SH
- * 
+ * and <code>LocalMaster</code>. XXX This isn't a good way to do it. Think
+ * about it more later-SH & Karsten
+ *
  * @author Sebastian Hahn
  */
 public interface Master {}

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/MasterConnector.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/MasterConnector.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/MasterConnector.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -43,15 +43,15 @@
  */
 public interface MasterConnector extends Remote {
 
-    /**
-     * Called once by every connecting client so that the master knows about it
-     * and has a chance to pass back a representation of itself.
-     *
-     * @param slave
-     *            A slave representation as passed from the connecting slave
-     * @return The representation of the master
-     * @throws RemoteException
-     */
-    public RemoteMaster registerClient(final Slave slave)
-            throws RemoteException;
+	/**
+	 * Called once by every connecting client so that the master knows about it
+	 * and has a chance to pass back a representation of itself.
+	 *
+	 * @param slave
+	 *            A slave representation as passed from the connecting slave
+	 * @return The representation of the master
+	 * @throws RemoteException
+	 */
+	public RemoteMaster registerClient(final Slave slave)
+			throws RemoteException;
 }

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Network.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Network.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Network.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi;
+
+import java.io.Serializable;
+
+public interface Network extends Serializable {
+
+	// XXX Maybe we want to do this in the constructor-SH
+	public void addTorInstanceForMaster(TorInstance torInstance,
+			LocalMaster master);
+
+	public String getName();
+
+	public void addTest(Test test);
+
+	public int initializeSlaves(String networkName);
+}

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/NetworkDescription.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/NetworkDescription.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/NetworkDescription.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi;
+
+public interface NetworkDescription {
+	public int necessaryRelays();
+
+	public int necessaryClients();
+
+	public int necessaryAuthorities();
+}

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/RemoteMaster.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/RemoteMaster.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/RemoteMaster.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -38,34 +38,36 @@
  * <code>RemotePuppeTor</code> is the main interface that drives the
  * interaction between the interconnected master and its slave instances. It is
  * published by the master's instance, and represents the view of the master a
- * slave has. It provides ways for the slave to register a
- * <code>Slave</code> to provide information about its capabilities,
- * as well as a way for the slave to poll the master for new work and then
- * report back results. XXX We will need a way to allow the master to access
- * this, as well as a way for clients with open ports to register for callback
- * support instead of polling for new tasks =SH
+ * slave has. It provides ways for the slave to register a <code>Slave</code>
+ * to provide information about its capabilities, as well as a way for the slave
+ * to poll the master for new work and then report back results. XXX We will
+ * need a way to allow the master to access this, as well as a way for clients
+ * with open ports to register for callback support instead of polling for new
+ * tasks =SH
  *
  * @author Sebastian Hahn
  */
 public interface RemoteMaster extends Remote {
 
-    /**
-     * Slaves that must poll because they are not reachable can use this method
-     * to ask the master for new work.
-     *
-     * @throws RemoteException
-     *             RMI...
-     */
-    public Test getNewJob() throws RemoteException;
+	/**
+	 * Slaves that must poll because they are not reachable can use this method
+	 * to ask the master for new work.
+	 *
+	 * @throws RemoteException
+	 *             RMI...
+	 * @throws InterruptedException
+	 *             when interrupted while waiting for the next job to arrive.
+	 */
+	public Task getNewTask() throws RemoteException, InterruptedException;
 
-    /**
-     * XXX We want the slaves to report back when they have an update for the
-     * master-SH
-     *
-     * @param jobResult
-     * @throws RemoteException
-     *
-     * public void reportResults(TestResult testResult) throws
-     * RemoteException;
-     */
+	/**
+	 * Report back the result of the task to the master. If possible, add an
+	 * error message. XXX Maybe down the road an error object is
+	 * needed/wanted-SH
+	 *
+	 * @throws RemoteException
+	 *             RMI
+	 */
+	public void reportTaskResult(TaskResult task) throws RemoteException,
+			InterruptedException;
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Slave.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Slave.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Slave.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -36,43 +36,42 @@
 import java.util.Set;
 
 /**
- * A <code>Slave</code> represents a slave instance ready for tests.
- * It carries information about the testing capabilities of a given slave. A
- * slave may not provide information except for its name, which is always
- * mandatory. The slave will not be used for non-client traffic, though.
+ * A <code>Slave</code> represents a slave instance ready for tests. It
+ * carries information about the testing capabilities of a given slave. A slave
+ * may not provide information except for its name, which is always mandatory.
+ * The slave will not be used for non-client traffic, though.
  *
  * @author Sebastian Hahn
  */
 public interface Slave extends Serializable {
 
-    public enum OS {
-        UNDEFINED, LINUX_I86_32, LINUX_I86_64, MAC_OSX_PPC, MAC_OSX_I86,
-        WINDOWS_XP_32, WINDOWS_XP_64, WINDOWS_VISTA_32, WINDOWS_VISTA_64
-    }
+	public enum OS {
+		UNDEFINED, LINUX_I86_32, LINUX_I86_64, MAC_OSX_PPC, MAC_OSX_I86,
+		WINDOWS_XP_32, WINDOWS_XP_64, WINDOWS_VISTA_32, WINDOWS_VISTA_64
+	}
 
-    /**
-     * @return the slave's name.
-     */
-    public String getName();
+	/**
+	 * @return the slave's name.
+	 */
+	public String getName();
 
-    /**
-     * @return the slave's operating system as defined in
-     *         <code>Slave.OS</code>.
-     */
-    public OS getOS();
+	/**
+	 * @return the slave's operating system as defined in <code>Slave.OS</code>.
+	 */
+	public OS getOS();
 
-    /**
-     * @return the slave's IP address. XXX Test this with IPv6-SH
-     */
-    public InetAddress getIP();
+	/**
+	 * @return the slave's IP address. XXX Test this with IPv6-SH
+	 */
+	public InetAddress getIP();
 
-    /**
-     * @return the ports this slave can open
-     */
-    public Set<Integer> openablePorts();
+	/**
+	 * @return the ports this slave can open
+	 */
+	public Set<Integer> openablePorts();
 
-    /**
-     * @return Tor revisions available on the slave
-     */
-    public Set<Integer> availableRevisions();
+	/**
+	 * @return Tor revisions available on the slave
+	 */
+	public Set<Integer> availableRevisions();
 }

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Task.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Task.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Task.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi;
+
+import java.rmi.RemoteException;
+
+public interface Task {
+
+	public abstract void execute() throws InterruptedException, RemoteException;
+
+}

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TaskResult.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TaskResult.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TaskResult.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi;
+
+import java.io.Serializable;
+
+public interface TaskResult extends Serializable {
+
+	public Task getTask();
+
+	public boolean wasSuccessful();
+}

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Test.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Test.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/Test.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -32,27 +32,17 @@
 package de.uniba.wiai.lspi.puppetor.rmi;
 
 import java.io.Serializable;
-import java.rmi.RemoteException;
 
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
-
 /**
- * <code>Test</code> describes a test and the kind of slave it can run
- * on, as well as other network settings that are required for the test to work.
- * A test should be able to tell whether it was successfully run or not when
- * passed a TestResult.
+ * <code>Test</code> describes a test and the kind of slave it can run on, as
+ * well as other network settings that are required for the test to work. A test
+ * should be able to tell whether it was successfully run or not when passed a
+ * TestResult.
  *
  * @author Sebastian Hahn
  */
 public interface Test extends Serializable {
-    /**
-     * XXX this goes away. I just put it in to see whether a remote test would
-     * actually execut on a slave.
-     *
-     * @return
-     * @throws RemoteException
-     * @throws PuppeTorException
-     */
-    public Object doJob() throws RemoteException, PuppeTorException;
-    // public //hier dann halt network etc hin
+	public String getDescription();
+
+	public NetworkDescription getNetworkDescription();
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TestExecutor.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TestExecutor.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TestExecutor.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -31,8 +31,8 @@
  */
 package de.uniba.wiai.lspi.puppetor.rmi;
 
+import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
 
 /**
  * A master uses the <code>TestExecutor</code> instance to load all registered
@@ -46,45 +46,45 @@
  */
 public interface TestExecutor {
 
-    /**
-     * Register a test with the executor so it will consider it for execution.
-     * Accept all submitted tests even though some may not be executable at the
-     * moment of submission.
-     */
-    public void registerTest(Test test);
+	/**
+	 * Register a test with the executor so it will consider it for execution.
+	 * Accept all submitted tests even though some may not be executable at the
+	 * moment of submission.
+	 */
+	public void registerTest(Test test);
 
-    /**
-     * Start executing tests. Callers should make sure that the PuppeTor network
-     * that is supposed to be used is ready.
-     */
-    public void startTesting();
+	/**
+	 * Start executing tests. Callers should make sure that the PuppeTor network
+	 * that is supposed to be used is ready.
+	 */
+	public void startTesting();
 
-    /**
-     * Return a Map of the nodes that have been run successfully along with the
-     * results of the tests.
-     */
-    public ConcurrentMap<Test, TestResult> getSuccessfulTests();
+	/**
+	 * Return an immutable Map of the nodes that have been run successfully
+	 * along with the results of the tests.
+	 */
+	public Map<Test, TestResult> getSuccessfulTests();
 
-    /**
-     * Return a Map of the nodes that have been run but didn't complete
-     * successfully along with the results of the tests.
-     */
-    public ConcurrentMap<Test, TestResult> getFailedTests();
+	/**
+	 * Return an immutable Map of the nodes that have been run but didn't
+	 * complete successfully along with the results of the tests.
+	 */
+	public Map<Test, TestResult> getFailedTests();
 
-    /**
-     * Return all tests that could not be executed because the PuppeTorNetwork
-     * could not match a test's preconditions.
-     */
-    public Set<Test> getNotRunTests();
+	/**
+	 * Return all tests that could not be executed because the PuppeTorNetwork
+	 * could not match a test's preconditions.
+	 */
+	public Set<Test> cannotRunTests();
 
-    /**
-     * Register a newly connected PuppeTor slave via its
-     * <code>LocalMaster</code> connection object.
-     */
-    public void registerLocalMaster(LocalMaster master);
+	/**
+	 * Register a newly connected PuppeTor slave via its
+	 * <code>LocalMaster</code> connection object.
+	 */
+	public void registerLocalMaster(LocalMaster master);
 
-    /**
-     * Unregister a PuppeTor slave. Called when a slave disconnects.
-     */
-    public void unregisterLocalMaster(LocalMaster master);
+	/**
+	 * Unregister a PuppeTor slave. Called when a slave disconnects.
+	 */
+	public void unregisterLocalMaster(LocalMaster master);
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TestResult.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TestResult.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TestResult.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -34,9 +34,8 @@
 import java.io.Serializable;
 
 /**
- * XXX unused for now. this will hold the result of a /<code>Test</code>
- * -SH
+ * XXX unused for now. this will hold the result of a /<code>Test</code> -SH
  */
 public interface TestResult extends Serializable {
-    public Test getJob();
+	public Test getJob();
 }

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TorInstance.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TorInstance.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/TorInstance.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi;
+
+import java.util.List;
+
+/**
+ * Describe each tor instance at the client with a <code>TorInstance</code>.
+ *
+ * @author Sebastian Hahn
+ */
+public interface TorInstance {
+	/**
+	 * Additional configuration options that a test wants to be set for a tor
+	 * instance. <code>TorInstance.shouldReplaceConfiguration()</code>
+	 * determines whether this configuration should be added to the default tor
+	 * configuration or replace it.
+	 *
+	 * @return An immutable list of extra configuration settings.
+	 */
+	public List<String> getConfiguration();
+
+	/**
+	 * Whether the caller should use the result of
+	 * <code>TorInstance.getExtraConfiguration()</code> to append tor's
+	 * default configuration or replace it.
+	 *
+	 * @return true if configuration should be replaced, false if it should be
+	 *         appended.
+	 */
+	public boolean shouldReplaceConfiguration();
+
+	public boolean isDirectoryAuthority();
+
+	public boolean isBridgeAuthority();
+
+	public boolean isRelay();
+
+	public boolean isExit();
+
+	public boolean isOnPrivateNetwork();
+
+	public int getRevision();
+
+	public boolean isBridge();
+
+	public void linkToSlave(Slave slave);
+}
\ No newline at end of file

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/execute/PuppeTorMasterProgram.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/execute/PuppeTorMasterProgram.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/execute/PuppeTorMasterProgram.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -45,6 +45,7 @@
 import de.uniba.wiai.lspi.puppetor.rmi.Master;
 import de.uniba.wiai.lspi.puppetor.rmi.Slave;
 import de.uniba.wiai.lspi.puppetor.rmi.RemoteMaster;
+import de.uniba.wiai.lspi.puppetor.rmi.TestExecutor;
 import de.uniba.wiai.lspi.puppetor.rmi.impl.MasterImplFactory;
 
 /**
@@ -58,113 +59,136 @@
  */
 public class PuppeTorMasterProgram {
 
-    /**
-     * The login object for clients
-     */
-    final private PuppeTorMasterProgram.InnerMasterConnector master;
+	/**
+	 * The login object for clients
+	 */
+	final private PuppeTorMasterProgram.InnerMasterConnector master;
 
-    /**
-     * The port the server is supposed to listen on. This port must not be
-     * firewalled and must be forwarded to the machine if necessary.
-     */
-    final private static int serverport = 2050;
+	/**
+	 * The port the server is supposed to listen on. This port must not be
+	 * firewalled and must be forwarded to the machine if necessary.
+	 */
+	final private static int serverport = 2050;
 
-    /**
-     * The address this server should bind on. Use 127.0.0.1 for local testing.
-     * XXX Someone should check if this works with IPv6 -SH
-     */
-    final private static String serveraddress = "78.47.18.109";
+	/**
+	 * The address this server should bind on. Use 127.0.0.1 for local testing.
+	 * XXX Someone should check if this works with IPv6 -SH
+	 */
+	final private static String serveraddress = "78.47.18.109";
 
-    /**
-     * Master application entry point
-     *
-     * @param args
-     *            Command-line arguments - ignored for now.
-     */
-    public static void main(final String[] args) {
-        final PuppeTorMasterProgram server = new PuppeTorMasterProgram();
-        server.exportObject();
+	/**
+	 * Master application entry point
+	 *
+	 * @param args
+	 *            Command-line arguments - ignored for now.
+	 */
+	public static void main(final String[] args) {
+		final PuppeTorMasterProgram server = new PuppeTorMasterProgram();
+		System.out.println("PuppeTorMasterProgram made");
+		server.exportObject();
+		System.out.println("exported objects. waiting for slaves.");
+		try {
+			Thread.sleep(1000 * 10);// XXX this should be two minutes-SH
+		} catch (final InterruptedException e) {
+			e.printStackTrace();
+			throw new RuntimeException("This is the main thread. We don't "
+					+ "want to be interrupted.");
+		}
+		final TestExecutor exec =
+				AbstractMasterFactory.getInstance().getTestExecutorInstance();
+		System.out.println("trying to start executor");
+		exec.startTesting();
+	}
 
-        // XXX do stuff with the clients-SH
-    }
+	/**
+	 * Private constructor to set up RMI-related Java-internal variables and
+	 * create a <code>RemotePuppeTorImpl</code>.
+	 */
+	private PuppeTorMasterProgram() {
+		// Set the location of the keystore where your private certificate is.
+		System.setProperty("javax.net.ssl.keyStore", "res/keystore");
+		// Set the password for your keystore.
+		System.setProperty("javax.net.ssl.keyStorePassword", "asdasd");
 
-    /**
-     * Private constructor to set up RMI-related Java-internal variables and
-     * create a <code>RemotePuppeTorImpl</code>.
-     */
-    private PuppeTorMasterProgram() {
-        // Set the location of the keystore where your private certificate is.
-        System.setProperty("javax.net.ssl.keyStore", "res/keystore");
-        // Set the password for your keystore.
-        System.setProperty("javax.net.ssl.keyStorePassword", "asdasd");
+		/*
+		 * Set the location of the truststore which contains the exported
+		 * certificates of your slaves.
+		 */
+		System.setProperty("javax.net.ssl.trustStore", "res/truststore");
+		// Tell the RMI system the location of the master
+		System.setProperty("java.rmi.server.hostname", serveraddress);
+		// Set up the factories we want to use
+		AbstractMasterFactory.initialize(new MasterImplFactory());
 
-        /*
-         * Set the location of the truststore which contains the exported
-         * certificates of your slaves.
-         */
-        System.setProperty("javax.net.ssl.trustStore", "res/truststore");
-        // Tell the RMI system the location of the master
-        System.setProperty("java.rmi.server.hostname", serveraddress);
-        // Set up the factories we want to use
-        AbstractMasterFactory
-                .initialize(new MasterImplFactory());
+		registerTests();
 
-        try {
-            master = new InnerMasterConnector();
-        } catch (final RemoteException e) {
-            // We cannot do much better here. This is supposed to just work.
-            e.printStackTrace();
-            throw new RuntimeException("Couldn't create remote object. Dying.");
-        }
-    }
+		try {
+			master = new InnerMasterConnector();
+		} catch (final RemoteException e) {
+			// We cannot do much better here. This is supposed to just work.
+			e.printStackTrace();
+			throw new RuntimeException("Couldn't create remote object. Dying.");
+		}
+	}
 
-    /**
-     * Create an RMI registry that uses SSL-secured Sockets for communication,
-     * requires client authentication, and bind our <code>MasterConnector</code>
-     * in the registry. If this doesn't work, most likely the user's system
-     * configuration isn't correct.
-     */
-    private void exportObject() {
-        try {
-            final Registry registry =
-                    LocateRegistry.createRegistry(serverport,
-                            new SslRMIClientSocketFactory(),
-                            new SslRMIServerSocketFactory(null, null, true));
+	/**
+	 * Create an RMI registry that uses SSL-secured Sockets for communication,
+	 * requires client authentication, and bind our <code>MasterConnector</code>
+	 * in the registry. If this doesn't work, most likely the user's system
+	 * configuration isn't correct.
+	 */
+	private void exportObject() {
+		try {
+			final Registry registry =
+					LocateRegistry.createRegistry(serverport,
+							new SslRMIClientSocketFactory(),
+							new SslRMIServerSocketFactory(null, null, true));
 
-            registry.bind("Master", master);
-        } catch (final Throwable th) {
-            th.printStackTrace();
-            System.out
-                    .println("Could not create the registry or bind an"
-                            + "object in it. Please check your system's configuration. "
-                            + th);
-            System.exit(1);
-        }
-    }
+			registry.bind("Master", master);
+		} catch (final Throwable th) {
+			th.printStackTrace();
+			throw new RuntimeException(
+					"Could not create the registry or bind"
+							+ "an object in it. Please check your system's configuration. "
+							+ th);
 
-    static class InnerMasterConnector extends UnicastRemoteObject implements
-            MasterConnector {
-        /**
-         * Required for serialization. Needs to change for new released
-         * versions.
-         */
-        private static final long serialVersionUID = 1L;
+		}
+	}
 
-        /**
-         * empty default constructor necessary for the Exception
-         *
-         * @throws RemoteException
-         *             RMI
-         */
-        public InnerMasterConnector() throws RemoteException {}
+	/**
+	 * Register all the tests you want to execute here.
+	 */
+	private void registerTests() {
+		final AbstractMasterFactory fact = AbstractMasterFactory.getInstance();
+		final TestExecutor exec = fact.getTestExecutorInstance();
+		exec
+				.registerTest(fact
+						.createPublicNetworkTestForClientsOnly("Access google over public Tor network."));
+	}
 
-        public RemoteMaster registerClient(final Slave slave)
-                throws RemoteException {
-            final AbstractMasterFactory fact =
-                    AbstractMasterFactory.getInstance();
-            final Master master = fact.createMaster(slave);
-            ((LocalMaster)master).registerWithTestExecutor();
-            return (RemoteMaster)master;
-        }
-    }
+	static class InnerMasterConnector extends UnicastRemoteObject implements
+			MasterConnector {
+		/**
+		 * Required for serialization. Needs to change for new released
+		 * versions.
+		 */
+		private static final long serialVersionUID = 1L;
+
+		/**
+		 * empty default constructor necessary for the Exception
+		 *
+		 * @throws RemoteException
+		 *             RMI
+		 */
+		public InnerMasterConnector() throws RemoteException {}
+
+		public RemoteMaster registerClient(final Slave slave)
+				throws RemoteException {
+			final AbstractMasterFactory fact =
+					AbstractMasterFactory.getInstance();
+			final Master master = fact.createMaster(slave);
+			((LocalMaster) master).registerWithTestExecutor();
+			return (RemoteMaster) master;
+		}
+	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/execute/PuppeTorSlaveProgram.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/execute/PuppeTorSlaveProgram.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/execute/PuppeTorSlaveProgram.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -37,17 +37,19 @@
 import java.rmi.registry.Registry;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.LinkedBlockingQueue;
 
 import javax.rmi.ssl.SslRMIClientSocketFactory;
 
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
 import de.uniba.wiai.lspi.puppetor.rmi.AbstractSlaveFactory;
 import de.uniba.wiai.lspi.puppetor.rmi.MasterConnector;
 import de.uniba.wiai.lspi.puppetor.rmi.Slave;
-import de.uniba.wiai.lspi.puppetor.rmi.Test;
 import de.uniba.wiai.lspi.puppetor.rmi.RemoteMaster;
+import de.uniba.wiai.lspi.puppetor.rmi.Task;
 import de.uniba.wiai.lspi.puppetor.rmi.impl.SlaveImplFactory;
+import de.uniba.wiai.lspi.puppetor.rmi.tasks.TerminateTask;
 
 /**
  * The <code>PuppeTorSlaveProgram</code> contains the main method for the
@@ -61,141 +63,172 @@
  */
 public class PuppeTorSlaveProgram {
 
-    /**
-     * The <code>RemotePuppeTor</code> object that is exported by the server.
-     * This variable may be written to only from the main thread.
-     */
-    volatile private RemoteMaster master;
+	/**
+	 * The <code>RemotePuppeTor</code> object that is exported by the server.
+	 * This variable may be written to only from the main thread.
+	 */
+	volatile private RemoteMaster master;
 
-    /**
-     * The port the master server is supposed to listen on. This port must not
-     * be firewalled and must be forwarded to the machine if necessary. Use the
-     * same value as you used for the master's configuration.
-     */
-    final private static int serverport = 2050;
+	/**
+	 * The port the master server is supposed to listen on. This port must not
+	 * be firewalled and must be forwarded to the machine if necessary. Use the
+	 * same value as you used for the master's configuration.
+	 */
+	final private static int serverport = 2050;
 
-    /**
-     * The address master server listens on. Use the same value as you used for
-     * the master's configuration. XXX Someone should check if this works with
-     * IPv6 -SH
-     */
-    final private static String serveraddress = "78.47.18.109";
+	/**
+	 * The address master server listens on. Use the same value as you used for
+	 * the master's configuration. XXX Someone should check if this works with
+	 * IPv6 -SH
+	 */
+	final private static String serveraddress = "78.47.18.109";
 
-    /**
-     * Each slave is identified by its unique <code>slaveName</code>. Be
-     * careful to prevent naming collisions between slaves.
-     */
-    final private static String slaveName = "slave1";
+	/**
+	 * Each slave is identified by its unique <code>slaveName</code>. Be
+	 * careful to prevent naming collisions between slaves.
+	 */
+	final private static String slaveName = "slave1";
 
-    /**
-     * A representation of this slave node to be sent to the master.
-     */
-    final private Slave slave;
+	/**
+	 * A representation of this slave node to be sent to the master.
+	 */
+	final private Slave slave;
 
-    /**
-     * Slave application entry point
-     *
-     * @param args
-     *            Command-line arguments
-     */
-    public static void main(final String[] args) {
-        final PuppeTorSlaveProgram slave = new PuppeTorSlaveProgram();
-        while (slave.connectToMaster() == false) {
-            try {
-                Thread.sleep(60000); // wait one minute
-            } catch (final InterruptedException e) {
-                // and immediatly retry if we're interrupted.
-                // XXX this isn't a good idea. we should quit.-SH
-            }
-        }
-        // XXX How about we spawn a thread here that polls for new work and puts
-        // it in a nice little queue that some worker threads use...
-        try {
-            final Test job = slave.master.getNewJob();
-            if (job != null) {
-                final Object res = job.doJob();
-            }
-        } catch (final PuppeTorException e) {
-            e.printStackTrace();
-            System.out.println("PuppeTor didn't do what we wanted it to do."
-                    + " For now, that's a fatal error. " + e);
-            System.exit(1);
-        } catch (final RemoteException e) {
-            // XXX Need to handle the exception... -SH
-        }
-    }
+	final protected static BlockingQueue<Task> tasks =
+			new LinkedBlockingQueue<Task>();
 
-    /**
-     * Private constructor to set up RMI-related Java-internal variables.
-     */
-    private PuppeTorSlaveProgram() {
-        /*
-         * Set the location of the keystore where your private certificate is.
-         */
-        System.setProperty("javax.net.ssl.keyStore", "res/keystore");
-        /*
-         * Set the password for your keystore.
-         */
-        System.setProperty("javax.net.ssl.keyStorePassword", "asdasd");
-        /*
-         * Set the location of the truststore which contains the exported
-         * certificates of your slaves
-         */
-        System.setProperty("javax.net.ssl.trustStore", "res/truststore");
-        // Set up the factories we want to use
-        AbstractSlaveFactory.initialize(new SlaveImplFactory());
-        final AbstractSlaveFactory fac =
-                AbstractSlaveFactory.getInstance();
+	/**
+	 * Slave application entry point
+	 *
+	 * @param args
+	 *            Command-line arguments
+	 */
+	public static void main(final String[] args) {
+		final PuppeTorSlaveProgram slave = new PuppeTorSlaveProgram();
+		System.out.println("PuppeTorSlaveProgram made");
+		while (slave.connectToMaster() == false) {
+			try {
+				Thread.sleep(60000); // wait one minute
+			} catch (final InterruptedException e) {
+				// and immediatly retry if we're interrupted.
+			}
+		}
+		System.out.println("Connected to master");
 
-        /*
-         * Create a new slave with the properties that are relevant for the
-         * computer and networking environment it runs on.
-         */
-        final Set<Integer> ports = new HashSet<Integer>();
-        for (int i = 10025; i < 20000; i++) {
-            ports.add(i);
-        }
-        final Set<Integer> availableRevisions =
-                new CopyOnWriteArraySet<Integer>();
-        slave =
-                fac.createSlave(slaveName, Slave.OS.UNDEFINED,
-                        "127.0.0.1", ports, availableRevisions);
+		new Thread(new Runnable() {
+			public void run() {
+				while (true) {
+					try {
+						try {
+							tasks.put(slave.master.getNewTask());
+							System.out.println("added task");
+						} catch (final RemoteException e) {
+							// The connection to the master broke down. Stop
+							// this thread.
+							e.printStackTrace();
+							tasks.put(new TerminateTask("local termination"));
+							Thread.currentThread().interrupt();
+						}
+					} catch (final InterruptedException e) {
+						e.printStackTrace();
+						Thread.currentThread().interrupt();
+					}
+					if (Thread.interrupted()) {
+						System.out.println("interrupted.");
+						break;
+					}
 
-    }
+				}
+			}
+		}).start();
+		try {
+			while (true) {
+				final Task newTask = tasks.take();
+				newTask.execute();
+				if (Thread.interrupted()) {
+					break;
+				}
+			}
+		} catch (final InterruptedException e) {
+			// XXX handle-SH
+			System.out.println("handle stuff here");
+		} catch (final RemoteException e) {
+			// XXX handle-SH
+			System.out.println("handle stuff here");
+		}
+	}
 
-    /**
-     * Attempt to make a connection to the master through RMI. If the master is
-     * down, that is not a fatal condition, we want to keep trying until we can
-     * reach it. Don't call this except from main().
-     *
-     * @return true if the connection was successful, false otherwise.
-     */
-    private boolean connectToMaster() {
-        try {
-            final Registry registry =
-                    LocateRegistry.getRegistry(serveraddress, serverport,
-                            new SslRMIClientSocketFactory());
+	/**
+	 * Private constructor to set up RMI-related Java-internal variables.
+	 */
+	private PuppeTorSlaveProgram() {
+		/*
+		 * Set the location of the keystore where your private certificate is.
+		 */
+		System.setProperty("javax.net.ssl.keyStore", "res/keystore");
+		/*
+		 * Set the password for your keystore.
+		 */
+		System.setProperty("javax.net.ssl.keyStorePassword", "asdasd");
+		/*
+		 * Set the location of the truststore which contains the exported
+		 * certificates of your slaves
+		 */
+		System.setProperty("javax.net.ssl.trustStore", "res/truststore");
+		// Set up the factories we want to use
+		AbstractSlaveFactory.initialize(new SlaveImplFactory());
+		final AbstractSlaveFactory fac = AbstractSlaveFactory.getInstance();
 
-            master =
-                    ((MasterConnector) registry.lookup("Master"))
-                            .registerClient(slave);
-        } catch (final NotBoundException e) {
-            e.printStackTrace();
-            System.out.println("We could connect, but the master has not "
-                    + "exported the Master Object yet." + e);
-            return false;
-        } catch (final RemoteException e) {
-            // XXX remove the next two lines once this stabilizes-SH
-            e.printStackTrace();
-            System.out.println("Server down " + e);
-            return false;
-        } catch (final IllegalArgumentException e) {
-            e.printStackTrace();
-            System.out.println("A slave with this name is already connected "
-                    + "to the server! " + e);
-            return false;
-        }
-        return true;
-    }
+		/*
+		 * Create a new slave with the properties that are relevant for the
+		 * computer and networking environment it runs on.
+		 */
+		final Set<Integer> ports = new HashSet<Integer>();
+		for (int i = 10025; i < 20000; i++) {
+			ports.add(i);
+		}
+		final Set<Integer> availableRevisions =
+				new CopyOnWriteArraySet<Integer>();
+		slave =
+				fac.createSlave(slaveName, Slave.OS.UNDEFINED, "127.0.0.1",
+						ports, availableRevisions);
 
+	}
+
+	/**
+	 * Attempt to make a connection to the master through RMI. If the master is
+	 * down, that is not a fatal condition, we want to keep trying until we can
+	 * reach it. Don't call this except from main().
+	 *
+	 * @return true if the connection was successful, false otherwise.
+	 */
+	private boolean connectToMaster() {
+		try {
+			final Registry registry =
+					LocateRegistry.getRegistry(serveraddress, serverport,
+							new SslRMIClientSocketFactory());
+
+			master =
+					((MasterConnector) registry.lookup("Master"))
+							.registerClient(slave);
+			AbstractSlaveFactory.setMaster(master);
+		} catch (final NotBoundException e) {
+			e.printStackTrace();
+			System.out.println("We could connect, but the master has not "
+					+ "exported the Master Object yet." + e);
+			return false;
+		} catch (final RemoteException e) {
+			// XXX remove the next two lines once this stabilizes-SH
+			e.printStackTrace();
+			System.out.println("Server down " + e);
+			return false;
+		} catch (final IllegalArgumentException e) {
+			e.printStackTrace();
+			System.out.println("A slave with this name is already connected "
+					+ "to the server! " + e);
+			return false;
+		}
+		return true;
+	}
+
 }

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/AbstractTaskImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/AbstractTaskImpl.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/AbstractTaskImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.impl;
+
+import java.io.Serializable;
+import java.rmi.RemoteException;
+
+import de.uniba.wiai.lspi.puppetor.rmi.AbstractSlaveFactory;
+import de.uniba.wiai.lspi.puppetor.rmi.RemoteMaster;
+import de.uniba.wiai.lspi.puppetor.rmi.Task;
+
+public abstract class AbstractTaskImpl implements Serializable, Task {
+
+	/**
+	 * The name that will be shared across all slaves to identify this network.
+	 */
+	final protected String name;
+
+	public AbstractTaskImpl(final String name) {
+		this.name = name;
+	}
+
+	public abstract void execute() throws InterruptedException, RemoteException;
+
+	protected void reportResult(final boolean success) throws InterruptedException,
+			RemoteException {
+		final RemoteMaster master = AbstractSlaveFactory.getMaster();
+		master.reportTaskResult(new TaskResultImpl(success, this));
+	}
+}

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/MasterImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/MasterImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/MasterImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -34,14 +34,16 @@
 import java.rmi.RemoteException;
 import java.rmi.server.UnicastRemoteObject;
 import java.rmi.server.Unreferenced;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
 
 import de.uniba.wiai.lspi.puppetor.rmi.AbstractMasterFactory;
-import de.uniba.wiai.lspi.puppetor.rmi.CreateNetwork;
 import de.uniba.wiai.lspi.puppetor.rmi.LocalMaster;
 import de.uniba.wiai.lspi.puppetor.rmi.Master;
 import de.uniba.wiai.lspi.puppetor.rmi.Slave;
-import de.uniba.wiai.lspi.puppetor.rmi.Test;
 import de.uniba.wiai.lspi.puppetor.rmi.RemoteMaster;
+import de.uniba.wiai.lspi.puppetor.rmi.Task;
+import de.uniba.wiai.lspi.puppetor.rmi.TaskResult;
 
 /**
  * Represent the master at the slave, and give the master a way to interact with
@@ -49,63 +51,72 @@
  *
  * @author Sebastian Hahn
  */
-public class MasterImpl extends UnicastRemoteObject implements
- LocalMaster, RemoteMaster, Master, Unreferenced {
+public class MasterImpl extends UnicastRemoteObject implements LocalMaster,
+		RemoteMaster, Master, Unreferenced {
 
-    /**
-     * Required for serialization. Needs to change for new released versions.
-     */
-    private static final long serialVersionUID = 1L;
+	/**
+	 * Required for serialization. Needs to change for new released versions.
+	 */
+	private static final long serialVersionUID = 1L;
 
-    /**
-     * Store the reference to the connected slave
-     */
-    private final Slave slave;
+	/**
+	 * Store the reference to the connected slave
+	 */
+	private final Slave slave;
 
-    public Slave getSlave() {
-        return slave;
-    }
+	private final BlockingQueue<Task> tasks;
 
-    public void registerWithTestExecutor() {
-        AbstractMasterFactory.getInstance().getTestExecutorInstance()
-                .registerLocalMaster(this);
-    }
+	private final BlockingQueue<TaskResult> completedTasks;
 
-    /**
-     * Check the slave object for validity and save it for further reference
-     *
-     * @throws RemoteException
-     *             RMI
-     */
-    public MasterImpl(final Slave slave) throws RemoteException {
-        if (slave.getName() == null) {
-            throw new NullPointerException("The slave's name must not be null!");
-        }
-        this.slave = slave;
-    }
+	public Slave getSlave() {
+		return slave;
+	}
 
-    /**
-     * XXX Currently, there is no logic to give back useful tasks, but if the
-     * client is known, a new <code>CreateNetwork</code> test is submitted.-SH
-     */
-    public Test getNewJob() throws RemoteException {
-        return new CreateNetwork();
-    }
+	public void registerWithTestExecutor() {
+		AbstractMasterFactory.getInstance().getTestExecutorInstance()
+				.registerLocalMaster(this);
+	}
 
-    // public void repoprtResults(final String slaveName,
-    // final TestResult jobResult) throws RemoteException {
-    // XXX We want to let the server know that the client did some work and
-    // how it turned out to be. -SH
-    // }
+	/**
+	 * Check the slave object for validity and save it for further reference
+	 *
+	 * @throws RemoteException
+	 *             RMI
+	 */
+	public MasterImpl(final Slave slave) throws RemoteException {
+		if (slave.getName() == null) {
+			throw new NullPointerException("The slave's name must not be null!");
+		}
+		this.slave = slave;
+		tasks = new LinkedBlockingQueue<Task>();
+		completedTasks = new LinkedBlockingQueue<TaskResult>();
+	}
 
-    /**
-     * Remove the slave from the Map of slaves and destroy its workqueues.
-     * Inform the TestRunner that all still-running tests failed because the
-     * slave went away. XXX Don't just promise to do that - we actually have to
-     * do that when there are the queues that I mentioned.-SH
-     */
-    public void unreferenced() {
-        AbstractMasterFactory.getInstance().getTestExecutorInstance()
-                .unregisterLocalMaster(this);
-    }
+	public Task getNewTask() throws RemoteException, InterruptedException {
+		return tasks.take();
+	}
+
+	public void reportTaskResult(final TaskResult task) throws RemoteException,
+			InterruptedException {
+		completedTasks.put(task);
+	}
+
+	public TaskResult getTaskResult() throws InterruptedException {
+		return completedTasks.take();
+	}
+
+	/**
+	 * Remove the slave from the Map of slaves and destroy its workqueues.
+	 * Inform the TestRunner that all still-running tests failed because the
+	 * slave went away. XXX Don't just promise to do that - we actually have to
+	 * do that when there are the queues that I mentioned.-SH
+	 */
+	public void unreferenced() {
+		AbstractMasterFactory.getInstance().getTestExecutorInstance()
+				.unregisterLocalMaster(this);
+	}
+
+	public void addTask(final AbstractTaskImpl abstractTaskImpl) {
+		tasks.add(abstractTaskImpl);
+	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/MasterImplFactory.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/MasterImplFactory.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/MasterImplFactory.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -34,7 +34,10 @@
 import java.rmi.RemoteException;
 import de.uniba.wiai.lspi.puppetor.rmi.AbstractMasterFactory;
 import de.uniba.wiai.lspi.puppetor.rmi.Master;
+import de.uniba.wiai.lspi.puppetor.rmi.Network;
+import de.uniba.wiai.lspi.puppetor.rmi.NetworkDescription;
 import de.uniba.wiai.lspi.puppetor.rmi.Slave;
+import de.uniba.wiai.lspi.puppetor.rmi.Test;
 import de.uniba.wiai.lspi.puppetor.rmi.TestExecutor;
 
 /**
@@ -44,14 +47,29 @@
  */
 public class MasterImplFactory extends AbstractMasterFactory {
 
-    @Override
-    public Master createMaster(final Slave slave)
-            throws RemoteException {
-        return new MasterImpl(slave);
-    }
+	@Override
+	public Master createMaster(final Slave slave) throws RemoteException {
+		return new MasterImpl(slave);
+	}
 
-    @Override
-    public TestExecutor getTestExecutorInstance() {
-        return TestExecutorImpl.getInstance();
-    }
+	@Override
+	public TestExecutor getTestExecutorInstance() {
+		return TestExecutorImpl.getInstance();
+	}
+
+	@Override
+	public Test createPublicNetworkTestForClientsOnly(final String description) {
+		return new TestImpl(description, new NetworkDescriptionImpl(1, 0, 0));
+	}
+
+	@Override
+	public Network createNetwork(final String name) {
+		return new NetworkImpl(name);
+	}
+
+	@Override
+	public NetworkDescription createNetworkDescription() {
+		// TODO Auto-generated method stub
+		return null;
+	}
 }

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/NetworkDescriptionImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/NetworkDescriptionImpl.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/NetworkDescriptionImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.impl;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import de.uniba.wiai.lspi.puppetor.rmi.NetworkDescription;
+
+public class NetworkDescriptionImpl implements NetworkDescription {
+
+	/**
+	 * Required for serialization. Needs to change for new released versions.
+	 */
+	private static final long serialVersionUID = 1L;
+
+	private final AtomicInteger numClients;
+	private final AtomicInteger numRelays;
+	private final AtomicInteger numAuthorities;
+
+	public int necessaryClients() {
+		return numClients.get();
+	}
+
+	public int necessaryRelays() {
+		return numRelays.get();
+	}
+
+	public int necessaryAuthorities() {
+		return numAuthorities.get();
+	}
+
+	public NetworkDescriptionImpl(final int numClients, final int numRelays,
+			final int numAuthorities) {
+		this.numClients = new AtomicInteger(numClients);
+		this.numRelays = new AtomicInteger(numRelays);
+		this.numAuthorities = new AtomicInteger(numAuthorities);
+	}
+
+}

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/NetworkImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/NetworkImpl.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/NetworkImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.impl;
+
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import de.uniba.wiai.lspi.puppetor.rmi.LocalMaster;
+import de.uniba.wiai.lspi.puppetor.rmi.Network;
+import de.uniba.wiai.lspi.puppetor.rmi.Test;
+import de.uniba.wiai.lspi.puppetor.rmi.TorInstance;
+import de.uniba.wiai.lspi.puppetor.rmi.tasks.CreateNetworkTask;
+
+public class NetworkImpl implements Network {
+
+	/**
+	 * Required for serialization. Needs to change for new released versions.
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * The name of the network, so we can identify it in logs etc.
+	 */
+	final private String name;
+
+	/**
+	 * All the tests that will run with this network. The individual Tor
+	 * instances will have the tests they need to execute broken down further.
+	 */
+	private final List<Test> tests;
+
+	private final ConcurrentMap<LocalMaster, Set<TorInstance>> torInstances;
+
+	public NetworkImpl(final String name) {
+		this.name = name;
+		tests = new CopyOnWriteArrayList<Test>();
+		torInstances =
+				new ConcurrentHashMap<LocalMaster, Set<TorInstance>>();
+	}
+
+	public void addTorInstanceForMaster(final TorInstance torInstance,
+			final LocalMaster master) {
+		torInstance.linkToSlave(master.getSlave());
+		torInstances
+				.putIfAbsent(master, new CopyOnWriteArraySet<TorInstance>());
+		torInstances.get(master).add(torInstance);
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void addTest(final Test test) {
+		tests.add(test);
+	}
+
+	public int initializeSlaves(final String networkName) {
+		int i = 0;
+		for (final LocalMaster master : torInstances.keySet()) {
+			master.addTask(new CreateNetworkTask(networkName));
+			i++;
+		}
+		return i;
+	}
+
+}

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/SlaveImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/SlaveImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/SlaveImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -49,109 +49,109 @@
  */
 public final class SlaveImpl implements Slave {
 
-    /**
-     * Required for serialization. Needs to change for new released versions.
-     */
-    private static final long serialVersionUID = 1L;
+	/**
+	 * Required for serialization. Needs to change for new released versions.
+	 */
+	private static final long serialVersionUID = 1L;
 
-    /**
-     * The slave's name
-     */
-    protected final String name;
+	/**
+	 * The slave's name
+	 */
+	protected final String name;
 
-    /**
-     * The slave's ip address
-     */
-    protected final InetAddress ip;
+	/**
+	 * The slave's ip address
+	 */
+	protected final InetAddress ip;
 
-    /**
-     * The operating system of the slave. See <code>Slave.OS</code>.
-     */
-    protected final OS os;
+	/**
+	 * The operating system of the slave. See <code>Slave.OS</code>.
+	 */
+	protected final OS os;
 
-    /**
-     * The ports this slave can open. Currently, we choose to use 256 as a
-     * maximum that "should be" enough so we don't transfer so much data when
-     * serializing. See the constructor. Make sure this is immutable.
-     */
-    protected final Set<Integer> ports;
+	/**
+	 * The ports this slave can open. Currently, we choose to use 256 as a
+	 * maximum that "should be" enough so we don't transfer so much data when
+	 * serializing. See the constructor. Make sure this is immutable.
+	 */
+	protected final Set<Integer> ports;
 
-    /**
-     * The different revisions of Tor clients this slave can execute.
-     */
-    protected final Set<Integer> availableRevisions;
+	/**
+	 * The different revisions of Tor clients this slave can execute.
+	 */
+	protected final Set<Integer> availableRevisions;
 
-    /**
-     * Create a new <code>Slave</code> with the metrics we currently
-     * use, meaning it's operating system, it's IP, and the ports it can open.
-     * We may in the future include other things like Tor executable version
-     * numbers and the ability to run certain extra scripts.
-     *
-     * @param slaveName
-     *            the slave's name. Each slave must have it's own unique name in
-     *            a given PuppeTor network.
-     * @param os
-     *            the slave's operating system.
-     * @param ip
-     *            A String representation of the slave's IP (v4 or v6).
-     * @param ports
-     *            All the ports this slave can open. Currently, we pick 256 out
-     *            of those at random.
-     * @throws NullPointerException
-     *             if the slavename is null
-     */
-    public SlaveImpl(final String slaveName, final OS os,
-            final String ip, final Set<Integer> ports,
-            final Set<Integer> availableRevisions) throws NullPointerException {
-        if (slaveName == null) {
-            throw new NullPointerException("slaveName must not be null");
-        }
-        name = slaveName;
-        this.os = os;
-        try {
-            this.ip = InetAddress.getByName(ip);
-        } catch (final UnknownHostException e) {
-            e.printStackTrace();
-            throw new RuntimeException("You specified an invalid IP address!");
-        }
+	/**
+	 * Create a new <code>Slave</code> with the metrics we currently use,
+	 * meaning it's operating system, it's IP, and the ports it can open. We may
+	 * in the future include other things like Tor executable version numbers
+	 * and the ability to run certain extra scripts.
+	 *
+	 * @param slaveName
+	 *            the slave's name. Each slave must have it's own unique name in
+	 *            a given PuppeTor network.
+	 * @param os
+	 *            the slave's operating system.
+	 * @param ip
+	 *            A String representation of the slave's IP (v4 or v6).
+	 * @param ports
+	 *            All the ports this slave can open. Currently, we pick 256 out
+	 *            of those at random.
+	 * @throws NullPointerException
+	 *             if the slavename is null
+	 */
+	public SlaveImpl(final String slaveName, final OS os, final String ip,
+			final Set<Integer> ports, final Set<Integer> availableRevisions)
+			throws NullPointerException {
+		if (slaveName == null) {
+			throw new NullPointerException("slaveName must not be null");
+		}
+		name = slaveName;
+		this.os = os;
+		try {
+			this.ip = InetAddress.getByName(ip);
+		} catch (final UnknownHostException e) {
+			e.printStackTrace();
+			throw new RuntimeException("You specified an invalid IP address!");
+		}
 
-        if (ports.size() > 256) {
-            final Set<Integer> tmp = new CopyOnWriteArraySet<Integer>();
-            int i = 0;
-            for (final Integer j : tmp) {
-                if (i++ == 256) {
-                    break;
-                }
-                tmp.add(j);
-            }
-            this.ports = Collections.unmodifiableSet(tmp);
-        } else {
-            this.ports =
-                    Collections
-                            .unmodifiableSet(new CopyOnWriteArraySet<Integer>(
-                                    ports));
-        }
-        this.availableRevisions =
-                Collections.unmodifiableSet(availableRevisions);
-    }
+		if (ports.size() > 256) {
+			final Set<Integer> tmp = new CopyOnWriteArraySet<Integer>();
+			int i = 0;
+			for (final Integer j : tmp) {
+				if (i++ == 256) {
+					break;
+				}
+				tmp.add(j);
+			}
+			this.ports = Collections.unmodifiableSet(tmp);
+		} else {
+			this.ports =
+					Collections
+							.unmodifiableSet(new CopyOnWriteArraySet<Integer>(
+									ports));
+		}
+		this.availableRevisions =
+				Collections.unmodifiableSet(availableRevisions);
+	}
 
-    public String getName() {
-        return name;
-    }
+	public String getName() {
+		return name;
+	}
 
-    public OS getOS() {
-        return os;
-    }
+	public OS getOS() {
+		return os;
+	}
 
-    public InetAddress getIP() {
-        return ip;
-    }
+	public InetAddress getIP() {
+		return ip;
+	}
 
-    public Set<Integer> openablePorts() {
-        return ports;
-    }
+	public Set<Integer> openablePorts() {
+		return ports;
+	}
 
-    public Set<Integer> availableRevisions() {
-        return availableRevisions;
-    }
+	public Set<Integer> availableRevisions() {
+		return availableRevisions;
+	}
 }

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/SlaveImplFactory.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/SlaveImplFactory.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/SlaveImplFactory.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -44,16 +44,15 @@
  */
 public class SlaveImplFactory extends AbstractSlaveFactory {
 
-    /**
-     * @return a new <code>RemotePuppeTorImpl</code> instance.
-     */
-    @Override
-    public Slave createSlave(final String slaveName,
-            final OS os, final String ip, final Set<Integer> ports,
-            final Set<Integer> availableRevisions) throws NullPointerException {
-        System.out.println(slaveName);
-        return new SlaveImpl(slaveName, os, ip, ports,
-                availableRevisions);
-    }
+	/**
+	 * @return a new <code>RemotePuppeTorImpl</code> instance.
+	 */
+	@Override
+	public Slave createSlave(final String slaveName, final OS os,
+			final String ip, final Set<Integer> ports,
+			final Set<Integer> availableRevisions) throws NullPointerException {
+		System.out.println(slaveName);
+		return new SlaveImpl(slaveName, os, ip, ports, availableRevisions);
+	}
 
 }

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TaskResultImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TaskResultImpl.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TaskResultImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.impl;
+
+import de.uniba.wiai.lspi.puppetor.rmi.Task;
+import de.uniba.wiai.lspi.puppetor.rmi.TaskResult;
+
+public class TaskResultImpl implements TaskResult {
+
+	/**
+	 * Required for serialization. Needs to change for new released versions.
+	 */
+	private static final long serialVersionUID = 1L;
+
+	final private Task task;
+
+	final private boolean wasSuccessful;
+
+	public TaskResultImpl(final boolean success, final Task task) {
+		wasSuccessful = success;
+		this.task = task;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public boolean wasSuccessful() {
+		return wasSuccessful;
+	}
+
+}

Modified: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TestExecutorImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TestExecutorImpl.java	2008-07-13 14:25:54 UTC (rev 15872)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TestExecutorImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -31,11 +31,19 @@
  */
 package de.uniba.wiai.lspi.puppetor.rmi.impl;
 
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import java.util.Vector;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.atomic.AtomicBoolean;
 
+import de.uniba.wiai.lspi.puppetor.rmi.Network;
 import de.uniba.wiai.lspi.puppetor.rmi.LocalMaster;
+import de.uniba.wiai.lspi.puppetor.rmi.NetworkDescription;
+import de.uniba.wiai.lspi.puppetor.rmi.TaskResult;
 import de.uniba.wiai.lspi.puppetor.rmi.Test;
 import de.uniba.wiai.lspi.puppetor.rmi.TestResult;
 import de.uniba.wiai.lspi.puppetor.rmi.TestExecutor;
@@ -45,74 +53,209 @@
  */
 public final class TestExecutorImpl implements TestExecutor {
 
-    /**
-     * The TestExecutor instance that we'll use
-     */
-    private static final TestExecutor instance = new TestExecutorImpl();
+	/**
+	 * The TestExecutor instance that we'll use
+	 */
+	private static final TestExecutor instance = new TestExecutorImpl();
 
-    /**
-     * Store all local representations of connections to slaves. Use the slave's
-     * name as key.
-     */
-    private static final ConcurrentMap<String, LocalMaster> masters =
-            new ConcurrentHashMap<String, LocalMaster>();
+	/**
+	 * Store all local representations of connections to slaves. Use the slave's
+	 * name as key.
+	 */
+	private static final ConcurrentMap<String, LocalMaster> masters =
+			new ConcurrentHashMap<String, LocalMaster>();
 
-    /**
-     * Singleton
-     */
-    private TestExecutorImpl() {
-    }
+	/**
+	 * Store all registered tests until they are started.
+	 */
+	private static final List<Test> newTests = new Vector<Test>();
 
-    public static TestExecutor getInstance() {
-        return instance;
-    }
+	/**
+	 * Store all currently running tests.
+	 */
+	// private static final List<Test> runningTests = new Vector<Test>();
+	/**
+	 * Store all tests that cannot run because the slave's cannot build such a
+	 * network.
+	 */
+	private static final Set<Test> cannotRunTests =
+			new CopyOnWriteArraySet<Test>();
 
-    public void registerLocalMaster(final LocalMaster master) {
-        System.out.println("register slave " + master.getSlave().getName());
-        if (null != masters.putIfAbsent(master.getSlave().getName(), master)) {
-            throw new IllegalArgumentException(master.getSlave().getName()
-                    + " has already registered with this Server");
-        }
+	/**
+	 * Store the networks that are created out of the NetworkDescriptions.
+	 */
+	private static final Set<Network> networks =
+			new CopyOnWriteArraySet<Network>();
 
-    }
+	/**
+	 * Store all failed tests.
+	 */
+	private static final Map<Test, TestResult> failedTests =
+			new ConcurrentHashMap<Test, TestResult>();
 
-    public void unregisterLocalMaster(final LocalMaster master) {
-        // XXX Don't forget to mark all tests as failed that depended on this
-        // slave-SH
-        System.out.println("unregister slave " + master.getSlave().getName());
-        if (masters.remove(master.getSlave().getName()) == null) {
-            throw new RuntimeException(
-                    "This is a bug. unregisterLocalMaster must never be called twice for the same master.");
-        }
-    }
+	/**
+	 * Store all successfully completed tests.
+	 */
+	private static final Map<Test, TestResult> successfulTests =
+			new ConcurrentHashMap<Test, TestResult>();
 
-    protected void evaluateNetwork() {
-        ;
-    }
+	/**
+	 * Whether testing has started. This cannot be reset.
+	 */
+	private static AtomicBoolean startedTesting = new AtomicBoolean(false);
 
-    public void startTesting() {
-        // TODO Auto-generated method stub
+	private static Set<TaskResult> taskResults =
+			new CopyOnWriteArraySet<TaskResult>();
 
-    }
+	protected static Object taskResultsLock = new Object();
 
-    public ConcurrentMap<Test, TestResult> getFailedTests() {
-        // TODO Auto-generated method stub
-        return null;
-    }
+	/**
+	 * Singleton
+	 */
+	private TestExecutorImpl() {}
 
-    public Set<Test> getNotRunTests() {
-        // TODO Auto-generated method stub
-        return null;
-    }
+	public static TestExecutor getInstance() {
+		return instance;
+	}
 
-    public ConcurrentMap<Test, TestResult> getSuccessfulTests() {
-        // TODO Auto-generated method stub
-        return null;
-    }
+	public void registerLocalMaster(final LocalMaster master) {
+		if (startedTesting.get() == true) {
+			throw new RuntimeException("Bug: Testing has started already.");
+		}
+		System.out.println("register slave " + master.getSlave().getName());
+		if (null != masters.putIfAbsent(master.getSlave().getName(), master)) {
+			throw new IllegalArgumentException(master.getSlave().getName()
+					+ " has already registered with this Server");
+		}
+	}
 
-    public void registerTest(final Test test) {
-        // TODO Auto-generated method stub
+	public void unregisterLocalMaster(final LocalMaster master) {
+		// XXX Don't forget to mark all tests as failed that depended on this
+		// slave if we have already started with testing-SH
+		System.out.println("unregister slave " + master.getSlave().getName());
+		if (masters.remove(master.getSlave().getName()) == null) {
+			throw new RuntimeException(
+					"This is a bug. unregisterLocalMaster must never be called twice for the same master.");
+		}
+	}
 
-    }
+	/**
+	 * Evaluate which tests can be run with the currently connected slaves.
+	 * Cancel all currently running tests and report them as failed if they
+	 * cannot be restarted with the new (reduced) set of connected slaves,
+	 * restart those tests otherwise. XXX This should be merged with
+	 * makeNetworks -SH
+	 */
+	protected void evaluateNetwork() {
+		if (startedTesting.get() == false) {
+			throw new RuntimeException("Bug: Testing has not been started.");
+		// XXX We need to actually check the network.-SH
+		}
+	}
 
+	public void startTesting() {
+		if (startedTesting.get() == true) {
+			throw new RuntimeException("Bug: Testing has started already.");
+		}
+		startedTesting.set(true);
+		// check which tests we can actually execute
+		evaluateNetwork();
+		System.out.println("start making networks");
+		// XXX We can probably be much smarter here and reuse networks that
+		// have been built already. Later.-SH
+		for (final Test test : newTests) {
+			makeNetworks(test);
+		}
+		final int networkCount = 0;
+		for (final LocalMaster master : masters.values()) {
+			new Thread(new TaskCollector(master)).start();
+		}
+		// XXX cancelled networks will still appear here...=SH
+		for (final Network nw : networks) {
+			final int slaveCount = nw.initializeSlaves("Network #: " + networkCount);
+			try {
+				synchronized (taskResultsLock) {
+					while (taskResults.size() < slaveCount) {
+						taskResultsLock.wait();
+					}
+
+				}
+			} catch (final InterruptedException e) {
+				System.out.println("Interrupted");
+				// XXX Mark all the tests for this network failed.-SH
+			}
+			// XXXBlock here or cancel when interrupted.... -SH
+
+		}
+	}
+
+	protected void makeNetworks(final Test test) {
+		final NetworkDescription nd = test.getNetworkDescription();
+		// XXX we want to do something much smarter here.-SH
+
+		for (final LocalMaster master : masters.values()) {
+			// XXX the name choosing doesn't make sense-SH
+			final Network nw =
+					new NetworkImpl(test.getDescription() + " slavename:"
+							+ master.getSlave().getName());
+			int necessaryClients = nd.necessaryClients();
+			while (necessaryClients >= 1) {
+				System.out.println("adding master");
+				nw.addTorInstanceForMaster(new TorInstanceImpl(), master);
+				necessaryClients--;
+			}
+			nw.addTest(test);
+			networks.add(nw);
+		}
+	}
+
+	public Map<Test, TestResult> getFailedTests() {
+		return failedTests;
+	}
+
+	public Set<Test> cannotRunTests() {
+		return cannotRunTests;
+	}
+
+	public Map<Test, TestResult> getSuccessfulTests() {
+		return successfulTests;
+	}
+
+	public void registerTest(final Test test) {
+		if (startedTesting.get() == true) {
+			throw new RuntimeException("Bug: Testing has started already.");
+		}
+		if (test == null) {
+			throw new NullPointerException("tests must not be null");
+		}
+		newTests.add(test);
+	}
+
+	private class TaskCollector implements Runnable {
+		private final LocalMaster master;
+
+		public void run() {
+			while (true) {
+				try {
+					synchronized (taskResultsLock) {
+						taskResults.add(master.getTaskResult());
+						taskResultsLock.notifyAll();
+					}
+					System.out.println("received completed task");
+				} catch (final InterruptedException e) {
+					e.printStackTrace();
+					Thread.currentThread().interrupt();
+				}
+				if (Thread.interrupted()) {
+					break;
+				}
+			}
+		}
+
+		protected TaskCollector(final LocalMaster master) {
+			this.master = master;
+		}
+
+	}
+
 }

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TestImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TestImpl.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TestImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.impl;
+
+import de.uniba.wiai.lspi.puppetor.rmi.NetworkDescription;
+import de.uniba.wiai.lspi.puppetor.rmi.Test;
+
+public class TestImpl implements Test {
+
+	/**
+	 * Required for serialization. Needs to change for new released versions.
+	 */
+	private static final long serialVersionUID = 1L;
+
+	final private String description;
+
+	/**
+	 * The network that must exist for the test to be executed.
+	 */
+	final private NetworkDescription networkDescription;
+
+	public TestImpl(final String description, final NetworkDescription network) {
+		this.description = description;
+		networkDescription = network;
+	}
+
+	public final NetworkDescription getNetworkDescription() {
+		return networkDescription;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+}

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TorInstanceImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TorInstanceImpl.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/TorInstanceImpl.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.impl;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import de.uniba.wiai.lspi.puppetor.rmi.Slave;
+import de.uniba.wiai.lspi.puppetor.rmi.TorInstance;
+
+/**
+ * Implements a Tor node. Threadsafe.
+ *
+ * @author Sebastian Hahn
+ */
+public class TorInstanceImpl implements TorInstance {
+
+	/**
+	 * Saves configuration options in an "option value" format. Synchronized
+	 * with <code>this</code>.
+	 */
+	private List<String> configuration;
+
+	/**
+	 * The svn revision of the Tor build. 0 means no specified revision.
+	 * Synchronized with <code>this</code>.
+	 */
+	private AtomicInteger revision;
+
+	/**
+	 * Whether we are a bridge authority. Synchronized with <code>this</code>.
+	 */
+	private AtomicBoolean bridgeAuthority;
+
+	/**
+	 * Whether we are a directory authority. Synchronized with <code>this</code>.
+	 */
+	private AtomicBoolean directoryAuthority;
+
+	/**
+	 * Whether we are an exit. Synchronized with <code>this</code>.
+	 */
+	private AtomicBoolean exit;
+
+	/**
+	 * Whether we are a relay. Synchronized with <code>this</code>.
+	 */
+	private AtomicBoolean relay;
+
+	/**
+	 * Whether we are a bridge. Synchronized with <code>this</code>.
+	 */
+	private AtomicBoolean bridge;
+
+	/**
+	 * Whether we are on a private network. Synchronized with <code>this</code>.
+	 */
+	private AtomicBoolean privateNetwork;
+
+	/**
+	 * Whether the configuration of the tor instance should be replaced by the
+	 * config returned from <code>this.getConfiguration()</code>.
+	 */
+	private AtomicBoolean replaceConfiguration;
+
+	private Slave slave;
+
+	public synchronized List<String> getConfiguration() {
+		return Collections.unmodifiableList(configuration);
+	}
+
+	public int getRevision() {
+		return revision.get();
+	}
+
+	public boolean isBridgeAuthority() {
+		return bridgeAuthority.get();
+	}
+
+	public boolean isDirectoryAuthority() {
+		return directoryAuthority.get();
+	}
+
+	public boolean isExit() {
+		return exit.get();
+	}
+
+	public boolean isRelay() {
+		return relay.get();
+	}
+
+	public boolean isOnPrivateNetwork() {
+		return privateNetwork.get();
+	}
+
+	public boolean shouldReplaceConfiguration() {
+		return replaceConfiguration.get();
+	}
+
+	public boolean isBridge() {
+		return bridge.get();
+	}
+
+	public synchronized void linkToSlave(final Slave slave) {
+		if (this.slave != null) {
+			throw new IllegalStateException("A TorInstance cannot be "
+					+ "reassigend to a new Slave!");
+		}
+		this.slave = slave;
+	}
+
+}

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/tasks/CreateNetworkTask.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/tasks/CreateNetworkTask.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/tasks/CreateNetworkTask.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.tasks;
+
+import java.rmi.RemoteException;
+
+import de.uniba.wiai.lspi.puppetor.NetworkFactory;
+import de.uniba.wiai.lspi.puppetor.rmi.impl.AbstractTaskImpl;
+
+public class CreateNetworkTask extends AbstractTaskImpl {
+
+	/**
+	 * Required for serialization. Needs to change for new released versions.
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public CreateNetworkTask(final String name) {
+		super(name);
+	}
+
+	@Override
+	public void execute() throws InterruptedException, RemoteException {
+		NetworkFactory.createNetwork(name);
+		reportResult(true);
+	}
+
+}

Added: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/tasks/TerminateTask.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/tasks/TerminateTask.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/tasks/TerminateTask.java	2008-07-13 16:05:31 UTC (rev 15873)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.tasks;
+
+import java.rmi.RemoteException;
+
+import de.uniba.wiai.lspi.puppetor.rmi.impl.AbstractTaskImpl;
+
+public class TerminateTask extends AbstractTaskImpl {
+
+	/**
+	 * Required for serialization. Needs to change for new released versions.
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public TerminateTask(final String name) {
+		super(name);
+	}
+
+	@Override
+	public void execute() throws InterruptedException, RemoteException {
+		Thread.currentThread().interrupt();
+	}
+
+}



More information about the tor-commits mailing list