当前位置: 首页>>代码示例>>Java>>正文


Java Repository.shutDown方法代码示例

本文整理汇总了Java中org.openrdf.repository.Repository.shutDown方法的典型用法代码示例。如果您正苦于以下问题:Java Repository.shutDown方法的具体用法?Java Repository.shutDown怎么用?Java Repository.shutDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.repository.Repository的用法示例。


在下文中一共展示了Repository.shutDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testUpdateDate2

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testUpdateDate2() throws Exception {
	Repository repo = new SailRepository( new MemoryStore() );
	repo.initialize();
	RepositoryConnection rc = repo.getConnection();
	
	URI base = Utility.getUniqueUri();
	Date now = new Date();
	rc.add( new StatementImpl( base, MetadataConstants.DCT_MODIFIED,
			rc.getValueFactory().createLiteral( now ) ) );

	AbstractSesameEngine.updateLastModifiedDate( rc, null );

	List<Statement> stmts = Iterations.asList( eng.getRawConnection().
			getStatements( eng.getBaseUri(), MetadataConstants.DCT_MODIFIED,
					null, false ) );
	Literal val = Literal.class.cast( stmts.get( 0 ).getObject() );
	Date upd = getDate( val.calendarValue() );

	rc.close();
	repo.shutDown();

	// the 100 is to remove the ms, which aren't always the same because
	// they're not stored in the RDF
	assertEquals( now.getTime(), upd.getTime(), 100 );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:27,代码来源:InMemorySesameEngineTest.java

示例2: createRc

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Override
protected final void createRc( Properties p ) {
	if ( null != rc ) {
		// we've already have our rc created, so there's nothing to do here
		return;
	}

	Security.getSecurity().associateUser( this, new LocalUserImpl() );

	MemoryStore memstore = ( p.containsKey( MEMSTORE_DIR )
			? new MemoryStore( new File( p.getProperty( MEMSTORE_DIR ) ) )
			: new MemoryStore() );

	if ( p.containsKey( SYNC_DELAY ) ) {
		memstore.setSyncDelay( Long.parseLong( p.getProperty( SYNC_DELAY ) ) );
	}

	Sail sail = ( p.containsKey( INFER )
			? new ForwardChainingRDFSInferencer( memstore )
			: memstore );

	Repository repo = new SailRepository( sail );

	try {
		repo.initialize();
		rc = repo.getConnection();
	}
	catch ( Exception e ) {
		try {
			repo.shutDown();
		}
		catch ( Exception ex ) {
			log.error( ex, ex );
		}
	}

	setRepositoryConnection( rc, true );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:39,代码来源:InMemorySesameEngine.java

示例3: testCreateFromRepository

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testCreateFromRepository() throws Exception {
	Repository repo = new SailRepository( new MemoryStore() );
	repo.initialize();
	RepositoryConnection rc = repo.getConnection();
	rc.add( SRCFILE, null, RDFFormat.TURTLE );
	rc.commit();
	rc.close();

	InsightManager imi = InsightManagerImpl.createFromRepository( repo );
	repo.shutDown();

	assertEquals( 1, imi.getPerspectives().size() );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:15,代码来源:InsightManagerImplTest.java

示例4: negativeTestRepo2

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void negativeTestRepo2()
        throws Exception {

    Repository rep = new MarkLogicRepository(host, port, user, password, "DIGEST");
    rep.initialize();
    rep.shutDown();

    // should throw error as we shutdown repo
    exception.expect(RepositoryException.class);
    exception.expectMessage("MarkLogicRepository not initialized.");
    @SuppressWarnings("unused")
    RepositoryConnection conn = rep.getConnection();
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:15,代码来源:MarkLogicRepositoryTest.java

示例5: testRepo

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testRepo()
        throws Exception {

    Repository rep = new MarkLogicRepository(host, port, user, password, "DIGEST");
    rep.initialize();
    rep.shutDown();

    rep.initialize();
    Assert.assertTrue(rep.getDataDir() == null);
    Assert.assertTrue(rep.isWritable());
    Assert.assertTrue(rep.getValueFactory() instanceof ValueFactoryImpl);
    Assert.assertTrue(rep.getConnection() instanceof MarkLogicRepositoryConnection);
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:15,代码来源:MarkLogicRepositoryTest.java

示例6: TestRepoWithJavaAPIClientDatabaseClient

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void TestRepoWithJavaAPIClientDatabaseClient()
        throws Exception {
    DatabaseClient databaseClient = DatabaseClientFactory.newClient(host, port, user, password, DatabaseClientFactory.Authentication.valueOf("DIGEST"));
    Repository rep = new MarkLogicRepository(databaseClient);
    rep.initialize();
    Assert.assertTrue(rep instanceof Repository);
    RepositoryConnection conn = rep.getConnection();
    Assert.assertTrue(conn instanceof RepositoryConnection);
    conn.close();
    rep.shutDown();
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:13,代码来源:MarkLogicRepositoryTest.java

示例7: testNestedConnections

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testNestedConnections()
        throws OpenRDFException {

    MarkLogicRepositoryConfig config = new MarkLogicRepositoryConfig();
    config.setHost(host);
    config.setPort(port);
    config.setUser(user);
    config.setPassword(password);
    config.setAuth("DIGEST");

    MarkLogicRepositoryFactory FACTORY = new MarkLogicRepositoryFactory();

    ValueFactory vf = conn.getValueFactory();
    URI tommy = vf.createURI("http://marklogicsparql.com/id#4444");
    URI lname = vf.createURI("http://marklogicsparql.com/addressbook#lastName");
    Literal tommylname = vf.createLiteral("Ramone");
    Statement stmt = vf.createStatement(tommy, lname, tommylname);

    conn.add(stmt);

    conn.begin();

    Repository repo2 = FACTORY.getRepository(config);
    repo2.initialize();
    RepositoryConnection conn2 = repo2.getConnection();

    conn2.begin();
    Assert.assertEquals("The size of repository must be zero", 1, conn.size());
    conn2.commit();

    conn2.close();
    repo2.shutDown();

    conn.commit();

}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:38,代码来源:MarkLogicRepositoryConnectionTest.java

示例8: testIsolationLevel

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void  testIsolationLevel() throws Exception {
	RepositoryConnection repConn = null;
	Repository tempRep1 = null;
	try{
		MarkLogicRepositoryConfig tempConfig1 = new MarkLogicRepositoryConfig();
		tempConfig1.setHost(host);
		tempConfig1.setAuth("DIGEST");
		tempConfig1.setUser("admin");
		tempConfig1.setPassword("admin");
		tempConfig1.setPort(restPort);
		tempRep1 = new MarkLogicRepositoryFactory().getRepository(tempConfig1);
		tempRep1.initialize();
		repConn = tempRep1.getConnection();
		repConn.begin();
		repConn.add(john, fname, johnfname);
		createRepconn();
		assertThat(repConn.hasStatement(john, fname, johnfname, false), is(equalTo(true)));
		repConn.commit();
	}
	catch (Exception e){
		logger.debug(e.getMessage());
	}
	finally{
		if(repConn.isActive())
			repConn.rollback();
		tempRep1.shutDown();
		repConn.close();
		repConn = null;
		tempRep1 = null;
	}

}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:34,代码来源:MarkLogicRepositoryConnectionTest.java

示例9: createRepconn

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
private void createRepconn() throws Exception {
	RepositoryConnection repConn1 = null;
	Repository tempRep2 = null;
	try{
		MarkLogicRepositoryConfig tempConfig2 = new MarkLogicRepositoryConfig();
		tempConfig2.setHost(host);
		tempConfig2.setAuth("DIGEST");
		tempConfig2.setUser("admin");
		tempConfig2.setPassword("admin");
		tempConfig2.setPort(restPort);
		tempRep2 = new MarkLogicRepositoryFactory().getRepository(tempConfig2);
		tempRep2.initialize();
		repConn1 = tempRep2.getConnection();
		assertThat(repConn1.hasStatement(john, fname, johnfname, false), is(equalTo(false)));
	}
	catch (Exception e){
		logger.debug(e.getMessage());
	}
	finally{
		if(repConn1.isActive())
			repConn1.rollback();
		tempRep2.shutDown();
		repConn1.close();
		repConn1 = null;
		tempRep2 = null;
	}
	
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:29,代码来源:MarkLogicRepositoryConnectionTest.java

示例10: main

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, OpenRDFException {

		// load journal properties from resources
		final Properties props = loadProperties("/blazegraph.properties");

		// instantiate a sail
		final BigdataSail sail = new BigdataSail(props);
		final Repository repo = new BigdataSailRepository(sail);

		try{
			repo.initialize();
			
			/*
			 * Load data from resources 
			 * src/main/resources/data.n3
			 */
	
			loadDataFromResources(repo, "/data.n3", "");
			
			final String query = "select * {<http://blazegraph.com/blazegraph> ?p ?o}";
			final TupleQueryResult result = executeSelectQuery(repo, query, QueryLanguage.SPARQL);
			
			try {
				while(result.hasNext()){
					
					final BindingSet bs = result.next();
					log.info(bs);
					
				}
			} finally {
				result.close();
			}
		} finally {
			repo.shutDown();
		}
	}
 
开发者ID:blazegraph,项目名称:blazegraph-samples,代码行数:37,代码来源:SampleBlazegraphSesameEmbedded.java

示例11: main

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
public static void main(String[] args) throws OpenRDFException, IOException {
	
	final Repository repo = createRepository();
	
	registerCustomFunction(repo);
		
	try{
		repo.initialize();
		
		/*
		 * Load data from resources 
		 * src/main/resources/data.n3
		 */

		Utils.loadDataFromResources(repo, "data.n3", "");
										
		final TupleQueryResult result = Utils.executeSelectQuery(repo, QUERY, QueryLanguage.SPARQL);
		
		try {
			while(result.hasNext()){
				
				BindingSet bs = result.next();
				log.info(bs);
				
			}
		} finally {
			result.close();
		}
	} finally {
		repo.shutDown();
	}
}
 
开发者ID:blazegraph,项目名称:blazegraph-samples,代码行数:33,代码来源:SampleBlazegraphCustomFunctionEmbedded.java

示例12: shutDownInternal

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
/**
 * Shuts down the Sail.
 * 
 * @throws StoreException
 *         If the Sail encountered an error or unexpected internal state.
 */
@Override
protected void shutDownInternal() throws SailException {
	for (Repository rep : this.members) {
		try {
			rep.shutDown();
		} catch (RepositoryException e) {
			throw new SailException(e);
		}
	}
}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:17,代码来源:FederationSail.java

示例13: shutdown

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
/**
 * Shutdown a repository.
 * Tries to shutdown the underlying store too.
 * 
 * @param repository the repository.
 * @param store the store.
 */
void shutdown(final Repository repository) {
	if (repository != null) {
		_log.info(MessageCatalog._00012_REPOSITORY_SHUTDOWN_START);

		try {
			repository.shutDown();
			_log.info(MessageCatalog._00014_REPOSITORY_SHUTDOWN);
		} catch (final RepositoryException repositoryException) {
			_log.error(MessageCatalog._00013_REPOSITORY_SHUTDOWN_FAILURE, repositoryException);
		}
	}
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:20,代码来源:Listener.java

示例14: shutdown

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
/**
 * Shuts down a repository.
 * Tries to shutdown the underlying store too.
 * 
 * @param repository the repository.
 */
void shutdown(final Repository repository) {

	if (repository != null) {
		_log.info(MessageCatalog._00012_REPOSITORY_SHUTDOWN_START);

		try {
			repository.shutDown();
			_log.info(MessageCatalog._00014_REPOSITORY_SHUTDOWN);
		} catch (final RepositoryException repositoryException) {
			_log.error(MessageCatalog._00013_REPOSITORY_SHUTDOWN_FAILURE, repositoryException);
		}
	}
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:20,代码来源:RepositoryManager.java

示例15: createInsightStatements

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
public static void createInsightStatements( File modelquestions,
		InsightManagerImpl imi ) throws IOException, EngineManagementException {

	if ( null == modelquestions || !modelquestions.exists() ) {
		return;
	}

	Map<String, RDFFormat> extfmt = new HashMap<>();

	extfmt.put( "ttl", RDFFormat.TURTLE );
	extfmt.put( "rdf", RDFFormat.RDFXML );
	extfmt.put( "n3", RDFFormat.N3 );
	extfmt.put( "nt", RDFFormat.NTRIPLES );

	// we need to check that we actually loaded SOME perspectives, so we'll load
	// a temporary InsightManager first
	InsightManagerImpl loader = new InsightManagerImpl();

	try {
		Repository repo = new SailRepository( new MemoryStore() );
		repo.initialize();
		if ( FilenameUtils.isExtension( modelquestions.toString(), extfmt.keySet() ) ) {
			RepositoryConnection rc = repo.getConnection();
			rc.add( modelquestions, "",
					extfmt.get( FilenameUtils.getExtension( modelquestions.toString() ) ) );
			loader.loadFromRepository( rc );
			rc.close();
			repo.shutDown();
		}
	}
	catch ( RepositoryException | RDFParseException e ) {
		throw new EngineManagementException( EngineManagementException.ErrorCode.FILE_ERROR,
				e );
	}

	boolean ok = !loader.getPerspectives().isEmpty();

	if ( !ok ) {
		throw new EngineManagementException( EngineManagementException.ErrorCode.MISSING_REQUIRED_TUPLE,
				modelquestions + " does not contain any Perspectives" );
	}

	imi.addAll( loader.getPerspectives(), false );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:45,代码来源:EngineUtil2.java


注:本文中的org.openrdf.repository.Repository.shutDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。