gunark-jasperserver-client 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -3
- data/License.txt +165 -20
- data/Manifest.txt +9 -7
- data/PostInstall.txt +0 -3
- data/README.txt +46 -32
- data/config/hoe.rb +10 -4
- data/lib/jasper_server/client.rb +11 -6
- data/lib/jasper_server/protocols/basic.rb +2 -2
- data/lib/jasper_server/protocols/soap.rb +46 -10
- data/lib/jasper_server/report_request.rb +2 -1
- data/lib/jasper_server/version.rb +1 -1
- data/lib/jasperserver-client.rb +3 -1
- data/script/txt2html +3 -3
- metadata +5 -4
- data/README +0 -0
data/History.txt
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
== 0.0
|
1
|
+
== 0.2.0 2009-08-14
|
2
2
|
|
3
|
-
*
|
4
|
-
|
3
|
+
* Should now work with Rails 2.3
|
4
|
+
* Can now specify the maximum time the client will wait for a response from the Jasper Server
|
5
|
+
|
6
|
+
|
7
|
+
== 0.1.0 2008-09-25
|
8
|
+
|
9
|
+
* Initial release
|
data/License.txt
CHANGED
@@ -1,20 +1,165 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
the
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/Manifest.txt
CHANGED
@@ -2,13 +2,19 @@ History.txt
|
|
2
2
|
License.txt
|
3
3
|
Manifest.txt
|
4
4
|
PostInstall.txt
|
5
|
-
README
|
6
5
|
README.txt
|
7
6
|
Rakefile
|
8
7
|
config/hoe.rb
|
9
8
|
config/requirements.rb
|
9
|
+
init.rb
|
10
|
+
lib/jasper_server/client.rb
|
11
|
+
lib/jasper_server/error.rb
|
12
|
+
lib/jasper_server/protocols/basic.rb
|
13
|
+
lib/jasper_server/protocols/soap.rb
|
14
|
+
lib/jasper_server/protocols/soap_monkeypatch.rb
|
15
|
+
lib/jasper_server/report_request.rb
|
16
|
+
lib/jasper_server/version.rb
|
10
17
|
lib/jasperserver-client.rb
|
11
|
-
lib/jasperserver-client/version.rb
|
12
18
|
script/console
|
13
19
|
script/destroy
|
14
20
|
script/generate
|
@@ -19,8 +25,4 @@ tasks/environment.rake
|
|
19
25
|
tasks/website.rake
|
20
26
|
test/test_helper.rb
|
21
27
|
test/test_jasperserver-client.rb
|
22
|
-
|
23
|
-
website/index.txt
|
24
|
-
website/javascripts/rounded_corners_lite.inc.js
|
25
|
-
website/stylesheets/screen.css
|
26
|
-
website/template.html.erb
|
28
|
+
|
data/PostInstall.txt
CHANGED
data/README.txt
CHANGED
@@ -1,48 +1,62 @@
|
|
1
|
-
=
|
1
|
+
= JasperServer-Client
|
2
2
|
|
3
|
-
*
|
3
|
+
* http://jasper-client.rubyforge.org
|
4
|
+
* http://github.com/gunark/jasperserver-client
|
4
5
|
|
5
6
|
== DESCRIPTION:
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
JasperServer-Client is -- you guessed it -- a Ruby-based client for JasperServer.
|
9
|
+
The library allows for requesting and fetching reports from a networked JasperServer over SOAP.
|
10
|
+
|
11
|
+
== USAGE:
|
12
|
+
|
13
|
+
Here we request a report to be generated in PDF format and then save the resulting data
|
14
|
+
to a local file:
|
15
|
+
|
16
|
+
# Create a new client instance for the JasperServer running at
|
17
|
+
# http://example.com/jasperserver
|
18
|
+
client = JasperServer::Client.new("http://example.com/jasperserver/services/repository",
|
19
|
+
"jasperadmin", "secret!")
|
20
|
+
|
21
|
+
# Create a request for a report. The first parameter is the full path of the
|
22
|
+
# report unit, the second is the desired output format, and the last is an
|
23
|
+
# optional hash of parameters to be fed into the report.
|
24
|
+
request = JasperServer::Request.new("/example/my-report", "PDF", {'fruit' => 'apple'})
|
25
|
+
|
26
|
+
# Send the report request to the server and return the output data.
|
27
|
+
pdf_data = client.request_report(request)
|
28
|
+
|
29
|
+
# Write the report data to a file (instead you could send the data to the user's
|
30
|
+
# browser if you're doing this in, for example, a Rails controller action).
|
31
|
+
File.open('/tmp/report.pdf', 'w') do |f|
|
32
|
+
f.puts(pdf_data)
|
33
|
+
end
|
16
34
|
|
17
35
|
== REQUIREMENTS:
|
18
36
|
|
19
|
-
*
|
37
|
+
* A Ruby interpreter.
|
38
|
+
* The *soap4r* gem, version 1.5.8 or greater. (This should be automatically
|
39
|
+
installed as a dependency; otherwise run <tt>gem install soap4r</tt>.)
|
40
|
+
* A running JasperServer instance. The client has been tested with versions 2.0 through
|
41
|
+
to 3.0 of JasperServer.
|
20
42
|
|
21
43
|
== INSTALL:
|
22
44
|
|
23
|
-
*
|
45
|
+
* Via RubyGems:
|
46
|
+
gem install jasperserver-client
|
24
47
|
|
25
48
|
== LICENSE:
|
26
49
|
|
27
|
-
|
28
|
-
|
29
|
-
|
50
|
+
JasperServer-Client is free software; you can redistribute it and/or modify
|
51
|
+
it under the terms of the GNU Lesser General Public License as published
|
52
|
+
by the Free Software Foundation; either version 3 of the License, or
|
53
|
+
(at your option) any later version.
|
30
54
|
|
31
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
-
a copy of this software and associated documentation files (the
|
33
|
-
'Software'), to deal in the Software without restriction, including
|
34
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
-
permit persons to whom the Software is furnished to do so, subject to
|
37
|
-
the following conditions:
|
38
55
|
|
39
|
-
|
40
|
-
|
56
|
+
JasperServer-Client is distributed in the hope that it will be useful,
|
57
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
58
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
59
|
+
GNU General Public License for more details.
|
41
60
|
|
42
|
-
|
43
|
-
|
44
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
61
|
+
You should have received a copy of the GNU Lesser General Public License
|
62
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
data/config/hoe.rb
CHANGED
@@ -7,6 +7,9 @@ GEM_NAME = 'jasperserver-client' # what ppl will type to install your gem
|
|
7
7
|
RUBYFORGE_PROJECT = 'jasper-client' # The unix name for your project
|
8
8
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
9
|
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
+
EXTRA_DEPENDENCIES = [
|
11
|
+
['soap4r', '>= 1.5.8']
|
12
|
+
]
|
10
13
|
|
11
14
|
@config_file = "~/.rubyforge/user-config.yml"
|
12
15
|
@config = nil
|
@@ -28,14 +31,17 @@ Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
|
28
31
|
end
|
29
32
|
|
30
33
|
|
34
|
+
ENV['NODOT'] = '1'
|
35
|
+
|
36
|
+
|
31
37
|
REV = nil
|
32
38
|
# UNCOMMENT IF REQUIRED:
|
33
39
|
# REV = YAML.load(`svn info`)['Revision']
|
34
40
|
VERS = JasperServer::VERSION::STRING + (REV ? ".#{REV}" : "")
|
35
|
-
RDOC_OPTS = ['--quiet', '--title', '
|
41
|
+
RDOC_OPTS = ['--quiet', '--title', 'JasperServer-Client documentation',
|
36
42
|
"--opname", "index.html",
|
37
43
|
"--line-numbers",
|
38
|
-
"--main", "README",
|
44
|
+
"--main", "README.txt",
|
39
45
|
"--inline-source"]
|
40
46
|
|
41
47
|
class Hoe
|
@@ -64,7 +70,7 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
64
70
|
end
|
65
71
|
|
66
72
|
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
67
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}
|
73
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}"
|
68
74
|
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
69
75
|
$hoe.rsync_args = '-av --delete --ignore-errors'
|
70
|
-
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
76
|
+
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/lib/jasper_server/client.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'jasper_server/protocols/soap'
|
2
2
|
|
3
3
|
module JasperServer
|
4
|
+
|
5
|
+
# The client through which all report requests are sent to the JasperServer.
|
4
6
|
class Client
|
5
7
|
|
6
8
|
# Create a new instance of the client.
|
@@ -9,7 +11,8 @@ module JasperServer
|
|
9
11
|
# "http://<hostname>:<port>/jasperserver/services/repository"
|
10
12
|
# username :: The username used to connect to the JasperServer.
|
11
13
|
# password :: The password used to connect to the JasperServer.
|
12
|
-
|
14
|
+
# timeout :: Maximum time to wait for a response from the JasperServer (default it 60 seconds).
|
15
|
+
def initialize(url, username, password, timeout = 60)
|
13
16
|
unless url =~ /\/services\/repository\/?$/
|
14
17
|
# add the /services/repository suffix to the URL if the user forgot
|
15
18
|
# to include it
|
@@ -22,12 +25,13 @@ module JasperServer
|
|
22
25
|
@jasper_url = url
|
23
26
|
@jasper_username = username
|
24
27
|
@jasper_password = password
|
28
|
+
@timeout = timeout
|
25
29
|
end
|
26
30
|
|
27
|
-
# Request a report from the server based on the
|
31
|
+
# Request a report from the server based on the ReportRequest object you provide.
|
28
32
|
# Returns the report data.
|
29
33
|
#
|
30
|
-
# For example if your request specifies
|
34
|
+
# For example if your request specifies <tt>PDF</tt> as the output format, PDF
|
31
35
|
# binary data will be returned.
|
32
36
|
#
|
33
37
|
# client = JasperServer::Client.new("http://example.com/jasperserver/services/repository",
|
@@ -38,13 +42,14 @@ module JasperServer
|
|
38
42
|
# f.puts(pdf_data)
|
39
43
|
# end
|
40
44
|
#
|
41
|
-
# For debugging purposes, try requesting output in
|
45
|
+
# For debugging purposes, try requesting output in <tt>CSV</tt> format, since
|
42
46
|
# request_report will then return an easily readable String.
|
43
47
|
def request_report(request)
|
44
48
|
soap = JasperServer::Protocols::SOAP.new
|
45
|
-
soap.connect(@jasper_url, @jasper_username, @jasper_password)
|
49
|
+
soap.connect(@jasper_url, @jasper_username, @jasper_password, @timeout)
|
46
50
|
soap.request_report_via_soap(request)
|
47
51
|
end
|
48
52
|
|
49
53
|
end
|
50
|
-
end
|
54
|
+
end
|
55
|
+
|
@@ -3,7 +3,7 @@ require 'jasper_server/error'
|
|
3
3
|
module JasperServer
|
4
4
|
module Protocols
|
5
5
|
|
6
|
-
# THIS DOES NOT WORK
|
6
|
+
# <b>THIS PROTOCOL ADAPTER DOES NOT YET WORK!!!</b>
|
7
7
|
#
|
8
8
|
# This was an attempt at fetching reports using scraping... unfortunately
|
9
9
|
# I can't figure out how to fake the Spring authentication session :(
|
@@ -94,4 +94,4 @@ module JasperServer
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
97
|
-
end
|
97
|
+
end
|
@@ -1,6 +1,31 @@
|
|
1
1
|
require 'jasper_server/protocols/soap_monkeypatch'
|
2
2
|
require 'jasper_server/error'
|
3
3
|
|
4
|
+
gem 'xml-simple'
|
5
|
+
require 'xmlsimple'
|
6
|
+
|
7
|
+
if Object.const_defined?(:XmlSimple) && !XmlSimple.respond_to?(:xml_in_string)
|
8
|
+
class XmlSimple
|
9
|
+
# Same as xml_in but doesn't try to smartly shoot itself in the foot.
|
10
|
+
def xml_in_string(string, options = nil)
|
11
|
+
handle_options('in', options)
|
12
|
+
|
13
|
+
@doc = parse(string)
|
14
|
+
result = collapse(@doc.root)
|
15
|
+
|
16
|
+
if @options['keeproot']
|
17
|
+
merge({}, @doc.root.name, result)
|
18
|
+
else
|
19
|
+
result
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.xml_in_string(string, options = nil)
|
24
|
+
new.xml_in_string(string, options)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
4
29
|
module JasperServer
|
5
30
|
module Protocols
|
6
31
|
class SOAP
|
@@ -22,8 +47,6 @@ module JasperServer
|
|
22
47
|
elsif value.kind_of? Time
|
23
48
|
ts = ReportRequest.convert_time_to_jasper_timestamp(value)
|
24
49
|
params_xml << %{<parameter name="#{name}">#{ts}</parameter>\n}
|
25
|
-
elsif value.kind_of? Integer
|
26
|
-
params_xml << %{<parameter name="#{name}">#{value}</parameter>\n}
|
27
50
|
elsif !value.blank?
|
28
51
|
params_xml << %{<parameter name="#{name}"><![CDATA[#{value}]]></parameter>\n}
|
29
52
|
end
|
@@ -39,13 +62,25 @@ module JasperServer
|
|
39
62
|
</resourceDescriptor>
|
40
63
|
</request>|
|
41
64
|
|
42
|
-
RAILS_DEFAULT_LOGGER.debug "
|
65
|
+
RAILS_DEFAULT_LOGGER.debug "#{self.class.name} Request:\n#{request}" if Object.const_defined?('RAILS_DEFAULT_LOGGER')
|
43
66
|
|
44
67
|
result = @driver.runReport(request)
|
45
68
|
|
46
|
-
RAILS_DEFAULT_LOGGER.debug "
|
47
|
-
|
48
|
-
|
69
|
+
RAILS_DEFAULT_LOGGER.debug "#{self.class.name} Response:\n#{result}" if Object.const_defined?('RAILS_DEFAULT_LOGGER')
|
70
|
+
|
71
|
+
if Object.const_defined?(:ActiveSupport) && ActiveSupport.const_defined?(:XmlMini)
|
72
|
+
# for Rails 2.3+
|
73
|
+
xml = ActiveSupport::XmlMini.parse(result)
|
74
|
+
xml = xml['operationResult']
|
75
|
+
xml.each do |k,v|
|
76
|
+
if v.kind_of?(Hash) && v[ActiveSupport::XmlMini.backend::CONTENT_KEY]
|
77
|
+
xml[k] = [v[ActiveSupport::XmlMini.backend::CONTENT_KEY]]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
else
|
81
|
+
xml = XmlSimple.xml_in_string(result)
|
82
|
+
end
|
83
|
+
|
49
84
|
unless xml['returnCode'].first.to_i == 0
|
50
85
|
raise JasperServer::Error, "JasperServer replied with an error: #{xml['returnMessage'] ? xml['returnMessage'].first : xml.inspect}"
|
51
86
|
end
|
@@ -53,18 +88,19 @@ module JasperServer
|
|
53
88
|
result.instance_variable_get(:@env).external_content['report'].data.content
|
54
89
|
end
|
55
90
|
|
56
|
-
def connect(url, username, password)
|
57
|
-
@driver = connect_to_soap_service(url, username, password)
|
91
|
+
def connect(url, username, password, timeout = 60)
|
92
|
+
@driver = connect_to_soap_service(url, username, password, timeout)
|
58
93
|
end
|
59
94
|
|
60
95
|
protected
|
61
|
-
def connect_to_soap_service(url, username, password)
|
96
|
+
def connect_to_soap_service(url, username, password, timeout = 60)
|
62
97
|
driver = ::SOAP::RPC::Driver.new(url, JASPER_URN)
|
63
98
|
driver.options['protocol.http.basic_auth'] << [url, username, password]
|
99
|
+
driver.options['receive_timeout'] = timeout
|
64
100
|
|
65
101
|
driver.add_method('runReport', 'requestXmlString')
|
66
102
|
return driver
|
67
103
|
end
|
68
104
|
end
|
69
105
|
end
|
70
|
-
end
|
106
|
+
end
|
@@ -18,6 +18,7 @@ module JasperServer
|
|
18
18
|
# are automatically adjusted for timezone).
|
19
19
|
# E.g. <tt>{ 'fruit' => "Apple", 'date' => Time.now}</tt>
|
20
20
|
def initialize(report_unit, output_format, report_params = {})
|
21
|
+
raise ArgumentError, "Missing output_format in report request!" if output_format.nil? || output_format.empty?
|
21
22
|
@report_unit = report_unit
|
22
23
|
@output_format = output_format.upcase
|
23
24
|
@report_params = report_params
|
@@ -34,4 +35,4 @@ module JasperServer
|
|
34
35
|
end
|
35
36
|
|
36
37
|
end
|
37
|
-
end
|
38
|
+
end
|
data/lib/jasperserver-client.rb
CHANGED
data/script/txt2html
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
GEM_NAME = 'jasperserver-client' # what ppl will type to install your gem
|
4
|
-
RUBYFORGE_PROJECT = '
|
4
|
+
RUBYFORGE_PROJECT = 'jasper-client'
|
5
5
|
|
6
6
|
require 'rubygems'
|
7
7
|
begin
|
@@ -15,9 +15,9 @@ end
|
|
15
15
|
require 'redcloth'
|
16
16
|
require 'syntax/convertors/html'
|
17
17
|
require 'erb'
|
18
|
-
require File.dirname(__FILE__) + "/../lib
|
18
|
+
require File.dirname(__FILE__) + "/../lib/jasper_server/version.rb"
|
19
19
|
|
20
|
-
version =
|
20
|
+
version = JasperServer::VERSION::STRING
|
21
21
|
download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
22
22
|
|
23
23
|
def rubyforge_project_id
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gunark-jasperserver-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zukowski
|
@@ -9,11 +9,12 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-08-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hoe
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -39,7 +40,6 @@ files:
|
|
39
40
|
- License.txt
|
40
41
|
- Manifest.txt
|
41
42
|
- PostInstall.txt
|
42
|
-
- README
|
43
43
|
- README.txt
|
44
44
|
- Rakefile
|
45
45
|
- config/hoe.rb
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- test/test_jasperserver-client.rb
|
66
66
|
has_rdoc: true
|
67
67
|
homepage: http://jasper-client.rubyforge.org
|
68
|
+
licenses:
|
68
69
|
post_install_message: |+
|
69
70
|
|
70
71
|
For more information on jasperserver-client, see http://jasperserver-client.rubyforge.org
|
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
94
|
requirements: []
|
94
95
|
|
95
96
|
rubyforge_project: jasper-client
|
96
|
-
rubygems_version: 1.
|
97
|
+
rubygems_version: 1.3.5
|
97
98
|
signing_key:
|
98
99
|
specification_version: 2
|
99
100
|
summary: Ruby-based client for JasperServer. Allows for requesting and fetching reports using Ruby from a networked JasperServer over SOAP.
|
data/README
DELETED
File without changes
|