rjack-jets3t 0.8.1.0-java → 0.9.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,23 @@
1
+ === 0.9.0.0 (2012-7-30)
2
+ * Update to jets3t 0.9.0; now depends on rjack-httpclient-4
3
+ * Add S3Bucket.get, generalize put
4
+ * Upgrade to tarpit ~> 2.0 (build)
5
+
1
6
  === 0.8.1.0 (2011-7-31)
2
- * Updated to jets3t 0.8.1
7
+ * Update to jets3t 0.8.1
3
8
 
4
9
  === 0.8.0.0 (2010-12-28)
5
- * Updated to jets3t 0.8.0
10
+ * Update to jets3t 0.8.0
6
11
 
7
12
  === 0.7.4.0 (2010-8-31)
8
- * Updated to jets3t 0.7.4 (Note
13
+ * Update to jets3t 0.7.4 (Note
9
14
  {Issue #16}[http://bitbucket.org/jmurty/jets3t/issue/16/classnotfoundexception])
10
15
  * Remove require 'rubygems' from lib, require 'java' for imports.
11
16
  * Expand slf4j/logback gem deps for compatibility with
12
17
  slf4j-1.6.x/logback-1.x
13
18
 
14
19
  === 0.7.2.0 (2010-5-13)
15
- * Updated to jets3t 0.7.2
20
+ * Update to jets3t 0.7.2
16
21
  * New S3Bucket wrapper with put/delete methods.
17
22
  * S3Service provides list, get, create S3Bucket.
18
23
  * Set gem platform to java
@@ -7,8 +7,9 @@ assembly.xml
7
7
  pom.xml
8
8
  lib/rjack-jets3t/base.rb
9
9
  lib/rjack-jets3t.rb
10
+ lib/rjack-jets3t/java.rb
10
11
  lib/rjack-jets3t/s3_bucket.rb
11
12
  lib/rjack-jets3t/s3_service.rb
12
13
  test/test_jets3t.rb
13
14
  lib/rjack-jets3t/java-xmlbuilder-0.4.jar
14
- lib/rjack-jets3t/jets3t-0.8.1.jar
15
+ lib/rjack-jets3t/jets3t-0.9.0.jar
data/NOTICE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  rjack-jets3t gem
2
- Copyright (c) 2009-2011 David Kellum
2
+ Copyright (c) 2009-2012 David Kellum
3
3
 
4
4
  This product includes software developed by:
5
5
 
@@ -6,9 +6,9 @@
6
6
 
7
7
  == Description
8
8
 
9
- A gem packaging and initialization facade for the
9
+ A gem packaging and ruby wrapper for the
10
10
  {JetS3t}[http://jets3t.s3.amazonaws.com/index.html]
11
- Amazon Simple Storage Service (S3) client.
11
+ Amazon Web Services client.
12
12
 
13
13
  == Synopsis
14
14
 
@@ -19,12 +19,12 @@ Amazon Simple Storage Service (S3) client.
19
19
 
20
20
  s3 = S3Service.new( :credentials => [ '<access-key>', '<secret-key>' ] )
21
21
 
22
- buckets = s3.service.list_all_buckets
22
+ buckets = s3.jservice.list_all_buckets
23
23
  puts buckets.map { |b| b.name }
24
24
 
25
25
  == Requirements
26
26
 
27
- * rjack-httpclient-3[http://rjack.rubyforge.org/httpclient-3]
27
+ * rjack-httpclient-4[http://rjack.rubyforge.org/httpclient-4]
28
28
  * rjack-commons-codec[http://rjack.rubyforge.org/commons-codec]
29
29
  * rjack-slf4j[http://rjack.rubyforge.org/slf4j]
30
30
  * An SLF4J output adaptor such as 'rjack-slf4j/simple' or
@@ -36,7 +36,7 @@ Amazon Simple Storage Service (S3) client.
36
36
 
37
37
  === rjack-jets3t gem
38
38
 
39
- Copyright (c) 2009-2011 David Kellum
39
+ Copyright (c) 2009-2012 David Kellum
40
40
 
41
41
  Licensed under the Apache License, Version 2.0 (the "License"); you
42
42
  may not use this file except in compliance with the License. You
data/Rakefile CHANGED
@@ -1,42 +1,12 @@
1
1
  # -*- ruby -*-
2
2
 
3
- $LOAD_PATH << './lib'
4
- require 'rjack-jets3t/base'
5
-
6
3
  require 'rubygems'
7
- gem 'rjack-tarpit', '~> 1.3.0'
4
+ require 'bundler/setup'
8
5
  require 'rjack-tarpit'
9
6
 
10
- include RJack
11
-
12
- t = TarPit.new( 'rjack-jets3t', JetS3t::VERSION,
13
- :java_platform, :jars_from_assembly )
14
-
15
- t.specify do |h|
16
- h.developer( "David Kellum", "dek-oss@gravitext.com" )
17
- h.extra_deps += [ [ 'rjack-slf4j', '>= 1.5.8', '< 1.7' ],
18
- [ 'rjack-httpclient-3', '~> 3.1.3' ],
19
- [ 'rjack-commons-codec', '~> 1.4.0' ] ]
20
- h.extra_dev_deps << [ 'rjack-logback', '>= 0.9.18', '< 2.0' ]
21
- h.rdoc_locations << "dekellum@rubyforge.org:/var/www/gforge-projects/rjack/jets3t"
22
- end
7
+ RJack::TarPit.new( 'rjack-jets3t' ) do |tp|
23
8
 
24
- t.assembly_version = 1.0
25
- file 'Manifest.txt' => [ "lib/#{t.name}/base.rb" ]
9
+ tp.rdoc_destinations <<
10
+ 'dekellum@rubyforge.org:/var/www/gforge-projects/rjack/jets3t'
26
11
 
27
- task :check_pom_deps do
28
- t.test_line_match( 'pom.xml',
29
- %r[<version>#{ JetS3t::JETS3T_VERSION }</version>] )
30
12
  end
31
- task :check_history_version do
32
- t.test_line_match( 'History.rdoc', /^==/, / #{t.version} / )
33
- end
34
- task :check_history_date do
35
- t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
36
- end
37
-
38
- task :gem => [ :check_pom_deps, :check_history_version ]
39
- task :tag => [ :check_pom_deps, :check_history_version, :check_history_date ]
40
- task :push => [ :check_history_date ]
41
-
42
- t.define_tasks
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2009-2011 David Kellum
2
+ # Copyright (c) 2009-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -14,16 +14,6 @@
14
14
  # permissions and limitations under the License.
15
15
  #++
16
16
 
17
- require 'rjack-slf4j'
18
- require 'rjack-slf4j/jcl-over-slf4j'
19
- require 'rjack-commons-codec'
20
- require 'rjack-httpclient-3'
21
17
  require 'rjack-jets3t/base'
22
-
23
- module RJack
24
- module JetS3t
25
- Dir.glob( File.join( JETS3T_DIR, '*.jar' ) ).each { |jar| require jar }
26
- end
27
- end
28
-
18
+ require 'rjack-jets3t/java'
29
19
  require 'rjack-jets3t/s3_service'
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2009-2011 David Kellum
2
+ # Copyright (c) 2009-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -17,7 +17,7 @@
17
17
  module RJack
18
18
  module JetS3t
19
19
  # JetS3t java version
20
- JETS3T_VERSION = '0.8.1'
20
+ JETS3T_VERSION = '0.9.0'
21
21
 
22
22
  # rjack-jets3t version
23
23
  VERSION = JETS3T_VERSION + '.0'
@@ -0,0 +1,32 @@
1
+ #--
2
+ # Copyright (c) 2009-2012 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You
6
+ # may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'java'
18
+
19
+ require 'rjack-slf4j'
20
+ require 'rjack-slf4j/jcl-over-slf4j'
21
+ require 'rjack-commons-codec'
22
+ require 'rjack-httpclient-4'
23
+ require 'rjack-jets3t/base'
24
+
25
+ module RJack::JetS3t
26
+ Dir.glob( File.join( JETS3T_DIR, '*.jar' ) ).each { |jar| require jar }
27
+
28
+ import 'org.jets3t.service.S3ServiceException'
29
+
30
+ #Alias to org.jets3t.service.model.S3Bucket
31
+ JS3Bucket = Java::org.jets3t.service.model.S3Bucket
32
+ end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2009-2011 David Kellum
2
+ # Copyright (c) 2009-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -14,90 +14,100 @@
14
14
  # permissions and limitations under the License.
15
15
  #++
16
16
 
17
- require 'rjack-slf4j'
18
- require 'rjack-slf4j/jcl-over-slf4j'
19
- require 'rjack-commons-codec'
20
- require 'rjack-httpclient-3'
21
- require 'rjack-jets3t/base'
17
+ require 'rjack-jets3t/java'
22
18
 
23
- require 'java'
19
+ module RJack::JetS3t
20
+ import 'org.jets3t.service.acl.AccessControlList'
21
+ import 'org.jets3t.service.model.S3Object'
24
22
 
25
- module RJack
26
- module JetS3t
27
- import 'org.jets3t.service.acl.AccessControlList'
28
- import 'org.jets3t.service.model.S3Object'
23
+ # Facade over org.jets3t.service.model.S3Bucket
24
+ class S3Bucket
29
25
 
30
- # Facade over org.jets3t.service.model.S3Bucket
31
- class S3Bucket
26
+ # The S3Service in which this bucket resides
27
+ attr_reader :service
32
28
 
33
- #import 'org.jets3t.service.model.S3Bucket'
34
- #import 'org.jets3t.service.impl.rest.httpclient.RestS3Service'
35
- #import 'org.jets3t.service.security.AWSCredentials'
36
- #import 'org.jets3t.service.Jets3tProperties'
29
+ # The underlying org.jets3t.service.model.S3Bucket
30
+ attr_reader :jbucket
37
31
 
38
- # The S3Service from in which this bucket resides
39
- attr_reader :service
32
+ # Hostname/prefix used use when composing HTTP access URLs.
33
+ attr_accessor :host_prefix
40
34
 
41
- # The underlying org.jets3t.service.model.S3Bucket
42
- attr_reader :jbucket
35
+ # Default ACL for put
36
+ attr_accessor :default_acl
43
37
 
44
- # Hostname/prefix used use when composing HTTP access URLs.
45
- attr_accessor :host_prefix
46
-
47
- # Default ACL for put
48
- attr_accessor :default_acl
49
-
50
- # New bucket wrapper
51
- #
52
- # ==== Parameters
53
- # service<S3Service>:: S3Service in which this bucket resides
54
- # jbucket<org.jets3t.service.model.S3Bucket>:: the bucket
55
- #
56
- # ==== Options (opts)
57
- # :host_prefix<~to_s>:: Host name/prefix to use when composing access
58
- # URLs. (Default: s3.amazonaws.com/bucket-name)
59
- # :default_acl<AccessControlList>:: Default ACL for put
60
- # (Default: AccessControlList::REST_CANNED_PUBLIC_READ)
61
- #
62
- # ==== Raises
63
- # :S3ServiceException:: From JetS3t
64
- # :RuntimeError:: On failure to provide required options
65
- def initialize( service, jbucket, opts = {} )
66
- @service = service
67
- @jbucket = jbucket
68
- @host_prefix = ( opts[ :host_prefix ] ||
69
- [ 's3.amazonaws.com', jbucket.name ].join( '/' ) )
70
- @default_acl = ( opts[ :default_acl ] ||
71
- AccessControlList::REST_CANNED_PUBLIC_READ )
72
- end
38
+ # New bucket wrapper
39
+ #
40
+ # ==== Parameters
41
+ # service<S3Service>:: S3Service in which this bucket resides
42
+ # jbucket<org.jets3t.service.model.S3Bucket>:: the bucket
43
+ #
44
+ # ==== Options (opts)
45
+ # :host_prefix<~to_s>:: Host name/prefix to use when composing access
46
+ # URLs. (Default: s3.amazonaws.com/bucket-name)
47
+ # :default_acl<AccessControlList>:: Default ACL for put
48
+ # (Default: AccessControlList::REST_CANNED_PUBLIC_READ)
49
+ #
50
+ # ==== Raises
51
+ # :S3ServiceException:: From JetS3t
52
+ # :RuntimeError:: On failure to provide required options
53
+ def initialize( service, jbucket, opts = {} )
54
+ @service = service
55
+ @jbucket = jbucket
56
+ @host_prefix = ( opts[ :host_prefix ] ||
57
+ [ 's3.amazonaws.com', jbucket.name ].join( '/' ) )
58
+ @default_acl = ( opts[ :default_acl ] ||
59
+ AccessControlList::REST_CANNED_PUBLIC_READ )
60
+ end
73
61
 
74
- # Bucket name
75
- def name
76
- @jbucket.name
77
- end
62
+ # Bucket name
63
+ def name
64
+ @jbucket.name
65
+ end
78
66
 
79
- # Put object in this S3 bucket at the given name (key). Yields
80
- # S3Object for setting content, acl or other overrides. Returns
81
- # external HTTP url using :host_prefix
82
- # ==== Raises
83
- # :S3ServiceException:: From JetS3t
84
- def put( name, mime_type )
85
- obj = S3Object.new( @jbucket, name )
86
- obj.content_type = mime_type
87
- obj.acl = @default_acl
88
- yield obj
89
- @service.jservice.put_object( @jbucket, obj )
90
- "http://%s/%s" % [ @host_prefix, name ]
67
+ # Put object in this S3 bucket at the given key. Yields
68
+ # S3Object for setting content, acl or other overrides if
69
+ # given. Optional data may be passed as a Ruby String which will
70
+ # be converted to java_bytes. Returns external HTTP url using
71
+ # :host_prefix
72
+ # ==== Raises
73
+ # :S3ServiceException:: From JetS3t
74
+ def put( key, mime_type, rbytes = nil )
75
+ if rbytes
76
+ rbytes = rbytes.to_java_bytes if rbytes.respond_to?( :to_java_bytes )
77
+ obj = S3Object.new( key, rbytes )
78
+ else
79
+ obj = S3Object.new( @jbucket, key )
91
80
  end
81
+ obj.content_type = mime_type
82
+ obj.acl = @default_acl
83
+ yield obj if block_given?
84
+ @service.jservice.put_object( @jbucket, obj )
85
+ "http://%s/%s" % [ @host_prefix, key ]
86
+ end
92
87
 
93
- # Delete object with the given name in this bucket
94
- # ==== Raises
95
- # :S3ServiceException:: From JetS3t
96
- def delete( name )
97
- @service.jservice.delete_object( @jbucket, name )
98
- end
88
+ # Get and yield S3Object from this S3 bucket for the given
89
+ # key. Ensures that on return from block, the objects
90
+ # date_input_stream will be closed.
91
+ # ==== Raises
92
+ # :S3ServiceException:: From JetS3t
93
+ def get( key )
94
+ obj = @service.jservice.get_object( @jbucket.name, key )
95
+ yield obj
96
+ nil
97
+ ensure
98
+ if obj
99
+ din = obj.data_input_stream
100
+ din.close if din
101
+ end
102
+ end
99
103
 
104
+ # Delete object with the given name in this bucket
105
+ # ==== Raises
106
+ # :S3ServiceException:: From JetS3t
107
+ def delete( name )
108
+ @service.jservice.delete_object( @jbucket, name )
100
109
  end
101
110
 
102
111
  end
112
+
103
113
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2009-2011 David Kellum
2
+ # Copyright (c) 2009-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -14,103 +14,90 @@
14
14
  # permissions and limitations under the License.
15
15
  #++
16
16
 
17
- require 'rjack-slf4j'
18
- require 'rjack-slf4j/jcl-over-slf4j'
19
- require 'rjack-commons-codec'
20
- require 'rjack-httpclient-3'
21
- require 'rjack-jets3t/base'
22
-
17
+ require 'rjack-jets3t/java'
23
18
  require 'rjack-jets3t/s3_bucket'
24
19
 
25
- require 'java'
26
-
27
- module RJack
28
- module JetS3t
29
- import 'org.jets3t.service.S3ServiceException'
30
-
31
- JS3Bucket = Java::org.jets3t.service.model.S3Bucket
32
-
33
- # Initialization Wrapper around
34
- # RestS3Service[http://jets3t.s3.amazonaws.com/api/org/jets3t/service/impl/rest/httpclient/RestS3Service.html]
35
- class S3Service
36
- import 'org.jets3t.service.impl.rest.httpclient.RestS3Service'
37
- import 'org.jets3t.service.security.AWSCredentials'
38
- import 'org.jets3t.service.Jets3tProperties'
39
- # import 'org.jets3t.service.acl.AccessControlList'
40
-
41
- # The underlying org.jets3t.service.impl.rest.httpclient.RestS3Service
42
- attr_reader :jservice
43
-
44
- alias :service :jservice
45
-
46
- # New REST S3 service instance given options hash.
47
- # ==== Options (opts)
48
- # :credentials<Array[String,String]>:: Required [access,secret] key
49
- # :http_client<org.apache.commons.HttpClient>:: A pre-configured replacement
50
- # HttpClient (3.x)
51
- # (Default: JetS3t provided)
52
- # String<~to_s>:: Other options as defined in
53
- # {JetS3t Properties}[http://jets3t.s3.amazonaws.com/toolkit/configuration.html].
54
- # HTTP client properties only apply to JetS3t's default
55
- # client (:http_client not set), and the timeout
56
- # parameters are here defaulted to 5 seconds vs. the JetS3t
57
- # 60 second originals.
58
- #
59
- # ==== Raises
60
- # :S3ServiceException:: From JetS3t
61
- # :RuntimeError:: On failure to provide required options
62
- def initialize( opts = {} )
63
- opts = opts.dup
64
-
65
- creds = opts.delete( :credentials )
66
- unless creds && (2..3) === creds.length
67
- raise "Missing required :credentials [public,secret] keys"
68
- end
69
- creds = AWSCredentials.new( *creds )
70
-
71
- http = opts.delete( :http_client )
72
- unless http
73
- hdefs = { 'httpclient.connection-timeout-ms' => 5000,
74
- 'httpclient.socket-timeout-ms' => 5000 }
75
- opts = hdefs.merge( opts )
76
- end
77
-
78
- props = Jets3tProperties.new
79
- opts.each { |k,v| props.set_property( k.to_s, v.to_s ) }
80
-
81
- @jservice = RestS3Service.new( creds, nil, nil, props )
82
-
83
- @jservice.http_client = http if http
20
+ module RJack::JetS3t
21
+
22
+ # Initialization Wrapper around
23
+ # RestS3Service[http://jets3t.s3.amazonaws.com/api/org/jets3t/service/impl/rest/httpclient/RestS3Service.html]
24
+ class S3Service
25
+ import 'org.jets3t.service.impl.rest.httpclient.RestS3Service'
26
+ import 'org.jets3t.service.security.AWSCredentials'
27
+ import 'org.jets3t.service.Jets3tProperties'
28
+
29
+ # The underlying org.jets3t.service.impl.rest.httpclient.RestS3Service
30
+ attr_reader :jservice
31
+
32
+ alias :service :jservice
33
+
34
+ # New REST S3 service instance given options hash.
35
+ # ==== Options (opts)
36
+ # :credentials<Array[String,String]>:: Required [access,secret] key
37
+ # :http_client<HttpClient>:: A pre-configured replacement
38
+ # org.apache.http.client.HttpClient
39
+ # (4.x) (Default: JetS3t provided)
40
+ # String<~to_s>:: Other options as defined in
41
+ # {JetS3t Properties}[http://jets3t.s3.amazonaws.com/toolkit/configuration.html].
42
+ # HTTP client properties only apply to JetS3t's default
43
+ # client (:http_client not set), and the timeout
44
+ # parameters are here defaulted to 5 seconds vs. the JetS3t
45
+ # 60 second originals.
46
+ #
47
+ # ==== Raises
48
+ # :S3ServiceException:: From JetS3t
49
+ # :RuntimeError:: On failure to provide required options
50
+ def initialize( opts = {} )
51
+ opts = opts.dup
52
+
53
+ creds = opts.delete( :credentials )
54
+ unless creds && (2..3) === creds.length
55
+ raise "Missing required :credentials [public,secret] keys"
84
56
  end
57
+ creds = AWSCredentials.new( *creds )
85
58
 
86
- # Return the S3Bucket with the specified name
87
- def []( bucket_name, opts = {} )
88
- jbucket = @jservice.get_bucket( bucket_name )
89
- S3Bucket.new( self, jbucket, opts )
59
+ http = opts.delete( :http_client )
60
+ unless http
61
+ hdefs = { 'httpclient.connection-timeout-ms' => 5000,
62
+ 'httpclient.socket-timeout-ms' => 5000 }
63
+ opts = hdefs.merge( opts )
90
64
  end
91
65
 
92
- alias :bucket :[]
66
+ props = Jets3tProperties.new
67
+ opts.each { |k,v| props.set_property( k.to_s, v.to_s ) }
93
68
 
94
- # Return Array of all buckets in this S3Service account instance.
95
- def buckets( opts = {} )
96
- jbuckets = @jservice.list_all_buckets
97
- jbuckets.map { |jb| S3Bucket.new( self, jb, opts ) }
98
- end
69
+ @jservice = RestS3Service.new( creds, nil, nil, props )
99
70
 
100
- # Create new bucket with the specified name
101
- def create_bucket( bucket_name, opts = {} )
102
- jbucket = JS3Bucket.new( bucket_name )
103
- yield jbucket if block_given?
104
- jbucket = @jservice.create_bucket( jbucket )
105
- S3Bucket.new( self, jbucket, opts )
106
- end
71
+ @jservice.http_client = http if http
72
+ end
107
73
 
108
- # Delete the specified S3Bucket instance
109
- def delete_bucket( bucket )
110
- @jservice.delete_bucket( bucket.jbucket )
111
- end
74
+ # Return the S3Bucket with the specified name
75
+ def []( bucket_name, opts = {} )
76
+ jbucket = @jservice.get_bucket( bucket_name )
77
+ S3Bucket.new( self, jbucket, opts )
78
+ end
112
79
 
80
+ alias :bucket :[]
81
+
82
+ # Return Array of all buckets in this S3Service account instance.
83
+ def buckets( opts = {} )
84
+ jbuckets = @jservice.list_all_buckets
85
+ jbuckets.map { |jb| S3Bucket.new( self, jb, opts ) }
86
+ end
87
+
88
+ # Create new bucket with the specified name
89
+ def create_bucket( bucket_name, opts = {} )
90
+ jbucket = JS3Bucket.new( bucket_name )
91
+ yield jbucket if block_given?
92
+ jbucket = @jservice.create_bucket( jbucket )
93
+ S3Bucket.new( self, jbucket, opts )
94
+ end
95
+
96
+ # Delete the specified S3Bucket instance
97
+ def delete_bucket( bucket )
98
+ @jservice.delete_bucket( bucket.jbucket )
113
99
  end
114
100
 
115
101
  end
102
+
116
103
  end
data/pom.xml CHANGED
@@ -17,7 +17,7 @@
17
17
  <dependency>
18
18
  <groupId>net.java.dev.jets3t</groupId>
19
19
  <artifactId>jets3t</artifactId>
20
- <version>0.8.1</version>
20
+ <version>0.9.0</version>
21
21
  <exclusions>
22
22
  <exclusion>
23
23
  <groupId>commons-logging</groupId>
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env jruby
2
2
  #.hashdot.profile += jruby-shortlived
3
+
3
4
  #--
4
- # Copyright (c) 2009-2011 David Kellum
5
+ # Copyright (c) 2009-2012 David Kellum
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
7
8
  # may not use this file except in compliance with the License. You
@@ -16,18 +17,22 @@
16
17
  # permissions and limitations under the License.
17
18
  #++
18
19
 
19
- $LOAD_PATH.unshift File.join( File.dirname(__FILE__), "..", "lib" )
20
-
21
20
  require 'rubygems'
21
+ require 'bundler/setup'
22
+
22
23
  require 'rjack-logback'
23
24
 
24
- RJack::Logback.config_console( :level => RJack::Logback::INFO )
25
+ RJack::Logback.config_console( :stderr => true )
26
+ if ARGV.include?( '-v' ) || ARGV.include?( '--verbose' )
27
+ RJack::Logback.root.level = RJack::Logback::DEBUG
28
+ end
25
29
 
26
- require 'rjack-jets3t'
30
+ require 'minitest/unit'
31
+ require 'minitest/autorun'
27
32
 
28
- require 'test/unit'
33
+ require 'rjack-jets3t'
29
34
 
30
- class TestJets3t < Test::Unit::TestCase
35
+ class TestJets3t < MiniTest::Unit::TestCase
31
36
  include RJack::JetS3t
32
37
 
33
38
  import "java.io.ByteArrayInputStream"
@@ -58,7 +63,7 @@ class TestJets3t < Test::Unit::TestCase
58
63
  @s3.delete_bucket( @tbucket ) if @tbucket
59
64
  end
60
65
 
61
- def test_write
66
+ def test_write_stream
62
67
  assert( @s3.buckets.any? { |b| b.name == @tbucket.name } )
63
68
 
64
69
  url = @tbucket.put( "testkey", "text/plain" ) do |obj|
@@ -68,6 +73,31 @@ class TestJets3t < Test::Unit::TestCase
68
73
  end
69
74
  assert_equal( 'http://s3.amazonaws.com/test.rjack.rubyforge.org/testkey',
70
75
  url )
76
+ called = false
77
+ @tbucket.get( "testkey" ) do |obj|
78
+ assert_equal( "text/plain", obj.content_type )
79
+ assert_equal( "hello", obj.data_input_stream.to_io.read )
80
+ called = true
81
+ end
82
+ assert( called )
83
+
84
+ @tbucket.delete( "testkey" )
85
+ end
86
+
87
+ def test_write_bytes
88
+ assert( @s3.buckets.any? { |b| b.name == @tbucket.name } )
89
+
90
+ url = @tbucket.put( "testkey", "text/plain", "hello" )
91
+ assert_equal( 'http://s3.amazonaws.com/test.rjack.rubyforge.org/testkey',
92
+ url )
93
+ called = false
94
+ @tbucket.get( "testkey" ) do |obj|
95
+ assert_equal( "text/plain", obj.content_type )
96
+ assert_equal( "hello", obj.data_input_stream.to_io.read )
97
+ called = true
98
+ end
99
+ assert( called )
100
+
71
101
  @tbucket.delete( "testkey" )
72
102
  end
73
103
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rjack-jets3t
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.1.0
5
+ version: 0.9.0.0
6
6
  platform: java
7
7
  authors:
8
8
  - David Kellum
@@ -10,13 +10,11 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-31 00:00:00 -07:00
14
- default_executable:
13
+ date: 2012-07-30 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rjack-slf4j
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ version_requirements: &id001 !ruby/object:Gem::Requirement
20
18
  none: false
21
19
  requirements:
22
20
  - - ">="
@@ -25,34 +23,40 @@ dependencies:
25
23
  - - <
26
24
  - !ruby/object:Gem::Version
27
25
  version: "1.7"
26
+ requirement: *id001
27
+ prerelease: false
28
28
  type: :runtime
29
- version_requirements: *id001
30
29
  - !ruby/object:Gem::Dependency
31
- name: rjack-httpclient-3
32
- prerelease: false
33
- requirement: &id002 !ruby/object:Gem::Requirement
30
+ name: rjack-httpclient-4
31
+ version_requirements: &id002 !ruby/object:Gem::Requirement
34
32
  none: false
35
33
  requirements:
36
- - - ~>
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 4.1.2
37
+ - - <
37
38
  - !ruby/object:Gem::Version
38
- version: 3.1.3
39
+ version: "4.3"
40
+ requirement: *id002
41
+ prerelease: false
39
42
  type: :runtime
40
- version_requirements: *id002
41
43
  - !ruby/object:Gem::Dependency
42
44
  name: rjack-commons-codec
43
- prerelease: false
44
- requirement: &id003 !ruby/object:Gem::Requirement
45
+ version_requirements: &id003 !ruby/object:Gem::Requirement
45
46
  none: false
46
47
  requirements:
47
- - - ~>
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.4.2
51
+ - - <
48
52
  - !ruby/object:Gem::Version
49
- version: 1.4.0
53
+ version: "1.7"
54
+ requirement: *id003
55
+ prerelease: false
50
56
  type: :runtime
51
- version_requirements: *id003
52
57
  - !ruby/object:Gem::Dependency
53
58
  name: rjack-logback
54
- prerelease: false
55
- requirement: &id004 !ruby/object:Gem::Requirement
59
+ version_requirements: &id004 !ruby/object:Gem::Requirement
56
60
  none: false
57
61
  requirements:
58
62
  - - ">="
@@ -61,23 +65,32 @@ dependencies:
61
65
  - - <
62
66
  - !ruby/object:Gem::Version
63
67
  version: "2.0"
68
+ requirement: *id004
69
+ prerelease: false
64
70
  type: :development
65
- version_requirements: *id004
66
71
  - !ruby/object:Gem::Dependency
67
- name: rjack-tarpit
72
+ name: minitest
73
+ version_requirements: &id005 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: "2.2"
79
+ requirement: *id005
68
80
  prerelease: false
69
- requirement: &id005 !ruby/object:Gem::Requirement
81
+ type: :development
82
+ - !ruby/object:Gem::Dependency
83
+ name: rjack-tarpit
84
+ version_requirements: &id006 !ruby/object:Gem::Requirement
70
85
  none: false
71
86
  requirements:
72
87
  - - ~>
73
88
  - !ruby/object:Gem::Version
74
- version: 1.3.3
89
+ version: "2.0"
90
+ requirement: *id006
91
+ prerelease: false
75
92
  type: :development
76
- version_requirements: *id005
77
- description: |-
78
- A gem packaging and initialization facade for the
79
- {JetS3t}[http://jets3t.s3.amazonaws.com/index.html]
80
- Amazon Simple Storage Service (S3) client.
93
+ description:
81
94
  email:
82
95
  - dek-oss@gravitext.com
83
96
  executables: []
@@ -85,8 +98,6 @@ executables: []
85
98
  extensions: []
86
99
 
87
100
  extra_rdoc_files:
88
- - Manifest.txt
89
- - NOTICE.txt
90
101
  - History.rdoc
91
102
  - README.rdoc
92
103
  files:
@@ -99,12 +110,12 @@ files:
99
110
  - pom.xml
100
111
  - lib/rjack-jets3t/base.rb
101
112
  - lib/rjack-jets3t.rb
113
+ - lib/rjack-jets3t/java.rb
102
114
  - lib/rjack-jets3t/s3_bucket.rb
103
115
  - lib/rjack-jets3t/s3_service.rb
104
116
  - test/test_jets3t.rb
105
117
  - lib/rjack-jets3t/java-xmlbuilder-0.4.jar
106
- - lib/rjack-jets3t/jets3t-0.8.1.jar
107
- has_rdoc: true
118
+ - lib/rjack-jets3t/jets3t-0.9.0.jar
108
119
  homepage: http://rjack.rubyforge.org/jets3t
109
120
  licenses: []
110
121
 
@@ -119,19 +130,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
130
  requirements:
120
131
  - - ">="
121
132
  - !ruby/object:Gem::Version
133
+ hash: 2
134
+ segments:
135
+ - 0
122
136
  version: "0"
123
137
  required_rubygems_version: !ruby/object:Gem::Requirement
124
138
  none: false
125
139
  requirements:
126
140
  - - ">="
127
141
  - !ruby/object:Gem::Version
142
+ hash: 2
143
+ segments:
144
+ - 0
128
145
  version: "0"
129
146
  requirements: []
130
147
 
131
- rubyforge_project: rjack-jets3t
132
- rubygems_version: 1.5.1
148
+ rubyforge_project:
149
+ rubygems_version: 1.8.15
133
150
  signing_key:
134
151
  specification_version: 3
135
- summary: A gem packaging and initialization facade for the {JetS3t}[http://jets3t.s3.amazonaws.com/index.html] Amazon Simple Storage Service (S3) client.
136
- test_files:
137
- - test/test_jets3t.rb
152
+ summary: A gem packaging and ruby wrapper for the JetS3t Amazon Web Services client.
153
+ test_files: []
154
+