The pattern of use is:

You create a factory service for your data object.  The data object's
dependencies are injected into the factory.

You ask the factory for the object, it instantiates the data object
with the dependencies.

buildDefaultRegistry() builds  a new registry, not what you want.

Be aware that the dependencies will be runtime-generated proxy objects
that are not serializable.

You can have additional modules, not just AppModule ... there's doc in
the tapestry-ioc section to discuss how to update MANIFEST.MF with the
necessary data.

On 2/27/07, Peter Beshai <[EMAIL PROTECTED]> wrote:
I would like to use one of my services I have defined in AppModule in one of
my data classes. Is this frowned upon?

If not, how do I go about doing it?

Currently my AppModule has:
public static IListService buildListService( ... ) {  ... return
listService; } // listService is an instantation of an implementation of
IListService

and I tried in my data class to add the following:

private Registry registry = IOCUtilities.buildDefaultRegistry();
private IListService _listService = registry.getService(IListService.class);

but it didn't work

I also tried

private Registry registry = IOCUtilities.buildDefaultRegistry();
private IListService _listService = registry.getService("
my.package.ListService",IListService.class);

which gave me java.lang.RuntimeException: Module 'com.beshai.list.jdo' does
not exist. Please ensure that the JAR file for the module is on the
classpath. (the package and class is in a different JAR file, but it is a
maven dependency)

Thanks
--
Peter Beshai

Pure Mathematics/Computer Science Student
University of Waterloo



--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to