orientdb 0.0.1-jruby

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,28 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## IDEA
17
+ .idea/*
18
+
19
+ ## RVM
20
+ .rvmrc
21
+
22
+ ## PROJECT::GENERAL
23
+ coverage
24
+ rdoc
25
+ pkg
26
+
27
+ ## PROJECT::SPECIFIC
28
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :gemcutter
2
+
3
+ # Specify your gem's dependencies in orientdb.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/lib/orientdb.rb ADDED
@@ -0,0 +1,18 @@
1
+ raise "Rubyhaze only runs on JRuby. Sorry!" unless (RUBY_PLATFORM =~ /java/)
2
+
3
+ $: << File.dirname(__FILE__)
4
+ path = File.expand_path('../../jars/', __FILE__)
5
+ puts "path : #{path}"
6
+ $: << path
7
+
8
+ require 'java'
9
+ require 'orientdb-client-0.9.23'
10
+
11
+ module OrientDB
12
+ end
13
+
14
+ require 'orientdb/version'
15
+ require 'orientdb/mixins/proxy'
16
+ require 'orientdb/user'
17
+ require 'orientdb/database'
18
+ require 'orientdb/document'
@@ -0,0 +1,35 @@
1
+ class OrientDB::Database
2
+
3
+ include OrientDB::Mixins::Proxy
4
+
5
+ KLASS = com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx
6
+
7
+ def initialize(database_url)
8
+ @proxy_object = KLASS.new database_url
9
+ end
10
+
11
+ def auth(username, password)
12
+ proxy_object.open username, password
13
+ end
14
+
15
+ def user
16
+ OrientDB::User.from_ouser proxy_object.getUser
17
+ end
18
+
19
+ alias :each_in_class :browseClass
20
+ alias :each_in_custer :browseCluster
21
+
22
+
23
+ class << self
24
+
25
+ def create(database_url)
26
+ new(database_url).create
27
+ end
28
+
29
+ def connect(database_url, username, password)
30
+ new(database_url).auth(username, password)
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,19 @@
1
+ class OrientDB::DatabasePool
2
+
3
+ include OrientDB::Mixins::Proxy
4
+
5
+ KLASS = com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool
6
+
7
+ def initialize(database_url, username, password)
8
+ @proxy_object = KLASS.global.acquire database_url, username, password
9
+ end
10
+
11
+ class << self
12
+
13
+ def connect(database_url, username, password)
14
+ new database_url, username, password
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,21 @@
1
+ class OrientDB::Document
2
+
3
+ include OrientDB::Mixins::Proxy
4
+
5
+ KLASS = com.orientechnologies.orient.core.record.impl.ODocument
6
+
7
+ def initialize(db, klass_name, fields = {})
8
+ @proxy_object = KLASS.new db, klass_name
9
+ fields.each do |name, value|
10
+ @proxy_object.field name.to_s, value
11
+ end
12
+ end
13
+
14
+ class << self
15
+
16
+ def create(db, klass_name, fields = {})
17
+ new(db, klass_name, fields).save
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,46 @@
1
+ module OrientDB
2
+ module Mixins
3
+ module Proxy
4
+
5
+ def self.included(base)
6
+ base.extend ClassMethods
7
+ end
8
+
9
+ attr_reader :proxy_object
10
+
11
+ def respond_to?(meth)
12
+ proxy_object.respond_to?(meth) || super
13
+ end
14
+
15
+ def method_missing(meth, *args, &blk)
16
+ if proxy_object.respond_to? meth
17
+ proxy_object.send meth, *args, &blk
18
+ else
19
+ super
20
+ end
21
+ end
22
+
23
+ module ClassMethods
24
+
25
+ def proxy_accessor(aliased_name, real_name = nil)
26
+ real_name ||= aliased_name
27
+ aliased_name = aliased_name.to_s
28
+ if aliased_name[-1,1] == '?'
29
+ class_eval %{def #{aliased_name[0..-2]}() proxy_object.send :is_#{real_name}? end}
30
+ class_eval %{def #{aliased_name}() proxy_object.send :is_#{real_name}? end}
31
+ class_eval %{def #{aliased_name[0..-2]}=(v) proxy_object.send :set_#{real_name}, v end}
32
+ else
33
+ class_eval %{def #{aliased_name}() proxy_object.send :get_#{real_name}? end}
34
+ class_eval %{def #{aliased_name}=(v) proxy_object.send :set_#{real_name}, v end}
35
+ end
36
+ end
37
+
38
+ def proxy_accessors(*args)
39
+ args.each { |arg| proxy_accessor *arg }
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,16 @@
1
+ class OrientDB::User
2
+
3
+ include OrientDB::Mixins::Proxy
4
+
5
+ KLASS = com.orientechnologies.orient.core.metadata.security.OUser
6
+
7
+ def initialize
8
+ @proxy_object = KLASS.new
9
+ end
10
+
11
+ def self.from_ouser(ouser)
12
+ obj = new
13
+ obj.instance_variable_set "@proxy_object", ouser
14
+ end
15
+
16
+ end
@@ -0,0 +1,3 @@
1
+ module OrientDB
2
+ VERSION = "0.0.1"
3
+ end
data/orientdb.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/orientdb/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "orientdb"
6
+ s.version = OrientDB::VERSION
7
+ s.platform = "jruby"
8
+ s.authors = ["Adrian Madrid"]
9
+ s.email = ["aemadrid@gmail.com"]
10
+ s.homepage = "http://rubygems.org/gems/orientdb"
11
+ s.summary = "JRuby wrapper for OrientDB"
12
+ s.description = "JRuby wrapper for OrientDB"
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ s.rubyforge_project = "orientdb"
16
+
17
+ s.add_development_dependency "bundler", ">= 1.0.0"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = Dir["test/test*.rb"]
21
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
22
+ s.require_path = 'lib'
23
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: orientdb
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: jruby
11
+ authors:
12
+ - Adrian Madrid
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-02 00:00:00 -06:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: bundler
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 0
30
+ - 0
31
+ version: 1.0.0
32
+ type: :development
33
+ version_requirements: *id001
34
+ description: JRuby wrapper for OrientDB
35
+ email:
36
+ - aemadrid@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - .gitignore
45
+ - .rvmrc
46
+ - Gemfile
47
+ - Rakefile
48
+ - jars/orient-commons-0.9.23.jar
49
+ - jars/orientdb-client-0.9.23.jar
50
+ - jars/orientdb-core-0.9.23.jar
51
+ - jars/orientdb-enterprise-0.9.23.jar
52
+ - jars/orientdb-server-0.9.23.jar
53
+ - jars/orientdb-tools-0.9.23.jar
54
+ - lib/orientdb.rb
55
+ - lib/orientdb/database.rb
56
+ - lib/orientdb/database_pool.rb
57
+ - lib/orientdb/document.rb
58
+ - lib/orientdb/mixins/proxy.rb
59
+ - lib/orientdb/user.rb
60
+ - lib/orientdb/version.rb
61
+ - orientdb.gemspec
62
+ has_rdoc: true
63
+ homepage: http://rubygems.org/gems/orientdb
64
+ licenses: []
65
+
66
+ post_install_message:
67
+ rdoc_options: []
68
+
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ segments:
83
+ - 1
84
+ - 3
85
+ - 6
86
+ version: 1.3.6
87
+ requirements: []
88
+
89
+ rubyforge_project: orientdb
90
+ rubygems_version: 1.3.6
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: JRuby wrapper for OrientDB
94
+ test_files: []
95
+