/** * Copyright (c) 2013 Atlanmod INRIA LINA Mines Nantes * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Atlanmod INRIA LINA Mines Nantes - initial API and implementation * Descritpion ! To come * @author Sunye */ package fr.inria.atlanmod.neo4emf.drivers; import java.util.ArrayList; import java.util.List; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.factory.GraphDatabaseFactory; import org.neo4j.index.lucene.LuceneKernelExtensionFactory; import org.neo4j.kernel.extension.KernelExtensionFactory; import org.neo4j.kernel.impl.cache.CacheProvider; import org.neo4j.kernel.impl.cache.NoCacheProvider; import org.neo4j.kernel.impl.cache.WeakCacheProvider; public class NEConnectionFactory { public NEConnection createNEConnection(NEConfiguration configuration) { GraphDatabaseService db; NEConnection connection; // the cache providers ArrayList<CacheProvider> cacheList = new ArrayList<CacheProvider>(); System.out.println("pouetpouetpouetpouet"); cacheList.add(new WeakCacheProvider()); // the kernel extensions LuceneKernelExtensionFactory lucene = new LuceneKernelExtensionFactory(); List<KernelExtensionFactory<?>> extensions = new ArrayList<KernelExtensionFactory<?>>(); extensions.add(lucene); // the database setup GraphDatabaseFactory gdbf = new GraphDatabaseFactory(); gdbf.setKernelExtensions(extensions); gdbf.setCacheProviders(cacheList); db = gdbf.newEmbeddedDatabase(configuration.path().getAbsolutePath()); connection = new NEConnection(db, configuration); return connection; } }