s2container 0.8.0
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/Apache_Software_License_2.0.txt +202 -0
- data/ChangeLog +1 -0
- data/ChangeLog.ja +64 -0
- data/README +9 -0
- data/Rakefile +51 -0
- data/example/example01/example.rb +13 -0
- data/example/example01/run.rb +20 -0
- data/example/example02/example.rb +30 -0
- data/example/example02/run.rb +8 -0
- data/example/example03/example.rb +8 -0
- data/example/example03/run.rb +12 -0
- data/example/example04/example.rb +9 -0
- data/example/example04/run.rb +15 -0
- data/example/example05/example.rb +9 -0
- data/example/example05/run.rb +21 -0
- data/example/example06/example.rb +9 -0
- data/example/example06/run.rb +8 -0
- data/example/example07/example.rb +8 -0
- data/example/example07/run.rb +15 -0
- data/example/example08/example.rb +9 -0
- data/example/example08/run.rb +19 -0
- data/example/example09/example.rb +7 -0
- data/example/example09/run.rb +11 -0
- data/example/example10/example.rb +9 -0
- data/example/example10/run.rb +10 -0
- data/example/example11/example.rb +18 -0
- data/example/example11/run.rb +10 -0
- data/example/example12/example.rb +9 -0
- data/example/example12/run.rb +8 -0
- data/example/example13/example.rb +18 -0
- data/example/example13/example.sql +4 -0
- data/example/example13/run.rb +22 -0
- data/example/example13/sample.db +0 -0
- data/example/example14/example.db +0 -0
- data/example/example14/example.rb +57 -0
- data/example/example14/example.sql +50 -0
- data/example/example14/run1.rb +23 -0
- data/example/example14/run2.rb +28 -0
- data/example/example14/run3.rb +25 -0
- data/example/example14/run4.rb +23 -0
- data/example/example14/run5.rb +35 -0
- data/example/example15/example.rb +20 -0
- data/example/example15/run.rb +28 -0
- data/example/example16/example.rb +15 -0
- data/example/example16/run.rb +24 -0
- data/example/quickstart/quickstart1/quickstart.rb +10 -0
- data/example/quickstart/quickstart2/quickstart.rb +9 -0
- data/example/quickstart/quickstart3/quickstart.rb +9 -0
- data/example/quickstart/quickstart4/quickstart.rb +14 -0
- data/example/quickstart/quickstart5/quickstart.rb +21 -0
- data/example/quickstart/quickstart6/quickstart.rb +28 -0
- data/example/quickstart/quickstart7/quickstart.rb +18 -0
- data/lib/s2container.rb +25 -0
- data/lib/seasar/aop/aspect.rb +30 -0
- data/lib/seasar/aop/interceptor/trace-interceptor.rb +48 -0
- data/lib/seasar/aop/method-invocation.rb +57 -0
- data/lib/seasar/aop/pointcut.rb +53 -0
- data/lib/seasar/aop/s2aop-factory.rb +125 -0
- data/lib/seasar/aop.rb +29 -0
- data/lib/seasar/beans/abstract-property-desc.rb +59 -0
- data/lib/seasar/beans/attribute-accessor-desc.rb +60 -0
- data/lib/seasar/beans/bean-desc-factory.rb +68 -0
- data/lib/seasar/beans/bean-desc.rb +232 -0
- data/lib/seasar/beans/instance-variable-desc.rb +58 -0
- data/lib/seasar/beans.rb +29 -0
- data/lib/seasar/container/arg-def.rb +51 -0
- data/lib/seasar/container/aspect-def.rb +60 -0
- data/lib/seasar/container/aspect-info-def.rb +94 -0
- data/lib/seasar/container/assembler/abstract-assembler.rb +68 -0
- data/lib/seasar/container/assembler/auto-property-assembler.rb +57 -0
- data/lib/seasar/container/assembler/autobinding-auto-def.rb +55 -0
- data/lib/seasar/container/assembler/autobinding-def-factory.rb +57 -0
- data/lib/seasar/container/assembler/autobinding-none-def.rb +53 -0
- data/lib/seasar/container/assembler/manual-constructor-assembler.rb +67 -0
- data/lib/seasar/container/assembler/manual-property-assembler.rb +68 -0
- data/lib/seasar/container/autobinding-def.rb +36 -0
- data/lib/seasar/container/component-def.rb +229 -0
- data/lib/seasar/container/component-info-def.rb +117 -0
- data/lib/seasar/container/deployer/abstract-component-deployer.rb +47 -0
- data/lib/seasar/container/deployer/instance-def-factory.rb +56 -0
- data/lib/seasar/container/deployer/instance-outer-def.rb +44 -0
- data/lib/seasar/container/deployer/instance-prototype-def.rb +44 -0
- data/lib/seasar/container/deployer/instance-singleton-def.rb +42 -0
- data/lib/seasar/container/deployer/outer-component-deployer.rb +47 -0
- data/lib/seasar/container/deployer/prototype-component-deployer.rb +51 -0
- data/lib/seasar/container/deployer/singleton-component-deployer.rb +54 -0
- data/lib/seasar/container/exception/component-notfound-runtime-exception.rb +44 -0
- data/lib/seasar/container/exception/cyclic-reference-runtime-exception.rb +43 -0
- data/lib/seasar/container/exception/illegal-autobinding-def-runtime-exception.rb +43 -0
- data/lib/seasar/container/exception/illegal-instance-def-runtime-exception.rb +44 -0
- data/lib/seasar/container/exception/toomany-registration-runtime-exception.rb +46 -0
- data/lib/seasar/container/instance-def.rb +37 -0
- data/lib/seasar/container/outer-component-def.rb +34 -0
- data/lib/seasar/container/property-def.rb +43 -0
- data/lib/seasar/container/s2application-context.rb +447 -0
- data/lib/seasar/container/s2container-component-def.rb +41 -0
- data/lib/seasar/container/s2container.rb +308 -0
- data/lib/seasar/container/simple-component-def.rb +45 -0
- data/lib/seasar/container/toomany-registration-component-def.rb +69 -0
- data/lib/seasar/container.rb +143 -0
- data/lib/seasar/dbi/dbi-interceptor.rb +97 -0
- data/lib/seasar/dbi/paginate.rb +215 -0
- data/lib/seasar/dbi.rb +26 -0
- data/lib/seasar/exception/notyet-implemented-exception.rb +25 -0
- data/lib/seasar/exception/property-notfound-runtime-exception.rb +48 -0
- data/lib/seasar/exception/s2runtime-exception.rb +35 -0
- data/lib/seasar/exception/unsupported-operation-exception.rb +25 -0
- data/lib/seasar/exception.rb +27 -0
- data/lib/seasar/log/s2logger.rb +75 -0
- data/lib/seasar/log.rb +38 -0
- data/lib/seasar/util/class-util.rb +116 -0
- data/lib/seasar/util.rb +24 -0
- data/setup.rb +1585 -0
- data/test/seasar/aop/test_pointcut.rb +25 -0
- data/test/seasar/aop/test_s2aop_factory.rb +90 -0
- data/test/seasar/beans/test_bean-desc.rb +179 -0
- data/test/seasar/container/assembler/test_auto_property_assembler.rb +87 -0
- data/test/seasar/container/assembler/test_autobinding_def_factory.rb +22 -0
- data/test/seasar/container/assembler/test_manual_property_assembler.rb +59 -0
- data/test/seasar/container/assembler/test_manula_constructor_assembler.rb +59 -0
- data/test/seasar/container/assembler/test_proc_constructor_assembler.rb +61 -0
- data/test/seasar/container/deployer/test_instance_def_factory.rb +24 -0
- data/test/seasar/container/deployer/test_prototype-deployer.rb +25 -0
- data/test/seasar/container/deployer/test_singleton-component-deployer.rb +24 -0
- data/test/seasar/container/s2app_load_sample.rb +6 -0
- data/test/seasar/container/test_arg-def.rb +34 -0
- data/test/seasar/container/test_aspect-info-def.rb +85 -0
- data/test/seasar/container/test_component-def.rb +91 -0
- data/test/seasar/container/test_component-info-def.rb +88 -0
- data/test/seasar/container/test_s2application-context.rb +290 -0
- data/test/seasar/container/test_s2container.rb +268 -0
- data/test/seasar/dbi/test_paginate.rb +265 -0
- data/test/seasar/test_log.rb +20 -0
- data/test/seasar/test_util.rb +46 -0
- data/test/test-suite.rb +7 -0
- metadata +211 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
module Deployer
|
22
|
+
# コンポーネントのインスタンス管理をOuterとするDeployerクラスです。
|
23
|
+
class OuterComponentDeployer < AbstractComponentDeployer
|
24
|
+
|
25
|
+
# OuterComponentDeployerを構築します。
|
26
|
+
# - args
|
27
|
+
# 1. Seasar::Container::ComponentDef <em>component_def</em>
|
28
|
+
def initialize(component_def)
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
# コンポーネントを構築します。
|
33
|
+
# - args
|
34
|
+
# - none
|
35
|
+
# - return
|
36
|
+
# - Object
|
37
|
+
def deploy
|
38
|
+
Seasar::Beans::BeanDescFactory.remove_bean_desc(@component_def.instance)
|
39
|
+
@property_assembler.assemble(@component_def.instance)
|
40
|
+
Seasar::Beans::BeanDescFactory.remove_bean_desc(@component_def.instance)
|
41
|
+
return @component_def.instance
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
module Deployer
|
22
|
+
# コンポーネントのインスタンス管理をPrototypeとするDeployerクラスです。
|
23
|
+
class PrototypeComponentDeployer < AbstractComponentDeployer
|
24
|
+
|
25
|
+
# PrototypeComponentDeployerを構築します。
|
26
|
+
# - args
|
27
|
+
# 1. Seasar::Container::ComponentDef <em>component_def</em>
|
28
|
+
def initialize(component_def)
|
29
|
+
super
|
30
|
+
@instantiating = false
|
31
|
+
end
|
32
|
+
|
33
|
+
# コンポーネントを構築します。
|
34
|
+
# - args
|
35
|
+
# - none
|
36
|
+
# - return
|
37
|
+
# - Object
|
38
|
+
def deploy
|
39
|
+
if @instantiating
|
40
|
+
raise Seasar::Container::Exception::CyclicReferenceRuntimeException(@component_def.component_class)
|
41
|
+
end
|
42
|
+
@instantiating = true
|
43
|
+
component = @constructor_assembler.assemble
|
44
|
+
@property_assembler.assemble(component)
|
45
|
+
@instantiating = false
|
46
|
+
return component
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
module Deployer
|
22
|
+
# コンポーネントのインスタンス管理をSingletonとするDeployerクラスです。
|
23
|
+
class SingletonComponentDeployer < AbstractComponentDeployer
|
24
|
+
|
25
|
+
# SingletonComponentDeployerを構築します。
|
26
|
+
# - args
|
27
|
+
# 1. Seasar::Container::ComponentDef <em>component_def</em>
|
28
|
+
def initialize(component_def)
|
29
|
+
super
|
30
|
+
@component = nil
|
31
|
+
@instantiating = false
|
32
|
+
end
|
33
|
+
|
34
|
+
# コンポーネントを構築します。
|
35
|
+
# - args
|
36
|
+
# - none
|
37
|
+
# - return
|
38
|
+
# - Object
|
39
|
+
def deploy
|
40
|
+
if @component.nil?
|
41
|
+
if @instantiating
|
42
|
+
raise Seasar::Container::Exception::CyclicReferenceRuntimeException.new(@component_def.component_class)
|
43
|
+
end
|
44
|
+
@instantiating = true
|
45
|
+
@component = @constructor_assembler.assemble
|
46
|
+
@instantiating = false
|
47
|
+
@property_assembler.assemble(@component)
|
48
|
+
end
|
49
|
+
return @component
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
module Exception
|
22
|
+
|
23
|
+
# コンポーネントがコンテナに見つからない場合にスローされる例外クラスです。
|
24
|
+
class ComponentNotFoundRuntimeException < Seasar::Exception::S2RuntimeException
|
25
|
+
|
26
|
+
# ComponentNotFoundRuntimeExceptionを構築します。
|
27
|
+
# - args
|
28
|
+
# 1. Symbol|String <em>key</em>
|
29
|
+
def initialize(key)
|
30
|
+
@key = key
|
31
|
+
end
|
32
|
+
|
33
|
+
# ComponentNotFoundRuntimeExceptionの文字列表現を返します。
|
34
|
+
# - args
|
35
|
+
# - none
|
36
|
+
# - return
|
37
|
+
# - String
|
38
|
+
def to_s
|
39
|
+
return "component [#{@key.to_s}] not found."
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
module Exception
|
22
|
+
# コンポーネントの再帰インジェクションが発生した場合にスローされる例外クラスです。
|
23
|
+
class CyclicReferenceRuntimeException < Seasar::Exception::S2RuntimeException
|
24
|
+
|
25
|
+
# CyclicReferenceRuntimeExceptionを構築します。
|
26
|
+
# - args
|
27
|
+
# 1. Class <em>component_class</em>
|
28
|
+
def initialize(component_class)
|
29
|
+
@component_class = component_class
|
30
|
+
end
|
31
|
+
|
32
|
+
# CyclicReferenceRuntimeExceptionの文字列表現を返します。
|
33
|
+
# - args
|
34
|
+
# - none
|
35
|
+
# - return
|
36
|
+
# - String
|
37
|
+
def to_s
|
38
|
+
return "component class is #{@component_class}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
module Exception
|
22
|
+
# AutoBindingDef抽象クラスを継承していないクラスを登録しようとした場合にスローされる例外クラスです。
|
23
|
+
class IllegalAutoBindingDefRuntimeException < Seasar::Exception::S2RuntimeException
|
24
|
+
|
25
|
+
# IllegalAutoBindingDefRuntimeExceptionを構築します。
|
26
|
+
# - args
|
27
|
+
# 1. Symbol <em>name</em>
|
28
|
+
def initialize(name)
|
29
|
+
@name = name
|
30
|
+
end
|
31
|
+
|
32
|
+
# IllegalAutoBindingDefRuntimeExceptionの文字列表現を返します。
|
33
|
+
# - args
|
34
|
+
# - none
|
35
|
+
# - return
|
36
|
+
# - String
|
37
|
+
def to_s
|
38
|
+
return 'autobinding name is ' << @name.to_s
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
module Exception
|
22
|
+
|
23
|
+
# InstanceDef抽象クラスを継承していないクラスを登録しようとした場合にスローされる例外クラスです。
|
24
|
+
class IllegalInstanceDefRuntimeException < Seasar::Exception::S2RuntimeException
|
25
|
+
|
26
|
+
# IllegalInstanceDefRuntimeExceptionを構築します。
|
27
|
+
# - args
|
28
|
+
# 1. Symbol <em>instance_def_name</em>
|
29
|
+
def initialize(instance_def_name)
|
30
|
+
@instance_def_name = instance_def_name
|
31
|
+
end
|
32
|
+
|
33
|
+
# IllegalInstanceDefRuntimeExceptionの文字列表現を返します。
|
34
|
+
# - args
|
35
|
+
# 1. Seasar::Container::ComponentDef <em>component_def</em>
|
36
|
+
# - return
|
37
|
+
# - Seasar::Container::Deployer::PrototypeComponentDeployer
|
38
|
+
def to_s
|
39
|
+
return 'instanceDef name is ' << @instance_def_name.to_s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
module Exception
|
22
|
+
|
23
|
+
# 複数のコンポーネントがコンテナに見つかった場合にスローされる例外クラスです。
|
24
|
+
class TooManyRegistrationRuntimeException < Seasar::Exception::S2RuntimeException
|
25
|
+
|
26
|
+
# TooManyRegistrationRuntimeExceptionを構築します。
|
27
|
+
# - args
|
28
|
+
# 1. Symbol <em>key</em>
|
29
|
+
# 2. Array <em>compnent_classes</em>
|
30
|
+
def initialize(key, compnent_classes)
|
31
|
+
@key = key
|
32
|
+
@component_classes = compnent_classes
|
33
|
+
end
|
34
|
+
|
35
|
+
# TooManyRegistrationRuntimeExceptionの文字列表現を返します。
|
36
|
+
# - args
|
37
|
+
# 1. Seasar::Container::ComponentDef <em>component_def</em>
|
38
|
+
# - return
|
39
|
+
# - Seasar::Container::Deployer::PrototypeComponentDeployer
|
40
|
+
def to_s
|
41
|
+
return "too many registration for key : #{@key}, classes : #{@component_classes.inspect}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
class InstanceDef
|
22
|
+
SINGLETON_NAME = :singleton
|
23
|
+
PROTOTYPE_NAME = :prototype
|
24
|
+
OUTER_NAME = :outer
|
25
|
+
|
26
|
+
#
|
27
|
+
# - args
|
28
|
+
# 1. Seasar::Container::ComponentDef <em>component_def</em>
|
29
|
+
# - return
|
30
|
+
# - Seasar::Container::Deployer::AbstractComponentDeployer
|
31
|
+
#
|
32
|
+
def create_component_deployer(component_def)
|
33
|
+
end
|
34
|
+
attr_accessor :name
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
class OuterComponentDef < ComponentDef
|
22
|
+
|
23
|
+
# - args
|
24
|
+
# 1. Seasar::Container::S2Contaner <em>container</em>
|
25
|
+
def initialize(container)
|
26
|
+
super(self.class)
|
27
|
+
@container = container
|
28
|
+
@instance_def = Seasar::Container::Deployer::InstanceDefFactory.get_instance_def(InstanceDef::OUTER_NAME)
|
29
|
+
@instance = nil
|
30
|
+
end
|
31
|
+
attr_accessor :instance
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#--
|
3
|
+
# +----------------------------------------------------------------------+
|
4
|
+
# | Copyright 2005-2008 the Seasar Foundation and the Others. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
# | Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
+
# | you may not use this file except in compliance with the License. |
|
8
|
+
# | You 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, |
|
15
|
+
# | either express or implied. See the License for the specific language |
|
16
|
+
# | governing permissions and limitations under the License. |
|
17
|
+
# +----------------------------------------------------------------------+
|
18
|
+
#++
|
19
|
+
module Seasar
|
20
|
+
module Container
|
21
|
+
class PropertyDef < ArgDef
|
22
|
+
|
23
|
+
# - args
|
24
|
+
# 1. Symbol|String <em>property_name</em>
|
25
|
+
# 2. Object <em>value</em>
|
26
|
+
def initialize(property_name, value = nil)
|
27
|
+
super(value)
|
28
|
+
if property_name.is_a?(Symbol)
|
29
|
+
@property_name = property_name
|
30
|
+
elsif property_name.is_a?(String)
|
31
|
+
if property_name[0] == "@"
|
32
|
+
@property_name = property_name.to_sym
|
33
|
+
else
|
34
|
+
@property_name = "@#{property_name}".to_sym
|
35
|
+
end
|
36
|
+
else
|
37
|
+
raise ArgumentError.new("property name must be String or Symbol")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
attr_accessor :property_name
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|