Pardon my inexperience, but I'm having a little difficulty getting my head
wrapped around all of these IOC concepts. I've read through much of the
documentation on the tapestry website, but I'm still having a hard time
understanding it all.

So I should create a data factory service to handle the creation of my data
objects, and presumably include a buildDataFactory method in my AppModule
with an @InjectService("ListService") as one of the parameters. How do I go
from there to having it as something I can use in my data class? Would I
pass the service into the data class have it store a copy there (doesn't
sound like a good idea) or should I restructure my data class to not need
the service (it's possible in this case)?

Also, what is the benefit to having more modules than AppModule?
And re: updating the MANIFEST.MF, is this in regards to the external jar
where my ListService is in?

Thanks and sorry for the abundance of questions!
--
Peter Beshai

Pure Mathematics/Computer Science Student
University of Waterloo

On 2/27/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:

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