On Thu, 2010-02-04 at 12:27 +0000, Pid wrote:
> On 03/02/2010 23:50, Martin Grotzke wrote:
> > On Fri, 2010-01-29 at 14:58 +0000, Pid wrote:
> >> On 29/01/2010 11:33, Martin Grotzke wrote:
> >>> Hi Pid,
> >>>
> >>> what you describe is correct and works, I've implemented a Manager
> >>> implementation that uses simple attributes until now (for memcached
> >>> based session failover, memcached-session-manager:
> >>> http://code.google.com/p/memcached-session-manager/ ).
> >>>
> >>> However, now I want to support a complex, nested child element for a
> >>> TranscoderStrategy in my case (somehow comparable to the Store element
> >>> that is allowed as child element for the PersistentManager), that
> >>> supports different attributes depending on the TranscoderStrategy
> >>> implementation. It's possible to put all attributes into the Manager
> >>> element, but this is not what one would want to do - the related
> >>> attributes are spread between the Manager related attributes.
> >>
> >> I'm not sure I understand.
> >> Is the requirement an aesthetic thing or does the existing method not
> >> actually work for your use case?
> > Well, you might call it aesthetic. But you might also call it a better
> > design, as closely related attributes are encapsulated by a dedicated
> > element (high-cohesion).
> >
> > To make it more concrete, instead of
> >
> > <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
> >      memcachedNodes="n1:localhost:11211 n2:localhost:11212"
> >      failoverNodes="n2"
> >      requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"
> >      
> > transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
> >      copyCollectionsForSerialization="true"
> >      
> > customXmlFormat="org.example.SomeXmlFormat,org.example.AnotherXmlFormat"
> >      />
> >
> > I want
> >
> > <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
> >      memcachedNodes="n1:localhost:11211 n2:localhost:11212"
> >      failoverNodes="n2"
> >      requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"
> >      >
> >      <TranscoderFactory 
> > className="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
> >          copyCollectionsForSerialization="true"
> >          
> > customXmlFormat="org.example.SomeXmlFormat,org.example.AnotherXmlFormat"
> >      />
> > </Manager>
> >
> > where the allowed attributes of the TranscoderFactory element depend on
> > the actual TranscoderFactory class (specified with className).
> >
> > Unfortunately, this is not possible in the current version of tomcat
> > (don't know if there are any plans to change this).
> 
> Your requirement seems quite specific and I suspect that as there's a 
> way to handle this already, it's unlikely to change.
I agree, this is not a very common case. However, it would be nice to
have this kind of flexibility.


> >> If you've extended ManagerBase then maybe you can add an object FooBar
> >> (with getter&  setter) and attributes as needed.
> >>
> >> Or have you tried this already?
> 
> > Yes, I had already tried this without success. What's evaluated for the
> > Manager element is defined in the
> > org.apache.catalina.startup.ContextRuleSet.java, e.g. this are the
> > relevant lines for the Store:
> >
> > digester.addObjectCreate(prefix + "Context/Manager/Store",
> >                           null, // MUST be specified in the element
> >                           "className");
> > digester.addSetProperties(prefix + "Context/Manager/Store");
> > digester.addSetNext(prefix + "Context/Manager/Store",
> >                      "setStore",
> >                      "org.apache.catalina.Store");
> 
> I think you're probably stuck then.
Exactly ;-)

Cheers,
Martin


> 
> 
> p
> 
> 
> 
> >>> On Fri, 2010-01-29 at 10:10 +0000, Pid wrote:
> >>>> On 29/01/2010 00:31, Martin Grotzke wrote:
> >>>>> Hi,
> >>>>>
> >>>>> is it somehow possible to have a custom nested element below the Manager
> >>>>> element in server.xml/context.xml? E.g.
> >>>>>
> >>>>> <Manager className="org.app.MyManager">
> >>>>>      <FooBar foo="bar"/>
> >>>>> </Manager>
> >>>>>
> >>>>> where the MyManager class has a property fooBar?
> >>>>
> >>>> If the MyManager class has a field called fooBar, with matching getter
> >>>> and setter, then (my guess, based on how Valves work, is that) you can
> >>>> probably set it by doing this:
> >>>>
> >>>> <Manager className="org.app.MyManager" fooBar="somevalue">
> >>>>
> >>>> </Manager>
> >>>>
> >>>>
> >>>> p
> >>>>
> >>>>> AFAICS the ContextRuleSet defines what's possible in the Context element
> >>>>> without any hook - so it seems that there's no possibility to achieve
> >>>>> this.
> >>>>>
> >>>>> If someone could tell me that I'm wrong with this asumption I would be
> >>>>> happy! :-)
> >>>>>
> >>>>> Thanx&&    cheers,
> >>>>> Martin
> >>>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >>>> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to