licensing update to APSL 2.0
[org.ibex.jinetd.git] / src / org / ibex / jinetd / Host.java
1 // Copyright 2000-2005 the Contributors, as shown in the revision logs.
2 // Licensed under the Apache Public Source License 2.0 ("the License").
3 // You may not use this file except in compliance with the License.
4
5 package org.ibex.jinetd;
6 import org.ibex.util.*;
7 import java.io.*;
8 import java.util.*;
9 import java.lang.reflect.*;
10
11 public class Host extends Loader {
12
13     final String hostname;
14     public Host(String path, String hostname) { super(path); this.hostname = hostname; }
15
16     public void changed(Watched w) {
17         super.changed(w);
18         Log.debug(this, "changed(" + w + ")");
19         try {
20             ClassLoader cl = getClassLoader();
21             if (cl == null) return;
22             Class c = cl.loadClass("Main");
23             if (c == null) return;
24             Method m = c.getMethod("main", new Class[] { });
25             m.invoke(null, new Object[] { });
26         } catch (Exception e) {
27             Log.warn(this, "nope");
28         }
29     }
30 }