/*
 * This file is part of Nuts.
 * Copyright (C) 2009 Nuts Develop Team.
 *
 * Nuts is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License any later version.
 *
 * Nuts is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Nuts. If not, see <http://www.gnu.org/licenses/>.
 */
package nuts.demo;

import nuts.aems.WebApplet;
//import nuts.exts.lucene.store.VFSDirectory;
//
//import org.apache.commons.vfs2.FileObject;
//import org.apache.commons.vfs2.FileSystemManager;
//import org.apache.commons.vfs2.VFS;
//import org.apache.lucene.analysis.standard.StandardAnalyzer;
//import org.apache.lucene.index.IndexWriter;
//import org.apache.lucene.index.LogByteSizeMergePolicy;
//import org.apache.lucene.index.MergePolicy;
//import org.apache.lucene.index.SerialMergeScheduler;
//import org.apache.lucene.store.Directory;
//import org.apache.lucene.util.Version;

/**
 * Application
 */
public class Application extends WebApplet {

//	private static FileObject lucenePath;
//	private static Directory luceneDirectory;
//	
//	/**
//	 * @return the luceneDirectory
//	 */
//	public static Directory getLuceneDirectory() {
//		return luceneDirectory;
//	}
//
//	/**
//	 * @return the luceneIndexWriter
//	 */
//	public static IndexWriter getLuceneIndexWriter() throws Exception {
//		IndexWriter writer = new IndexWriter(Application.getLuceneDirectory(),
//			new StandardAnalyzer(Version.LUCENE_30), !lucenePath.exists(),
//			IndexWriter.MaxFieldLength.LIMITED);
//		writer.setMergeScheduler(new SerialMergeScheduler());
//		MergePolicy mp = writer.getMergePolicy();
//		if (mp instanceof LogByteSizeMergePolicy) {
//			((LogByteSizeMergePolicy)mp).setMaxMergeMB(0.9);
//		}
//		else {
//			mp = new LogByteSizeMergePolicy(writer);
//			((LogByteSizeMergePolicy)mp).setMaxMergeMB(0.9);
//			writer.setMergePolicy(mp);
//		}
//		return writer;
//	}
//
//	@Override
//	protected void initialize() throws Exception {
//		super.initialize();
//		
//		FileSystemManager fsm = VFS.getManager();
//		lucenePath = fsm.resolveFile(Application.get().getProperty("lucene.directory", "gae:///lucene"));
//		luceneDirectory = new VFSDirectory(fsm, lucenePath);
//	}
}
