summaryrefslogtreecommitdiff
path: root/src/org/noreply/fancydress/type3/HalfPath.java
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-10-17 17:34:54 +0000
committerPeter Palfrader <peter@palfrader.org>2003-10-17 17:34:54 +0000
commit46a03a3ea3c26a65e4428bc9de036a01487aeda3 (patch)
tree6a05fbfcb47a7f08eba65fc3a0f7c3e7247a629e /src/org/noreply/fancydress/type3/HalfPath.java
parentf5d3577a642e961ff247abef37e05c2399b26736 (diff)
First go at refactoring for PathSpecs
Diffstat (limited to 'src/org/noreply/fancydress/type3/HalfPath.java')
-rw-r--r--src/org/noreply/fancydress/type3/HalfPath.java51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/org/noreply/fancydress/type3/HalfPath.java b/src/org/noreply/fancydress/type3/HalfPath.java
index 14d4af6..73dfb84 100644
--- a/src/org/noreply/fancydress/type3/HalfPath.java
+++ b/src/org/noreply/fancydress/type3/HalfPath.java
@@ -1,62 +1,11 @@
/* $Id$ */
package org.noreply.fancydress.type3;
-import org.noreply.fancydress.directory.*;
-import org.noreply.fancydress.status.*;
-import org.noreply.fancydress.type3.routing.*;
-import java.util.*;
-
public class HalfPath {
private Hop[] hops;
public HalfPath(Hop[] hops) {
this.hops = hops;
}
-
- private String[] tokenize(String path) throws Mix3Exception {
- ArrayList nicks = new ArrayList();
- int indexFrom = 0;
- int indexOf;
-
- while ((indexOf = path.indexOf(',', indexFrom)) != -1) {
- String v = path.substring(indexFrom, indexOf).trim();
- if (v.equals(""))
- throw new Mix3Exception("Invalid path.");
- nicks.add( v );
- indexFrom = indexOf + 1;
- }
- String v = path.substring(indexFrom).trim();
- if (v.equals(""))
- throw new Mix3Exception("Invalid path.");
- nicks.add( v );
-
- String[] result = new String[nicks.size()];
- for (int i=0; i<result.length; i++)
- result[i] = (String) nicks.get(i);
-
- return result;
- }
-
- public HalfPath(Directory dir, String path) throws Mix3Exception {
- String[] nicks = tokenize(path);
- hops = new Hop[nicks.length];
-
- for (int i=0; i<hops.length; i++) {
- Server server = dir.getServer(nicks[i]);
- if (server == null)
- throw new Mix3Exception("Invalid path: "+nicks[i]+" not found");
- ServerDescriptor desc = server.getDescriptor();
- IncomingMMTPSection incoming = desc.getIncomingMMTPSection();
- Routing routing;
-
- if (incoming.getHostname() != null) { /* FIXME */
- routing = new RoutingHOST(incoming.getHostname(), incoming.getPort(), server.getKeyID());
- } else {
- routing = new RoutingIP4(incoming.getIP(), incoming.getPort(), server.getKeyID());
- }
- hops[i] = new Hop(routing, desc.getPacketKey());
- }
- }
-
public Hop[] getHops() {
return hops;
}