ovidiu 02/03/15 15:41:32 Modified: src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap ScriptNode.java Log: Invoke the Interpreter instance to read the script. Revision Changes Path 1.4 +11 -14 xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap/ScriptNode.java Index: ScriptNode.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/treeprocessor/sitemap/ScriptNode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ScriptNode.java 14 Mar 2002 20:25:07 -0000 1.3 +++ ScriptNode.java 15 Mar 2002 23:41:32 -0000 1.4 @@ -25,8 +25,9 @@ import org.apache.cocoon.sitemap.PatternException; public class ScriptNode extends AbstractProcessingNode - implements Composable, Initializable, Contextualizable + implements Composable, Contextualizable { + ComponentManager manager; String source; String language; Context context; @@ -37,11 +38,6 @@ this.language = language; } - public void initialize() - { - System.out.println("ScriptNode initialize"); - } - /** * This method should never be called by the TreeProcessor, since a * <map:script> element should not be in an "executable" sitemap @@ -65,28 +61,29 @@ } /** - * This method is the only chance a ScriptNode object has a chance - * to know about its environment and do something useful (since - * <code>invoke</code> is never called). Thus, once we obtain the - * ComponentManager, obtain the appropriate <code>Interpreter</code> - * instance for the language, and load the script. + * + * Load the script specified by this node. * * @param manager a <code>ComponentManager</code> value */ public void compose(ComponentManager manager) throws ComponentException { + this.manager = manager; + try { ComponentSelector selector = (ComponentSelector)manager.lookup(Interpreter.ROLE); // Obtain the Interpreter instance for this language Interpreter interpreter = (Interpreter)selector.select(language); - InputStream in = context.getResourceAsStream(source); + interpreter.readScript(source); } - catch (ComponentException ex) { + catch (Exception ex) { + ex.printStackTrace(); System.out.println("ScriptNode: Couldn't read the source file " + source + " in language " + language); - throw ex; + throw new ComponentException("ScriptNode: Couldn't read the source file " + + source + " in language " + language); } } }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]