s2container 0.9.2 → 0.9.3
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 +36 -29
- data/Rakefile +2 -2
- data/example/quickstart/quickstart8/quickstart.rb +3 -3
- data/lib/seasar/aop.rb +7 -3
- data/lib/seasar/container/assembler/manual-constructor-assembler.rb +2 -2
- data/lib/seasar/container/s2application-context.rb +16 -0
- data/lib/seasar/container/s2container.rb +13 -9
- data/test/seasar/aop/test_s2aop_factory.rb +1 -1
- data/test/seasar/container/test_component-def.rb +1 -1
- data/test/seasar/container/test_s2application-context.rb +10 -0
- data/test/seasar/container/test_s2container.rb +3 -0
- data/test/seasar/test_log.rb +1 -1
- metadata +2 -2
data/ChangeLog
CHANGED
@@ -1,29 +1,36 @@
|
|
1
|
-
|
2
|
-
2009-
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
*
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
*
|
12
|
-
*
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
1
|
+
|
2
|
+
2009-11-13 s2container-0.9.3
|
3
|
+
* modify: for JRuby-1.4.0
|
4
|
+
|
5
|
+
2009-09-23 s2container-0.9.3
|
6
|
+
* add: S2ApplicationContext.destroy_singleton_containers method.
|
7
|
+
|
8
|
+
2009-07-04 s2container-0.9.2
|
9
|
+
* fix: manual-constructor-assembler.
|
10
|
+
* fix: init method of S2ApplicationContext class.
|
11
|
+
* fix: init method of S2ApplicationContext class.
|
12
|
+
* modify: The instance method of S2ApplicationContext (use thread local).
|
13
|
+
* modify: The s2component method. (for define instance class method).
|
14
|
+
* info: s2container-0.9.2 release.
|
15
|
+
|
16
|
+
2009-06-20 s2container-0.9.1
|
17
|
+
|
18
|
+
* modify: for JRuby.
|
19
|
+
* info: s2container-0.9.1 release.
|
20
|
+
|
21
|
+
2009-06-04 s2container-0.9.1
|
22
|
+
|
23
|
+
* add: add Seasar::DBI::TxInterceptor.
|
24
|
+
|
25
|
+
2009-05-06 s2container-0.9.1
|
26
|
+
|
27
|
+
* fix: s2aspect method.
|
28
|
+
|
29
|
+
2009-04-26 s2container-0.9.0
|
30
|
+
|
31
|
+
* add: destroy method to Seasar::Container::S2Container, Seasar::Container::ComponentDef.
|
32
|
+
* info: s2container-0.9.0 release.
|
33
|
+
|
34
|
+
2009-04-15 s2container-0.8.0
|
35
|
+
|
36
|
+
* info: s2container-0.8.0 first release from rubyforge.
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
RUBY_S2CONTAINER_VERSION = '0.9.
|
1
|
+
RUBY_S2CONTAINER_VERSION = '0.9.3'
|
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-11-13'
|
22
22
|
s.version = RUBY_S2CONTAINER_VERSION
|
23
23
|
s.authors = ['klove']
|
24
24
|
s.email = 'klovelion@gmail.com'
|
@@ -2,13 +2,13 @@ $LOAD_PATH.unshift(File::expand_path(File::dirname(__FILE__)) + '/../../../lib')
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 's2container'
|
4
4
|
|
5
|
-
s2comp(:class => Seasar::DBI::DBIInterceptor
|
6
|
-
s2comp(:class => Seasar::DBI::TxInterceptor
|
5
|
+
s2comp(:class => Seasar::DBI::DBIInterceptor)
|
6
|
+
s2comp(:class => Seasar::DBI::TxInterceptor)
|
7
7
|
s2comp(:class => DBI::DatabaseHandle, :name => :dbh, :autobinding => :none) { DBI.connect("dbi:SQLite3::memory:") }
|
8
8
|
|
9
9
|
class Dao
|
10
10
|
s2comp
|
11
|
-
s2aspect :interceptor => :
|
11
|
+
s2aspect :interceptor => :dbiinterceptor
|
12
12
|
def create_table; 'create table sample(id integer primary key, name text);' end
|
13
13
|
def find_all; 'select * from sample;' end
|
14
14
|
def insert_name(val); 'insert into sample(name) values(?);' end
|
data/lib/seasar/aop.rb
CHANGED
@@ -21,10 +21,14 @@ module Seasar
|
|
21
21
|
autoload :Aspect, 'seasar/aop/aspect'
|
22
22
|
autoload :MethodInvocation, 'seasar/aop/method-invocation'
|
23
23
|
autoload :Pointcut, 'seasar/aop/pointcut'
|
24
|
-
if
|
25
|
-
autoload :S2AopFactory, 'seasar/aop/s2aop-factory'
|
26
|
-
else
|
24
|
+
if defined? JRUBY_VERSION
|
27
25
|
autoload :S2AopFactory, 'seasar/aop/s2aop-factory186'
|
26
|
+
else
|
27
|
+
if '1.8.6' < RUBY_VERSION
|
28
|
+
autoload :S2AopFactory, 'seasar/aop/s2aop-factory'
|
29
|
+
else
|
30
|
+
autoload :S2AopFactory, 'seasar/aop/s2aop-factory186'
|
31
|
+
end
|
28
32
|
end
|
29
33
|
module Interceptor
|
30
34
|
autoload :TraceInterceptor, 'seasar/aop/interceptor/trace-interceptor'
|
@@ -46,8 +46,8 @@ module Seasar
|
|
46
46
|
if procedure.nil?
|
47
47
|
args = @component_def.get_arg_defs.map {|arg_def| arg_def.value}
|
48
48
|
return @component_def.get_concreate_class.new(*args)
|
49
|
-
elsif @component_def.component_class == Proc
|
50
|
-
return procedure
|
49
|
+
# elsif @component_def.component_class == Proc
|
50
|
+
# return procedure
|
51
51
|
else
|
52
52
|
component = procedure.call(@component_def)
|
53
53
|
if component.is_a?(@component_def.component_class)
|
@@ -253,6 +253,22 @@ module Seasar
|
|
253
253
|
end
|
254
254
|
alias get_singleton_container create_singleton_container
|
255
255
|
|
256
|
+
#
|
257
|
+
# - args
|
258
|
+
# 1. Array|nil <em>namespaces</em> String namespaces
|
259
|
+
# - return
|
260
|
+
# - nil
|
261
|
+
#
|
262
|
+
def destroy_singleton_containers(namespaces = nil)
|
263
|
+
namespaces = [namespaces] if namespaces.is_a?(String)
|
264
|
+
key = namespaces.sort unless namespaces.nil?
|
265
|
+
if namespaces.nil?
|
266
|
+
@singletons.each {|key, container| container.destroy}
|
267
|
+
elsif @singletons.key?(key)
|
268
|
+
@singletons[key].destroy
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
256
272
|
#
|
257
273
|
# - args
|
258
274
|
# 1. Array <em>namespaces</em> String namespaces
|
@@ -177,27 +177,28 @@ module Seasar
|
|
177
177
|
# - args
|
178
178
|
# 1. String|Symbol <em>key</em>
|
179
179
|
# 2. Boolean <em>search_parent</em>
|
180
|
-
# 3. Array <em>
|
180
|
+
# 3. Array <em>searched_as_parent</em>
|
181
181
|
# - return
|
182
182
|
# - Seasar::Container::ComponentDef
|
183
183
|
#
|
184
|
-
def get_component_def_internal(key, search_parent = true,
|
184
|
+
def get_component_def_internal(key, search_parent = true, searched_as_parent = [], searched_as_child = [])
|
185
185
|
if @component_def_map.key?(key)
|
186
186
|
return @component_def_map[key]
|
187
187
|
elsif key.is_a?(String) && key.match(/\./)
|
188
188
|
component_def = self.get_component_def_with_namespace(key)
|
189
189
|
return component_def unless component_def.nil?
|
190
190
|
else
|
191
|
-
component_def = self.get_component_def_from_children(key,
|
191
|
+
component_def = self.get_component_def_from_children(key, searched_as_parent, searched_as_child)
|
192
192
|
return component_def unless component_def.nil?
|
193
193
|
end
|
194
194
|
return nil unless search_parent
|
195
195
|
|
196
|
-
|
196
|
+
searched_as_parent << self
|
197
197
|
return nil if @parents.size == 0
|
198
198
|
@parents.each {|parent|
|
199
|
-
next if
|
200
|
-
|
199
|
+
next if searched_as_parent.member?(parent)
|
200
|
+
#s2logger.debug(self.class.name){'search parent container : ' + parent.namespace.to_s}
|
201
|
+
component_def = parent.get_component_def_internal(key, true, searched_as_parent, searched_as_child)
|
201
202
|
return component_def unless component_def.nil?
|
202
203
|
}
|
203
204
|
return nil
|
@@ -227,11 +228,14 @@ module Seasar
|
|
227
228
|
# - return
|
228
229
|
# - Seasar::Container::ComponentDef
|
229
230
|
#
|
230
|
-
def get_component_def_from_children(key,
|
231
|
+
def get_component_def_from_children(key, searched_as_parent = [], searched_as_child = [])
|
231
232
|
@children.each {|child_container|
|
232
|
-
next if
|
233
|
-
|
233
|
+
next if searched_as_parent.member?(child_container)
|
234
|
+
next if searched_as_child.member?(child_container)
|
235
|
+
#s2logger.debug(self.class.name){'search child container : ' + child_container.namespace.to_s}
|
236
|
+
component_def = child_container.get_component_def_internal(key, false, searched_as_parent, searched_as_child)
|
234
237
|
return component_def unless component_def.nil?
|
238
|
+
searched_as_child << child_container
|
235
239
|
}
|
236
240
|
return nil
|
237
241
|
end
|
@@ -16,7 +16,7 @@ module Seasar
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_procedure_arg
|
19
|
-
return if RUBY_VERSION < '1.8.7'
|
19
|
+
return if RUBY_VERSION < '1.8.7' || defined? JRUBY_VERSION
|
20
20
|
aspect_def = Seasar::Container::AspectDef.new(/^hoge$/) {|invocation|
|
21
21
|
result = invocation.proceed
|
22
22
|
next result * 10
|
@@ -192,6 +192,16 @@ module Seasar
|
|
192
192
|
assert(c1 == c2)
|
193
193
|
end
|
194
194
|
|
195
|
+
def test_destroy_singleton_containers
|
196
|
+
s2app.init
|
197
|
+
c1 = s2app.create_singleton_container(%w[a.b a.c])
|
198
|
+
s2app.destroy_singleton_containers
|
199
|
+
|
200
|
+
s2app.init
|
201
|
+
c1 = s2app.create_singleton_container(%w[a.b a.c])
|
202
|
+
s2app.destroy_singleton_containers(%w[a.b a.c])
|
203
|
+
end
|
204
|
+
|
195
205
|
def test_snapshot
|
196
206
|
s2app.init
|
197
207
|
assert(!s2app.snapshot?)
|
@@ -212,12 +212,15 @@ module Seasar
|
|
212
212
|
assert(g.has_component_def(C))
|
213
213
|
|
214
214
|
assert_equal(x, f.root)
|
215
|
+
#puts '-----------------------'
|
215
216
|
assert(g.has_component_def(X))
|
217
|
+
#puts '-----------------------'
|
216
218
|
assert(!g.has_component_def('qqq'))
|
217
219
|
assert(g.has_component_def('a.b.d.g'))
|
218
220
|
assert(g.has_component_def('a.c.e.g'))
|
219
221
|
assert(g.has_component_def('x.y.f.g'))
|
220
222
|
assert(g.has_component_def('x.y.f.g.Gg'))
|
223
|
+
assert(b.has_component_def(F))
|
221
224
|
end
|
222
225
|
|
223
226
|
def test_init_destroy
|
data/test/seasar/test_log.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.3
|
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-11-13 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|