• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RepositoryFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MapEventsOverlay类代码示例发布时间:2022-05-23
下一篇:
Java DataResultSet类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap