01: // ResourceIndexFeeder.java
02: // $Id: ResourceIndexFeeder.java,v 1.2 2000/08/16 21:37:30 ylafon Exp $
03: // (c) COPYRIGHT MIT, INRIA and Keio, 1999.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigadmin.editors;
07:
08: import java.util.Properties;
09:
10: import org.w3c.jigadm.RemoteResourceWrapper;
11: import org.w3c.jigadm.editors.HttpServerResourceFeeder;
12: import org.w3c.jigadm.editors.IndexFeeder;
13:
14: import org.w3c.jigsaw.admin.RemoteResource;
15: import org.w3c.jigsaw.admin.RemoteAccessException;
16:
17: /**
18: * @version $Revision: 1.2 $
19: * @author Benoît Mahé (bmahe@w3.org)
20: */
21: public class ResourceIndexFeeder extends IndexFeeder {
22:
23: protected RemoteResource getResource(RemoteResourceWrapper rrw,
24: Properties p) {
25: String name = (String) p
26: .get(HttpServerResourceFeeder.RESOURCE_P);
27: if (name == null)
28: return null;
29: RemoteResourceWrapper w = rrw;
30: RemoteResource rm = w.getResource();
31: RemoteResource target = null;
32: do {
33: w = w.getFatherWrapper();
34: if (w != null) {
35: rm = w.getResource();
36: try {
37: if ((rm.getClassHierarchy())[0]
38: .equals("org.w3c.jigsaw.http.ConfigResource"))
39: target = rm.loadResource(name);
40: } catch (RemoteAccessException ex) {
41: ex.printStackTrace();
42: }
43: } else {
44: return null;
45: }
46: } while (target == null);
47: return target;
48: }
49:
50: }
|