org.enhydra.barracuda.taskdefs
Class Localize2
java.lang.Object
|
+--org.apache.tools.ant.ProjectComponent
|
+--org.apache.tools.ant.Task
|
+--org.apache.tools.ant.taskdefs.MatchingTask
|
+--org.enhydra.barracuda.taskdefs.Xmlc
|
+--org.enhydra.barracuda.taskdefs.Localize2
- public class Localize2
- extends Xmlc
Ant task to invoke the localize HTML template files. Supports all the
attributes found in the Xmlc taskdef. This is a reworking of the original
Localize taskdef--the taskdef reads the master templates, generates locale
templates from it using straight text substitution (previously we actually
compiled the master template via XMLC and then parsed the resulting DOM
object, which caused all kinds of problems because of Tidy bugs/quirks).
At any rate, once the templates are generated, then we invoke XMLC on
everything, and then at the end we compile it all sing the javac taskdef.
There is probably room to improve the performance of this thing (I haven't
done any optimization)
- Author:
- christianc@enhydra.org
Fields inherited from class org.enhydra.barracuda.taskdefs.Xmlc |
classPath, cmdl, compile, destDir, forceBuild, keep, logHdr, logLevel, ML, options, packageDir, packageName, performExec, srcDir, srcDirName, srcOutDir, srcOutDirName, upToDate, verbose, xmlcArgs |
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
fileset, useDefaultExcludes |
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Method Summary |
protected boolean |
embeddedInToken(java.lang.String str,
int fpos,
java.lang.String stoken,
java.lang.String etoken)
|
void |
execute()
Execute the task. |
protected boolean |
isQualified(java.lang.String str,
int fpos)
|
static void |
main(java.lang.String[] args)
|
protected java.lang.String |
qualifiedStrReplace(java.lang.String str,
java.lang.String str1,
java.lang.String str2)
Replace occurrences of str1 in string str with str2, but only
if the str1 is qualified (ie. not embedded in an 'id=""' or
'class=""' attribute) |
void |
setClasspathref(java.lang.String iclasspathRef)
Set the classpath ref for javac. |
void |
setMasterlocaledir(java.lang.String masterDir)
Set the Master Locale Directory by accesssing the build.xml file |
void |
setMasterlocalefile(java.lang.String masterFile)
Set the Master Locale File Name by accessing the build.xml file |
void |
setTidy(Xmlc.BooleanAttribute itidy)
Run tidy on the localized templates |
protected java.lang.String |
strReplace(java.lang.String str,
java.lang.String str1,
java.lang.String str2)
Replace occurrences of str1 in string str with str2 |
Methods inherited from class org.enhydra.barracuda.taskdefs.Xmlc |
createArg, setArgs, setClasspath, setCompile, setDestdir, setForce, setKeep, setMarkup, setOptions, setPackagedir, setPackagename, setPerformexec, setSourceout, setSrcdir, setVerbose |
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, setDefaultexcludes, setExcludes, setExcludesfile, setIncludes, setIncludesfile, XsetIgnore, XsetItems |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
classpathRef
protected java.lang.String classpathRef
tidy
protected boolean tidy
masterFile
public java.lang.String masterFile
masterDir
public java.lang.String masterDir
countryCodes
public static final java.lang.String[] countryCodes
Localize2
public Localize2()
setClasspathref
public void setClasspathref(java.lang.String iclasspathRef)
- Set the classpath ref for javac.
setTidy
public void setTidy(Xmlc.BooleanAttribute itidy)
- Run tidy on the localized templates
setMasterlocaledir
public void setMasterlocaledir(java.lang.String masterDir)
- Set the Master Locale Directory by accesssing the build.xml file
- Parameters:
masterDir
- the location of the Master Localization File
setMasterlocalefile
public void setMasterlocalefile(java.lang.String masterFile)
- Set the Master Locale File Name by accessing the build.xml file
- Parameters:
masterFile
- the given name of the Master Localization File
execute
public void execute()
throws org.apache.tools.ant.BuildException
- Execute the task. The basic flow here is: invoke xmlc to generate
template classes, invoke the java compiler to compile those classes,
then use those compiled DOM structures to create localized versions of
the XML templates. Finally, reinvoke xmlc and javac to recompile the
newly created localized templates.
- Overrides:
execute
in class Xmlc
- Throws:
org.apache.tools.ant.BuildException
- All exceptions are thrown as BuildException.
Note: most of the logic here was cloned from the Javac command. Unfortunately
this was the only way to 'reuse' it.
qualifiedStrReplace
protected java.lang.String qualifiedStrReplace(java.lang.String str,
java.lang.String str1,
java.lang.String str2)
- Replace occurrences of str1 in string str with str2, but only
if the str1 is qualified (ie. not embedded in an 'id=""' or
'class=""' attribute)
strReplace
protected java.lang.String strReplace(java.lang.String str,
java.lang.String str1,
java.lang.String str2)
- Replace occurrences of str1 in string str with str2
isQualified
protected boolean isQualified(java.lang.String str,
int fpos)
embeddedInToken
protected boolean embeddedInToken(java.lang.String str,
int fpos,
java.lang.String stoken,
java.lang.String etoken)
main
public static void main(java.lang.String[] args)
Copyright © 2001 Enhydra.org