User: pathoss
Date: 02/05/12 06:13:24
Modified: modules/xdoclet/src/xdoclet/modules/i18n Tag:
MODULE_REFACTORING_BRANCH MessageBundleSubTask.java
Log:
Refactored. The thing compiles now :)
Revision Changes Path
No revision
No revision
1.1.2.3 +95 -99
xdoclet/modules/xdoclet/src/xdoclet/modules/i18n/Attic/MessageBundleSubTask.java
Index: MessageBundleSubTask.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/modules/xdoclet/src/xdoclet/modules/i18n/Attic/MessageBundleSubTask.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -w -r1.1.2.2 -r1.1.2.3
--- MessageBundleSubTask.java 8 May 2002 22:44:04 -0000 1.1.2.2
+++ MessageBundleSubTask.java 12 May 2002 13:13:24 -0000 1.1.2.3
@@ -4,47 +4,36 @@
*/
package xdoclet.modules.i18n;
-import xdoclet.TemplateSubTask;
-import xdoclet.XDocletException;
-import xdoclet.GenerationManager;
-import xdoclet.tagshandler.PackageTagsHandler;
-import xdoclet.template.TemplateException;
-
import java.io.File;
+import org.apache.log4j.Category;
+import xjavadoc.XClass;
import xjavadoc.XJavaDoc;
import xjavadoc.XJavaDocException;
import xjavadoc.XPackage;
-import xjavadoc.XClass;
-import org.apache.log4j.Category;
+import xdoclet.GenerationManager;
+
+import xdoclet.TemplateSubTask;
+import xdoclet.XDocletException;
+import xdoclet.tagshandler.PackageTagsHandler;
+import xdoclet.template.TemplateException;
/**
* Generates Messages.properties file from message-bundle tags for each package.
* Later we may provide more options, currently it fits xdoclet's needs only.
*
- * @xdoclet:subtask name="msgbundle" parent="xdoclet.DocletTask"
- *
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created May 7, 2002
- * @version $Revision: 1.1.2.2 $
+ * @xdoclet:subtask name="msgbundle" parent="xdoclet.DocletTask"
+ * @version $Revision: 1.1.2.3 $
*/
public class MessageBundleSubTask extends TemplateSubTask
{
public final static String SUBTASK_NAME = "msgbundle";
- /**
- * @todo-javadoc Describe the field
- */
private static String DEFAULT_TEMPLATE_FILE = "resources/msgbundle.xdt";
- /**
- * @todo-javadoc Describe the field
- */
- private static String GENERATED_FILE_NAME = "Messages.properties";
- public String getSubTaskName()
- {
- return SUBTASK_NAME;
- }
+ private static String GENERATED_FILE_NAME = "Messages.properties";
public MessageBundleSubTask()
{
@@ -52,9 +41,9 @@
setDestinationFile(GENERATED_FILE_NAME);
}
- protected boolean isGenerationPerClass()
+ public String getSubTaskName()
{
- return false;
+ return SUBTASK_NAME;
}
public String getDestinationFile()
@@ -62,6 +51,11 @@
return PackageTagsHandler.packageNameAsPathFor( getCurrentPackage() ) +
"/resources";
}
+ protected boolean isGenerationPerClass()
+ {
+ return false;
+ }
+
protected void startProcessForAll() throws XDocletException
{
XPackage[] packages = null;
@@ -70,34 +64,29 @@
try {
packages = XJavaDoc.getInstance().sourcePackages();
- } catch (XJavaDocException e) {
+ }
+ catch (XJavaDocException e) {
throw new XDocletException(e, e.getMessage());
}
- for( int i=0; i<packages.length; i++ )
- {
- XPackage pakaj = packages[i];
- setCurrentPackage( pakaj );
+ for (int i = 0; i < packages.length; i++) {
+ XPackage currentPackage = packages[i];
+ setCurrentPackage(currentPackage);
- File output_file = new File( getDestDir(), getDestinationFile() );
+ File outputFile = new File(getDestDir(), getDestinationFile());
- try
- {
+ try {
setGenerationManager( new MessageBundleGenerationManager( this ) );
- if( getGenerationManager().isGenerationNeeded( output_file ) )
- {
- startEngine( getTemplateURL(), output_file );
+ if (getGenerationManager().isGenerationNeeded(outputFile)) {
+ startEngine(getTemplateURL(), outputFile);
}
}
- catch( TemplateException e )
- {
- if( e instanceof XDocletException )
- {
+ catch (TemplateException e) {
+ if (e instanceof XDocletException) {
throw ( XDocletException ) e;
}
- else
- {
+ else {
throw new XDocletException( e, "Failed." );
}
}
@@ -109,6 +98,9 @@
System.out.println( "Generating Messages.properties for package '" +
getCurrentPackage() + "'" );
}
+ /**
+ * @created 12 mei 2002
+ */
private static class MessageBundleGenerationManager extends GenerationManager
{
public MessageBundleGenerationManager( TemplateSubTask subTask )
@@ -117,7 +109,11 @@
}
/**
- * @todo return false for packages which do not have any i18n:msg in any of
their classes/methods
+ * @param file
+ * @param clazz
+ * @return
+ * @todo return false for packages which do not have any
+ * i18n:msg in any of their classes/methods
*/
protected boolean checkClass( File file, XClass clazz )
{
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel