s2container 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +7 -0
- data/Rakefile +2 -2
- data/example/quickstart/quickstart1/quickstart.rb +6 -0
- data/example/quickstart/quickstart3/quickstart.rb +2 -0
- data/example/quickstart/quickstart8/quickstart.rb +44 -0
- data/lib/s2container.rb +1 -0
- data/lib/seasar/aop/interceptor/trace-interceptor.rb +1 -1
- data/lib/seasar/aop.rb +3 -2
- data/lib/seasar/container/aspect-def.rb +0 -0
- data/lib/seasar/container/assembler/manual-constructor-assembler.rb +2 -6
- data/lib/seasar/container/component-def.rb +4 -0
- data/lib/seasar/container/deployer/prototype-component-deployer.rb +1 -1
- data/lib/seasar/container/deployer/singleton-component-deployer.rb +2 -1
- data/lib/seasar/container/s2application-context.rb +31 -16
- data/lib/seasar/container.rb +26 -0
- data/lib/seasar/dbi/dbi-interceptor.rb +2 -1
- data/lib/seasar/dbi/tx-interceptor.rb +2 -1
- data/lib/seasar/dbi.rb +2 -3
- data/lib/seasar/log/factory/ruby-logger-factory.rb +13 -0
- data/lib/seasar/util/class-util.rb +5 -1
- data/test/seasar/container/assembler/test_proc_constructor_assembler.rb +2 -2
- data/test/seasar/container/test_component-def.rb +1 -1
- data/test/seasar/container/test_s2application-context.rb +3 -3
- data/test/seasar/container/test_s2component.rb +78 -0
- data/test/seasar/test_log.rb +2 -2
- data/test/seasar/test_util.rb +21 -0
- data/test/test-suite.rb +1 -1
- metadata +5 -2
data/ChangeLog
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
|
2
|
+
2009-07-04 s2container-0.9.2
|
3
|
+
* fix: manual-constructor-assembler.
|
4
|
+
* fix: init method of S2ApplicationContext class.
|
5
|
+
* fix: init method of S2ApplicationContext class.
|
6
|
+
* modify: The instance method of S2ApplicationContext (use thread local).
|
7
|
+
* modify: The s2component method. (for define instance class method).
|
8
|
+
|
2
9
|
2009-06-20 s2container-0.9.1
|
3
10
|
|
4
11
|
* modify: for JRuby.
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
RUBY_S2CONTAINER_VERSION = '0.9.
|
1
|
+
RUBY_S2CONTAINER_VERSION = '0.9.2'
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'rake'
|
@@ -18,7 +18,7 @@ end
|
|
18
18
|
|
19
19
|
spec = Gem::Specification.new do |s|
|
20
20
|
s.name = 's2container'
|
21
|
-
s.date = '2009-
|
21
|
+
s.date = '2009-07-04'
|
22
22
|
s.version = RUBY_S2CONTAINER_VERSION
|
23
23
|
s.authors = ['klove']
|
24
24
|
s.email = 'klovelion@gmail.com'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
$LOAD_PATH.unshift(File::expand_path(File::dirname(__FILE__)) + '/../../../lib')
|
2
|
+
require 'rubygems'
|
3
|
+
require 's2container'
|
4
|
+
|
5
|
+
s2comp(:class => Seasar::DBI::DBIInterceptor, :name => :dbi_interceptor)
|
6
|
+
s2comp(:class => Seasar::DBI::TxInterceptor, :name => :tx_interceptor)
|
7
|
+
s2comp(:class => DBI::DatabaseHandle, :name => :dbh, :autobinding => :none) { DBI.connect("dbi:SQLite3::memory:") }
|
8
|
+
|
9
|
+
class Dao
|
10
|
+
s2comp
|
11
|
+
s2aspect :interceptor => :dbi_interceptor
|
12
|
+
def create_table; 'create table sample(id integer primary key, name text);' end
|
13
|
+
def find_all; 'select * from sample;' end
|
14
|
+
def insert_name(val); 'insert into sample(name) values(?);' end
|
15
|
+
def insert(id, name); 'insert into sample values(?, ?);' end
|
16
|
+
#def update_name(id, name); ['update sample set name = :name where id = :id;', :name => name, :id => id ] end
|
17
|
+
def update_name(id, name); [<<-EOSQL, :id => id, :name => name]
|
18
|
+
update sample
|
19
|
+
set name = :name
|
20
|
+
where id = :id;
|
21
|
+
EOSQL
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Service
|
26
|
+
s2comp
|
27
|
+
s2aspect :interceptor => :tx_interceptor
|
28
|
+
attr_accessor :dao
|
29
|
+
def run_in_tx
|
30
|
+
@dao.update_name(1, 'FOO')
|
31
|
+
@dao.insert(2, 'BAR')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
dao = Dao.instance
|
36
|
+
dao.create_table
|
37
|
+
dao.insert_name('foo')
|
38
|
+
dao.insert_name('bar')
|
39
|
+
p dao.find_all
|
40
|
+
|
41
|
+
Service.instance.run_in_tx rescue p $!.message
|
42
|
+
p dao.find_all
|
43
|
+
|
44
|
+
s2app.get(:dbh).disconnect
|
data/lib/s2container.rb
CHANGED
data/lib/seasar/aop.rb
CHANGED
@@ -16,8 +16,6 @@
|
|
16
16
|
# | governing permissions and limitations under the License. |
|
17
17
|
# +----------------------------------------------------------------------+
|
18
18
|
#++
|
19
|
-
|
20
|
-
require 'seasar/aop/interceptor/trace-interceptor'
|
21
19
|
module Seasar
|
22
20
|
module Aop
|
23
21
|
autoload :Aspect, 'seasar/aop/aspect'
|
@@ -28,6 +26,9 @@ module Seasar
|
|
28
26
|
else
|
29
27
|
autoload :S2AopFactory, 'seasar/aop/s2aop-factory186'
|
30
28
|
end
|
29
|
+
module Interceptor
|
30
|
+
autoload :TraceInterceptor, 'seasar/aop/interceptor/trace-interceptor'
|
31
|
+
end
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
File without changes
|
@@ -36,11 +36,6 @@ module Seasar
|
|
36
36
|
# - return
|
37
37
|
# - none
|
38
38
|
def assemble
|
39
|
-
args = []
|
40
|
-
for arg_def in @component_def.get_arg_defs
|
41
|
-
args << arg_def.value
|
42
|
-
end
|
43
|
-
|
44
39
|
procedure = nil
|
45
40
|
if @component_def.onetime_proc.is_a?(Proc)
|
46
41
|
procedure = @component_def.onetime_proc
|
@@ -49,11 +44,12 @@ module Seasar
|
|
49
44
|
procedure = @component_def.constructor
|
50
45
|
end
|
51
46
|
if procedure.nil?
|
47
|
+
args = @component_def.get_arg_defs.map {|arg_def| arg_def.value}
|
52
48
|
return @component_def.get_concreate_class.new(*args)
|
53
49
|
elsif @component_def.component_class == Proc
|
54
50
|
return procedure
|
55
51
|
else
|
56
|
-
component = procedure.call(
|
52
|
+
component = procedure.call(@component_def)
|
57
53
|
if component.is_a?(@component_def.component_class)
|
58
54
|
return component
|
59
55
|
else
|
@@ -74,6 +74,8 @@ module Seasar
|
|
74
74
|
# - none
|
75
75
|
#
|
76
76
|
def init
|
77
|
+
@concreate_class = nil
|
78
|
+
@onetime_proc = nil
|
77
79
|
return self.get_component_deployer.init
|
78
80
|
end
|
79
81
|
|
@@ -84,6 +86,8 @@ module Seasar
|
|
84
86
|
# - none
|
85
87
|
#
|
86
88
|
def destroy
|
89
|
+
@concreate_class = nil
|
90
|
+
@onetime_proc = nil
|
87
91
|
return self.get_component_deployer.destroy
|
88
92
|
end
|
89
93
|
|
@@ -37,7 +37,7 @@ module Seasar
|
|
37
37
|
# - Object
|
38
38
|
def deploy
|
39
39
|
if @instantiating
|
40
|
-
raise Seasar::Container::Exception::CyclicReferenceRuntimeException(@component_def.component_class)
|
40
|
+
raise Seasar::Container::Exception::CyclicReferenceRuntimeException.new(@component_def.component_class)
|
41
41
|
end
|
42
42
|
@instantiating = true
|
43
43
|
component = @constructor_assembler.assemble
|
@@ -26,9 +26,9 @@ module Seasar
|
|
26
26
|
#
|
27
27
|
class S2ApplicationContext
|
28
28
|
@@static_component_infos = []
|
29
|
-
@@static_aspect_infos
|
29
|
+
@@static_aspect_infos = []
|
30
30
|
@@instance = nil
|
31
|
-
|
31
|
+
|
32
32
|
class << self
|
33
33
|
#
|
34
34
|
# - args
|
@@ -37,6 +37,14 @@ module Seasar
|
|
37
37
|
# - Seasar::Container::S2ApplicationContext
|
38
38
|
#
|
39
39
|
def instance
|
40
|
+
if Seasar::Container.use_thread_local?
|
41
|
+
require 'thread'
|
42
|
+
th = Thread.current
|
43
|
+
if th[:S2ApplicationContext].nil?
|
44
|
+
th[:S2ApplicationContext] = self.new
|
45
|
+
end
|
46
|
+
return th[:S2ApplicationContext]
|
47
|
+
end
|
40
48
|
if @@instance.nil?
|
41
49
|
@@instance = self.new
|
42
50
|
end
|
@@ -45,11 +53,18 @@ module Seasar
|
|
45
53
|
|
46
54
|
#
|
47
55
|
# - args
|
48
|
-
# 1.
|
56
|
+
# 1. Boolean
|
49
57
|
# - return
|
50
58
|
# - nil
|
51
59
|
#
|
52
|
-
def instance=(
|
60
|
+
def instance=(val)
|
61
|
+
if Seasar::Container.use_thread_local?
|
62
|
+
require 'thread'
|
63
|
+
Thread.current[:S2ApplicationContext] = val
|
64
|
+
else
|
65
|
+
@@instance = val
|
66
|
+
end
|
67
|
+
end
|
53
68
|
end
|
54
69
|
|
55
70
|
#
|
@@ -72,7 +87,7 @@ module Seasar
|
|
72
87
|
if options[:force] == true
|
73
88
|
@@static_component_infos = []
|
74
89
|
@@static_aspect_infos = []
|
75
|
-
|
90
|
+
Seasar::Beans::BeanDescFactory.init
|
76
91
|
end
|
77
92
|
@include_patterns = []
|
78
93
|
@exclude_patterns = []
|
@@ -203,8 +218,7 @@ module Seasar
|
|
203
218
|
# - Object
|
204
219
|
#
|
205
220
|
def get_component(key, namespaces = [], &procedure)
|
206
|
-
|
207
|
-
return @singletons[namespace_key].get_component(key, &procedure)
|
221
|
+
return self.get_singleton_container(namespaces).get_component(key, &procedure)
|
208
222
|
end
|
209
223
|
alias component get_component
|
210
224
|
alias get get_component
|
@@ -218,35 +232,36 @@ module Seasar
|
|
218
232
|
# - Boolean
|
219
233
|
#
|
220
234
|
def has_component_def(key, namespaces = [])
|
221
|
-
|
222
|
-
return @singletons[namespace_key].has_component_def(key)
|
235
|
+
return self.get_singleton_container(namespaces).has_component_def(key)
|
223
236
|
end
|
224
237
|
alias component_def? has_component_def
|
225
238
|
|
226
239
|
#
|
227
240
|
# - args
|
228
241
|
# 1. Array <em>namespaces</em> String namespaces
|
242
|
+
# 2. Proc <em>procedure</em> component selector block
|
229
243
|
# - return
|
230
244
|
# - String
|
231
245
|
#
|
232
|
-
def
|
233
|
-
namespaces = [namespaces]
|
246
|
+
def create_singleton_container(namespaces = [], &procedure)
|
247
|
+
namespaces = [namespaces] if namespaces.is_a?(String)
|
234
248
|
key = namespaces.sort
|
235
|
-
|
236
|
-
@singletons[key] = self.create(namespaces)
|
249
|
+
unless @singletons.key?(key)
|
250
|
+
@singletons[key] = self.create(namespaces, &procedure)
|
237
251
|
end
|
238
|
-
return key
|
252
|
+
return @singletons[key]
|
239
253
|
end
|
254
|
+
alias get_singleton_container create_singleton_container
|
240
255
|
|
241
256
|
#
|
242
257
|
# - args
|
243
258
|
# 1. Array <em>namespaces</em> String namespaces
|
244
|
-
# 2. Proc <em>procedure</em>
|
259
|
+
# 2. Proc <em>procedure</em> component selector block
|
245
260
|
# - return
|
246
261
|
# - Seasar::Container::S2Container
|
247
262
|
#
|
248
263
|
def create(namespaces = [], &procedure)
|
249
|
-
namespaces = [namespaces]
|
264
|
+
namespaces = [namespaces] if namespaces.is_a?(String)
|
250
265
|
container = S2Container.new
|
251
266
|
component_defs = []
|
252
267
|
component_infos = self.get_component_infos(namespaces)
|
data/lib/seasar/container.rb
CHANGED
@@ -50,6 +50,22 @@ def s2component(option = {}, &procedure)
|
|
50
50
|
raise TypeError.new("class not specified.")
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
option[:class].class_eval {
|
55
|
+
@s2component_key = option[:name].nil? ? option[:class] : option[:name]
|
56
|
+
@s2component_namespace = option[:namespace]
|
57
|
+
unless option[:class].respond_to?(:instance)
|
58
|
+
class << self
|
59
|
+
def instance
|
60
|
+
if @s2component_namespace.nil?
|
61
|
+
return s2app.get(@s2component_key)
|
62
|
+
else
|
63
|
+
return s2app.get(@s2component_namespace).get(@s2component_key)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
}
|
53
69
|
return s2app.register(option, &procedure)
|
54
70
|
end
|
55
71
|
alias s2comp s2component
|
@@ -134,6 +150,16 @@ module Seasar
|
|
134
150
|
autoload :IllegalInstanceDefRuntimeException, 'seasar/container/exception/illegal-instance-def-runtime-exception'
|
135
151
|
autoload :TooManyRegistrationRuntimeException, 'seasar/container/exception/toomany-registration-runtime-exception'
|
136
152
|
end
|
153
|
+
|
154
|
+
@use_thread_local = true
|
155
|
+
module_function
|
156
|
+
def use_thread_local?
|
157
|
+
return @use_thread_local
|
158
|
+
end
|
159
|
+
|
160
|
+
def use_thread_local=(val)
|
161
|
+
@use_thread_local = val
|
162
|
+
end
|
137
163
|
end
|
138
164
|
end
|
139
165
|
|
@@ -16,10 +16,11 @@
|
|
16
16
|
# | governing permissions and limitations under the License. |
|
17
17
|
# +----------------------------------------------------------------------+
|
18
18
|
#++
|
19
|
+
require 'dbi'
|
19
20
|
module Seasar
|
20
21
|
module DBI
|
21
22
|
class DBIInterceptor
|
22
|
-
s2comp :namespace => 'dbi', :name => 'interceptor', :
|
23
|
+
#s2comp :namespace => 'dbi', :name => 'interceptor', :static => true
|
23
24
|
|
24
25
|
# - args
|
25
26
|
# - none
|
@@ -16,10 +16,11 @@
|
|
16
16
|
# | governing permissions and limitations under the License. |
|
17
17
|
# +----------------------------------------------------------------------+
|
18
18
|
#++
|
19
|
+
require 'dbi'
|
19
20
|
module Seasar
|
20
21
|
module DBI
|
21
22
|
class TxInterceptor
|
22
|
-
s2comp :namespace => 'dbi', :name => 'tx', :
|
23
|
+
#s2comp :namespace => 'dbi', :name => 'tx', :static => true
|
23
24
|
|
24
25
|
# - args
|
25
26
|
# - none
|
data/lib/seasar/dbi.rb
CHANGED
@@ -17,11 +17,10 @@
|
|
17
17
|
# +----------------------------------------------------------------------+
|
18
18
|
#++
|
19
19
|
|
20
|
-
require 'dbi'
|
21
|
-
require 'seasar/dbi/dbi-interceptor'
|
22
|
-
require 'seasar/dbi/tx-interceptor'
|
23
20
|
module Seasar
|
24
21
|
module DBI
|
25
22
|
autoload :Paginate, 'seasar/dbi/paginate'
|
23
|
+
autoload :DBIInterceptor, 'seasar/dbi/dbi-interceptor'
|
24
|
+
autoload :TxInterceptor, 'seasar/dbi/tx-interceptor'
|
26
25
|
end
|
27
26
|
end
|
@@ -24,6 +24,7 @@ module Seasar
|
|
24
24
|
class RubyLoggerFactory
|
25
25
|
@@logger = nil
|
26
26
|
@@logdev = STDERR
|
27
|
+
@@level = Logger::WARN
|
27
28
|
class << self
|
28
29
|
|
29
30
|
#
|
@@ -36,6 +37,7 @@ module Seasar
|
|
36
37
|
if @@logger.nil?
|
37
38
|
@@logger = Logger.new(@@logdev)
|
38
39
|
@@logger.datetime_format = "%Y-%m-%d %H:%M:%S"
|
40
|
+
@@logger.level = @@level
|
39
41
|
end
|
40
42
|
return @@logger
|
41
43
|
end
|
@@ -61,6 +63,17 @@ module Seasar
|
|
61
63
|
@@logdev = logdev
|
62
64
|
@@logger = nil
|
63
65
|
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# - args
|
69
|
+
# 1. Object <em>level</em>
|
70
|
+
# - return
|
71
|
+
# - nil
|
72
|
+
#
|
73
|
+
def level=(level)
|
74
|
+
@@level = level
|
75
|
+
@@logger = nil
|
76
|
+
end
|
64
77
|
end
|
65
78
|
end
|
66
79
|
end
|
@@ -42,13 +42,17 @@ module Seasar
|
|
42
42
|
|
43
43
|
#
|
44
44
|
# - args
|
45
|
-
# 1.
|
45
|
+
# 1. Object <em>target</em>
|
46
46
|
# - return
|
47
47
|
# - Array
|
48
48
|
#
|
49
49
|
def get_accessor_attributes(target)
|
50
50
|
#method_names = (target.public_methods - Object.public_methods).map {|method_name| method_name.to_s}
|
51
51
|
method_names = target.public_methods(false).map {|method_name| method_name.to_s}
|
52
|
+
if target.class.name.match(/EnhancedByS2Aop/)
|
53
|
+
method_names += target.class.superclass.public_instance_methods(false).map {|method_name| method_name.to_s}
|
54
|
+
method_names.uniq!
|
55
|
+
end
|
52
56
|
attributes = []
|
53
57
|
method_names.each {|name|
|
54
58
|
next if name.match(/^==+$/)
|
@@ -33,8 +33,8 @@ module Seasar
|
|
33
33
|
|
34
34
|
def test_proc_args
|
35
35
|
container = S2Container.new
|
36
|
-
cd = Seasar::Container::ComponentDef.new(C, 'c') {|
|
37
|
-
|
36
|
+
cd = Seasar::Container::ComponentDef.new(C, 'c') {|cd|
|
37
|
+
cd.get_concreate_class.new(*cd.get_arg_defs.map {|arg_def| arg_def.value})
|
38
38
|
}
|
39
39
|
cd.add_arg_def(Seasar::Container::ArgDef.new(100))
|
40
40
|
cd.add_arg_def(Seasar::Container::ArgDef.new(200))
|
@@ -185,10 +185,10 @@ module Seasar
|
|
185
185
|
assert(2, s2app.select_component_info_by_namespace(infos, %w[a.e x.y]).size)
|
186
186
|
end
|
187
187
|
|
188
|
-
def
|
188
|
+
def test_create_singleton_container
|
189
189
|
s2app.init
|
190
|
-
c1 = s2app.
|
191
|
-
c2 = s2app.
|
190
|
+
c1 = s2app.create_singleton_container(%w[a.b a.c])
|
191
|
+
c2 = s2app.create_singleton_container(%w[a.c a.b])
|
192
192
|
assert(c1 == c2)
|
193
193
|
end
|
194
194
|
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Seasar
|
2
|
+
module Container
|
3
|
+
class TC_S2Component < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
s2app.init
|
6
|
+
end
|
7
|
+
|
8
|
+
def teardown
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_instance
|
12
|
+
b = B.instance
|
13
|
+
assert(b.is_a?(B))
|
14
|
+
assert(b.c.is_a?(C))
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_instance_exist
|
18
|
+
a = A.instance
|
19
|
+
assert(a == 1000)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_instance_method
|
23
|
+
d = D.instance
|
24
|
+
assert(d.is_a?(D))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_namespaced
|
28
|
+
e = E.instance
|
29
|
+
assert(e.is_a?(E))
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_inherit
|
33
|
+
g = G.instance
|
34
|
+
assert(g.is_a?(G))
|
35
|
+
end
|
36
|
+
|
37
|
+
class A
|
38
|
+
s2comp
|
39
|
+
class << self
|
40
|
+
def instance
|
41
|
+
return 1000
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class B
|
47
|
+
s2comp
|
48
|
+
def initialize
|
49
|
+
@c = :di, Seasar::Container::TC_S2Component::C
|
50
|
+
end
|
51
|
+
attr_reader :c
|
52
|
+
end
|
53
|
+
|
54
|
+
class C
|
55
|
+
s2comp
|
56
|
+
end
|
57
|
+
|
58
|
+
class D
|
59
|
+
s2comp
|
60
|
+
def instance
|
61
|
+
return 1000
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class E
|
66
|
+
s2comp :namespace => 'xxx', :name => 'TC_S2Component'
|
67
|
+
end
|
68
|
+
|
69
|
+
class F
|
70
|
+
s2comp
|
71
|
+
end
|
72
|
+
|
73
|
+
class G < F
|
74
|
+
s2comp
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/test/seasar/test_log.rb
CHANGED
@@ -11,10 +11,10 @@ module Seasar
|
|
11
11
|
|
12
12
|
def test_logging
|
13
13
|
return if defined? JRUBY_VERSION
|
14
|
-
#logger = s2logger('/tmp/a.log')
|
15
14
|
logger = s2logger
|
16
|
-
logger.level = Logger::DEBUG
|
15
|
+
#logger.level = Logger::DEBUG
|
17
16
|
s2logger.debug(self) {"debug level logging"}
|
17
|
+
#logger.level = Logger::WARN
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_jlogger
|
data/test/seasar/test_util.rb
CHANGED
@@ -24,6 +24,12 @@ module Seasar
|
|
24
24
|
assert_equal('Seasar::Util::TC_ClassUtil', Seasar::Util::ClassUtil.module_name(A))
|
25
25
|
end
|
26
26
|
|
27
|
+
def test_aspect
|
28
|
+
s2app.init
|
29
|
+
b = s2app.get(B)
|
30
|
+
assert_equal(5 * 2, b.calc(2, 3))
|
31
|
+
end
|
32
|
+
|
27
33
|
class A
|
28
34
|
def initialize
|
29
35
|
@a = "abc"
|
@@ -41,6 +47,21 @@ module Seasar
|
|
41
47
|
class AbcDef_; end
|
42
48
|
class ABCde; end
|
43
49
|
class ABCdeFG; end
|
50
|
+
|
51
|
+
class B
|
52
|
+
s2comp
|
53
|
+
s2aspect(:pointcut => 'calc') {|invoker| invoker.proceed * 2}
|
54
|
+
attr_accessor :tc_class_util_c
|
55
|
+
def calc(a, b)
|
56
|
+
@tc_class_util_c.calc(a, b)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
class C
|
60
|
+
s2comp :name => :tc_class_util_c
|
61
|
+
def calc(a, b)
|
62
|
+
return a + b
|
63
|
+
end
|
64
|
+
end
|
44
65
|
end
|
45
66
|
end
|
46
67
|
end
|
data/test/test-suite.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s2container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- klove
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-07-04 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/s2container.rb
|
96
96
|
- test/test-suite.rb
|
97
97
|
- test/seasar/container/test_component-info-def.rb
|
98
|
+
- test/seasar/container/test_s2component.rb
|
98
99
|
- test/seasar/container/test_arg-def.rb
|
99
100
|
- test/seasar/container/s2app_load_sample.rb
|
100
101
|
- test/seasar/container/deployer/test_instance_def_factory.rb
|
@@ -171,6 +172,8 @@ files:
|
|
171
172
|
- example/quickstart/quickstart3/quickstart.rb
|
172
173
|
- example/quickstart/quickstart5
|
173
174
|
- example/quickstart/quickstart5/quickstart.rb
|
175
|
+
- example/quickstart/quickstart8
|
176
|
+
- example/quickstart/quickstart8/quickstart.rb
|
174
177
|
- example/quickstart/quickstart7
|
175
178
|
- example/quickstart/quickstart7/quickstart.rb
|
176
179
|
- example/quickstart/quickstart1
|