r1591 - in branches/jaxx-2.X: . jaxx-runtime/src/main/java/jaxx/runtime maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin maven-jaxx-plugin/src/main/resources maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin
Author: tchemit Date: 2009-10-24 13:34:52 +0200 (Sat, 24 Oct 2009) New Revision: 1591 Modified: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java branches/jaxx-2.X/maven-jaxx-plugin/src/main/resources/log4j.properties branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java branches/jaxx-2.X/pom.xml Log: - Evolution #100: am?\195?\169lioration du design du compilateur - Evolution #99: Am?\195?\169liorer le code g?\195?\169n?\195?\169r?\195?\169 - Evolution #98: les objets JAXX sont serializable Modified: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java =================================================================== --- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java 2009-10-24 11:32:31 UTC (rev 1590) +++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java 2009-10-24 11:34:52 UTC (rev 1591) @@ -4,13 +4,14 @@ */ package jaxx.runtime; +import java.io.Serializable; import java.util.Map; /** * The <code>JAXXObject</code> interface is implemented by all classes * produced by the JAXX compiler. */ -public interface JAXXObject extends JAXXContext { +public interface JAXXObject extends JAXXContext, Serializable { /** * Retrieves an object defined in an XML tag by its ID. Modified: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java =================================================================== --- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2009-10-24 11:32:31 UTC (rev 1590) +++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2009-10-24 11:34:52 UTC (rev 1591) @@ -30,7 +30,9 @@ public static final String DEFAULT_ICON_PATH = "/icons/"; public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path"; - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * Logger + */ static private final Log log = LogFactory.getLog(Util.class); // Maps root objects to lists of event listeners private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>(); Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java =================================================================== --- branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-10-24 11:32:31 UTC (rev 1590) +++ branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-10-24 11:34:52 UTC (rev 1591) @@ -20,7 +20,7 @@ import jaxx.compiler.CompilerConfiguration; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import jaxx.compiler.beans.BeanInfoUtil; import jaxx.compiler.decorators.CompiledObjectDecorator; import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; @@ -297,6 +297,10 @@ * */ protected ClassLoader cl; + /** + * JAXX engine + */ + private JAXXEngine engine; @SuppressWarnings("unchecked") @Override @@ -393,10 +397,11 @@ // force compiler init from here, not in a static block TagManager.reset(verbose); - JAXXCompilerLaunchor launchor; - launchor = JAXXCompilerLaunchor.newLaunchor(src, files, this); - boolean success = launchor.compile(); - getLog().info("Generated " + launchor.getCompilerCount() + " file(s). "); + engine = JAXXEngine.newLaunchor(src, files, this); +// JAXXEngine engine; +// engine = JAXXEngine.newLaunchor(src, files, this); + boolean success = engine.compile(); + getLog().info("Generated " + engine.getCompilerCount() + " file(s). "); if (!success) { throw new MojoExecutionException("Aborting due to errors reported by jaxxc"); @@ -512,6 +517,10 @@ return validatorClass; } + public JAXXEngine getEngine() { + return engine; + } + @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/main/resources/log4j.properties =================================================================== --- branches/jaxx-2.X/maven-jaxx-plugin/src/main/resources/log4j.properties 2009-10-24 11:32:31 UTC (rev 1590) +++ branches/jaxx-2.X/maven-jaxx-plugin/src/main/resources/log4j.properties 2009-10-24 11:34:52 UTC (rev 1591) @@ -6,4 +6,4 @@ log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n log4j.logger.org.nuiton.i18n=ERROR -#log4j.logger.jaxx=DEBUG +log4j.logger.jaxx=INFO Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java =================================================================== --- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2009-10-24 11:32:31 UTC (rev 1590) +++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2009-10-24 11:34:52 UTC (rev 1591) @@ -2,7 +2,6 @@ import jaxx.runtime.Base64Coder; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; import jaxx.runtime.JAXXObjectDescriptor; import jaxx.runtime.Util; @@ -17,7 +16,7 @@ getMojo().execute(); assertNumberJaxxFiles(1); - JAXXCompiler compiler = JAXXCompilerLaunchor.get().getJAXXCompiler("org.nuiton.jaxx.plugin.Bug1750Test.ComboBox"); + JAXXCompiler compiler = getMojo().getEngine().getJAXXCompiler("org.nuiton.jaxx.plugin.Bug1750Test.ComboBox"); assertNotNull(compiler); JAXXObjectDescriptor descriptor = compiler.getJAXXObjectDescriptor(); Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java =================================================================== --- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-10-24 11:32:31 UTC (rev 1590) +++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-10-24 11:34:52 UTC (rev 1591) @@ -1,7 +1,7 @@ package org.nuiton.jaxx.plugin; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import jaxx.runtime.context.DefaultJAXXContext; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.SystemStreamLog; @@ -123,8 +123,8 @@ //do nothing } }); - Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers"); - Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount"); + Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); + Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount"); fieldCompilers.setAccessible(true); fieldErrorCount.setAccessible(true); @@ -141,11 +141,9 @@ // ok jaxx compiler failed assertTrue(true); - JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get(); + JAXXEngine launchor = mojo.getEngine(); Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor); assertEquals(1, compilers.size()); - //JAXXCompiler compiler; - //compiler = compilers.values().iterator().next(); Integer nberrors = (Integer) fieldErrorCount.get(launchor); assertTrue(nberrors != null && nberrors > 0); } Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java =================================================================== --- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java 2009-10-24 11:32:31 UTC (rev 1590) +++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java 2009-10-24 11:34:52 UTC (rev 1591) @@ -1,6 +1,6 @@ package org.nuiton.jaxx.plugin; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.SystemStreamLog; @@ -49,8 +49,8 @@ //do nothing } }); - Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers"); - Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount"); + Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); + Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount"); fieldCompilers.setAccessible(true); fieldErrorCount.setAccessible(true); @@ -66,10 +66,9 @@ } catch (MojoExecutionException e) { // ok jaxx compiler failed assertTrue(true); - JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get(); + JAXXEngine launchor = mojo.getEngine(); Map<String, Compiler> compilers = (Map<String, Compiler>) fieldCompilers.get(launchor); assertEquals(1, compilers.size()); - //Compiler compiler = compilers.values().iterator().next(); Integer nberrors = (Integer) fieldErrorCount.get(launchor); assertEquals(1, nberrors.intValue()); } Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java =================================================================== --- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java 2009-10-24 11:32:31 UTC (rev 1590) +++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java 2009-10-24 11:34:52 UTC (rev 1591) @@ -1,7 +1,7 @@ package org.nuiton.jaxx.plugin; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import org.apache.maven.plugin.MojoExecutionException; import java.lang.reflect.Field; @@ -66,8 +66,8 @@ //do nothing } }); - Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers"); - Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount"); + Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); + Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount"); fieldCompilers.setAccessible(true); fieldErrorCount.setAccessible(true); @@ -85,11 +85,9 @@ // ok jaxx compiler failed assertTrue(true); - JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get(); + JAXXEngine launchor = mojo.getEngine(); Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor); assertEquals(1, compilers.size()); - //JAXXCompiler compiler; - //compiler = compilers.values().iterator().next(); Integer nberrors = (Integer) fieldErrorCount.get(launchor); assertTrue(nberrors != null && nberrors > 0); } Modified: branches/jaxx-2.X/pom.xml =================================================================== --- branches/jaxx-2.X/pom.xml 2009-10-24 11:32:31 UTC (rev 1590) +++ branches/jaxx-2.X/pom.xml 2009-10-24 11:34:52 UTC (rev 1591) @@ -342,7 +342,7 @@ <name>JAXX Project</name> <description>JAXX Project</description> <inceptionYear>2008</inceptionYear> - <url>http://maven-site.nuiton.org/jaxx</url> + <url>http://maven-site.nuiton.org/jaxx-2.0</url> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** -->
participants (1)
-
tchemit@users.nuiton.org