r3420 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish: datastore export rule simulator ui/sensitivity util
Author: chatellier Date: 2011-06-17 13:55:14 +0000 (Fri, 17 Jun 2011) New Revision: 3420 Log: Storage parameters storing/reloading refactored. SensitivityCalculator parameters are not lost anymore ;) Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java Removed: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/DocHelper.java Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/AnalysePlanStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ExportStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/RuleStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityExportStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Doc.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Docable.java Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/AnalysePlanStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/AnalysePlanStorage.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/AnalysePlanStorage.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -25,26 +25,22 @@ package fr.ifremer.isisfish.datastore; -import fr.ifremer.isisfish.IsisFishException; -import fr.ifremer.isisfish.IsisFish; -import fr.ifremer.isisfish.simulator.AnalysePlan; -import fr.ifremer.isisfish.util.Doc; -import fr.ifremer.isisfish.util.DocHelper; -import fr.ifremer.isisfish.util.Docable; -import fr.ifremer.isisfish.vcs.VCSException; - import static org.nuiton.i18n.I18n._; +import java.io.File; +import java.util.List; +import java.util.Map; + import org.apache.commons.collections.map.ReferenceMap; -import org.apache.commons.lang.ObjectUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.io.File; -import java.lang.reflect.Field; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import fr.ifremer.isisfish.IsisFish; +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.simulator.AnalysePlan; +import fr.ifremer.isisfish.util.Doc; +import fr.ifremer.isisfish.util.Docable; +import fr.ifremer.isisfish.vcs.VCSException; /** * Class permettant de representer un plan d'analyse. @@ -60,7 +56,7 @@ * * Last update: $Date$ by : $Author$ */ -public class AnalysePlanStorage extends JavaSourceStorage implements Docable { // AnalysePlanStorage +public class AnalysePlanStorage extends JavaSourceStorage { // AnalysePlanStorage /** to use log facility, just put in your code: log.info(\"...\"); */ private static Log log = LogFactory.getLog(AnalysePlanStorage.class); @@ -163,129 +159,6 @@ return (AnalysePlan) result; } - /** - * Permet de recuperer les parametres du plan. - * - * @return Une map contenant le nom du parametre et son type - * @throws IsisFishException s'il est impossible de retourner une map - * convenable - */ - public Map<String, Class<?>> getParameterNames() throws IsisFishException { - Map<String, Class<?>> result = null; - // On essai de recuperer les paramètres depuis la classe compilé - // si c possible - try { - if (0 == compile(false, null)) { - AnalysePlan plan = getNewAnalysePlanInstance(); - result = AnalysePlanStorage.getParameterNames(plan); - } - } catch (Exception eee) { - log.info(_("isisfish.error.plan.parameter"), eee); - } - // si on ne reussi pas avec la classe compilé on essai en parsant le - // source - if (result == null) { - try { - //String code = getContent(); - log.fatal("FIXME a faire recherche des parametre dans le source"); - throw new IsisFishException(_("isisfish.error.source.parameter")); - // TODO implanter la recherche des parametres. - // Se sont les attributs commencant par 'param_' et ils doivent - // etre public non static, non transient. - // ex: public Date param_Date. - // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre - // le prefix param. - } catch (Exception eee) { - throw new IsisFishException(_("isisfish.error.source.parameter"), eee); - } - } - return result; - } - - - /** - * Recherche par introspection tous les parametres de la classe - * commencant par param_ - * - * @param plan le plan dont on souhaite les infos de parametre - * @return retourne le nom et le type des parametres du plan - */ - public static Map<String, Class<?>> getParameterNames(AnalysePlan plan) { - Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>(); - for (Field field : plan.getClass().getFields()) { - if (field.getName().startsWith(PARAM_PREFIX)) { - result.put(field.getName().substring(PARAM_PREFIX.length()), - field.getType()); - } - } - return result; - } - - /** - * Donne la valeur d'un parametre par introspection - * - * @param name le nom du parametre - * @param plan le plan dont on souhaite la valeur du parametre - * @return la valeur courante du parametre - * @throws IsisFishException s'il y a un probleme pour recuperer la valeur - */ - static public Object getParameterValue(AnalysePlan plan, String name) throws IsisFishException { - if (plan == null || name == null || "".equals(name)) { - return null; - } - try { - String fieldName = PARAM_PREFIX + name; - Field field = plan.getClass().getDeclaredField(fieldName); - return field.get(plan); - } catch (IllegalAccessException eee) { - throw new IsisFishException("Can't get plan parameter: " + name, eee); - } catch (NoSuchFieldException eee) { - throw new IsisFishException("Can't get plan parameter: " + name, eee); - } - } - - /** - * Modifie la valeur d'un attribut pas introspection - * - * @param name le nom de l'attribut - * @param value la valeur de l'attribut - * @param plan le plan dont on souhaite modifier la valeur de parametre - * @throws IsisFishException s'il y a un probleme - */ - static public void setParameterValue(AnalysePlan plan, String name, Object value) throws IsisFishException { - try { - String fieldName = PARAM_PREFIX + name; - Field field = plan.getClass().getDeclaredField(fieldName); - field.set(plan, value); - } catch (IllegalAccessException eee) { - throw new IsisFishException("Can't modify plan parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee); - } catch (NoSuchFieldException eee) { - throw new IsisFishException("Can't modify plan parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee); - } catch (IllegalArgumentException eee) { - throw new IsisFishException("Can't modify plan parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee); - } - } - - /** - * Recupere les parametres et leur valeur pour les retourner sous forme - * de chaine. Pour pouvoir par exemple les afficher a l'utilisateur - * - * @param plan le plan dont on souhaite la valeur du parametre en string - * @return la valeur sous forme de string - * @throws IsisFishException - */ - public static String getParamAsString(AnalysePlan plan) throws IsisFishException { - StringBuffer result = new StringBuffer(); - - for (String name : getParameterNames(plan).keySet()) { - Object value = getParameterValue(plan, name); - - result.append(name).append(" : ").append(value); - result.append("\n"); - } - return result.toString(); - } - static public void checkout() throws VCSException { checkout(IsisFish.config.getDatabaseDirectory(), ANALYSE_PLAN_PATH); } @@ -329,51 +202,6 @@ } /** - * @return the @Doc of the underlied AnalysePlan class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getClassDoc() { - Doc result = null; - try { - Class<?> klazz = getCodeClass(); - result = DocHelper.getClassDoc(klazz); - } catch (IsisFishException e) { - log.warn(_("isisfish.error.not.found.code", this)); - } - return result; - } - - /** - * @param fieldName name of the field to inspect - * @return the @Doc of the given field of the underlied AnalysePlan class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getFieldDoc(String fieldName) { - Doc result = null; - try { - Class<?> klazz = getCodeClass(); - result = DocHelper.getFieldDoc(klazz, fieldName); - } catch (Exception e) { - log.warn(_("isisfish.error.not.found.field", fieldName, this)); - } - return result; - } - - /** - * @param paramName the name of the param to inspect - * @return the doc associated with the param, - * (says the field PARAM_PREFIX+fieldName) - */ - public Doc getParamDoc(String paramName) { - Doc doc = getFieldDoc(PARAM_PREFIX + paramName); - return doc; - } - - /** * <b>Be ware this method require to instanciate a AnalysePlan, so * it would be better to call as often as possible.</b> * Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ExportStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ExportStorage.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ExportStorage.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -28,13 +28,10 @@ import static org.nuiton.i18n.I18n._; import java.io.File; -import java.lang.reflect.Field; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.commons.collections.map.ReferenceMap; -import org.apache.commons.lang.ObjectUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -42,7 +39,6 @@ import fr.ifremer.isisfish.IsisFishException; import fr.ifremer.isisfish.export.Export; import fr.ifremer.isisfish.util.Doc; -import fr.ifremer.isisfish.util.DocHelper; import fr.ifremer.isisfish.util.Docable; import fr.ifremer.isisfish.vcs.VCSException; @@ -58,7 +54,7 @@ * Last update: $Date$ * by : $Author$ */ -public class ExportStorage extends JavaSourceStorage implements Docable { +public class ExportStorage extends JavaSourceStorage { /** Class logger. */ private static Log log = LogFactory.getLog(ExportStorage.class); @@ -165,41 +161,6 @@ } /** - * @return the @Doc of the underlied rule class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getClassDoc() { - Doc result = null; - try { - Class<?> klazz = getCodeClass(); - result = DocHelper.getClassDoc(klazz); - } catch (IsisFishException e) { - log.warn(_("isisfish.error.not.found.code", this)); - } - return result; - } - - /** - * @param fieldName name of the field to inspect - * @return the @Doc of the given field of the underlied Rule class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getFieldDoc(String fieldName) { - Doc result=null; - try { - Class<?> klazz = getCodeClass(); - result = DocHelper.getFieldDoc(klazz,fieldName); - } catch (Exception e) { - log.warn(_("isisfish.error.not.found.field",fieldName,this)); - } - return result; - } - - /** * <b>Be ware this method require to instanciate a Export, so * it would be better to call as often as possible.</b> * @@ -219,124 +180,4 @@ } return result; } - - /** - * @param paramName the name of the param to inspect - * @return the doc associated with the param, - * (says the field PARAM_PREFIX+fieldName) - */ - public Doc getParamDoc(String paramName) { - Doc doc; - doc = getFieldDoc(PARAM_PREFIX + paramName); - return doc; - } - - /** - * Permet de recuperer les parametres de l'export. - * - * @return Une map contenant le nom du parametre et son type - * @throws IsisFishException s'il est impossible de retourner une map - * convenable - */ - public Map<String, Class<?>> getParameterNames() throws IsisFishException { - Map<String, Class<?>> result = null; - // On essai de recuperer les paramètres depuis la classe compilé - // si c possible - try { - if (0 == compile(false, null)) { - Export export = getNewExportInstance(); - result = ExportStorage.getParameterNames(export); - } - } catch (Exception eee) { - log.info(_("isisfish.error.compiled.parameter"), eee); - } - // si on ne reussi pas avec la classe compilé on essai en parsant le - // source - if (result == null) { - try { - //String code = getContent(); - log.fatal("FIXME a faire recherche des parametre dans le source"); - throw new IsisFishException(_("isisfish.error.source.parameter")); - // TODO implanter la recherche des parametres. - // Se sont les attributs commencant par 'param_' et ils doivent - // etre public non static, non transient. - // ex: public Date param_Date. - // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre - // le prefix param. - } catch (Exception eee) { - throw new IsisFishException(_("isisfish.error.source.parameter"), eee); - } - } - return result; - } - - /** - * Recherche par introspection tous les parametres de la classe - * commencant par {@link #PARAM_PREFIX}. - * - * @param export the export to inspect - * @return the list of parameters for a given export - */ - public static Map<String, Class<?>> getParameterNames(Export export) { - Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>(); - for (Field field : export.getClass().getFields()) { - if (field.getName().startsWith(PARAM_PREFIX)) { - result.put(field.getName().substring(PARAM_PREFIX.length()), - field.getType()); - } - } - return result; - } - - /** - * Donne la valeur d'un parametre par introspection. - * - * @param name le nom du parametre - * @param export the export to inspect - * @return la valeur courante du parametre - * @throws IsisFishException if any exception - */ - public static Object getParameterValue(Export export, String name) throws IsisFishException { - if (export == null || name == null || "".equals(name)) { - return null; - } - try { - String fieldName = PARAM_PREFIX + name; - Field field = export.getClass().getDeclaredField(fieldName); - return field.get(export); - } catch (IllegalAccessException eee) { - throw new IsisFishException("Can't get rule parameter: " + name, eee); - } catch (NoSuchFieldException eee) { - throw new IsisFishException("Can't get rule parameter: " + name, eee); - } - } - - /** - * Modifie la valeur d'un attribut par introspection. - * - * @param name le nom de l'attribut - * @param value la valeur de l'attribut - * @param export the export to inspect - * @throws IsisFishException if any exception - */ - public static void setParameterValue(Export export, String name, - Object value) throws IsisFishException { - try { - String fieldName = PARAM_PREFIX + name; - Field field = export.getClass().getDeclaredField(fieldName); - field.set(export, value); - } catch (IllegalAccessException eee) { - throw new IsisFishException("Can't modify export parameter: " - + name + " with '" + value + "'(" - + ObjectUtils.identityToString(value) + ")", eee); - } catch (NoSuchFieldException eee) { - throw new IsisFishException("Can't modify export parameter: " - + name + " with '" + value + "'(" - + ObjectUtils.identityToString(value) + ")", eee); - } catch (IllegalArgumentException eee) { - throw new IsisFishException("Can't modify export parameter: " - + name + " with '" + value + "'(" - + ObjectUtils.identityToString(value) + ")", eee); - } - } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,14 +29,21 @@ import java.io.File; import java.io.PrintWriter; +import java.lang.reflect.Field; +import java.util.LinkedHashMap; +import java.util.Map; import org.apache.commons.lang.ClassUtils; +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import fr.ifremer.isisfish.IsisFish; import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.rule.Rule; import fr.ifremer.isisfish.util.CompileHelper; import fr.ifremer.isisfish.util.Doc; -import fr.ifremer.isisfish.util.DocHelper; +import fr.ifremer.isisfish.util.Docable; import fr.ifremer.isisfish.util.JavadocHelper; /** @@ -56,8 +63,12 @@ * * Last update: $Date$ by : $Author$ */ -public abstract class JavaSourceStorage extends CodeSourceStorage { +public abstract class JavaSourceStorage extends CodeSourceStorage implements Docable { + /** Class logger. */ + private static Log log = LogFactory.getLog(ExportStorage.class); + + /** Le prefix de tous les attributs java manipulable par Isis. */ protected static final String PARAM_PREFIX = "param_"; /** @@ -171,7 +182,13 @@ } return result; } - + + protected static Doc getFieldDoc(Class klass, String paramName) throws SecurityException, NoSuchFieldException { + Field f = klass == null ? null : klass.getField(paramName); + Doc result = f == null ? null : f.getAnnotation(Doc.class); + return result; + } + /** * Get doc of parameter. * @@ -180,7 +197,166 @@ * @return {@link Doc} annotation */ public static Doc getParameterDoc(Object object, String paramName) { - Doc result = DocHelper.getFieldDoc(object.getClass(), PARAM_PREFIX + paramName); + Doc result = null; + try { + result = getFieldDoc(object.getClass(), PARAM_PREFIX + paramName); + } catch (Exception e) { + log.warn(_("isisfish.error.not.found.field", paramName, object)); + } return result; } + + /** + * @param paramName the name of the param to inspect + * @return the doc associated with the param, + * (says the field PARAM_PREFIX+fieldName) + */ + public Doc getFieldDoc(String paramName) { + Doc result = null; + try { + Class<?> clazz = getCodeClass(); + result = getFieldDoc(clazz, PARAM_PREFIX + paramName); + } catch (Exception e) { + log.warn(_("isisfish.error.not.found.field", paramName, this)); + } + return result; + } + + /** + * Get docable element description. + */ + @Override + public String getDescription() { + return null; + } + + /** + * Permet de recuperer les parametres de l'export. + * + * @return Une map contenant le nom du parametre et son type + * @throws IsisFishException s'il est impossible de retourner une map + * convenable + */ + public Map<String, Class<?>> getParameterNames() throws IsisFishException { + Map<String, Class<?>> result = null; + // On essai de recuperer les paramètres depuis la classe compilé + // si c possible + try { + if (0 == compile(false, null)) { + Object instance = getNewInstance(); + result = getParameterNames(instance); + } + } catch (Exception eee) { + log.info(_("isisfish.error.compiled.parameter"), eee); + } + // si on ne reussi pas avec la classe compilé on essai en parsant le + // source + if (result == null) { + try { + //String code = getContent(); + log.fatal("FIXME a faire recherche des parametre dans le source"); + throw new IsisFishException(_("isisfish.error.source.parameter")); + // TODO implanter la recherche des parametres. + // Se sont les attributs commencant par 'param_' et ils doivent + // etre public non static, non transient. + // ex: public Date param_Date. + // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre + // le prefix param. + } catch (Exception eee) { + throw new IsisFishException(_("isisfish.error.source.parameter"), eee); + } + } + return result; + } + + /** + * Recherche par introspection tous les parametres de la classe + * commencant par {@link #PARAM_PREFIX}. + * + * @param instance the instance to inspect + * @return the list of parameters for a given export + */ + public static Map<String, Class<?>> getParameterNames(Object instance) { + Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>(); + for (Field field : instance.getClass().getFields()) { + if (field.getName().startsWith(PARAM_PREFIX)) { + result.put(field.getName().substring(PARAM_PREFIX.length()), + field.getType()); + } + } + return result; + } + + /** + * Donne la valeur d'un parametre par introspection. + * + * @param name le nom du parametre + * @param instance the instance to inspect + * @return la valeur courante du parametre + * @throws IsisFishException if any exception + */ + public static Object getParameterValue(Object instance, String name) throws IsisFishException { + if (instance == null || name == null || "".equals(name)) { + return null; + } + try { + String fieldName = PARAM_PREFIX + name; + Field field = instance.getClass().getDeclaredField(fieldName); + return field.get(instance); + } catch (IllegalAccessException eee) { + throw new IsisFishException("Can't get rule parameter: " + name, eee); + } catch (NoSuchFieldException eee) { + throw new IsisFishException("Can't get rule parameter: " + name, eee); + } + } + + /** + * Modifie la valeur d'un attribut par introspection. + * + * @param name le nom de l'attribut + * @param value la valeur de l'attribut + * @param instance the instance to inspect + * @throws IsisFishException if any exception + */ + public static void setParameterValue(Object instance, String name, + Object value) throws IsisFishException { + try { + String fieldName = PARAM_PREFIX + name; + Field field = instance.getClass().getDeclaredField(fieldName); + field.set(instance, value); + } catch (IllegalAccessException eee) { + throw new IsisFishException("Can't modify export parameter: " + + name + " with '" + value + "'(" + + ObjectUtils.identityToString(value) + ")", eee); + } catch (NoSuchFieldException eee) { + throw new IsisFishException("Can't modify export parameter: " + + name + " with '" + value + "'(" + + ObjectUtils.identityToString(value) + ")", eee); + } catch (IllegalArgumentException eee) { + throw new IsisFishException("Can't modify export parameter: " + + name + " with '" + value + "'(" + + ObjectUtils.identityToString(value) + ")", eee); + } + } + + /** + * Recupere les parametres et leur valeur pour les retourner sous forme + * de chaine. Pour pouvoir par exemple les afficher a l'utilisateur. + * + * @param instance the instance to inspect + * @return a string representation of parameters and their values for + * a given rule + * @throws IsisFishException if any exception + */ + public static String getParamAsString(Object instance) throws IsisFishException { + StringBuffer result = new StringBuffer(); + + for (String name : getParameterNames(instance).keySet()) { + Object value = getParameterValue(instance, name); + + result.append(name).append(" : ").append(value); + result.append("\n"); + } + return result.toString(); + } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/RuleStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/RuleStorage.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/RuleStorage.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -25,26 +25,22 @@ package fr.ifremer.isisfish.datastore; -import fr.ifremer.isisfish.IsisFishException; -import fr.ifremer.isisfish.IsisFish; -import fr.ifremer.isisfish.util.Doc; -import fr.ifremer.isisfish.util.DocHelper; -import fr.ifremer.isisfish.util.Docable; -import fr.ifremer.isisfish.rule.Rule; -import fr.ifremer.isisfish.vcs.VCSException; - import static org.nuiton.i18n.I18n._; +import java.io.File; +import java.util.List; +import java.util.Map; + import org.apache.commons.collections.map.ReferenceMap; -import org.apache.commons.lang.ObjectUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.io.File; -import java.lang.reflect.Field; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import fr.ifremer.isisfish.IsisFish; +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.util.Doc; +import fr.ifremer.isisfish.util.Docable; +import fr.ifremer.isisfish.vcs.VCSException; /** * Class permettant de representer une regle de gestion. @@ -166,130 +162,6 @@ return (Rule) result; } - /** - * Permet de recuperer les parametres de la regle. - * - * @return Une map contenant le nom du parametre et son type - * @throws IsisFishException s'il est impossible de retourner une map - * convenable - */ - public Map<String, Class<?>> getParameterNames() throws IsisFishException { - Map<String, Class<?>> result = null; - // On essai de recuperer les paramètres depuis la classe compilé - // si c possible - try { - if (0 == compile(false, null)) { - Rule rule = getNewRuleInstance(); - result = RuleStorage.getParameterNames(rule); - } - } catch (Exception eee) { - log.info(_("isisfish.error.compiled.parameter"), eee); - } - // si on ne reussi pas avec la classe compilé on essai en parsant le - // source - if (result == null) { - try { - //String code = getContent(); - log.fatal("FIXME a faire recherche des parametre dans le source"); - throw new IsisFishException(_("isisfish.error.source.parameter")); - // TODO implanter la recherche des parametres. - // Se sont les attributs commencant par 'param_' et ils doivent - // etre public non static, non transient. - // ex: public Date param_Date. - // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre - // le prefix param. - } catch (Exception eee) { - throw new IsisFishException(_("isisfish.error.source.parameter"), eee); - } - } - return result; - } - - - /** - * Recherche par introspection tous les parametres de la classe - * commencant par param_ - * - * @param rule the rule to inspect - * @return the list of parameters for a given rule - */ - static public Map<String, Class<?>> getParameterNames(Rule rule) { - Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>(); - for (Field field : rule.getClass().getFields()) { - if (field.getName().startsWith(PARAM_PREFIX)) { - result.put(field.getName().substring(PARAM_PREFIX.length()), - field.getType()); - } - } - return result; - } - - /** - * Donne la valeur d'un parametre par introspection - * - * @param name le nom du parametre - * @param rule the rule to inspect - * @return la valeur courante du parametre - * @throws IsisFishException if any exception - */ - static public Object getParameterValue(Rule rule, String name) throws IsisFishException { - if (rule == null || name == null || "".equals(name)) { - return null; - } - try { - String fieldName = PARAM_PREFIX + name; - Field field = rule.getClass().getDeclaredField(fieldName); - return field.get(rule); - } catch (IllegalAccessException eee) { - throw new IsisFishException("Can't get rule parameter: " + name, eee); - } catch (NoSuchFieldException eee) { - throw new IsisFishException("Can't get rule parameter: " + name, eee); - } - } - - /** - * Modifie la valeur d'un attribut par introspection. - * - * @param name le nom de l'attribut - * @param value la valeur de l'attribut - * @param rule the rule to inspect - * @throws IsisFishException if any exception - */ - static public void setParameterValue(Rule rule, String name, Object value) throws IsisFishException { - try { - String fieldName = PARAM_PREFIX + name; - Field field = rule.getClass().getDeclaredField(fieldName); - field.set(rule, value); - } catch (IllegalAccessException eee) { - throw new IsisFishException("Can't modify rule parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee); - } catch (NoSuchFieldException eee) { - throw new IsisFishException("Can't modify rule parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee); - } catch (IllegalArgumentException eee) { - throw new IsisFishException("Can't modify rule parameter: " + name + " with '" + value + "'(" + ObjectUtils.identityToString(value) + ")", eee); - } - } - - /** - * Recupere les parametres et leur valeur pour les retourner sous forme - * de chaine. Pour pouvoir par exemple les afficher a l'utilisateur. - * - * @param rule the rule to inspect - * @return a string representation of parameters and their values for - * a given rule - * @throws IsisFishException if any exception - */ - public static String getParamAsString(Rule rule) throws IsisFishException { - StringBuffer result = new StringBuffer(); - - for (String name : getParameterNames(rule).keySet()) { - Object value = getParameterValue(rule, name); - - result.append(name).append(" : ").append(value); - result.append("\n"); - } - return result.toString(); - } - static public void checkout() throws VCSException { checkout(IsisFish.config.getDatabaseDirectory(), RULE_PATH); } @@ -332,52 +204,6 @@ } /** - * @return the @Doc of the underlied rule class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getClassDoc() { - Doc result=null; - try { - Class klazz = getCodeClass(); - result = DocHelper.getClassDoc(klazz); - } catch (IsisFishException e) { - log.warn(_("isisfish.error.not.found.code",this)); - } - return result; - } - - /** - * @param fieldName name of the field to inspect - * @return the @Doc of the given field of the underlied Rule class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getFieldDoc(String fieldName) { - Doc result=null; - try { - Class klazz = getCodeClass(); - result = DocHelper.getFieldDoc(klazz,fieldName); - } catch (Exception e) { - log.warn(_("isisfish.error.not.found.field",fieldName,this)); - } - return result; - } - - /** - * @param paramName the name of the param to inspect - * @return the doc associated with the param, - * (says the field PARAM_PREFIX+fieldName) - */ - public Doc getParamDoc(String paramName) { - Doc doc; - doc = getFieldDoc(PARAM_PREFIX + paramName); - return doc; - } - - /** * <b>Be ware this method require to instanciate a Rule, so * it would be better to call as often as possible.</b> * @@ -386,10 +212,10 @@ * @see Docable */ public String getDescription() { - String result=null; + String result = null; try { Rule rule = getNewRuleInstance(); - result =rule == null ? null : rule.getDescription(); + result = rule == null ? null : rule.getDescription(); } catch (Exception e) { log.warn(_("isisfish.error.not.found.description",this)); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -25,24 +25,16 @@ package fr.ifremer.isisfish.datastore; -import fr.ifremer.isisfish.IsisFishException; -import fr.ifremer.isisfish.IsisFishRuntimeException; -import fr.ifremer.isisfish.IsisFish; -import fr.ifremer.isisfish.util.DocHelper; -import fr.ifremer.isisfish.util.Doc; -import fr.ifremer.isisfish.util.Docable; -import fr.ifremer.isisfish.vcs.VCSException; - -import static org.nuiton.i18n.I18n._; - -import org.apache.commons.collections.map.ReferenceMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import java.io.File; import java.util.List; import java.util.Map; +import org.apache.commons.collections.map.ReferenceMap; + +import fr.ifremer.isisfish.IsisFish; +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.vcs.VCSException; + /** * Gestion des fichers CVS de type scripts (appartenant au module scripts). * @@ -54,11 +46,8 @@ * Last update: $Date$ * by : $Author$ */ -public class ScriptStorage extends JavaSourceStorage implements Docable { +public class ScriptStorage extends JavaSourceStorage { - /** to use log facility, just put in your code: log.info(\"...\"); */ - private static Log log = LogFactory.getLog(ScriptStorage.class); - public static final String SCRIPT_PATH = "scripts"; /** Template freemarker pour les scripts. */ @@ -197,52 +186,4 @@ result.removeAll(getScriptNames()); return result; } - - /** - * @return the @Doc of the underlied rule class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getClassDoc() { - Doc result=null; - try { - Class<?> klazz = getCodeClass(); - result = DocHelper.getClassDoc(klazz); - } catch (IsisFishException e) { - log.warn(_("isisfish.error.not.found.code",this)); - } - return result; - } - - /** - * @param fieldName name of the field to inspect - * @return the @Doc of the given field of the underlied Rule class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getFieldDoc(String fieldName) { - Doc result=null; - try { - Class<?> klazz = getCodeClass(); - result = DocHelper.getFieldDoc(klazz,fieldName); - } catch (Exception e) { - log.warn(_("isisfish.error.not.found.field",fieldName,this)); - } - return result; - } - - - /** - * <b>Be ware this method require to instanciate a Rule, so - * it would be better to call as often as possible.</b> - * - * @return the descript of the instanciate AnalysePlan - * @see Doc - * @see Docable - */ - public String getDescription() { - throw new IsisFishRuntimeException(_("isisfish.error.not.support.class",this)); - } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityExportStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityExportStorage.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityExportStorage.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -53,9 +53,6 @@ */ public class SensitivityExportStorage extends ExportStorage implements Docable { - /** Class logger. */ - private static Log log = LogFactory.getLog(SensitivityExportStorage.class); - public static final String SENSITIVITY_EXPORT_PATH = "sensitivityexports"; /** Template freemarker pour les scripts d'export . */ Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -25,26 +25,22 @@ package fr.ifremer.isisfish.datastore; -import fr.ifremer.isisfish.IsisFishException; -import fr.ifremer.isisfish.IsisFish; -import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator; -import fr.ifremer.isisfish.util.Doc; -import fr.ifremer.isisfish.util.DocHelper; -import fr.ifremer.isisfish.util.Docable; -import fr.ifremer.isisfish.vcs.VCSException; - import static org.nuiton.i18n.I18n._; +import java.io.File; +import java.util.List; +import java.util.Map; + import org.apache.commons.collections.map.ReferenceMap; -import org.apache.commons.lang.ObjectUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.io.File; -import java.lang.reflect.Field; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import fr.ifremer.isisfish.IsisFish; +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator; +import fr.ifremer.isisfish.util.Doc; +import fr.ifremer.isisfish.util.Docable; +import fr.ifremer.isisfish.vcs.VCSException; /** * Cette class permet de stocker les fichiers de calculateur de sensibilité. @@ -57,7 +53,7 @@ * @version $Revision$ * Last update: $Date$ by : $Author$ */ -public class SensitivityStorage extends JavaSourceStorage implements Docable { // SensitivityStorage +public class SensitivityStorage extends JavaSourceStorage { // SensitivityStorage /** to use log facility, just put in your code: log.info(\"...\"); */ private static Log log = LogFactory.getLog(SensitivityStorage.class); @@ -161,144 +157,6 @@ } /** - * Permet de recuperer les parametres du calculateur. - * - * @return Une map contenant le nom du parametre et son type - * @throws IsisFishException s'il est impossible de retourner une map - * convenable - */ - public Map<String, Class<?>> getParameterNames() throws IsisFishException { - Map<String, Class<?>> result = null; - // On essai de recuperer les paramètres depuis la classe compilé - // si c possible - try { - if (0 == compile(false, null)) { - SensitivityCalculator calculator = getNewSensitivityInstance(); - result = SensitivityStorage.getParameterNames(calculator); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error(_("isisfish.error.source.parameter"), eee); - } - } - // si on ne reussi pas avec la classe compilé on essai en parsant le - // source - if (result == null) { - try { - //String code = getContent(); - log.fatal("FIXME a faire recherche des parametres dans le source"); - throw new IsisFishException( - _("isisfish.error.source.parameter")); - // TODO implanter la recherche des parametres. - // Se sont les attributs commencant par 'param_' et ils doivent - // etre public non static, non transient. - // ex: public Date param_Date. - // Lorsqu'on ajoute un champs dans la map il ne faut pas mettre - // le prefix param. - } catch (Exception eee) { - throw new IsisFishException( - _("isisfish.error.source.parameter"), eee); - } - } - return result; - } - - /** - * Recherche par introspection tous les parametres de la classe - * commencant par {@link #PARAM_PREFIX}. - * - * @param calculator le calculateur dont on souhaite les infos de parametre - * @return retourne le nom et le type des parametres du calculateur - */ - public static Map<String, Class<?>> getParameterNames( - SensitivityCalculator calculator) { - Map<String, Class<?>> result = new LinkedHashMap<String, Class<?>>(); - for (Field field : calculator.getClass().getFields()) { - if (field.getName().startsWith(PARAM_PREFIX)) { - result.put(field.getName().substring(PARAM_PREFIX.length()), - field.getType()); - } - } - return result; - } - - /** - * Donne la valeur d'un parametre par introspection. - * - * @param name le nom du parametre - * @param calculator le calculateur dont on souhaite la valeur du parametre - * @return la valeur courante du parametre - * @throws IsisFishException s'il y a un probleme pour recuperer la valeur - */ - public static Object getParameterValue(SensitivityCalculator calculator, - String name) throws IsisFishException { - if (calculator == null || name == null || "".equals(name)) { - return null; - } - try { - String fieldName = PARAM_PREFIX + name; - Field field = calculator.getClass().getDeclaredField(fieldName); - return field.get(calculator); - } catch (IllegalAccessException eee) { - throw new IsisFishException("Can't get plan parameter: " + name, - eee); - } catch (NoSuchFieldException eee) { - throw new IsisFishException("Can't get plan parameter: " + name, - eee); - } - } - - /** - * Modifie la valeur d'un attribut pas introspection. - * - * @param name le nom de l'attribut - * @param value la valeur de l'attribut - * @param calculator le calculator dont on souhaite modifier la valeur de parametre - * @throws IsisFishException s'il y a un probleme - */ - public static void setParameterValue(SensitivityCalculator calculator, - String name, Object value) throws IsisFishException { - try { - String fieldName = PARAM_PREFIX + name; - Field field = calculator.getClass().getDeclaredField(fieldName); - field.set(calculator, value); - } catch (IllegalAccessException eee) { - throw new IsisFishException("Can't modify plan parameter: " + name - + " with '" + value + "'(" - + ObjectUtils.identityToString(value) + ")", eee); - } catch (NoSuchFieldException eee) { - throw new IsisFishException("Can't modify plan parameter: " + name - + " with '" + value + "'(" - + ObjectUtils.identityToString(value) + ")", eee); - } catch (IllegalArgumentException eee) { - throw new IsisFishException("Can't modify plan parameter: " + name - + " with '" + value + "'(" - + ObjectUtils.identityToString(value) + ")", eee); - } - } - - /** - * Recupere les paramètres et leur valeur pour les retourner sous forme - * de chaine. Pour pouvoir par exemple les afficher à l'utilisateur. - * - * @param calculator le calculateur dont on souhaite la valeur du parametre en string - * @return la valeur sous forme de string - * @throws IsisFishException - */ - public static String getParamAsString(SensitivityCalculator calculator) - throws IsisFishException { - StringBuffer result = new StringBuffer(); - - for (String name : getParameterNames(calculator).keySet()) { - Object value = getParameterValue(calculator, name); - - result.append(name).append(" : ").append(value); - result.append("\n"); - } - return result.toString(); - } - - /** * Effectue un chekout VCS sur le répertoire des calculateurs. * * @see VersionStorage#checkout(File, String) @@ -351,54 +209,6 @@ } /** - * @return the @Doc of the underlied {@link SensitivityCalculator} class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getClassDoc() { - Doc result = null; - try { - Class<?> klazz = getCodeClass(); - result = DocHelper.getClassDoc(klazz); - } catch (IsisFishException e) { - if (log.isWarnEnabled()) { - log.warn(_("isisfish.error.not.found.code", this)); - } - } - return result; - } - - /** - * @param fieldName name of the field to inspect - * @return the @Doc of the given field of the underlied {@link SensitivityCalculator} class - * @see DocHelper - * @see Doc - * @see Docable - */ - public Doc getFieldDoc(String fieldName) { - Doc result = null; - try { - Class<?> klazz = getCodeClass(); - result = DocHelper.getFieldDoc(klazz, fieldName); - } catch (Exception e) { - log.warn(_("isisfish.error.not.found.field", fieldName, this)); - } - return result; - } - - /** - * @param paramName the name of the param to inspect - * @return the doc associated with the param, - * (says the field {@link #PARAM_PREFIX} + fieldName) - */ - public Doc getParamDoc(String paramName) { - Doc doc; - doc = getFieldDoc(PARAM_PREFIX + paramName); - return doc; - } - - /** * <b>Be ware this method require to instanciate a AnalysePlan, so * it would be better to call as often as possible.</b> * @@ -406,6 +216,7 @@ * @see Doc * @see Docable */ + @Override public String getDescription() { String result = null; try { Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -0,0 +1,137 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ + +package fr.ifremer.isisfish.datastore; + +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.beanutils.ConvertUtilsBean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.persistence.TopiaEntity; + +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.util.ConverterUtil; + +/** + * Helper used to populate and extract instance parameters + * from simulation. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class StorageHelper { + + /** Class logger. */ + private static Log log = LogFactory.getLog(StorageHelper.class); + + /** + * Recupere dans prop les valeurs des champs specifique au export et met a + * jour les champs de l'export. + * + * @param instanceIndex l'index de l'instance + * @param instance l'instance a mettre à jour + * @param context le topia context dont on a besoin + * @param props les proprietes contenant les parametre de l'export + * @param propPrefix prefix des clés a prendre en compte dans {@code props} + */ + public static void populateStorageParams(int instanceIndex, TopiaContext context, + Object instance, Properties props, String propPrefix) { + //ConvertUtilsBean beanUtils = ConverterUtil.getConverter(region + // .getStorage()); + String exportName = JavaSourceStorage.getName(instance); + String paramTag = propPrefix + "." + instanceIndex + ".parameter."; + + for (Map.Entry<String, Class<?>> entry : JavaSourceStorage.getParameterNames(instance).entrySet()) { + String propName = entry.getKey(); + Class<?> type = entry.getValue(); + if (TopiaEntity.class.isAssignableFrom(type)) { + type = TopiaEntity.class; + } + String valueString = "not initialized"; + try { + valueString = props.getProperty(paramTag + propName); + + // ATTENTION il semblerait que notre intance de beanUtils + // soit ecrasé par celle du MatrixType ... + // a ne pas deplacer avant la boucle + ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context); + + Object value = beanUtils.convert(valueString, type); + if (log.isDebugEnabled()) { + log.debug("Set instance param: " + paramTag + + propName + " = " + value + "(" + valueString + ")"); + } + + JavaSourceStorage.setParameterValue(instance, propName, value); + } catch (Exception eee) { + if (log.isWarnEnabled()) { + log.info("Properties: " + props); + log.warn("Can't reload field " + propName + " for export " + + exportName + " with value " + valueString, eee); + } + } + } + } + + /** + * Permet de mettre les parametres d'un object Isis sous une forme String pour + * pouvoir les relire ensuite. + * + * @param instanceIndex l'index de la rule + * @param context le context + * @param instance La regle dont on souhaite mettre les parametres dans l'objet + * Properties retourne + * @param propPrefix prefix des clés a prendre en compte dans {@code props} + * @return L'objet Properties contenant les valeurs des parametres de l'instance + */ + public static Properties getParamsAsProperties(int instanceIndex, TopiaContext context, + Object instance, String propPrefix) { + Properties result = new Properties(); + ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context); + for (String paramName : RuleStorage.getParameterNames(instance).keySet()) { + String paramValueString; + try { + Object value = RuleStorage.getParameterValue(instance, paramName); + paramValueString = beanUtils.convert(value); + if (paramValueString != null) { + result.setProperty(propPrefix + "." + instanceIndex + ".parameter." + paramName, paramValueString); + } + } catch (IsisFishException eee) { + if (log.isWarnEnabled()) { + log.warn("Can't convert parameter value to String: " + paramName, eee); + } + } + } + + return result; + } +} Property changes on: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageHelper.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -30,7 +30,6 @@ import java.io.FileWriter; import java.io.Writer; import java.util.List; -import java.util.Map; import java.util.Properties; import org.apache.commons.beanutils.ConvertUtilsBean; @@ -38,11 +37,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.persistence.TopiaEntity; +import fr.ifremer.isisfish.IsisFishException; import fr.ifremer.isisfish.datastore.ExportStorage; import fr.ifremer.isisfish.datastore.SensitivityExportStorage; import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.datastore.StorageHelper; import fr.ifremer.isisfish.util.ConverterUtil; /** @@ -56,7 +56,7 @@ * Last update: $Date$ * by : $Author$ */ -public class ExportHelper { +public class ExportHelper extends StorageHelper { /** Class logger. */ private static Log log = LogFactory.getLog(ExportHelper.class); @@ -135,41 +135,21 @@ */ public static void populateSensitivityExport(int exportIndex, TopiaContext context, SensitivityExport export, Properties props) { - //ConvertUtilsBean beanUtils = ConverterUtil.getConverter(region - // .getStorage()); - String exportName = SensitivityExportStorage.getName(export); - String paramTag = "sensitivityexport." + exportIndex + ".parameter."; - - for (Map.Entry<String, Class<?>> entry : SensitivityExportStorage - .getParameterNames(export).entrySet()) { - String propName = entry.getKey(); - Class<?> type = entry.getValue(); - if (TopiaEntity.class.isAssignableFrom(type)) { - type = TopiaEntity.class; - } - String valueString = "not initialized"; - try { - valueString = props.getProperty(paramTag + propName); - - // ATTENTION il semblerait que notre intance de beanUtils - // soit ecrasé par celle du MatrixType ... - // a ne pas deplacer avant la boucle - ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context); - - Object value = beanUtils.convert(valueString, type); - if (log.isDebugEnabled()) { - log.debug("Set sensitivityexport param: " + paramTag + - propName + " = " + value + "(" + valueString + ")"); - } - - SensitivityExportStorage.setParameterValue(export, propName, value); - } catch (Exception eee) { - if (log.isWarnEnabled()) { - log.info("Properties: " + props); - log.warn("Can't reload field " + propName + " for export " - + exportName + " with value " + valueString, eee); - } - } - } + populateStorageParams(exportIndex, context, export, props, "sensitivityexport"); } + + /** + * Permet de mettre les parametres de l'export sous une forme String pour + * pouvoir les relire ensuite. + * + * @param sensitivityExportIndex l'index de l'export + * @param context le topia context dont on a besoin + * @param sensitivityExport l'export dont on souhaite mettre les parametres dans l'objet + * Properties retourné + * @return L'objet Properties contenant les valeurs des parametres de l'export + */ + public static Properties getSensitivityExportAsProperties( + int sensitivityExportIndex, TopiaContext context, SensitivityExport sensitivityExport) { + return getParamsAsProperties(sensitivityExportIndex, context, sensitivityExport, "sensitivityexport"); + } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -25,19 +25,14 @@ package fr.ifremer.isisfish.rule; -import java.util.Map; import java.util.Properties; -import org.apache.commons.beanutils.ConvertUtilsBean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.persistence.TopiaEntity; -import fr.ifremer.isisfish.IsisFishException; import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.datastore.RuleStorage; -import fr.ifremer.isisfish.util.ConverterUtil; +import fr.ifremer.isisfish.datastore.StorageHelper; /** * Helper pour effectuer des manipulations sur les règles. @@ -55,7 +50,7 @@ * Last update: $Date$ * by : $Author$ */ -public class RuleHelper { +public class RuleHelper extends StorageHelper { /** Logger for this class. */ private static final Log log = LogFactory.getLog(RuleHelper.class); @@ -88,41 +83,7 @@ * @param props les propriétés contenant les paramètres de la règle */ public static void populateRule(int ruleIndex, TopiaContext context, Rule rule, Properties props) { - String ruleName = RuleStorage.getName(rule); - String paramTag = "rule." + ruleIndex + ".parameter."; - - for (Map.Entry<String, Class<?>> entry : RuleStorage.getParameterNames(rule).entrySet()) { - String propName = entry.getKey(); - Class<?> type = entry.getValue(); - if (TopiaEntity.class.isAssignableFrom(type)) { - type = TopiaEntity.class; - } - String valueString = "not initialized"; - try { - valueString = props.getProperty(paramTag + propName); - - if (log.isDebugEnabled()) { - log.debug("About to convert rule param: " + paramTag + propName + " = " + valueString); - } - - // ATTENTION il semblerait que notre intance de beanUtils - // soit ecrasé par celle du MatrixType ... - // a ne pas deplacer avant la boucle - ConvertUtilsBean beanUtils = ConverterUtil - .getConverter(context); - Object value = beanUtils.convert(valueString, type); - - if (log.isDebugEnabled()) { - log.debug("Set rule param: " + paramTag + propName + " = " + value + "(" + valueString + ")"); - } - RuleStorage.setParameterValue(rule, propName, value); - } catch (Exception eee) { - if (log.isWarnEnabled()) { - log.info("Properties: " + props); - log.warn("Can't reload field " + propName + " for rule " + ruleName + " with value " + valueString, eee); - } - } - } + populateStorageParams(ruleIndex, context, rule, props, "rule"); } /** @@ -137,23 +98,6 @@ * regle */ public static Properties getRuleAsProperties(int ruleIndex, TopiaContext context, Rule rule) { - Properties result = new Properties(); - ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context); - for (String paramName : RuleStorage.getParameterNames(rule).keySet()) { - String paramValueString; - try { - Object value = RuleStorage.getParameterValue(rule, paramName); - paramValueString = beanUtils.convert(value); - if (paramValueString != null) { - result.setProperty("rule." + ruleIndex + ".parameter." + paramName, paramValueString); - } - } catch (IsisFishException eee) { - if (log.isWarnEnabled()) { - log.warn("Can't convert parameter value to String: " + paramName, eee); - } - } - } - - return result; + return getParamsAsProperties(ruleIndex, context, rule, "rule"); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -60,6 +60,7 @@ import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.datastore.SensitivityExportStorage; import fr.ifremer.isisfish.datastore.SensitivityStorage; +import fr.ifremer.isisfish.datastore.StorageHelper; import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationDAO; import fr.ifremer.isisfish.entities.Strategy; @@ -294,206 +295,6 @@ return result; } - /** - * Permet de mettre les parametres de la regle sous une forme String pour - * pouvoir les relire ensuite. - * - * @param ruleIndex l'index de la rule - * @param rule La regle dont on souhaite mettre les parametres dans l'objet - * Properties retourne - * @return L'objet Properties contenant les valeurs des parametres de la - * regle - */ - protected Properties ruleParametertoProperties(int ruleIndex, Rule rule) { - Properties result = new Properties(); - ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion() - .getStorage()); - for (String paramName : RuleStorage.getParameterNames(rule).keySet()) { - String paramValueString; - try { - Object value = RuleStorage.getParameterValue(rule, paramName); - paramValueString = beanUtils.convert(value); - if (paramValueString != null) { - result.setProperty("rule." + ruleIndex + ".parameter." + paramName, paramValueString); - } - } catch (IsisFishException eee) { - if (log.isWarnEnabled()) { - log.warn("Can't convert parameter value to String: " + paramName, eee); - } - } - } - - return result; - } - - /** - * Permet de mettre les parametres de l'export sous une forme String pour - * pouvoir les relire ensuite. - * - * @param sensitivityExportIndex l'index de l'export - * @param sensitivityExport l'export dont on souhaite mettre les parametres dans l'objet - * Properties retourné - * @return L'objet Properties contenant les valeurs des parametres de l'export - */ - protected Properties sensitivityExportParametertoProperties( - int sensitivityExportIndex, SensitivityExport sensitivityExport) { - Properties result = new Properties(); - ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion().getStorage()); - for (String paramName : SensitivityExportStorage.getParameterNames(sensitivityExport).keySet()) { - try { - Object value = SensitivityExportStorage.getParameterValue( - sensitivityExport, paramName); - String paramValueString = beanUtils.convert(value); - if (paramValueString != null) { - result.setProperty("sensitivityexport." - + sensitivityExportIndex + ".parameter." - + paramName, paramValueString); - } - } catch (IsisFishException eee) { - if (log.isWarnEnabled()) { - log.warn("Can't convert parameter value to String: " - + paramName, eee); - } - } - } - - return result; - } - - /** - * Permet de mettre les parametres du calculateur sous une forme String pour - * pouvoir les relire ensuite. - * - * @param sensitivityIndex l'index du calculateur de sensitivity - * @param calculator Le calculateurdont on souhaite mettre les parametres dans l'objet - * Properties retourne - * @return L'objet Properties contenant les valeurs des parametres du calculateur de sensibilité - */ - protected Properties sensitivityCalculatorParametertoProperties( - int sensitivityIndex, SensitivityCalculator calculator) { - Properties result = new Properties(); - ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion().getStorage()); - for (String paramName : SensitivityStorage.getParameterNames(calculator).keySet()) { - try { - Object value = SensitivityStorage.getParameterValue(calculator, - paramName); - String paramValueString = beanUtils.convert(value); - if (paramValueString != null) { - result.setProperty("sensitivity." + sensitivityIndex + ".parameter." + paramName, paramValueString); - } - } catch (IsisFishException eee) { - if (log.isWarnEnabled()) { - log.warn("Can't convert parameter value to String: " - + paramName, eee); - } - } - } - - return result; - } - - /** - * Permet de mettre les parametres du plan sous une forme String pour - * pouvoir les relire ensuite. - * - * @param planIndex l'index du plan - * @param plan Le plan dont on souhaite mettre les parametres dans l'objet - * Properties retourne - * @return L'objet Properties contenant les valeurs des parametres du plan - */ - protected Properties planParametertoProperties(int planIndex, - AnalysePlan plan) { - Properties result = new Properties(); - ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion().getStorage()); - for (String paramName : AnalysePlanStorage.getParameterNames(plan).keySet()) { - try { - Object value = AnalysePlanStorage.getParameterValue(plan,paramName); - String paramValueString = beanUtils.convert(value); - if (paramValueString != null) { - result.setProperty("plan." + planIndex + ".parameter." - + paramName, paramValueString); - } - } catch (IsisFishException eee) { - if (log.isWarnEnabled()) { - log.warn("Can't convert parametre value to String: " - + paramName, eee); - } - } - } - - return result; - } - - /** - * Recupere dans prop les valeurs des champs specifique au plan et met a - * jour les champs du plan. - * - * @param planIndex l'index du plan - * @param plan le plan dont les parametres doivent etre lu depuis les - * proprietes - * @param props les proprietes contenant les parametre du plan - */ - protected void populateAnalysePlan(int planIndex, AnalysePlan plan, - Properties props) { - ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion() - .getStorage()); - String planName = AnalysePlanStorage.getName(plan); - String paramTag = "plan." + planIndex + ".parameter."; - - for (Map.Entry<String, Class<?>> entry : AnalysePlanStorage.getParameterNames(plan).entrySet()) { - String propName = entry.getKey(); - Class<?> type = entry.getValue(); - if (TopiaEntity.class.isAssignableFrom(type)) { - type = TopiaEntity.class; - } - String valueString = props.getProperty(paramTag + propName); - Object value = beanUtils.convert(valueString, type); - try { - AnalysePlanStorage.setParameterValue(plan, propName, value); - } catch (IsisFishException eee) { - if (log.isWarnEnabled()) { - log.warn("Can't reload field " + propName + " for plan " - + planName, eee); - } - } - } - } - - /** - * Recupere dans prop les valeurs des champs specifique au calculateur de - * sensibilité et met a jour les champs du calculateur. - * - * @param calculatorIndex l'index du calculateur - * @param calculator le calculateur dont les parametres doivent etre lu depuis lesproprietes - * @param props les proprietes contenant les parametre du calculateur - */ - protected void populateSensitivityCalculator(int calculatorIndex, - SensitivityCalculator calculator, Properties props) { - ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion() - .getStorage()); - String calculatorName = SensitivityStorage.getName(calculator); - String paramTag = "sensitivity." + calculatorIndex + ".parameter."; - - for (Map.Entry<String, Class<?>> entry : SensitivityStorage.getParameterNames(calculator).entrySet()) { - String propName = entry.getKey(); - Class<?> type = entry.getValue(); - if (TopiaEntity.class.isAssignableFrom(type)) { - type = TopiaEntity.class; - } - String valueString = props.getProperty(paramTag + propName); - Object value = beanUtils.convert(valueString, type); - try { - SensitivityStorage.setParameterValue(calculator, propName, value); - } catch (IsisFishException eee) { - if (log.isWarnEnabled()) { - log.warn("Can't reload field " + propName - + " for sensitivity calculator " + calculatorName, - eee); - } - } - } - } - /* * @see fr.ifremer.isisfish.simulator.SimulationParameter#getExtraRules() */ @@ -692,7 +493,8 @@ AnalysePlan plan = AnalysePlanStorage .getAnalysePlan(name) .getNewAnalysePlanInstance(); - populateAnalysePlan(planIndex++, plan, propertiesParameters); + StorageHelper.populateStorageParams(planIndex++, + getRegion().getStorage(), plan, propertiesParameters, "plan"); analysePlans.add(plan); } catch (IsisFishException eee) { if (log.isWarnEnabled()) { @@ -955,7 +757,8 @@ SensitivityStorage sensitivityStorage = SensitivityStorage.getSensitivity(calculatorName); sensitivityCalculator = sensitivityStorage.getNewSensitivityInstance(); // 0 = only single sensitivity - populateSensitivityCalculator(0, sensitivityCalculator, propertiesParameters); + StorageHelper.populateStorageParams(0, getRegion().getStorage(), sensitivityCalculator, + propertiesParameters, "sensitivity"); } catch (IsisFishException eee) { sensitivityCalculator = null; if (log.isWarnEnabled()) { @@ -1700,7 +1503,7 @@ int ruleIndex = 0; for (Rule rule : getRules()) { ruleList += RuleStorage.getName(rule) + ","; - Properties ruleProp = ruleParametertoProperties(ruleIndex++, rule); + Properties ruleProp = RuleHelper.getRuleAsProperties(ruleIndex++, getRegion().getStorage(), rule); result.putAll(ruleProp); } result.setProperty("rules", ruleList); @@ -1724,7 +1527,8 @@ int planIndex = 0; for (AnalysePlan plan : getAnalysePlans()) { planList += AnalysePlanStorage.getName(plan) + ","; - Properties planProp = planParametertoProperties(planIndex++, plan); + Properties planProp = StorageHelper.getParamsAsProperties(planIndex++, + getRegion().getStorage(), plan, "plan"); result.putAll(planProp); } result.setProperty("plans", planList); @@ -1760,8 +1564,8 @@ result.setProperty("sensitivitycalculator", calculatorName); // calculator parameter - Properties calculatorParams = sensitivityCalculatorParametertoProperties( - 0, getSensitivityCalculator()); + Properties calculatorParams = StorageHelper.getParamsAsProperties(0, + getRegion().getStorage(), getSensitivityCalculator(), "sensitivity"); result.putAll(calculatorParams); } else { if (propertiesParameters != null @@ -1783,8 +1587,8 @@ for (SensitivityExport sensitivityExport : getSensitivityExport()) { sensitivityExportList += SensitivityExportStorage .getName(sensitivityExport) + ","; - Properties exportProp = sensitivityExportParametertoProperties( - sensitivityExportIndex++, sensitivityExport); + Properties exportProp = ExportHelper.getSensitivityExportAsProperties( + sensitivityExportIndex++, getRegion().getStorage(), sensitivityExport); result.putAll(exportProp); } result.setProperty("sensitivityexports", sensitivityExportList); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2011-06-17 13:55:14 UTC (rev 3420) @@ -83,22 +83,23 @@ } protected void sensCalculatorChanged() { - - // TODO change combo box content + + String sensitivityName = (String)fieldSensitivityCalculatorSelect.getSelectedItem(); + // when calculator is changed by refreshSelectedSensitivityCalculator // this event is thrown by build a new Calculator instance // and parameter are lost + // fix it with a small class name test + SensitivityCalculator sensivitityCalculator = getSimulAction().getSensitivityCalculator(); + if (sensivitityCalculator != null && sensivitityCalculator.getClass().getSimpleName().equals(sensitivityName)) { + sensivitityCalculator = getSimulAction().getSensitivityCalculator(); + } else { + sensivitityCalculator = getSimulAction().getSensivitityCalculatorInstance(sensitivityName); + } - String sensitivityName = (String)fieldSensitivityCalculatorSelect.getSelectedItem(); - SensitivityCalculator sensivitityCalculator = getSimulAction().getSensivitityCalculatorInstance(sensitivityName); - // can be null for example if calculator can't be compiled if (sensivitityCalculator != null) { getSimulAction().setSensitivityCalculator(sensivitityCalculator); - - // enable/disable table (if sensivitityCalculator can manage it) - //factorCardinalityScrollPane.setVisible(!sensivitityCalculator.canManageCardinality()); - //validate(); CardLayout factorPanelLayout = (CardLayout)factorCardinalityPanel.getLayout(); if (sensivitityCalculator.canManageCardinality()) { @@ -106,10 +107,8 @@ } else { factorPanelLayout.show(factorCardinalityPanel, "factorCardinalityNotSupported"); } - // update model - //setSensitivityCalculatorParamsModel(); SensitivityCalculatorParametersTableModel parametersTableModel = new SensitivityCalculatorParametersTableModel(sensivitityCalculator); simulSensitivityCalculatorParam.setModel(parametersTableModel); simulSensitivityCalculatorParam.getColumnModel().getColumn(0).setCellRenderer(new SensitivityCalculatorParametersTableCellRenderer(sensivitityCalculator)); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Doc.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Doc.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Doc.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin + * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/DocHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/DocHelper.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/DocHelper.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -1,140 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2007 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin - * %% - * 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, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.util; - -import static org.nuiton.i18n.I18n._; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.lang.reflect.Field; - -/** - * Class containing usefull methods to obtain @Doc informations - * for a class,field,method... - * - * @author chemit - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class DocHelper { - - /** Logger for this class */ - private static final Log log = LogFactory.getLog(DocHelper.class); - - /** - * @param klazz class to use - * @return the @Doc associated with the class of null if klazz is null or - * there is no Doc for this klazz - */ - public static Doc getClassDoc(Class<?> klazz) { - return klazz == null ? null : klazz.getAnnotation(Doc.class); - } - - /** - * @param value object given - * @return the @Doc associated to the class of the given object, or null if value is - * null or no doc found for his class - * - * @deprecated as of 20090408 never used - */ - public static Doc getClassDoc(Object value) { - return value == null ? null : getClassDoc(value.getClass()); - } - - /** - * @param f file to use - * @return the @Doc associated to the field, or null - * if field is null of no @doc found - * - * @deprecated as of 20090408 never used - */ - public static Doc getFieldDoc(Field f) { - return f == null ? null : f.getAnnotation(Doc.class); - } - - /** - * @param klazz class to use - * @param fieldName field name to use - * @return the @Doc associated with e filed of the given class, - * or null if class is null, field does not exist, or no - * Doc for the field - */ - public static Doc getFieldDoc(Class<?> klazz, String fieldName) { - Field f = null; - try { - f = klazz == null ? null : klazz.getField(fieldName); - } catch (NoSuchFieldException e) { - // should never appear - log.warn(_("isisfish.error.not.found.field.class", fieldName, - klazz)); - //throw new IsisFishRuntimeException(e); - } - return f == null ? null : f.getAnnotation(Doc.class); - } - - /** - * @param doc doc to use - * @return the {@link Doc#value()} of the given @Doc - * - * @deprecated as of 20090408 never used - */ - public static String getValue(Doc doc) { - return doc == null ? "" : doc.value(); - } - - /** - * @param doc doc to use - * @return the {@link Doc#author()}} of the given @Doc - * - * @deprecated as of 20090408 never used - */ - public static String getAuthor(Doc doc) { - return doc == null ? "" : doc.author(); - } - - /** - * @param doc doc to use - * @return the {@link Doc#date()} of the given @Doc - * - * @deprecated as of 20090408 never used - */ - public static String getDate(Doc doc) { - return doc == null ? "" : doc.date(); - } - - /** - * @param doc doc to use - * @return the {@link Doc#version()} of the given @Doc - * - * @deprecated as of 20090408 never used - */ - public static String getVersion(Doc doc) { - return doc == null ? "" : doc.version(); - } -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Docable.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Docable.java 2011-06-17 12:13:36 UTC (rev 3419) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Docable.java 2011-06-17 13:55:14 UTC (rev 3420) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin + * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -30,7 +30,6 @@ * * @author chemit * @see Doc - * @see DocHelper * @version $Revision$ * * Last update : $Date$ @@ -39,13 +38,6 @@ public interface Docable { /** - * Class documentation (if any). - * - * @return the @Doc of the class, or null if none - */ - Doc getClassDoc(); - - /** * Field documentation (if any). * * @param fieldName name of the field to use
participants (1)
-
chatellier@users.labs.libre-entreprise.org