bosdk 0.1.0-universal-java-1.6

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2010 Shane Emmons
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,30 @@
1
+ = BOSDK.gem
2
+
3
+ == Description
4
+
5
+ A JRuby wrapper for the Business Objects SDK
6
+
7
+ == Requirements
8
+
9
+ - The Business Objects Java SDK
10
+ - An environment variable 'BOE_JAVA_LIB' pointing to the Business Objects Java SDK directory
11
+ - JRuby >= 1.4.0
12
+
13
+ == Usage
14
+
15
+ require 'bosdk'
16
+ session = BOSDK::EnterpriseSession.new 'cms', 'Administrator', ''
17
+
18
+ ...do stuff with 'session.boe'...
19
+
20
+ session.disconnect if session.connected?
21
+
22
+ == Future Enhancements
23
+
24
+ In the future there will be wrappers around the more commonly used portions of the SDK,
25
+ including IInfoStore and IInfoObject.
26
+
27
+ == Resources
28
+
29
+ - Website: http://semmons99.github.com/bosdk
30
+ - Git Repo: http://github.com/semmons99/bosdk/tree/master
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require 'rake/clean'
2
+
3
+ CLEAN.include %w( doc )
4
+ CLOBBER.include %w( *.gem )
5
+
6
+ desc 'generate documentation'
7
+ task :rdoc do
8
+ sh 'hanna README.rdoc MIT-LICENSE lib -U'
9
+ end
10
+
11
+ desc 'build gem'
12
+ task :gem => :rdoc do
13
+ sh 'gem build bosdk.gemspec'
14
+ end
15
+
16
+ desc 'upload gem'
17
+ task :upload => :gem do
18
+ Dir.glob('bosdk*.gem') do |gem|
19
+ sh "gem push #{gem}"
20
+ end
21
+ end
22
+
23
+ desc 'run unit tests'
24
+ task :test do
25
+ ruby '-S spec -f s -c spec/*_spec.rb'
26
+ end
data/bosdk.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "bosdk"
3
+ s.version = "0.1.0"
4
+
5
+ s.author = "Shane Emmons"
6
+ s.description = "A JRuby wrapper for the Business Objects Java SDK"
7
+ s.email = "semmons99@gmail.com"
8
+ s.files = [
9
+ "README.rdoc", "MIT-LICENSE", "bosdk.gemspec", "Rakefile",
10
+ "lib/bosdk.rb",
11
+ "lib/bosdk/enterprise_session.rb",
12
+ "spec/enterprise_session_spec.rb",
13
+ ]
14
+
15
+ s.homepage = "http://semmons99.github.com/bosdk"
16
+ s.summary = "JRuby Business Object Java SDK wrapper"
17
+ s.platform = Gem::Platform::CURRENT
18
+ s.requirements = "An environment variable 'BOE_JAVA_LIB' pointing to the Business Objects Java SDK directory"
19
+ end
@@ -0,0 +1,22 @@
1
+ module BOSDK
2
+ class EnterpriseSession
3
+ attr_reader :boe
4
+
5
+ def initialize(cms, username, password)
6
+ @boe = CrystalEnterprise.getSessionMgr.logon(username, password, cms, 'secEnterprise')
7
+ @connected = true
8
+
9
+ at_exit { disconnect }
10
+ end
11
+
12
+ def connected?
13
+ return @connected
14
+ end
15
+
16
+ def disconnect
17
+ @boe.logoff if connected?
18
+ @boe = nil
19
+ @connected = false
20
+ end
21
+ end
22
+ end
data/lib/bosdk.rb ADDED
@@ -0,0 +1,27 @@
1
+ # Copyright (c) 2010 Shane Emmons
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person
4
+ # obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without
6
+ # restriction, including without limitation the rights to use,
7
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the
9
+ # Software is furnished to do so, subject to the following
10
+ # conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ # OTHER DEALINGS IN THE SOFTWARE.
23
+ include Java
24
+ Dir.glob(ENV["BOE_JAVA_LIB"] + "/*.jar").each{|jar| require jar}
25
+ include_class "com.crystaldecisions.sdk.framework.CrystalEnterprise"
26
+
27
+ require 'bosdk/enterprise_session'
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+ include Java
3
+ Dir.glob(ENV["BOE_JAVA_LIB"] + "/*.jar").each {|jar| require jar}
4
+ include_class "com.crystaldecisions.sdk.framework.CrystalEnterprise"
5
+
6
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
7
+ require 'bosdk/enterprise_session'
8
+
9
+ module BOSDK
10
+ describe EnterpriseSession do
11
+ before(:each) do
12
+ # mocks
13
+ @session_mgr = mock("ISessionMgr").as_null_object
14
+ @session = mock("IEnterpriseSession").as_null_object
15
+
16
+ # stubs
17
+ CrystalEnterprise.should_receive(:getSessionMgr).with.and_return(@session_mgr)
18
+ @session_mgr.should_receive(:logon).once.with('Administrator', '', 'cms', 'secEnterprise').and_return(@session)
19
+ @session.should_receive(:logoff).at_most(2).with.and_return
20
+
21
+ @es = EnterpriseSession.new('cms', 'Administrator', '')
22
+ end
23
+
24
+ specify "#connected? returns 'true' when connected to a CMS" do
25
+ @es.connected?.should be_true
26
+ end
27
+
28
+ specify "#connected? returns 'false' when not connected to a CMS" do
29
+ @es.disconnect
30
+ @es.connected?.should be_false
31
+ end
32
+
33
+ specify "#disconnect should disconnect from the CMS" do
34
+ @es.disconnect
35
+ @es.connected?.should be_false
36
+ end
37
+
38
+ specify "#disconnect shouldn't raise an error when not connected" do
39
+ @es.disconnect
40
+ lambda{@es.disconnect}.should_not raise_exception
41
+ end
42
+ end
43
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bosdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: universal-java-1.6
6
+ authors:
7
+ - Shane Emmons
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-19 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A JRuby wrapper for the Business Objects Java SDK
17
+ email: semmons99@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - README.rdoc
26
+ - MIT-LICENSE
27
+ - bosdk.gemspec
28
+ - Rakefile
29
+ - lib/bosdk.rb
30
+ - lib/bosdk/enterprise_session.rb
31
+ - spec/enterprise_session_spec.rb
32
+ has_rdoc: true
33
+ homepage: http://semmons99.github.com/bosdk
34
+ licenses: []
35
+
36
+ post_install_message:
37
+ rdoc_options: []
38
+
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ requirements:
54
+ - An environment variable 'BOE_JAVA_LIB' pointing to the Business Objects Java SDK directory
55
+ rubyforge_project:
56
+ rubygems_version: 1.3.5
57
+ signing_key:
58
+ specification_version: 3
59
+ summary: JRuby Business Object Java SDK wrapper
60
+ test_files: []
61
+