From: Wolfgang M. M. <wol...@us...> - 2004-07-15 19:43:32
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9621/src/org/exist/xquery Modified Files: AbstractInternalModule.java XQueryContext.java Added Files: ModuleContext.java Log Message: Pass global context information to imported XQuery modules. Index: AbstractInternalModule.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/AbstractInternalModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractInternalModule.java 28 May 2004 10:54:13 -0000 1.2 --- AbstractInternalModule.java 15 Jul 2004 19:43:23 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- import java.util.TreeMap; + import org.apache.log4j.Logger; import org.exist.dom.QName; import org.exist.xquery.value.Sequence; *************** *** 36,39 **** --- 37,42 ---- public abstract class AbstractInternalModule implements InternalModule { + private final static Logger LOG = Logger.getLogger(AbstractInternalModule.class); + protected TreeMap mFunctionMap = new TreeMap(); protected FunctionDef[] mFunctions; Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** XQueryContext.java 27 Jun 2004 21:10:06 -0000 1.18 --- XQueryContext.java 15 Jul 2004 19:43:23 -0000 1.19 *************** *** 801,808 **** throw new XPathException("IO exception while loading module " + namespaceURI, e); } ! XQueryContext context = new XQueryContext(broker); ! context.setStaticallyKnownDocuments(getStaticallyKnownDocuments()); ! context.setBaseURI(baseURI); ! context.setWatchDog(watchdog); XQueryLexer lexer = new XQueryLexer(reader); XQueryParser parser = new XQueryParser(lexer); --- 801,805 ---- throw new XPathException("IO exception while loading module " + namespaceURI, e); } ! XQueryContext context = new ModuleContext(this); XQueryLexer lexer = new XQueryLexer(reader); XQueryParser parser = new XQueryParser(lexer); --- NEW FILE: ModuleContext.java --- /* * Created on Jul 15, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package org.exist.xquery; import java.util.Iterator; import org.exist.dom.DocumentSet; /** * @author wolf * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class ModuleContext extends XQueryContext { private XQueryContext parentContext; /** * @param broker */ public ModuleContext(XQueryContext parentContext) { super(parentContext.getBroker()); this.parentContext = parentContext; } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getStaticallyKnownDocuments() */ public DocumentSet getStaticallyKnownDocuments() { return parentContext.getStaticallyKnownDocuments(); } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getModule(java.lang.String) */ public Module getModule(String namespaceURI) { return parentContext.getModule(namespaceURI); } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getModules() */ public Iterator getModules() { return parentContext.getModules(); } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getWatchDog() */ public XQueryWatchDog getWatchDog() { return parentContext.getWatchDog(); } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getBaseURI() */ public String getBaseURI() { return parentContext.getBaseURI(); } } |