You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vjeran Marcinko <vj...@tis.hr> on 2004/08/22 14:05:35 UTC

Service layer singletons in Tapestry apps

Hi.

Is it me, or somebody else thinks that finding proper place for placing
service layer singletons is a bit foggy ?

- at first glance Global seems most apropriate, since most of service
classes are singletons, and should be placed somewhere globally to all
application, and that's Global object. But then again, if I want to
instantiate these service objects in this Global object, I would need some
way of fetching parameters from some XML config file for this service
singleton and that would be .application file, but there is a problem -
Global object has no contract by which it would be passed in some
IPropertySource object let's say from where to fetch config. I can do that
only if I override createGlobal() method of AbstractEngine, but I always
consider overriding standard class a hack, and not mainstream way of doing
something, and BTW, createGlobal() method has only RequestContext passed to
method, thus no way to fetch IPropertySource from there, only if I take
instance variable '_propertySource' from engine, but one wouldn't be sure if
it's already set in that time

- there is <extension> mechanism in .application file, that should be used
for instantiating singletons, and offers some basic way of xml
configuration, but I hardly hear that anyone is using it? (or maybe I'm
wrong)

Is forecoming Tapestry3.1, with HiveMind support, offer some new way of
exposing such shared service objects?

Regards,
Vjeran


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Service layer singletons in Tapestry apps

Posted by Howard Lewis Ship <hl...@gmail.com>.
That, in fact, is the entire point of HiveMind. Tapestry had outgrown
the "home brew" approach for managing service singletons and offered
only a very, very limited ability (i.e.., <extension>) for managing
application-specific singletons.

<extension> is limited, because it can't be connected directly to the
Servlet API, simply because of when extensions are instantiated, and
because they are instantiated using a no-args constructor.

HiveMind opens it all up and povides everything you'll need.

On Sun, 22 Aug 2004 14:05:35 +0200, Vjeran Marcinko <vj...@tis.hr> wrote:
> Hi.
> 
> Is it me, or somebody else thinks that finding proper place for placing
> service layer singletons is a bit foggy ?
> 
> - at first glance Global seems most apropriate, since most of service
> classes are singletons, and should be placed somewhere globally to all
> application, and that's Global object. But then again, if I want to
> instantiate these service objects in this Global object, I would need some
> way of fetching parameters from some XML config file for this service
> singleton and that would be .application file, but there is a problem -
> Global object has no contract by which it would be passed in some
> IPropertySource object let's say from where to fetch config. I can do that
> only if I override createGlobal() method of AbstractEngine, but I always
> consider overriding standard class a hack, and not mainstream way of doing
> something, and BTW, createGlobal() method has only RequestContext passed to
> method, thus no way to fetch IPropertySource from there, only if I take
> instance variable '_propertySource' from engine, but one wouldn't be sure if
> it's already set in that time
> 
> - there is <extension> mechanism in .application file, that should be used
> for instantiating singletons, and offers some basic way of xml
> configuration, but I hardly hear that anyone is using it? (or maybe I'm
> wrong)
> 
> Is forecoming Tapestry3.1, with HiveMind support, offer some new way of
> exposing such shared service objects?
> 
> Regards,
> Vjeran
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org