jasper-client 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +22 -0
- data/VERSION +1 -1
- data/bin/walker +55 -0
- data/lib/jasper-client/jasper_client.rb +5 -2
- metadata +8 -6
data/COPYING
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2010 xforty technologies (Tangeis, LLC)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/bin/walker
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
puts File.dirname(__FILE__)
|
4
|
+
|
5
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib', 'jasper-client')
|
6
|
+
|
7
|
+
p $:
|
8
|
+
|
9
|
+
require 'jasper-client'
|
10
|
+
require 'rubygems'
|
11
|
+
|
12
|
+
|
13
|
+
wsdl = 'http://localhost:8080/jasperserver/services/repository?wsdl'
|
14
|
+
user = pass = 'jasperadmin'
|
15
|
+
|
16
|
+
top = ARGV.shift
|
17
|
+
|
18
|
+
#::Savon::Request.log = true;
|
19
|
+
|
20
|
+
client = JasperClient::RepositoryService.new(wsdl, user, pass)
|
21
|
+
|
22
|
+
def save_resource(client, res)
|
23
|
+
puts "%10s %s" % [ res.type, res.uri_string ]
|
24
|
+
r = client.get do |request|
|
25
|
+
request.resourceDescriptor :name => '', :wsType => '', :uriString => res.uri_string, :isNew => 'false'
|
26
|
+
end
|
27
|
+
p r.success?
|
28
|
+
puts r.xml_doc.to_xml
|
29
|
+
puts r.xml_doc
|
30
|
+
save_resource(client, res)
|
31
|
+
end
|
32
|
+
|
33
|
+
def list_folder(client, path, &blk)
|
34
|
+
response = client.list do |request|
|
35
|
+
request.resourceDescriptor :name => '', :wsType => 'folder', :uriString => path, :isNew => :false do |res|
|
36
|
+
res.label 'null'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
unless response.success?
|
40
|
+
puts "Request Failed: %s" % [ response.message ]
|
41
|
+
end
|
42
|
+
response.each &blk
|
43
|
+
response.select{ |res|
|
44
|
+
"folder" == res.type
|
45
|
+
}.each { |res|
|
46
|
+
list_folder(client, res.uri_string,&blk)
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
list_folder(client,top) do |res|
|
51
|
+
puts "======================================================"
|
52
|
+
puts "%14s %s" % [ res.type, res.uri_string ]
|
53
|
+
save_resource(client, res)
|
54
|
+
end
|
55
|
+
|
@@ -39,7 +39,7 @@ module JasperClient
|
|
39
39
|
def initialize_resources(resources)
|
40
40
|
@resources = []
|
41
41
|
resources.each do |res|
|
42
|
-
@resources <<
|
42
|
+
@resources << Resource.new(res)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -158,11 +158,12 @@ module JasperClient
|
|
158
158
|
|
159
159
|
# Extract resourceDescriptors from the response and drop them into @resources.
|
160
160
|
def collect_resources
|
161
|
-
@resources = @xml_doc.search('./resourceDescriptor').map { |r| Resource.new(r) }
|
161
|
+
@resources = @xml_doc.search('./operationResult/resourceDescriptor').map { |r| Resource.new(r) }
|
162
162
|
end
|
163
163
|
|
164
164
|
# Response from a list request.
|
165
165
|
class ListResponse < Response
|
166
|
+
include Enumerable
|
166
167
|
# Initialize the list response from a Savon response. The listReturn element is
|
167
168
|
# pulled from the response, and each resourceDescriptor child of that element is
|
168
169
|
# collected into a list as each item in the list.
|
@@ -177,6 +178,8 @@ module JasperClient
|
|
177
178
|
def items
|
178
179
|
resources
|
179
180
|
end
|
181
|
+
|
182
|
+
def each(&blk); @resources.each(&blk); end
|
180
183
|
end
|
181
184
|
|
182
185
|
# Response from a get request.
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
- 0
|
8
7
|
- 1
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andrew Libby
|
@@ -14,24 +14,26 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
18
|
-
default_executable:
|
17
|
+
date: 2010-10-27 00:00:00 -04:00
|
18
|
+
default_executable: walker
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: Client for JasperServer
|
22
22
|
email: alibby@xforty.com
|
23
|
-
executables:
|
24
|
-
|
23
|
+
executables:
|
24
|
+
- walker
|
25
25
|
extensions: []
|
26
26
|
|
27
27
|
extra_rdoc_files:
|
28
28
|
- LICENSE
|
29
29
|
- README.rdoc
|
30
30
|
files:
|
31
|
+
- COPYING
|
31
32
|
- LICENSE
|
32
33
|
- README.rdoc
|
33
34
|
- Rakefile
|
34
35
|
- VERSION
|
36
|
+
- bin/walker
|
35
37
|
- lib/jasper-client.rb
|
36
38
|
- lib/jasper-client/http_multipart.rb
|
37
39
|
- lib/jasper-client/jasper_client.rb
|