r1316 - in guix/trunk/guix-compiler: . src/main/java/org/codelutin/guix/compiler src/main/java/org/codelutin/guix/model src/main/java/org/codelutin/guix/tags
Author: kmorin Date: 2009-04-17 08:19:00 +0000 (Fri, 17 Apr 2009) New Revision: 1316 Removed: guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/compiler/GuixCompilerLaunchor.java guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/model/ModelObject.java Modified: guix/trunk/guix-compiler/pom.xml guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/compiler/GuixCompiler.java guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/model/AttributeDescriptor.java guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/tags/TagManager.java Log: Modified: guix/trunk/guix-compiler/pom.xml =================================================================== --- guix/trunk/guix-compiler/pom.xml 2009-04-15 15:52:09 UTC (rev 1315) +++ guix/trunk/guix-compiler/pom.xml 2009-04-17 08:19:00 UTC (rev 1316) @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -13,7 +12,7 @@ <version>1.0-SNAPSHOT</version> </parent> - <artifactId>guix-compiler</artifactId> + <artifactId>guix-parser</artifactId> <dependencies> <dependency> @@ -26,8 +25,8 @@ <!-- ************************************************************* --> <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Guix compiler</description> + <name>guix-compiler</name> + <description>Guix parser</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> @@ -39,8 +38,23 @@ <!-- *** Build Environment ************************************** --> <!-- ************************************************************* --> <scm> - <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/guix/trunk/guix_compiler</connection> + <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/guix/trunk/guix-parser</connection> <!--developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/guix/trunk</developerConnection--> <!--url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/guix/trunk/?root=buix</url--> </scm> + + <profiles> + <profile> + <build> + <plugins> + <plugin> + <groupId>org.codelutin.guix</groupId> + <artifactId>guix-maven-plugin</artifactId> + <version>${project.version}</version> + </plugin> + </plugins> + </build> + <id>default</id> + </profile> + </profiles> </project> Modified: guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/compiler/GuixCompiler.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/compiler/GuixCompiler.java 2009-04-15 15:52:09 UTC (rev 1315) +++ guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/compiler/GuixCompiler.java 2009-04-17 08:19:00 UTC (rev 1316) @@ -4,13 +4,17 @@ */ package org.codelutin.guix.compiler; +import org.codelutin.guix.GuixLauncher; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.Stack; +import org.codelutin.guix.model.AttributeDescriptor; import org.codelutin.guix.model.ClassDescriptor; -import org.codelutin.guix.model.ModelObject; +import org.codelutin.guix.model.GuixModelObject; import org.codelutin.guix.tags.TagManager; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -34,10 +38,10 @@ * so we can report the right source file. */ protected Stack<File> sourceFiles = new Stack<File>(); /** XML parser of src file. */ - protected XmlPullParser xpp; private File baseDir; private File src; private String outputClassName; + private GuixLauncher launchor; /*------------------------------------------------------------------------*/ /*-- Constructor methods -------------------------------------------------*/ @@ -49,14 +53,16 @@ * @param src location of file to compile * @param outputClassName the out file name */ - protected GuixCompiler(File baseDir, File src, String outputClassName) { + public GuixCompiler(File baseDir, File src, String outputClassName, + GuixLauncher launchor) { this.baseDir = baseDir; this.src = src; sourceFiles.push(src); this.outputClassName = outputClassName; + this.launchor = launchor; } - public void compile() + public GuixModelObject compile() throws FileNotFoundException, IOException, XmlPullParserException { //try { XmlPullParserFactory factory = XmlPullParserFactory.newInstance( @@ -65,135 +71,112 @@ XmlPullParser xpp = factory.newPullParser(); xpp.setInput(new FileReader(src)); - if (xpp.getEventType() == xpp.START_DOCUMENT) { - xpp.next(); + if (xpp.getEventType() == XmlPullParser.START_DOCUMENT) { + StringBuffer doc = new StringBuffer(); + do { + xpp.nextToken(); + if(xpp.getEventType() == XmlPullParser.COMMENT) + doc.append(xpp.getText()); + } while(xpp.getEventType() == XmlPullParser.START_TAG); String nameSpace = xpp.getNamespace(); String localName = xpp.getName(); - boolean namespacePrefix = xpp.getPrefix() != null; - String fullClassName = - getFullClassName(nameSpace,localName,namespacePrefix); + String packageName = + getPackageName(nameSpace, localName); - ModelObject root = new ModelObject(xpp.getAttributeValue("", "id")); + GuixModelObject root = new GuixModelObject( + xpp.getAttributeValue("", "id"), doc.toString()); root.setClassDescriptor(new ClassDescriptor( - src.getName(),src.getPath().replace('/', '.'))); - root.getClassDescriptor() - .setSuperClass(new ClassDescriptor(localName,fullClassName - .substring(0, fullClassName.lastIndexOf(".")))); + src.getName(), src.getPath().replace('/', '.'))); + root.getClassDescriptor().setSuperClass(new ClassDescriptor( + localName, packageName)); + root.setAttributeDescriptors(getAttributes(xpp)); - xpp.next(); - compile(xpp); + while(xpp.getEventType() != XmlPullParser.START_TAG) + xpp.nextToken(); + if(xpp.getName().equals("script")) { + xpp.nextToken(); + if(xpp.getEventType() == XmlPullParser.CDSECT) + root.getClassDescriptor().setScript(xpp.getText()); + while((xpp.getEventType() != XmlPullParser.END_TAG) + || (!xpp.getName().equals("script"))) + xpp.nextToken(); + } + + failed = launchor.registerClassDescriptor(root.getClassDescriptor()); + + xpp.nextToken(); + if (xpp.getEventType() == XmlPullParser.START_TAG) { + compile(xpp,root,doc.toString()); + } + + return root; } + failed = true; + return null; //} } /*------------------------------------------------------------------------*/ /*-- Compile methods -----------------------------------------------------*/ /*------------------------------------------------------------------------*/ - public void compile(final XmlPullParser xpp) throws IOException { - //tagsBeingCompiled.push(tag); + public void compile(final XmlPullParser xpp, GuixModelObject previousMO, + String javaDoc) throws IOException, XmlPullParserException { + String nameSpace = xpp.getNamespace(); String localName = xpp.getName(); - boolean namespacePrefix = xpp.getPrefix() != null; - String fullClassName = - getFullClassName(nameSpace,localName,namespacePrefix); - + String packageName = getPackageName(nameSpace, localName); - if (fullClassName != null) {//we are definitely dealing with a class tag - //addDependencyClass(fullClassName); - nameSpace = fullClassName - .substring(0, fullClassName.lastIndexOf(".") + 1) + "*"; - if (symbolTable.getSuperclassName() == null) { - symbolTable.setSuperclassName(fullClassName); - } - String id = tag.getAttribute("id"); - if (id.length() > 0) { - symbolTable.getClassTagIds().put(id, fullClassName); - if (tag.getAttributeNode("javaBean") != null) { - // add java bean support for this property - String capitalizeName = - org.apache.commons.lang.StringUtils.capitalize(id); - // add method - symbolTable.getScriptMethods().add( - new MethodDescriptor("get" + capitalizeName, - Modifier.PUBLIC, fullClassName, new String[0], classLoader)); - if (Boolean.class.getName().equals(fullClassName)) { - symbolTable.getScriptMethods().add(new MethodDescriptor("is" + capitalizeName, Modifier.PUBLIC, fullClassName, new String[0], classLoader)); - } - symbolTable.getScriptMethods().add(new MethodDescriptor("set" + capitalizeName, Modifier.PUBLIC, "void", new String[]{fullClassName}, classLoader)); - } - } - } - // during the first pass, we can't create ClassDescriptors for JAXX files because they may not have been processed yet - // (and we can't wait until they have been processed because of circular dependencies). So we don't do any processing - // during the first pass which requires having a ClassDescriptor; here we determine whether we have a class tag or not - // (class tag namespaces end in "*") and use a generic handler if so. The real handler is used during the second pass. - TagHandler handler = (nameSpace != null && nameSpace.endsWith("*")) ? firstPassClassTagHandler : TagManager.getTagHandler(tag.getNamespaceURI(), localName, namespacePrefix, this); - if (handler != firstPassClassTagHandler && handler instanceof DefaultObjectHandler) { - fullClassName = ((DefaultObjectHandler) handler).getBeanClass().getName(); - //namespace = fullClassName.substring(0, fullClassName.lastIndexOf(".") + 1) + "*"; - handler = firstPassClassTagHandler; - } - if (handler == firstPassClassTagHandler) { - final String finalClassName = fullClassName; - registerInitializer(new Runnable() { // register an initializer which will create the CompiledObject after pass 1 + nameSpace = packageName + ".*"; + GuixModelObject mo = new GuixModelObject(xpp.getAttributeValue("","id"),javaDoc); + mo.setParent(previousMO); + mo.setClassDescriptor(new ClassDescriptor(localName, packageName)); + previousMO.getChildren().add(mo); - public void run() { - DefaultObjectHandler handler = (DefaultObjectHandler) TagManager.getTagHandler(null, finalClassName, JAXXCompiler.this); - if (handler == null) { - throw new CompilerException("Internal error: missing TagHandler for '" + finalClassName + "'"); - } - handler.registerCompiledObject(tag, JAXXCompiler.this); + failed = launchor.registerClassDescriptor(mo.getClassDescriptor()); + if(!failed) { + GuixModelObject prev = mo; + StringBuffer doc = new StringBuffer(); + do { + xpp.next(); + if (xpp.getEventType() == XmlPullParser.END_TAG) { + prev = prev.getParent(); } - }); - } - if (handler != null) { - try { - handler.compileFirstPass(tag, this); - } catch (CompilerException e) { - reportError(e); + else if(xpp.getEventType() == XmlPullParser.COMMENT) + doc.append(xpp.getText()); + } while (xpp.getEventType() != XmlPullParser.START_TAG + && xpp.getEventType() != XmlPullParser.END_DOCUMENT); + + if (xpp.getEventType() == XmlPullParser.START_TAG) { + compile(xpp, prev,doc.toString()); } - } else { - reportError("Could not find a Java class corresponding to: <" + tag.getTagName() + ">"); - failed = true; } - - Element finished = tagsBeingCompiled.pop(); - if (finished != tag) { - throw new RuntimeException("internal error: just finished compiling " + tag + ", but top of tagsBeingCompiled stack is " + finished); - } } - private String getFullClassName(String nameSpace, String localName, - boolean namespacePrefix) { + private String getPackageName(String nameSpace, String localName) { // resolve class tags into fully-qualified class name - String fullClassName; + String packageName; if (nameSpace != null && nameSpace.endsWith("*")) { - String packageName = nameSpace.substring(0, nameSpace.length() - 1); - // class name is fully-qualified already - if (localName.startsWith(packageName)) { - fullClassName = TagManager.resolveClassName(localName); - } - // namespace not included in class name, - //probably need the namespace to resolve - else { - fullClassName = TagManager - .resolveClassName(packageName + localName); - // it was just a default namespace, - // try again without using the namespace - if (fullClassName == null && !namespacePrefix) { - fullClassName = TagManager.resolveClassName(localName); - } - } + packageName = nameSpace.substring(0, nameSpace.length() - 2); + } else { + String fullClassName = TagManager.resolveClassName(localName); + packageName = fullClassName + .substring(0, fullClassName.lastIndexOf('.')); } - else { - fullClassName = TagManager.resolveClassName(localName); + return packageName; + } + + private List<AttributeDescriptor> getAttributes(XmlPullParser xpp) { + List<AttributeDescriptor> result = new ArrayList<AttributeDescriptor>(); + for(int i = 0 ; i < xpp.getAttributeCount() ; i++) { + if(!xpp.getAttributeName(i).equals("id")) + result.add(new AttributeDescriptor( + xpp.getAttributeName(i),xpp.getAttributeValue(i))); } - return fullClassName; + return result; } public boolean isFailed() { return failed; } - } Deleted: guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/compiler/GuixCompilerLaunchor.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/compiler/GuixCompilerLaunchor.java 2009-04-15 15:52:09 UTC (rev 1315) +++ guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/compiler/GuixCompilerLaunchor.java 2009-04-17 08:19:00 UTC (rev 1316) @@ -1,213 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package org.codelutin.guix.compiler; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Launch Guix files compilation - * - * @author morin - */ -public class GuixCompilerLaunchor { - - /** log */ - protected static final Log log = - LogFactory.getLog(GuixCompilerLaunchor.class); - /** original list of files to compile */ - protected final File[] files = null; - /** original list of classes to compile */ - protected final String[] classNames = null; - /** Files to be treated while compilation. */ - protected List<File> jaxxFiles = new ArrayList<File>(); - /** Class names corresponding to the files in the jaxxFiles list. */ - protected List<String> jaxxFileClassNames = new ArrayList<String>(); - /** Maps the names of classes being compiled to the compiler instance - * handling the compilation. */ - protected Map<String, GuixCompiler> compilers = - new HashMap<String, GuixCompiler>(); - - protected int compilerCount; - private File targetDirectory = new File("destination"); - - - /** - * Compiled a set of files. - * - * @return <code>true</code> if compilation succeeds, - * <code>false</code> otherwise - */ - public synchronized boolean compile() { - //reset(); // just to be safe... - compilerCount = 0; - jaxxFiles.addAll(Arrays.asList(files)); - jaxxFileClassNames.addAll(Arrays.asList(classNames)); - try { - boolean success = true; - - // pass 1 - /*if (!nextStep(LifeCycle.compile_first_pass, success)) { - return false; - }*/ - boolean compiled; - do { - compiled = false; - assert jaxxFiles.size() == jaxxFileClassNames.size(); - // clone it so it can safely be modified while we're iterating - Iterator<File> filesIterator = - new ArrayList<File>(jaxxFiles).iterator(); - Iterator<String> classNamesIterator = - new ArrayList<String>(jaxxFileClassNames).iterator(); - - while (filesIterator.hasNext()) { - - File file = filesIterator.next(); - String className = classNamesIterator.next(); - if (log.isDebugEnabled()) { - log.debug("compile first pass for " + className); - } - //if (symbolTables.get(file) == null) { - compiled = true; - if (compilers.containsKey(className)) { - //throw new CompilerException("Internal error: " + className + " is already being compiled, attempting to compile it again"); - } - - File destDir = targetDirectory; - if (destDir != null) { - int dotPos = className.lastIndexOf("."); - if (dotPos != -1) { - destDir = new File(destDir,className - .substring(0, dotPos) - .replace('.', File.separatorChar)); - } - if (!destDir.exists() && !destDir.mkdirs()) { - log.warn("couldn't create directory "+ destDir); - continue; - } - } else { - //destDir = file.getParentFile(); - } - GuixCompiler compiler = new GuixCompiler( - file.getParentFile(), file, className); - //addProfileTime(compiler, currentPass.name() + "_start"); - compilers.put(className, compiler); - compiler.compile(); - //addProfileTime(compiler, currentPass.name() + "_end"); - //assert !symbolTables.values().contains(compiler.getSymbolTable()) : "symbolTable is already registered"; - //symbolTables.put(file, compiler.getSymbolTable()); - if (compiler.isFailed()) { - success = false; - } - //} - } - - } while (compiled); - - /*// pass 2 - if (!nextStep(LifeCycle.compile_second_pass, success)) { - return false; - } - - assert jaxxFiles.size() == jaxxFileClassNames.size(); - List<File> jaxxFilesClone = new ArrayList<File>(jaxxFiles); - for (String className : jaxxFileClassNames) { - JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during second pass"); - addProfileTime(compiler, currentPass.name() + "_start"); - if (log.isDebugEnabled()) { - log.debug("runInitializers for " + className); - } - if (!compiler.isFailed()) { - compiler.runInitializers(); - } - if (log.isDebugEnabled()) { - log.debug("compile second pass for " + className); - } - compiler.compileSecondPass(); - addProfileTime(compiler, currentPass.name() + "_end"); - if (log.isDebugEnabled()) { - log.debug("done with result [" + !compiler.isFailed() + "] for " + className); - } - if (compiler.isFailed()) { - success = false; - } - } - if (!jaxxFilesClone.equals(jaxxFiles)) { - throw new AssertionError("Internal error: compilation set altered during pass 2 (was " + jaxxFilesClone + ", modified to " + jaxxFiles + ")"); - } - - // stylesheet application - if (!nextStep(LifeCycle.stylesheet_pass, success)) { - return false; - } - assert jaxxFiles.size() == jaxxFileClassNames.size(); - for (String className : jaxxFileClassNames) { - JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during stylesheet application"); - addProfileTime(compiler, currentPass.name() + "_start"); - compiler.applyStylesheets(); - addProfileTime(compiler, currentPass.name() + "_end"); - if (compiler.isFailed()) { - success = false; - } - } - - // code generation - if (!nextStep(LifeCycle.generate_pass, success)) { - return false; - } - assert jaxxFiles.size() == jaxxFileClassNames.size(); - List<Generator> generators = new ArrayList<Generator>(); - for (Generator generator : ServiceLoader.load(Generator.class)) { - generators.add(generator); - } - for (String className : jaxxFileClassNames) { - JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation"); - addProfileTime(compiler, currentPass.name() + "_start"); - compiler.generateCode(generators); - addProfileTime(compiler, currentPass.name() + "_end"); - //compiler.generateCode(); - if (compiler.isFailed()) { - success = false; - } - } - - if (options.isProfile()) { - // profile pass (only if succes compile) - if (!nextStep(LifeCycle.profile_pass, success)) { - return false; - } - StringBuilder buffer = profiler.computeProfileReport(); - log.info(buffer.toString()); - } - - return report(success); - - //FIXME : deal better the exception treatment... - } catch (CompilerException e) { - System.err.println(e.getMessage()); - e.printStackTrace(); - return false;*/ - - } catch (Throwable e) { - e.printStackTrace(); - return false; - } finally { - compilerCount = compilers.size(); - //TC - 20081018 only reset when no error was detected - //if (options.isResetAfterCompile() && errorCount == 0) { - // reset(); - //} - return false; - } - } -} Modified: guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/model/AttributeDescriptor.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/model/AttributeDescriptor.java 2009-04-15 15:52:09 UTC (rev 1315) +++ guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/model/AttributeDescriptor.java 2009-04-17 08:19:00 UTC (rev 1316) @@ -13,6 +13,11 @@ private String name; private String value; + public AttributeDescriptor(String name, String value) { + this.name = name; + this.value = value; + } + public String getName() { return name; } Deleted: guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/model/ModelObject.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/model/ModelObject.java 2009-04-15 15:52:09 UTC (rev 1315) +++ guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/model/ModelObject.java 2009-04-17 08:19:00 UTC (rev 1316) @@ -1,66 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package org.codelutin.guix.model; - -import java.util.List; - -/** - * - * @author morin - */ -public class ModelObject { - - private String id; - private ModelObject parent; - private List<ModelObject> children; - private ClassDescriptor classDescriptor; - private List<AttributeDescriptor> attributeDescriptors; - - public ModelObject(String id) { - this.id = id; - } - - public List<AttributeDescriptor> getAttributeDescriptors() { - return attributeDescriptors; - } - - public void setAttributeDescriptors( - List<AttributeDescriptor> attributeDescriptors) { - this.attributeDescriptors = attributeDescriptors; - } - - public ClassDescriptor getClassDescriptor() { - return classDescriptor; - } - - public void setClassDescriptor(ClassDescriptor classDescriptor) { - this.classDescriptor = classDescriptor; - } - - public List<ModelObject> getChildren() { - return children; - } - - public void setChildren(List<ModelObject> children) { - this.children = children; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public ModelObject getParent() { - return parent; - } - - public void setParent(ModelObject parent) { - this.parent = parent; - } -} Modified: guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/tags/TagManager.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/tags/TagManager.java 2009-04-15 15:52:09 UTC (rev 1315) +++ guix/trunk/guix-compiler/src/main/java/org/codelutin/guix/tags/TagManager.java 2009-04-17 08:19:00 UTC (rev 1316) @@ -30,7 +30,7 @@ private static Map<String, String> defaultNamespaces = new HashMap<String, String>(); /** Maps qualified tag names to the TagHandlers responsible for processing them. */ - private static Map<QName, TagHandler> registeredTags = new HashMap<QName, TagHandler>(); + //private static Map<QName, TagHandler> registeredTags = new HashMap<QName, TagHandler>(); /** Keeps track of whether or not named classes exist. */ private static Map<String, Boolean> classExistenceCache = new HashMap<String, Boolean>(); @@ -40,7 +40,7 @@ * TagHandler instances, because subclasses of the bean class should be handled by the same TagHandler * (assuming no more specific mappings exist), which requires creating a new instance of the TagHandler. */ - private static ClassMap<Class<? extends TagHandler>> registeredBeans = new ClassMap<Class<? extends TagHandler>>(); + //private static ClassMap<Class<? extends TagHandler>> registeredBeans = new ClassMap<Class<? extends TagHandler>>(); // still targeting 1.4, so I can't use javax.xml.namespace.QName private static class QName { @@ -82,13 +82,13 @@ private TagManager() { /* not instantiable */ } - public static void reset(boolean verbose) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { + /*public static void reset(boolean verbose) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { registeredBeans.clear(); registeredTags.clear(); defaultNamespaces.clear(); CompiledObjectDecorator.reset(); JAXXCompilerLaunchor.loadLibraries(verbose); - } + }*/ /** @@ -100,7 +100,7 @@ * @param handler the <code>TagHandler</code> class, which must descend from <code>DefaultObjectHandler</code> * @throws IllegalArgumentException if the handler class does not descend from <code>DefaultObjectHandler</code> */ - public static <T extends TagHandler> void registerBean(ClassDescriptor beanClass, Class<T> handler) { + /*public static <T extends TagHandler> void registerBean(ClassDescriptor beanClass, Class<T> handler) { if (!DefaultObjectHandler.class.isAssignableFrom(handler)) { throw new IllegalArgumentException("handler class must be a subclass of DefaultObjectHandler"); } @@ -113,7 +113,7 @@ String namespace = name.substring(0, dotPos + 1) + "*"; name = name.substring(dotPos + 1); registerDefaultNamespace(name, namespace); - } + }*/ /** @@ -153,7 +153,7 @@ * @param tag the simple name of the tag * @param handler the <code>TagHandler</code> which should process the tag */ - public static <T extends TagHandler> void registerTag(String namespace, String tag, T handler) { + /*public static <T extends TagHandler> void registerTag(String namespace, String tag, T handler) { if (namespace == null) { namespace = "*"; } @@ -163,7 +163,7 @@ } registeredTags.put(new QName(namespace, tag), handler); registerDefaultNamespace(tag, namespace); - } + }*/ /** @@ -177,26 +177,26 @@ * @return the <code>TagHandler</code> for the tag * @throws jaxx.CompilerException ? */ - public static TagHandler getTagHandler(String namespace, String tag, JAXXCompiler compiler) throws CompilerException { + /*public static TagHandler getTagHandler(String namespace, String tag, JAXXCompiler compiler) throws CompilerException { return getTagHandler(namespace, tag, false, compiler); - } + }*/ - private static String getNamespace(ClassDescriptor beanClass) { + /*private static String getNamespace(ClassDescriptor beanClass) { String packageName = beanClass.getPackageName(); return packageName != null ? packageName + ".*" : "*"; - } + }*/ - private static String getSimpleName(ClassDescriptor beanClass) { + /*private static String getSimpleName(ClassDescriptor beanClass) { String packageName = beanClass.getPackageName(); if (packageName != null) { assert beanClass.getName().startsWith(packageName); return beanClass.getName().substring(packageName.length() + 1); } return beanClass.getName(); - } + }*/ /** @@ -206,7 +206,7 @@ * are considered. * @throws jaxx.CompilerException ? */ - public static DefaultObjectHandler getTagHandler(ClassDescriptor beanClass) throws CompilerException { + /*public static DefaultObjectHandler getTagHandler(ClassDescriptor beanClass) throws CompilerException { try { if (beanClass == null) { throw new NullPointerException(); @@ -237,7 +237,7 @@ catch (InvocationTargetException e) { throw new RuntimeException(e); } - } + }*/ private static boolean classExists(String className) { @@ -263,7 +263,7 @@ } - private static String determinePackage(String simpleClassName, String defaultPackage) { + /*private static String determinePackage(String simpleClassName, String defaultPackage) { String namespace = null; Set<String> classes = compiler.getImportedClasses(); for (String className : classes) { // search class imports (e.g. import java.util.Date;) @@ -294,7 +294,7 @@ } return namespace; - } + }*/ /** * Resolves a simple class name (like <code>Object</code> or <code>String</code>) to its fully-qualified name. Inner @@ -332,7 +332,7 @@ result = defaultNamespace.substring(0, defaultNamespace.length() - 1) + name; } - if (result == null) { + /*if (result == null) { // Inner class names (like JPopupMenu.Separator) present a special challenge. The name before the dot might be // a package name, or it might be a class name. If it's a class name, it might be fully qualified, or it might // not. And it's also not actually the correct name of the class, as far as the JVM is concerned -- the correct @@ -379,7 +379,7 @@ break; dotPos = originalName.lastIndexOf('.', dotPos - 1); } - } + }*/ if (result != null && !result.equals(originalName)) result = resolveClassName(result); // check for aliases against the new name as well @@ -388,7 +388,7 @@ } - public static ClassDescriptor resolveClass(String className, JAXXCompiler compiler) { + /*public static ClassDescriptor resolveClass(String className, JAXXCompiler compiler) { try { className = resolveClassName(className, compiler); if (className == null) @@ -398,5 +398,5 @@ catch (ClassNotFoundException e) { return null; } - } + }*/ } \ No newline at end of file
participants (1)
-
kmorin@users.labs.libre-entreprise.org