1 package org.xvsm.remote.freepastry;
2
3 import java.net.URI;
4 import java.net.URISyntaxException;
5 import java.util.Hashtable;
6
7 import org.xvsm.remote.interfaces.IMarshaller;
8 import org.xvsm.remote.interfaces.ITransportListener;
9
10 /***
11 * implementation of the ITransportListener interface.
12 * The functionality (run) is provided by FreePastryApplication and not by this class!
13 *
14 * @author Hannu-Daniel Goiss
15 */
16 public class FreePastryTransportListener implements ITransportListener<byte[]> {
17 private Hashtable<String, String> env;
18 private FreePastryConnection freepastryConnection;
19 private FreePastryApplication application;
20 /***
21 * The URI where the listener should listen.
22 */
23 private URI uri;
24
25 /***
26 * The Marshaller that should be used.
27 */
28 private IMarshaller<byte[]> marshaller;
29
30 public URI getUri() {
31 return uri;
32 }
33
34 public void setEnvironmentVariable(Hashtable<String, String> env) {
35 this.env = env;
36
37 env.put("Port", uri.toString().substring(uri.toString().lastIndexOf(":")+1));
38
39 freepastryConnection = FreePastryConnection.getInstance(env);
40
41 application = FreePastryApplication.getInstance(freepastryConnection.getPastryNode(), marshaller);
42 }
43
44 public void setMarshaller(IMarshaller<byte[]> m) {
45 marshaller = m;
46 }
47
48 public void setURI(URI uri) {
49 try {
50 uri = new URI(uri.getScheme()+"://"+uri.getHost()+":"+uri.getPort());
51 }
52 catch(URISyntaxException urise) {
53 urise.printStackTrace();
54 }
55
56 this.uri = uri;
57 }
58
59 public void stop() {
60 }
61
62
63
64
65 public void run() {
66
67 }
68
69 }