neo4j 1.0.0.beta.29-java → 1.0.0.beta.30-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,8 @@ Maintainer:
2
2
  Andreas Ronge <andreas dot ronge at gmail dot com>
3
3
 
4
4
  Contributors:
5
+
6
+ * Jay Adkisson
5
7
  * Stephan Hagemann
6
8
  * Bobby Calderwood
7
9
  * Ben Jackson
@@ -19,6 +19,9 @@ lucene: { fulltext: { provider: lucene,
19
19
  # If set to true it you can use the database while it is migrating.
20
20
  migration_thread: false
21
21
 
22
+ # If online backup should be available, if it is the Online JAR file will be loaded.
23
+ online_backup_enabled: false
24
+
22
25
  #use the clustered Neo4j GraphDatabase (org.neo4j.kernel.HighlyAvailableGraphDatabase)
23
26
  ha.db: false
24
27
 
@@ -13,25 +13,38 @@ require 'will_paginate/finders/base'
13
13
 
14
14
  require 'neo4j/jars/core/geronimo-jta_1.1_spec-1.1.1.jar'
15
15
  require 'neo4j/jars/core/lucene-core-3.0.3.jar'
16
- require 'neo4j/jars/core/neo4j-lucene-index-0.5-1.3.M01.jar'
17
- require 'neo4j/jars/core/neo4j-kernel-1.3-1.3.M01.jar'
18
- require 'neo4j/jars/ha/neo4j-management-1.3-1.3.M01.jar'
16
+ require 'neo4j/jars/core/neo4j-lucene-index-1.3.M02.jar'
17
+ require 'neo4j/jars/core/neo4j-kernel-1.3.M02.jar'
18
+ require 'neo4j/jars/ha/neo4j-management-1.3.M02.jar'
19
19
 
20
20
  module Neo4j
21
21
 
22
22
  def self.load_local_jars
23
23
  # This is a temporary fix since the HA does not yet work with this JAR
24
24
  # It will be solved in a future version of the Java Neo4j library.
25
- require 'neo4j/jars/core/neo4j-index-1.3-1.3.M01.jar'
25
+ if Neo4j.config[:online_backup_enabled]
26
+ Neo4j.load_online_backup
27
+ else
28
+ # backup and HA does not work with this JAR FILE
29
+ require 'neo4j/jars/core/neo4j-index-1.3-1.3.M01.jar'
30
+ end
26
31
  end
27
32
 
28
33
  def self.load_shell_jars
29
- require 'neo4j/jars/ha/neo4j-shell-1.3-1.3.M01.jar'
34
+ require 'neo4j/jars/ha/neo4j-shell-1.3.M02.jar'
30
35
  end
31
-
36
+
37
+ def self.load_online_backup
38
+ require 'neo4j/jars/ha/neo4j-com-1.3.M02.jar'
39
+ require 'neo4j/jars/core/neo4j-backup-1.3-SNAPSHOT.jar'
40
+ require 'neo4j/jars/ha/netty-3.2.1.Final.jar'
41
+ Neo4j.send(:const_set, :OnlineBackup, org.neo4j.backup.OnlineBackup)
42
+ end
43
+
32
44
  def self.load_ha_jars
33
45
  require 'neo4j/jars/ha/log4j-1.2.16.jar'
34
- require 'neo4j/jars/ha/neo4j-ha-0.6-1.3.M01.jar'
46
+ require 'neo4j/jars/ha/neo4j-ha-1.3.M02.jar'
47
+ require 'neo4j/jars/ha/neo4j-com-1.3.M02.jar'
35
48
  require 'neo4j/jars/ha/netty-3.2.1.Final.jar'
36
49
  require 'neo4j/jars/ha/org.apache.servicemix.bundles.jline-0.9.94_1.jar'
37
50
  require 'neo4j/jars/ha/org.apache.servicemix.bundles.lucene-3.0.1_2.jar'
@@ -1,6 +1,6 @@
1
1
  # external neo4j dependencies
2
2
  require 'neo4j/to_java'
3
- require 'neo4j/jars/core/neo4j-graph-algo-0.8-1.3.M01.jar'
3
+ require 'neo4j/jars/core/neo4j-graph-algo-1.3.M02.jar'
4
4
 
5
5
  module Neo4j
6
6
 
@@ -84,10 +84,11 @@ module Neo4j
84
84
  index_config = lucene_config(type)
85
85
 
86
86
  if entity_type == :node
87
- self.class.index_provider.node_index("#{indexer_for}-#{type}", index_config)
87
+ self.class.index_provider.node_index(indexer_for.index_names[type], index_config)
88
88
  else
89
- self.class.index_provider.relationship_index("#{indexer_for}-#{type}", index_config)
89
+ self.class.index_provider.relationship_index(indexer_for.index_names[type], index_config)
90
90
  end
91
+
91
92
  end
92
93
 
93
94
  class << self
@@ -64,6 +64,7 @@ module Neo4j
64
64
  def start_ha_graph_db
65
65
  Neo4j.logger.info "starting Neo4j in HA mode, machine id: #{Neo4j.config['ha.machine_id']} at #{Neo4j.config['ha.server']} db #{@storage_path}"
66
66
  Neo4j.load_ha_jars # those jars are only needed for the HighlyAvailableGraphDatabase
67
+ Neo4j.load_online_backup if Neo4j.config[:online_backup_enabled]
67
68
  @graph = org.neo4j.kernel.HighlyAvailableGraphDatabase.new(@storage_path, Neo4j.config.to_java_map)
68
69
  @graph.register_transaction_event_handler(@event_handler)
69
70
  @lucene = @graph.index #org.neo4j.index.impl.lucene.LuceneIndexProvider.new
@@ -110,17 +110,29 @@ module Neo4j
110
110
  # # generate a relationship between folder and file of type 'FileNode#files'
111
111
  # folder.files << FileNode.new
112
112
  #
113
- def to(*args)
113
+ # ==== Example, without prefix
114
+ #
115
+ # class FolderNode
116
+ # include Neo4j::NodeMixin
117
+ # has_n(:files).to(:contains)
118
+ # end
119
+ #
120
+ # file = FileNode.new
121
+ # # create an outgoing relationship of type 'contains' from folder node to file
122
+ # folder.files << FolderNode.new
123
+ #
124
+ def to(target)
114
125
  @direction = :outgoing
115
126
 
116
- if (args.size > 1)
117
- raise "only one argument expected - the class of the node this relationship points to, got #{args.inspect}"
118
- elsif (Class === args[0])
127
+ if (Class === target)
119
128
  # handle e.g. has_n(:friends).to(class)
120
- @target_class = args[0]
129
+ @target_class = target
121
130
  @rel_type = "#{@target_class}##{@method_id}"
131
+ elsif (Symbol === target)
132
+ # handle e.g. has_n(:friends).to(:knows)
133
+ @rel_type = target.to_s
122
134
  else
123
- raise "Expected a class for, got #{args[0]}/#{args[0].class}"
135
+ raise "Expected a class or a symbol for, got #{target}/#{target.class}"
124
136
  end
125
137
  self
126
138
  end
@@ -33,9 +33,33 @@ module Neo4j
33
33
  # It is possible to share the same index for several different classes, see #node_indexer.
34
34
  # :singleton-method: find
35
35
 
36
+ ##
37
+ # Specifies the location on the filesystem of the lucene index for the given index type.
38
+ #
39
+ # If not specified it will have the default location:
40
+ #
41
+ # Neo4j.config[:storage_path]/index/lucene/node|relationship/ParentModuleName_SubModuleName_ClassName-indextype
42
+ #
43
+ # Forwards to the Indexer#index_names class
44
+ #
45
+ # ==== Example
46
+ # module Foo
47
+ # class Person
48
+ # include Neo4j::NodeMixin
49
+ # index :name
50
+ # index_names[:fulltext] = 'my_location'
51
+ # end
52
+ # end
53
+ #
54
+ # Person.index_names[:fulltext] => 'my_location'
55
+ # Person.index_names[:exact] => 'Foo_Person-exact' # default Location
56
+ # Notice in versions <= 1.0.0.beta.29 the default location was 'Foo::Person-exact'
57
+ # which does not work on Windows [lighthouse ticket #147]
58
+ #
59
+ # :singleton-method: index_names
36
60
 
37
- def_delegators :@_indexer, :index, :find, :index?, :index_type?, :delete_index_type, :rm_field_type, :add_index, :rm_index, :index_type_for, :index_name
38
61
 
62
+ def_delegators :@_indexer, :index, :find, :index?, :index_type?, :delete_index_type, :rm_field_type, :add_index, :rm_index, :index_type_for, :index_names
39
63
 
40
64
  # Sets which indexer should be used for the given node class.
41
65
  # You can share an indexer between several different classes.
@@ -306,13 +306,16 @@ module Neo4j
306
306
  db = Neo4j.started_db
307
307
  index_config = lucene_config(type)
308
308
  if @entity_type == :node
309
- db.lucene.for_nodes("#{@indexer_for}-#{type}", index_config)
309
+ db.lucene.for_nodes(index_names[type], index_config)
310
310
  else
311
- db.lucene.for_relationships("#{@indexer_for}-#{type}", index_config)
311
+ db.lucene.for_relationships(index_names[type], index_config)
312
312
  end
313
313
  end
314
314
 
315
-
315
+ def index_names
316
+ default_filename = @indexer_for.to_s.gsub('::', '_')
317
+ @index_names ||= Hash.new{|hash,index_type| hash[index_type] = "#{default_filename}-#{index_type}"}
318
+ end
316
319
 
317
320
  end
318
321
 
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = "1.0.0.beta.29"
2
+ VERSION = "1.0.0.beta.30"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 1.0.0.beta.29
5
+ version: 1.0.0.beta.30
6
6
  platform: java
7
7
  authors:
8
8
  - Andreas Ronge
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-10 00:00:00 +01:00
13
+ date: 2011-02-16 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -134,19 +134,21 @@ files:
134
134
  - lib/neo4j/rails/validations/uniqueness.rb
135
135
  - lib/neo4j/rails/validations/non_nil.rb
136
136
  - lib/neo4j/jars/core/lucene-core-3.0.3.jar
137
- - lib/neo4j/jars/core/neo4j-kernel-1.3-1.3.M01.jar
138
- - lib/neo4j/jars/core/neo4j-lucene-index-0.5-1.3.M01.jar
137
+ - lib/neo4j/jars/core/neo4j-graph-algo-1.3.M02.jar
138
+ - lib/neo4j/jars/core/neo4j-backup-1.3-SNAPSHOT.jar
139
139
  - lib/neo4j/jars/core/geronimo-jta_1.1_spec-1.1.1.jar
140
- - lib/neo4j/jars/core/neo4j-graph-algo-0.8-1.3.M01.jar
140
+ - lib/neo4j/jars/core/neo4j-kernel-1.3.M02.jar
141
+ - lib/neo4j/jars/core/neo4j-lucene-index-1.3.M02.jar
141
142
  - lib/neo4j/jars/core/neo4j-index-1.3-1.3.M01.jar
142
- - lib/neo4j/jars/ha/neo4j-management-1.3-1.3.M01.jar
143
+ - lib/neo4j/jars/ha/neo4j-management-1.3.M02.jar
143
144
  - lib/neo4j/jars/ha/org.apache.servicemix.bundles.lucene-3.0.1_2.jar
144
145
  - lib/neo4j/jars/ha/zookeeper-3.3.2.jar
145
- - lib/neo4j/jars/ha/neo4j-shell-1.3-1.3.M01.jar
146
146
  - lib/neo4j/jars/ha/netty-3.2.1.Final.jar
147
- - lib/neo4j/jars/ha/neo4j-ha-0.6-1.3.M01.jar
148
147
  - lib/neo4j/jars/ha/log4j-1.2.16.jar
148
+ - lib/neo4j/jars/ha/neo4j-ha-1.3.M02.jar
149
+ - lib/neo4j/jars/ha/neo4j-com-1.3.M02.jar
149
150
  - lib/neo4j/jars/ha/org.apache.servicemix.bundles.jline-0.9.94_1.jar
151
+ - lib/neo4j/jars/ha/neo4j-shell-1.3.M02.jar
150
152
  - lib/neo4j/index/indexer.rb
151
153
  - lib/neo4j/index/lucene_query.rb
152
154
  - lib/neo4j/index/indexer_registry.rb