You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by mi...@apache.org on 2003/11/14 01:01:22 UTC

cvs commit: cocoon-lenya/src/java/org/apache/lenya/lucene/index ConfigurableIndexer.java

michi       2003/11/13 16:01:22

  Modified:    src/java/org/apache/lenya/lucene/index
                        ConfigurableIndexer.java
  Log:
  hardcoded filename fixed
  
  Revision  Changes    Path
  1.10      +26 -8     cocoon-lenya/src/java/org/apache/lenya/lucene/index/ConfigurableIndexer.java
  
  Index: ConfigurableIndexer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/lucene/index/ConfigurableIndexer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ConfigurableIndexer.java	13 Nov 2003 22:55:17 -0000	1.9
  +++ ConfigurableIndexer.java	14 Nov 2003 00:01:22 -0000	1.10
  @@ -93,16 +93,13 @@
        * @throws Exception DOCUMENT ME!
        */
       public DocumentCreator createDocumentCreator(Element indexer, String configFileName) throws Exception {
  -        log.error(".createDocumentCreatort(): Element name: " + indexer.getNodeName());
  +        log.debug(".createDocumentCreatort(): Element name: " + indexer.getNodeName());
   
  -        String luceneDocConfigFileName = "cmfs-luceneDoc.xconf"; // indexer/configuration/@src
  -
  -        String configurationFileName = new File(configFileName).getParent() + File.separator + luceneDocConfigFileName; // configuration.getChild("configuration").getAttribute("src");
  +        // FIXME: concat these files ...
  +        String configurationFileName = new File(configFileName).getParent() + File.separator + getLuceneDocConfigFileName(indexer);
           File configurationFile = new File(configurationFileName);
           String stylesheet = getStylesheet(configurationFile);
           return new ConfigurableDocumentCreator(stylesheet);
  -
  -        //return null;
       }
   
       public static final String CONFIGURATION_CREATOR_STYLESHEET = "org/apache/lenya/lucene/index/configuration2xslt.xsl";
  @@ -111,7 +108,7 @@
        * Converts the configuration file to an XSLT stylesheet and returns a reader that reads this stylesheet.
        */
       protected String getStylesheet(File configurationFile) throws Exception {
  -        log.error(".getStylesheet(): Configuration file: " + configurationFile.getAbsolutePath());
  +        log.debug(".getStylesheet(): Configuration file: " + configurationFile.getAbsolutePath());
   
           URL configurationCreatorURL = ConfigurableIndexer.class.getClassLoader().getResource(CONFIGURATION_CREATOR_STYLESHEET);
           File configurationStylesheetFile = new File(new URI(configurationCreatorURL.toString()));
  @@ -136,4 +133,25 @@
           String[] indexableExtensions = { "xml" };
           return new AbstractIndexer.DefaultIndexFilter(indexableExtensions);
       }
  +
  +    /**
  +     *
  +     */
  +   private String getLuceneDocConfigFileName(Element indexer) {
  +       String luceneDocConfigFileName = null;
  +
  +       org.w3c.dom.NodeList nl = indexer.getChildNodes();
  +       for (int i = 0; i < nl.getLength(); i++) {
  +           org.w3c.dom.Node node = nl.item(i);
  +           if (node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE && node.getNodeName().equals("configuration")) {
  +               log.debug(".getLuceneDocConfigFileName(): Node configuration exists!");
  +               luceneDocConfigFileName = ((Element)node).getAttribute("src");
  +           }
  +       }
  +       if (luceneDocConfigFileName == null) {
  +           log.error(".getLuceneDocConfigFileName(): ERROR: Lucene Document Configuration is not specified (indexer/configuration/@src)");
  +       }
  +       log.debug(".getLuceneDocConfigFileName(): Lucene Document Configuration: " + luceneDocConfigFileName);
  +       return luceneDocConfigFileName;
  +   }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org