pacer-dex 2.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ target/*
6
+ lib/*.jar
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in pacer-graph.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Dex Graph Database Adapter for Pacer
2
+
3
+ [Pacer](https://github.com/pangloss/pacer) is a
4
+ [JRuby](http://jruby.org) graph traversal framework built on the
5
+ [Tinkerpop](http://www.tinkerpop.com) stack.
6
+
7
+ This plugin enables full [Dex](http://sparsity-technologies.com) graph support in Pacer.
8
+
9
+
10
+ ## Usage
11
+
12
+ Here is how you open a Dex graph in Pacer.
13
+
14
+ require 'pacer'
15
+ require 'pacer-dex'
16
+
17
+ # Graph will be created if it doesn't exist
18
+ graph = Pacer.dex 'path/to/graph'
19
+
20
+ All other operations are identical across graph implementations (except
21
+ where certain features are not supported). See Pacer's documentation for
22
+ more information.
23
+
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ file 'pom.xml' => 'lib/pacer-dex/version.rb' do
5
+ pom = File.read 'pom.xml'
6
+ when_writing('Update pom.xml version number') do
7
+ open 'pom.xml', 'w' do |f|
8
+ pom.each_line do |line|
9
+ line.sub!(%r{<gem.version>.*</gem.version>}, "<gem.version>#{ Pacer::Dex::VERSION }</gem.version>")
10
+ line.sub!(%r{<blueprints.version>.*</blueprints.version>}, "<blueprints.version>#{ Pacer::Dex::BLUEPRINTS_VERSION }</blueprints.version>")
11
+ line.sub!(%r{<pipes.version>.*</pipes.version>}, "<pipes.version>#{ Pacer::Dex::PIPES_VERSION }</pipes.version>")
12
+ f << line
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ file Pacer::Dex::JAR_PATH => 'pom.xml' do
19
+ when_writing("Execute 'mvn package' task") do
20
+ system('mvn clean package')
21
+ end
22
+ end
23
+
24
+ task :note do
25
+ puts "NOTE: touch lib/pacer-neo4j/version.rb (or rake touch) to force everything to rebuild"
26
+ end
27
+
28
+ task :build => [:note, Pacer::Dex::JAR_PATH]
29
+ task :install => [:note, Pacer::Dex::JAR_PATH]
30
+
31
+ desc 'Touch version.rb so that the jar rebuilds'
32
+ task :touch do
33
+ system 'touch', 'lib/pacer-neo4j/version.rb'
34
+ end
35
+
data/lib/pacer-dex.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'pacer-dex/version'
2
+ if Pacer::Dex::ENABLED
3
+ require 'pacer'
4
+ require Pacer::Dex::JAR
5
+
6
+ require 'pacer-dex/graph'
7
+ else
8
+ puts "Dex has been disabled."
9
+ puts
10
+ puts "Please ensure you are running a compatible JVM (see pacer-dex/version.rb)"
11
+ puts "or set Pacer::Dex::ENABLED = true to force."
12
+ puts
13
+ end
@@ -0,0 +1,23 @@
1
+ module Pacer
2
+ class << self
3
+ # Return a graph for the given path. Will create a graph if none exists at
4
+ # that location. (The graph is only created if data is actually added to it).
5
+ def dex(path)
6
+ dex = com.tinkerpop.blueprints.impls.dex.DexGraph
7
+ path = File.expand_path(path)
8
+ open = proc do
9
+ graph = Pacer.open_graphs[path]
10
+ unless graph
11
+ graph = dex.new(path)
12
+ Pacer.open_graphs[path] = graph
13
+ end
14
+ graph
15
+ end
16
+ shutdown = proc do |g|
17
+ g.blueprints_graph.shutdown
18
+ Pacer.open_graphs[path] = nil
19
+ end
20
+ PacerGraph.new(Pacer::YamlEncoder, open, shutdown)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,32 @@
1
+ if Pacer::Dex::ENABLED
2
+ class RSpec::GraphRunner
3
+ module Dex
4
+ def all(usage_style = :read_write, indices = true, &block)
5
+ super
6
+ dex(usage_style, indices, &block)
7
+ end
8
+
9
+ def dex(usage_style = :read_write, indices = true, &block)
10
+ for_graph('dex', usage_style, indices, false, dex_graph, dex_graph2, nil, block)
11
+ end
12
+
13
+ protected
14
+
15
+ def dex_graph
16
+ return @dex_graph if @dex_graph
17
+ path1 = File.expand_path('tmp/spec.dex')
18
+ dir = Pathname.new(path1)
19
+ dir.rmtree if dir.exist?
20
+ @dex_graph = Pacer.dex(path1)
21
+ end
22
+
23
+ def dex_graph2
24
+ return @dex_graph2 if @dex_graph2
25
+ path2 = File.expand_path('tmp/spec.dex.2')
26
+ dir = Pathname.new(path2)
27
+ dir.rmtree if dir.exist?
28
+ @dex_graph2 = Pacer.dex(path2)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,14 @@
1
+ module Pacer
2
+ module Dex
3
+ # Dex segfaults for me under Java 1.7... YMMV
4
+ if not defined? ENABLED
5
+ ENABLED = ENV_JAVA['java.runtime.version'] =~ /^1\.6\./
6
+ end
7
+ VERSION = "2.0.0"
8
+ JAR = "pacer-dex-#{ VERSION }-standalone.jar"
9
+ JAR_PATH = "lib/#{ JAR }"
10
+ BLUEPRINTS_VERSION = "2.1.0"
11
+ PIPES_VERSION = "2.1.0"
12
+ PACER_REQ = ">= 1.0.0"
13
+ end
14
+ end
data/pacer-dex.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "pacer-dex/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "pacer-dex"
7
+ s.version = Pacer::Dex::VERSION
8
+ s.platform = 'java'
9
+ s.authors = ["Darrick Wiebe"]
10
+ s.email = ["darrick@innatesoftware.com"]
11
+ s.homepage = "http://sparsity-technologies.com"
12
+ s.summary = %q{Dex jars and related code for Pacer}
13
+ s.description = s.summary
14
+
15
+ s.add_dependency 'pacer', Pacer::Dex::PACER_REQ
16
+
17
+ s.rubyforge_project = "pacer-dex"
18
+
19
+ s.files = `git ls-files`.split("\n") + [Pacer::Dex::JAR_PATH]
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ end
data/pom.xml ADDED
@@ -0,0 +1,128 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5
+ <modelVersion>4.0.0</modelVersion>
6
+ <groupId>com.tinkerpop.pacer</groupId>
7
+ <artifactId>pacer-dex</artifactId>
8
+ <!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
9
+ <properties>
10
+ <gem.version>2.0.0</gem.version>
11
+ <blueprints.version>2.1.0</blueprints.version>
12
+ <pipes.version>2.1.0</pipes.version>
13
+ </properties>
14
+ <!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
15
+ <version>${gem.version}</version>
16
+ <packaging>pom</packaging>
17
+ <url>https://github.com/pangloss/pacer</url>
18
+ <name>Pacer Dex dependencies and related code.</name>
19
+ <description>
20
+ </description>
21
+ <inceptionYear>2011</inceptionYear>
22
+ <developers>
23
+ <developer>
24
+ <name>Darrick Wiebe</name>
25
+ <email>darrick@innatesoftware.com</email>
26
+ <url>http://github.com/pangloss</url>
27
+ </developer>
28
+ </developers>
29
+ <dependencies>
30
+ <!-- PROPERTY GRAPH MODEL SUPPORT -->
31
+ <dependency>
32
+ <groupId>com.tinkerpop.blueprints</groupId>
33
+ <artifactId>blueprints-core</artifactId>
34
+ <version>${blueprints.version}</version>
35
+ </dependency>
36
+ <dependency>
37
+ <groupId>com.tinkerpop.blueprints</groupId>
38
+ <artifactId>blueprints-dex-graph</artifactId>
39
+ <version>${blueprints.version}</version>
40
+ </dependency>
41
+ <!-- GRAPH TRAVERSAL SUPPORT -->
42
+ <dependency>
43
+ <groupId>com.tinkerpop</groupId>
44
+ <artifactId>pipes</artifactId>
45
+ <version>${pipes.version}</version>
46
+ </dependency>
47
+ </dependencies>
48
+
49
+ <repositories>
50
+ <repository>
51
+ <id>tinkerpop-repository</id>
52
+ <name>TinkerPop Maven2 Repository</name>
53
+ <url>http://tinkerpop.com/maven2</url>
54
+ <snapshots>
55
+ <enabled>true</enabled>
56
+ <updatePolicy>always</updatePolicy>
57
+ </snapshots>
58
+ </repository>
59
+ </repositories>
60
+
61
+ <distributionManagement>
62
+ <repository>
63
+ <id>tinkerpop-repository</id>
64
+ <name>TinkerPop Maven2 Repository</name>
65
+ <url>ftp://ftp.tinkerpop.com:21/public/maven2/</url>
66
+ </repository>
67
+ </distributionManagement>
68
+
69
+ <build>
70
+ <directory>${basedir}/target</directory>
71
+ <finalName>${project.artifactId}-${project.version}</finalName>
72
+ <resources>
73
+ <resource>
74
+ <directory>${basedir}/src/main/resources
75
+ </directory>
76
+ </resource>
77
+ </resources>
78
+ <testResources>
79
+ <testResource>
80
+ <directory>${basedir}/src/test/resources
81
+ </directory>
82
+ </testResource>
83
+ </testResources>
84
+ <plugins>
85
+ <plugin>
86
+ <artifactId>maven-compiler-plugin</artifactId>
87
+ <configuration>
88
+ <source>1.6</source>
89
+ <target>1.6</target>
90
+ </configuration>
91
+ </plugin>
92
+ <plugin>
93
+ <artifactId>maven-assembly-plugin</artifactId>
94
+ <version>2.2-beta-4</version>
95
+ <executions>
96
+ <execution>
97
+ <phase>package</phase>
98
+ <goals>
99
+ <goal>attached</goal>
100
+ </goals>
101
+ </execution>
102
+ </executions>
103
+ <configuration>
104
+ <descriptors>
105
+ <descriptor>pom/standalone.xml</descriptor>
106
+ </descriptors>
107
+ <finalName>${project.artifactId}-${project.version}</finalName>
108
+ <outputDirectory>lib</outputDirectory>
109
+ <workDirectory>target/assembly/work</workDirectory>
110
+ <tarLongFileMode>warn</tarLongFileMode>
111
+ </configuration>
112
+ </plugin>
113
+ <plugin>
114
+ <groupId>org.apache.maven.plugins</groupId>
115
+ <artifactId>maven-javadoc-plugin</artifactId>
116
+ <version>2.6.1</version>
117
+ </plugin>
118
+ </plugins>
119
+ <extensions>
120
+ <extension>
121
+ <groupId>org.apache.maven.wagon</groupId>
122
+ <artifactId>wagon-ftp</artifactId>
123
+ <version>1.0-alpha-6</version>
124
+ </extension>
125
+ </extensions>
126
+ </build>
127
+
128
+ </project>
@@ -0,0 +1,22 @@
1
+ <assembly>
2
+ <id>standalone</id>
3
+ <formats>
4
+ <format>jar</format>
5
+ </formats>
6
+ <includeBaseDirectory>false</includeBaseDirectory>
7
+
8
+ <fileSets>
9
+ <fileSet>
10
+ <directory>target/classes</directory>
11
+ <outputDirectory>/</outputDirectory>
12
+ </fileSet>
13
+ </fileSets>
14
+
15
+ <dependencySets>
16
+ <dependencySet>
17
+ <outputDirectory>/</outputDirectory>
18
+ <unpack>true</unpack>
19
+ <scope>runtime</scope>
20
+ </dependencySet>
21
+ </dependencySets>
22
+ </assembly>
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pacer-dex
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ prerelease:
6
+ platform: java
7
+ authors:
8
+ - Darrick Wiebe
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: pacer
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 1.0.0
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
30
+ description: Dex jars and related code for Pacer
31
+ email:
32
+ - darrick@innatesoftware.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - README.md
40
+ - Rakefile
41
+ - lib/pacer-dex.rb
42
+ - lib/pacer-dex/graph.rb
43
+ - lib/pacer-dex/rspec.rb
44
+ - lib/pacer-dex/version.rb
45
+ - pacer-dex.gemspec
46
+ - pom.xml
47
+ - pom/standalone.xml
48
+ - lib/pacer-dex-2.0.0-standalone.jar
49
+ homepage: http://sparsity-technologies.com
50
+ licenses: []
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: !binary |-
60
+ MA==
61
+ none: false
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: !binary |-
67
+ MA==
68
+ none: false
69
+ requirements: []
70
+ rubyforge_project: pacer-dex
71
+ rubygems_version: 1.8.24
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Dex jars and related code for Pacer
75
+ test_files: []
76
+ has_rdoc: