Newton 統合

Neo4j Wiki から

目次

[edit] Goal

The goal of this integration is to expose Neo4j as a service in a Newton environment. There is now a first bundle that can be deployed into Newton at https://svn.neo4j.org/laboratory/users/peter/neo4j-newton/, you need to deploy two Newton artifacts in order to get maven to build.

[edit] Setup

[edit] Get a current Newton distribution

Download and unzip Newton (version 1.3.1) from here

[edit] Deploy the necessary Newton artifacts into your local maven repo

export NEWTON_HOME=PATH_TO_NEWTON_INSTALLATION
cd $NEWTON_HOME

[edit] Deploy the necessary Newton bundles into the Maven repo

mvn deploy:deploy-file -Durl=file:/$HOME/.m2/repository/  -Dpackaging=jar -Dversion=1.3.1 -DgroupId=org.cauldron.newton.sdk  -DartifactId=cmd -Dfile=sdk/lib/cmd.jar
mvn deploy:deploy-file -Durl=file:/$HOME/.m2/repository/  -Dpackaging=jar -Dversion=1.3.1 -DgroupId=org.cauldron.newton  -DartifactId=component-activator -Dfile=sdk/lib/component-activator.jar 

[edit] Build and copy your Neo4j bundles and deployment descriptors to a convenient location for Newton to scan

cd $MY_CODE_LOCATION
svn co https://svn.neo4j.org/laboratory/users/peter/neo4j-newton/ neo4j-newton
cd neo4j-newton
mvn install
mkdir -p $NEWTON_HOME/examples/neo4j
cp neo4j-newton-service/target/neo4j-newton-service-0.1.0.jar $NEWTON_HOME/examples/neo4j/
cp neo4j-newton-service/neo4j-service.composite $NEWTON_HOME/examples/neo4j/
cp neo4j-newton-shellcommands/target/neo4j-newton-shellcommands-1.0-SNAPSHOT.jar $NEWTON_HOME/examples/neo4j/
cp neo4j-newton-shellcommands/neo4j-shellcommands.composite $NEWTON_HOME/examples/neo4j/

[edit] Start Newton

cd $NEWTON_HOME
bin/container

[edit] Scan the Neo4j bundles

> cds scan boot examples/neo4j

[edit] Deploy the bundles by pointing out the location of the composite XML files

> installer install file:examples/neo4j/neo4j-service.composite
> installer install file:examples/neo4j/neo4j-shellcommands.composite

You should be able to see the $NEWTON_HOME/target/neostore, created by the started Neo4j engine, and see the bundles and the service registered with

>equinox ss
...
83      ACTIVE      org.neo4j.newton.service_0.1.0
84      ACTIVE      org.neo4j.newton.shellcommands_1.0.0.SNAPSHOT
> services 90
Bundle: org.neo4j.newton.service (#90)
  registered: NeoNewtonService
> equinox bundle 83
cds://org.neo4j.newton.service?zone=boot&type=osgi.bundle&bundle.symbolic.name=org.neo4j.newton.service&version=0.1.0 [83]
  Id=83, Status=ACTIVE      Data Root=/Users/peter/code/newton/var/org.eclipse.osgi/bundles/83/data
  Registered Services
    {org.neo4j.newton.service.NeoNewtonService}={org.cauldron.newton.component.uid=71c4f760-c590-12a9-8a62-0191c9f03165, service.id=136}
  Services in use:
    {org.cauldron.newton.runtime.api.NewtonRuntime, org.cauldron.newton.runtime.component.InternalNewtonRuntime}={service.id=35}
    {org.cauldron.newton.installer.InstallManager}={service.id=74}
    {org.cauldron.newton.frameworkintercept.api.InterceptorLookup}={service.id=24}
    {org.cauldron.newton.framework.NewtonFramework}={service.id=36}
  Exported packages
    org.neo4j.newton.service; version="1.0.0"[exported]
    org.neo4j.api.core; version="0.0.0"[exported]
  Imported packages
    javax.xml.parsers; version="0.0.0"<System Bundle [0]>
    org.cauldron.newton.framework; version="1.3.1"<file:/Users/peter/code/newton/lib/newton/framework.jar [13]>
    org.osgi.framework; version="1.4.0"<System Bundle [0]>
    org.osgi.util.tracker; version="1.3.3"<System Bundle [0]>
    org.w3c.dom; version="0.0.0"<System Bundle [0]>
    org.xml.sax; version="0.0.0"<System Bundle [0]>
    org.cauldron.newton.frameworkintercept.api; version="1.3.1"<initial@reference:file:../newton/frameworkintercept.jar/ [1]>
  No fragment bundles
  Named class space
    org.neo4j.newton.service; bundle-version="0.1.0"[provided]
  No required bundles
ProtectionDomain  null
 null
 <no principals>
 org.eclipse.osgi.framework.internal.core.BundleCombinedPermissions@e476fc (
)

[edit] Use the "ls" command

> help
Available command groups (type 'enter' to enter a group):
system - commands for manipulating systems
storagecds - Commands for manipulating cds storage
sleep - sleeps for a configurable number of milliseconds
session - Session commands built into the console
provisioner - Commands for manipulating the provisioner
obr - OBR commands
ls - ls <node-id> lists the corresponding Neo4j node
logman - Commands for controlling logging within container
logconfig - Configuration commands for the log.
log - Log commands
installer - installs/uninstalls/tracks SCA components in this jvm
indexcds - Commands for manipulating the index service
framework - Framework commands
exec - executes a script from a file or url location
configuration - Configuration commands
cds - Commands for manipulating cds content
binder - Tools for introspecting the binding graph
> ls 0
got id: 0
[0:name=reference node,]
> 
Neo4j のサイト
ツールボックス