Viewing By Entry / Main
September 18, 2006
Now that Mark has added a configuration object to Transfer, it's time to document how you can configure Model-Glue to use Transfer for the ORM integration which drives GDMs (Generic Data Messages) and scaffolding. First off, you need the very latest version of Transfer from CVS (see the transfer.riaforge.org website for details). Second, you need a fairly up-to-date version of Model-Glue (from SVN).

Third, crack open Model-Glue and edit one of the core files - shock! horror! Edit ModelGlue/unity/config/Configuration.xml and change the definitions for ormAdapter and ormService as follows:

<!--
   This defines what ORM service to use, such as Transfer.
-->

<bean id="ormAdapter" class="transfer.modelglue.TransferAdapter">
   <constructor-arg name="framework">
      <ref bean="ModelGlue" />
   </constructor-arg>
</bean>

<!--
   This defines the ORM service
-->

<bean id="ormService" class="transfer.TransferFactory">
   <constructor-arg name="configuration">
      <ref bean="transferConfiguration" />
   
</constructor-arg>
</bean>
The transferConfiguration bean definition will appear either in your Model-Glue's local ColdSpring.xml or a global configuration that is used as the parent bean factory for Model-Glue (see earlier blog posts about this sort of configuration).

Your Transfer configuration might look like this:

<bean id="transferConfiguration" class="transfer.com.config.Configuration">
   <constructor-arg name="datasourcePath">
      <value>/environment/transfer/datasource.xml</value>
   </constructor-arg>
   <constructor-arg name="configPath">
      <value>/environment/transfer/transfer.xml</value>
   </constructor-arg>
   <constructor-arg name="definitionPath">
      <value>/environment/transferdata</value>
   </constructor-arg>
</bean>
That's all there is to it! Model-Glue will now use Transfer for scaffolding and GDMs. Bear in mind this is an early cut of the integration right now. In particular, it doesn't support validation or any form of relationship yet. However, it should be enough to let you do basic table-based operations using Transfer.

Joe and Mark and I are still looking at what it will take to support relationships with Transfer in Model-Glue. To be clear, Transfer has sophisticated support for relationships but Model-Glue's ORM support is very Reactor-centric right now which makes this level of integration somewhat more difficult!

Comments

Hey Sean,

Looks like this is coming along - let me know if I can help out more w/ relationships.

One tweak, though: you shouldn't need to modify the core Configuration.xml. Placing the ormService and ormAdapter definition in an application's Coldspring.xml file should be sufficient - it'll load that file into the same CS factory, overwriting the default Reactor beans.


Joe, did you not see my two enhancement requests on the coldspring-dev list (for an include tag and an alias option)? Because of the parent bean factory approach we have to use for our environment, it is easier for us to modify the core Configuration.xml file for now (to save repeating the definitions of ormService and ormAdapter in every single ColdSpring.xml file).


Post Your Comments
Name:
Email Address:
Comments
*** Please note that all comments require moderation so it may be some time before your comment posts to this blog! ***
Remember My Information:
 



Hosting provided by