use of org.neo4j.dbms.api.DatabaseManagementServiceBuilder in project neo4j by neo4j.
the class ReadTestSupport method setup.
@Override
public void setup(Path storeDir, Consumer<GraphDatabaseService> create, Consumer<GraphDatabaseService> sysCreate) {
DatabaseManagementServiceBuilder databaseManagementServiceBuilder = newManagementServiceBuilder(storeDir);
databaseManagementServiceBuilder.setConfig(settings);
managementService = databaseManagementServiceBuilder.build();
db = managementService.database(DEFAULT_DATABASE_NAME);
GraphDatabaseService sysDb = managementService.database(SYSTEM_DATABASE_NAME);
create.accept(db);
sysCreate.accept(sysDb);
}
use of org.neo4j.dbms.api.DatabaseManagementServiceBuilder in project neo4j-documentation by neo4j.
the class TransactionEventListenerExample method main.
// tag::TransactionEventListener[]
public static void main(String[] args) throws IOException {
FileUtils.deleteDirectory(HOME_DIRECTORY);
var managementService = new DatabaseManagementServiceBuilder(HOME_DIRECTORY).build();
var database = managementService.database(DEFAULT_DATABASE_NAME);
var countingListener = new CountingTransactionEventListener();
managementService.registerTransactionEventListener(DEFAULT_DATABASE_NAME, countingListener);
var connectionType = RelationshipType.withName("CONNECTS");
try (var transaction = database.beginTx()) {
var startNode = transaction.createNode();
var endNode = transaction.createNode();
startNode.createRelationshipTo(endNode, connectionType);
transaction.commit();
}
}
use of org.neo4j.dbms.api.DatabaseManagementServiceBuilder in project neo4j-documentation by neo4j.
the class OrderedPath method main.
public static void main(String[] args) {
DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(databaseDirectory).build();
GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
OrderedPath op = new OrderedPath(managementService, db);
op.shutdownGraph();
}
use of org.neo4j.dbms.api.DatabaseManagementServiceBuilder in project neo4j-documentation by neo4j.
the class StartWithConfigurationDocTest method loadFromHashmap.
@Test
void loadFromHashmap() {
// tag::startDbWithMapConfig[]
DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(directory).setConfig(GraphDatabaseSettings.pagecache_memory, ByteUnit.mebiBytes(512)).setConfig(GraphDatabaseSettings.transaction_timeout, Duration.ofSeconds(60)).setConfig(GraphDatabaseSettings.preallocate_logical_logs, true).build();
GraphDatabaseService graphDb = managementService.database(DEFAULT_DATABASE_NAME);
// end::startDbWithMapConfig[]
Assertions.assertNotNull(graphDb);
managementService.shutdown();
}
use of org.neo4j.dbms.api.DatabaseManagementServiceBuilder in project neo4j-documentation by neo4j.
the class OrderedPathDocTest method setUp.
@BeforeClass
public static void setUp() throws IOException {
if (Files.exists(OrderedPath.databaseDirectory)) {
FileUtils.deleteDirectory(OrderedPath.databaseDirectory);
}
DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(OrderedPath.databaseDirectory).build();
db = managementService.database(DEFAULT_DATABASE_NAME);
orderedPath = new OrderedPath(managementService, OrderedPathDocTest.db);
gen = new JavaDocsGenerator("ordered-path-java", "dev");
}
Aggregations