01: // IndexerModule.java
02: // $Id: IndexerModule.java,v 1.4 2002/06/26 17:26:03 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1997.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.tools.resources.indexer;
07:
08: import org.w3c.tools.resources.ContainerResource;
09: import org.w3c.tools.resources.ResourceContext;
10: import org.w3c.tools.resources.ResourceReference;
11:
12: public class IndexerModule {
13: public static final String NAME = "org.w3c.jigsaw.indexer".intern();
14: private static final String INDEXER = "org.w3c.jigsaw.indexer.name"
15: .intern();
16:
17: protected IndexersCatalog catalog = null;
18:
19: public void registerIndexer(ResourceContext ctxt, String name) {
20: ctxt.registerModule(INDEXER, name);
21: }
22:
23: public ResourceReference getIndexer(ResourceContext ctxt) {
24: String idxname = (String) ctxt.getModule(INDEXER);
25: try {
26: return catalog.lookup(idxname);
27: } catch (Exception ex) {
28: // FIXME !
29: ex.printStackTrace();
30: }
31: return null;
32: }
33:
34: public ResourceReference getIndexer(String name) {
35: try {
36: return catalog.lookup(name);
37: } catch (Exception ex) {
38: return null;
39: }
40: }
41:
42: public IndexerModule(IndexersCatalog catalog) {
43: this.catalog = catalog;
44: }
45: }
|