beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rich Feit <richf...@gmail.com>
Subject Re: Fwd: svn commit: r289648 [1/6] - in /beehive/trunk/netui: src/compiler-core/ src/compiler-core/org/apache/beehive/netui/compiler/ src/compiler-core/org/apache/beehive/netui/compiler/genmodel/ src/compiler-core/org/apache/beehive/netui/compiler/gramma
Date Fri, 16 Sep 2005 21:33:15 GMT
Great, thanks for verifying it.  We're definitely on our way!
Rich

Eddie O'Neil wrote:

>Rich--
>
>  Excellent!  Great to have the compiler moved over.
>
>  I've just finished test runs on Linux (FC3) and on WinXP -- both
>passed at 100% for the JUnit, compiler, and test recorder tests.
> 
>  I'll be working on the distribution part of this next.
>
>Eddie
>
>
>
>---------- Forwarded message ----------
>From: rich@apache.org <rich@apache.org>
>Date: Sep 16, 2005 2:30 PM
>Subject: svn commit: r289648 [1/6] - in /beehive/trunk/netui:
>src/compiler-core/
>src/compiler-core/org/apache/beehive/netui/compiler/
>src/compiler-core/org/apache/beehive/netui/compiler/genmodel/
>src/compiler-core/org/apache/beehive/netui/compiler/grammar/ src/...
>To: commits@beehive.apache.org
>
>
>Author: rich
>Date: Fri Sep 16 13:27:57 2005
>New Revision: 289648
>
>URL: http://svn.apache.org/viewcvs?rev=289648&view=rev
>Log:
>Moved the NetUI compiler layer off of XMLBeans. The generated files
>(struts-config-*.xml, pageflow-validation-*.xml, annotations-*.xml)
>are now created (and merged, if Struts Merge or Validator Merge is
>used) through APIs in the JDK.
>
>tests: bvt in netui (WinXP)
>BB: bvt, run.tests against a dist (linux)
>
>
>Added:
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java
>  (with props)
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/XmlElementSupport.java
>  (with props)
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/XmlModelWriter.java
>  (with props)
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/XmlModelWriterException.java
>  (with props)
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/resources/
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/resources/struts-config_1_1.dtd
>  (with props)
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/resources/struts-config_1_1.xsd
>  (with props)
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/resources/struts-validator_1_1.xsd
>  (with props)
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/resources/validator_1_0.dtd
>  (with props)
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/resources/validator_1_1.dtd
>  (with props)
>    beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationInterfaceParser.java
>  (with props)
>    beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/FilerImpl.java
>  (with props)
>Removed:
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/validation/ValidatableFieldFactory.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/validation/ValidatableFieldOld.java
>    beehive/trunk/netui/src/compiler-core/schema/struts-config/
>    beehive/trunk/netui/src/compiler-core/schema/struts-validator/
>Modified:
>    beehive/trunk/netui/src/compiler-core/build.xml
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ControllerGrammar.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/AbstractForwardContainer.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ActionModel.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ExceptionModel.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/FormBeanModel.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ForwardModel.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/MessageResourcesModel.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/StrutsApp.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/StrutsElementSupport.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/validation/LocaleSet.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/validation/ValidatableEntity.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java
>    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/validation/ValidationModel.java
>    beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationInstanceImpl.java
>    beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java
>    beehive/trunk/netui/src/compiler/build.xml
>    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java
>    beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/OutputHandler.java
>    beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTest.java
>    beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestPropertyMgr.java
>    beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/expectedOutput/struts-config--global.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/expectedOutput/struts-config-Jira390.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/Jira611/expectedOutput/struts-config-Jira611-child.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/Jira611/expectedOutput/struts-config-Jira611-parent.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/Nested_Abstract/expectedOutput/struts-config-Nested_Abstract.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/Nested_NewReturnTo/expectedOutput/struts-config-Nested_NewReturnTo.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_ActionMethodOverload/expectedOutput/struts-config-PF_ActionMethodOverload.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_ActionNegatives/expectedOutput/struts-config-PF_ActionNegatives.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_ActionReadOnly/expectedOutput/struts-config-PF_ActionReadOnly.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_ActionUseFormBean/expectedOutput/struts-config-PF_ActionUseFormBean.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_ActionWithForm/expectedOutput/struts-config-PF_ActionWithForm.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_AnyNumberActionForward/expectedOutput/struts-config-PF_AnyNumberActionForward.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_CatchExceptionHandler/expectedOutput/struts-config-PF_CatchExceptionHandler.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_DeprecatedExceptionHandler/expectedOutput/struts-config-PF_DeprecatedExceptionHandler.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_ForwardNotInActionOrController/expectedOutput/struts-config-PF_ForwardNotInActionOrController.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_ForwardRedirect/expectedOutput/struts-config-PF_ForwardRedirect.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_ForwardSyntax/expectedOutput/struts-config-PF_ForwardSyntax.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_InvalidAnnotations/expectedOutput/struts-config-PF_InvalidAnnotations.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_JustBeginAction/expectedOutput/struts-config-PF_JustBeginAction.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_LongLivedTrue/expectedOutput/struts-config-PF_LongLivedTrue.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_MissingForwardJPF/expectedOutput/struts-config-MissingForwardJPF.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_RedirectWithNavigateTo/expectedOutput/struts-config-PF_RedirectWithNavigateTo.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_RolesAllowed/expectedOutput/struts-config-PF_RolesAllowed.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_SameGlobalActionForwardName/expectedOutput/struts-config-PF_SameGlobalActionForwardName.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_SameMethodNameSig/expectedOutput/struts-config-PF_SameMethodNameSig.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_TwoActionValidationErrForward/expectedOutput/struts-config-PF_TwoActionValidationErrForward.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_TwoActionsSameForward/expectedOutput/struts-config-PF_TwoActionsSameForward.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_TwoBeginAction/expectedOutput/struts-config-PF_TwoBeginAction.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_ValidateErrorForward/expectedOutput/struts-config-PF_ValidateErrorForward.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_WrongActionMember/expectedOutput/struts-config-PF_WrongActionMember.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PF_WrongControlLocation/expectedOutput/struts-config-PF_WrongControlLocation.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PI_Abstract/expectedOutput/struts-config-PI_Abstract.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PI_Begin/expectedOutput/struts-config-PI_Begin-parent.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PI_Begin/expectedOutput/struts-config-PI_Begin.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PI_ControlsOverride/expectedOutput/struts-config-PI_ControlsOverride-parent.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PI_ControlsOverride/expectedOutput/struts-config-PI_ControlsOverride.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PI_ForwardPath/expectedOutput/struts-config-PI_ForwardPath-parent.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PI_ForwardPath/expectedOutput/struts-config-PI_ForwardPath.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PI_ReturnAction/expectedOutput/struts-config-PI_ReturnAction-parent.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/PI_ReturnAction/expectedOutput/struts-config-PI_ReturnAction.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/SF_ImplicitReferences/expectedOutput/struts-config--SF_ImplicitReferences.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/SF_ImplicitReferences/expectedOutput/struts-config-SF_ImplicitReferences.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/SF_ImplicitReferencesNested/expectedOutput/struts-config--SF_ImplicitReferencesNested.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/SF_ImplicitReferencesNested/expectedOutput/struts-config-SF_ImplicitReferencesNested.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/SF_InvalidRelativePath/expectedOutput/struts-config--SF_InvalidRelativePath.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/SF_InvalidRelativePath/expectedOutput/struts-config-SF_InvalidRelativePath.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/retrievePopupOutput/expectedOutput/struts-config-retrievePopupOutput.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/simpleActionReadOnlyUseFormBeanWarning/expectedOutput/struts-config-simpleActionReadOnlyUseFormBeanWarning.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/simpleBeginAbstractParent/expectedOutput/struts-config-simpleBeginAbstractParent-childFlow.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/simpleBeginAbstractParent/expectedOutput/struts-config-simpleBeginAbstractParent.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/simpleBeginActionMethodOverride/expectedOutput/struts-config-simpleBeginActionMethodOverride-childFlow.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/simpleBeginActionMethodOverride/expectedOutput/struts-config-simpleBeginActionMethodOverride.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/simpleInheritedBegin/expectedOutput/struts-config-simpleInheritedBegin-childFlow.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/simpleInheritedBegin/expectedOutput/struts-config-simpleInheritedBegin.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/simpleInvalidPathWarning/expectedOutput/struts-config-simpleInvalidPathWarning.expected
>    beehive/trunk/netui/test/src/compilerTests/testsuite/simpleReadOnlyUseFormBeanWarning/expectedOutput/struts-config-simpleReadOnlyUseFormBeanWarning.expected
>    beehive/trunk/netui/test/webapps/drt/coreWeb/strutsMerge/test6/merge-jpf-struts-config.xml
>
>Modified: beehive/trunk/netui/src/compiler-core/build.xml
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/build.xml?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/build.xml (original)
>+++ beehive/trunk/netui/src/compiler-core/build.xml Fri Sep 16 13:27:57 2005
>@@ -9,7 +9,6 @@
>     <property name="module.classes.dir"
>location="${classes.dir}/${module.name}"/>
>
>     <path id="module.classpath">
>-        <path refid="xbean.dependency.path"/>
>         <fileset refid="controls.fileset"/>
>     </path>
>
>@@ -21,8 +20,6 @@
>
>         <mkdir dir="${module.classes.dir}"/>
>
>-        <antcall target="compile.schemas"/>
>-
>         <javac srcdir="${module.dir}"
>                destdir="${module.classes.dir}"
>                classpathref="module.classpath"
>@@ -37,34 +34,10 @@
>         <copy todir="${module.classes.dir}">
>             <fileset dir="${module.dir}" includes="**/*.properties"/>
>             <fileset dir="${module.dir}" includes="**/*.xml"/>
>+            <fileset dir="${module.dir}" includes="**/*.xsd"/>
>+            <fileset dir="${module.dir}" includes="**/*.dtd"/>
>             <fileset dir="${module.dir}" includes="META-INF/**"/>
>         </copy>
>-    </target>
>-
>-    <target name="compile.schemas">
>-        <!-- run the XMLBean compiler for the struts-config schema -->
>-        <ant antfile="${netui.ant.dir}/xmlBean.xml">
>-            <property name="xsd.root.dir"
>value="${module.dir}/schema/struts-config"/>
>-            <property name="class.output.dir" value="${module.classes.dir}"/>
>-            <property name="xbean.inputs"
>value="${module.dir}/schema/struts-config/*.xsd*"/>
>-            <property name="xbean.output"
>value="${module.classes.dir}/org/apache/beehive/netui/compiler/model/schema/struts11/StrutsConfigDocument.class"/>
>-        </ant>
>-
>-        <!-- run the XMLBean compiler for the struts-validator schema -->
>-        <ant antfile="${netui.ant.dir}/xmlBean.xml">
>-            <property name="xsd.root.dir"
>value="${module.dir}/schema/struts-validator"/>
>-            <property name="class.output.dir" value="${module.classes.dir}"/>
>-            <property name="xbean.inputs"
>value="${module.dir}/schema/struts-validator/*.xsd*"/>
>-            <property name="xbean.output"
>value="${module.classes.dir}/org/apache/beehive/netui/compiler/model/schema/validator11/ValidatorDocument.class"/>
>-        </ant>
>-
>-        <!-- run the XMLBean compiler for the processed-annotations schema -->
>-        <ant antfile="${netui.ant.dir}/xmlBean.xml">
>-            <property name="xsd.root.dir"
>value="${module.dir}/schema/processed-annotations"/>
>-            <property name="class.output.dir" value="${module.classes.dir}"/>
>-            <property name="xbean.inputs"
>value="${module.dir}/schema/processed-annotations/*.xsd*"/>
>-            <property name="xbean.output"
>value="${module.classes.dir}/org/apache/beehive/netui/compiler/schema/annotations/ProcessedAnnotationsDocument.class"/>
>-        </ant>
>     </target>
>
>     <target name="clean">
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationToXML.java
>Fri Sep 16 13:27:57 2005
>@@ -24,49 +24,53 @@
> import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue;
> import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance;
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
>-import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotationsDocument;
>-import org.apache.beehive.netui.compiler.schema.annotations.AnnotatedElement;
>-import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotation;
>-import org.apache.beehive.netui.compiler.schema.annotations.AnnotationAttribute;
> import org.apache.beehive.netui.compiler.model.StrutsApp;
>-import org.apache.xmlbeans.XmlOptions;
>+import org.apache.beehive.netui.compiler.model.XmlModelWriter;
>+import org.apache.beehive.netui.compiler.model.XmlModelWriterException;
>+import org.w3c.dom.Element;
>
> import java.util.Map;
> import java.util.Iterator;
> import java.util.List;
>+import java.util.Date;
> import java.io.File;
> import java.io.IOException;
> import java.io.PrintWriter;
>
> public class AnnotationToXML
> {
>-    private static final String ANNOTATIONS_FILE_PREFIX = "jpf-annotations";
>+    private static final String ANNOTATIONS_FILE_PREFIX = "annotations";
>
>-    private ProcessedAnnotationsDocument _doc;
>+    private XmlModelWriter _xw;
>     private TypeDeclaration _typeDecl;
>
>-    public AnnotationToXML( TypeDeclaration typeDecl )
>+    public AnnotationToXML(TypeDeclaration typeDecl)
>+            throws IOException, XmlModelWriterException
>     {
>-        _doc = ProcessedAnnotationsDocument.Factory.newInstance();
>         _typeDecl = typeDecl;
>-        ProcessedAnnotationsDocument.ProcessedAnnotations pa =
>_doc.addNewProcessedAnnotations();
>-        pa.setTypeName( typeDecl.getQualifiedName() );
>+        String typeName = typeDecl.getQualifiedName();
>+        StringBuffer comment = new StringBuffer(" Generated from ");
>+        comment.append(typeName);
>+        comment.append( " on " ).append( new Date().toString() ).append( ' ' );
>+        _xw = new XmlModelWriter(null, "processed-annotations", null,
>null, comment.toString());
>+        _xw.addElementWithText(_xw.getRootElement(), "type-name", typeName);
>     }
>
>     public void include( MemberDeclaration memberDecl,
>AnnotationInstance annotation )
>     {
>-        AnnotatedElement element =
>_doc.getProcessedAnnotations().addNewAnnotatedElement();
>         String name = memberDecl instanceof TypeDeclaration
>                       ? ( ( TypeDeclaration ) memberDecl ).getQualifiedName()
>                       : memberDecl.getSimpleName();
>-        element.setElementName( name );
>-        ProcessedAnnotation xmlAnnotation = element.addNewAnnotation();
>+        Element annotatedElement =
>_xw.addElement(_xw.getRootElement(), "annotated-element");
>+        _xw.addElementWithText(annotatedElement, "element-name", name);
>+        Element xmlAnnotation = _xw.addElement(annotatedElement, "annotation");
>         include( xmlAnnotation, annotation );
>     }
>
>-    private void include( ProcessedAnnotation xmlAnnotation,
>AnnotationInstance annotation )
>+    private void include( Element xmlAnnotation, AnnotationInstance
>annotation )
>     {
>-        xmlAnnotation.setAnnotationName(
>annotation.getAnnotationType().getAnnotationTypeDeclaration().getQualifiedName()
>);
>+        String annotationName =
>annotation.getAnnotationType().getAnnotationTypeDeclaration().getQualifiedName();
>+        _xw.addElementWithText(xmlAnnotation, "annotation-name",
>annotationName);
>
>         Map elementValues = annotation.getElementValues();
>
>@@ -78,8 +82,8 @@
>
>             String name = elementDecl.getSimpleName();
>             Object value = annotationValue.getValue();
>-            AnnotationAttribute xmlAttr =
>xmlAnnotation.addNewAnnotationAttribute();
>-            xmlAttr.setAttributeName( name );
>+            Element xmlAttr = _xw.addElement(xmlAnnotation,
>"annotation-attribute");
>+            _xw.addElementWithText(xmlAttr, "attribute-name", name);
>
>             if ( value instanceof List )
>             {
>@@ -91,39 +95,35 @@
>
>                     // we only handle lists of annotations at the moment
>                     assert listVal instanceof AnnotationInstance :
>listVal.getClass().getName();
>-                    include( xmlAttr.addNewAnnotationValue(), (
>AnnotationInstance ) listVal );
>+                    include(_xw.addElement(xmlAttr,
>"annotation-value"), (AnnotationInstance) listVal);
>                 }
>             }
>             else
>             {
>                 // we only support a few types at the moment
>                 assert value instanceof TypeInstance || value
>instanceof String : value.getClass().getName();
>-                xmlAttr.setStringValue1( value.toString() );
>+                _xw.addElementWithText(xmlAttr, "string-value",
>value.toString());
>             }
>         }
>     }
>
>     public void writeXml( Diagnostics diagnostics,
>AnnotationProcessorEnvironment env )
>+            throws IOException, XmlModelWriterException
>     {
>-        String typeName = _typeDecl.getQualifiedName();
>-        String outputFilePath = StrutsApp.getOutputFileURI(
>ANNOTATIONS_FILE_PREFIX, typeName, false );
>-        PrintWriter writer = null;
>-
>-        try
>-        {
>-            XmlOptions options = new XmlOptions();
>-            options.setSavePrettyPrint();
>-            File outputFile = new File( outputFilePath );
>-            writer = env.getFiler().createTextFile( outputFile );
>-            _doc.save( writer, options );
>-        }
>-        catch ( IOException e )
>-        {
>-            diagnostics.addError( _typeDecl,
>"error.could-not-generate", outputFilePath, e.getMessage() );
>-        }
>-        finally
>-        {
>-            if ( writer != null ) writer.close();
>+        String outputFilePath = getFilePath(_typeDecl);
>+        File outputFile = new File(outputFilePath);
>+        PrintWriter writer = env.getFiler().createTextFile(outputFile);
>+
>+        try {
>+            _xw.simpleFastWrite(writer);
>+        } finally {
>+            writer.close();
>         }
>+    }
>+
>+    public static String getFilePath(TypeDeclaration typeDecl)
>+    {
>+        String typeName = typeDecl.getQualifiedName();
>+        return StrutsApp.getOutputFileURI( ANNOTATIONS_FILE_PREFIX,
>typeName, false );
>     }
> }
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
>Fri Sep 16 13:27:57 2005
>@@ -22,8 +22,6 @@
> import org.apache.beehive.netui.compiler.typesystem.declaration.MethodDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
>
>-import java.io.File;
>-
> public class FacesBackingGenerator
>         extends BaseGenerator
>         implements JpfLanguageConstants
>@@ -36,26 +34,32 @@
>     public void generate( ClassDeclaration publicClass )
>         throws FatalCompileTimeException
>     {
>-        AnnotationInstance facesBackingAnnotation =
>CompilerUtils.getAnnotation( publicClass, FACES_BACKING_TAG_NAME );
>-        assert facesBackingAnnotation != null;  // checker should enforce this
>-        AnnotationToXML atx = new AnnotationToXML( publicClass );
>-
>-        // Add the class-level @Jpf.FacesBacking annotation.
>-        atx.include( publicClass, facesBackingAnnotation );
>-
>-        // For each method, add the @Jpf.CommandHandler annotation.
>-        MethodDeclaration[] methods = CompilerUtils.getClassMethods(
>publicClass, COMMAND_HANDLER_TAG_NAME );
>-        for ( int i = 0; i < methods.length; i++ )
>-        {
>-            MethodDeclaration method = methods[i];
>-            AnnotationInstance commandHandlerAnn =
>CompilerUtils.getAnnotation( method, COMMAND_HANDLER_TAG_NAME );
>-            atx.include( method, commandHandlerAnn );
>+        try {
>+            AnnotationInstance facesBackingAnnotation =
>CompilerUtils.getAnnotation( publicClass, FACES_BACKING_TAG_NAME );
>+            assert facesBackingAnnotation != null;  // checker should
>enforce this
>+            AnnotationToXML atx = new AnnotationToXML( publicClass );
>+
>+            // Add the class-level @Jpf.FacesBacking annotation.
>+            atx.include( publicClass, facesBackingAnnotation );
>+
>+            // For each method, add the @Jpf.CommandHandler annotation.
>+            MethodDeclaration[] methods =
>CompilerUtils.getClassMethods( publicClass, COMMAND_HANDLER_TAG_NAME
>);
>+            for ( int i = 0; i < methods.length; i++ )
>+            {
>+                MethodDeclaration method = methods[i];
>+                AnnotationInstance commandHandlerAnn =
>CompilerUtils.getAnnotation( method, COMMAND_HANDLER_TAG_NAME );
>+                atx.include( method, commandHandlerAnn );
>+            }
>+
>+            // Add @Jpf.SharedFlowField, @Jpf.PageFlowField, @Control.
>+            FlowControllerGenerator.includeFieldAnnotations( atx,
>publicClass, PAGE_FLOW_FIELD_TAG_NAME );
>+
>+            // Write the file.
>+            atx.writeXml( getDiagnostics(), getEnv() );
>+        } catch (Exception e) {
>+            getDiagnostics().addError( publicClass, "error.could-not-generate",
>+                                      
>AnnotationToXML.getFilePath(publicClass), e.getMessage() );
>+            e.printStackTrace();  // TODO: log instead
>         }
>-
>-        // Add @Jpf.SharedFlowField, @Jpf.PageFlowField, @Control.
>-        FlowControllerGenerator.includeFieldAnnotations( atx,
>publicClass, PAGE_FLOW_FIELD_TAG_NAME );
>-
>-        // Write the file.
>-        atx.writeXml( getDiagnostics(), getEnv() );
>     }
> }
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
>Fri Sep 16 13:27:57 2005
>@@ -34,7 +34,6 @@
> import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
> import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance;
> import org.apache.beehive.netui.compiler.processor.SilentDiagnostics;
>-import org.apache.xmlbeans.XmlException;
>
> import java.io.File;
> import java.io.FilenameFilter;
>@@ -272,7 +271,7 @@
>     }
>
>     protected abstract GenStrutsApp createStrutsApp( ClassDeclaration jclass )
>-        throws XmlException, IOException, FatalCompileTimeException;
>+        throws IOException, FatalCompileTimeException;
>
>     protected void startCheckClass( ClassDeclaration jclass )
>             throws FatalCompileTimeException
>@@ -291,10 +290,6 @@
>             strutsApp = createStrutsApp( jclass );
>             strutsConfigFile = strutsApp.getStrutsConfigFile();
>         }
>-        catch ( XmlException e )
>-        {
>-            // will be reported at generate time
>-        }
>         catch ( IOException e )
>         {
>             // will be reported at generate time
>@@ -302,8 +297,6 @@
>
>         if ( strutsConfigFile != null )
>         {
>-            File parentDir = strutsConfigFile.getParentFile();
>-
>             getFCSourceFileInfo().addReferencedFile( strutsConfigFile );
>
>             if ( strutsConfigFile.exists() && strutsApp != null && !
>strutsApp.canWrite() )
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
>Fri Sep 16 13:27:57 2005
>@@ -24,7 +24,7 @@
> import org.apache.beehive.netui.compiler.typesystem.declaration.FieldDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
>-import org.apache.xmlbeans.XmlException;
>+import org.apache.beehive.netui.compiler.model.XmlModelWriterException;
>
> import java.io.File;
> import java.io.FileNotFoundException;
>@@ -47,7 +47,7 @@
>     }
>
>     protected abstract GenStrutsApp createStrutsApp( ClassDeclaration cl )
>-            throws XmlException, IOException, FatalCompileTimeException;
>+            throws IOException, FatalCompileTimeException;
>
>     public void generate( ClassDeclaration publicClass )
>     {
>@@ -78,8 +78,7 @@
>         catch ( Exception e )
>         {
>             e.printStackTrace();    // @TODO log
>-            assert e instanceof XmlException || e instanceof
>IOException || e instanceof FileNotFoundException
>-                    : e.getClass().getName();
>+            assert e instanceof IOException : e.getClass().getName();
>             getDiagnostics().addError( publicClass, "error.could-not-generate",
>                                        app != null ?
>app.getStrutsConfigFile() : null, e.getMessage() );
>         }
>@@ -90,13 +89,18 @@
>     }
>
>     private void writeFieldAnnotations( ClassDeclaration classDecl,
>GenStrutsApp app )
>-            throws FatalCompileTimeException
>     {
>-        AnnotationToXML atx = new AnnotationToXML( classDecl );
>-
>-        if ( includeFieldAnnotations( atx, classDecl, null ) )
>-        {
>-            atx.writeXml( getDiagnostics(), getEnv() );
>+        try {
>+            AnnotationToXML atx = new AnnotationToXML( classDecl );
>+
>+            if ( includeFieldAnnotations( atx, classDecl, null ) )
>+            {
>+                atx.writeXml( getDiagnostics(), getEnv() );
>+            }
>+        } catch (Exception e) {
>+            getDiagnostics().addError(classDecl,
>"error.could-not-generate", AnnotationToXML.getFilePath(classDecl),
>+                                      e.getMessage() );
>+            e.printStackTrace();  // TODO: log instead
>         }
>     }
>
>@@ -167,7 +171,7 @@
>             e.printStackTrace();    // @TODO get rid of this
>             assert e instanceof FileNotFoundException
>                    || e instanceof IOException
>-                   || e instanceof XmlException
>+                   || e instanceof XmlModelWriterException
>                     : e.getClass().getName();
>
>             getDiagnostics().addError( publicClass, "error.could-not-generate",
>
>Added: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java?rev=289648&view=auto
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java
>(added)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java
>Fri Sep 16 13:27:57 2005
>@@ -0,0 +1,67 @@
>+/*
>+ * Copyright 2004 The Apache Software Foundation.
>+ *
>+ * Licensed under the Apache License, Version 2.0 (the "License");
>+ * you may not use this file except in compliance with the License.
>+ * You may obtain a copy of the License at
>+ *
>+ *     http://www.apache.org/licenses/LICENSE-2.0
>+ *
>+ * Unless required by applicable law or agreed to in writing, software
>+ * distributed under the License is distributed on an "AS IS" BASIS,
>+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>+ * See the License for the specific language governing permissions and
>+ * limitations under the License.
>+ *
>+ * $Header:$
>+ */
>+package org.apache.beehive.netui.compiler;
>+
>+import org.xml.sax.EntityResolver;
>+import org.xml.sax.InputSource;
>+import org.xml.sax.SAXException;
>+
>+import java.io.IOException;
>+import java.io.InputStream;
>+
>+/**
>+ * Entity resolver that tries to find the resource locally (from
>classloader, under
>+ * org/apache/beehive/netui/compiler/resources) before trying to
>resolve via the network.
>+ */
>+public class LocalFileEntityResolver implements EntityResolver
>+{
>+    private static final String RESORUCE_PATH_PREFIX =
>"org/apache/beehive/netui/compiler/resources/";
>+    private static final LocalFileEntityResolver INSTANCE = new
>LocalFileEntityResolver();
>+
>+    protected LocalFileEntityResolver() {
>+    }
>+
>+    public static LocalFileEntityResolver getInstance() {
>+        return INSTANCE;
>+    }
>+
>+    /**
>+     * Resolve the entity.  First try to find it locally, then
>fallback to the network.
>+     */
>+    public InputSource resolveEntity(String publicID, String
>systemID) throws SAXException, IOException {
>+        InputSource localFileInput = resolveLocalEntity(systemID);
>+        return localFileInput != null ? localFileInput : new
>InputSource(systemID);
>+    }
>+
>+    /**
>+     * Resolve the given entity locally.
>+     */
>+    public InputSource resolveLocalEntity(String systemID) throws
>SAXException, IOException {
>+        String localFileName = systemID;
>+        int fileNameStart = localFileName.lastIndexOf('/') + 1;
>+        if (fileNameStart < localFileName.length()) {
>+            localFileName = systemID.substring(fileNameStart);
>+        }
>+        ClassLoader cl = LocalFileEntityResolver.class.getClassLoader();
>+        InputStream stream =
>cl.getResourceAsStream(RESORUCE_PATH_PREFIX + localFileName);
>+        if (stream != null) {
>+            return new InputSource(stream);
>+        }
>+        return null;
>+    }
>+}
>
>Propchange: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java
>------------------------------------------------------------------------------
>    svn:eol-style = native
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowChecker.java
>Fri Sep 16 13:27:57 2005
>@@ -29,7 +29,6 @@
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
> import org.apache.beehive.netui.compiler.typesystem.type.DeclaredType;
> import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance;
>-import org.apache.xmlbeans.XmlException;
>
> import java.io.File;
> import java.io.IOException;
>@@ -193,7 +192,7 @@
>     }
>
>     protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
>-        throws XmlException, IOException, FatalCompileTimeException
>+        throws IOException, FatalCompileTimeException
>     {
>         File sourceFile = CompilerUtils.getSourceFile( jclass, true );
>         return new GenStrutsApp( sourceFile, jclass, getEnv(),
>getFCSourceFileInfo(), true, getDiagnostics() );
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/PageFlowGenerator.java
>Fri Sep 16 13:27:57 2005
>@@ -20,7 +20,6 @@
> import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
> import org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
>-import org.apache.xmlbeans.XmlException;
>
> import java.io.File;
> import java.io.IOException;
>@@ -35,7 +34,7 @@
>     }
>
>     protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
>-        throws XmlException, IOException, FatalCompileTimeException
>+        throws IOException, FatalCompileTimeException
>     {
>         File sourceFile = CompilerUtils.getSourceFile( jclass, true );
>         return new GenStrutsApp( sourceFile, jclass, getEnv(),
>getFCSourceFileInfo(), false, getDiagnostics() );
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowChecker.java
>Fri Sep 16 13:27:57 2005
>@@ -23,7 +23,6 @@
> import org.apache.beehive.netui.compiler.grammar.InvalidAttributeType;
> import org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
>-import org.apache.xmlbeans.XmlException;
>
> import java.io.File;
> import java.io.IOException;
>@@ -72,7 +71,7 @@
>     }
>
>     protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
>-        throws XmlException, IOException, FatalCompileTimeException
>+        throws IOException, FatalCompileTimeException
>     {
>         File sourceFile = CompilerUtils.getSourceFile( jclass, true );
>         return new GenSharedFlowStrutsApp( sourceFile, jclass,
>getEnv(), getFCSourceFileInfo(), true, getDiagnostics() );
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
>Fri Sep 16 13:27:57 2005
>@@ -21,7 +21,6 @@
> import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
> import org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
>-import org.apache.xmlbeans.XmlException;
>
> import java.io.File;
> import java.io.IOException;
>@@ -36,7 +35,7 @@
>     }
>
>     protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
>-            throws XmlException, IOException, FatalCompileTimeException
>+            throws IOException, FatalCompileTimeException
>     {
>         File sourceFile = CompilerUtils.getSourceFile( jclass, true );
>         return new GenSharedFlowStrutsApp( sourceFile, jclass,
>getEnv(), getFCSourceFileInfo(), false, getDiagnostics() );
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/diagnostics.properties
>Fri Sep 16 13:27:57 2005
>@@ -15,6 +15,7 @@
> error.atmost-one-may-exist-6 = Only one of attributes "{0}", "{1}",
>"{2}", "{3}", "{4}", or "{5}" may be present.
> error.attr-dependency-not-found-1 = Attribute "{0}" may only be
>present when attribute "{1}" is present.
> error.attr-dependency-not-found-2 = Attribute "{0}" may only be
>present when attribute "{1}" or "{2}" is present.
>+error.attr-dependency-not-found-3 = Attribute "{0}" may only be
>present when one of attributes "{1}", "{2}", or "{3}" is present.
> error.unresolved-exception-handler = No exception handler method
>named "{0}" could be found.
> error.invalid-parent-directory = Could not create parent directory "{0}".
> error.struts-config-not-writable = Cannot write to "{0}".
>@@ -78,7 +79,7 @@
> error.xml-parse-error = Error while parsing {0} (line {1}, column {2}): {3}
> error.xml-parse-error-nocolumn = Error while parsing {0} (line {1}): {2}
> error.xml-parse-error-nolinecolumn = Error while parsing {0}: {1}
>-error.xml-read-error = Could not load {0}: {1}.
>+error.xml-read-error = Could not load {0} due to {1}: {2}.
>
> error.invalid-uri = This URI is invalid: {0}
> error.relative-uri = This attribute requires a relative path.
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenSharedFlowStrutsApp.java
>Fri Sep 16 13:27:57 2005
>@@ -23,7 +23,6 @@
> import org.apache.beehive.netui.compiler.JpfLanguageConstants;
> import org.apache.beehive.netui.compiler.Diagnostics;
> import org.apache.beehive.netui.compiler.FatalCompileTimeException;
>-import org.apache.xmlbeans.XmlException;
>
> import java.io.File;
> import java.io.IOException;
>@@ -35,7 +34,7 @@
> {
>     public GenSharedFlowStrutsApp( File sourceFile, ClassDeclaration
>jclass, AnnotationProcessorEnvironment env,
>                                    FlowControllerInfo fcInfo, boolean
>checkOnly, Diagnostics diagnostics )
>-            throws XmlException, IOException, FatalCompileTimeException
>+            throws IOException, FatalCompileTimeException
>     {
>         super( sourceFile, jclass, env, fcInfo, checkOnly, diagnostics );
>         recalculateStrutsConfigFile();  // it changes based on _isGlobalApp
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
>Fri Sep 16 13:27:57 2005
>@@ -28,20 +28,16 @@
> import org.apache.beehive.netui.compiler.model.ForwardModel;
> import org.apache.beehive.netui.compiler.model.MessageResourcesModel;
> import org.apache.beehive.netui.compiler.model.StrutsApp;
>+import org.apache.beehive.netui.compiler.model.XmlModelWriterException;
> import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance;
> import org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.declaration.MethodDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier;
>-import org.apache.beehive.netui.compiler.typesystem.declaration.PackageDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.declaration.ParameterDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
> import org.apache.beehive.netui.compiler.typesystem.type.DeclaredType;
> import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance;
>-import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
>-import org.apache.xmlbeans.XmlCursor;
>-import org.apache.xmlbeans.XmlException;
>-import org.apache.xmlbeans.XmlObject;
>
> import java.io.File;
> import java.io.FileNotFoundException;
>@@ -68,7 +64,7 @@
>     private FlowControllerInfo _fcInfo;
>
>     protected void recalculateStrutsConfigFile()
>-        throws XmlException, IOException, FatalCompileTimeException
>+        throws IOException, FatalCompileTimeException
>     {
>         _strutsConfigFile = calculateStrutsConfigFile(); // caching this
>     }
>@@ -80,7 +76,7 @@
>
>     public GenStrutsApp( File sourceFile, ClassDeclaration jclass,
>AnnotationProcessorEnvironment env,
>                          FlowControllerInfo fcInfo, boolean
>checkOnly, Diagnostics diagnostics )
>-        throws XmlException, IOException, FatalCompileTimeException
>+        throws IOException, FatalCompileTimeException
>     {
>         super( jclass.getQualifiedName() );
>
>@@ -328,9 +324,19 @@
>     }
>
>     public void writeToFile()
>-        throws FileNotFoundException, IOException, XmlException,
>FatalCompileTimeException
>+        throws FileNotFoundException, IOException,
>XmlModelWriterException, FatalCompileTimeException
>     {
>-        writeToFile( getMergeFile( getMergeFileName() ) );
>+        File strutsMergeFile = getMergeFile( getMergeFileName() );
>+        PrintWriter writer = getEnv().getFiler().createTextFile(
>_strutsConfigFile );
>+
>+        try
>+        {
>+            writeXml( writer, strutsMergeFile );
>+        }
>+        finally
>+        {
>+            writer.close();
>+        }
>     }
>
>     public boolean isStale()
>@@ -419,23 +425,8 @@
>
>         return true;
>     }
>-
>-
>-    public void writeToFile( File strutsMergeFile )
>-        throws FileNotFoundException, IOException, XmlException,
>FatalCompileTimeException
>-    {
>-        PrintWriter writer = getEnv().getFiler().createTextFile(
>_strutsConfigFile );
>-
>-        try
>-        {
>-            writeXml( writer, strutsMergeFile );
>-        }
>-        finally
>-        {
>-            writer.close();
>-        }
>-    }
>-
>+
>+
>     public File getStrutsConfigFile()
>     {
>         return _strutsConfigFile;
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
>Fri Sep 16 13:27:57 2005
>@@ -20,9 +20,9 @@
> import org.apache.beehive.netui.compiler.CompilerUtils;
> import org.apache.beehive.netui.compiler.JpfLanguageConstants;
> import org.apache.beehive.netui.compiler.MergedControllerAnnotation;
>-import org.apache.beehive.netui.compiler.Diagnostics;
> import org.apache.beehive.netui.compiler.FatalCompileTimeException;
> import org.apache.beehive.netui.compiler.model.FormBeanModel;
>+import org.apache.beehive.netui.compiler.model.XmlModelWriterException;
> import org.apache.beehive.netui.compiler.model.validation.ValidationModel;
> import org.apache.beehive.netui.compiler.model.validation.ValidatorConstants;
> import org.apache.beehive.netui.compiler.model.validation.ValidatorRule;
>@@ -37,13 +37,10 @@
> import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance;
> import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
>-import org.apache.xmlbeans.XmlException;
>
> import java.io.File;
> import java.io.FileNotFoundException;
>-import java.io.FileOutputStream;
> import java.io.IOException;
>-import java.io.PrintStream;
> import java.io.PrintWriter;
> import java.util.Collection;
> import java.util.Iterator;
>@@ -430,7 +427,7 @@
>     }
>
>     public void writeToFile()
>-        throws FileNotFoundException, XmlException, IOException,
>FatalCompileTimeException
>+        throws FileNotFoundException, IOException,
>FatalCompileTimeException, XmlModelWriterException
>     {
>         String outputFilePath = getOutputFileURI();
>         File outputFile = new File( outputFilePath );
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ControllerGrammar.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ControllerGrammar.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ControllerGrammar.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ControllerGrammar.java
>Fri Sep 16 13:27:57 2005
>@@ -21,28 +21,28 @@
> import org.apache.beehive.netui.compiler.AnnotationMemberType;
> import org.apache.beehive.netui.compiler.FlowControllerInfo;
> import org.apache.beehive.netui.compiler.Diagnostics;
>-import org.apache.beehive.netui.compiler.model.schema.struts11.StrutsConfigDocument;
>-import org.apache.beehive.netui.compiler.model.schema.validator11.FormValidationDocument;
> import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
>
>+import java.net.URL;
>+
>
> public class ControllerGrammar
>         extends BaseFlowControllerGrammar
>-{
>+{
>     public ControllerGrammar( AnnotationProcessorEnvironment env,
>Diagnostics diags, RuntimeVersionChecker rvc,
>                               FlowControllerInfo fcInfo )
>     {
>         super( env, diags, null, rvc, fcInfo );
>-
>+
>         addMemberType( LOGIN_REQUIRED_ATTR, new AnnotationMemberType(
>null, this ) );
>         addMemberType( ROLES_ALLOWED_ATTR, new RolesAllowedType( this ) );
>         addMemberType( READONLY_ATTR, new AnnotationMemberType( null, this ) );
>-        addMemberType( STRUTSMERGE_ATTR, new ValidXmlFileType(
>StrutsConfigDocument.type, null, this, fcInfo ) );
>+        addMemberType( STRUTSMERGE_ATTR, new ValidXmlFileType(
>"struts-config_1_1.xsd", null, this, fcInfo ) );
>         addMemberType( VALIDATOR_VERSION_ATTR, new
>AnnotationMemberType( null, this ) );
>-        addMemberType( VALIDATOR_MERGE_ATTR, new ValidXmlFileType(
>FormValidationDocument.type, null, this, fcInfo ) );
>+        addMemberType( VALIDATOR_MERGE_ATTR, new ValidXmlFileType(
>"struts-validator_1_1.xsd", null, this, fcInfo ) );
>         addMemberType( TILES_DEFINITIONS_CONFIGS_ATTR, new
>TilesDefinitionsConfigsType( null, this, fcInfo ) );
>         addMemberType( MULTIPART_HANDLER_ATTR, new
>AnnotationMemberType( null, this ) );
>-
>+
>         addMemberArrayGrammar( SHARED_FLOW_REFS_ATTR, new
>SharedFlowRefGrammar( env, diags, rvc ) );
>         addMemberArrayGrammar( FORWARDS_ATTR, new ForwardGrammar(
>env, diags, null, rvc, fcInfo ) );
>         addMemberArrayGrammar( CATCHES_ATTR, new CatchGrammar( env,
>diags, null, rvc, CONTROLLER_TAG_NAME, fcInfo ) );
>@@ -50,7 +50,7 @@
>         addMemberArrayGrammar( VALIDATABLE_BEANS_ATTR, new
>ValidatableBeanGrammar( env, diags, rvc ) );
>         addMemberArrayGrammar( SIMPLE_ACTIONS_ATTR, new
>SimpleActionGrammar( env, diags, rvc, fcInfo ) );
>     }
>-
>+
>     public String[][] getMutuallyExclusiveAttrs()
>     {
>         return null;
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/ValidXmlFileType.java
>Fri Sep 16 13:27:57 2005
>@@ -19,154 +19,159 @@
>
> import org.apache.beehive.netui.compiler.AnnotationGrammar;
> import org.apache.beehive.netui.compiler.FlowControllerInfo;
>-import org.apache.xmlbeans.SchemaType;
>-import org.apache.xmlbeans.XmlOptions;
>-import org.apache.xmlbeans.XmlObject;
>-import org.apache.xmlbeans.XmlError;
>-import org.apache.xmlbeans.XmlException;
>+import org.apache.beehive.netui.compiler.LocalFileEntityResolver;
> import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue;
>+import org.xml.sax.SAXParseException;
>+import org.xml.sax.SAXException;
>+import org.xml.sax.InputSource;
>+import org.xml.sax.helpers.DefaultHandler;
>
>+import javax.xml.parsers.DocumentBuilderFactory;
>+import javax.xml.parsers.DocumentBuilder;
> import java.util.Map;
> import java.util.Collections;
> import java.util.HashMap;
>-import java.util.List;
>-import java.util.ArrayList;
> import java.io.File;
>+import java.io.IOException;
>
>
> public class ValidXmlFileType
>         extends WebappPathType
> {
>-    private SchemaType _schema;
>+    private String _schemaFileName;
>     private static Map _parseResults = Collections.synchronizedMap(
>new HashMap() );
>-
>-    public ValidXmlFileType( SchemaType schema, String
>requiredRuntimeVersion, AnnotationGrammar parentGrammar,
>+
>+    public ValidXmlFileType( String schemaFileName, String
>requiredRuntimeVersion, AnnotationGrammar parentGrammar,
>                              FlowControllerInfo fcInfo )
>     {
>         super( false, requiredRuntimeVersion, parentGrammar, fcInfo );
>-        _schema = schema;
>+        assert schemaFileName != null;
>+        _schemaFileName = schemaFileName;
>     }
>
>-
>+
>     protected boolean checkAnyExtension()
>     {
>         return true;
>     }
>
>-
>+
>     protected boolean doFatalError()
>     {
>         return true;
>     }
>-
>-
>+
>+
>     protected boolean ignoreDirectories()
>     {
>         return false;
>     }
>-
>-
>+
>+
>     protected boolean allowFileInPageFlowSourceDir()
>     {
>         return true;
>     }
>-
>-
>+
>+
>     protected void runAdditionalChecks( File file, AnnotationValue value )
>     {
>-        try
>+
>+        //
>+        // We cache the results of parsing the file until the file is
>actually modified,
>+        // so we don't end up continually re-parsing it.
>+        //
>+        ParseResults prevResults = ( ParseResults )
>_parseResults.get( file.getPath() );
>+        long lastModTime = file.lastModified();
>+
>+        if ( prevResults == null || lastModTime >
>prevResults.getFileModTime() )
>         {
>-            //
>-            // We cache the results of parsing the file until the
>file is actually modified,
>-            // so we don't end up continually re-parsing it.
>-            //
>-            ParseResults prevResults = ( ParseResults )
>_parseResults.get( file.getPath() );
>-
>-            if ( prevResults == null || file.lastModified() >
>prevResults.getFileModTime() )
>+            try
>             {
>-                try
>-                {
>-                    XmlOptions options = new XmlOptions();
>-                    options.setDocumentType( _schema );
>-                    XmlObject xml = XmlObject.Factory.parse( file, options );
>-                    List errorListener = new ArrayList();
>-                    options.setErrorListener( errorListener );
>-
>-                    if ( !xml.validate( options ) )
>-                    {
>-                        assert !errorListener.isEmpty();
>-
>-                        XmlError err = ( XmlError ) errorListener.get( 0 );
>-                        assert err != null;
>-
>-                        throw new XmlException( err.getMessage(), null, err );
>-                    }
>-                }
>-                catch ( Exception e )
>-                {
>-                    _parseResults.put( file.getPath(), new
>ParseResults( file.lastModified(), e ) );
>-                    throw e;
>+                LocalFileEntityResolver entityResolver =
>LocalFileEntityResolver.getInstance();
>+                InputSource schemaInput = 
>entityResolver.resolveLocalEntity(_schemaFileName);
>+                assert schemaInput != null : "could not get schema
>resource for " + _schemaFileName;
>+                DocumentBuilderFactory factory =
>DocumentBuilderFactory.newInstance();
>+                factory.setNamespaceAware(true);
>+                factory.setValidating(true);
>+                factory.setAttribute(
>"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
>+                                      "http://www.w3.org/2001/XMLSchema");
>+                factory.setAttribute(
>"http://java.sun.com/xml/jaxp/properties/schemaSource", schemaInput);
>+                DocumentBuilder builder = factory.newDocumentBuilder();
>+               
>builder.setEntityResolver(LocalFileEntityResolver.getInstance());
>+                Validator handler = new Validator(lastModTime, file, value);
>+                builder.setErrorHandler(handler);
>+                builder.parse(file);
>+                if (handler.hadErrors()) {
>+                    return;
>                 }
>-
>-                _parseResults.put( file.getPath(), new ParseResults(
>file.lastModified(), null ) );
>             }
>-            else
>+            catch ( SAXParseException e )
>             {
>-                Exception e = prevResults.getException();
>-
>-                if ( e != null )
>-                {
>-                    throw e;
>-                }
>+                addErrorDiagnostic( file, e, value );
>+                _parseResults.put( file.getPath(), new ParseResults(
>lastModTime, e ) );
>+                return;
>             }
>+            catch ( Exception e )
>+            {
>+                _parseResults.put( file.getPath(), new ParseResults(
>lastModTime, e ) );
>+                addError( value, "error.xml-read-error",
>+                          new Object[]{ file.getPath(),
>e.getClass().getName(), e.getMessage() } );
>+                return;
>+            }
>+
>+            _parseResults.put( file.getPath(), new ParseResults(
>lastModTime, null ) );
>         }
>-        catch ( XmlException e )
>-        {
>-            addErrorDiagnostic( e.getError(), value );
>-        }
>-        catch ( Exception e )
>+        else
>         {
>-            addError( value, "error.xml-read-error", new Object[]{
>file.getPath(), e.getMessage() } );
>+            Exception e = prevResults.getException();
>+
>+            if (e instanceof SAXParseException) {
>+                addErrorDiagnostic(file, (SAXParseException) e, value);
>+            } else if (e != null) {
>+                addError( value, "error.xml-read-error",
>+                          new Object[]{ file.getPath(),
>e.getClass().getName(), e.getMessage() } );
>+            }
>         }
>     }
>-
>-    private void addErrorDiagnostic( XmlError err, AnnotationValue value )
>+
>+    private void addErrorDiagnostic( File file, SAXParseException
>err, AnnotationValue value )
>     {
>-        if ( err.getColumn() != -1 && err.getLine() != -1 )
>+        if ( err.getColumnNumber() != -1 && err.getLineNumber() != -1 )
>         {
>             Object[] args =
>                     {
>-                        err.getSourceName(),
>-                        new Integer( err.getLine() ),
>-                        new Integer( err.getColumn() ),
>+                        file.getPath(),
>+                        new Integer( err.getLineNumber() ),
>+                        new Integer( err.getColumnNumber() ),
>                         err.getMessage()
>                     };
>-
>+
>             addError( value, "error.xml-parse-error", args );
>         }
>-        else if ( err.getLine() != -1 )
>+        else if ( err.getLineNumber() != -1 )
>         {
>             Object[] args =
>             {
>-                err.getSourceName(),
>-                new Integer( err.getLine() ),
>+                file.getPath(),
>+                new Integer( err.getLineNumber() ),
>                 err.getMessage()
>             };
>-
>+
>             addError( value, "error.xml-parse-error-nocolumn", args );
>-        }
>+        }
>         else
>         {
>             Object[] args =
>             {
>-                err.getSourceName(),
>+                file.getPath(),
>                 err.getMessage()
>             };
>-
>+
>             addError( value, "error.xml-parse-error-nolinecolumn", args );
>         }
>     }
>-
>+
>     private static class ParseResults
>     {
>         private long _fileModTime;
>@@ -196,6 +201,46 @@
>         public void setException( Exception exception )
>         {
>             _exception = exception;
>+        }
>+    }
>+
>+    private class Validator extends DefaultHandler {
>+
>+        private long _fileModTime;
>+        private File _file;
>+        private AnnotationValue _value;
>+        private boolean _hadErrors = false;
>+
>+        public Validator(long fileModTime, File file, AnnotationValue value) {
>+            _fileModTime = fileModTime;
>+            _file = file;
>+            _value = value;
>+        }
>+
>+        public void error(SAXParseException ex)
>+                throws SAXException {
>+            ParseResults results = new ParseResults(_fileModTime, ex);
>+            addErrorDiagnostic(_file, ex, _value );
>+            _parseResults.put(_file.getPath(), results);
>+            _hadErrors = true;
>+        }
>+
>+        public void fatalError(SAXParseException ex)
>+                throws SAXException {
>+            error(ex);
>+        }
>+
>+        public void warning(SAXParseException exception)
>+                throws SAXException {
>+            // TODO: add a compiler warning?
>+        }
>+
>+        public boolean hadErrors() {
>+            return _hadErrors;
>+        }
>+
>+        public InputSource resolveEntity(String publicId, String
>systemId) throws IOException, SAXException {
>+            return super.resolveEntity(publicId, systemId);
>         }
>     }
> }
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/AbstractForwardContainer.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/AbstractForwardContainer.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/AbstractForwardContainer.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/AbstractForwardContainer.java
>Fri Sep 16 13:27:57 2005
>@@ -17,8 +17,7 @@
>  */
> package org.apache.beehive.netui.compiler.model;
>
>-import org.apache.beehive.netui.compiler.model.schema.struts11.ForwardDocument;
>-import org.apache.xmlbeans.XmlObject;
>+import org.w3c.dom.Element;
>
> import java.util.LinkedHashMap;
> import java.util.Iterator;
>@@ -71,28 +70,13 @@
>         return ( ForwardModel ) _forwards.get( forwardName );
>     }
>
>-    public void writeForwards( ForwardDocument.Forward[]
>existingForwards, XmlObject xmlForwardContainer )
>+    public void writeForwards( XmlModelWriter xw, Element
>forwardsParentElement )
>     {
>         for ( Iterator i = _forwards.values().iterator(); i.hasNext(); )
>         {
>             ForwardModel fwd = ( ForwardModel ) i.next();
>-            ForwardDocument.Forward fwdToEdit = null;
>-
>-            for ( int j = 0; j < existingForwards.length; ++j )
>-            {
>-                if ( fwd.getName().equals( existingForwards[j].getName() ) )
>-                {
>-                    fwdToEdit = existingForwards[j];
>-                    break;
>-                }
>-            }
>-
>-            if ( fwdToEdit == null )
>-            {
>-                fwdToEdit = addNewForward( xmlForwardContainer );
>-            }
>-
>-            fwd.writeToXMLBean( fwdToEdit );
>+            Element fwdToEdit = findChildElement(xw,
>forwardsParentElement, "forward", "name", fwd.getName(), true);
>+            fwd.writeXML( xw, fwdToEdit );
>         }
>     }
>
>@@ -112,6 +96,5 @@
>     {
>         _forwards.remove( forward.getName() );
>     }
>-
>-    protected abstract ForwardDocument.Forward addNewForward(
>XmlObject xmlForwardContainer );
>+
> }
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ActionModel.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ActionModel.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ActionModel.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ActionModel.java
>Fri Sep 16 13:27:57 2005
>@@ -22,13 +22,8 @@
> import java.util.LinkedHashMap;
> import java.util.Iterator;
>
>-import org.apache.beehive.netui.compiler.model.schema.struts11.ActionDocument.Action;
>-import org.apache.beehive.netui.compiler.model.schema.struts11.SetPropertyDocument.SetProperty;
>-import org.apache.beehive.netui.compiler.model.schema.struts11.ExceptionDocument;
>-import org.apache.beehive.netui.compiler.model.schema.struts11.ForwardDocument;
>-import org.apache.beehive.netui.compiler.model.schema.struts11.ActionDocument;
> import org.apache.beehive.netui.compiler.JpfLanguageConstants;
>-import org.apache.xmlbeans.XmlObject;
>+import org.w3c.dom.Element;
>
>
> /**
>@@ -43,11 +38,10 @@
>
>     private static final String JPF_ACTION_MAPPING_CLASSNAME =
>PAGEFLOW_PACKAGE + ".config.PageFlowActionMapping";
>
>-
>+
>     // Struts attributes.
>     private ArrayList _exceptionCatches = new ArrayList();
>     private String _attribute;
>-    private String _className;
>     private String _forward;
>     private String _include;
>     private String _input;
>@@ -88,7 +82,7 @@
>         this._path = path;
>         this._formBeanName = formName;
>     }
>-
>+
>     protected ActionModel( StrutsApp parent )
>     {
>         this( null, null, parent );
>@@ -96,7 +90,7 @@
>
>     /**
>      * Construct a copy of the given mapping, with the given path.
>-     */
>+     */
>     public ActionModel( ActionModel src, String newPath )
>     {
>         super( src );
>@@ -104,7 +98,6 @@
>         this._formBeanName = src._formBeanName;
>         _exceptionCatches = ( ArrayList ) src._exceptionCatches.clone();
>         _attribute = src._attribute;
>-        _className = src._className;
>         _forward = src._forward;
>         _include = src._include;
>         _input = src._input;
>@@ -126,127 +119,70 @@
>         _unqualifiedActionPath = src._unqualifiedActionPath;
>         _defaultForwardName = src._defaultForwardName;
>     }
>-
>+
>     public void setFormBeanName( String formBeanName )
>     {
>         _formBeanName = formBeanName;
>     }
>-
>-    public void writeToXMLBean( Action xb )
>+
>+    protected void writeToElement(XmlModelWriter xw, Element element)
>     {
>-        xb.setPath( _path );
>-
>-        if ( xb.getName() == null && _formBeanName != null )
>xb.setName( _formBeanName );
>-        if ( xb.getClassName() == null && _className != null )
>xb.setClassName( _className );
>-        if ( xb.getType() == null && _type != null ) xb.setType( _type );
>-        if ( xb.getAttribute() == null && _attribute != null )
>xb.setAttribute( _attribute );
>-        if ( xb.getInput() == null && _input != null ) xb.setInput( _input );
>-        if ( xb.getParameter() == null && _parameter != null )
>xb.setParameter( _parameter );
>-        if ( xb.getPrefix() == null && _prefix != null )
>xb.setPrefix( _prefix );
>-        if ( xb.getSuffix() == null && _suffix != null )
>xb.setSuffix( _suffix );
>-
>-        if ( xb.getScope() == null )
>-        {
>-            if ( _scope != null )
>-            {
>-                if ( _scope.equals( "request" ) )
>-                {
>-                    xb.setScope( Action.Scope.REQUEST );
>-                }
>-                else if ( _scope.equals( "session" ) )
>-                {
>-                    xb.setScope( Action.Scope.SESSION );
>-                }
>-                else
>-                {
>-                    assert false : _scope;
>-                }
>-            }
>-            else
>-            {
>-                xb.setScope( Action.Scope.REQUEST );
>-            }
>-        }
>-
>-        if ( xb.getRoles() == null && _roles != null ) xb.setRoles( _roles );
>-        if ( xb.getForward2() == null &&  _forward != null )
>xb.setForward2( _forward );
>-        if ( xb.getInclude() == null && _include != null )
>xb.setInclude( _include );
>-        if ( xb.getUnknown() == null && _unknown ) xb.setUnknown(
>Action.Unknown.TRUE );
>-        if ( xb.getValidate() == null ) xb.setValidate( _validate ?
>Action.Validate.TRUE : Action.Validate.FALSE );
>-
>-        if (  _unqualifiedActionPath != null ) addSetProperty( xb,
>"unqualifiedActionPath", _unqualifiedActionPath );
>-        if ( _formMember != null ) addSetProperty( xb, "formMember",
>_formMember );
>-        if ( _formClass != null ) addSetProperty( xb, "formClass",
>_formClass );
>-        if ( _loginRequired ) addSetProperty( xb, "loginRequired",
>_loginRequired );
>-        if ( _preventDoubleSubmit ) addSetProperty( xb,
>"preventDoubleSubmit", _preventDoubleSubmit );
>-        if ( _isOverloaded ) addSetProperty( xb, "overloaded", _isOverloaded );
>-        if ( _readonly ) addSetProperty( xb, "readonly", _readonly );
>-        if ( _isSimpleAction ) addSetProperty( xb, "simpleAction",
>_isSimpleAction );
>-        if ( _defaultForwardName != null ) addSetProperty( xb,
>"defaultForward", _defaultForwardName );
>-
>+        element.setAttribute("path", _path);
>+        setElementAttribute(element, "name", _formBeanName);
>+        setElementAttribute(element, "className", getClassName());
>+        setElementAttribute(element, "type", _type);
>+        setElementAttribute(element, "attribute", _attribute);
>+        setElementAttribute(element, "input", _input);
>+        setElementAttribute(element, "parameter", _parameter);
>+        setElementAttribute(element, "prefix", _prefix);
>+        setElementAttribute(element, "suffix", _suffix);
>+        setElementAttribute(element, "scope", _scope != null ? _scope
>: "request");
>+        setElementAttribute(element, "roles", _roles);
>+        setElementAttribute(element, "forward", _forward);
>+        setElementAttribute(element, "include", _include);
>+        setElementAttribute(element, "validate",
>Boolean.toString(_validate));  // always set the value, even if false
>+        addSetProperty( xw, element, "unqualifiedActionPath",
>_unqualifiedActionPath );
>+        addSetProperty( xw, element, "formMember", _formMember );
>+        addSetProperty( xw, element, "formClass", _formClass );
>+        addSetProperty( xw, element, "loginRequired", _loginRequired );
>+        addSetProperty( xw, element, "preventDoubleSubmit",
>_preventDoubleSubmit );
>+        addSetProperty( xw, element, "overloaded", _isOverloaded );
>+        addSetProperty( xw, element, "readonly", _readonly );
>+        addSetProperty( xw, element, "simpleAction", _isSimpleAction );
>+        addSetProperty( xw, element, "defaultForward", _defaultForwardName );
>+        addSetProperty( xw, element, "formBeanMessageResourcesKey",
>_formBeanMessageResourcesKey );
>+
>         if ( _conditionalForwards != null )
>         {
>-            addSetProperty( xb, "conditionalForwards", getMapString(
>_conditionalForwards) );
>-        }
>-
>-        if ( _formBeanMessageResourcesKey != null )
>-        {
>-            addSetProperty( xb, "formBeanMessageResourcesKey",
>_formBeanMessageResourcesKey );
>+            addSetProperty( xw, element, "conditionalForwards",
>getMapString( _conditionalForwards) );
>         }
>-
>+
>         if ( _exceptionCatches != null && ! _exceptionCatches.isEmpty() )
>         {
>-            ExceptionDocument.Exception[] existingExceptions =
>xb.getExceptionArray();
>-
>             for ( int i = 0; i < _exceptionCatches.size(); ++i )
>             {
>                 ExceptionModel ec = ( ExceptionModel )
>_exceptionCatches.get( i );
>-                ExceptionDocument.Exception exceptionToEdit = null;
>-
>-                for ( int j = 0; j < existingExceptions.length; ++j )
>-                {
>-                    if ( ec.getType().equals(
>existingExceptions[j].getType() ) )
>-                    {
>-                        exceptionToEdit = existingExceptions[j];
>-                        break;
>-                    }
>-                }
>-
>-                if ( exceptionToEdit == null )
>-                {
>-                    exceptionToEdit = xb.addNewException();
>-                }
>-
>-                ec.writeToXMLBean( exceptionToEdit );
>+                Element exceptionToEdit = findChildElement(xw,
>element, "exception", "type", ec.getType(), true);
>+                ec.writeXML( xw, exceptionToEdit );
>             }
>         }
>-
>+
>         //
>         // forwards
>         //
>-        writeForwards( xb.getForwardArray(), xb );
>-
>-        addComment( xb );
>-    }
>-
>-    private void addSetProperty( ActionDocument.Action xb, String
>propertyName, boolean propertyValue )
>-    {
>-        addSetProperty( xb, propertyName, Boolean.toString( propertyValue ) );
>+        writeForwards( xw, element );
>     }
>-
>-    private void addSetProperty( ActionDocument.Action xb, String
>propertyName, String propertyValue )
>+
>+    private void addSetProperty( XmlModelWriter xw, Element element,
>String propertyName, boolean propertyValue )
>     {
>-        SetProperty prop = xb.addNewSetProperty();
>-        prop.setProperty( propertyName );
>-        prop.setValue( propertyValue );
>-        if ( xb.getClassName() == null ) xb.setClassName(
>JPF_ACTION_MAPPING_CLASSNAME );
>+        if (propertyValue) addSetProperty( xw, element, propertyName,
>Boolean.toString( propertyValue ) );
>     }
>-
>-    protected ForwardDocument.Forward addNewForward( XmlObject xmlObject )
>+
>+    private void addSetProperty( XmlModelWriter xw, Element element,
>String propertyName, String propertyValue )
>     {
>-        return ( ( Action ) xmlObject ).addNewForward();
>+        setCustomProperty(xw, element, propertyName, propertyValue,
>JPF_ACTION_MAPPING_CLASSNAME);
>     }
>-
>+
>     /**
>      * Implemented for {@link ExceptionContainer}.
>      */
>@@ -265,16 +201,6 @@
>         this._attribute = attribute;
>     }
>
>-    public String getClassName()
>-    {
>-        return _className;
>-    }
>-
>-    public void setClassName( String className )
>-    {
>-        this._className = className;
>-    }
>-
>     public String getForward()
>     {
>         return _forward;
>@@ -309,7 +235,7 @@
>     {
>         return _formBeanName;
>     }
>-
>+
>     public String getFormBeanName()
>     {
>         return _formBeanName;
>@@ -344,7 +270,7 @@
>     {
>         return _path;
>     }
>-
>+
>     public String getPath( boolean useUnqualifiedPath )
>     {
>         if ( useUnqualifiedPath && _unqualifiedActionPath != null )
>@@ -446,7 +372,7 @@
>     {
>         _loginRequired = loginRequired;
>     }
>-
>+
>     public void setPreventDoubleSubmit( boolean preventDoubleSubmit )
>     {
>         _preventDoubleSubmit = preventDoubleSubmit;
>@@ -501,23 +427,23 @@
>     {
>         _readonly = readonly;
>     }
>-
>+
>     public void addConditionalForward( String expression, String forwardName )
>     {
>         if ( _conditionalForwards == null ) _conditionalForwards =
>new LinkedHashMap();
>         _conditionalForwards.put( expression, forwardName );
>     }
>-
>+
>     private static String getMapString( Map map )
>     {
>         StringBuffer retVal = new StringBuffer();
>-
>+
>         for ( Iterator i = map.entrySet().iterator(); i.hasNext(); )
>         {
>             Map.Entry entry = ( Map.Entry ) i.next();
>             retVal.append( entry.getValue() ).append( ':' ).append(
>entry.getKey() ).append( ';' );
>         }
>-
>+
>         return retVal.toString();
>     }
>
>@@ -525,6 +451,6 @@
>     {
>         _formBeanMessageResourcesKey = formBeanMessageResourcesKey;
>     }
>-
>+
>
> }
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ExceptionModel.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ExceptionModel.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ExceptionModel.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/ExceptionModel.java
>Fri Sep 16 13:27:57 2005
>@@ -17,10 +17,8 @@
>  */
> package org.apache.beehive.netui.compiler.model;
>
>-import org.apache.beehive.netui.compiler.model.schema.struts11.SetPropertyDocument.SetProperty;
>-import org.apache.beehive.netui.compiler.model.schema.struts11.ExceptionDocument;
>-import org.apache.beehive.netui.compiler.model.validation.ValidatorConstants;
> import org.apache.beehive.netui.compiler.JpfLanguageConstants;
>+import org.w3c.dom.Element;
>
> public class ExceptionModel
>         extends StrutsElementSupport
>@@ -36,18 +34,18 @@
>     private boolean _inheritedPath = false;
>
>     private static final String JPF_EXCEPTION_CONFIG_CLASSNAME =
>PAGEFLOW_PACKAGE + ".config.PageFlowExceptionConfig";
>-
>-
>+
>+
>     protected ExceptionModel( StrutsApp parentApp )
>     {
>         super( parentApp );
>     }
>-
>+
>     public ExceptionModel( String type, String path, String
>handlerMethod, String message,
>                            String messageKey, StrutsApp parentApp )
>     {
>         super( parentApp );
>-
>+
>         _type = type;
>         _path = path;
>         _handlerMethod = handlerMethod;
>@@ -115,56 +113,55 @@
>         _handlerClass = handlerClass;
>     }
>
>-    public void writeToXMLBean( ExceptionDocument.Exception xb )
>-
>+    protected void writeToElement(XmlModelWriter xw, Element element)
>     {
>-        xb.setType( _type );
>+        element.setAttribute("type", _type);
>
>-        if ( xb.getPath() == null && _path != null )
>+        if ( _path != null )
>         {
>             boolean relativeToModule = ! _path.startsWith( "/" );
>-
>+
>             if ( relativeToModule )
>             {
>-                xb.setPath( "/" + _path );  // struts wants "/" --
>assumes this is module-relative path
>+                // struts wants "/" -- assumes this is module-relative path
>+                setElementAttribute(element, "path", '/' + _path);
>             }
>             else
>             {
>-                xb.setPath( _path );
>-                addSetProperty( xb, "isPathContextRelative", "true" );
>+                setElementAttributeMayBeEmpty(element, "path", _path);
>+                addSetProperty(xw, element, "isPathContextRelative", "true" );
>             }
>         }
>-
>-        if ( _inheritedPath ) addSetProperty( xb, "inheritedPath", "true" );
>-
>-        if ( xb.getKey() == null && _messageKey != null ) xb.setKey(
>_messageKey );
>-
>+
>+        if ( _inheritedPath ) addSetProperty(xw, element,
>"inheritedPath", "true" );
>+
>+        //
>+        // Set the message key.  If there isn't one, use the typename
>as the message key.
>+        setElementAttribute(element, "key", _messageKey);
>+        if (_messageKey == null) setElementAttribute(element, "key", _type);
>+
>         //
>         // Struts doesn't support "message" directly -- we'll add
>this as a custom property.
>         //
>-        if ( _message != null ) addSetProperty( xb, "defaultMessage",
>_message );
>-
>-        if ( xb.getKey() == null ) xb.setKey( _type );
>-
>+        addSetProperty(xw, element, "defaultMessage", _message );
>+
>         //
>         // Note that we're setting the handler *method* as the
>handler.  This would break Struts.
>         //
>-        if ( xb.getHandler() == null && _handlerMethod != null &&
>_handlerClass == null )
>-        {
>-            xb.setHandler( _handlerMethod );
>-            addSetProperty( xb, "isHandlerMethod", "true" );
>+        if ( _handlerMethod != null && _handlerClass == null ) {
>+            setElementAttribute(element, "handler", _handlerMethod);
>+            addSetProperty(xw, element, "isHandlerMethod", "true" );
>+        }
>+        else {
>+            setElementAttribute(element, "handler", _handlerClass);
>         }
>-
>-        if ( _readonly ) addSetProperty( xb, "readonly", "true" );
>-        if ( xb.getHandler() == null && _handlerClass != null )
>xb.setHandler( _handlerClass );
>-    }
>-
>-    private void addSetProperty( ExceptionDocument.Exception xb,
>String propertyName, String propertyValue )
>-    {
>-        SetProperty prop = xb.addNewSetProperty();
>-        prop.setProperty( propertyName );
>-        prop.setValue( propertyValue );
>-        if ( xb.getClassName() == null ) xb.setClassName(
>JPF_EXCEPTION_CONFIG_CLASSNAME );
>+
>+        if ( _readonly ) addSetProperty(xw, element, "readonly", "true" );
>+    }
>+
>+    private void addSetProperty( XmlModelWriter xw, Element element,
>String propertyName, String propertyValue )
>+    {
>+        setCustomProperty(xw, element, propertyName, propertyValue,
>JPF_EXCEPTION_CONFIG_CLASSNAME);
>     }
>
>     public boolean isReadonly()
>
>Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/FormBeanModel.java
>URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/FormBeanModel.java?rev=289648&r1=289647&r2=289648&view=diff
>==============================================================================
>--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/FormBeanModel.java
>(original)
>+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/model/FormBeanModel.java
>Fri Sep 16 13:27:57 2005
>@@ -21,9 +21,8 @@
> import java.util.Collection;
> import java.util.List;
>
>-import org.apache.beehive.netui.compiler.model.schema.struts11.FormBeanDocument;
>-import org.apache.beehive.netui.compiler.model.schema.struts11.SetPropertyDocument.SetProperty;
> import org.apache.beehive.netui.compiler.JpfLanguageConstants;
>+import org.w3c.dom.Element;
>
>
> /**
>@@ -90,18 +89,17 @@
>     }
>
>
>-    private static final String JPF_ACTION_FORM_BEAN_CLASSNAME =
>PAGEFLOW_PACKAGE + ".config.PageFlowActionFormBean";
>+    private static final String CUSTOM_ACTION_FORM_BEAN_CLASSNAME =
>PAGEFLOW_PACKAGE + ".config.PageFlowActionFormBean";
>
>     private String _id = "";  // NOI18N
>-    private String _className = null;
>     private boolean _dynamic = false;
>     private String _name = null;  // required to be set
>     private String _type = null;  // required to be set
>-
>-    /** This is a NetUI-specific property. */
>+
>+    /** This is a NetUI-specific property. */
>     private String _actualType = null;
>-
>-    /** This is a NetUI-specific property. */
>+
>+    /** This is a NetUI-specific property. */
>     private boolean _pageFlowScoped;  // required to be set
>
>     private ArrayList _properties = new ArrayList();
>@@ -115,25 +113,21 @@
>         _pageFlowScoped = pageFlowScoped;
>     }
>
>-    public void writeToXMLBean( FormBeanDocument.FormBean xb )
>+    protected void writeToElement(XmlModelWriter xw, Element element)
>     {
>-        xb.setName( _name );
>+        element.setAttribute("name", _name);
>
>-        if ( xb.getType() == null ) xb.setType( _type );
>-        if ( xb.getId() == null && _id != null && _id.length() > 0 )
>xb.setId( _id );
>-        if ( xb.getClassName() == null &&_className != null )
>xb.setClassName( _className );
>-        if ( xb.getDynamic() == null && _dynamic ) xb.setDynamic(
>FormBeanDocument.FormBean.Dynamic.TRUE );
>-
>-        if ( _actualType != null && ! _actualType.equals( xb.getType() ) )
>-        {
>-            SetProperty prop = xb.addNewSetProperty();
>-            prop.setProperty( "actualType" );
>-            prop.setValue( _actualType );
>-            if ( xb.getClassName() == null ) xb.setClassName(
>JPF_ACTION_FORM_BEAN_CLASSNAME );
>-        }
>+        setElementAttribute(element, "type", _type);
>+        setElementAttribute(element, "id", _id);
>+        setElementAttribute(element, "className", getClassName());
>+        setElementAttribute(element, "dynamic", _dynamic);
>
>+        if ( _actualType != null && !
>_actualType.equals(element.getAttribute("type")) )
>+        {
>+            setCustomProperty(xw, element, "actualType", _actualType,
>CUSTOM_ACTION_FORM_BEAN_CLASSNAME);
>+        }
>     }
>-
>+
>     public String getId()
>     {
>         return _id;
>@@ -144,11 +138,6 @@
>         _id = id;
>     }
>
>-    public String getClassName()
>-    {
>-        return _className;
>-    }
>-
>     public void setClassName( String className )
>     {
>         if ( className != null )
>@@ -156,7 +145,7 @@
>             if ("org.apache.struts.action.DynaActionForm".equals(
>className ) )  // NOI18N
>                 _dynamic = true;
>
>-            _className = className;
>+            setClassName(className);
>         }
>     }
>
>  
>

Mime
View raw message