How can I use the webadmin interface with a built-in instance of Neo4j 2.0?

I have a project that works with the integrated Neo4j 1.8.2 plus web admin interface.

Now I updated the project to work with the latest Neo4j 2.0.1. Although there were some obstacles during this course (since I use Spring Data Neo4j), everything went smoothly in the end.

But currently I'm stuck in starting a web admin.

Any recommendations would be highly appreciated.

Here is my configuration that I used for version 1.8

(class for configuration mentioned in snippets)

package com.example;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.MapConfiguration;
import org.neo4j.server.configuration.Configurator;
import org.neo4j.server.configuration.ThirdPartyJaxRsPackage;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class Neo4jServerConfig implements Configurator {

    private Configuration config;

    public Neo4jServerConfig(Map<String, String> config) {
        this.config = new MapConfiguration(config);
    }

    @Override
    public Configuration configuration() {
        return config;
    }

    @Override
    public Map<String, String> getDatabaseTuningProperties() {
        return null;
    }

    @Override
    public Set<ThirdPartyJaxRsPackage> getThirdpartyJaxRsClasses() {
        return new HashSet<>();
    }

    @Override
    public Set<ThirdPartyJaxRsPackage> getThirdpartyJaxRsPackages() {
        return new HashSet<>();
    }

}

bean                                                                                                                                                     ...   ...                                                                           ...   ...                        

... 1,8 Neo4j.

Neo4j 2.0 . bean,

        <!-- neo4j server configuration -->
    <util:map id="neo4jConfig">
        <entry key="allow_store_upgrade" value="true"/>
        <entry key="enable_remote_shell" value="true"/>
        <entry key="online_backup_enabled" value="true"/>
        <entry key="node_auto_indexing" value="true"/>
        <entry key="node_keys_indexable" value="id,name,type,__type__"/>
        <entry key="relationship_auto_indexing" value="true"/>
    </util:map>

    <bean id="graphDbFactory" class="org.neo4j.graphdb.factory.GraphDatabaseFactory"/>

    <bean id="graphDbBuilder" factory-bean="graphDbFactory" factory-method="newEmbeddedDatabaseBuilder">
        <constructor-arg index="0" value="${neo4j.db.path}"/>
    </bean>

    <bean id="graphDbBuilderFinal" factory-bean="graphDbBuilder" factory-method="setConfig">
        <constructor-arg ref="neo4jConfig"/>
    </bean>

    <bean id="graphDatabaseService" factory-bean="graphDbBuilderFinal" factory-method="newGraphDatabase" destroy-method="shutdown" />

bean

    <bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start" destroy-method="stop">
        <constructor-arg index="0" ref="graphDatabaseService" /> 
        <constructor-arg index="1" ref="config"/>
    </bean>

-, "org.neo4j.server.WrappingNeoServerBootstrapper" - - , ?

-, -arg "graphDatabaseService"... : "bean org.neo4j.kernel.GraphDatabaseAPI" ( )

( , , ) , localhost: 28473 .

?

.

+3
3

, , . , pom , 2 neo4j-server 2 Jersey. WrappingNeoServerBootstrapper ().

POM CH.QOS Neo4J .

Spring . .

, localhost 7474.

<util:map id="config">
    <entry key="remote_shell_enabled" value="true"/>
</util:map>

<bean id="graphDbFactory" class="org.neo4j.graphdb.factory.GraphDatabaseFactory"/>

<bean id="graphDbBuilder" factory-bean="graphDbFactory" factory-method="newEmbeddedDatabaseBuilder">
    <constructor-arg value="${neo4j.datastore}"/>
</bean>

<bean id="graphDbBuilderFinal" factory-bean="graphDbBuilder" factory-method="setConfig">
    <constructor-arg ref="config"/>
</bean>

<bean id="graphDatabaseService" factory-bean="graphDbBuilderFinal" factory-method="newGraphDatabase"
      destroy-method="shutdown"/>

<bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start"
      destroy-method="stop">
    <constructor-arg ref="graphDatabaseService"/>
</bean>
+3

WrappingNeoServerBootstrapper GraphDatabaseAPI , ... .

, webadmin neo4j 2.0.1:

val graphdb = new GraphDatabaseFactory()
          .newEmbeddedDatabaseBuilder(DBPath)
          .loadPropertiesFromFile(neo4jPropertiesPath)
          .newGraphDatabase()
          .asInstanceOf[GraphDatabaseAPI}

val srv = new WrappingNeoServerBootstrapper(graphdb, config);
srv.start()

, "graphDatabaseService" "GraphDatabaseAPI". , , spring... WrappingNeoServerBootstrapper .

+2

So it is tested on OSX; To be clear after adding POM updates and spring configuration, this is all you need to do. Then just go to localhost: 7474 gives you your objects schedule.

0
source

All Articles