本文整理汇总了Java中org.eclipse.rdf4j.repository.Repository.shutDown方法的典型用法代码示例。如果您正苦于以下问题:Java Repository.shutDown方法的具体用法?Java Repository.shutDown怎么用?Java Repository.shutDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.rdf4j.repository.Repository
的用法示例。
在下文中一共展示了Repository.shutDown方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRepconn
import org.eclipse.rdf4j.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;
}
}
示例2: negativeTestRepo2
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
@Test
public void negativeTestRepo2()
throws Exception {
Repository rep = new MarkLogicRepository(host, port, new DatabaseClientFactory.DigestAuthContext(user, password));
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();
}
示例3: testRepo
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
@Test
public void testRepo()
throws Exception {
Repository rep = new MarkLogicRepository(host, port, new DatabaseClientFactory.DigestAuthContext(user, password));
rep.initialize();
rep.shutDown();
rep.initialize();
Assert.assertTrue(rep.getDataDir() == null);
Assert.assertTrue(rep.isWritable());
Assert.assertTrue(rep.getValueFactory() instanceof SimpleValueFactory);
Assert.assertTrue(rep.getConnection() instanceof MarkLogicRepositoryConnection);
}
示例4: TestRepoWithJavaAPIClientDatabaseClient
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
@Test
public void TestRepoWithJavaAPIClientDatabaseClient()
throws Exception {
DatabaseClient databaseClient = DatabaseClientFactory.newClient(host, port, new DatabaseClientFactory.DigestAuthContext(user, password));
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();
}
示例5: testNestedConnections
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
@Test
public void testNestedConnections()
throws RDF4JException {
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();
IRI tommy = vf.createIRI("http://marklogicsparql.com/id#4444");
IRI lname = vf.createIRI("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();
}
示例6: testIsolationLevel
import org.eclipse.rdf4j.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;
}
}
示例7: main
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
/**
* Main program
*
* @param args
*/
public static void main(String[] args) {
logger.info("-- START --");
if (args.length < 2) {
logger.error("No input or output file");
System.exit(-1);
}
Optional<RDFFormat> fmtin = Rio.getParserFormatForFileName(args[0]);
if(!fmtin.isPresent()) {
logger.error("No parser for input {}", args[0]);
System.exit(-2);
}
int code = 0;
Repository repo = new SailRepository(new MemoryStore());
repo.initialize();
Serializer s = getSerializer();
s.setOutputFile(new File(args[1]));
try (RepositoryConnection con = repo.getConnection()) {
con.add(new File(args[0]), "http://data.gov.be", fmtin.get());
XMLStreamWriter w = s.getXMLStreamWriter();
w.writeStartDocument();
writeCatalog(w, con);
w.writeEndDocument();
w.close();
} catch (IOException|XMLStreamException|SaxonApiException ex) {
logger.error("Error converting", ex);
System.exit(-1);
} finally {
repo.shutDown();
}
}
示例8: shutdown
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
public void shutdown() {
for (Repository repo : repoMap.values()) {
if (repo.isInitialized())
try {
repo.shutDown();
} catch (RepositoryException e) {
logger.warn("Failed to shutdown repo {}", repo);
}
}
}
示例9: main
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
/**
* Main program
*
* @param args
*/
public static void main(String[] args) {
logger.info("-- START --");
if (args.length < 2) {
logger.error("No input or output file");
System.exit(-1);
}
Optional<RDFFormat> fmtin = Rio.getParserFormatForFileName(args[0]);
if(!fmtin.isPresent()) {
logger.error("No parser for input {}", args[0]);
System.exit(-2);
}
Optional<RDFFormat> fmtout = Rio.getWriterFormatForFileName(args[1]);
if(!fmtout.isPresent()) {
logger.error("No parser for output {}", args[1]);
System.exit(-3);
}
int code = 0;
Repository repo = new SailRepository(new MemoryStore());
repo.initialize();
try (RepositoryConnection con = repo.getConnection()) {
con.add(new File(args[0]), "http://data.gov.be", fmtin.get());
// Various namespace prefixes
con.setNamespace(DCAT.PREFIX, DCAT.NAMESPACE);
con.setNamespace(DCTERMS.PREFIX, DCTERMS.NAMESPACE);
con.setNamespace(FOAF.PREFIX, FOAF.NAMESPACE);
con.setNamespace("vcard", "http://www.w3.org/2006/vcard/ns#");
con.setNamespace("locn", "http://www.w3.org/ns/locn#");
FileOutputStream fout = new FileOutputStream(new File(args[1]));
RDFWriter writer;
if (fmtout.get().equals(RDFFormat.RDFXML)) {
writer = new RDFXMLPrettyWriterFactory().getWriter(fout);
} else {
writer = Rio.createWriter(fmtout.get(), fout);
}
logger.info("Using writer {}", writer.getClass().getCanonicalName());
con.export(writer);
} catch (IOException ex) {
logger.error("Error converting", ex);
code = -1;
}
repo.shutDown();
System.exit(code);
}