--- /dev/null
+// PropertyFeeder.java\r
+// $Id: HttpServerResourceFeeder.java,v 1.1 2010/06/15 12:22:45 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1997.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.jigadm.editors ;\r
+\r
+import org.w3c.jigadm.RemoteResourceWrapper;\r
+\r
+import org.w3c.jigsaw.admin.RemoteAccessException;\r
+import org.w3c.jigsaw.admin.RemoteResource;\r
+\r
+import java.util.Properties;\r
+\r
+/**\r
+ * HttpServerResourceFeeder :\r
+ * @author Benoit Mahe <bmahe@sophia.inria.fr>\r
+ */\r
+public class HttpServerResourceFeeder implements EditorFeeder {\r
+\r
+ public static final String RESOURCE_P = "feeder.resource";\r
+\r
+ String[] s = null;\r
+\r
+ public String[] getDefaultItems() {\r
+ return s;\r
+ }\r
+\r
+ protected String [] getStringArray(RemoteResourceWrapper rrw, Properties p) {\r
+ String name = (String)p.get(RESOURCE_P);\r
+ if (name == null)\r
+ return new String[0];\r
+ RemoteResourceWrapper w = rrw;\r
+ RemoteResource rm = w.getResource();\r
+ RemoteResource target = null;\r
+\r
+ do {\r
+ w = w.getFatherWrapper();\r
+ if (w != null) {\r
+ rm = w.getResource();\r
+ try {\r
+ if ((rm.getClassHierarchy())[0].equals\r
+ ("org.w3c.jigsaw.http.ConfigResource"))\r
+ target = rm.loadResource(name);\r
+ } catch (RemoteAccessException ex) {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+ else \r
+ return new String[0];\r
+ } while (target == null);\r
+ try {\r
+ return target.enumerateResourceIdentifiers();\r
+ } catch (RemoteAccessException ex) {\r
+ ex.printStackTrace();\r
+ return new String[0];\r
+ }\r
+ }\r
+\r
+ public void initialize (RemoteResourceWrapper rrw, Properties p) {\r
+ s = getStringArray(rrw, p);\r
+ } \r
+\r
+}\r