@@ -68,53 +68,59 @@ MolHomeServices >> addDeployedComponent: aComponentClass [
6868]
6969
7070{ #category : #private }
71- MolHomeServices >> checkInstanciationOfComponent: arg1 named: arg2 [
71+ MolHomeServices >> checkInstanciationOfComponent: aComponentClass named: aComponentName [
7272
73- | tmp1 tmp2 tmp3 |
74- arg2 ifNil: [
73+ | deployed component overridedTypes |
74+ aComponentName ifNil: [
7575 ^ WrongComponentNameError new messageText:
7676 ' Can not instanciate a component without name' ].
77- arg2 isSymbol ifFalse: [
77+
78+ aComponentName isSymbol ifFalse: [
7879 ^ WrongComponentNameError new messageText:
7980 ' Can not instanciate a component with a name wish is not a symbol' ].
80- tmp1 := self deployedComponents at: arg1 ifAbsent: [
81+
82+ deployed := self deployedComponents at: aComponentClass ifAbsent: [
8183 ^ ComponentNotDeployedError new messageText:
8284 ' Can not instanciate a non deployed component' ].
83- tmp1 at: arg2 ifPresent: [ :arg3 |
84- arg3 ifNotNil: [
85+ deployed at: aComponentName ifPresent: [ :e |
86+ e ifNotNil: [
8587 ^ ComponentAlreadyExistsError new messageText:
8688 ' Can not instanciate a component with the same name of another component, please change the name of the component' ] ].
87- tmp2 := MolComponentManager default locatorServices
88- searchComponentTypeImplementorFor: arg1 componentType
89- named: arg2.
90- tmp2 ifNotNil: [
89+
90+ component := MolComponentManager default locatorServices
91+ searchComponentTypeImplementorFor: aComponentClass componentType
92+ named: aComponentName.
93+ component ifNotNil: [
9194 ^ ComponentAlreadyExistsError new messageText:
9295 ' Can not instanciate a component with the same type and name of another component, please change the name of the component' ].
93- arg1 componentType allProvidedServices do: [ :arg4 |
96+
97+ aComponentClass componentType allProvidedServices do: [ :e |
9498 (MolComponentManager default locatorServices
95- searchServicesProviderFor: arg4
96- named: arg2 ) isNotFoundServices ifFalse: [
99+ searchServicesProviderFor: e
100+ named: aComponentName ) isNotFoundServices ifFalse: [
97101 ^ ComponentProvidedServicesAlreadyExistsError new messageText:
98102 ' Can not instanciate a component with the same services and name of another component, please change the name of the component' ] ].
99- arg1 componentType allProvidedParameters do: [ :arg5 |
103+
104+ aComponentClass componentType allProvidedParameters do: [ :e |
100105 (MolComponentManager default locatorServices
101- searchParametersProviderFor: arg5
102- named: arg2 ) isNotFoundParameters ifFalse: [
106+ searchParametersProviderFor: e
107+ named: aComponentName ) isNotFoundParameters ifFalse: [
103108 ^ ComponentProvidedParametersAlreadyExistsError new messageText:
104109 ' Can not instanciate a component with the same parameters and name of another component, please change the name of the component' ] ].
105- arg1 isOverrideComponentType ifTrue: [
106- tmp3 := arg1 overridedComponentTypes.
107- tmp3 do: [ :arg6 |
108- arg6 allProvidedServices do: [ :arg7 |
110+
111+ aComponentClass isOverrideComponentType ifTrue: [
112+ overridedTypes := aComponentClass overridedComponentTypes.
113+ overridedTypes do: [ :type |
114+ type allProvidedServices do: [ :e |
109115 (MolComponentManager default locatorServices
110- searchServicesProviderFor: arg7
111- named: arg2 ) isNotFoundServices ifFalse: [
116+ searchServicesProviderFor: e
117+ named: aComponentName ) isNotFoundServices ifFalse: [
112118 ^ ComponentProvidedServicesAlreadyExistsError new messageText:
113119 ' (Inheritance problem) Can not instanciate a component with the same services and name of another component, please change the name of the component' ] ].
114- arg6 allProvidedParameters do: [ :arg8 |
120+ type allProvidedParameters do: [ :e |
115121 (MolComponentManager default locatorServices
116- searchParametersProviderFor: arg8
117- named: arg2 ) isNotFoundParameters ifFalse: [
122+ searchParametersProviderFor: e
123+ named: aComponentName ) isNotFoundParameters ifFalse: [
118124 ^ ComponentProvidedServicesAlreadyExistsError new messageText:
119125 ' (Inheritance problem) Can not instanciate a component with the same parameters and name of another component, please change the name of the component' ] ] ] ].
120126 ^ nil
0 commit comments