Thread: [Ejtools-cvs] CVS: libraries/xdoclet/src/main/xdoclet/beans BeanInfoSubTask.java,1.1,1.2 I18NSubTask
Brought to you by:
letiemble
From: Laurent E. <let...@us...> - 2002-05-29 20:29:27
|
Update of /cvsroot/ejtools/libraries/xdoclet/src/main/xdoclet/beans In directory usw-pr-cvs1:/tmp/cvs-serv9033/xdoclet/src/main/xdoclet/beans Modified Files: BeanInfoSubTask.java I18NSubTask.java JavaBeanDocletTask.java Log Message: Final implementation of JavaBean BeanInfo generation. Index: BeanInfoSubTask.java =================================================================== RCS file: /cvsroot/ejtools/libraries/xdoclet/src/main/xdoclet/beans/BeanInfoSubTask.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BeanInfoSubTask.java 24 May 2002 21:05:39 -0000 1.1 --- BeanInfoSubTask.java 29 May 2002 20:29:24 -0000 1.2 *************** *** 1,40 **** ! package xdoclet.beans; ! ! import xdoclet.TemplateSubTask; ! import xdoclet.XDocletException; ! import xdoclet.template.TemplateException; ! import xdoclet.template.TemplateEngine; ! import xdoclet.util.Log; ! import xdoclet.util.Translator; ! ! import java.io.File; ! import java.io.IOException; ! import java.text.MessageFormat; ! import java.util.*; ! ! import org.apache.log4j.Category; ! ! public class BeanInfoSubTask extends TemplateSubTask ! { ! public final static String SUBTASK_NAME = "beaninfo"; ! ! private static String DEFAULT_TEMPLATE_FILE = "/xdoclet/beans/beaninfo.j"; ! private static String GENERATED_FILE_NAME = "{0}BeanInfo.java"; ! ! public BeanInfoSubTask() ! { ! setTemplateURL( getClass().getResource( DEFAULT_TEMPLATE_FILE ) ); ! setDestinationFile( GENERATED_FILE_NAME ); ! setHavingClassTag( "beaninfo:class" ); ! } ! ! public String getSubTaskName() ! { ! return SUBTASK_NAME; ! } ! ! protected void engineStarted() throws XDocletException ! { ! System.out.println( Translator.getString( "xdoclet.beans.Messages", "generating_beaninfo", new String[]{super.getCurrentClass().qualifiedName() + "BeanInfo.java"} ) ); ! } ! } --- 1,86 ---- ! package xdoclet.beans; ! ! import java.io.File; ! import java.io.IOException; ! import java.text.MessageFormat; ! ! import org.apache.log4j.Category; ! ! import xdoclet.TemplateSubTask; ! import xdoclet.XDocletException; ! import xdoclet.template.TemplateEngine; ! import xdoclet.template.TemplateException; ! import xdoclet.util.Log; ! import xdoclet.util.Translator; ! ! /** ! * Description of the Class ! * ! * @author laurent ! * @created 26 mai 2002 ! */ ! public class BeanInfoSubTask extends TemplateSubTask ! { ! /** Description of the Field */ ! protected boolean i18nGeneration = false; ! ! /** Description of the Field */ ! private static String DEFAULT_TEMPLATE_FILE = "/xdoclet/beans/beaninfo.j"; ! /** Description of the Field */ ! private static String GENERATED_FILE_NAME = "{0}BeanInfo.java"; ! /** Description of the Field */ ! public final static String SUBTASK_NAME = "beaninfo"; ! ! ! /** Constructor for the BeanInfoSubTask object */ ! public BeanInfoSubTask() ! { ! setDestinationFile(GENERATED_FILE_NAME); ! setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE)); ! setHavingClassTag("javabean:class"); ! } ! ! ! /** ! * Gets the subTaskName attribute of the BeanInfoSubTask object ! * ! * @return The subTaskName value ! */ ! public String getSubTaskName() ! { ! return SUBTASK_NAME; ! } ! ! ! /** ! * Gets the i18n attribute of the BeanInfoSubTask object ! * ! * @return The i18n value ! */ ! public boolean isI18n() ! { ! return i18nGeneration; ! } ! ! ! /** ! * Sets the i18n attribute of the BeanInfoSubTask object ! * ! * @param value The new i18n value ! */ ! public void setI18n(boolean value) ! { ! i18nGeneration = value; ! } ! ! ! /** ! * Description of the Method ! * ! * @exception XDocletException Description of the Exception ! */ ! protected void engineStarted() throws XDocletException ! { ! System.out.println(Translator.getString("xdoclet.beans.Messages", "generating_beaninfo", new String[]{super.getCurrentClass().qualifiedName() + "BeanInfo.java"})); ! } ! } Index: I18NSubTask.java =================================================================== RCS file: /cvsroot/ejtools/libraries/xdoclet/src/main/xdoclet/beans/I18NSubTask.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** I18NSubTask.java 24 May 2002 21:05:39 -0000 1.1 --- I18NSubTask.java 29 May 2002 20:29:24 -0000 1.2 *************** *** 1,65 **** ! package xdoclet.beans; ! ! import xdoclet.TemplateSubTask; ! import xdoclet.XDocletException; ! import xdoclet.template.TemplateException; ! import xdoclet.template.TemplateEngine; ! import xdoclet.util.Log; ! import xdoclet.util.Translator; ! ! import java.io.File; ! import java.io.IOException; ! import java.text.MessageFormat; ! import java.util.*; ! ! import org.apache.log4j.Category; ! ! public class I18NSubTask extends TemplateSubTask ! { ! public final static String SUBTASK_NAME = "i18n"; ! ! protected String locale; ! private static String DEFAULT_TEMPLATE_FILE = "/xdoclet/beans/i18n.j"; ! private static String GENERATED_FILE_NAME = "{0}BeanInfo"; ! private static String GENERATED_FILE_EXTENSION = ".properties"; ! ! public String getLocale() ! { ! return locale; ! } ! ! public void setLocale( String new_locale) ! { ! locale = new_locale; ! } ! ! public I18NSubTask() ! { ! setTemplateURL( getClass().getResource( DEFAULT_TEMPLATE_FILE ) ); ! setHavingClassTag( "beaninfo:class" ); ! } ! ! public String getSubTaskName() ! { ! return SUBTASK_NAME; ! } ! ! public void execute() throws XDocletException ! { ! if ((getLocale() == null) || ("".equals(getLocale()))) { ! setDestinationFile( GENERATED_FILE_NAME + GENERATED_FILE_EXTENSION ); ! } else { ! setDestinationFile( GENERATED_FILE_NAME + "_" + getLocale() + GENERATED_FILE_EXTENSION ); ! } ! startProcess(); ! } ! ! protected void engineStarted() throws XDocletException ! { ! if (locale == null) { ! System.out.println( Translator.getString( "xdoclet.beans.Messages", "generating_properties_default", new String[]{super.getCurrentClass().qualifiedName() + "BeanInfo"} ) ); ! } else { ! System.out.println( Translator.getString( "xdoclet.beans.Messages", "generating_properties", new String[]{super.getCurrentClass().qualifiedName() + "BeanInfo", getLocale()} ) ); ! } ! } ! } --- 1,65 ---- ! package xdoclet.beans; ! ! import java.io.File; ! import java.io.IOException; ! import java.text.MessageFormat; ! import java.util.Hashtable; ! ! import org.apache.log4j.Category; ! ! import xdoclet.ConfigParameter; ! import xdoclet.DocletContext; ! import xdoclet.SubTask; ! import xdoclet.TemplateSubTask; ! import xdoclet.XDocletException; ! import xdoclet.template.TemplateEngine; ! import xdoclet.template.TemplateException; ! import xdoclet.util.Log; ! import xdoclet.util.Translator; ! ! /** ! * Description of the Class ! * ! * @author laurent ! * @created 26 mai 2002 ! */ ! public class I18NSubTask extends TemplateSubTask ! { ! /** Description of the Field */ ! private static String DEFAULT_TEMPLATE_FILE = "/xdoclet/beans/i18n.j"; ! /** Description of the Field */ ! private static String GENERATED_FILE_NAME = "{0}BeanInfo.properties"; ! /** Description of the Field */ ! public final static String SUBTASK_NAME = "i18n"; ! ! ! /** Constructor for the I18NSubTask object */ ! public I18NSubTask() ! { ! setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE)); ! setDestinationFile(GENERATED_FILE_NAME); ! setHavingClassTag("javabean:class"); ! } ! ! ! /** ! * Gets the subTaskName attribute of the I18NSubTask object ! * ! * @return The subTaskName value ! */ ! public String getSubTaskName() ! { ! return SUBTASK_NAME; ! } ! ! ! /** ! * Description of the Method ! * ! * @exception XDocletException Description of the Exception ! */ ! protected void engineStarted() throws XDocletException ! { ! System.out.println(Translator.getString("xdoclet.beans.Messages", "generating_properties", new String[]{super.getCurrentClass().qualifiedName() + "BeanInfo"})); ! } ! } Index: JavaBeanDocletTask.java =================================================================== RCS file: /cvsroot/ejtools/libraries/xdoclet/src/main/xdoclet/beans/JavaBeanDocletTask.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JavaBeanDocletTask.java 24 May 2002 21:05:39 -0000 1.1 --- JavaBeanDocletTask.java 29 May 2002 20:29:24 -0000 1.2 *************** *** 1,39 **** ! package xdoclet.beans; ! ! import xdoclet.DocletTask; ! import xdoclet.doc.info.InfoSubTask; ! ! import java.util.Vector; ! ! public class JavaBeanDocletTask extends DocletTask ! { ! protected Vector tasks = new Vector(); ! ! public JavaBeanDocletTask() { ! } ! ! public BeanInfoSubTask createBeanInfo() ! { ! BeanInfoSubTask beaninfo = new BeanInfoSubTask(); ! tasks.add(beaninfo); ! ! return beaninfo; ! } ! ! public I18NSubTask createI18N() ! { ! I18NSubTask i18n = new I18NSubTask(); ! tasks.add(i18n); ! ! return i18n; ! } ! ! protected Vector getSubTasks() ! { ! Vector subtasks = super.getSubTasks(); ! ! subtasks.addAll(tasks); ! ! return subtasks; ! } ! } --- 1,66 ---- ! package xdoclet.beans; ! import java.util.Hashtable; ! import java.util.Vector; ! import xdoclet.DocletContext; ! ! import xdoclet.DocletTask; ! import xdoclet.SubTask; ! ! /** ! * Description of the Class ! * ! * @author laurent ! * @created 26 mai 2002 ! */ ! public class JavaBeanDocletTask extends DocletTask ! { ! /** Description of the Field */ ! protected Vector tasks = new Vector(); ! ! ! /** Constructor for the JavaBeanDocletTask object */ ! public JavaBeanDocletTask() { } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public BeanInfoSubTask createBeanInfo() ! { ! BeanInfoSubTask beaninfo = new BeanInfoSubTask(); ! tasks.add(beaninfo); ! ! return beaninfo; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public I18NSubTask createI18N() ! { ! I18NSubTask i18n = new I18NSubTask(); ! tasks.add(i18n); ! ! return i18n; ! } ! ! ! /** ! * Gets the subTasks attribute of the JavaBeanDocletTask object ! * ! * @return The subTasks value ! */ ! protected Vector getSubTasks() ! { ! Vector subtasks = super.getSubTasks(); ! ! subtasks.addAll(tasks); ! ! return subtasks; ! } ! } |