本文整理汇总了Java中org.openrdf.repository.config.RepositoryFactory类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryFactory类的具体用法?Java RepositoryFactory怎么用?Java RepositoryFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryFactory类属于org.openrdf.repository.config包,在下文中一共展示了RepositoryFactory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testGetRepository
import org.openrdf.repository.config.RepositoryFactory; //导入依赖的package包/类
@Test
public void testGetRepository() throws Exception {
MarkLogicRepositoryConfig config = new MarkLogicRepositoryConfig();
config.setHost(host);
config.setPort(port);
config.setUser(adminUser);
config.setPassword(adminPassword);
config.setAuth("DIGEST");
RepositoryFactory factory = new MarkLogicRepositoryFactory();
Assert.assertEquals("marklogic:MarkLogicRepository", factory.getRepositoryType());
Repository repo = factory.getRepository(config);
repo.initialize();
Assert.assertTrue(repo.getConnection() instanceof MarkLogicRepositoryConnection);
Repository otherrepo = factory.getRepository(config);
otherrepo.initialize();
RepositoryConnection oconn = otherrepo.getConnection();
Assert.assertTrue(oconn instanceof MarkLogicRepositoryConnection);
}
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:22,代码来源:MarkLogicRepositoryFactoryTest.java
示例2: testGetRepositoryWithAllInOneConstructor
import org.openrdf.repository.config.RepositoryFactory; //导入依赖的package包/类
@Test
public void testGetRepositoryWithAllInOneConstructor() throws Exception {
MarkLogicRepositoryConfig config = new MarkLogicRepositoryConfig(host, port, user, password, "DIGEST");
RepositoryFactory factory = new MarkLogicRepositoryFactory();
Assert.assertEquals("marklogic:MarkLogicRepository", factory.getRepositoryType());
Repository repo = factory.getRepository(config);
repo.initialize();
Assert.assertTrue(repo.getConnection() instanceof MarkLogicRepositoryConnection);
Repository otherrepo = factory.getRepository(config);
otherrepo.initialize();
Assert.assertTrue(otherrepo.getConnection() instanceof RepositoryConnection);
}
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:16,代码来源:MarkLogicRepositoryFactoryTest.java
示例3: testGetRepository
import org.openrdf.repository.config.RepositoryFactory; //导入依赖的package包/类
@Before
public void testGetRepository() throws Exception {
MarkLogicRepositoryConfig config = new MarkLogicRepositoryConfig();
config.setHost(host);
config.setPort(restPort);
config.setUser("admin");
config.setPassword("admin");
config.setAuth("DIGEST");
RepositoryFactory factory = new MarkLogicRepositoryFactory();
Assert.assertEquals("marklogic:MarkLogicRepository", factory.getRepositoryType());
testRepository = (MarkLogicRepository) factory.getRepository(config);
testRepository.initialize();
vf = testRepository.getValueFactory();
testConn = testRepository.getConnection();
Assert.assertTrue(testRepository.getConnection() instanceof MarkLogicRepositoryConnection);
try{
Repository otherrepo = factory.getRepository(config);
RepositoryConnection conn = otherrepo.getConnection();
Assert.assertTrue(2>1);
}
catch(Exception e){
Assert.assertTrue(e instanceof RepositoryException);
}
}
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:29,代码来源:MarkLogicRepositoryTest.java
示例4: getRepositoryInstance
import org.openrdf.repository.config.RepositoryFactory; //导入依赖的package包/类
/**
* Returns a (un-initialized) Repository instance that has been configured
* based on the supplied configuration data.
*
* @param configuration The repository configuration data.
* @return The created (but un-initialized) repository.
* @throws ConfigurationException If no repository could be created due to
* invalid or incomplete configuration data.
*/
private Repository getRepositoryInstance(Graph configuration) throws ConfigurationException {
RepositoryConfig repoConfig = null;
try {
// read configuration
repoConfig = RepositoryConfig.create(configuration, null);
repoConfig.validate();
RepositoryImplConfig repoImplConfig = repoConfig.getRepositoryImplConfig();
// initialize repository factory
RepositoryRegistry registry = RepositoryRegistry.getInstance();
RepositoryFactory factory = registry.get(repoImplConfig.getType());
if (factory == null) {
throw new ConfigurationException("Unsupported repository type: "
+ repoImplConfig.getType()
+ " in repository definition (id:" + repoConfig.getID()
+ ", title:" + repoConfig.getTitle() + ")");
}
// create repository
return factory.getRepository(repoImplConfig);
} catch (RepositoryConfigException e) {
String reason = "error creating repository";
if (repoConfig != null)
reason += " (id:" + repoConfig.getID() + ", title:" + repoConfig.getTitle() + ")";
throw new ConfigurationException(reason + ": " + e.getMessage());
}
}
开发者ID:goerlitz,项目名称:rdffederator,代码行数:40,代码来源:SPLENDID.java
示例5: createRepositoryStack
import org.openrdf.repository.config.RepositoryFactory; //导入依赖的package包/类
private Repository createRepositoryStack(RepositoryImplConfig config) {
RepositoryFactory factory = RepositoryRegistry.getInstance().get(config.getType());
if (factory == null) {
throw new SesameManagerException("Unsupported repository type: " + config.getType());
}
Repository repository;
try {
repository = factory.getRepository(config);
} catch (RepositoryConfigException ex) {
throw new SesameManagerException("Could not get repository from factory",ex);
}
if (config instanceof DelegatingRepositoryImplConfig) {
RepositoryImplConfig delegateConfig = ((DelegatingRepositoryImplConfig)config).getDelegate();
Repository delegate = createRepositoryStack(delegateConfig);
try {
((DelegatingRepository)repository).setDelegate(delegate);
}
catch (ClassCastException e) {
throw new SesameManagerException(
"Delegate specified for repository that is not a DelegatingRepository: "
+ delegate.getClass());
}
}
return repository;
}
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:31,代码来源:SesameManager.java
注:本文中的org.openrdf.repository.config.RepositoryFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论