1 /* 2 * Copyright 1999-2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.cocoon.components.treeprocessor.sitemap; 17 18 import org.apache.cocoon.components.flow.AbstractInterpreter; 19 import org.apache.cocoon.components.flow.Interpreter; 20 import org.apache.cocoon.components.treeprocessor.AbstractProcessingNode; 21 import org.apache.cocoon.components.treeprocessor.InvokeContext; 22 import org.apache.cocoon.environment.Environment; 23 24 /** 25 * Handler for <map:script> elements in the sitemap. It registers the 26 * 27 * @author <a HREF="mailto:ovidiu@apache.org">Ovidiu Predescu</a> 28 * @since March 13, 2002 29 * @version CVS $Id: ScriptNode.java 30932 2004-07-29 17:35:38Z vgritsenko $ 30 */ 31 public class ScriptNode extends AbstractProcessingNode 32 { 33 String source; 34 35 public ScriptNode(String source) 36 { 37 this.source = source; 38 } 39 40 /** 41 * This method should never be called by the TreeProcessor, since a 42 * <map:script> element should not be in an "executable" sitemap 43 * node. 44 * 45 * @param env an <code>Environment</code> value 46 * @param context an <code>InvokeContext</code> value 47 * @return a <code>boolean</code> value 48 * @exception Exception if an error occurs 49 */ 50 public boolean invoke(Environment env, InvokeContext context) 51 throws Exception 52 { 53 return true; 54 } 55 56 public void registerScriptWithInterpreter(Interpreter interpreter) 57 { 58 if (interpreter instanceof AbstractInterpreter) 59 ((AbstractInterpreter)interpreter).register(source); 60 } 61 } 62