1 4 5 9 10 11 package org.openlaszlo.compiler; 12 import java.io.*; 13 import java.util.*; 14 import org.jdom.Element; 15 import org.openlaszlo.sc.ScriptCompiler; 16 import org.openlaszlo.xml.internal.MissingAttributeException; 17 18 19 23 abstract class ElementCompiler { 24 29 protected static final String VIEW_INSTANTIATION_FNAME = "LzInstantiateView"; 30 protected final CompilationEnvironment mEnv; 31 32 ElementCompiler(CompilationEnvironment env) { 33 mEnv = env; 34 } 35 36 39 abstract void compile(Element element) throws CompilationError; 40 41 void updateSchema(Element element, ViewSchema schema, Set visited) { 42 } 43 44 47 File resolveSrcReference(Element elt) { 48 return mEnv.resolveReference(elt); 49 } 50 51 59 public static String requireIdentifierAttributeValue(Element e, String aname) { 60 String value = e.getAttributeValue(aname); 61 if (value == null || !ScriptCompiler.isIdentifier(value)) { 62 throw new MissingAttributeException(e, aname); 63 } 64 return value; 65 } 66 67 68 69 } 70 | Popular Tags |