Search in sources :

Example 36 with ForumException

use of net.jforum.exceptions.ForumException in project jforum2 by rafaelsteil.

the class LuceneManager method init.

/**
 * @see net.jforum.search.SearchManager#init()
 */
public void init() {
    try {
        Analyzer analyzer = (Analyzer) Class.forName(SystemGlobals.getValue(ConfigKeys.LUCENE_ANALYZER)).newInstance();
        this.settings = new LuceneSettings(analyzer);
        this.settings.useFSDirectory(SystemGlobals.getValue(ConfigKeys.LUCENE_INDEX_WRITE_PATH));
        this.removeLockFile();
        this.indexer = new LuceneIndexer(this.settings);
        this.search = new LuceneSearch(this.settings, new LuceneContentCollector(this.settings));
        this.indexer.watchNewDocuDocumentAdded(this.search);
        SystemGlobals.setObjectValue(ConfigKeys.LUCENE_SETTINGS, this.settings);
    } catch (Exception e) {
        throw new ForumException(e);
    }
}
Also used : ForumException(net.jforum.exceptions.ForumException) Analyzer(org.apache.lucene.analysis.Analyzer) IOException(java.io.IOException) ForumException(net.jforum.exceptions.ForumException)

Example 37 with ForumException

use of net.jforum.exceptions.ForumException in project jforum2 by rafaelsteil.

the class SystemGlobals method loadAdditionalDefaults.

/**
 * Merge additional configuration defaults
 *
 * @param file File from which to load the additional defaults
 */
public static void loadAdditionalDefaults(String file) {
    if (!new File(file).exists()) {
        logger.info("Cannot find file " + file + ". Will ignore it");
        return;
    }
    try {
        FileInputStream input = new FileInputStream(file);
        globals.installation.load(input);
        input.close();
    } catch (IOException e) {
        throw new ForumException(e);
    }
    if (!additionalDefaultsList.contains(file)) {
        additionalDefaultsList.add(file);
    }
}
Also used : ForumException(net.jforum.exceptions.ForumException) IOException(java.io.IOException) File(java.io.File) FileInputStream(java.io.FileInputStream)

Aggregations

ForumException (net.jforum.exceptions.ForumException)37 IOException (java.io.IOException)24 FileInputStream (java.io.FileInputStream)10 File (java.io.File)7 Iterator (java.util.Iterator)6 Properties (java.util.Properties)6 DatabaseException (net.jforum.exceptions.DatabaseException)6 List (java.util.List)5 SQLException (java.sql.SQLException)4 CacheEngineStartupException (net.jforum.exceptions.CacheEngineStartupException)4 SchedulerException (org.quartz.SchedulerException)4 FileOutputStream (java.io.FileOutputStream)3 PreparedStatement (java.sql.PreparedStatement)3 Enumeration (java.util.Enumeration)3 Statement (java.sql.Statement)2 ArrayList (java.util.ArrayList)2 SAXParser (javax.xml.parsers.SAXParser)2 Post (net.jforum.entities.Post)2 User (net.jforum.entities.User)2 SSO (net.jforum.sso.SSO)2