![]() |
|||
DirectoryIndexer.javaGo to the documentation of this file.00001 /* 00002 * DirectoryIndexer.java 00003 * 00004 * Created on 29 octobre 2003, 11:06 00005 */ 00006 00007 package org.net2map.pov.indexer; 00008 import java.io.*; 00009 import java.util.*; 00010 import org.net2map.pov.documentsManager.*; 00015 public class DirectoryIndexer 00016 { 00017 private static org.apache.log4j.Logger logger = 00018 org.apache.log4j.Logger.getLogger(DirectoryIndexer.class.getName()); 00019 00021 public DirectoryIndexer() 00022 { 00023 logger.setLevel((org.apache.log4j.Level)org.apache.log4j.Priority.DEBUG); 00024 logger.warn("Creating..."); 00025 00026 logger.warn("...Created"); 00027 } 00028 00029 public void IndexLocalDirectory(String paramDirectoryPath) 00030 { 00031 PovDocumentsManager docmanager = null; 00032 Runtime r = Runtime.getRuntime(); 00033 File root = new File( paramDirectoryPath ); 00034 if ( root.isDirectory() ) 00035 { // if a directory 00036 String[] files = root.list(); // list its files 00037 Arrays.sort(files); // sort the files 00038 for ( int i = 0; i < files.length; i++ ) // recursively index them 00039 { 00040 logger.warn("Indexing " + files[i]); 00041 docmanager = new PovDocumentsManager( "/home/moi/index" ); 00042 docmanager.indexHtml( paramDirectoryPath + "/" + files[i], true ); 00043 docmanager = null; 00044 r.gc(); 00045 } 00046 } 00047 } 00048 00050 public static void main(String[] args) 00051 { 00052 DirectoryIndexer theDirectoryIndexer = new DirectoryIndexer(); 00053 try 00054 { 00055 theDirectoryIndexer.IndexLocalDirectory("/var/www/html/mirror"); 00056 } 00057 catch(Exception theException) 00058 { 00059 logger.fatal("EXCEPTION!", theException); 00060 } 00061 } 00062 00063 } |
|||
|
Accueil | Téléchargement | Manuel
| Doc. technique | Sources CVS |
Faq | Nous contacter
©2003 - All Rights Reserved |
|||