Carsten Ziegeler wrote:
> 
> >
> > I am currently trying to get act nodes to work and am have 
> a question 
> > about the source resolving in 2.2. Currently the environment source 
> > resolver is put into the object model in the PipelinesNode. 
> However, 
> > now that the environment no longer implements SourceResolver but 
> > appears to be implemented by EnvironmentHelper instead I no longer 
> > have access to it there. So, I was thinking whether we should move 
> > that logic into
> > EnvironmentHelper.enterProcessor() / leaveProcessor() ? 
> Does that make 
> > any sense to you?
> >
> Ok, I never liked putting such objects into the object model 
> as the om is available to all sitemap components and users 
> *can* take those objects out of the om and use them.
> IMHO we should avoid putting any internal objects into the om 
> or into the environment if possible. But that's only my 
> personal opinion :)
> 
> The Processor holds an EnvironmentHelper instance and each 
> node can simply (and should) pass on this instance to a 
> sitemap component.
> So, you can do a
> resolver = this.processor.getEnvironmentHelper();
> 
> in the ActNode (if this node has access to the processor). 
> The pipeline implementation e.g. does it this way.
> If the ActNode doesn't have access to the processor, than 
> there are two
> choices:
> a) Use the attributes of the environment or
> b) Use the new EnvironmentContext mechanism This allows to 
> store arbitrary objects "at" the environment without directly 
> adding them to the environment. This keeps the env. clear 
> Perhaps this is FS or overdoing things, I don't know. Anyway, 
> you can get an EnvironmentContext using a static method on 
> the EnvironmentHelper
> getEnvironmentContext(Environment) and  add/get attributes from there.
> 
> Personally, I would prefer passing the processor to the act 
> node as this is imho the cleanest but also the fastest 
> solution (no lookup required during runtime).
> 

OK thanks. It looks like we had the same idea :-). I went ahead and
implemented it the way you describe in option b) . I also added two
static helper methods to EnvironmentHelper: getSourceResolver and
getRedirector so we don't have to pass in the processor instance.

If you find the time perhaps you can proof-read the changes?

TIA,
Unico

Reply via email to