I use HiveUtils (formerly hivetranse) ObjectBuilder for doing something
similar. It also solves the problem of injecting dependencies into POJOS:
http://hivetranse.sourceforge.net/quickstart.html#start.objectbuilder
Here is some sample code:
hivemodule.xml
<contribution configuration-id="tapestry.state.ApplicationObjects">
<state-object name="importantNewsArticles" scope="application">
<invoke-factory object="object:ImportantNewsArticles" />
</state-object>
</contribution>
<contribution configuration-id="hiveutils.ObjectBuilderObjects">
<object name="ImportantNewsArticles" cached="true"
class="com.estudiowebs.CMS.DAO.ImportantNewsArticles">
<inject name="persistenceService" object="spring:persistenceService" />
</object>
</contribution>
JAVA class
public class ImportantNewsArticles implements StateObjectFactory {
private PersistenceService persistenceService;
public void setPersistenceService(PersistenceService service) {
this.persistenceService = service;
}
public ImportantNewsArticles() {
}
public Object createStateObject() {
return yourASOObject;
}
}
Notice how the persistenceService which is a spring managed bean gets
injected into my ASO which is a regular POJO. In the same way you could
inject anything that you might need to initialize your ASO.
I hope it helps.
Raul.
spamsucks wrote:
I am trying to inject an aso into tapestry using the StateObjectFactory.
My class "StorageAdapterFactory" implements the StateObjectFactory and
has a property "fileSystemPath" with setter/getter on it.
I am trying to pass a String argument to my StateObjectFactory, but have
get the error that "No object provider exists for prefix 'string' "
I have tried using nothing, and with "literal:" but both of these also
fail. Can someone point me to how I can pass a string to my factory?
A tired thanks (it's been tough getting this far!)
<contribution configuration-id="tapestry.state.ApplicationObjects">
<state-object name="stitchfolder-data" scope="application">
<invoke-factory object="service:StorageAdapterFactory"/>
</state-object> </contribution>
<service-point id="StorageAdapterFactory"
interface="org.apache.tapestry.engine.state.StateObjectFactory">
<invoke-factory>
<construct
class="org.authsum.stitches.adapter.StorageAdapterFactory">
<set-object property="fileSystemPath"
value="string:/usr/local/rhodepc/workspace/dmi/stitchfolder"/>
</construct>
</invoke-factory>
</service-point>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]