rjack-jets3t 0.7.2.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +10 -0
- data/Manifest.txt +13 -0
- data/NOTICE.txt +20 -0
- data/README.rdoc +66 -0
- data/Rakefile +43 -0
- data/assembly.xml +14 -0
- data/lib/rjack-jets3t/base.rb +27 -0
- data/lib/rjack-jets3t/jets3t-0.7.2.jar +0 -0
- data/lib/rjack-jets3t/s3_bucket.rb +101 -0
- data/lib/rjack-jets3t/s3_service.rb +114 -0
- data/lib/rjack-jets3t.rb +29 -0
- data/pom.xml +68 -0
- data/test/test_jets3t.rb +79 -0
- metadata +152 -0
data/History.rdoc
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
=== 0.7.2.0 (2010-5-13)
|
2
|
+
* Updated to jets3t 0.7.2
|
3
|
+
* New S3Bucket wrapper with put/delete methods.
|
4
|
+
* S3Service provides list, get, create S3Bucket.
|
5
|
+
* Set gem platform to java
|
6
|
+
* Upgraded to tarpit ~> 1.2.0
|
7
|
+
* Remove require 'rubygems' from lib.
|
8
|
+
|
9
|
+
=== 0.7.1.0 (2009-10-17)
|
10
|
+
* Initial release based on jets3t 0.7.1
|
data/Manifest.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
History.rdoc
|
2
|
+
Manifest.txt
|
3
|
+
NOTICE.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
assembly.xml
|
7
|
+
pom.xml
|
8
|
+
lib/rjack-jets3t/base.rb
|
9
|
+
lib/rjack-jets3t.rb
|
10
|
+
lib/rjack-jets3t/s3_bucket.rb
|
11
|
+
lib/rjack-jets3t/s3_service.rb
|
12
|
+
test/test_jets3t.rb
|
13
|
+
lib/rjack-jets3t/jets3t-0.7.2.jar
|
data/NOTICE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
rjack-jets3t gem
|
2
|
+
Copyright (c) 2009-2010 David Kellum
|
3
|
+
|
4
|
+
This product includes software developed by:
|
5
|
+
|
6
|
+
jets3t (java)
|
7
|
+
Copyright (c) 2009 James Murty, 2008 Zmanda Inc
|
8
|
+
|
9
|
+
JMX instrumentation code was contributed by:
|
10
|
+
Copyright (c) 2009 Doug MacEachern (Hyperic.com)
|
11
|
+
|
12
|
+
The Apache Software Foundation (http://www.apache.org/).
|
13
|
+
|
14
|
+
The ExoLab Project (http://www.exolab.org/)
|
15
|
+
|
16
|
+
Sun Microsystems (http://www.sun.com/)
|
17
|
+
|
18
|
+
Codehaus (http://castor.codehaus.org)
|
19
|
+
|
20
|
+
Safehaus (http://jug.safehaus.org/Home)
|
data/README.rdoc
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
= rjack-jets3t
|
2
|
+
|
3
|
+
* http://rjack.rubyforge.org
|
4
|
+
* http://rubyforge.org/projects/rjack
|
5
|
+
|
6
|
+
== Description
|
7
|
+
|
8
|
+
A gem packaging and initialization facade for the
|
9
|
+
{JetS3t}[http://jets3t.s3.amazonaws.com/index.html]
|
10
|
+
Amazon Simple Storage Service (S3) client.
|
11
|
+
|
12
|
+
== Synopsis
|
13
|
+
|
14
|
+
require 'rjack-logback'
|
15
|
+
require 'rjack-jets3t'
|
16
|
+
|
17
|
+
include RJack::Jets3t
|
18
|
+
|
19
|
+
s3 = S3Service.new( :credentials => [ '<access-key>', '<secret-key>' ] )
|
20
|
+
|
21
|
+
buckets = s3.service.list_all_buckets
|
22
|
+
puts buckets.map { |b| b.name }
|
23
|
+
|
24
|
+
== Requirements
|
25
|
+
|
26
|
+
* rjack-httpclient-3[http://rjack.rubyforge.org/httpclient-3]
|
27
|
+
* rjack-commons-codec[http://rjack.rubyforge.org/commons-codec]
|
28
|
+
* rjack-slf4j[http://rjack.rubyforge.org/slf4j]
|
29
|
+
* An SLF4J output adaptor such as 'rjack-slf4j/simple' or
|
30
|
+
rjack-logback[http://rjack.rubyforge.org/logback] must be require'd
|
31
|
+
before rjack-jets3t. (The rjack-logback gem is listed as a
|
32
|
+
development dependency only.)
|
33
|
+
|
34
|
+
== License
|
35
|
+
|
36
|
+
=== rjack-jets3t gem
|
37
|
+
|
38
|
+
Copyright (c) 2009-2010 David Kellum
|
39
|
+
|
40
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you
|
41
|
+
may not use this file except in compliance with the License. You
|
42
|
+
may obtain a copy of the License at:
|
43
|
+
|
44
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
45
|
+
|
46
|
+
Unless required by applicable law or agreed to in writing, software
|
47
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
48
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
49
|
+
implied. See the License for the specific language governing
|
50
|
+
permissions and limitations under the License.
|
51
|
+
|
52
|
+
=== JetS3t (java)
|
53
|
+
|
54
|
+
Copyright (c) 2009 James Murty, 2008 Zmanda Inc
|
55
|
+
|
56
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
57
|
+
you may not use this file except in compliance with the License.
|
58
|
+
You may obtain a copy of the License at
|
59
|
+
|
60
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
61
|
+
|
62
|
+
Unless required by applicable law or agreed to in writing, software
|
63
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
64
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
65
|
+
implied. See the License for the specific language governing
|
66
|
+
permissions and limitations under the License.
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
$LOAD_PATH << './lib'
|
4
|
+
require 'rjack-jets3t/base'
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
gem 'rjack-tarpit', '~> 1.2.0'
|
8
|
+
require 'rjack-tarpit'
|
9
|
+
|
10
|
+
include RJack
|
11
|
+
|
12
|
+
t = TarPit.new( 'rjack-jets3t', JetS3t::VERSION, :java_platform )
|
13
|
+
|
14
|
+
t.specify do |h|
|
15
|
+
h.developer( "David Kellum", "dek-oss@gravitext.com" )
|
16
|
+
h.extra_deps += [ [ 'rjack-slf4j', '~> 1.5.8' ],
|
17
|
+
[ 'rjack-httpclient-3', '~> 3.1.3' ],
|
18
|
+
[ 'rjack-commons-codec', '~> 1.4.0' ] ]
|
19
|
+
h.extra_dev_deps << [ 'rjack-logback', '>= 0.9.17']
|
20
|
+
h.rubyforge_name = "rjack"
|
21
|
+
h.remote_rdoc_dir = "jets3t"
|
22
|
+
end
|
23
|
+
|
24
|
+
t.assembly_version = 1.0
|
25
|
+
t.jars = [ "jets3t-#{ JetS3t::JETS3T_VERSION }.jar" ]
|
26
|
+
file 'Manifest.txt' => [ "lib/#{t.name}/base.rb" ]
|
27
|
+
|
28
|
+
task :check_pom_deps do
|
29
|
+
t.test_line_match( 'pom.xml',
|
30
|
+
%r[<version>#{ JetS3t::JETS3T_VERSION }</version>] )
|
31
|
+
end
|
32
|
+
task :check_history_version do
|
33
|
+
t.test_line_match( 'History.rdoc', /^==/, / #{t.version} / )
|
34
|
+
end
|
35
|
+
task :check_history_date do
|
36
|
+
t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
|
37
|
+
end
|
38
|
+
|
39
|
+
task :gem => [ :check_pom_deps, :check_history_version ]
|
40
|
+
task :tag => [ :check_pom_deps, :check_history_version, :check_history_date ]
|
41
|
+
task :push => [ :check_history_date ]
|
42
|
+
|
43
|
+
t.define_tasks
|
data/assembly.xml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<assembly>
|
2
|
+
<id>bin</id>
|
3
|
+
<formats>
|
4
|
+
<format>dir</format>
|
5
|
+
</formats>
|
6
|
+
<includeBaseDirectory>false</includeBaseDirectory>
|
7
|
+
<dependencySets>
|
8
|
+
<dependencySet>
|
9
|
+
<includes>
|
10
|
+
<include>net.java.dev.jets3t:jets3t</include>
|
11
|
+
</includes>
|
12
|
+
</dependencySet>
|
13
|
+
</dependencySets>
|
14
|
+
</assembly>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009-2010 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
|
+
module RJack
|
18
|
+
module JetS3t
|
19
|
+
# JetS3t java version
|
20
|
+
JETS3T_VERSION = '0.7.2'
|
21
|
+
|
22
|
+
# rjack-jets3t version
|
23
|
+
VERSION = JETS3T_VERSION + '.0'
|
24
|
+
|
25
|
+
JETS3T_DIR = File.dirname( __FILE__ ) # :nodoc:
|
26
|
+
end
|
27
|
+
end
|
Binary file
|
@@ -0,0 +1,101 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009-2010 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 '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
|
+
|
23
|
+
module RJack
|
24
|
+
module JetS3t
|
25
|
+
import 'org.jets3t.service.acl.AccessControlList'
|
26
|
+
import 'org.jets3t.service.model.S3Object'
|
27
|
+
|
28
|
+
# Facade over org.jets3t.service.model.S3Bucket
|
29
|
+
class S3Bucket
|
30
|
+
|
31
|
+
#import 'org.jets3t.service.model.S3Bucket'
|
32
|
+
#import 'org.jets3t.service.impl.rest.httpclient.RestS3Service'
|
33
|
+
#import 'org.jets3t.service.security.AWSCredentials'
|
34
|
+
#import 'org.jets3t.service.Jets3tProperties'
|
35
|
+
|
36
|
+
# The S3Service from in which this bucket resides
|
37
|
+
attr_reader :service
|
38
|
+
|
39
|
+
# The underlying org.jets3t.service.model.S3Bucket
|
40
|
+
attr_reader :jbucket
|
41
|
+
|
42
|
+
# Hostname/prefix used use when composing HTTP access URLs.
|
43
|
+
attr_accessor :host_prefix
|
44
|
+
|
45
|
+
# Default ACL for put
|
46
|
+
attr_accessor :default_acl
|
47
|
+
|
48
|
+
# New bucket wrapper
|
49
|
+
#
|
50
|
+
# ==== Parameters
|
51
|
+
# service<S3Service>:: S3Service in which this bucket resides
|
52
|
+
# jbucket<org.jets3t.service.model.S3Bucket>:: the bucket
|
53
|
+
#
|
54
|
+
# ==== Options (opts)
|
55
|
+
# :host_prefix<~to_s>:: Host name/prefix to use when composing access
|
56
|
+
# URLs. (Default: s3.amazonaws.com/bucket-name)
|
57
|
+
# :default_acl<AccessControlList>:: Default ACL for put
|
58
|
+
# (Default: AccessControlList::REST_CANNED_PUBLIC_READ)
|
59
|
+
#
|
60
|
+
# ==== Raises
|
61
|
+
# :S3ServiceException:: From JetS3t
|
62
|
+
# :RuntimeError:: On failure to provide required options
|
63
|
+
def initialize( service, jbucket, opts = {} )
|
64
|
+
@service = service
|
65
|
+
@jbucket = jbucket
|
66
|
+
@host_prefix = ( opts[ :host_prefix ] ||
|
67
|
+
[ 's3.amazonaws.com', jbucket.name ].join( '/' ) )
|
68
|
+
@default_acl = ( opts[ :default_acl ] ||
|
69
|
+
AccessControlList::REST_CANNED_PUBLIC_READ )
|
70
|
+
end
|
71
|
+
|
72
|
+
# Bucket name
|
73
|
+
def name
|
74
|
+
@jbucket.name
|
75
|
+
end
|
76
|
+
|
77
|
+
# Put object in this S3 bucket at the given name (key). Yields
|
78
|
+
# S3Object for setting content, acl or other overrides. Returns
|
79
|
+
# external HTTP url using :host_prefix
|
80
|
+
# ==== Raises
|
81
|
+
# :S3ServiceException:: From JetS3t
|
82
|
+
def put( name, mime_type )
|
83
|
+
obj = S3Object.new( @jbucket, name )
|
84
|
+
obj.content_type = mime_type
|
85
|
+
obj.acl = @default_acl
|
86
|
+
yield obj
|
87
|
+
@service.jservice.put_object( @jbucket, obj )
|
88
|
+
"http://%s/%s" % [ @host_prefix, name ]
|
89
|
+
end
|
90
|
+
|
91
|
+
# Delete object with the given name in this bucket
|
92
|
+
# ==== Raises
|
93
|
+
# :S3ServiceException:: From JetS3t
|
94
|
+
def delete( name )
|
95
|
+
@service.jservice.delete_object( @jbucket, name )
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009-2010 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 '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
|
+
|
23
|
+
require 'rjack-jets3t/s3_bucket'
|
24
|
+
|
25
|
+
module RJack
|
26
|
+
module JetS3t
|
27
|
+
import 'org.jets3t.service.S3ServiceException'
|
28
|
+
|
29
|
+
JS3Bucket = Java::org.jets3t.service.model.S3Bucket
|
30
|
+
|
31
|
+
# Initialization Wrapper around
|
32
|
+
# RestS3Service[http://jets3t.s3.amazonaws.com/api/org/jets3t/service/impl/rest/httpclient/RestS3Service.html]
|
33
|
+
class S3Service
|
34
|
+
import 'org.jets3t.service.impl.rest.httpclient.RestS3Service'
|
35
|
+
import 'org.jets3t.service.security.AWSCredentials'
|
36
|
+
import 'org.jets3t.service.Jets3tProperties'
|
37
|
+
# import 'org.jets3t.service.acl.AccessControlList'
|
38
|
+
|
39
|
+
# The underlying org.jets3t.service.impl.rest.httpclient.RestS3Service
|
40
|
+
attr_reader :jservice
|
41
|
+
|
42
|
+
alias :service :jservice
|
43
|
+
|
44
|
+
# New REST S3 service instance given options hash.
|
45
|
+
# ==== Options (opts)
|
46
|
+
# :credentials<Array[String,String]>:: Required [access,secret] key
|
47
|
+
# :http_client<org.apache.commons.HttpClient>:: A pre-configured replacement
|
48
|
+
# HttpClient (3.x)
|
49
|
+
# (Default: JetS3t provided)
|
50
|
+
# String<~to_s>:: Other options as defined in
|
51
|
+
# {JetS3t Properties}[http://jets3t.s3.amazonaws.com/toolkit/configuration.html].
|
52
|
+
# HTTP client properties only apply to JetS3t's default
|
53
|
+
# client (:http_client not set), and the timeout
|
54
|
+
# parameters are here defaulted to 5 seconds vs. the JetS3t
|
55
|
+
# 60 second originals.
|
56
|
+
#
|
57
|
+
# ==== Raises
|
58
|
+
# :S3ServiceException:: From JetS3t
|
59
|
+
# :RuntimeError:: On failure to provide required options
|
60
|
+
def initialize( opts = {} )
|
61
|
+
opts = opts.dup
|
62
|
+
|
63
|
+
creds = opts.delete( :credentials )
|
64
|
+
unless creds && (2..3) === creds.length
|
65
|
+
raise "Missing required :credentials [public,secret] keys"
|
66
|
+
end
|
67
|
+
creds = AWSCredentials.new( *creds )
|
68
|
+
|
69
|
+
http = opts.delete( :http_client )
|
70
|
+
unless http
|
71
|
+
hdefs = { 'httpclient.connection-timeout-ms' => 5000,
|
72
|
+
'httpclient.socket-timeout-ms' => 5000 }
|
73
|
+
opts = hdefs.merge( opts )
|
74
|
+
end
|
75
|
+
|
76
|
+
props = Jets3tProperties.new
|
77
|
+
opts.each { |k,v| props.set_property( k.to_s, v.to_s ) }
|
78
|
+
|
79
|
+
@jservice = RestS3Service.new( creds, nil, nil, props )
|
80
|
+
|
81
|
+
@jservice.http_client = http if http
|
82
|
+
end
|
83
|
+
|
84
|
+
# Return the S3Bucket with the specified name
|
85
|
+
def []( bucket_name, opts = {} )
|
86
|
+
jbucket = @jservice.get_bucket( bucket_name )
|
87
|
+
S3Bucket.new( self, jbucket, opts )
|
88
|
+
end
|
89
|
+
|
90
|
+
alias :bucket :[]
|
91
|
+
|
92
|
+
# Return Array of all buckets in this S3Service account instance.
|
93
|
+
def buckets( opts = {} )
|
94
|
+
jbuckets = @jservice.list_all_buckets
|
95
|
+
jbuckets.map { |jb| S3Bucket.new( self, jb, opts ) }
|
96
|
+
end
|
97
|
+
|
98
|
+
# Create new bucket with the specified name
|
99
|
+
def create_bucket( bucket_name, opts = {} )
|
100
|
+
jbucket = JS3Bucket.new( bucket_name )
|
101
|
+
yield jbucket if block_given?
|
102
|
+
jbucket = @jservice.create_bucket( jbucket )
|
103
|
+
S3Bucket.new( self, jbucket, opts )
|
104
|
+
end
|
105
|
+
|
106
|
+
# Delete the specified S3Bucket instance
|
107
|
+
def delete_bucket( bucket )
|
108
|
+
@jservice.delete_bucket( bucket.jbucket )
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
data/lib/rjack-jets3t.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009-2010 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 '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
|
+
|
23
|
+
module RJack
|
24
|
+
module JetS3t
|
25
|
+
require "#{JETS3T_DIR}/jets3t-#{JETS3T_VERSION}.jar"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
require 'rjack-jets3t/s3_service'
|
data/pom.xml
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
3
|
+
|
4
|
+
<modelVersion>4.0.0</modelVersion>
|
5
|
+
<groupId>rjack</groupId>
|
6
|
+
<artifactId>rjack-jets3t</artifactId>
|
7
|
+
<packaging>pom</packaging>
|
8
|
+
<version>1.0</version>
|
9
|
+
<name>RJack JetS3t Assembly</name>
|
10
|
+
|
11
|
+
<scm>
|
12
|
+
<connection>scm:svn:http://svn/svn/evrinid/trunk/cpipe</connection>
|
13
|
+
</scm>
|
14
|
+
|
15
|
+
<repositories>
|
16
|
+
<repository>
|
17
|
+
<name>jets3t</name>
|
18
|
+
<id>jets3t</id>
|
19
|
+
<url>http://jets3t.s3.amazonaws.com/maven2</url>
|
20
|
+
</repository>
|
21
|
+
</repositories>
|
22
|
+
|
23
|
+
<dependencies>
|
24
|
+
|
25
|
+
<dependency>
|
26
|
+
<groupId>org.slf4j</groupId>
|
27
|
+
<artifactId>jcl-over-slf4j</artifactId>
|
28
|
+
<version>1.5.8</version>
|
29
|
+
</dependency>
|
30
|
+
|
31
|
+
<dependency>
|
32
|
+
<groupId>net.java.dev.jets3t</groupId>
|
33
|
+
<artifactId>jets3t</artifactId>
|
34
|
+
<version>0.7.2</version>
|
35
|
+
<exclusions>
|
36
|
+
<exclusion>
|
37
|
+
<groupId>commons-logging</groupId>
|
38
|
+
<artifactId>commons-logging</artifactId>
|
39
|
+
</exclusion>
|
40
|
+
</exclusions>
|
41
|
+
</dependency>
|
42
|
+
|
43
|
+
</dependencies>
|
44
|
+
|
45
|
+
<build>
|
46
|
+
<plugins>
|
47
|
+
<plugin>
|
48
|
+
<artifactId>maven-assembly-plugin</artifactId>
|
49
|
+
<configuration>
|
50
|
+
<descriptors>
|
51
|
+
<descriptor>assembly.xml</descriptor>
|
52
|
+
</descriptors>
|
53
|
+
<tarLongFileMode>gnu</tarLongFileMode>
|
54
|
+
</configuration>
|
55
|
+
<executions>
|
56
|
+
<execution>
|
57
|
+
<id>assembly</id>
|
58
|
+
<phase>package</phase>
|
59
|
+
<goals>
|
60
|
+
<goal>attached</goal>
|
61
|
+
</goals>
|
62
|
+
</execution>
|
63
|
+
</executions>
|
64
|
+
</plugin>
|
65
|
+
</plugins>
|
66
|
+
</build>
|
67
|
+
|
68
|
+
</project>
|
data/test/test_jets3t.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
#.hashdot.profile += jruby-shortlived
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2009-2010 David Kellum
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
7
|
+
# may not use this file except in compliance with the License. You
|
8
|
+
# may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
15
|
+
# implied. See the License for the specific language governing
|
16
|
+
# permissions and limitations under the License.
|
17
|
+
#++
|
18
|
+
|
19
|
+
$LOAD_PATH.unshift File.join( File.dirname(__FILE__), "..", "lib" )
|
20
|
+
|
21
|
+
require 'rubygems'
|
22
|
+
gem( 'rjack-slf4j', '~> 1.5.8' )
|
23
|
+
gem( 'rjack-logback', '~> 0.9.17' )
|
24
|
+
|
25
|
+
require 'rjack-logback'
|
26
|
+
|
27
|
+
include RJack
|
28
|
+
|
29
|
+
Logback.config_console( :level => Logback::INFO )
|
30
|
+
|
31
|
+
require 'rjack-jets3t'
|
32
|
+
|
33
|
+
require 'test/unit'
|
34
|
+
|
35
|
+
class TestJets3t < Test::Unit::TestCase
|
36
|
+
include JetS3t
|
37
|
+
|
38
|
+
import "java.io.ByteArrayInputStream"
|
39
|
+
|
40
|
+
def test_loaded
|
41
|
+
assert true
|
42
|
+
end
|
43
|
+
|
44
|
+
# Create a test_opts.yaml with creds to account with at least one
|
45
|
+
# bucket for a real test.
|
46
|
+
#
|
47
|
+
# ---
|
48
|
+
# :credentials:
|
49
|
+
# - access-key
|
50
|
+
# - secret-key
|
51
|
+
|
52
|
+
if File.exists?( 'test_opts.yaml' )
|
53
|
+
|
54
|
+
def setup
|
55
|
+
opts = File.open( 'test_opts.yaml' ) { |f| YAML::load( f ) }
|
56
|
+
@s3 = S3Service.new( opts )
|
57
|
+
@tbucket = @s3.create_bucket( "test.rjack.rubyforge.org" )
|
58
|
+
end
|
59
|
+
|
60
|
+
def teardown
|
61
|
+
@s3.delete_bucket( @tbucket ) if @tbucket
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_write
|
65
|
+
assert( @s3.buckets.any? { |b| b.name == @tbucket.name } )
|
66
|
+
|
67
|
+
url = @tbucket.put( "testkey", "text/plain" ) do |obj|
|
68
|
+
data = "hello"
|
69
|
+
obj.data_input_stream = ByteArrayInputStream.new( data.to_java_bytes )
|
70
|
+
obj.content_length = data.length
|
71
|
+
end
|
72
|
+
assert_equal( 'http://s3.amazonaws.com/test.rjack.rubyforge.org/testkey',
|
73
|
+
url )
|
74
|
+
@tbucket.delete( "testkey" )
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rjack-jets3t
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 7
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.7.2.0
|
11
|
+
platform: java
|
12
|
+
authors:
|
13
|
+
- David Kellum
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-05-13 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rjack-slf4j
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 5
|
31
|
+
- 8
|
32
|
+
version: 1.5.8
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rjack-httpclient-3
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 3
|
44
|
+
- 1
|
45
|
+
- 3
|
46
|
+
version: 3.1.3
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rjack-commons-codec
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 1
|
58
|
+
- 4
|
59
|
+
- 0
|
60
|
+
version: 1.4.0
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rjack-logback
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
- 9
|
73
|
+
- 17
|
74
|
+
version: 0.9.17
|
75
|
+
type: :development
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: rjack-tarpit
|
79
|
+
prerelease: false
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ~>
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
segments:
|
85
|
+
- 1
|
86
|
+
- 2
|
87
|
+
- 1
|
88
|
+
version: 1.2.1
|
89
|
+
type: :development
|
90
|
+
version_requirements: *id005
|
91
|
+
description: |-
|
92
|
+
A gem packaging and initialization facade for the
|
93
|
+
{JetS3t}[http://jets3t.s3.amazonaws.com/index.html]
|
94
|
+
Amazon Simple Storage Service (S3) client.
|
95
|
+
email:
|
96
|
+
- dek-oss@gravitext.com
|
97
|
+
executables: []
|
98
|
+
|
99
|
+
extensions: []
|
100
|
+
|
101
|
+
extra_rdoc_files:
|
102
|
+
- Manifest.txt
|
103
|
+
- NOTICE.txt
|
104
|
+
- README.rdoc
|
105
|
+
- History.rdoc
|
106
|
+
files:
|
107
|
+
- History.rdoc
|
108
|
+
- Manifest.txt
|
109
|
+
- NOTICE.txt
|
110
|
+
- README.rdoc
|
111
|
+
- Rakefile
|
112
|
+
- assembly.xml
|
113
|
+
- pom.xml
|
114
|
+
- lib/rjack-jets3t/base.rb
|
115
|
+
- lib/rjack-jets3t.rb
|
116
|
+
- lib/rjack-jets3t/s3_bucket.rb
|
117
|
+
- lib/rjack-jets3t/s3_service.rb
|
118
|
+
- test/test_jets3t.rb
|
119
|
+
- lib/rjack-jets3t/jets3t-0.7.2.jar
|
120
|
+
has_rdoc: true
|
121
|
+
homepage: http://rjack.rubyforge.org
|
122
|
+
licenses: []
|
123
|
+
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options:
|
126
|
+
- --main
|
127
|
+
- README.rdoc
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
version: "0"
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
segments:
|
142
|
+
- 0
|
143
|
+
version: "0"
|
144
|
+
requirements: []
|
145
|
+
|
146
|
+
rubyforge_project: rjack
|
147
|
+
rubygems_version: 1.3.6
|
148
|
+
signing_key:
|
149
|
+
specification_version: 3
|
150
|
+
summary: A gem packaging and initialization facade for the {JetS3t}[http://jets3t.s3.amazonaws.com/index.html] Amazon Simple Storage Service (S3) client.
|
151
|
+
test_files:
|
152
|
+
- test/test_jets3t.rb
|