Index: /trunk/java-client/Makefile
===================================================================
--- /trunk/java-client/Makefile	(revision 2108)
+++ /trunk/java-client/Makefile	(revision 2109)
@@ -18,6 +18,6 @@
 
 all : org/nzdl/gsdl/corba/gsdlInterface/corbaiface.java
-	(cd gnu/getopt && make all)
-	(cd org/nzdl/gsdl && make all)
+	(cd gnu/getopt && $(MAKE) all)
+	(cd org/nzdl/gsdl && $(MAKE) all)
 	diff --brief ./corbaiface.idl $(GREENSTONEIDLFILE)
 
@@ -36,5 +36,6 @@
 
 clean :
-	(cd org/nzdl/gsdl && make clean)
+	(cd gnu/getopt && $(MAKE) clean)
+	(cd org/nzdl/gsdl && $(MAKE) clean)
 	rm -rf docs
 	rm -rf org/nzdl/gsdl/corba
@@ -44,7 +45,8 @@
 
 test : all
-	java -classpath $(CLASSPATH) org.nzdl.gsdl.SimpleClient -a
+	java -classpath "$(CLASSPATH)" org.nzdl.gsdl.SimpleClient -a
 
 many : all
-	java -classpath $(CLASSPATH) org.nzdl.gsdl.SearchAllCollections -q "marriage customs"
+	java -classpath "$(CLASSPATH)" org.nzdl.gsdl.SearchAllCollections -q "marriage customs"
 	echo "This is causing a bunch of corba protocol errors for me.  How about you?"
+
Index: /trunk/java-client/org/nzdl/gsdl/Makefile
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/Makefile	(revision 2108)
+++ /trunk/java-client/org/nzdl/gsdl/Makefile	(revision 2109)
@@ -22,5 +22,5 @@
 #JAVACOPTIONS= -g:none -O
 
-%.class : %.java subdirs
+%.class : %.java
 	$(JAVAC) $(JAVACOPTIONS)  $<
 
