branch develop updated (3e4479f -> c94d209)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository eugene. See https://gitlab.nuiton.org/nuiton/eugene.git from 3e4479f Rethink stereotypes and tag values API (fixes #4042) new f079bb4 Add missing i18n traductions new 2277192 Remove application config generate mojo from eugene project (See #4047) new c94d209 Remove application config generate mojo from eugene project (Fixes #4047) Merge branch 'feature/4047' into develop The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit c94d2097a900abd8d9f7094c072df010b6a3338b Merge: f079bb4 2277192 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Sep 30 12:41:47 2016 +0200 Remove application config generate mojo from eugene project (Fixes #4047) Merge branch 'feature/4047' into develop commit 2277192e21bb09173a4ad350510071ad3916ba06 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Sep 30 12:41:38 2016 +0200 Remove application config generate mojo from eugene project (See #4047) commit f079bb451710d528fa6bae2bf8149461a0d7f0fd Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Sep 27 16:16:40 2016 +0200 Add missing i18n traductions Summary of changes: eugene-config-templates/LICENSE.txt | 165 --------- eugene-config-templates/README.md | 0 eugene-config-templates/pom.xml | 106 ------ .../src/license/THIRD-PARTY.properties | 21 -- .../templates/ApplicationConfigTransformer.java | 314 ---------------- eugene-config-templates/src/site/fr/rst/index.rst | 33 -- eugene-config-templates/src/site/rst/index.rst | 33 -- eugene-config-templates/src/site/site_en.xml | 54 --- eugene-config-templates/src/site/site_fr.xml | 58 --- eugene-maven-plugin/pom.xml | 7 - .../plugin/GenerateApplicationConfigMojo.java | 406 --------------------- .../main/resources/tag-values-report.properties | 1 + .../main/resources/tag-values-report_fr.properties | 1 + pom.xml | 1 - 14 files changed, 2 insertions(+), 1198 deletions(-) delete mode 100644 eugene-config-templates/LICENSE.txt delete mode 100644 eugene-config-templates/README.md delete mode 100644 eugene-config-templates/pom.xml delete mode 100644 eugene-config-templates/src/license/THIRD-PARTY.properties delete mode 100644 eugene-config-templates/src/main/java/org/nuiton/eugene/config/templates/ApplicationConfigTransformer.java delete mode 100644 eugene-config-templates/src/site/fr/rst/index.rst delete mode 100644 eugene-config-templates/src/site/rst/index.rst delete mode 100644 eugene-config-templates/src/site/site_en.xml delete mode 100644 eugene-config-templates/src/site/site_fr.xml delete mode 100644 eugene-maven-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateApplicationConfigMojo.java -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository eugene. See https://gitlab.nuiton.org/nuiton/eugene.git commit f079bb451710d528fa6bae2bf8149461a0d7f0fd Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Sep 27 16:16:40 2016 +0200 Add missing i18n traductions --- eugene-maven-plugin/src/main/resources/tag-values-report.properties | 1 + eugene-maven-plugin/src/main/resources/tag-values-report_fr.properties | 1 + 2 files changed, 2 insertions(+) diff --git a/eugene-maven-plugin/src/main/resources/tag-values-report.properties b/eugene-maven-plugin/src/main/resources/tag-values-report.properties index 49651b8..848bd19 100644 --- a/eugene-maven-plugin/src/main/resources/tag-values-report.properties +++ b/eugene-maven-plugin/src/main/resources/tag-values-report.properties @@ -44,6 +44,7 @@ report.detail.tagValue.defaultValue=Default value report.detail.tagValue.matcherClass=Matcher class report.detail.tagValue.target=Target(s) report.detail.target.model=On a model +report.detail.target.package=on a package report.detail.target.classifier=on a classifier report.detail.target.class=on a class report.detail.target.interface=on a interface diff --git a/eugene-maven-plugin/src/main/resources/tag-values-report_fr.properties b/eugene-maven-plugin/src/main/resources/tag-values-report_fr.properties index 0383109..f75f9f0 100644 --- a/eugene-maven-plugin/src/main/resources/tag-values-report_fr.properties +++ b/eugene-maven-plugin/src/main/resources/tag-values-report_fr.properties @@ -44,6 +44,7 @@ report.detail.tagValue.defaultValue=Valeur par d\u00E9faut report.detail.tagValue.matcherClass=Matcher class report.detail.tagValue.target=Cible(s) report.detail.target.model=sur un mod\u00E8le +report.detail.target.package=sur un paquetage report.detail.target.classifier=sur un classifier report.detail.target.class=sur une classe report.detail.target.interface=sur une interface -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository eugene. See https://gitlab.nuiton.org/nuiton/eugene.git commit 2277192e21bb09173a4ad350510071ad3916ba06 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Sep 30 12:41:38 2016 +0200 Remove application config generate mojo from eugene project (See #4047) --- eugene-config-templates/LICENSE.txt | 165 --------- eugene-config-templates/README.md | 0 eugene-config-templates/pom.xml | 106 ------ .../src/license/THIRD-PARTY.properties | 21 -- .../templates/ApplicationConfigTransformer.java | 314 ---------------- eugene-config-templates/src/site/fr/rst/index.rst | 33 -- eugene-config-templates/src/site/rst/index.rst | 33 -- eugene-config-templates/src/site/site_en.xml | 54 --- eugene-config-templates/src/site/site_fr.xml | 58 --- eugene-maven-plugin/pom.xml | 7 - .../plugin/GenerateApplicationConfigMojo.java | 406 --------------------- pom.xml | 1 - 12 files changed, 1198 deletions(-) diff --git a/eugene-config-templates/LICENSE.txt b/eugene-config-templates/LICENSE.txt deleted file mode 100644 index cca7fc2..0000000 --- a/eugene-config-templates/LICENSE.txt +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/eugene-config-templates/README.md b/eugene-config-templates/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/eugene-config-templates/pom.xml b/eugene-config-templates/pom.xml deleted file mode 100644 index 8673e5c..0000000 --- a/eugene-config-templates/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - EUGene :: EUGene - - $HeadURL$ - %% - Copyright (C) 2004 - 2010 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> -<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/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>eugene</artifactId> - <version>3.0-SNAPSHOT</version> - </parent> - - <groupId>org.nuiton.eugene</groupId> - <artifactId>eugene-config-templates</artifactId> - - <name>EUGene :: Config templates</name> - <inceptionYear>2016</inceptionYear> - - <dependencies> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>eugene</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-config</artifactId> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.nuiton.processor</groupId> - <artifactId>processor-maven-plugin</artifactId> - <executions> - <execution> - <phase>generate-sources</phase> - <goals> - <goal>process</goal> - </goals> - </execution> - </executions> - <configuration> - <includes>**/*.java</includes> - <filters> - org.nuiton.processor.filters.GeneratorTemplatesFilter - </filters> - </configuration> - </plugin> - - <!-- expose new plexus components --> - <plugin> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-metadata</artifactId> - <executions> - <execution> - <goals> - <goal>generate-metadata</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/eugene-config-templates/src/license/THIRD-PARTY.properties b/eugene-config-templates/src/license/THIRD-PARTY.properties deleted file mode 100644 index 91e981a..0000000 --- a/eugene-config-templates/src/license/THIRD-PARTY.properties +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by org.codehaus.mojo.license.AddThirdPartyMojo -#------------------------------------------------------------------------------- -# Already used licenses in project : -# - BSD License -# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 -# - Indiana University Extreme! Lab Software License, vesion 1.1.1 -# - Lesser General Public License (LGPL) v 3.0 -# - Lesser General Public License (LPGL) -# - Lesser General Public License (LPGL) v 2.1 -# - MIT License -# - Mozilla Public License Version 1.0 -# - The Apache Software License, Version 2.0 -# - The SAX License -# - The W3C License -# - http://jaxen.codehaus.org/license.html -#------------------------------------------------------------------------------- -# Please fill the missing licenses for dependencies : -# -# -#Tue Jul 23 16:39:16 CEST 2013 -commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 diff --git a/eugene-config-templates/src/main/java/org/nuiton/eugene/config/templates/ApplicationConfigTransformer.java b/eugene-config-templates/src/main/java/org/nuiton/eugene/config/templates/ApplicationConfigTransformer.java deleted file mode 100644 index dedcb25..0000000 --- a/eugene-config-templates/src/main/java/org/nuiton/eugene/config/templates/ApplicationConfigTransformer.java +++ /dev/null @@ -1,314 +0,0 @@ -package org.nuiton.eugene.config.templates; - -/*- - * #%L - * EUGene :: Config templates - * %% - * Copyright (C) 2016 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ - -import com.google.common.collect.ImmutableSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codehaus.plexus.util.StringUtils; -import org.nuiton.config.ApplicationConfig; -import org.nuiton.eugene.GeneratorUtil; -import org.nuiton.eugene.java.JavaGeneratorUtil; -import org.nuiton.eugene.java.ObjectModelTransformerToJava; -import org.nuiton.eugene.models.object.ObjectModelAttribute; -import org.nuiton.eugene.models.object.ObjectModelClass; -import org.nuiton.eugene.models.object.ObjectModelJavaModifier; -import org.nuiton.eugene.models.object.ObjectModelOperation; - -import java.util.Set; - -/*{generator option: parentheses = false}*/ -/*{generator option: writeString = +}*/ - -/** - * To generate configuration java files from the options enum file. - * Created on 15/09/16. - * - * @author Tony Chemit - chemit@codelutin.com - * @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.eugene.config.templates.ApplicationConfigTransformer" - * @since 3.0 - */ -public class ApplicationConfigTransformer extends ObjectModelTransformerToJava { - - private static final Log log = LogFactory.getLog(ApplicationConfigTransformer.class); - public static final String PROP_OPTION_CLASS_NAME = "optionClassName"; - public static final String PROP_ACTION_CLASS_NAME = "actionClassName"; - - @Override - public void transformFromClass(ObjectModelClass clazz) { - - String packageName = clazz.getPackageName(); - String abstractClassName = "Generated" + clazz.getName(); - - if (canGenerate(packageName + "." + abstractClassName)) { - - generateAbstractClass(packageName, abstractClassName, clazz); - - } else { - - if (log.isDebugEnabled()) { - log.debug("Skip generation for " + abstractClassName); - } - - } - - String className = clazz.getName(); - if (canGenerate(packageName + "." + className)) { - - generateClass(packageName, className, abstractClassName); - - } else { - - if (log.isDebugEnabled()) { - log.debug("Skip generation for " + className); - } - - } - } - - protected void generateAbstractClass(String packageName, String abstractClassName, ObjectModelClass input) { - - String optionClassName = getProperty(PROP_OPTION_CLASS_NAME); - String optionClassSimpleName = GeneratorUtil.getSimpleName(optionClassName); - - String actionClassName = getProperty(PROP_ACTION_CLASS_NAME); - - ObjectModelClass output = createAbstractClass(abstractClassName, packageName); - - addInterface(output, "java.util.function.Supplier<ApplicationConfig>"); - addImport(output, "java.util.function.Supplier"); - addImport(output, optionClassName); - - if (log.isInfoEnabled()) { - log.info("Generate " + output.getQualifiedName()); - } - addAttribute(output, "applicationConfig", ApplicationConfig.class, "", ObjectModelJavaModifier.PRIVATE); - - ObjectModelOperation constructor = addConstructor(output, ObjectModelJavaModifier.PROTECTED); - StringBuilder builder = new StringBuilder(); - builder.append("" - /*{ - this.applicationConfig = new ApplicationConfig(); - this.applicationConfig.loadDefaultOptions(<%=optionClassSimpleName%>.values()); - }*/ - ); - if (actionClassName != null) { - addImport(output, actionClassName); - String actionClassSimpleName = GeneratorUtil.getSimpleName(actionClassName); - builder.append("" - /*{ - for (<%=actionClassSimpleName%> a : <%=actionClassSimpleName%>.values()) { - - for (String alias : a.getAliases()) { - applicationConfig.addActionAlias(alias, a.getAction()); - } - } - }*/ - ); - } - setOperationBody(constructor, builder.toString()); - - ObjectModelOperation getApplicationConfig = addOperation( - output, "get", ApplicationConfig.class, ObjectModelJavaModifier.PUBLIC); - addAnnotation(output, getApplicationConfig, Override.class); - setOperationBody(getApplicationConfig, "" - /*{ - return applicationConfig; - }*/ - ); - - ObjectModelOperation setOption = addOperation( - output, "setOption", "void", ObjectModelJavaModifier.PROTECTED); - addParameter(setOption, String.class, "key"); - addParameter(setOption, Object.class, "attrName"); - - setOperationBody(setOption, "" - /*{ - applicationConfig.setOption(key, String.valueOf(attrName)); - }*/ - ); - - for (ObjectModelAttribute attribute : input.getAttributes()) { - - String attrName = attribute.getName(); - String attrType = attribute.getType(); - String simpleType = JavaGeneratorUtil.getSimpleName(attrType); - String constantName = JavaGeneratorUtil.getSimpleName(optionClassName) + "." + JavaGeneratorUtil.convertVariableNameToConstantName(attrName); - - addImport(output, attrType); - - // generate getter - createGetMethod(output, - attrName, - simpleType, - constantName); - - - // generate setter - createSetMethod(output, - attrName, - simpleType, - constantName - ); - - } - - } - - protected void generateClass(String packageName, String className, String abstractClassName) { - - ObjectModelClass output = createClass(className, packageName); - if (log.isInfoEnabled()) { - log.info("Generate " + output.getQualifiedName()); - } - setSuperClass(output, abstractClassName); - - } - - protected boolean canGenerate(String input) { - return !getResourcesHelper().isJavaFileInClassPath(input); - } - - private static final Set<String> KNOWN_TYPES = ImmutableSet.of( - "File", - "Color", - "KeyStroke", - "URL", - "Class", - "Date", - "Time", - "Timestamp", - "Locale", - "Version", - "String", - "int", - "Integer", - "long", - "Long", - "float", - "Float", - "boolean", - "Boolean", - "byte", - "Byte", - "char", - "Character", - "double", - "Double"); - - protected void createGetMethod(ObjectModelClass output, - String attrName, - String simpleType, - String constantName) { - - boolean booleanProperty = GeneratorUtil.isBooleanPrimitive(simpleType); - String methodPrefix = booleanProperty ? JavaGeneratorUtil.OPERATION_GETTER_BOOLEAN_PREFIX : JavaGeneratorUtil.OPERATION_GETTER_DEFAULT_PREFIX; - - String methodName = "getOptionAs" + StringUtils.capitalise(simpleType); - if (simpleType.equals("String")) { - methodName = "getOption"; - } else if (simpleType.equals("Integer")) { - methodName = "getOptionAsInt"; - } - - ObjectModelOperation operation = addOperation( - output, - getJavaBeanMethodName(methodPrefix, attrName), - simpleType, - ObjectModelJavaModifier.PUBLIC - ); - - if (!KNOWN_TYPES.contains(simpleType)) { - methodName = "getOptionAsObject"; - setOperationBody(operation, "" - /*{ - return (<%=simpleType%>) applicationConfig.<%=methodName%>(<%=simpleType%>.class, <%=constantName%>.getKey()); - }*/ - ); - } else - - { - setOperationBody(operation, "" - /*{ - return applicationConfig.<%=methodName%>(<%=constantName%>.getKey()); - }*/ - ); - - if ("Boolean".equals(simpleType)) { - operation = addOperation( - output, - getJavaBeanMethodName(JavaGeneratorUtil.OPERATION_GETTER_BOOLEAN_PREFIX, attrName), - "boolean", - ObjectModelJavaModifier.PUBLIC - ); - - setOperationBody(operation, "" - /*{ - return applicationConfig.<%=methodName%>(<%=constantName%>.getKey()); - }*/ - ); - } - } - } - - protected void createSetMethod(ObjectModelClass output, - String attrName, - String simpleType, - String constantName) { - boolean booleanProperty = GeneratorUtil.isBooleanPrimitive(simpleType); - ObjectModelOperation operation = addOperation( - output, - getJavaBeanMethodName("set", attrName), - "void", - ObjectModelJavaModifier.PUBLIC - ); - addParameter(operation, simpleType, attrName); - - String methodPrefix = booleanProperty ? JavaGeneratorUtil.OPERATION_GETTER_BOOLEAN_PREFIX : JavaGeneratorUtil.OPERATION_GETTER_DEFAULT_PREFIX; - String methodName = getJavaBeanMethodName(methodPrefix, attrName); - setOperationBody(operation, "" - /*{ - setOption(<%=constantName%>.getKey(), <%=attrName%>); - }*/ - ); - - if ("Boolean".equals(simpleType)) { - operation = addOperation( - output, - getJavaBeanMethodName("set", attrName), - "void", - ObjectModelJavaModifier.PUBLIC - ); - addParameter(operation, "boolean", attrName); - - setOperationBody(operation, "" - /*{ - setOption(<%=constantName%>.getKey(), <%=attrName%>); - }*/ - ); - } - - - } - -} diff --git a/eugene-config-templates/src/site/fr/rst/index.rst b/eugene-config-templates/src/site/fr/rst/index.rst deleted file mode 100644 index 7777c47..0000000 --- a/eugene-config-templates/src/site/fr/rst/index.rst +++ /dev/null @@ -1,33 +0,0 @@ -.. - -.. * #%L -.. * EUGene :: YAML templates -.. * %% -.. * Copyright (C) 2013 - 2014 CodeLutin -.. * %% -.. * This program is free software: you can redistribute it and/or modify -.. * it under the terms of the GNU Lesser General Public License as -.. * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. -.. * -.. * You should have received a copy of the GNU General Lesser Public -.. * License along with this program. If not, see -.. * <http://www.gnu.org/licenses/lgpl-3.0.html>. -.. * #L% -.. - - -======================= -EUGene Config templates -======================= - -.. contents:: - -Introduction ------------- - -Example -------- diff --git a/eugene-config-templates/src/site/rst/index.rst b/eugene-config-templates/src/site/rst/index.rst deleted file mode 100644 index 7777c47..0000000 --- a/eugene-config-templates/src/site/rst/index.rst +++ /dev/null @@ -1,33 +0,0 @@ -.. - -.. * #%L -.. * EUGene :: YAML templates -.. * %% -.. * Copyright (C) 2013 - 2014 CodeLutin -.. * %% -.. * This program is free software: you can redistribute it and/or modify -.. * it under the terms of the GNU Lesser General Public License as -.. * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. -.. * -.. * You should have received a copy of the GNU General Lesser Public -.. * License along with this program. If not, see -.. * <http://www.gnu.org/licenses/lgpl-3.0.html>. -.. * #L% -.. - - -======================= -EUGene Config templates -======================= - -.. contents:: - -Introduction ------------- - -Example -------- diff --git a/eugene-config-templates/src/site/site_en.xml b/eugene-config-templates/src/site/site_en.xml deleted file mode 100644 index d403320..0000000 --- a/eugene-config-templates/src/site/site_en.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - EUGene :: YAML templates - %% - Copyright (C) 2013 - 2014 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> - - -<project name="${project.name}" - xmlns="http://maven.apache.org/DECORATION/1.4.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/DECORATION/1.4.0 http://maven.apache.org/xsd/decoration-1.4.0.xsd"> - - <bannerLeft> - <name>${project.name}</name> - </bannerLeft> - - <body> - - <links> - <item name="[fr" href="fr/index.html"/> - <item name="en]" href="index.html"/> - </links> - - <breadcrumbs> - <item name="${project.name}" href="./index.html"/> - </breadcrumbs> - - <menu ref="parent"/> - - <menu name="User"> - <item href="index.html" name="Home"/> - </menu> - - <menu ref="reports"/> - - </body> -</project> diff --git a/eugene-config-templates/src/site/site_fr.xml b/eugene-config-templates/src/site/site_fr.xml deleted file mode 100644 index 7808bd2..0000000 --- a/eugene-config-templates/src/site/site_fr.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - EUGene :: YAML templates - %% - Copyright (C) 2013 - 2014 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> - - -<project name="${project.name}" - xmlns="http://maven.apache.org/DECORATION/1.4.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/DECORATION/1.4.0 http://maven.apache.org/xsd/decoration-1.4.0.xsd"> - - <bannerLeft> - <name>${project.name}</name> - </bannerLeft> - - <body> - - <links> - <item name="[fr" href="index.html"/> - <item name="en]" href="../index.html"/> - </links> - - <breadcrumbs> - <item name="${project.name}" href="./index.html"/> - </breadcrumbs> - - <!-- TC-20100117 : ne fonctionne pas sur une langue non principale --> - <!--<menu ref="parent"/>--> - <menu name="Parent Projet"> - <item name="Eugene" href="../../fr/index.html"/> - </menu> - - <menu name="Utilisateur"> - <item href="index.html" name="Accueil"/> - </menu> - - <menu ref="reports"/> - - </body> -</project> diff --git a/eugene-maven-plugin/pom.xml b/eugene-maven-plugin/pom.xml index a5fcf38..162ca3d 100644 --- a/eugene-maven-plugin/pom.xml +++ b/eugene-maven-plugin/pom.xml @@ -78,13 +78,6 @@ </dependency> <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>eugene-config-templates</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> <groupId>com.tunnelvisionlabs</groupId> <artifactId>antlr4-runtime</artifactId> </dependency> diff --git a/eugene-maven-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateApplicationConfigMojo.java b/eugene-maven-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateApplicationConfigMojo.java deleted file mode 100644 index 38be435..0000000 --- a/eugene-maven-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateApplicationConfigMojo.java +++ /dev/null @@ -1,406 +0,0 @@ -package org.nuiton.eugene.plugin; - -/* - * #%L - * I18n :: Maven Plugin - * %% - * Copyright (C) 2007 - 2016 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ - -import org.antlr.v4.runtime.ANTLRInputStream; -import org.antlr.v4.runtime.CommonTokenStream; -import org.antlr.v4.runtime.TokenStream; -import org.antlr.v4.runtime.misc.NotNull; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.maven.project.MavenProject; -import org.nuiton.eugene.DefaultTemplateConfiguration; -import org.nuiton.eugene.Template; -import org.nuiton.eugene.config.templates.ApplicationConfigTransformer; -import org.nuiton.eugene.java.JavaGeneratorUtil; -import org.nuiton.eugene.models.object.xml.ObjectModelAttributeImpl; -import org.nuiton.eugene.models.object.xml.ObjectModelClassImpl; -import org.nuiton.eugene.models.object.xml.ObjectModelImpl; -import org.nuiton.eugene.plugin.parser.java.Java8BaseVisitor; -import org.nuiton.eugene.plugin.parser.java.Java8Lexer; -import org.nuiton.eugene.plugin.parser.java.Java8Parser; -import org.nuiton.plugin.AbstractPlugin; -import org.nuiton.plugin.PluginHelper; -import org.nuiton.plugin.PluginWithEncoding; -import org.nuiton.version.Version; - -import javax.swing.KeyStroke; -import java.awt.Color; -import java.io.File; -import java.net.URL; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.Locale; -import java.util.Map; -import java.util.Properties; - -/** - * Generate a i18n enum class helper. - * - * Created on 28/08/16. - * - * @author Tony Chemit - chemit@codelutin.com - * @since 3.0 - */ -@Mojo(name = "generate-config", defaultPhase = LifecyclePhase.GENERATE_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) -public class GenerateApplicationConfigMojo extends AbstractPlugin implements PluginWithEncoding { - - /** - * To set the package fully qualified name of the generated class. - * - * By default, will use groupId.artifactId (with {@code -} replaced by {@code .}) plus {@code .config}. - */ - @Parameter(property = "eugene.packageName") - private String packageName; - - /** - * Model name (will prefix the generated files names with it). - */ - @Parameter(property = "eugene.modelName", required = true) - private String modelName; - - /** - * The fully qualified name of the enum class of options to scan to generate the configuration java files. - * - * By default, will use groupId.artifactId (with {@code -} replaced by {@code .}) plus {@code .config.modelNameOption}. - */ - @Parameter(property = "eugene.optionsClassName") - private String optionsClassName; - - /** - * The fully qualified name of the enum class of actions to scan to generate the configuration java files. - * - * By default, will use groupId.artifactId (with {@code -} replaced by {@code .}) plus {@code .config.modelNameAction}. - */ - @Parameter(property = "eugene.actionsClassName") - private String actionsClassName; - - /** - * The source directory where to scan options java file. - */ - @Parameter(property = "eugene.sourceDirectory", defaultValue = "${basedir}/src/main/java", required = true) - private File sourceDirectory; - - /** - * The root directory where to generated. - */ - @Parameter(property = "eugene.outputdirectory", defaultValue = "${basedir}/target/generated-sources/java", required = true) - private File outputdirectory; - - /** - * Pour activer le mode verbeux. - */ - @Parameter(property = "eugene.verbose", defaultValue = "${maven.verbose}") - protected boolean verbose; - - /** - * Encoding to be used for generation of files. - * - * <b>Note:</b> If nothing is filled here, we will use the system - * property {@code file.encoding}. - */ - @Parameter(property = "eugene.encoding", defaultValue = "${project.build.sourceEncoding}") - protected String encoding; - - /** - * - */ - @Parameter(property = "eugene.prefix", defaultValue = "Config") - protected String prefix; - - /** - * Maven project. - */ - @Parameter(defaultValue = "${project}", readonly = true) - protected MavenProject project; - - protected ObjectModelImpl model; - - protected ApplicationConfigTransformer template; - - @Override - protected void init() throws Exception { - - if (packageName == null) { - - packageName = getProject().getGroupId() + "." + getProject().getArtifactId().replaceAll("-", "."); - getLog().info("Use package name: " + packageName); - } - - if (optionsClassName == null) { - - optionsClassName = packageName + "." + modelName + prefix + "Option"; - - File file = PluginHelper.getFile(sourceDirectory, optionsClassName.split("\\.")); - File javaFile = new File(file.getParentFile(), file.getName() + ".java"); - - if (!javaFile.exists()) { - - prefix = "Configuration"; - - optionsClassName = packageName + "." + modelName + prefix + "Option"; - - file = PluginHelper.getFile(sourceDirectory, optionsClassName.split("\\.")); - javaFile = new File(file.getParentFile(), file.getName() + ".java"); - - if (!javaFile.exists()) { - throw new MojoExecutionException("Can't find option file at: " + javaFile); - } - } - getLog().info("Detected configuration options class: " + optionsClassName); - - } - - if (actionsClassName == null) { - - actionsClassName = packageName + "." + modelName + prefix + "Action"; - - File file = PluginHelper.getFile(sourceDirectory, actionsClassName.split("\\.")); - File javaFile = new File(file.getParentFile(), file.getName() + ".java"); - - if (javaFile.exists()) { - - getLog().info("Detected configuration actions class: " + actionsClassName); - } else { - - // won't be used - actionsClassName = null; - } - - } - - ClassLoader loader = this.initClassLoader(getProject(), sourceDirectory, true, false, false, true, true); - - // get options - - model = new ObjectModelImpl(); - model.setName(modelName); - - - - String className = modelName + prefix; - getLog().info("Config class name: " + className); - - File file = PluginHelper.getFile(sourceDirectory, optionsClassName.split("\\.")); - File javaFile = new File(file.getParentFile(), file.getName() + ".java"); - - String content = FileUtils.readFileToString(javaFile, encoding); - TokenStream tokenStream = new CommonTokenStream(new Java8Lexer(new ANTLRInputStream(content))); - Java8Parser parser = new Java8Parser(tokenStream); - - - // see http://stackoverflow.com/a/32918434/2038100 - //parser.setErrorHandler(new BailErrorStrategy()); - //parser.getInterpreter().setPredictionMode(PredictionMode.SLL); - //parser.getInterpreter().tail_call_preserves_sll = false; - parser.getInterpreter().enable_global_context_dfa = true; - - JavaParserVisitor visitor = new JavaParserVisitor(loader, javaFile); - parser.compilationUnit().accept(visitor); - - Map<String, String> names = visitor.getNames(); - - ObjectModelClassImpl aClass = new ObjectModelClassImpl(); - aClass.setName(className); - aClass.setPackage(packageName); - model.addClass(aClass); - - for (Map.Entry<String, String> entry : names.entrySet()) { - ObjectModelAttributeImpl attribute = new ObjectModelAttributeImpl(); - attribute.setName(JavaGeneratorUtil.convertConstantNameToVariableName(entry.getKey())); - attribute.setType(entry.getValue()); - aClass.addAttribute(attribute); - } - - Properties templateProperties = new Properties(); - - templateProperties.put(Template.PROP_ENCODING, getEncoding()); - templateProperties.put(Template.PROP_VERBOSE, verbose); - templateProperties.put(Template.PROP_OVERWRITE, true); - templateProperties.put(Template.PROP_CLASS_LOADER, loader); - templateProperties.put(ApplicationConfigTransformer.PROP_OPTION_CLASS_NAME, optionsClassName); - if (actionsClassName != null) { - templateProperties.put(ApplicationConfigTransformer.PROP_ACTION_CLASS_NAME, actionsClassName); - } - - template = new ApplicationConfigTransformer(); - template.setConfiguration(new DefaultTemplateConfiguration(templateProperties)); - - if (!project.getCompileSourceRoots().contains(outputdirectory.getPath())) { - if (isVerbose()) { - getLog().info("Add compile source root : " + outputdirectory); - } - project.addCompileSourceRoot(outputdirectory.getPath()); - } - } - - @Override - protected void doAction() throws Exception { - - getLog().info("Generate file(s) to: " + outputdirectory); - - template.applyTemplate(model, outputdirectory); - - } - - @Override - public boolean isVerbose() { - return verbose; - } - - @Override - public void setVerbose(boolean verbose) { - this.verbose = verbose; - } - - @Override - public MavenProject getProject() { - return project; - } - - @Override - public String getEncoding() { - return encoding; - } - - @Override - public void setEncoding(String encoding) { - this.encoding = encoding; - } - - @Override - public void setProject(MavenProject project) { - this.project = project; - } - - protected class JavaParserVisitor extends Java8BaseVisitor<Void> { - - protected final Map<String, String> names; - - private final ClassLoader loader; - protected final File file; - - private JavaParserVisitor(ClassLoader loader, File file) { - this.loader = loader; - this.file = file; - names = new LinkedHashMap<>(); - } - - public Map<String, String> getNames() { - return names; - } - - String name; - boolean first; - - @Override - public Void visitEnumConstant(Java8Parser.EnumConstantContext ctx) { - name = ctx.getChild(0).getText(); - first = false; - return super.visitEnumConstant(ctx); - } - - @Override - public Void visitArgumentList(@NotNull Java8Parser.ArgumentListContext ctx) { - if (!first) { - - String type = StringUtils.removeEnd(ctx.getChild(0).getText(), ".class"); - switch (type) { - case "File": - type = File.class.getName(); - break; - case "Color": - type = Color.class.getName(); - break; - case "KeyStroke": - type = KeyStroke.class.getName(); - break; - case "URL": - type = URL.class.getName(); - break; - case "Class": - type = Class.class.getName(); - break; - case "Date": - type = Date.class.getName(); - break; - case "Time": - type = Time.class.getName(); - break; - case "Timestamp": - type = Timestamp.class.getName(); - break; - case "Locale": - type = Locale.class.getName(); - break; - case "Version": - type = Version.class.getName(); - break; - case "String": - case "int": - case "Integer": - case "long": - case "Long": - case "float": - case "Float": - case "boolean": - case "Boolean": - case "byte": - case "Byte": - case "char": - case "Character": - case "double": - case "Double": - break; - default: - try { - loader.loadClass(type); - } catch (ClassNotFoundException e) { - - // try to see if class found in source path - - File sourceFile = PluginHelper.getFile(sourceDirectory, type.split("\\.")); - sourceFile = new File(sourceFile.getParentFile(), sourceFile.getName() + ".java"); - if (!sourceFile.exists()) { - - throw new IllegalStateException("Can't find real type of " + type + " for option: " + name + ", please use the fully qualified name in code"); - } - } - } - - names.put(name, type); - first = true; - } - return super.visitArgumentList(ctx); - } - - } - -} diff --git a/pom.xml b/pom.xml index 3e3b087..e154149 100644 --- a/pom.xml +++ b/pom.xml @@ -120,7 +120,6 @@ <modules> <module>eugene</module> - <module>eugene-config-templates</module> <module>eugene-java-templates</module> <module>eugene-plantuml-templates</module> <module>eugene-yaml-templates</module> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository eugene. See https://gitlab.nuiton.org/nuiton/eugene.git commit c94d2097a900abd8d9f7094c072df010b6a3338b Merge: f079bb4 2277192 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Sep 30 12:41:47 2016 +0200 Remove application config generate mojo from eugene project (Fixes #4047) Merge branch 'feature/4047' into develop eugene-config-templates/LICENSE.txt | 165 --------- eugene-config-templates/README.md | 0 eugene-config-templates/pom.xml | 106 ------ .../src/license/THIRD-PARTY.properties | 21 -- .../templates/ApplicationConfigTransformer.java | 314 ---------------- eugene-config-templates/src/site/fr/rst/index.rst | 33 -- eugene-config-templates/src/site/rst/index.rst | 33 -- eugene-config-templates/src/site/site_en.xml | 54 --- eugene-config-templates/src/site/site_fr.xml | 58 --- eugene-maven-plugin/pom.xml | 7 - .../plugin/GenerateApplicationConfigMojo.java | 406 --------------------- pom.xml | 1 - 12 files changed, 1198 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm