> > Every time I want to use CVSSource in my project, I clean InputModule
> > section and all works correctly after that.
> 
> Maybe it works if you clean the InputModule section. I will test it.
> 
> However, isn't it a bug (of CVSSource or other) that you can't have
> both CVSSource and InputModules together at the same time?
> 
> Shouldn't someone break the loop? Who? How?


I have tried something that worked on cocoon 2.1.5: using lazy initialization.

Here's the necessary change for CVSSourceFactory:

- Method implementation one-line change:

    private VariableResolver getVariable(Configuration config, String
name, String defValue) throws ConfigurationException {
        Configuration child = config.getChild(name);
        try {
            String pattern = child.getValue(defValue);
            return new LazyVariableResolver(pattern, this.manager); //
instead of using VariableResolverFactory
        } catch(PatternException pe) {
            throw new ConfigurationException(
                "Wrong expression for " + child.getName() + " at " +
child.getLocation(),
                pe
            );
        }
    }


- New inner class (could easily be moved outside):

    class LazyVariableResolver extends VariableResolver {
        VariableResolver delegate;
        ComponentManager cm;

        LazyVariableResolver(String s, ComponentManager cm) throws
PatternException {
            super(s);
            this.cm = cm;
        }

        public String resolve(InvokeContext context, Map map) throws
PatternException {
            if(delegate==null) {
                delegate =
VariableResolverFactory.getResolver(originalExpr, cm);
            }
            return delegate.resolve(context, map);
        }
    }


But possibly this is not the right thing to do for Cocoon 2.1.7, as I
think the VariableResolver thing has changed quite a lot from 2.1.5 to
2.1.7.

-- 
Antonio

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

Reply via email to