Index: /trunk/java-client/org/nzdl/gsdl/ptp/Connection.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/ptp/Connection.java	(revision 2109)
+++ /trunk/java-client/org/nzdl/gsdl/ptp/Connection.java	(revision 2109)
@@ -0,0 +1,230 @@
+/*
+ *    TODO.java
+ *    Copyright (C) 2000 Stuart Yeates 
+ *
+ *    This program is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    This program is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with this program; if not, write to the Free Software
+ *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+// the package we're in
+package org.nzdl.gsdl.ptp;
+
+// java standard library classes used
+import java.io.IOException;
+import java.io.Reader;
+import java.io.InputStreamReader;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.Serializable;
+//import java.io.;
+import java.util.*;
+import java.net.*;
+
+/**
+ * Class ...
+ *
+ * Based on algorithms in ...
+ *
+ * @author stuart yeates (say1@cs.waikato.ac.nz)
+ * @version $Revision$
+ * @see
+ * @see
+ * @see
+ * 
+ */
+
+public class Connection extends Thread
+{
+  // queries ...
+  public static final String WHOAREYOU = "WHO ARE YOU?";
+  public static final String WHODOYOUKNOW = "WHO DO YOU KNOW?";
+  public static final String HELPREQUEST = "HELP?";
+  public static final String WHATVERSIONAREYOU = "WHAT VERSION ARE YOU?";
+  public static final String OUT = "OUT.";
+
+  // responses
+  public static final String IAMIOR = "I AM IOR:";
+  public static final String IAMHTTP = "I AM HTTP:";
+  public static final String IAMP2P = "I AM P2P:";
+
+  public static final String IKNOWIOR = "I AM IOR:";
+  public static final String IKNOWHTTP = "I AM HTTP:";
+  public static final String IKNOWP2P = "I AM P2P:";
+
+  public static final String HELPRESPONSE = "HELP "; // note the space ...
+
+  public static final String VERSION = "VERSION ";
+
+  boolean server = false;
+  boolean connectionClosed = false;
+
+  int port = 0;
+  String remoteHostName = "";
+  InetAddress  remoteHost = null;
+
+  Socket socket = null;
+  Reader input = null;
+  Writer output = null;
+ 
+  Connection(String host, int port) {
+    new Thread("Client") ;
+    server = false;
+
+    this.port = port;
+    this.remoteHostName = host;
+    try {
+      remoteHost = InetAddress.getByName(remoteHostName);
+      socket = new Socket(remoteHost, port, InetAddress.getLocalHost(), 4567);
+    } catch (Exception exception) {
+      System.err.println("caught exception: "+exception);
+    }
+    try {
+      input = new InputStreamReader(new BufferedInputStream(socket.getInputStream()));
+      output = new OutputStreamWriter(new BufferedOutputStream(socket.getOutputStream()));  
+    } catch (IOException exception) {
+      System.err.println("caught exception: "+exception);
+    }
+  }
+  Connection(Socket socket) {
+    new Thread("Server") ;
+    server = true;
+    setPriority(MIN_PRIORITY);
+
+    this.socket = socket;
+    port = socket.getPort();
+    remoteHost = socket.getInetAddress();
+    remoteHostName = remoteHost.getHostName();
+
+    try {
+      input = new InputStreamReader(new BufferedInputStream(socket.getInputStream()));
+      output = new OutputStreamWriter(new BufferedOutputStream(socket.getOutputStream()));  
+    } catch (IOException exception) {
+      System.err.println("caught exception: "+exception);
+    }
+  }
+
+  String readline() throws IOException {
+    StringBuffer buff = new StringBuffer(1000);
+    while (true) {
+      int c = input.read();
+      if (c == '\n' || c == '\r')
+	return buff.toString();
+      buff.append((char)c);
+    }
+  }
+
+  public void run() {
+    try {
+      while (!server || !connectionClosed) {
+	String line = readline();    
+	reply(line);
+      }
+    } catch (Exception exception) {
+      System.err.println("caught exception:" + exception);
+      connectionClosed = true;
+    }
+  }
+  
+  int reply(String line) throws IOException {
+
+    String first = line.substring(0,WHOAREYOU.length());
+    if (first.compareToIgnoreCase(WHOAREYOU) == 0) {
+      System.err.println("We were asked who we are ...");
+      return whoWeAre();
+    }
+
+    first = line.substring(0,WHODOYOUKNOW.length());
+    if (first.compareToIgnoreCase(WHODOYOUKNOW) == 0) {
+      System.err.println("We were asked who we know ...");
+      return whoWeKnow();
+    }
+
+    first = line.substring(0,HELPREQUEST.length());
+    if (first.compareToIgnoreCase(HELPREQUEST) == 0) {
+      System.err.println("We were asked for help ...");
+      return help();
+    }
+
+    first = line.substring(0,WHATVERSIONAREYOU.length());
+    if (first.compareToIgnoreCase(WHATVERSIONAREYOU) == 0) {
+      System.err.println("We were asked what verrsion we are ...");
+      return whatVersionAreWe();
+    }
+
+    first = line.substring(0,OUT.length());
+    if (first.compareToIgnoreCase(OUT) == 0) {
+      System.err.println("We were asked to close the connection ...");
+      connectionClosed = true;
+      return gracefulClose();
+    }
+    System.err.println("Nothing matched \"" + line + "\" sending help ...");
+    return help();
+  }
+
+  int gracefulClose() 
+  {
+    return -1;
+  }
+
+
+  int whoWeAre() throws IOException {
+    output.write("I AM IOR:1234567890");
+    output.write("I AM HTTP://www.someplace");
+    output.write("I AM P2P:www.someplace:4444");
+    return 3;
+  }
+
+  int whoWeKnow() throws IOException {
+    output.write("I KNOW IOR:12345678901");
+    output.write("I KNOW IOR:12345678902");
+    output.write("I KNOW HTTP://www.someplace.else");
+    output.write("I KNOW HTTP://www.someplace.elsewhere");
+    output.write("I KNOW P2P:www.someplace:4444:A");
+    output.write("I KNOW P2P:www.someplace:4444:B");
+    return 6;
+  }
+
+  int help() throws IOException {
+    output.write("HELP: This is NZDL P2P protocol $Revision$");
+    output.write("HELP: There are five valid commands:");
+    output.write("HELP: WHO ARE YOU?");
+    output.write("HELP: WHO DO YOU KNOW?");
+    output.write("HELP: WHAT VERSION ARE YOU?");
+    output.write("HELP: HELP");
+    output.write("HELP: OUT");
+    return 7;
+  }
+
+  int whatVersionAreWe() throws IOException {
+    output.write("VERSION: Protocol: NZDL-P2P-0.1 ");
+    output.write("VERSION: Implementation: $Revision$");
+    return 2;
+  }
+
+  /**
+   * Tests...
+   *
+   * 
+   * @exception java.io.IOException when ...
+   * @param args the arguments ...
+   */
+
+  public static void main(String args[]) throws IOException
+  {
+
+  }
+}
+
Index: /trunk/java-client/org/nzdl/gsdl/ptp/HTTP.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/ptp/HTTP.java	(revision 2109)
+++ /trunk/java-client/org/nzdl/gsdl/ptp/HTTP.java	(revision 2109)
@@ -0,0 +1,74 @@
+/*
+ *    HTTP.java
+ *    Copyright (C) 2000 Stuart Yeates 
+ *
+ *    This program is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    This program is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with this program; if not, write to the Free Software
+ *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+// the package we're in
+package org.nzdl.gsdl.ptp;
+
+// java standard library classes used
+import java.io.IOException;
+import java.io.Reader;
+import java.io.InputStreamReader;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.Serializable;
+//import java.io.;
+import java.util.*;
+import java.net.*;
+
+/**
+ * Class ...
+ *
+ * Based on algorithms in ...
+ *
+ * @author stuart yeates (say1@cs.waikato.ac.nz)
+ * @version $Revision$
+ * @see
+ * @see
+ * @see
+ * 
+ */
+
+class HTTP extends Locator {
+  // TODO
+  String host;
+  int port;
+  int file;
+
+  HTTP(int port, String host, String file) {
+    this.port = port;
+    this.host = host;
+    this.file = file;
+  }
+
+  /**
+   * Tests...
+   *
+   * 
+   * @exception java.io.IOException when ...
+   * @param args the arguments ...
+   */
+
+  public static void main(String args[]) throws IOException
+  {
+
+  }
+}
+
Index: /trunk/java-client/org/nzdl/gsdl/ptp/IOR.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/ptp/IOR.java	(revision 2109)
+++ /trunk/java-client/org/nzdl/gsdl/ptp/IOR.java	(revision 2109)
@@ -0,0 +1,75 @@
+/*
+ *    TODO.java
+ *    Copyright (C) 2000 Stuart Yeates 
+ *
+ *    This program is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    This program is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with this program; if not, write to the Free Software
+ *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+// the package we're in
+package org.nzdl.gsdl.ptp;
+
+// java standard library classes used
+import java.io.IOException;
+import java.io.Reader;
+import java.io.InputStreamReader;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.Serializable;
+//import java.io.;
+import java.util.*;
+import java.net.*;
+
+/**
+ * Class ...
+ *
+ * Based on algorithms in ...
+ *
+ * @author stuart yeates (say1@cs.waikato.ac.nz)
+ * @version $Revision$
+ * @see
+ * @see
+ * @see
+ * 
+ */
+
+class IOR extends Locator{
+  // TODO
+  String clean (String str) { return str; } ;
+
+  boolean valid (String str) { 
+    String match = "IOR:";
+    String first = str.substring(0,match.length());
+    if (first.compareToIgnoreCase(match) == 0) {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * Tests...
+   *
+   * 
+   * @exception java.io.IOException when ...
+   * @param args the arguments ...
+   */
+
+  public static void main(String args[]) throws IOException
+  {
+
+  }
+}
+
Index: /trunk/java-client/org/nzdl/gsdl/ptp/Makefile
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/ptp/Makefile	(revision 2109)
+++ /trunk/java-client/org/nzdl/gsdl/ptp/Makefile	(revision 2109)
@@ -0,0 +1,34 @@
+#name/location of java compiler
+JAVAC=javac
+
+#javac options
+#JAVACOPTIONS= -g:none -O
+JAVACOPTIONS= -deprecation -g:lines
+
+#complete compilation
+JAVACOMPILE=$(JAVAC) $(JAVACOPTIONS)
+
+#make a .class file from a .java file
+%.class: %.java
+	$(JAVAC) $(JAVACOPTIONS)  $<
+
+CLASSFILES=HTTP.class \
+  IOR.class \
+  P2P.class \
+  Poller.class \
+  Node.class \
+  Connection.class 
+
+all: $(CLASSFILES)
+
+clean:
+	rm -f *.class
+	rm -f *.html
+
+
+
+
+
+
+
+
Index: /trunk/java-client/org/nzdl/gsdl/ptp/Node.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/ptp/Node.java	(revision 2108)
+++ /trunk/java-client/org/nzdl/gsdl/ptp/Node.java	(revision 2109)
@@ -19,5 +19,5 @@
 
 // the package we're in
-package org.nzdl.ptp;
+package org.nzdl.gsdl.ptp;
 
 // java standard library classes used
@@ -34,4 +34,5 @@
 import java.net.*;
 
+
 /**
  * Class ...
@@ -47,328 +48,5 @@
  */
 
-class Connection extends Thread
-{
-  // queries ...
-  public static final String WHOAREYOU = "WHO ARE YOU?";
-  public static final String WHODOYOUKNOW = "WHO DO YOU KNOW?";
-  public static final String HELPREQUEST = "HELP?";
-  public static final String WHATVERSIONAREYOU = "WHAT VERSION ARE YOU?";
-  public static final String OUT = "OUT.";
-
-  // responses
-  public static final String IAMIOR = "I AM IOR:";
-  public static final String IAMHTTP = "I AM HTTP:";
-  public static final String IAMP2P = "I AM P2P:";
-
-  public static final String IKNOWIOR = "I AM IOR:";
-  public static final String IKNOWHTTP = "I AM HTTP:";
-  public static final String IKNOWP2P = "I AM P2P:";
-
-  public static final String HELPRESPONSE = "HELP "; // note the space ...
-
-  public static final String VERSION = "VERSION ";
-
-  boolean server = false;
-  boolean connectionClosed = false;
-
-  int port = 0;
-  String remoteHostName = "";
-  InetAddress  remoteHost = null;
-
-  Socket socket = null;
-  Reader input = null;
-  Writer output = null;
- 
-  Connection(String host, int port) {
-    new Thread("Client") ;
-    server = false;
-
-    this.port = port;
-    this.remoteHostName = host;
-    try {
-      remoteHost = InetAddress.getByName(remoteHostName);
-      socket = new Socket(remoteHost, port, InetAddress.getLocalHost(), 4567);
-    } catch (Exception exception) {
-      System.err.println("caught exception: "+exception);
-    }
-    try {
-      input = new InputStreamReader(new BufferedInputStream(socket.getInputStream()));
-      output = new OutputStreamWriter(new BufferedOutputStream(socket.getOutputStream()));  
-    } catch (IOException exception) {
-      System.err.println("caught exception: "+exception);
-    }
-  }
-  Connection(Socket socket) {
-    new Thread("Server") ;
-    server = true;
-    setPriority(MIN_PRIORITY);
-
-    this.socket = socket;
-    port = socket.getPort();
-    remoteHost = socket.getInetAddress();
-    remoteHostName = remoteHost.getHostName();
-
-    try {
-      input = new InputStreamReader(new BufferedInputStream(socket.getInputStream()));
-      output = new OutputStreamWriter(new BufferedOutputStream(socket.getOutputStream()));  
-    } catch (IOException exception) {
-      System.err.println("caught exception: "+exception);
-    }
-  }
-
-  String readline() throws IOException {
-    StringBuffer buff = new StringBuffer(1000);
-    while (true) {
-      int c = input.read();
-      if (c == '\n' || c == '\r')
-	return buff.toString();
-      buff.append((char)c);
-    }
-  }
-
-  public void run() {
-    try {
-      while (!server || !connectionClosed) {
-	String line = readline();    
-	reply(line);
-      }
-    } catch (Exception exception) {
-      System.err.println("caught exception:" + exception);
-      connectionClosed = true;
-    }
-  }
-  
-  int reply(String line) throws IOException {
-
-    String first = line.substring(0,WHOAREYOU.length());
-    if (first.compareToIgnoreCase(WHOAREYOU) == 0) {
-      System.err.println("We were asked who we are ...");
-      return whoWeAre();
-    }
-
-    first = line.substring(0,WHODOYOUKNOW.length());
-    if (first.compareToIgnoreCase(WHODOYOUKNOW) == 0) {
-      System.err.println("We were asked who we know ...");
-      return whoWeKnow();
-    }
-
-    first = line.substring(0,HELPREQUEST.length());
-    if (first.compareToIgnoreCase(HELPREQUEST) == 0) {
-      System.err.println("We were asked for help ...");
-      return help();
-    }
-
-    first = line.substring(0,WHATVERSIONAREYOU.length());
-    if (first.compareToIgnoreCase(WHATVERSIONAREYOU) == 0) {
-      System.err.println("We were asked what verrsion we are ...");
-      return whatVersionAreWe();
-    }
-
-    first = line.substring(0,OUT.length());
-    if (first.compareToIgnoreCase(OUT) == 0) {
-      System.err.println("We were asked to close the connection ...");
-      connectionClosed = true;
-      return gracefulClose();
-    }
-    System.err.println("Nothing matched \"" + line + "\" sending help ...");
-    return help();
-  }
-
-  int gracefulClose() 
-  {
-    return -1;
-  }
-
-
-  int whoWeAre() throws IOException {
-    output.write("I AM IOR:1234567890");
-    output.write("I AM HTTP://www.someplace");
-    output.write("I AM P2P:www.someplace:4444");
-    return 3;
-  }
-
-  int whoWeKnow() throws IOException {
-    output.write("I KNOW IOR:12345678901");
-    output.write("I KNOW IOR:12345678902");
-    output.write("I KNOW HTTP://www.someplace.else");
-    output.write("I KNOW HTTP://www.someplace.elsewhere");
-    output.write("I KNOW P2P:www.someplace:4444:A");
-    output.write("I KNOW P2P:www.someplace:4444:B");
-    return 6;
-  }
-
-  int help() throws IOException {
-    output.write("HELP: This is NZDL P2P protocol $Revision$");
-    output.write("HELP: There are five valid commands:");
-    output.write("HELP: WHO ARE YOU?");
-    output.write("HELP: WHO DO YOU KNOW?");
-    output.write("HELP: WHAT VERSION ARE YOU?");
-    output.write("HELP: HELP");
-    output.write("HELP: OUT");
-    return 7;
-  }
-
-  int whatVersionAreWe() throws IOException {
-    output.write("VERSION: Protocol: NZDL-P2P-0.1 ");
-    output.write("VERSION: Implementation: $Revision$");
-    return 2;
-  }
-}
-  /**
-   *
-   * 
-   * @exception java.io.IOException when ...
-   * @param arg2 ... 
-   * @param arg1 ...
-   * @return ...
-   * @see
-   * @see
-   */
-
-
-class Poller extends Thread {
-  int secondsBetweenPollCycles = 60; 
-  
-  
-  public void run() {
-    while (true) {
-      poll();
-      try {
-	sleep(secondsBetweenPollCycles * 1000);
-      } catch (InterruptedException exception) {
-	System.err.println("caught exception: "+exception);
-	return;
-      }
-    }
-  }
-
-  void poll() {
-    Enumeration e = Node.knownList.propertyNames();
-    while (e.hasMoreElements()) {
-      String next = (String) e.nextElement();
-      if (P2P.valid(next)) {
-	System.err.println("About to create new thread for " + next);
-	Connection connection = 
-	  new Connection(P2P.toHost(next),P2P.toPort(next));
-	System.err.println("About to start new thread");
-	connection.run();
-	System.err.println("About to wait for new thread");
-	try {
-	  connection.join();
-	} catch (InterruptedException exception) {
-	  System.err.println("caught exception: "+ exception);
-	  return;
-	}
-	System.err.println("Joined with new thread");
-      }	
-    }
-  }
-
-}
-
-class IOR {
-  // TODO
-  String clean (String str) { return str; } ;
-
-  boolean valid (String str) { 
-    String match = "IOR:";
-    String first = str.substring(0,match.length());
-    if (first.compareToIgnoreCase(match) == 0) {
-      return true;
-    }
-    return false;
-  }
-
-}
-class P2P {
-  // TODO
-  static String clean (String str) { return str; } ;
-
-  static boolean valid (String str) { 
-    String match = "P2P:";
-    String first = str.substring(0,match.length());
-    if (first.compareToIgnoreCase(match) == 0) {
-      return true;
-    }
-    return false;
-  }
-  static int toPort (String str) {
-    StringBuffer leading = new StringBuffer();
-    StringBuffer host = new StringBuffer();
-    StringBuffer port = new StringBuffer();
-    StringBuffer trailing = new StringBuffer();
-
-    int i = 0;
-    while(i < str.length() && str.charAt(i) != ':') {
-      leading.append(str.charAt(i));
-      i++;
-    } 
-    i++;
-    while(i < str.length() && str.charAt(i) != ':') {
-      host.append(str.charAt(i));
-      i++;
-    } 
-    i++;
-    while(i < str.length() && Character.isDigit(str.charAt(i)) ) {
-      port.append(str.charAt(i));
-      i++;
-    } 
-    while(i < str.length() ) {
-      trailing.append(str.charAt(i));
-      i++;
-    } 
-    System.err.println("P2P parsed \"" + str + "\" into host = \"" + 
-		       host + "\" and port = \"" + port + "\"");
-    return Integer.parseInt(port.toString());
-    
-  }
-  static String toHost (String str) {
-    StringBuffer leading = new StringBuffer();
-    StringBuffer host = new StringBuffer();
-    StringBuffer port = new StringBuffer();
-    StringBuffer trailing = new StringBuffer();
-
-    int i = 0;
-    while(i < str.length() && str.charAt(i) != ':') {
-      leading.append(str.charAt(i));
-      i++;
-    } 
-    i++;
-    while(i < str.length() && str.charAt(i) != ':') {
-      host.append(str.charAt(i));
-      i++;
-    } 
-    i++;
-    while(i < str.length() && Character.isDigit(str.charAt(i)) ) {
-      port.append(str.charAt(i));
-      i++;
-    } 
-    while(i < str.length() ) {
-      trailing.append(str.charAt(i));
-      i++;
-    } 
-    System.err.println("P2P parsed \"" + str  + "\" into host = \"" + 
-		       host + "\" and port = \"" + port + "\"");
-    return host.toString();
-
-  }
-}
-
-class HTTP {
-  // TODO
-  String clean (String str) { return str; } ;
-
-  boolean valid (String str) { 
-    String match = "HTTP:";
-    String first = str.substring(0,match.length());
-    if (first.compareToIgnoreCase(match) == 0) {
-      return true;
-    }
-    return false;
-  }
-
-}
-
-class Node {
+public class Node {
 
   static Properties knownList = new Properties();
@@ -404,5 +82,6 @@
     
     // start the poller ...
-    new Poller().run();
+    Poller poller = new Poller();
+    poller.run();
   
   }
Index: /trunk/java-client/org/nzdl/gsdl/ptp/P2P.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/ptp/P2P.java	(revision 2109)
+++ /trunk/java-client/org/nzdl/gsdl/ptp/P2P.java	(revision 2109)
@@ -0,0 +1,77 @@
+/*
+ *    P2P.java
+ *    Copyright (C) 2000 Stuart Yeates 
+ *
+ *    This program is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    This program is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with this program; if not, write to the Free Software
+ *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+// the package we're in
+package org.nzdl.gsdl.ptp;
+
+// java standard library classes used
+import java.io.IOException;
+import java.io.Reader;
+import java.io.InputStreamReader;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.Serializable;
+//import java.io.;
+import java.util.*;
+import java.net.*;
+
+/**
+ * Class ...
+ *
+ * Based on algorithms in ...
+ *
+ * @author stuart yeates (say1@cs.waikato.ac.nz)
+ * @version $Revision$
+ * @see
+ * @see
+ * @see
+ * 
+ */
+
+public class P2P extends Locator{
+  int port;
+  String host;
+  
+  P2P(String host, int port) {
+    this.host = host;
+    this.port = port;
+  }
+  String toString() {
+    return "P2P:" + host + ":" + port;
+  }
+
+
+  /**
+   * Tests...
+   *
+   *
+   * @exception java.io.IOException when ...
+   * @param args the arguments ...
+   */
+
+  public static void main(String args[]) throws IOException
+  {
+
+  }
+
+}
+
+
Index: /trunk/java-client/org/nzdl/gsdl/ptp/Poller.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/ptp/Poller.java	(revision 2109)
+++ /trunk/java-client/org/nzdl/gsdl/ptp/Poller.java	(revision 2109)
@@ -0,0 +1,108 @@
+/*
+ *    Poller.java
+ *    Copyright (C) 2000 Stuart Yeates 
+ *
+ *    This program is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    This program is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with this program; if not, write to the Free Software
+ *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+// the package we're in
+package org.nzdl.gsdl.ptp;
+
+// java standard library classes used
+import java.io.IOException;
+import java.io.Reader;
+import java.io.InputStreamReader;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.Serializable;
+//import java.io.;
+import java.util.*;
+import java.net.*;
+
+/**
+ * Class ...
+ *
+ * Based on algorithms in ...
+ *
+ * @author stuart yeates (say1@cs.waikato.ac.nz)
+ * @version $Revision$
+ * @see
+ * @see
+ * @see
+ * 
+ */
+
+public class Poller extends Thread {
+  int secondsBetweenPollCycles = 60; 
+  
+  public Poller() {
+
+  }
+
+  public void run() {
+    while (true) {
+      poll();
+      try {
+	sleep(secondsBetweenPollCycles * 1000);
+      } catch (InterruptedException exception) {
+	System.err.println("caught exception: "+exception);
+	return;
+      }
+    }
+  }
+
+  void poll() {
+    Enumeration e = Node.knownList.propertyNames();
+    while (e.hasMoreElements()) {
+      String next = (String) e.nextElement();
+      if (P2P.valid(next)) {
+	System.err.println("About to create new thread for " + next);
+	Connection connection = 
+	  new Connection(P2P.toHost(next),P2P.toPort(next));
+	System.err.println("About to start new thread");
+	connection.run();
+	System.err.println("About to wait for new thread");
+	try {
+	  connection.join();
+	} catch (InterruptedException exception) {
+	  System.err.println("caught exception: "+ exception);
+	  return;
+	}
+	System.err.println("Joined with new thread");
+      }	
+    }
+  }
+
+   /**
+   * Tests...
+   *
+   * 
+   * @exception java.io.IOException when ...
+   * @param args the arguments ...
+   */
+
+  public static void main(String args[]) throws IOException
+  {
+
+  }
+
+}
+
+
+
+
+
