This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 9747dbc86ffa84cb7177af414923bba6e40157c2 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 8 16:48:27 2009 +0000 evolution #78 : rendre le système d'aide multi-langue + JAXXContext is returned to jaxx.runtime package --- .../java/jaxx/compiler/CompilerConfiguration.java | 32 +- .../compiler/DefaultCompilerConfiguration.java | 71 +- .../HelpRootCompiledObjectDecorator.java | 4 +- .../src/main/java/jaxx/runtime/JAXXContext.java | 4 + .../jaxx/runtime/context/DefaultJAXXContext.java | 20 +- .../JAXXHelpBroker.java} | 76 +- .../{JaxxHelpUI.java => help/JAXXHelpUI.java} | 8 +- .../jaxx/runtime/swing/help/JAXXHelpUIHandler.java | 12 + .../org/nuiton/jaxx/plugin/AbstractJaxxMojo.java | 81 +-- .../org/nuiton/jaxx/plugin/GenerateHelpMojo.java | 520 ++++++++++++++ .../{JaxxGeneratorMojo.java => GenerateMojo.java} | 63 +- .../nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java | 780 --------------------- .../java/org/nuiton/jaxx/plugin/XmlHelper.java | 187 +++++ .../src/main/resources/defaultContent.html.vm | 4 +- .../src/main/resources/defaultHelpSet.hs.vm | 10 +- .../java/org/nuiton/jaxx/plugin/Bug1751Test.java | 2 +- .../java/org/nuiton/jaxx/plugin/CompilerTest.java | 14 +- .../nuiton/jaxx/plugin/CompilerValidatorTest.java | 2 +- .../java/org/nuiton/jaxx/plugin/DecoratorTest.java | 2 +- .../org/nuiton/jaxx/plugin/Evolution74Test.java | 4 +- .../test/java/org/nuiton/jaxx/plugin/I18nTest.java | 6 +- .../java/org/nuiton/jaxx/plugin/JaxxBaseTest.java | 8 +- 22 files changed, 861 insertions(+), 1049 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java index 7349bb8..eee1681 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java @@ -14,7 +14,7 @@ public interface CompilerConfiguration { /** * - * @return the class loader to use by compilers + * @return the class loader used by compilers */ ClassLoader getClassLoader(); @@ -51,36 +51,6 @@ public interface CompilerConfiguration { /** * - * @return the name of the help set to generate - */ - String getHelpSetName(); - - /** - * - * @return the prefix of i18n keys to use in help system - */ - String getHelpsetI18nPrefix(); - - /** - * - * @return the suffix of i18n keys to use in index of help system - */ - String getHelpsetIndexI18nSuffix(); - - /** - * - * @return the suffix of i18n keys to use in title of the help system - */ - String getHelpsetTitleI18nSuffix(); - - /** - * - * @return the suffix of i18n keys to use in toc of the help system - */ - String getHelpsetTocI18nSuffix(); - - /** - * * @return the type of context to use in each generated jaxx object */ Class<? extends JAXXContext> getJaxxContextClass(); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java index 00e61d2..eb06347 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java @@ -13,24 +13,20 @@ import jaxx.runtime.JAXXContext; */ public class DefaultCompilerConfiguration implements CompilerConfiguration { -// private File javacTargetDirectory; -// private String classPath; -// private String javacOpts; -// private boolean keepJavaFiles; /** - * + * where to generate */ private File targetDirectory; /** - * + * flag to optimize generated code */ private boolean optimize; /** - * + * verbose flag */ private boolean verbose; /** - * + * to do a profile pass after generation */ private boolean profile; /** @@ -59,11 +55,11 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration { */ private Class<?> defaultErrorUI; /** - * + * class loader to use in compiler */ private ClassLoader classLoader; /** - * + * the compiler class to use */ private Class<? extends JAXXCompiler> compilerClass; /** @@ -90,36 +86,6 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration { * since this class should be in sources (so not yet compiled) */ private String helpBrokerFQN; - /** - * The prefix to add to i18n key for any help i18n key. - * - * @since 1.3 - */ - protected String helpsetI18nPrefix; - /** - * The suffix to add to i18n key for an help Id. - * - * @since 1.3 - */ - protected String helpsetTitleI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @since 1.3 - */ - protected String helpsetTocI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @since 1.3 - */ - protected String helpsetIndexI18nSuffix; - /** - * The helpset name - * - * @since 1.3 - */ - protected String helpSetName; @Override public File getTargetDirectory() { @@ -211,31 +177,6 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration { } @Override - public String getHelpsetIndexI18nSuffix() { - return helpsetIndexI18nSuffix; - } - - @Override - public String getHelpsetTitleI18nSuffix() { - return helpsetTitleI18nSuffix; - } - - @Override - public String getHelpsetTocI18nSuffix() { - return helpsetTocI18nSuffix; - } - - @Override - public String getHelpSetName() { - return helpSetName; - } - - @Override - public String getHelpsetI18nPrefix() { - return helpsetI18nPrefix; - } - - @Override public Class<?> getValidatorClass() { return validatorClass; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java index 3ea6337..44d7c99 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java @@ -44,8 +44,8 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora if (options.isGenerateHelp()) { - // add JaxxHelpUI interface - Class<?> validatorInterface = jaxx.runtime.swing.JaxxHelpUI.class; + // add JAXXHelpUI interface + Class<?> validatorInterface = jaxx.runtime.swing.help.JAXXHelpUI.class; String helpBrokerFQN = getBrokerFQN(compiler); javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface) + "<" + helpBrokerFQN + ">"); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java index 5fa6725..6609d60 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java @@ -91,7 +91,9 @@ public interface JAXXContext { * @param <O> type of container to obtain from context * @param clazz clazz desired * @return parent's container + * @deprecated since 2.0.0 : breaks neutral since Swing */ + @Deprecated public <O extends Container> O getParentContainer(Class<O> clazz); /** @@ -101,6 +103,8 @@ public interface JAXXContext { * @param top the top container * @param clazz desired * @return parent's container + * @deprecated since 2.0.0 : breaks neutral since Swing */ + @Deprecated public <O extends Container> O getParentContainer(Object top, Class<O> clazz); } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java index 9bde7b2..fc08f0f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java @@ -1,6 +1,5 @@ package jaxx.runtime.context; -import jaxx.runtime.JAXXContext; import jaxx.runtime.*; import static jaxx.runtime.context.JAXXContextEntryDef.newDef; import org.apache.commons.logging.Log; @@ -25,14 +24,25 @@ import java.util.Map.Entry; */ public class DefaultJAXXContext implements JAXXContext { + /** + * entry of the parent context + */ protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = newDef(JAXXContext.class); - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * Logger + */ static private final Log log = LogFactory.getLog(DefaultJAXXContext.class); - /** l'ui auquel est rattache le context */ + /** + * l'ui auquel est rattache le context + */ protected JAXXObject ui; - /** le context parent */ + /** + * le context parent + */ protected JAXXContext parentContext; - /** les données contenues dans le context */ + /** + * les données contenues dans le context + */ protected final Map<JAXXContextEntryDef<?>, Object> data; public DefaultJAXXContext() { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java similarity index 92% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java index 781f848..b964937 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing; +package jaxx.runtime.swing.help; import java.applet.Applet; import java.awt.*; @@ -29,17 +29,16 @@ import org.apache.commons.logging.LogFactory; /** * La classe pour encapsuler l'aide de l'application. * - * @param <B> le type de broker * @author tony * @since 1.4 */ -public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { +public class JAXXHelpBroker { public static final String JAXX_CONTEXT_ENTRY = "jaxxcontext"; /** * Logger */ - static private Log log = LogFactory.getLog(JaxxHelpBroker.class); + static private Log log = LogFactory.getLog(JAXXHelpBroker.class); /** * name of helpset */ @@ -76,28 +75,28 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { * cache of component which cursor have been modified */ protected final Map<Component, String> cache; + /** + * help ui handler + */ + protected JAXXHelpUIHandler handler; - protected JaxxHelpBroker(String helpsetName, String helpKey, String defaultID) { - this(null, helpsetName, helpKey, defaultID); + public JAXXHelpBroker(String helpsetName, String helpKey, String defaultID, JAXXHelpUIHandler handler) { + this(null, helpsetName, helpKey, defaultID, handler); } - protected JaxxHelpBroker(Locale locale, String helpsetName, String helpKey, String defaultID) { + public JAXXHelpBroker(Locale locale, String helpsetName, String helpKey, String defaultID, JAXXHelpUIHandler handler) { if (helpsetName == null) { throw new NullPointerException("parameter helpsetName can not be null!"); } + if (handler == null) { + throw new NullPointerException("handler can not be null"); + } this.locale = locale; this.helpsetName = helpsetName; this.helpKey = helpKey; this.defaultID = defaultID; - cache = new HashMap<Component, String>(); -// try { -// ClassLoader cl = getClass().getClassLoader(); -// URL url = HelpSet.findHelpSet(cl, helpsetName, this.locale); -// helpset = new HelpSet(cl, url); -// helpBroker = helpset.createHelpBroker(); -// } catch (Exception ee) { -// throw new IllegalStateException("could not find help set " + helpsetName + " for reason " + ee.getMessage(), ee); -// } + this.handler = handler; + this.cache = new HashMap<Component, String>(); } public void prepareUI(JAXXObject c) { @@ -109,25 +108,37 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { AbstractButton help = getShowHelpButton(c); if (help == null) { - if (log.isDebugEnabled()) { - log.debug("no showButton detected for " + c.getClass()); - } - } else { - - // attach context to button - help.putClientProperty(JAXX_CONTEXT_ENTRY, c.getDelegateContext()); + // no showHelp button + return; + } - // add tracking action - ActionListener listener = getShowHelpAction(); - if (log.isDebugEnabled()) { - log.debug("adding tracking action " + listener); - } - help.addActionListener(listener); + // attach context to button + if (log.isDebugEnabled()) { + log.debug("attach context to showhelp button " + c); + } + help.putClientProperty(JAXX_CONTEXT_ENTRY, c); + // add tracking action + ActionListener listener = getShowHelpAction(); + if (log.isDebugEnabled()) { + log.debug("adding tracking action " + listener); } + help.addActionListener(listener); + if (log.isDebugEnabled()) { log.debug("done for " + c); } + + + getHelpBroker().enableHelpKey(((Component) c), getDefaultID(), getHelpset()); + } + + public void showHelp(JAXXContext context, String helpId) { + getHandler().showHelp(context, this, helpId); + } + + public JAXXHelpUIHandler getHandler() { + return handler; } public HelpBroker getHelpBroker() { @@ -145,7 +156,7 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { if (helpset == null) { try { ClassLoader cl = getClass().getClassLoader(); - URL url = HelpSet.findHelpSet(cl, helpsetName, this.locale); + URL url = HelpSet.findHelpSet(cl, helpsetName, locale); helpset = new HelpSet(cl, url); } catch (Exception ee) { throw new IllegalStateException("could not find help set " + helpsetName + " for reason " + ee.getMessage(), ee); @@ -175,10 +186,7 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { if (log.isDebugEnabled()) { log.debug(this); } - new CSH.DisplayHelpFromSource(helpBroker); - } - - public void showHelp(JAXXContext context, String helpId) { + new CSH.DisplayHelpFromSource(getHelpBroker()); } public void installUI(Component comp, String helpId) { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java similarity index 57% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java index fde1208..9af8afa 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java @@ -1,18 +1,18 @@ -package jaxx.runtime.swing; +package jaxx.runtime.swing.help; import java.awt.Component; /** * - * Contract to be added on JAXXObject wihch wants to use javax help. + * Contract to be added on JAXXObject which wants to use javax help. * * @param <B> type of broker. * * @author tony * @since 1.3 - * @see JaxxHelpBroker + * @see JAXXHelpBroker */ -public interface JaxxHelpUI<B extends JaxxHelpBroker<?>> { +public interface JAXXHelpUI<B extends JAXXHelpBroker> { B getBroker(); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java new file mode 100644 index 0000000..d8077c7 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java @@ -0,0 +1,12 @@ +package jaxx.runtime.swing.help; + +import jaxx.runtime.JAXXContext; + +/** + * + * @author chemit + */ +public interface JAXXHelpUIHandler { + + void showHelp(JAXXContext context, JAXXHelpBroker broker, String helpID); +} diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java index a53fed0..c55360f 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java @@ -41,12 +41,6 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { */ protected MavenProject project; /** - * Repertoire de destination des fichiers java a generer. - * - * @parameter expression="${jaxx.outJava}" default-value="${basedir}/target/generated-sources/java" - */ - protected File outJava; - /** * verbose flag * * @parameter expression="${jaxx.verbose}" default-value="false" @@ -55,72 +49,15 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { */ protected boolean verbose; /** - * to make compiler i18nable, says add the {@link org.nuiton.i18n.I18n#_(String, Object[])} method - * invocation on {@link jaxx.compiler.I18nHelper#I18N_ATTRIBUTES} attributes. - * - * @parameter expression="${jaxx.i18nable}" default-value="true" - * @see jaxx.compiler.I18nHelper - */ - protected boolean i18nable; - /** - * The store of helpIds generated by {@link JaxxGeneratorMojo}. - * <p/> - * - * @parameter expression="${jaxx.helpIdStore}" default-value="target/helpIds.properties" - * @required - * - * @since 1.3 - */ - protected File helpIdStore; - /** - * The name of the helpset to generate. - * - * @parameter expression="${jaxx.helpSetName}" default-value="${project.artifactId}" - * @required - * - * @since 1.3 - */ - protected String helpSetName; - /** - * The prefix to add to i18n key for any help i18n key. - * - * @parameter expression="${jaxx.helpsetI18nPrefix}" default-value="${jaxx.helpSetName}.help." - * @required - * - * @since 1.3 - */ - protected String helpsetI18nPrefix; - /** - * The suffix to add to i18n key for an help Id. - * - * @parameter expression="${jaxx.helpsetTitleI18nSuffix}" default-value=".title" - * @required - * - * @since 1.3 - */ - protected String helpsetTitleI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @parameter expression="${jaxx.helpsetTocI18nSuffix}" default-value=".toc" - * @required - * - * @since 1.3 - */ - protected String helpsetTocI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @parameter expression="${jaxx.helpsetIndexI18nSuffix}" default-value=".index" + * The store of helpIds generated by the goal {@link GenerateMojo} and then + * used by the goal {@link GenerateHelpMojo}. + * + * @parameter expression="${jaxx.helpIdsStore}" default-value="target/helpIds.properties" * @required * * @since 1.3 */ - protected String helpsetIndexI18nSuffix; - /** - * - */ - protected ClassLoader cl; + protected File helpIdsStore; @Override protected boolean checkPackaging() { @@ -146,4 +83,12 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { public void setVerbose(boolean verbose) { this.verbose = verbose; } + + public File getHelpIdsStore() { + return helpIdsStore; + } + + public void setHelpIdsStore(File helpIdsStore) { + this.helpIdsStore = helpIdsStore; + } } diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java new file mode 100644 index 0000000..559c565 --- /dev/null +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java @@ -0,0 +1,520 @@ +/* *##% + * Copyright (C) 2007 + * JaxxPlugin, Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ +package org.nuiton.jaxx.plugin; + +import org.apache.maven.plugin.MojoFailureException; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.Locale; +import java.util.Properties; +import org.nuiton.i18n.I18n; +import org.nuiton.util.FileUtil; +import org.nuiton.util.SortedProperties; + +/** + * Mojo to generate javax help stuff for your project. + * + * HelpIds should have been discovered by the JaxxMojo. + * + * @author chemit + * @goal generate-help + * @phase process-sources + * + * @requiresProject + * @requiresDependencyResolution compile + * @since 1.3 + */ +public class GenerateHelpMojo extends AbstractJaxxMojo { + + private static final String AUTOREMOVE_LINE = "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE"; + /** + * The directory where to generate help files. + * + * @parameter expression="${jaxx.outHelp}" default-value="${project.basedir}/src/main/help" + * @required + * + * @since 1.3 + */ + protected File outHelp; + /** + * The locales to generate for help, seprated by comma. + * + * The first locale given is the default locale. + * + * @parameter expression="${jaxx.locales}" + * @required + * + * @since 2.0.0 + */ + protected String locales; + /** + * The name of the helpset to generate. + * + * @parameter expression="${jaxx.helpsetName}" default-value="${project.artifactId}" + * @required + * + * @since 1.3 + */ + protected String helpsetName; + /** + * The template used to generate helpset file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.helpsetTemplate}" default-value="/defaultHelpSet.hs.vm" + * @required + * + * @since 1.3 + */ + protected File helpsetTemplate; + /** + * The template used to generate helpset map file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.mapTemplate}" default-value="/defaultMap.jhm.vm" + * @required + * + * @since 1.3 + */ + protected File mapTemplate; + /** + * The template used to generate helpset index file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.indexTemplate}" default-value="/defaultIndex.xml.vm" + * @required + * + * @since 1.3 + */ + protected File indexTemplate; + /** + * The template used to generate helpset toc file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.tocTemplate}" default-value="/defaultToc.xml.vm" + * @required + * + * @since 1.3 + */ + protected File tocTemplate; + /** + * The template used to generate helpset content file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.contentTemplate}" default-value="/defaultContent.html.vm" + * @required + * + * @since 1.3 + */ + protected File contentTemplate; + /** + * The help ids discovered in {@link #helpIdsStore} files. + */ + private Properties helpIds; + /** + * Default locale (the first locale in {@link #localesToTreate}. + */ + private Locale defaultLocale; + /** + * Locales to treate + */ + private Locale[] localesToTreate; + + @Override + public boolean init() throws Exception { + + File idsStore = getHelpIdsStore(); + + if (!idsStore.exists()) { + getLog().info("no helpIdStore to react at " + idsStore); + return false; + } + + if (locales == null || locales.trim().isEmpty()) { + throw new MojoFailureException("You must set the 'locales' property properly (was " + locales + ")."); + } + + // check there is a outHelp + if (outHelp == null) { + throw new MojoFailureException("You must set the 'target' property."); + } + + List<Locale> tmp = new ArrayList<Locale>(); + for (String loc : locales.split(",")) { + Locale l = I18n.newLocale(loc); + tmp.add(l); + } + + if (tmp.isEmpty()) { + throw new MojoFailureException("you must set the 'locales' property."); + } + + localesToTreate = tmp.toArray(new Locale[tmp.size()]); + defaultLocale = localesToTreate[0]; + + // check ressources + checkResource(helpsetTemplate); + checkResource(mapTemplate); + checkResource(indexTemplate); + checkResource(tocTemplate); + checkResource(contentTemplate); + + if (!outHelp.exists()) { + getLog().info("mkdir " + outHelp); + outHelp.mkdirs(); + } + + helpIds = new SortedProperties(); + + InputStream stream = new FileInputStream(idsStore); + + try { + helpIds.load(stream); + } finally { + if (stream != null) { + stream.close(); + } + } + + if (helpIds.isEmpty()) { + + // no ids detected + getLog().warn("No helpIds detected, will skip."); + return false; + } + + return true; + } + + @Override + public void doAction() throws Exception { + + int touchedFiles = 0; + + String mapFileName = helpsetName + "Map.jhm"; + String indexFileName = helpsetName + "Index.xml"; + String tocFileName = helpsetName + "TOC.xml"; + + for (Locale locale : localesToTreate) { + + boolean isDefaultLocale = locale == defaultLocale; + + String language = locale.getLanguage(); + + String localePath = (isDefaultLocale ? "default" : language); + + File localizedTarget = new File(outHelp, localePath); + + if (!localizedTarget.exists()) { + localizedTarget.mkdirs(); + } + getLog().info("Generate help for language " + language); + getLog().info(" Localized target : " + localizedTarget); + + Properties env = new Properties(); + + env.put("helpSetName", helpsetName); + env.put("locale", language); + env.put("localePath", localePath); + env.put("separator", " "); + env.put("autoremoveLine", AUTOREMOVE_LINE); + + String localeSuffix = isDefaultLocale ? "" : "_" + language; + String helpsetFileName = helpsetName + localeSuffix + ".hs"; + + env.put("helpSetFileName", helpsetFileName); + + env.put("mapFileName", mapFileName); + env.put("indexFileName", indexFileName); + env.put("tocFileName", tocFileName); +// env.put("searchData", localePath + "/index"); + + // --------------------------------------------------------------- + // --- main helpset file ----------------------------------------- + // --------------------------------------------------------------- + + File file = new File(outHelp, helpsetFileName); + + boolean doCreate = generateHelpsetFile(file, env); + + if (doCreate) { + touchedFiles++; + } + + // --------------------------------------------------------------- + // --- helpset map file ------------------------------------------ + // --------------------------------------------------------------- + + file = new File(localizedTarget, mapFileName); + + Properties mergedHelpIds = generateMapFile(file, env); + touchedFiles++; + + // --------------------------------------------------------------- + // --- helpset index file ---------------------------------------- + // --------------------------------------------------------------- + + file = new File(localizedTarget, indexFileName); + + NodeItem indexRootItem = generateIndexFile(file, env); + touchedFiles++; + + // --------------------------------------------------------------- + // --- helpset toc file ------------------------------------------ + // --------------------------------------------------------------- + + file = new File(localizedTarget, tocFileName); + + NodeItem tocRootItem = generateTocFile(file, env); + touchedFiles++; + + // --------------------------------------------------------------- + // --- helpset content files ------------------------------------- + // --------------------------------------------------------------- + + touchedFiles += generateContentFiles(localizedTarget, env, localePath); + + } + + getLog().info(touchedFiles + " file(s) treated."); + } + + protected int generateContentFiles(File localizedTarget, Properties env, String localePath) throws Exception { + + int touchedFiles = 0; + TemplateGenerator gen = prepareGenerator(contentTemplate); + Enumeration<?> keys = helpIds.keys(); + while (keys.hasMoreElements()) { + String key = (String) keys.nextElement(); + String url = (String) helpIds.get(key); + url = helpsetName + File.separator + url; + File f = new File(localizedTarget, url); + boolean exist = f.exists(); + if (exist) { + // check if there is a autoremoveLine in content + String content = FileUtil.readAsString(f); + if (!content.contains(AUTOREMOVE_LINE)) { + // no regenerate marker detected, so skip this file + if (verbose) { + getLog().debug("skip existing file " + f); + } + continue; + } + } + f.getParentFile().mkdirs(); + if (verbose) { + if (exist) { + getLog().info("regenerate content file " + f); + } else { + getLog().info("generate content file " + f); + } + } + env.put("helpId", key); + env.put("helpIdUrl", localePath + "/" + url); + gen.generate(env, f); + touchedFiles++; + } + return touchedFiles; + } + + protected boolean generateHelpsetFile(File file, Properties env) throws Exception { + + if (file.exists()) { + // check the autoremove line presence + String content = FileUtil.readAsString(file); + if (!content.contains(AUTOREMOVE_LINE)) { + // no regenerate marker detected, so skip this file + if (verbose) { + getLog().info("skip existing helpset main file " + file); + } + return false; + } + } + + if (verbose) { + if (file.exists()) { + getLog().info("regenerate helpset main file " + file); + } else { + getLog().info("generate helpset main file " + file); + } + } + doGen(helpsetTemplate, file, env); + return true; + } + + protected Properties generateMapFile(File file, Properties env) throws Exception { + + boolean create; + + Properties mergedHelpIds = null; + if (file.exists()) { + + // get back the exisiting data and merge it with incoming ones + + if (verbose) { + getLog().info("loading existing helpset map file " + file); + } + + mergedHelpIds = XmlHelper.getExistingHelpIds(file, verbose, getLog()); + create = false; + + } else { + + mergedHelpIds = new SortedProperties(); + create = true; + } + + // inject new helpIds + + for (Object k : helpIds.keySet()) { + mergedHelpIds.put(k, helpsetName + "/" + helpIds.get(k)); + } + + if (!mergedHelpIds.contains("top")) { + + // on ajoute une entree vers le root du helpset + + String topUrl = helpsetName + ".html"; + helpIds.put("top", topUrl); + mergedHelpIds.put("top", helpsetName + "/" + topUrl); + if (verbose) { + getLog().debug("add top entry with url " + topUrl); + } + } + + if (verbose) { + if (create) { + getLog().info("generate helpset map file " + file); + } else { + getLog().info("udpate helpset map file " + file); + } + } + + env.put("helpIds", mergedHelpIds); + doGen(mapTemplate, file, env); + env.remove("helpIds"); + return mergedHelpIds; + } + + protected NodeItem generateIndexFile(File file, Properties env) throws Exception { + NodeItem rootItem = null; + + boolean create; + + if (file.exists()) { + + create = false; + + rootItem = XmlHelper.getExistingItems("indexitem", file); + } else { + create = true; + } + + if (rootItem == null) { + rootItem = new NodeItem("top", helpsetName); + } + + // inject new index entries + + for (Object k : helpIds.keySet()) { + NodeItem toc = rootItem.findChild(k + ""); + if (verbose) { + getLog().debug("index " + k + " : " + toc); + } + } + + if (verbose) { + if (create) { + getLog().info("generate helpset index file " + file); + } else { + getLog().info("udpate helpset index file " + file); + } + } + + env.put("rootItem", rootItem); + doGen(indexTemplate, file, env); + env.remove("rootItem"); + return rootItem; + } + + protected NodeItem generateTocFile(File file, Properties env) throws Exception { + NodeItem rootItem = null; + + boolean create; + + if (file.exists()) { + + create = false; + + rootItem = XmlHelper.getExistingItems("tocitem", file); + } else { + create = true; + } + + if (rootItem == null) { + rootItem = new NodeItem("top", helpsetName); + } + // inject new toc entries + + for (Object k : helpIds.keySet()) { + NodeItem toc = rootItem.findChild(k + ""); + if (verbose) { + getLog().debug("toc " + k + " : " + toc); + } + } + + if (verbose) { + if (create) { + getLog().info("generate helpset toc file " + file); + } else { + getLog().info("udpate helpset toc file " + file); + } + } + + env.put("rootItem", rootItem); + doGen(tocTemplate, file, env); + env.remove("rootItem"); + return rootItem; + } + + protected void doGen(File template, File f, Properties env) throws Exception { + TemplateGenerator gen = prepareGenerator(template); + gen.generate(env, f); + } + + protected TemplateGenerator prepareGenerator(File template) throws Exception { + URL templateURL = getTemplate(template); + + if (verbose) { + getLog().info("using template " + templateURL); + } + TemplateGenerator gen = new TemplateGenerator(project, templateURL); + return gen; + } +} diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java similarity index 94% rename from maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java rename to maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index daac7f5..0fcb1e0 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -49,6 +49,7 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.Set; +import jaxx.runtime.swing.help.JAXXHelpBroker; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; @@ -61,7 +62,7 @@ import org.apache.commons.lang.builder.ToStringStyle; * @requiresDependencyResolution compile * @requiresProject */ -public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfiguration { +public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfiguration { /** * Default includes to use, if none provided @@ -74,6 +75,12 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi */ protected File src; /** + * Repertoire de destination des fichiers java a generer. + * + * @parameter expression="${jaxx.outJava}" default-value="${basedir}/target/generated-sources/java" + */ + protected File outJava; + /** * pour filter les fichiers a traiter * * @parameter expression="${jaxx.includes}" @@ -175,6 +182,14 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi */ protected boolean testPhase; /** + * to make compiler i18nable, says add the {@link org.nuiton.i18n.I18n#_(String, Object[])} method + * invocation on {@link jaxx.compiler.I18nHelper#I18N_ATTRIBUTES} attributes. + * + * @parameter expression="${jaxx.i18nable}" default-value="true" + * @see jaxx.compiler.I18nHelper + */ + protected boolean i18nable; + /** * pour optimizer le code compile ou genere ? * * @parameter expression="${jaxx.optimize}" default-value="false" @@ -242,9 +257,9 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi /** * the FQN of help broker * <p/> - * By default, none. + * By default, use the JAXX implementation {@link JAXXHelpBroker}. * - * @parameter expression="${jaxx.helpBrokerFQN}" + * @parameter expression="${jaxx.helpBrokerFQN}" default-value="jaxx.runtime.swing.help.JAXXHelpBroker" * * @since 1.3 */ @@ -287,6 +302,10 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi * */ private boolean nofiles; + /** + * + */ + protected ClassLoader cl; @SuppressWarnings("unchecked") @Override @@ -294,8 +313,8 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi if (generateHelp) { // check there is some bundle - if (helpIdStore == null) { - throw new MojoFailureException("you must set the helpIdStore property."); + if (getHelpIdsStore() == null) { + throw new MojoFailureException("you must set the 'helpIdStore' property."); } } @@ -498,31 +517,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi } @Override - public String getHelpsetIndexI18nSuffix() { - return helpsetIndexI18nSuffix; - } - - @Override - public String getHelpsetTitleI18nSuffix() { - return helpsetTitleI18nSuffix; - } - - @Override - public String getHelpsetTocI18nSuffix() { - return helpsetTocI18nSuffix; - } - - @Override - public String getHelpSetName() { - return helpSetName; - } - - @Override - public String getHelpsetI18nPrefix() { - return helpsetI18nPrefix; - } - - @Override public Class<?> getValidatorClass() { return validatorClass; } @@ -586,9 +580,10 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi } return; } + File idsStore = getHelpIdsStore(); - if (!helpIdStore.getParentFile().exists()) { - helpIdStore.getParentFile().mkdirs(); + if (!idsStore.getParentFile().exists()) { + idsStore.getParentFile().mkdirs(); } Properties p = new Properties(); @@ -599,7 +594,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi p.put(removeQuote(helpId), path); } - FileOutputStream w = new FileOutputStream(helpIdStore); + FileOutputStream w = new FileOutputStream(idsStore); try { p.store(w, null); @@ -607,7 +602,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi w.close(); } - getLog().info("helpIdStore generated in " + helpIdStore); + getLog().info("helpIdStore generated in " + idsStore); helpIds.clear(); } diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java deleted file mode 100644 index 1625471..0000000 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java +++ /dev/null @@ -1,780 +0,0 @@ -/* *##% - * Copyright (C) 2007 - * JaxxPlugin, Code Lutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *##%*/ -package org.nuiton.jaxx.plugin; - -import org.apache.maven.plugin.MojoFailureException; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; -import java.util.List; -import java.util.Properties; -import java.util.Set; -import java.util.Stack; -import org.apache.maven.model.Resource; -import org.nuiton.i18n.I18n; -import org.nuiton.util.FileUtil; -import org.nuiton.util.SortedProperties; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLReaderFactory; -import static org.nuiton.i18n.I18n._; - -/** - * Mojo to generate javax help stuff for your project. - * - * HelpIds should have been discovered by the JaxxMojo. - * - * @author chemit - * @goal generate-help - * @phase process-sources - * - * @requiresProject - * @requiresDependencyResolution compile - * @since 1.3 - */ -public class JaxxHelpGeneratorMojo extends AbstractJaxxMojo { - - /** - * The directory where to generate javaHelp skeleton files. - * <p/> - * Is required if generateHelp is on. - * - * @parameter expression="${jaxx.helpTarget}" alias="target" default-value="${maven.src.dir}/main/help" - * @required - * - * @since 1.3 - */ - protected File target; - /** - * The locale to generate for help. - * - * By default, stay in France. - * - * @parameter expression="${jaxx.locale}" default-value="fr" - * @required - * - * @since 1.3 - */ - protected String locale; - /** - * The package where to generate i18n java file. - * - * @parameter expression="${jaxx.packageName}" default-value="${project.groupId}" - * @required - * - * @since 1.3 - */ - protected String packageName; - /** - * The file name of the helpset to generate. - * - * @parameter expression="${jaxx.helpSetFileName}" default-value="${jaxx.helpSetName}.hs" - * @required - * - * @since 1.3 - */ - protected String helpsetFileName; - /** - * The file name of the helpset map to generate. - * - * @parameter expression="${jaxx.mapFileName}" default-value="${jaxx.helpSetName}Map.jhm" - * @required - * - * @since 1.3 - */ - protected String mapFileName; - /** - * The file name of the helpset index to generate. - * - * @parameter expression="${jaxx.indexFileName}" default-value="${jaxx.helpSetName}Index.xml" - * @required - * - * @since 1.3 - */ - protected String indexFileName; - /** - * The file name of the helpset toc to generate. - * - * @parameter expression="${jaxx.tocFileName}" default-value="${jaxx.helpSetName}TOC.xml" - * @required - * - * @since 1.3 - */ - protected String tocFileName; - /** - * The file name of the i18n java file to generate. - * - * @parameter expression="${jaxx.i8nFileName}" default-value="${jaxx.helpSetName}I18n.java" - * @required - * - * @since 1.3 - */ - protected String i8nFileName; - /** - * The template used to generate helpset file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.helpSetTemplate}" default-value="/defaultHelpSet.hs.vm" - * @required - * - * @since 1.3 - */ - protected File helpSetTemplate; - /** - * The template used to generate helpset map file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.mapTemplate}" default-value="/defaultMap.jhm.vm" - * @required - * - * @since 1.3 - */ - protected File mapTemplate; - /** - * The template used to generate helpset index file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.indexTemplate}" default-value="/defaultIndex.xml.vm" - * @required - * - * @since 1.3 - */ - protected File indexTemplate; - /** - * The template used to generate helpset toc file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.tocTemplate}" default-value="/defaultToc.xml.vm" - * @required - * - * @since 1.3 - */ - protected File tocTemplate; - /** - * The template used to generate helpset content file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.contentTemplate}" default-value="/defaultContent.html.vm" - * @required - * - * @since 1.3 - */ - protected File contentTemplate; - /** - * The template used to generate helpset content file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.i18nTemplate}" default-value="/defaultI18n.java.vm" - * @required - * - * @since 1.3 - */ - protected File i18nTemplate; - /** - * The help ids discovered by Jaxx compilation - */ - protected Properties helpIds; - private static final String AUTOREMOVE_LINE = "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE"; - - @Override - public boolean init() throws Exception { - - if (!helpIdStore.exists()) { - getLog().info("no helpIdStore to react at " + helpIdStore); - return false; - } - - // check there is some bundle - if (locale == null) { - throw new MojoFailureException("you must set the bundles property."); - } - // check there is some bundle - if (target == null) { - throw new MojoFailureException("you must set the target property."); - } - // check ressources - checkResource(helpSetTemplate); - checkResource(mapTemplate); - checkResource(indexTemplate); - checkResource(tocTemplate); - checkResource(contentTemplate); - - if (!target.exists()) { - getLog().info("mkdir " + target); - target.mkdirs(); - } - - helpIds = new SortedProperties(); - - InputStream stream = new FileInputStream(helpIdStore); - - helpIds.load(stream); - - stream.close(); - - if (helpIds.isEmpty()) { - - // no ids detected - getLog().warn("no helpIds detected, will skip."); - return false; - } - - return true; - } - - @Override - public void doAction() throws Exception { - - if (i18nable) { - - List<URL> lUrls = new java.util.ArrayList<URL>(); - List<?> resources = project.getResources(); - for (Object o : resources) { - Resource resource = (Resource) o; - lUrls.add(new File(resource.getDirectory()).toURI().toURL()); - } - I18n.setExtraURL(lUrls.toArray(new URL[lUrls.size()])); - I18n.init(locale, null); - } - - File file; - - Properties env = new Properties(); - - env.put("helpSetName", helpSetName); - env.put("helpSetFileName", helpsetFileName); - env.put("mapFileName", mapFileName); - env.put("indexFileName", indexFileName); - env.put("tocFileName", tocFileName); - env.put("separator", " "); - env.put("autoremoveLine", AUTOREMOVE_LINE); - - - int touchedFiles = 0; - - // --------------------------------------------------------------- - // --- main helpset file ----------------------------------------- - // --------------------------------------------------------------- - - - file = new File(target, helpsetFileName); - - boolean doCreate = generateHelSetFile(file, env); - - if (doCreate) { - touchedFiles++; - } - - // --------------------------------------------------------------- - // --- helpset map file ------------------------------------------ - // --------------------------------------------------------------- - - file = new File(target, mapFileName); - - Properties mergedHelpIds = generateMapFile(file, env); - touchedFiles++; - - // --------------------------------------------------------------- - // --- helpset index file ---------------------------------------- - // --------------------------------------------------------------- - - file = new File(target, indexFileName); - - NodeItem indexRootItem = generateIndexFile(file, env); - touchedFiles++; - - // --------------------------------------------------------------- - // --- helpset toc file ------------------------------------------ - // --------------------------------------------------------------- - - file = new File(target, tocFileName); - - NodeItem tocRootItem = generateTocFile(file, env); - touchedFiles++; - - // --------------------------------------------------------------- - // --- helpset content files ------------------------------------- - // --------------------------------------------------------------- - - TemplateGenerator gen = prepareGenerator(contentTemplate); - - Enumeration<?> keys = helpIds.keys(); - - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - String url = (String) helpIds.get(key); - url = helpSetName + File.separator + url; - - File f = new File(target, url); - - boolean exist = f.exists(); - - if (exist) { - // check if there is a autoremoveLine in content - String content = FileUtil.readAsString(f); - if (!content.contains(AUTOREMOVE_LINE)) { - // no regenerate marker detected, so skip this file - if (verbose) { - getLog().debug("skip existing file " + f); - } - continue; - } - } - - f.getParentFile().mkdirs(); - - if (verbose) { - if (exist) { - getLog().info("regenerate content file " + f); - } else { - getLog().info("generate content file " + f); - } - } - - env.put("helpId", key); - String i18n = helpsetI18nPrefix + key + helpsetTitleI18nSuffix; - env.put("helpIdTitle", _(i18n)); - env.put("helpIdUrl", url); - - gen.generate(env, f); - touchedFiles++; - } - - // --------------------------------------------------------------- - // --- i18n file ------------------------------------------------- - // --------------------------------------------------------------- - - String path = packageName.replaceAll("\\.", File.separator); - path += File.separator + i8nFileName; - file = new File(outJava, path); - generateI18nFile(file, env, mergedHelpIds, indexRootItem, tocRootItem); - touchedFiles++; - - getLog().info(touchedFiles + " file(s) treated."); - } - - protected void generateI18nFile(File file, Properties env, Properties mergedHelpIds, NodeItem indexRootItem, NodeItem tocRootItem) throws Exception { - - boolean create = !file.exists(); - - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - - Set<String> keys = new java.util.HashSet<String>(); - - for (Object k : mergedHelpIds.keySet()) { - String key = helpsetI18nPrefix + k + helpsetTitleI18nSuffix; - keys.add(key); - } - indexRootItem.extractI18n(keys, helpsetI18nPrefix, helpsetIndexI18nSuffix); - tocRootItem.extractI18n(keys, helpsetI18nPrefix, helpsetTocI18nSuffix); - - env.put("keys", keys); - env.put("packageName", packageName); - String className = file.getName(); - int index = className.lastIndexOf("."); - className = className.substring(0, index); - env.put("className", className); - - if (verbose) { - if (create) { - getLog().info("generate i18n java file " + file); - } else { - getLog().info("udpate i18n java file " + file); - } - } - - doGen(i18nTemplate, file, env); - - } - - protected boolean generateHelSetFile(File file, Properties env) throws Exception { - - if (file.exists()) { - // check the auto removeline presence - String content = FileUtil.readAsString(file); - if (!content.contains(AUTOREMOVE_LINE)) { - // no regenerate marker detected, so skip this file - if (verbose) { - getLog().info("skip existing helpset main file " + file); - } - return false; - } - } - - if (verbose) { - if (file.exists()) { - getLog().info("regenerate helpset main file " + file); - } else { - getLog().info("generate helpset main file " + file); - } - } - doGen(helpSetTemplate, file, env); - return true; - } - - protected Properties generateMapFile(File file, Properties env) throws Exception { - - boolean create; - - Properties mergedHelpIds = null; - if (file.exists()) { - - // get back the exisiting data and merge it with incoming ones - - if (verbose) { - getLog().info("loading existing helpset map file " + file); - } - - mergedHelpIds = getExistingHelpIds(file); - create = false; - - } else { - - mergedHelpIds = new SortedProperties(); - create = true; - } - - // inject new helpIds - - for (Object k : helpIds.keySet()) { - mergedHelpIds.put(k, helpSetName + "/" + helpIds.get(k)); - } - - if (!mergedHelpIds.contains("top")) { - // on ajoute une entree vers le root du helpset - - String topUrl = helpSetName + ".html"; - helpIds.put("top", topUrl); - mergedHelpIds.put("top", helpSetName + "/" + topUrl); - if (verbose) { - getLog().debug("add top entry with url " + topUrl); - } - } - - if (verbose) { - if (create) { - getLog().info("generate helpset map file " + file); - } else { - getLog().info("udpate helpset map file " + file); - } - } - - env.put("helpIds", mergedHelpIds); - doGen(mapTemplate, file, env); - env.remove("helpIds"); - return mergedHelpIds; - } - - protected NodeItem generateIndexFile(File file, Properties env) throws Exception { - NodeItem rootItem = null; - - boolean create; - - if (file.exists()) { - - create = false; - - rootItem = getExistingItems("indexitem", file); - } else { - create = true; - } - - if (rootItem == null) { - rootItem = new NodeItem("top", helpSetName); - } - - // inject new index entries - - for (Object k : helpIds.keySet()) { - NodeItem toc = rootItem.findChild(k + ""); - if (verbose) { - getLog().debug("index " + k + " : " + toc); - } - } - - //String prefix = helpsetI18nPrefix; - //String prefix = helpsetI18nPrefix + helpSetName + "."; - rootItem.applyI18n(helpsetI18nPrefix, helpsetIndexI18nSuffix); - - if (verbose) { - if (create) { - getLog().info("generate helpset index file " + file); - } else { - getLog().info("udpate helpset index file " + file); - } - } - - env.put("rootItem", rootItem); - doGen(indexTemplate, file, env); - env.remove("rootItem"); - return rootItem; - } - - protected NodeItem generateTocFile(File file, Properties env) throws Exception { - NodeItem rootItem = null; - - boolean create; - - if (file.exists()) { - - create = false; - - rootItem = getExistingItems("tocitem", file); - } else { - create = true; - } - - if (rootItem == null) { - rootItem = new NodeItem("top", helpSetName); - } - // inject new toc entries - - for (Object k : helpIds.keySet()) { - NodeItem toc = rootItem.findChild(k + ""); - if (verbose) { - getLog().debug("toc " + k + " : " + toc); - } - } - - //String prefix = helpsetI18nPrefix + helpSetName + "."; - rootItem.applyI18n(helpsetI18nPrefix, helpsetTocI18nSuffix); - - if (verbose) { - if (create) { - getLog().info("generate helpset toc file " + file); - } else { - getLog().info("udpate helpset toc file " + file); - } - } - - env.put("rootItem", rootItem); - doGen(tocTemplate, file, env); - env.remove("rootItem"); - return rootItem; - } - - protected void doGen(File template, File f, Properties env) throws Exception { - TemplateGenerator gen = prepareGenerator(template); - gen.generate(env, f); - } - - protected TemplateGenerator prepareGenerator(File template) throws Exception { - URL templateURL = getTemplate(template); - - if (verbose) { - getLog().info("using template " + templateURL); - } - TemplateGenerator gen = new TemplateGenerator(project, templateURL); - return gen; - } - -// protected URL getTemplate(File f) throws IOException { -// URL r = null; -// if (f.exists()) { -// r = f.toURI().toURL(); -// } else { -// r = getClass().getResource(f.toString()); -// } -// return r; -// } -// -// protected void checkResource(File f) throws MojoFailureException { -// if (!f.exists()) { -// // test in classPath -// InputStream r = getClass().getResourceAsStream(f.toString()); -// if (r == null) { -// throw new MojoFailureException("could not find ressource " + f); -// } -// } -// } - protected Properties getExistingHelpIds(File file) throws SAXException, IOException { - - final Properties result = new SortedProperties(); - - XMLReader parser = XMLReaderFactory.createXMLReader(); - - parser.setContentHandler(new ContentHandlerAdapter() { - - String target; - String url; - - @Override - public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { - if ("mapID".equals(localName)) { - target = atts.getValue("target"); - url = atts.getValue("url"); - if (verbose) { - getLog().debug("detect map entry : " + target + " : " + url); - } - result.put(target, url); - } - } - }); - - InputStream s = new FileInputStream(file); - try { - parser.parse(new InputSource(s)); - } finally { - s.close(); - } - return result; - } - - protected NodeItem getExistingItems(String tagName, File file) throws SAXException, IOException { - - XMLReader parser = XMLReaderFactory.createXMLReader(); - NodeItemHandler handler = new NodeItemHandler(tagName); - - parser.setContentHandler(handler); - - NodeItem rootItem = null; - InputStream s = new FileInputStream(file); - try { - parser.parse(new InputSource(s)); - rootItem = handler.rootItem; - } finally { - s.close(); - } - return rootItem; - } - - static class NodeItemHandler extends ContentHandlerAdapter { - - NodeItem rootItem; - NodeItem currentItem; - final Stack<NodeItem> stack; - final String tagName; - - public NodeItemHandler(String tagName) { - this.tagName = tagName; - this.stack = new Stack<NodeItem>(); - } - - @Override - public void startDocument() throws SAXException { - rootItem = new NodeItem("top", null); - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { - if (tagName.equals(localName)) { - - String target = atts.getValue("target"); - String text = atts.getValue("text"); - - // debut d'un item - if (currentItem == null) { - // premier item - if (rootItem.getTarget().equals(target)) { - // le premier item est bien top - //rootItem.setText(text); - currentItem = rootItem; - } else { - // le premier noeud n'est pas top - // en l'encapsule - stack.push(rootItem); - currentItem = new NodeItem(target, text); - rootItem.addChild(currentItem); - } - } else { - NodeItem newItem = new NodeItem(target, text); - currentItem.addChild(newItem); - currentItem = newItem; - } - currentItem.adjustTarget(); - stack.push(currentItem); - - } - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - if (tagName.equals(localName)) { - // fin d'un item - stack.pop(); - if (!stack.isEmpty()) { - currentItem = stack.peek(); - } - } - } - } - - static class ContentHandlerAdapter implements ContentHandler { - - @Override - public void setDocumentLocator(Locator locator) { - } - - @Override - public void startDocument() throws SAXException { - } - - @Override - public void endDocument() throws SAXException { - } - - @Override - public void startPrefixMapping(String prefix, String uri) throws SAXException { - } - - @Override - public void endPrefixMapping(String prefix) throws SAXException { - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - } - - @Override - public void characters(char[] ch, int start, int length) throws SAXException { - } - - @Override - public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { - } - - @Override - public void processingInstruction(String target, String data) throws SAXException { - } - - @Override - public void skippedEntity(String name) throws SAXException { - } - } -} diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java new file mode 100644 index 0000000..d2119df --- /dev/null +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java @@ -0,0 +1,187 @@ +package org.nuiton.jaxx.plugin; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import java.util.Stack; +import org.apache.maven.plugin.logging.Log; +import org.nuiton.util.SortedProperties; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLReaderFactory; + +/** + * To load {@link NodeItem} from xml. + * + * @author chemit + * @since 2.0.0 + */ +public class XmlHelper { + + public static Properties getExistingHelpIds(File file, final boolean verbose, final Log log) throws SAXException, IOException { + + final Properties result = new SortedProperties(); + + XMLReader parser = XMLReaderFactory.createXMLReader(); + + parser.setContentHandler(new ContentHandlerAdapter() { + + String target; + String url; + + @Override + public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + if ("mapID".equals(localName)) { + target = atts.getValue("target"); + url = atts.getValue("url"); + if (verbose) { + log.debug("detect map entry : " + target + " : " + url); + } + result.put(target, url); + } + } + }); + + InputStream s = new FileInputStream(file); + try { + parser.parse(new InputSource(s)); + } finally { + if (s != null) { + s.close(); + } + } + return result; + } + + public static NodeItem getExistingItems(String tagName, File file) throws SAXException, IOException { + + XMLReader parser = XMLReaderFactory.createXMLReader(); + NodeItemHandler handler = new NodeItemHandler(tagName); + + parser.setContentHandler(handler); + + NodeItem rootItem = null; + InputStream s = new FileInputStream(file); + try { + parser.parse(new InputSource(s)); + rootItem = handler.rootItem; + } finally { + s.close(); + } + return rootItem; + } + + static class NodeItemHandler extends ContentHandlerAdapter { + + NodeItem rootItem; + NodeItem currentItem; + final Stack<NodeItem> stack; + final String tagName; + + public NodeItemHandler(String tagName) { + this.tagName = tagName; + this.stack = new Stack<NodeItem>(); + } + + @Override + public void startDocument() throws SAXException { + rootItem = new NodeItem("top", null); + } + + @Override + public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + if (tagName.equals(localName)) { + + String target = atts.getValue("target"); + String text = atts.getValue("text"); + + // debut d'un item + if (currentItem == null) { + // premier item + if (rootItem.getTarget().equals(target)) { + // le premier item est bien top + //rootItem.setText(text); + currentItem = rootItem; + } else { + // le premier noeud n'est pas top + // en l'encapsule + stack.push(rootItem); + currentItem = new NodeItem(target, text); + rootItem.addChild(currentItem); + } + } else { + NodeItem newItem = new NodeItem(target, text); + currentItem.addChild(newItem); + currentItem = newItem; + } + currentItem.adjustTarget(); + stack.push(currentItem); + + } + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + if (tagName.equals(localName)) { + // fin d'un item + stack.pop(); + if (!stack.isEmpty()) { + currentItem = stack.peek(); + } + } + } + } + + static class ContentHandlerAdapter implements ContentHandler { + + @Override + public void setDocumentLocator(Locator locator) { + } + + @Override + public void startDocument() throws SAXException { + } + + @Override + public void endDocument() throws SAXException { + } + + @Override + public void startPrefixMapping(String prefix, String uri) throws SAXException { + } + + @Override + public void endPrefixMapping(String prefix) throws SAXException { + } + + @Override + public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + } + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + } + + @Override + public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { + } + + @Override + public void processingInstruction(String target, String data) throws SAXException { + } + + @Override + public void skippedEntity(String name) throws SAXException { + } + } +} diff --git a/maven-jaxx-plugin/src/main/resources/defaultContent.html.vm b/maven-jaxx-plugin/src/main/resources/defaultContent.html.vm index 584c595..ac806dc 100644 --- a/maven-jaxx-plugin/src/main/resources/defaultContent.html.vm +++ b/maven-jaxx-plugin/src/main/resources/defaultContent.html.vm @@ -2,11 +2,11 @@ <HTML> <HEAD> <TITLE> -$helpIdTitle +$helpId </TITLE> </HEAD> <BODY BGCOLOR="#ffffff"> -<H1>$helpIdTitle</H1> +<H1>$helpId</H1> <!-- $autoremoveLine --> diff --git a/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm b/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm index 582797c..baf3e7c 100644 --- a/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm +++ b/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm @@ -3,7 +3,7 @@ PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN" "http://java.sun.com/products/javahelp/helpset_1_0.dtd"> -<helpset version="1.0"> +<helpset version="1.0" xml:lang="$locale"> <!-- $autoremoveLine --> @@ -13,7 +13,7 @@ <!-- maps --> <maps> <homeID>top</homeID> - <mapref location="$mapFileName"/> + <mapref location="$localePath/$mapFileName"/> </maps> <!-- views --> @@ -21,17 +21,17 @@ <name>TOC</name> <label>Table Of Contents</label> <type>javax.help.TOCView</type> - <data>$tocFileName</data> + <data>$localePath/$tocFileName</data> </view> <view> <name>Index</name> <label>Index</label> <type>javax.help.IndexView</type> - <data>$indexFileName</data> + <data>$localePath/$indexFileName</data> </view> -#if ( $!searchData != "" ) +#if ( $searchData ) <view> <name>Search</name> <label>Search</label> diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java index c4de8ff..1ac11fa 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java @@ -7,7 +7,7 @@ public class Bug1751Test extends JaxxBaseTest { @Test public void Bug_1751() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); assertNumberJaxxFiles(3); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java index 6012c74..bda7928 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java @@ -23,7 +23,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void Icon() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); checkPattern(mojo, ".createImageIcon(\"myIcon.png\")", true); checkPattern(mojo, ".createActionIcon(\"myActionIcon.png\")", true); @@ -40,7 +40,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void ClientProperty() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); checkPattern(mojo, ".putClientProperty(\"testOne\", \"oneTest\")", true); checkPattern(mojo, ".putClientProperty(\"testTwo\", \"anotherTest\")", true); @@ -60,7 +60,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void WithLog() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); String[] files = mojo.files; assertNumberJaxxFiles(2); @@ -85,7 +85,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void NoLog() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); assertNumberJaxxFiles(2); checkPattern(mojo, "Log log = LogFactory.getLog(", false); @@ -96,7 +96,7 @@ public class CompilerTest extends JaxxBaseTest { @SuppressWarnings({"unchecked"}) @Test public void Errors() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); // init mojo to get alls files to treate mojo.init(); @@ -160,7 +160,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void ErrorJaxxContextImplementorClass() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.jaxxContextFQN = null; try { mojo.init(); @@ -213,7 +213,7 @@ public class CompilerTest extends JaxxBaseTest { public void Force() throws Exception { // first round, with force option so will generate theonly JButton.jaxx file - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); String[] files = mojo.files; assertNumberJaxxFiles(1); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java index b595ac6..dd0894a 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java @@ -24,7 +24,7 @@ public class CompilerValidatorTest extends JaxxBaseTest { @SuppressWarnings({"unchecked"}) public void ValidatorErrors() throws Exception { // init mojo to get alls files to treate - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.init(); String[] files = mojo.files; assertNumberJaxxFiles(19); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java index 4698e7e..e82f772 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java @@ -6,7 +6,7 @@ public class DecoratorTest extends JaxxBaseTest { @Test public void Decorator() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); assertNumberJaxxFiles(1); checkPattern(mojo, "root.add(jaxx.runtime.SwingUtil.boxComponentWithJxLayer(boxedButton))", true); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java index 64f09ff..92d239c 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java @@ -15,7 +15,7 @@ public class Evolution74Test extends JaxxBaseTest { @Test public void ok() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); assertNumberJaxxFiles(6); @@ -38,7 +38,7 @@ public class Evolution74Test extends JaxxBaseTest { @SuppressWarnings({"unchecked"}) @Test public void error() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); // init mojo to get alls files to treate mojo.init(); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java index 1228328..4a1e183 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java @@ -6,7 +6,7 @@ public class I18nTest extends JaxxBaseTest { @Test public void I18nText() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.i18nable = false; mojo.execute(); checkPattern(mojo, "testId.setText(_(\"test.text\"));", false); @@ -19,7 +19,7 @@ public class I18nTest extends JaxxBaseTest { @Test public void I18nTitle() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.i18nable = false; mojo.execute(); checkPattern(mojo, "testId.setTitle(_(\"test.title\"));", false); @@ -32,7 +32,7 @@ public class I18nTest extends JaxxBaseTest { @Test public void I18nToolTipText() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.i18nable = false; mojo.execute(); checkPattern(mojo, "testId.setToolTipText(_(\"test.toolTipText\"));", false); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java index abaa634..7d03c51 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java @@ -15,9 +15,9 @@ import static org.junit.Assert.*; * * @author chemit * @see AbstractMojoTest - * @see JaxxGeneratorMojo + * @see GenerateMojo */ -public abstract class JaxxBaseTest extends AbstractMojoTest<JaxxGeneratorMojo> { +public abstract class JaxxBaseTest extends AbstractMojoTest<GenerateMojo> { @Override protected String getGoalName(String methodName) { @@ -25,7 +25,7 @@ public abstract class JaxxBaseTest extends AbstractMojoTest<JaxxGeneratorMojo> { } @Override - protected void setUpMojo(JaxxGeneratorMojo mojo, File pomFile) throws Exception { + protected void setUpMojo(GenerateMojo mojo, File pomFile) throws Exception { super.setUpMojo(mojo, pomFile); mojo.jaxxContextFQN = DefaultJAXXContext.class.getName(); mojo.compilerFQN = jaxx.compiler.JAXXCompiler.class.getName(); @@ -33,7 +33,7 @@ public abstract class JaxxBaseTest extends AbstractMojoTest<JaxxGeneratorMojo> { mojo.defaultDecoratorFQN = jaxx.compiler.decorators.DefaultCompiledObjectDecorator.class.getName(); } - protected void checkPattern(JaxxGeneratorMojo mojo, String pattern, boolean required, String... files) throws IOException { + protected void checkPattern(GenerateMojo mojo, String pattern, boolean required, String... files) throws IOException { if (files.length == 0) { files = mojo.files; } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.