hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alejandro Scandroli" <alejandroscandr...@gmail.com>
Subject Re: constructor-based injection
Date Tue, 23 Oct 2007 07:52:31 GMT
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@carmanconsulting.com> wrote:
> I would probably handle that via a configuration point in HiveMind.
>
> On 10/22/07, Alejandro Scandroli <alejandroscandroli@gmail.com> 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@carmanconsulting.com> 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@gmail.com> 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.
> > > >
> > >
> >
>

Mime
View raw message