[Design the new POJO MicroContainer] - Re: Bean property inspection and actual injection
by adrian@jboss.org
What were you trying to fix here?
| Author: alesj
| Date: 2006-08-13 12:26:29 -0400 (Sun, 13 Aug 2006)
| New Revision: 55853
|
| Modified:
| projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java
| projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/PropertyContextualInjectionTestCase.java
| Log:
| AbstractController.allContexts.remove after failure in confiruration phase.
| Added NullName expected throwable.
|
| Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java
| ===================================================================
| --- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java 2006-08-13 15:45:00 UTC (rev 55852)
| +++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java 2006-08-13 16:26:29 UTC (rev 55853)
| @@ -443,6 +443,7 @@
| {
| log.error("Error installing to " + toState.getStateString() + ": " + context.toShortString(), error);
| uninstallContext(context, ControllerState.NOT_INSTALLED, trace);
| + allContexts.remove(context.getName()); //missing if contexts failes during configuration phase
| errorContexts.add(context);
| context.setError(error);
| return false;
|
This breaks the validate() method and makes it impossible
to retrieve the error that occurred since the installed context
no longer exists. (The controller has lost all reference to it).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965221#3965221
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965221
19 years, 7 months
[Design the new POJO MicroContainer] - Re: Bean property inspection and actual injection
by adrian@jboss.org
"alesj" wrote :
| I'm about to write bean class inspection for property @Inject - which will take place in DescribeAction - and will add PropertyMetaData to existing BeanMetaData (as discused).
|
| Should I wait for 'I do intend in future to define a proper contract'?
|
No since I've got no idea what that contract is, except
that it is a generalization of all the inject/depends/demands
such that a specific dependency type can be "plugged in"
without having to modify the kernel.
e.g. pseudo idea
| <register dependency="JNDI">
| <.../> <!-- description of dependency mechanism>
| </register>
|
| <inject bean="Blah" type="JNDI"/>
|
anonymous wrote :
| How to make this more general - handling all kinds of annotations, different injections (not just property, also constructor, collections, ...)?
Again, I haven't given any thought to it.
You can certainly use parameter annotations to describe
parameter injections.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965219#3965219
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965219
19 years, 7 months
[Design the new POJO MicroContainer] - Re: Bean instantiate order with contextual injection
by adrian@jboss.org
"alesj" wrote :
| How to get to class in different parameter injection cases:
|
|
| | <bean name="parameterObject1" class="org.jboss.test.kernel.inject.support.ParameterTestObject">
| | <constructor>
| | <parameter><array><inject/></array></parameter>
| | </constructor>
| | </bean>
| |
|
| Crawl back all to the constructorMD / parameterMD for some info which will help me in 'placeholder' dependency item?
That is more difficult. The current way it works is based on the
injected type deciding which method/constructor gets used
(by matching the passed types to the parameter types).
What you are trying to do is the reverse which currently has
no infrastructure to support it.
It is also an unsolvable problem in general:
e.g.
| public class MyClass
| {
| public MyClass(Type1 type1) {}
| public MyClass(Type2 type2) {}
| }
|
Which type should I use Type1 or Type2?
The only way to resolve it would be:
| <parameter class="Type1"><inject/></parameter>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965216#3965216
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965216
19 years, 7 months
[Design the new POJO MicroContainer] - Re: Bean instantiate order with contextual injection
by alesj
"adrian(a)jboss.org" wrote : I don't understand?
|
| It should fail if the inject cannot find a target.
|
| When it works, it should look like this:
| (C1) Context1: Your bean above
| (C2) Context2: Implements the class
|
| C1: preprocess/Describe - we need somebody to implement the parameter class
| C2: .../Instantiate/etc. - I implement it
| C1: Can now proceed to instantiation using C2 as the iDependOn
|
| If there is no C2, then it is an error.
Ok, this is written for property case - and is already commited.
In property case I can later (still in describe state) get the actual property class type.
How to get to class in different parameter injection cases:
| <bean name="parameterObject1" class="org.jboss.test.kernel.inject.support.ParameterTestObject">
| <constructor>
| <parameter><array><inject/></array></parameter>
| </constructor>
| </bean>
|
Crawl back all to the constructorMD / parameterMD for some info which will help me in 'placeholder' dependency item?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965208#3965208
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965208
19 years, 7 months