嵌入OSGi的Neo4j
我想在嵌入式模式下使用neo4j。正如我所看到的,不可能在不同的进程中共享嵌入OSGi的Neo4j,osgi,neo4j,Osgi,Neo4j,我想在嵌入式模式下使用neo4j。正如我所看到的,不可能在不同的进程中共享GraphDatabase实例。现在我的想法是使用嵌入OSGi容器中的neo4j为不同的组件共享相同的db。编写一个BundleActivator来创建GraphDB,并将其与其他OSGi捆绑包一起使用服务公开,这是一个好主意吗?正在用neo4j相关组件制作一个超级捆绑包。试着让我们知道进展如何。有关典型的激活器,请参阅。现在您可以使用适当的DI来实例化DB,如 //缓存提供程序 ArrayList cacheList=新
GraphDatabase
实例。现在我的想法是使用嵌入OSGi容器中的neo4j为不同的组件共享相同的db。编写一个BundleActivator
来创建GraphDB
,并将其与其他OSGi捆绑包一起使用服务公开,这是一个好主意吗?正在用neo4j相关组件制作一个超级捆绑包。试着让我们知道进展如何。有关典型的激活器,请参阅。现在您可以使用适当的DI来实例化DB,如
//缓存提供程序
ArrayList cacheList=新的ArrayList();
添加(新的SoftCacheProvider());
//索引提供者
IndexProvider lucene=新的LuceneIndexProvider();
ArrayList provs=新的ArrayList();
批准添加(lucene);
ListIndexitable提供程序=新的ListIndexitable();
提供者。setIndexProviders(provs);
//数据库设置
GraphDatabaseFactory gdbf=新GraphDatabaseFactory();
gdbf.setIndexProviders(提供者);
gdbf.setCacheProviders(缓存列表);
db=gdbf.newEmbeddedDatabase(“target/db”);
尝试生成示例失败:未能执行目标com.mycila.maven许可证插件:maven许可证插件:1.9.0:检查(检查许可证)project neo4j osgi示例:某些文件没有预期的许可证标头
//the cache providers
ArrayList<CacheProvider> cacheList = new ArrayList<CacheProvider>();
cacheList.add( new SoftCacheProvider() );
//the index providers
IndexProvider lucene = new LuceneIndexProvider();
ArrayList<IndexProvider> provs = new ArrayList<IndexProvider>();
provs.add( lucene );
ListIndexIterable providers = new ListIndexIterable();
providers.setIndexProviders( provs );
//the database setup
GraphDatabaseFactory gdbf = new GraphDatabaseFactory();
gdbf.setIndexProviders( providers );
gdbf.setCacheProviders( cacheList );
db = gdbf.newEmbeddedDatabase( "target/db" );