Package org.neo4j.kernel

Examples of org.neo4j.kernel.GraphDatabaseAPI


    }

    private void rollback(ServletRequest request) {
        Neo4jService service = SessionService.getService((HttpServletRequest) request,false);
        if (service==null) return;
        GraphDatabaseAPI graphDatabase = (GraphDatabaseAPI) service.getGraphDatabase();
        try {
            Transaction tx = graphDatabase.getDependencyResolver().resolveDependency(TransactionManager.class).getTransaction();
            if (tx!=null) tx.rollback();
        } catch(Exception e) {
            LOG.error("Error rolling back transaction ",e);
        }
    }
View Full Code Here



    private Transaction getCurrentTransaction(GraphDatabaseService graphDatabaseService) {
        try {
            if (graphDatabaseService instanceof GraphDatabaseAPI) {
                GraphDatabaseAPI graphDatabaseAPI = (GraphDatabaseAPI) graphDatabaseService;
                TransactionManager txManager = graphDatabaseAPI.getDependencyResolver().resolveDependency(TransactionManager.class);
                return (Transaction)txManager.getTransaction();
               
            }
        } catch (SystemException e) {
            throw new RuntimeException("Error accessing current transaction",e);
View Full Code Here

    private final TransactionManager txManager;

    public Neo4j19Locker(GraphDatabaseService graphDatabaseService) {
        if (!(graphDatabaseService instanceof GraphDatabaseAPI)) throw new RuntimeException("Error accessing transaction management, not a GraphDatabaseAPI " + graphDatabaseService);
        GraphDatabaseAPI graphDatabaseAPI = (GraphDatabaseAPI) graphDatabaseService;
        txManager = graphDatabaseAPI.getDependencyResolver().resolveDependency(TransactionManager.class);
    }
View Full Code Here

    @DELETE
    @Path("/{key}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response cleanDb(@PathParam("key") String deleteKey) {
        GraphDatabaseAPI graph = database.getGraph();
        String configKey = config.getString(CONFIG_DELETE_AUTH_KEY);

        if (deleteKey == null || configKey == null || !deleteKey.equals(configKey)) {
            return Response.status(Status.UNAUTHORIZED).build();
        }
View Full Code Here

    public void rollback() {
        if (null == tx.get()) {
            return;
        }

        GraphDatabaseAPI graphDatabaseAPI = (GraphDatabaseAPI) getRawGraph();
        TransactionManager transactionManager = graphDatabaseAPI.getTxManager();
        try {
            javax.transaction.Transaction t = transactionManager.getTransaction();
            if (t == null || t.getStatus() == Status.STATUS_ROLLEDBACK) {
                return;
            }
View Full Code Here

        Assert.assertNotNull(config.personRepository);
    }
    @Test                                                                      
    public void injectionForExistingGraphDatabaseService() {
        final Config config = assertInjected("-external-embedded");
        final GraphDatabaseAPI gds = (GraphDatabaseAPI) config.graphDatabaseService;
        assertEquals(EmbeddedGraphDatabase.class, gds.getClass());
        final org.neo4j.kernel.configuration.Config neoConfig = gds.getDependencyResolver().resolveDependency(org.neo4j.kernel.configuration.Config.class);
        assertEquals("true", neoConfig.getParams().get("allow_store_upgrade"));
    }
View Full Code Here

    }
    @Test
    @Ignore("todo setup zk-cluster")
    public void injectionForExistingHighlyAvailableGraphDatabaseService() {
        final Config config = assertInjected("-external-ha");
        final GraphDatabaseAPI gds = (GraphDatabaseAPI) config.graphDatabaseService;
        final org.neo4j.kernel.configuration.Config neoConfig = gds.getDependencyResolver().resolveDependency(org.neo4j.kernel.configuration.Config.class);
        assertEquals("HighlyAvailableGraphDatabase", gds.getClass().getSimpleName());
        assertEquals("1", neoConfig.getParams().get("ha.server_id"));
    }
View Full Code Here

        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:org/springframework/data/neo4j/config/DataGraphNamespaceHandlerTests" + testCase + "-context.xml");
        try {
        Config config = ctx.getBean("config", Config.class);
        Neo4jTemplate template = config.neo4jTemplate;
        Assert.assertNotNull("template", template);
        GraphDatabaseAPI graphDatabaseService = (GraphDatabaseAPI) template.getGraphDatabaseService();
        String fileSeparator = "target" + System.getProperty("file.separator") + "config-test";
        Assert.assertTrue("store-dir", graphDatabaseService.getStoreDir().endsWith(fileSeparator));
        Assert.assertNotNull("graphDatabaseService",config.graphDatabaseService);
        Assert.assertNotNull("transactionManager",config.transactionManager);
//        config.graphDatabaseService.shutdown();
        return config;
        } finally {
View Full Code Here

            throw new RuntimeException("missing master-credentials in neo4j-server.properties");
        }

        final SingleUserAuthenticationService adminAuth = new SingleUserAuthenticationService(masterCredendials);
        Database database = neoServer.getDatabase();
        GraphDatabaseAPI graphDatabaseAPI = database.getGraph();
        final MultipleAuthenticationService users = new MultipleAuthenticationService(graphDatabaseAPI);

        adminAuthenticationFilter = new AuthenticationFilter("neo4j-admin", adminAuth);
        adminPath = getMyMountpoint(configurator) + "/*";
        webServer.addFilter(adminAuthenticationFilter, adminPath);
View Full Code Here

  public void startService() {

   

    try {
      GraphDatabaseAPI api = (GraphDatabaseAPI) StructrApp.getInstance().getGraphDatabaseService();

      ServerConfigurator config = new ServerConfigurator(api);

      config.configuration()
        .addProperty(Configurator.WEBSERVER_ADDRESS_PROPERTY_KEY, host);
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.GraphDatabaseAPI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.