|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
constructor-based injectionHi
I need to do some constructor-based injection and I can't find the way. I need to create an instance of org.apache.tapestry.util.ComponentAddress, the constructor takes 2 Strings as parameters. I know it should be simple but I'm lost. Alejandro. |
|
|
Re: constructor-based injectionThe original hivemind documentation describes constructor-based injection fairly well:
http://hivemind.apache.org/hivemind1/hivemind/BuilderFactory.html Also, this post is about the same subject: http://mail-archives.apache.org/mod_mbox/hivemind-user/200506.mbox/%3C200506221538.j5MFcqJr014219@...%3E Kalle On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote:
Hi |
|
|
Re: constructor-based injectionA ComponentAddress, in Tapestry, isn't really a "service", though.
Why would you want to put this type of object in your HiveMind registry? I can see it being part of a configuration, but not necessarily a service. What exactly are you trying to do? On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > Hi > > I need to do some constructor-based injection and I can't find the way. > I need to create an instance of > org.apache.tapestry.util.ComponentAddress, the constructor takes 2 > Strings as parameters. > I know it should be simple but I'm lost. > > Alejandro. > |
|
|
Re: constructor-based injectionHi James
I'm trying to migrate some Spring code to Hivemind. I need to create a Map<String , ComponentAddress> in the Hivemind registry. This is what it looks like on spring: <bean id="viewerService" class="org.trails.descriptor.EditorBlockFinder"> <property name="defaultBlockAddress"> <bean class="org.apache.tapestry.util.ComponentAddress"> <constructor-arg index="0"> <value>trails:Viewers</value> </constructor-arg> <constructor-arg index="1"> <value>stringViewer</value> </constructor-arg> </bean> </property> <property name="editorMap"> <map> <entry> <key> <value>hidden</value> </key> <bean class="org.apache.tapestry.util.ComponentAddress"> <constructor-arg index="0"> <value>trails:Viewers</value> </constructor-arg> <constructor-arg index="1"> <value>hidden</value> </constructor-arg> </bean> </entry> </map> </property> </bean> Alejandro. On 10/22/07, James Carman <james@...> wrote: > A ComponentAddress, in Tapestry, isn't really a "service", though. > Why would you want to put this type of object in your HiveMind > registry? I can see it being part of a configuration, but not > necessarily a service. What exactly are you trying to do? > > On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > > Hi > > > > I need to do some constructor-based injection and I can't find the way. > > I need to create an instance of > > org.apache.tapestry.util.ComponentAddress, the constructor takes 2 > > Strings as parameters. > > I know it should be simple but I'm lost. > > > > Alejandro. > > > |
|
|
Re: constructor-based injectionI would probably handle that via a configuration point in HiveMind.
On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > Hi James > > I'm trying to migrate some Spring code to Hivemind. > I need to create a Map<String , ComponentAddress> in the Hivemind registry. > This is what it looks like on spring: > > <bean id="viewerService" class="org.trails.descriptor.EditorBlockFinder"> > <property name="defaultBlockAddress"> > <bean class="org.apache.tapestry.util.ComponentAddress"> > <constructor-arg index="0"> > <value>trails:Viewers</value> > </constructor-arg> > <constructor-arg index="1"> > <value>stringViewer</value> > </constructor-arg> > </bean> > </property> > <property name="editorMap"> > <map> > <entry> > <key> > <value>hidden</value> > </key> > <bean class="org.apache.tapestry.util.ComponentAddress"> > <constructor-arg index="0"> > <value>trails:Viewers</value> > </constructor-arg> > <constructor-arg index="1"> > <value>hidden</value> > </constructor-arg> > </bean> > </entry> > </map> > </property> > </bean> > > Alejandro. > > On 10/22/07, James Carman <james@...> wrote: > > A ComponentAddress, in Tapestry, isn't really a "service", though. > > Why would you want to put this type of object in your HiveMind > > registry? I can see it being part of a configuration, but not > > necessarily a service. What exactly are you trying to do? > > > > On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > > > Hi > > > > > > I need to do some constructor-based injection and I can't find the way. > > > I need to create an instance of > > > org.apache.tapestry.util.ComponentAddress, the constructor takes 2 > > > Strings as parameters. > > > I know it should be simple but I'm lost. > > > > > > Alejandro. > > > > > > |
|
|
Re: constructor-based injectionHi
I made it work using a contribution point and a EditorContribution class: <configuration-point id="Editors" occurs="1..n"> <schema> <element name="editor"> <attribute name="key"/> <attribute name="container" required="true"/> <attribute name="component" required="true"/> <conversion class="org.amneris.trails.EditorContribution"/> </element> </schema> </configuration-point> Then creating the ComponentAddress entry on initialization public void initialize() { for (EditorContribution editorContribution : contributions) { getEditorMap().put(editorContribution.getKey(), new ComponentAddress(editorContribution.getContainer(), editorContribution.getComponent())); } } Is there any way to create the ComponentAddress directly on HiveMind? I still can't find how to use constructor parameters. Alejandro. On 10/23/07, James Carman <james@...> wrote: > I would probably handle that via a configuration point in HiveMind. > > On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > > Hi James > > > > I'm trying to migrate some Spring code to Hivemind. > > I need to create a Map<String , ComponentAddress> in the Hivemind registry. > > This is what it looks like on spring: > > > > <bean id="viewerService" class="org.trails.descriptor.EditorBlockFinder"> > > <property name="defaultBlockAddress"> > > <bean class="org.apache.tapestry.util.ComponentAddress"> > > <constructor-arg index="0"> > > <value>trails:Viewers</value> > > </constructor-arg> > > <constructor-arg index="1"> > > <value>stringViewer</value> > > </constructor-arg> > > </bean> > > </property> > > <property name="editorMap"> > > <map> > > <entry> > > <key> > > <value>hidden</value> > > </key> > > <bean class="org.apache.tapestry.util.ComponentAddress"> > > <constructor-arg index="0"> > > <value>trails:Viewers</value> > > </constructor-arg> > > <constructor-arg index="1"> > > <value>hidden</value> > > </constructor-arg> > > </bean> > > </entry> > > </map> > > </property> > > </bean> > > > > Alejandro. > > > > On 10/22/07, James Carman <james@...> wrote: > > > A ComponentAddress, in Tapestry, isn't really a "service", though. > > > Why would you want to put this type of object in your HiveMind > > > registry? I can see it being part of a configuration, but not > > > necessarily a service. What exactly are you trying to do? > > > > > > On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > > > > Hi > > > > > > > > I need to do some constructor-based injection and I can't find the way. > > > > I need to create an instance of > > > > org.apache.tapestry.util.ComponentAddress, the constructor takes 2 > > > > Strings as parameters. > > > > I know it should be simple but I'm lost. > > > > > > > > Alejandro. > > > > > > > > > > |
|
|
Re: constructor-based injectionI figured this had something to do with Trails (not many other folks
use ComponentAddresses). Are you hivemindizing the editors registration piece? I wanted to do that long ago. In this case, you could probably just define your own "rule" in HiveMind to process the "editor" element into a ComponentAddress which can be added to your map. I would also put a unique="true" on the "key" attribute so that you don't get two editors defined by folks with the same name. On 10/23/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > Hi > > I made it work using a contribution point and a EditorContribution class: > > <configuration-point id="Editors" occurs="1..n"> > <schema> > <element name="editor"> > <attribute name="key"/> > <attribute name="container" required="true"/> > <attribute name="component" required="true"/> > <conversion class="org.amneris.trails.EditorContribution"/> > </element> > </schema> > </configuration-point> > > Then creating the ComponentAddress entry on initialization > > public void initialize() > { > for (EditorContribution editorContribution : contributions) > { > getEditorMap().put(editorContribution.getKey(), new > ComponentAddress(editorContribution.getContainer(), > editorContribution.getComponent())); > } > } > > Is there any way to create the ComponentAddress directly on HiveMind? > I still can't find how to use constructor parameters. > > Alejandro. > > > On 10/23/07, James Carman <james@...> wrote: > > I would probably handle that via a configuration point in HiveMind. > > > > On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > > > Hi James > > > > > > I'm trying to migrate some Spring code to Hivemind. > > > I need to create a Map<String , ComponentAddress> in the Hivemind registry. > > > This is what it looks like on spring: > > > > > > <bean id="viewerService" class="org.trails.descriptor.EditorBlockFinder"> > > > <property name="defaultBlockAddress"> > > > <bean class="org.apache.tapestry.util.ComponentAddress"> > > > <constructor-arg index="0"> > > > <value>trails:Viewers</value> > > > </constructor-arg> > > > <constructor-arg index="1"> > > > <value>stringViewer</value> > > > </constructor-arg> > > > </bean> > > > </property> > > > <property name="editorMap"> > > > <map> > > > <entry> > > > <key> > > > <value>hidden</value> > > > </key> > > > <bean class="org.apache.tapestry.util.ComponentAddress"> > > > <constructor-arg index="0"> > > > <value>trails:Viewers</value> > > > </constructor-arg> > > > <constructor-arg index="1"> > > > <value>hidden</value> > > > </constructor-arg> > > > </bean> > > > </entry> > > > </map> > > > </property> > > > </bean> > > > > > > Alejandro. > > > > > > On 10/22/07, James Carman <james@...> wrote: > > > > A ComponentAddress, in Tapestry, isn't really a "service", though. > > > > Why would you want to put this type of object in your HiveMind > > > > registry? I can see it being part of a configuration, but not > > > > necessarily a service. What exactly are you trying to do? > > > > > > > > On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > > > > > Hi > > > > > > > > > > I need to do some constructor-based injection and I can't find the way. > > > > > I need to create an instance of > > > > > org.apache.tapestry.util.ComponentAddress, the constructor takes 2 > > > > > Strings as parameters. > > > > > I know it should be simple but I'm lost. > > > > > > > > > > Alejandro. > > > > > > > > > > > > > > > |
|
|
Re: constructor-based injectionHi James
Yes in deed, I'm hivemindizing the editorSerivce (the editors registration piece), to allow new modules to contribute new editors using the "pluginnable" HiveMind magic. I'm also trying to avoid spring dependencies as much as I can. I will try to create a "rule" and I will let you know how it goes. Saludos. Alejandro. On 10/23/07, James Carman <james@...> wrote: > I figured this had something to do with Trails (not many other folks > use ComponentAddresses). Are you hivemindizing the editors > registration piece? I wanted to do that long ago. In this case, you > could probably just define your own "rule" in HiveMind to process the > "editor" element into a ComponentAddress which can be added to your > map. I would also put a unique="true" on the "key" attribute so that > you don't get two editors defined by folks with the same name. > > On 10/23/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > > Hi > > > > I made it work using a contribution point and a EditorContribution class: > > > > <configuration-point id="Editors" occurs="1..n"> > > <schema> > > <element name="editor"> > > <attribute name="key"/> > > <attribute name="container" required="true"/> > > <attribute name="component" required="true"/> > > <conversion class="org.amneris.trails.EditorContribution"/> > > </element> > > </schema> > > </configuration-point> > > > > Then creating the ComponentAddress entry on initialization > > > > public void initialize() > > { > > for (EditorContribution editorContribution : contributions) > > { > > getEditorMap().put(editorContribution.getKey(), new > > ComponentAddress(editorContribution.getContainer(), > > editorContribution.getComponent())); > > } > > } > > > > Is there any way to create the ComponentAddress directly on HiveMind? > > I still can't find how to use constructor parameters. > > > > Alejandro. > > > > > > On 10/23/07, James Carman <james@...> wrote: > > > I would probably handle that via a configuration point in HiveMind. > > > > > > On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > > > > Hi James > > > > > > > > I'm trying to migrate some Spring code to Hivemind. > > > > I need to create a Map<String , ComponentAddress> in the Hivemind registry. > > > > This is what it looks like on spring: > > > > > > > > <bean id="viewerService" class="org.trails.descriptor.EditorBlockFinder"> > > > > <property name="defaultBlockAddress"> > > > > <bean class="org.apache.tapestry.util.ComponentAddress"> > > > > <constructor-arg index="0"> > > > > <value>trails:Viewers</value> > > > > </constructor-arg> > > > > <constructor-arg index="1"> > > > > <value>stringViewer</value> > > > > </constructor-arg> > > > > </bean> > > > > </property> > > > > <property name="editorMap"> > > > > <map> > > > > <entry> > > > > <key> > > > > <value>hidden</value> > > > > </key> > > > > <bean class="org.apache.tapestry.util.ComponentAddress"> > > > > <constructor-arg index="0"> > > > > <value>trails:Viewers</value> > > > > </constructor-arg> > > > > <constructor-arg index="1"> > > > > <value>hidden</value> > > > > </constructor-arg> > > > > </bean> > > > > </entry> > > > > </map> > > > > </property> > > > > </bean> > > > > > > > > Alejandro. > > > > > > > > On 10/22/07, James Carman <james@...> wrote: > > > > > A ComponentAddress, in Tapestry, isn't really a "service", though. > > > > > Why would you want to put this type of object in your HiveMind > > > > > registry? I can see it being part of a configuration, but not > > > > > necessarily a service. What exactly are you trying to do? > > > > > > > > > > On 10/22/07, Alejandro Scandroli <alejandroscandroli@...> wrote: > > > > > > Hi > > > > > > > > > > > > I need to do some constructor-based injection and I can't find the way. > > > > > > I need to create an instance of > > > > > > org.apache.tapestry.util.ComponentAddress, the constructor takes 2 > > > > > > Strings as parameters. > > > > > > I know it should be simple but I'm lost. > > > > > > > > > > > > Alejandro. > > > > > > > > > > > > > > > > > > > > > |
| Free embeddable forum powered by Nabble | Forum Help |