You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/02/23 07:03:28 UTC

svn commit: r154965 [1/2] - in incubator/beehive/trunk: controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ netui/src/compiler/ netui/src/compiler/org/apache/beehive/netui/compiler/ netui/src/compiler/org/apache/beehive/netui/compiler/apt/ netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/ netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/

Author: rich
Date: Tue Feb 22 22:03:16 2005
New Revision: 154965

URL: http://svn.apache.org/viewcvs?view=rev&rev=154965
Log:
Fixes for:
    - http://issues.apache.org/jira/browse/BEEHIVE-247 : Absolute path to strutsMerge file does not get inherited
    - http://issues.apache.org/jira/browse/BEEHIVE-9 : Pageflow annotation processors should extend TwoPhaseAnnotationProcessor

The latter issue is what most of this checkin is about.  Basically, I've integrated the NetUI Diagnostics class into the Controls TwoPhaseAnnotationProcessor, and changed the NetUI annotation processors to extend TPAP.  In the process, I separated the whole Generator (BaseGenerator) concept from the Checker (BaseChecker).  We no longer ask the Checker for a Generator -- now, the AnnotationProcessor can get both independently, and keeps track of the check-result in a map that's available to the Generator.

DRT/BVT: netui, controls, wsm (WinXP)
BB: self (linux)


Added:
    incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/Diagnostics.java
      - copied, changed from r154627, incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/Diagnostics.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingGenerator.java   (with props)
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/SilentDiagnostics.java   (with props)
Removed:
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/Diagnostics.java
Modified:
    incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java
    incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/TwoPhaseAnnotationProcessor.java
    incubator/beehive/trunk/netui/src/compiler/build.xml
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseGenerator.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingChecker.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FormBeanChecker.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessor.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessorFactory.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessorFactory.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionOutputGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseFlowControllerGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseValidationRuleGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/CatchGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/CommandHandlerGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ControllerGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExceptionHandlerGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MessageBundleGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SharedFlowRefGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidatableBeanGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidatablePropertyGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateCustomGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateRangeGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateRequiredGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateTypeGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateValidWhenGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidationMessageArgsGrammar.java
    incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidationRulesContainerGrammar.java
    incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java (original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java Tue Feb 22 22:03:16 2005
@@ -95,7 +95,7 @@
         {
             if (atd.getSimpleName().equals("Control") )
             {
-                Collection<Declaration> decls = _env.getDeclarationsAnnotatedWith(atd);
+                Collection<Declaration> decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith(atd);
                 for (Declaration decl : decls)
                 {
                     if ( decl instanceof FieldDeclaration )

Copied: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/Diagnostics.java (from r154627, incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/Diagnostics.java)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/Diagnostics.java?view=diff&rev=154965&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/Diagnostics.java&r1=154627&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/Diagnostics.java&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/Diagnostics.java (original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/Diagnostics.java Tue Feb 22 22:03:16 2005
@@ -15,80 +15,76 @@
  *
  * $Header:$
  */
-package org.apache.beehive.netui.compiler;
+package org.apache.beehive.controls.runtime.generator.apt;
 
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 import com.sun.mirror.declaration.Declaration;
 import com.sun.mirror.declaration.AnnotationValue;
 import com.sun.mirror.declaration.AnnotationMirror;
 
-import java.util.ResourceBundle;
-import java.text.MessageFormat;
-
-public class Diagnostics
+public abstract class Diagnostics
 {
     private AnnotationProcessorEnvironment _env;
-    private ResourceBundle _messages;
-    private boolean _hadErrors = false;
+    private boolean _hasErrors = false;
     
-    public Diagnostics( AnnotationProcessorEnvironment env )
+    protected Diagnostics( AnnotationProcessorEnvironment env )
     {
         _env = env;
-        _messages = ResourceBundle.getBundle( "org.apache.beehive.netui.compiler.diagnostics" );
     }
     
     public void addError( Declaration decl, String messageKey, Object ... args )
     {
-        _env.getMessager().printError( decl.getPosition(), getMessage( messageKey, args ) );
-        _hadErrors = true;
+        _env.getMessager().printError( decl.getPosition(), getResourceString( messageKey, args ) );
+        _hasErrors = true;
     }
     
     public void addError( AnnotationMirror ann, String messageKey, Object ... args )
     {
-        _env.getMessager().printError( ann.getPosition(), getMessage( messageKey, args ) );
-        _hadErrors = true;
+        _env.getMessager().printError( ann.getPosition(), getResourceString( messageKey, args ) );
+        _hasErrors = true;
     }
     
     public void addErrorArrayArgs( AnnotationMirror ann, String messageKey, Object [] args )
     {
-        _env.getMessager().printError( ann.getPosition(), getMessage( messageKey, args ) );
-        _hadErrors = true;
+        _env.getMessager().printError( ann.getPosition(), getResourceString( messageKey, args ) );
+        _hasErrors = true;
     }
     
     public void addError( AnnotationValue annVal, String messageKey, Object ... args )
     {
-        _env.getMessager().printError( annVal.getPosition(), getMessage( messageKey, args ) );
-        _hadErrors = true;
+        _env.getMessager().printError( annVal.getPosition(), getResourceString( messageKey, args ) );
+        _hasErrors = true;
     }
     
     public void addWarning( Declaration decl, String messageKey, Object ... args )
     {
-        _env.getMessager().printWarning( decl.getPosition(), getMessage( messageKey, args ) );
+        _env.getMessager().printWarning( decl.getPosition(), getResourceString( messageKey, args ) );
     }
     
     public void addWarning( AnnotationMirror ann, String messageKey, Object ... args )
     {
-        _env.getMessager().printWarning( ann.getPosition(), getMessage( messageKey, args ) );
+        _env.getMessager().printWarning( ann.getPosition(), getResourceString( messageKey, args ) );
     }
     
     public void addWarning( AnnotationValue annVal, String messageKey, Object ... args )
     {
-        _env.getMessager().printWarning( annVal.getPosition(), getMessage( messageKey, args ) );
+        _env.getMessager().printWarning( annVal.getPosition(), getResourceString( messageKey, args ) );
     }
     
-    private String getMessage( String key, Object ... args )
+    protected abstract String getResourceString( String key, Object ... args );
+
+    public boolean hasErrors()
     {
-        String message = _messages.getString( key );
-        return MessageFormat.format( message, args );
+        return _hasErrors;
     }
-
-    public boolean hadErrors()
+    
+    protected void setHasErrors( boolean hadErrors )
     {
-        return _hadErrors;
+        _hasErrors = hadErrors;
     }
     
-    protected void setHadErrors( boolean hadErrors )
+    protected AnnotationProcessorEnvironment getAnnotationProcessorEnvironment()
     {
-        _hadErrors = hadErrors;
+        return _env;
     }
 }

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/TwoPhaseAnnotationProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/TwoPhaseAnnotationProcessor.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/TwoPhaseAnnotationProcessor.java (original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/TwoPhaseAnnotationProcessor.java Tue Feb 22 22:03:16 2005
@@ -23,7 +23,6 @@
 
 import com.sun.mirror.apt.AnnotationProcessor;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.Messager;
 import com.sun.mirror.declaration.AnnotationTypeDeclaration;
 import com.sun.mirror.declaration.Declaration;
 
@@ -66,14 +65,15 @@
  * of the AnnotationProcessorEnvironment and associated interfaces (Messager,
  * Filer etc).
  */
-abstract public class TwoPhaseAnnotationProcessor implements AnnotationProcessor
+abstract public class TwoPhaseAnnotationProcessor
+        extends Diagnostics
+        implements AnnotationProcessor
 {
     public TwoPhaseAnnotationProcessor(Set<AnnotationTypeDeclaration> atds,
                                        AnnotationProcessorEnvironment env)
     {
-        _numErrors = 0;
+        super( env );
         _atds = atds;
-        _env = env;
         _locale = Locale.getDefault();
     }
 
@@ -98,7 +98,7 @@
     {
         for (AnnotationTypeDeclaration atd : _atds)
         {
-            Collection<Declaration> decls = _env.getDeclarationsAnnotatedWith(atd);
+            Collection<Declaration> decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith(atd);
             for (Declaration decl : decls)
             {
                 check(decl);
@@ -114,7 +114,7 @@
     {
         for (AnnotationTypeDeclaration atd : _atds)
         {
-            Collection<Declaration> decls = _env.getDeclarationsAnnotatedWith(atd);
+            Collection<Declaration> decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith(atd);
             for (Declaration decl : decls)
             {
                 generate(decl);
@@ -126,8 +126,8 @@
      * The check method is responsible for all semantic validation of the input Declaration.
      * <p>
      * All semantic errors/warnings associated with the input Declaration should
-     * be output during check via the {@link #printError(Declaration, String, Object...)} and
-     * {@link #printWarning(Declaration,String,Object...)} methods.  If an implementation
+     * be output during check via the {@link #printError} and
+     * {@link #printWarning} methods.  If an implementation
      * bypasses printError, it must override {@link #hasErrors()} to ensure correct behaviour.
      * <p>
      * If the presence of the input Declaration implies the need to add new files,
@@ -146,11 +146,6 @@
      */
     abstract public void generate(Declaration decl);
 
-    protected AnnotationProcessorEnvironment getAnnotationProcessorEnvironment()
-    {
-        return _env;
-    }
-
     //
     // Helper functions for handling diagnostics
     //
@@ -161,9 +156,7 @@
      */
     protected void printError( Declaration d, String id, Object... args )
     {
-        String message = getResourceString(id, args);
-        getMessager().printError(d.getPosition(), message);
-        _numErrors++;
+        addError( d, id, args );
     }
 
     /**
@@ -172,14 +165,7 @@
      */
     protected void printWarning( Declaration d, String id, Object... args )
     {
-        String message = getResourceString(id, args);
-        getMessager().printWarning(d.getPosition(), message);
-    }
-
-    protected void printNotice( Declaration d, String id, Object... args )
-    {
-        String message = getResourceString(id, args);
-        getMessager().printNotice(d.getPosition(), message );
+        addWarning( d, id, args );
     }
 
     protected String getResourceString( String id, Object... args )
@@ -190,23 +176,6 @@
 	    return MessageFormat.format(pattern, args);
     }
 
-    /**
-     * Reports whether this processor has encountered errors during the "check" phase.
-     * Implementations must override this if they report errors via a mechanism other than
-     * {@link #printError(Declaration,String,Object...)}.
-     */
-    protected boolean hasErrors()
-    {
-        return _numErrors != 0;
-    }
-
-    private final Messager getMessager()
-    {
-        return getAnnotationProcessorEnvironment().getMessager();
-    }
-
-    int _numErrors;
     Set<AnnotationTypeDeclaration> _atds;
-    AnnotationProcessorEnvironment _env;
     Locale _locale;
 }

Modified: incubator/beehive/trunk/netui/src/compiler/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/build.xml?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/build.xml (original)
+++ incubator/beehive/trunk/netui/src/compiler/build.xml Tue Feb 22 22:03:16 2005
@@ -9,6 +9,7 @@
 
     <path id="module.classpath">
         <path refid="xbean.dependency.path"/>
+        <fileset refid="controls.fileset"/>
     </path>
 
     <target name="build">

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java Tue Feb 22 22:03:16 2005
@@ -34,6 +34,7 @@
 import java.util.Arrays;
 
 import static org.apache.beehive.netui.compiler.JpfLanguageConstants.PAGEFLOW_RUNTIME_JAR;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 
 
 /**

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java Tue Feb 22 22:03:16 2005
@@ -24,7 +24,7 @@
 import com.sun.mirror.declaration.Declaration;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.PAGEFLOW_RUNTIME_JAR;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 
 
 public class AnnotationMemberType

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java Tue Feb 22 22:03:16 2005
@@ -25,6 +25,7 @@
 
 import org.apache.beehive.netui.compiler.model.StrutsApp;
 import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 
 public abstract class BaseChecker
 {
@@ -32,11 +33,13 @@
     private Diagnostics _diagnostics;
     private RuntimeVersionChecker _runtimeVersionChecker;
     private File _webappRoot = null;
+    private SourceFileInfo _sourceFileInfo;
 
-    protected BaseChecker( AnnotationProcessorEnvironment env, Diagnostics diagnostics )
+    protected BaseChecker( AnnotationProcessorEnvironment env, SourceFileInfo sourceFileInfo, Diagnostics diagnostics )
     {
         _env = env;
         _diagnostics = diagnostics;
+        _sourceFileInfo = sourceFileInfo;
     }
     
     Map check( ClassDeclaration jclass, File webappRoot )
@@ -69,8 +72,6 @@
     
     public abstract Map onCheck( ClassDeclaration jclass );
     
-    public abstract BaseGenerator getGenerator();
-    
     protected AnnotationProcessorEnvironment getEnv()
     {
         return _env;
@@ -94,5 +95,10 @@
     protected File getWebappRoot()
     {
         return _webappRoot;
+    }
+
+    protected SourceFileInfo getSourceFileInfo()
+    {
+        return _sourceFileInfo;
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseGenerator.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseGenerator.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseGenerator.java Tue Feb 22 22:03:16 2005
@@ -19,17 +19,20 @@
 
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 import com.sun.mirror.declaration.ClassDeclaration;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 
 public abstract class BaseGenerator
 {
     private AnnotationProcessorEnvironment _env;
     private Diagnostics _diagnostics;
+    private SourceFileInfo _sourceFileInfo;
     
     
-    protected BaseGenerator( AnnotationProcessorEnvironment env )
+    protected BaseGenerator( AnnotationProcessorEnvironment env, SourceFileInfo sourceFileInfo, Diagnostics diagnostics )
     {
         _env = env;
-        _diagnostics = new Diagnostics( env );
+        _diagnostics = diagnostics;
+        _sourceFileInfo = sourceFileInfo;
     }
     
     public abstract void generate( ClassDeclaration publicClass );
@@ -42,5 +45,10 @@
     protected Diagnostics getDiagnostics()
     {
         return _diagnostics;
+    }
+
+    protected SourceFileInfo getSourceFileInfo()
+    {
+        return _sourceFileInfo;
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingChecker.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingChecker.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingChecker.java Tue Feb 22 22:03:16 2005
@@ -26,6 +26,7 @@
 import java.util.HashMap;
 
 import org.apache.beehive.netui.compiler.grammar.CommandHandlerGrammar;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 
 import static org.apache.beehive.netui.compiler.JpfLanguageConstants.COMMAND_HANDLER_TAG_NAME;
 import static org.apache.beehive.netui.compiler.JpfLanguageConstants.FACES_BACKING_BEAN_CLASS;
@@ -34,22 +35,9 @@
 public class FacesBackingChecker
         extends BaseChecker
 {
-    private FacesBackingInfo _facesBackingInfo;
-    
-    public FacesBackingChecker( AnnotationProcessorEnvironment env, Diagnostics diags, FacesBackingInfo fbInfo )
+    public FacesBackingChecker( AnnotationProcessorEnvironment env, FacesBackingInfo fbInfo, Diagnostics diags )
     {
-        super( env, diags );
-        _facesBackingInfo = fbInfo;
-    }
-    
-    public BaseGenerator getGenerator()
-    {
-        return new BaseGenerator( getEnv() )
-        {
-            public void generate( ClassDeclaration publicClass )
-            {
-            }
-        };
+        super( env, fbInfo, diags );
     }
     
     public Map onCheck( ClassDeclaration jclass )
@@ -80,12 +68,17 @@
 
         for ( MethodDeclaration method : methods )
         {
-            _facesBackingInfo.addCommandHandler( method.getSimpleName() );
+            getSourceFileInfo().addCommandHandler( method.getSimpleName() );
             chg.check( CompilerUtils.getAnnotation( method, COMMAND_HANDLER_TAG_NAME ), null, method );
         }
         
         Map checkResultMap = new HashMap();
-        checkResultMap.put( JpfLanguageConstants.ExtraInfoKeys.facesBackingInfo, _facesBackingInfo );
+        checkResultMap.put( JpfLanguageConstants.ExtraInfoKeys.facesBackingInfo, getSourceFileInfo() );
         return checkResultMap;
+    }
+
+    protected FacesBackingInfo getSourceFileInfo()
+    {
+        return ( FacesBackingInfo ) super.getSourceFileInfo();
     }
 }

Added: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingGenerator.java?view=auto&rev=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingGenerator.java (added)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingGenerator.java Tue Feb 22 22:03:16 2005
@@ -0,0 +1,36 @@
+/*
+ * 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 com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.ClassDeclaration;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
+
+public class FacesBackingGenerator
+        extends BaseGenerator
+{
+    public FacesBackingGenerator( AnnotationProcessorEnvironment env, SourceFileInfo sourceFileInfo, Diagnostics diagnostics )
+    {
+        super( env, sourceFileInfo, diagnostics );
+    }
+
+    public void generate( ClassDeclaration publicClass )
+    {
+        // do nothing
+    }
+}

Propchange: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java Tue Feb 22 22:03:16 2005
@@ -22,6 +22,7 @@
 import org.apache.beehive.netui.compiler.grammar.WebappPathType;
 import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
 import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.xmlbeans.XmlException;
 import com.sun.mirror.declaration.*;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
@@ -45,17 +46,15 @@
 public abstract class FlowControllerChecker
         extends BaseChecker
 {
-    private FlowControllerInfo _fcInfo;
     private AnnotationGrammar _controllerGrammar;
     private AnnotationGrammar _actionGrammar;
     private AnnotationGrammar _exceptionHandlerGrammar;
     private FormBeanChecker _formBeanChecker;
     private Map _checkResultMap;
     
-    protected FlowControllerChecker( AnnotationProcessorEnvironment env, Diagnostics diags, FlowControllerInfo fcInfo )    
+    protected FlowControllerChecker( AnnotationProcessorEnvironment env, FlowControllerInfo fcInfo, Diagnostics diags )
     {
-        super( env, diags );
-        _fcInfo = fcInfo;
+        super( env, fcInfo, diags );
     }
     
     protected void doAdditionalClassChecks( ClassDeclaration jpfClass, File webappRoot )
@@ -71,19 +70,19 @@
     
     protected abstract AnnotationGrammar getControllerGrammar();
     
-    public abstract BaseGenerator getGenerator();
-    
     public Map onCheck( ClassDeclaration jclass )
     {
+        FlowControllerInfo fcInfo = getSourceFileInfo();
+        
         _checkResultMap = new HashMap();
         _controllerGrammar = getControllerGrammar();
-        _actionGrammar = new ActionGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), _fcInfo );
+        _actionGrammar = new ActionGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), fcInfo );
         _exceptionHandlerGrammar =
-        new ExceptionHandlerGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), _fcInfo );
+        new ExceptionHandlerGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), fcInfo );
         _formBeanChecker = new FormBeanChecker( getEnv(), getDiagnostics() );
         
-        _fcInfo.setWebappRoot( getWebappRoot() );
-        _fcInfo.startBuild( getEnv(), jclass );
+        fcInfo.setWebappRoot( getWebappRoot() );
+        fcInfo.startBuild( getEnv(), jclass );
         
         try
         {
@@ -91,12 +90,14 @@
         }
         finally
         {
-            _fcInfo.endBuild();
+            fcInfo.endBuild();
         }
     }
     
     private Map onCheckInternal( ClassDeclaration jclass )
     {
+        FlowControllerInfo fcInfo = getSourceFileInfo();
+        
         //
         // Check the base class.
         //
@@ -150,8 +151,8 @@
         // Runtime performance enhancement: enable saving of previous-page and previous-action information based on
         // whether there were Forwards that contained navigateTo attributes.
         //
-        enableNavigateTo( jclass, _fcInfo.getMergedControllerAnnotation(), _fcInfo );
-        Map< String, TypeDeclaration > sharedFlowTypes = _fcInfo.getSharedFlowTypes();
+        enableNavigateTo( jclass, fcInfo.getMergedControllerAnnotation(), fcInfo );
+        Map< String, TypeDeclaration > sharedFlowTypes = fcInfo.getSharedFlowTypes();
         
         if ( sharedFlowTypes != null )
         {
@@ -161,12 +162,12 @@
                 // Saving of previous-page/previous-action info must be enabled if any of the referenced shared flows
                 // use this feature.
                 //
-                enableNavigateTo( sharedFlowType, new MergedControllerAnnotation( sharedFlowType ), _fcInfo );
+                enableNavigateTo( sharedFlowType, new MergedControllerAnnotation( sharedFlowType ), fcInfo );
             }
         }
         
         endCheckClass( jclass );
-        _checkResultMap.put( JpfLanguageConstants.ExtraInfoKeys.flowControllerInfo, _fcInfo );
+        _checkResultMap.put( JpfLanguageConstants.ExtraInfoKeys.flowControllerInfo, fcInfo );
         return _checkResultMap;
     }
     
@@ -263,7 +264,7 @@
             {
                 File parentDir = strutsConfigFile.getParentFile();
         
-                getFlowControllerInfo().addReferencedFile( strutsConfigFile );
+                getSourceFileInfo().addReferencedFile( strutsConfigFile );
                 
                 if ( ! parentDir.isDirectory() )
                 {
@@ -475,11 +476,6 @@
         }
     }
     
-    protected FlowControllerInfo getFlowControllerInfo()
-    {
-        return _fcInfo;
-    }
-    
     protected void checkForOverlappingClasses( ClassDeclaration jpfClass, String baseClass, String fileExtension,
                                                String errorKey )
     {
@@ -568,5 +564,10 @@
         {
             return name.endsWith( _extension );
         }
+    }
+
+    protected FlowControllerInfo getSourceFileInfo()
+    {
+        return ( FlowControllerInfo ) super.getSourceFileInfo();
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java Tue Feb 22 22:03:16 2005
@@ -24,6 +24,7 @@
 import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
 import org.apache.beehive.netui.compiler.genmodel.GenValidationModel;
 import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.xmlbeans.XmlException;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 import com.sun.mirror.declaration.ClassDeclaration;
@@ -34,16 +35,11 @@
 {
     private static long _compilerJarTimestamp = -1;
     private static final boolean ALWAYS_GENERATE = true;  // TODO: this turns stale checking off.  Do we need it?
-//    private static final boolean ALWAYS_GENERATE = 
-//            System.getProperty( "pageflow.always-generate-struts-config" ) != null;
-    private FlowControllerInfo _fcInfo;
     
-    
-    
-    protected FlowControllerGenerator( AnnotationProcessorEnvironment env, FlowControllerInfo fcInfo )
+    protected FlowControllerGenerator( AnnotationProcessorEnvironment env, FlowControllerInfo fcInfo, 
+                                       Diagnostics diagnostics )
     {
-        super( env );
-        _fcInfo = fcInfo;
+        super( env, fcInfo, diagnostics );
     }
     
     protected abstract GenStrutsApp createStrutsApp( ClassDeclaration cl )
@@ -52,7 +48,7 @@
     public void generate( ClassDeclaration publicClass )
     {
         GenStrutsApp app = null;
-        _fcInfo.startBuild( getEnv(), publicClass );
+        getSourceFileInfo().startBuild( getEnv(), publicClass );
         
         try
         {
@@ -77,7 +73,7 @@
         }
         finally
         {
-            _fcInfo.endBuild();
+            getSourceFileInfo().endBuild();
         }
     }
 
@@ -120,8 +116,8 @@
         }
     }
 
-    protected FlowControllerInfo getFlowControllerInfo()
+    protected FlowControllerInfo getSourceFileInfo()
     {
-        return _fcInfo;
+        return ( FlowControllerInfo ) super.getSourceFileInfo();
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FormBeanChecker.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FormBeanChecker.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FormBeanChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FormBeanChecker.java Tue Feb 22 22:03:16 2005
@@ -30,6 +30,7 @@
 import java.util.Map;
 
 import org.apache.beehive.netui.compiler.grammar.ValidatablePropertyGrammar;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 
 import static org.apache.beehive.netui.compiler.JpfLanguageConstants.VALIDATABLE_PROPERTY_TAG_NAME;
 import static org.apache.beehive.netui.compiler.JpfLanguageConstants.FORM_CLASS_NAME;
@@ -40,16 +41,9 @@
 public class FormBeanChecker
         extends BaseChecker
 {
-    
-    
     public FormBeanChecker( AnnotationProcessorEnvironment env, Diagnostics diags )
     {
-        super( env, diags );
-    }
-
-    public BaseGenerator getGenerator()
-    {
-        return null;
+        super( env, null, diags );
     }
 
     public Map onCheck( ClassDeclaration jclass )

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java Tue Feb 22 22:03:16 2005
@@ -44,6 +44,7 @@
     public static final String RAISE_ACTION_TAG_NAME = "RaiseAction";
     public static final String SHARED_FLOW_REF_TAG_NAME = "SharedFlowRef";
     public static final String SHARED_FLOW_FIELD_TAG_NAME = "SharedFlowField";
+    public static final String PAGE_FLOW_FIELD_TAG_NAME = "PageFlowField";
     
     public static final String VALIDATE_REQUIRED_TAG_NAME = "ValidateRequired";
     public static final String VALIDATE_RANGE_TAG_NAME = "ValidateRange";

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java Tue Feb 22 22:03:16 2005
@@ -21,6 +21,7 @@
 import org.apache.beehive.netui.compiler.grammar.WebappPathOrActionType;
 import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
 import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.xmlbeans.XmlException;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 import com.sun.mirror.declaration.ClassDeclaration;
@@ -35,13 +36,8 @@
 import com.sun.mirror.type.TypeMirror;
 import com.sun.mirror.type.DeclaredType;
 
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
 import java.io.File;
-import java.io.FilenameFilter;
 import java.io.IOException;
 
 import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
@@ -52,12 +48,7 @@
 {
     public PageFlowChecker( AnnotationProcessorEnvironment env, Diagnostics diagnostics, FlowControllerInfo fcInfo )    
     {
-        super( env, diagnostics, fcInfo );
-    }
-
-    public BaseGenerator getGenerator()
-    {
-        return new PageFlowGenerator( getEnv(), getFlowControllerInfo() );
+        super( env, fcInfo, diagnostics );
     }
 
     protected void checkField( FieldDeclaration field, TypeDeclaration jclass )
@@ -74,7 +65,7 @@
             assert sharedFlowName != null;
             
             Collection< AnnotationMirror > sharedFlowRefs =
-                    getFlowControllerInfo().getMergedControllerAnnotation().getSharedFlowRefs();
+                    getSourceFileInfo().getMergedControllerAnnotation().getSharedFlowRefs();
             
             boolean foundOne = false;
             
@@ -146,7 +137,7 @@
         // Issue a warning if the class name is the same as the parent package name.
         // This causes ambiguity when resolving inner classes.
         //
-        if ( pkg != null && jpfClass.getSimpleName().equals( pkg.getSimpleName() ) )
+        if ( jpfClass.getSimpleName().equals( pkg.getSimpleName() ) )
         {
             getDiagnostics().addWarning( jpfClass, "warning.classname-same-as-package" );
         }
@@ -155,7 +146,7 @@
         // Make sure every .jpf has a begin action if the class isn't abstract.
         //
         boolean isAbstract = CompilerUtils.hasModifier( jpfClass, Modifier.ABSTRACT );
-        FlowControllerInfo fcInfo = getFlowControllerInfo();
+        FlowControllerInfo fcInfo = getSourceFileInfo();
         
         if ( ! WebappPathOrActionType.actionExists( BEGIN_ACTION_NAME, jpfClass, null, getEnv(), fcInfo, true )
              && ! isAbstract )
@@ -207,7 +198,7 @@
         throws XmlException, IOException, NoWebInfDirectoryException
     {
         File sourceFile = CompilerUtils.getSourceFile( jclass, true );
-        return new GenStrutsApp( sourceFile, jclass, getEnv(), getFlowControllerInfo(), true );
+        return new GenStrutsApp( sourceFile, jclass, getEnv(), getSourceFileInfo(), true );
     }
 
     protected AnnotationGrammar getControllerGrammar()
@@ -221,7 +212,7 @@
         public JpfControllerGrammar()
         {
             super( PageFlowChecker.this.getEnv(), PageFlowChecker.this.getDiagnostics(),
-                   PageFlowChecker.this.getRuntimeVersionChecker(), PageFlowChecker.this.getFlowControllerInfo() );
+                   PageFlowChecker.this.getRuntimeVersionChecker(), PageFlowChecker.this.getSourceFileInfo() );
             addMemberType( NESTED_ATTR, new AnnotationMemberType( null, this ) );
             addMemberType( LONGLIVED_ATTR, new LongLivedAttrType() );
         }
@@ -240,7 +231,7 @@
                                    int annotationArrayIndex )
             {
                 boolean isLongLived = ( Boolean ) value.getValue();
-                if ( isLongLived && getFlowControllerInfo().isNested() ) addError( value, "error.nested-long-lived" );
+                if ( isLongLived && getSourceFileInfo().isNested() ) addError( value, "error.nested-long-lived" );
                 return null;
             }
         }        

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowGenerator.java Tue Feb 22 22:03:16 2005
@@ -25,15 +25,16 @@
 
 import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
 import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.xmlbeans.XmlException;
 
 
 public class PageFlowGenerator
         extends FlowControllerGenerator
 {
-    public PageFlowGenerator( AnnotationProcessorEnvironment env, FlowControllerInfo fcInfo )
+    public PageFlowGenerator( AnnotationProcessorEnvironment env, FlowControllerInfo fcInfo, Diagnostics diags )
     {
-        super( env, fcInfo );
+        super( env, fcInfo, diags );
     }
 
     protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
@@ -41,6 +42,6 @@
         throws XmlException, IOException, NoWebInfDirectoryException
     {
         File sourceFile = CompilerUtils.getSourceFile( jclass, true );
-        return new GenStrutsApp( sourceFile, jclass, getEnv(), getFlowControllerInfo(), false );
+        return new GenStrutsApp( sourceFile, jclass, getEnv(), getSourceFileInfo(), false );
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/RuntimeVersionChecker.java Tue Feb 22 22:03:16 2005
@@ -27,6 +27,8 @@
 import java.util.jar.JarFile;
 import java.util.jar.Attributes;
 
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
+
 public class RuntimeVersionChecker
         implements JpfLanguageConstants
 {

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java Tue Feb 22 22:03:16 2005
@@ -21,6 +21,7 @@
 import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
 import org.apache.beehive.netui.compiler.genmodel.GenSharedFlowStrutsApp;
 import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.xmlbeans.XmlException;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 import com.sun.mirror.declaration.ClassDeclaration;
@@ -33,14 +34,9 @@
 public class SharedFlowChecker
         extends FlowControllerChecker
 {
-    public SharedFlowChecker( AnnotationProcessorEnvironment env, Diagnostics diagnostics, FlowControllerInfo fcInfo )
+    public SharedFlowChecker( AnnotationProcessorEnvironment env, FlowControllerInfo fcInfo, Diagnostics diagnostics )
     {
-        super( env, diagnostics, fcInfo );
-    }
-
-    public BaseGenerator getGenerator()
-    {
-        return new SharedFlowGenerator( getEnv(), getFlowControllerInfo() );
+        super( env, fcInfo, diagnostics );
     }
 
     protected void doAdditionalClassChecks( ClassDeclaration jclass, File webappRoot )
@@ -81,11 +77,11 @@
         throws XmlException, IOException, NoWebInfDirectoryException
     {
         File sourceFile = CompilerUtils.getSourceFile( jclass, true );
-        return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(), getFlowControllerInfo(), true );
+        return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(), getSourceFileInfo(), true );
     }
 
     protected AnnotationGrammar getControllerGrammar()
     {
-        return new ControllerGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), getFlowControllerInfo() );
+        return new ControllerGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), getSourceFileInfo() );
     }    
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowGenerator.java Tue Feb 22 22:03:16 2005
@@ -26,21 +26,22 @@
 import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
 import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
 import org.apache.beehive.netui.compiler.genmodel.GenSharedFlowStrutsApp;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.xmlbeans.XmlException;
 
 
 public class SharedFlowGenerator
     extends FlowControllerGenerator
 {
-    public SharedFlowGenerator( AnnotationProcessorEnvironment env, FlowControllerInfo fcInfo )
+    public SharedFlowGenerator( AnnotationProcessorEnvironment env, FlowControllerInfo fcInfo, Diagnostics diags )
     {
-        super( env, fcInfo );
+        super( env, fcInfo, diags );
     }
 
     protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
             throws XmlException, IOException, NoWebInfDirectoryException
     {
         File sourceFile = CompilerUtils.getSourceFile( jclass, true );
-        return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(), getFlowControllerInfo(), false );
+        return new GenSharedFlowStrutsApp( sourceFile, jclass, getEnv(), getSourceFileInfo(), false );
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/BaseAnnotationProcessor.java Tue Feb 22 22:03:16 2005
@@ -17,128 +17,132 @@
  */
 package org.apache.beehive.netui.compiler.apt;
 
+import static org.apache.beehive.netui.compiler.JpfLanguageConstants.ANNOTATIONS_CLASSNAME;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.declaration.TypeDeclaration;
 import com.sun.mirror.declaration.ClassDeclaration;
-import com.sun.mirror.declaration.MethodDeclaration;
 import com.sun.mirror.declaration.Declaration;
-import com.sun.mirror.declaration.AnnotationMirror;
-import com.sun.mirror.declaration.AnnotationValue;
-import com.sun.mirror.util.SimpleDeclarationVisitor;
+import com.sun.mirror.declaration.Modifier;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
 import com.sun.mirror.type.ClassType;
-import org.apache.beehive.netui.compiler.Diagnostics;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.beehive.netui.compiler.BaseChecker;
 import org.apache.beehive.netui.compiler.BaseGenerator;
 import org.apache.beehive.netui.compiler.CompilerUtils;
+import org.apache.beehive.netui.compiler.SourceFileInfo;
+import org.apache.beehive.controls.runtime.generator.apt.TwoPhaseAnnotationProcessor;
 
-import java.util.Collection;
+import java.util.Set;
+import java.util.HashMap;
+import java.util.ResourceBundle;
+import java.text.MessageFormat;
 
 public abstract class BaseAnnotationProcessor
-        implements AnnotationProcessor
+        extends TwoPhaseAnnotationProcessor
 {
-    private final AnnotationProcessorEnvironment _env;
-
+    private HashMap< String, SourceFileInfo > _sourceFileInfo;
+    private ResourceBundle _messages;
+    
     
-    BaseAnnotationProcessor( AnnotationProcessorEnvironment env )
+    protected BaseAnnotationProcessor( Set< AnnotationTypeDeclaration > annotationTypeDecls,
+                                       AnnotationProcessorEnvironment env )
     {
-        _env = env;
+        super( annotationTypeDecls, env );
+        _messages = ResourceBundle.getBundle( "org.apache.beehive.netui.compiler.diagnostics" );
     }
 
-    public void process()
+    public void check( Declaration decl )
     {
-        ListClassVisitor visitor = new ListClassVisitor();
+        assert _sourceFileInfo != null;     // process() should guarantee this.
         
-        for ( TypeDeclaration typeDecl : _env.getSpecifiedTypeDeclarations() )
-        {
-            typeDecl.accept( visitor );
-        }
-    }
-    
-    private class ListClassVisitor extends SimpleDeclarationVisitor
-    {
-        public void visitTypeDeclaration( TypeDeclaration decl )
+        if ( decl instanceof ClassDeclaration )
         {
-            if ( decl instanceof ClassDeclaration )
+            ClassDeclaration classDecl = ( ClassDeclaration ) decl;
+            BaseChecker checker = getChecker( classDecl, this );
+            
+            if ( checker != null )
             {
-                ClassDeclaration classDecl = ( ClassDeclaration ) decl;
-                Diagnostics diagnostics = new Diagnostics( _env );
-                BaseChecker checker = getChecker( classDecl, diagnostics );
+                checker.check( classDecl );
+                
+                //
+                // Also do a silent check on all base classes.  We don't want to generate if there were errors
+                // in the base class.
+                //
+                SilentDiagnostics silentDiagnostics = new SilentDiagnostics();
                 
-                if ( checker != null )
+                for ( ClassType i = classDecl.getSuperclass(); i != null; i = i.getSuperclass() )
                 {
-                    checker.check( classDecl );
-                    
-                    //
-                    // Also do a silent check on all base classes.  We don't want to generate if there were errors
-                    // in the base class.
-                    //
-                    SilentDiagnostics silentDiagnostics = new SilentDiagnostics();
-                    for ( ClassType i = classDecl.getSuperclass(); i != null; i = i.getSuperclass() )
-                    {
-                        ClassDeclaration baseDecl = i.getDeclaration();
-                        
-                        if ( CompilerUtils.getSourceFile( baseDecl, false ) != null )
-                        {
-                            BaseChecker silentChecker = getChecker( baseDecl, silentDiagnostics );
-                            if ( silentChecker != null ) silentChecker.check( baseDecl );
-                        }
-                    }
+                    ClassDeclaration baseDecl = i.getDeclaration();
                     
-                    if ( ! diagnostics.hadErrors() && ! silentDiagnostics.hadErrors() )
+                    if ( CompilerUtils.getSourceFile( baseDecl, false ) != null )
                     {
-                        BaseGenerator generator = checker.getGenerator();
-                        if ( generator != null ) generator.generate( classDecl );
+                        BaseChecker silentChecker = getChecker( baseDecl, silentDiagnostics );
+                        if ( silentChecker != null ) silentChecker.check( baseDecl );
                     }
                 }
+                
+                if ( silentDiagnostics.hasErrors() ) setHasErrors( true );
             }
         }
     }
 
-    private static class SilentDiagnostics extends Diagnostics
+    public void generate( Declaration decl )
     {
-        public SilentDiagnostics()
-        {
-            super( null );
-        }
-
-        public void addError( Declaration decl, String messageKey, Object... args )
-        {
-            setHadErrors( true );
-        }
-
-        public void addError( AnnotationMirror ann, String messageKey, Object... args )
-        {
-            setHadErrors( true );
-        }
-
-        public void addErrorArrayArgs( AnnotationMirror ann, String messageKey, Object[] args )
+        assert _sourceFileInfo != null;     // process() should guarantee this.
+        
+        if ( decl instanceof ClassDeclaration )
         {
-            setHadErrors( true );
+            ClassDeclaration classDecl = ( ClassDeclaration ) decl;
+            BaseGenerator generator = getGenerator( classDecl, this );
+            if ( generator != null ) generator.generate( classDecl );
         }
+    }
 
-        public void addError( AnnotationValue annVal, String messageKey, Object... args )
-        {
-            setHadErrors( true );
-        }
+    public void process()
+    {
+        _sourceFileInfo = new HashMap< String, SourceFileInfo >();
+        super.process();
+        _sourceFileInfo = null;
+    }
 
-        public void addWarning( Declaration decl, String messageKey, Object... args )
-        {
-        }
+    protected abstract BaseChecker getChecker( ClassDeclaration decl, Diagnostics diagnostics );
+    
+    protected abstract BaseGenerator getGenerator( ClassDeclaration decl, Diagnostics diagnostics );
+    
+    protected SourceFileInfo getSourceFileInfo( ClassDeclaration decl )
+    {
+        return _sourceFileInfo.get( decl.getQualifiedName() );
+    }
 
-        public void addWarning( AnnotationMirror ann, String messageKey, Object... args )
+    protected void setSourceFileInfo( ClassDeclaration decl, SourceFileInfo sourceFileInfo )
+    {
+        _sourceFileInfo.put( decl.getQualifiedName(), sourceFileInfo );
+    }
+    
+    protected static boolean expectAnnotation( ClassDeclaration classDecl, String annotationBaseName,
+                                               String fileExtensionRequiresAnnotation, String baseClass,
+                                               Diagnostics diagnostics )
+    {
+        if ( CompilerUtils.getAnnotation( classDecl, annotationBaseName ) != null ) return true;
+        
+        String fileName = classDecl.getPosition().file().getName();
+        
+        if ( fileExtensionRequiresAnnotation != null && fileName.endsWith( fileExtensionRequiresAnnotation ) )
         {
+            diagnostics.addError( classDecl, "error.annotation-required", 
+                                  fileExtensionRequiresAnnotation, ANNOTATIONS_CLASSNAME + '.' + annotationBaseName );
         }
-
-        public void addWarning( AnnotationValue annVal, String messageKey, Object... args )
+        else if ( ! CompilerUtils.hasModifier( classDecl, Modifier.ABSTRACT ) )
         {
+            diagnostics.addWarning( classDecl, "warning.missing-annotation", baseClass,
+                                    ANNOTATIONS_CLASSNAME + '.' + annotationBaseName );
         }
+        
+        return false;
     }
     
-    protected abstract BaseChecker getChecker( ClassDeclaration decl, Diagnostics diagnostics );
-    
-    protected AnnotationProcessorEnvironment getEnv()
+    protected String getResourceString( String key, Object ... args )
     {
-        return _env;
+        String message = _messages.getString( key );
+        return MessageFormat.format( message, args );
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessor.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessor.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessor.java Tue Feb 22 22:03:16 2005
@@ -18,30 +18,40 @@
 package org.apache.beehive.netui.compiler.apt;
 
 import org.apache.beehive.netui.compiler.BaseChecker;
-import org.apache.beehive.netui.compiler.Diagnostics;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.beehive.netui.compiler.FormBeanChecker;
 import org.apache.beehive.netui.compiler.CompilerUtils;
+import org.apache.beehive.netui.compiler.BaseGenerator;
 import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 
 import static org.apache.beehive.netui.compiler.JpfLanguageConstants.FORM_BEAN_TAG_NAME;
 
+import java.util.Set;
+
 
 public class FormBeanAnnotationProcessor
         extends BaseAnnotationProcessor
 {
-    FormBeanAnnotationProcessor( AnnotationProcessorEnvironment env )
+    FormBeanAnnotationProcessor( Set< AnnotationTypeDeclaration > annotationTypeDecls,
+                                 AnnotationProcessorEnvironment env )
     {
-        super( env );
+        super( annotationTypeDecls, env );
     }
     
     protected BaseChecker getChecker( ClassDeclaration decl, Diagnostics diagnostics )
     {
         if ( CompilerUtils.getAnnotation( decl, FORM_BEAN_TAG_NAME ) != null )
         {
-            return new FormBeanChecker( getEnv(), diagnostics );
+            return new FormBeanChecker( getAnnotationProcessorEnvironment(), diagnostics );
         }
         
+        return null;
+    }
+    
+    protected BaseGenerator getGenerator( ClassDeclaration decl, Diagnostics diagnostics )
+    {
         return null;
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessorFactory.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessorFactory.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/FormBeanAnnotationProcessorFactory.java Tue Feb 22 22:03:16 2005
@@ -37,7 +37,7 @@
     public Collection<String> supportedAnnotationTypes()
     {
         return Collections.unmodifiableCollection(
-            Arrays.asList( new String[]{ ANNOTATION_QUALIFIER + FORM_BEAN_TAG_NAME + "*" } ) );
+            Arrays.asList( new String[]{ ANNOTATION_QUALIFIER + FORM_BEAN_TAG_NAME } ) );
     }
 
     public Collection< String > supportedOptions()
@@ -48,6 +48,6 @@
     public AnnotationProcessor getProcessorFor( Set< AnnotationTypeDeclaration > annotationTypeDeclarations,
                                                 AnnotationProcessorEnvironment env )
     {
-        return new FormBeanAnnotationProcessor( env );
+        return new FormBeanAnnotationProcessor( annotationTypeDeclarations, env );
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java Tue Feb 22 22:03:16 2005
@@ -20,73 +20,70 @@
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 import com.sun.mirror.declaration.AnnotationMirror;
 import com.sun.mirror.declaration.ClassDeclaration;
-import com.sun.mirror.declaration.Modifier;
-import org.apache.beehive.netui.compiler.BaseChecker;
-import org.apache.beehive.netui.compiler.CompilerUtils;
-import org.apache.beehive.netui.compiler.Diagnostics;
-import org.apache.beehive.netui.compiler.FlowControllerInfo;
-import org.apache.beehive.netui.compiler.PageFlowChecker;
-import org.apache.beehive.netui.compiler.SharedFlowChecker;
-import org.apache.beehive.netui.compiler.FacesBackingChecker;
-import org.apache.beehive.netui.compiler.FacesBackingInfo;
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.JPF_BASE_CLASS;
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.SHARED_FLOW_BASE_CLASS;
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.GLOBALAPP_BASE_CLASS;
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.JPF_FILE_EXTENSION_DOT;
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.SHARED_FLOW_FILE_EXTENSION_DOT;
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.GLOBALAPP_FILE_EXTENSION_DOT;
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.CONTROLLER_TAG_NAME;
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.FACES_BACKING_TAG_NAME;
-import static org.apache.beehive.netui.compiler.JpfLanguageConstants.ANNOTATIONS_CLASSNAME;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import org.apache.beehive.netui.compiler.*;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
+import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
 
 import java.io.File;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.text.MessageFormat;
 
 
 public class PageFlowAnnotationProcessor
         extends BaseAnnotationProcessor
 {
-    protected PageFlowAnnotationProcessor( AnnotationProcessorEnvironment env )
+    public PageFlowAnnotationProcessor( Set< AnnotationTypeDeclaration > annotationTypeDecls,
+                                        AnnotationProcessorEnvironment env )
     {
-        super( env );
+        super( annotationTypeDecls, env );
     }
 
-    protected BaseChecker getChecker( ClassDeclaration classDecl, Diagnostics diagnostics )
+    public BaseChecker getChecker( ClassDeclaration classDecl, Diagnostics diagnostics )
     {
-        String className = classDecl.getQualifiedName();
+        AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment();
         
-        if ( CompilerUtils.getAnnotation( classDecl, FACES_BACKING_TAG_NAME ) != null )
+        if ( CompilerUtils.isAssignableFrom( JPF_BASE_CLASS, classDecl, env ) )
         {
-            File originalFile = CompilerUtils.getSourceFile( classDecl, true );
-            FacesBackingInfo fbInfo = new FacesBackingInfo( originalFile, className );
-            return new FacesBackingChecker( getEnv(), diagnostics, fbInfo );
+            if ( expectAnnotation( classDecl, CONTROLLER_TAG_NAME, JPF_FILE_EXTENSION_DOT, JPF_BASE_CLASS, diagnostics ) )
+            {
+                FlowControllerInfo fcInfo = new FlowControllerInfo( classDecl );
+                setSourceFileInfo( classDecl, fcInfo );
+                
+                return new PageFlowChecker( env, diagnostics, fcInfo );
+            }
         }
-        else if ( CompilerUtils.isAssignableFrom( JPF_BASE_CLASS, classDecl, getEnv() ) )
+        else if ( CompilerUtils.isAssignableFrom( SHARED_FLOW_BASE_CLASS, classDecl, env ) )
         {
-            FlowControllerInfo fcInfo = new FlowControllerInfo( classDecl );
-            
-            if ( expectControllerAnnotation( classDecl, JPF_FILE_EXTENSION_DOT, JPF_BASE_CLASS, diagnostics ) )
+            if ( expectAnnotation( classDecl, CONTROLLER_TAG_NAME, SHARED_FLOW_FILE_EXTENSION_DOT,
+                                   SHARED_FLOW_BASE_CLASS, diagnostics ) )
             {
-                return new PageFlowChecker( getEnv(), diagnostics, fcInfo );
+                FlowControllerInfo fcInfo = new FlowControllerInfo( classDecl );
+                setSourceFileInfo( classDecl, fcInfo );
+                
+                return new SharedFlowChecker( env, fcInfo, diagnostics );
             }
         }
-        else if ( CompilerUtils.isAssignableFrom( SHARED_FLOW_BASE_CLASS, classDecl, getEnv() ) )
+        else if ( CompilerUtils.isAssignableFrom( GLOBALAPP_BASE_CLASS, classDecl, env ) )
         {
-            FlowControllerInfo fcInfo = new FlowControllerInfo( classDecl );
-            
-            if ( expectControllerAnnotation( classDecl, SHARED_FLOW_FILE_EXTENSION_DOT, SHARED_FLOW_BASE_CLASS,
-                                             diagnostics ) )
+            if ( expectAnnotation( classDecl, CONTROLLER_TAG_NAME, GLOBALAPP_FILE_EXTENSION_DOT, GLOBALAPP_BASE_CLASS,
+                                   diagnostics ) )
             {
-                return new SharedFlowChecker( getEnv(), diagnostics, fcInfo );
+                FlowControllerInfo fcInfo = new FlowControllerInfo( classDecl );
+                setSourceFileInfo( classDecl, fcInfo );
+                
+                return new SharedFlowChecker( env, fcInfo, diagnostics );
             }
         }
-        else if ( CompilerUtils.isAssignableFrom( GLOBALAPP_BASE_CLASS, classDecl, getEnv() ) )
+        else if ( CompilerUtils.isAssignableFrom( FACES_BACKING_BEAN_CLASS, classDecl, env ) )
         {
-            FlowControllerInfo fcInfo = new FlowControllerInfo( classDecl );
-            
-            if ( expectControllerAnnotation( classDecl, GLOBALAPP_FILE_EXTENSION_DOT, GLOBALAPP_BASE_CLASS,
-                                             diagnostics ) )
+            if ( expectAnnotation( classDecl, FACES_BACKING_TAG_NAME, JPF_FILE_EXTENSION_DOT, JPF_BASE_CLASS, diagnostics ) )
             {
-                return new SharedFlowChecker( getEnv(), diagnostics, fcInfo );
+                File originalFile = CompilerUtils.getSourceFile( classDecl, true );
+                FacesBackingInfo fbInfo = new FacesBackingInfo( originalFile, classDecl.getQualifiedName() );
+                setSourceFileInfo( classDecl, fbInfo );
+                return new FacesBackingChecker( env, fbInfo, diagnostics );
             }
         }
         else
@@ -98,30 +95,43 @@
                 diagnostics.addError( ann, "error.annotation-invalid-base-class2",
                                       CONTROLLER_TAG_NAME, JPF_BASE_CLASS, SHARED_FLOW_BASE_CLASS );
             }
+            
+            ann = CompilerUtils.getAnnotation( classDecl, FACES_BACKING_TAG_NAME );
+            
+            if ( ann != null )
+            {
+                diagnostics.addError( ann, "error.annotation-invalid-base-class",
+                                      FACES_BACKING_TAG_NAME, FACES_BACKING_BEAN_CLASS );
+            }
         }
         
         return null;
     }
 
-    private static boolean expectControllerAnnotation( ClassDeclaration classDecl,
-                                                       String fileExtensionRequiresAnnotation, String baseClass,
-                                                       Diagnostics diagnostics )
+    public BaseGenerator getGenerator( ClassDeclaration classDecl, Diagnostics diags )
     {
-        if ( CompilerUtils.getAnnotation( classDecl, CONTROLLER_TAG_NAME ) != null ) return true;
-        
-        String fileName = classDecl.getPosition().file().getName();
+        AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment();
+        SourceFileInfo sourceFileInfo = getSourceFileInfo( classDecl );
         
-        if ( fileExtensionRequiresAnnotation != null && fileName.endsWith( fileExtensionRequiresAnnotation ) )
+        if ( CompilerUtils.isAssignableFrom( JPF_BASE_CLASS, classDecl, env ) )
         {
-            diagnostics.addError( classDecl, "error.controller-annotation-required", 
-                                  fileExtensionRequiresAnnotation, ANNOTATIONS_CLASSNAME + '.' + CONTROLLER_TAG_NAME );
+            assert sourceFileInfo != null : classDecl.getQualifiedName();
+            assert sourceFileInfo instanceof FlowControllerInfo : sourceFileInfo.getClass().getName();
+            return new PageFlowGenerator( env, ( FlowControllerInfo ) sourceFileInfo, diags );
         }
-        else if ( ! CompilerUtils.hasModifier( classDecl, Modifier.ABSTRACT ) )
+        else if ( CompilerUtils.isAssignableFrom( SHARED_FLOW_BASE_CLASS, classDecl, env ) )
         {
-            diagnostics.addWarning( classDecl, "warning.no-controller-annotation", baseClass,
-                                    ANNOTATIONS_CLASSNAME + '.' + CONTROLLER_TAG_NAME );
+            assert sourceFileInfo != null : classDecl.getQualifiedName();
+            assert sourceFileInfo instanceof FlowControllerInfo : sourceFileInfo.getClass().getName();
+            return new SharedFlowGenerator( env, ( FlowControllerInfo ) sourceFileInfo, diags );
+        }
+        else if ( CompilerUtils.isAssignableFrom( FACES_BACKING_BEAN_CLASS, classDecl, env ) )
+        {
+            assert sourceFileInfo != null : classDecl.getQualifiedName();
+            assert sourceFileInfo instanceof FacesBackingInfo : sourceFileInfo.getClass().getName();
+            return new FacesBackingGenerator( env, sourceFileInfo, diags );
         }
         
-        return false;
+        return null;
     }
 }

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessorFactory.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessorFactory.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessorFactory.java Tue Feb 22 22:03:16 2005
@@ -26,15 +26,42 @@
 import java.util.Collection;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ArrayList;
 
 import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
 
 public class PageFlowAnnotationProcessorFactory
         implements AnnotationProcessorFactory
 {
+    private static final HashSet< String > PAGEFLOW_ANNOTATIONS = new HashSet< String >();
+    private static final HashSet< String > FACES_BACKING_ANNOTATIONS = new HashSet< String >();
+    
+    private static final ArrayList< String > SUPPORTED_ANNOTATION_TYPES = new ArrayList< String >();
+    
+    static
+    {
+        PAGEFLOW_ANNOTATIONS.add( ANNOTATION_QUALIFIER + CONTROLLER_TAG_NAME );
+        PAGEFLOW_ANNOTATIONS.add( ANNOTATION_QUALIFIER + ACTION_TAG_NAME );
+        PAGEFLOW_ANNOTATIONS.add( ANNOTATION_QUALIFIER + EXCEPTION_HANDLER_TAG_NAME );
+        PAGEFLOW_ANNOTATIONS.add( ANNOTATION_QUALIFIER + SIMPLE_ACTION_TAG_NAME );
+        PAGEFLOW_ANNOTATIONS.add( ANNOTATION_QUALIFIER + FORWARD_TAG_NAME );
+        
+        FACES_BACKING_ANNOTATIONS.add( ANNOTATION_QUALIFIER + FACES_BACKING_TAG_NAME );
+        FACES_BACKING_ANNOTATIONS.add( ANNOTATION_QUALIFIER + RAISE_ACTION_TAG_NAME );
+        FACES_BACKING_ANNOTATIONS.add( ANNOTATION_QUALIFIER + PAGE_FLOW_FIELD_TAG_NAME );
+        FACES_BACKING_ANNOTATIONS.add( ANNOTATION_QUALIFIER + COMMAND_HANDLER_TAG_NAME );
+        
+        SUPPORTED_ANNOTATION_TYPES.addAll( PAGEFLOW_ANNOTATIONS );
+        SUPPORTED_ANNOTATION_TYPES.addAll( FACES_BACKING_ANNOTATIONS );
+        SUPPORTED_ANNOTATION_TYPES.add( ANNOTATION_QUALIFIER + SHARED_FLOW_FIELD_TAG_NAME );
+        SUPPORTED_ANNOTATION_TYPES.add( ANNOTATION_QUALIFIER + SHARED_FLOW_REF_TAG_NAME );
+    }
+    
     public Collection< String > supportedAnnotationTypes()
     {
-        return Collections.unmodifiableCollection( Arrays.asList( new String[]{ ANNOTATION_QUALIFIER + '*' } ) );
+        return SUPPORTED_ANNOTATION_TYPES;
     }
 
     public Collection< String > supportedOptions()
@@ -45,6 +72,6 @@
     public AnnotationProcessor getProcessorFor( Set< AnnotationTypeDeclaration > annotationTypeDeclarations,
                                                 AnnotationProcessorEnvironment env )
     {
-        return new PageFlowAnnotationProcessor( env );
+        return new PageFlowAnnotationProcessor( annotationTypeDeclarations, env );
     }
 }

Added: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/SilentDiagnostics.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/SilentDiagnostics.java?view=auto&rev=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/SilentDiagnostics.java (added)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/SilentDiagnostics.java Tue Feb 22 22:03:16 2005
@@ -0,0 +1,72 @@
+/*
+ * 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.apt;
+
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
+import com.sun.mirror.declaration.Declaration;
+import com.sun.mirror.declaration.AnnotationMirror;
+import com.sun.mirror.declaration.AnnotationValue;
+
+public class SilentDiagnostics extends Diagnostics
+{
+    public SilentDiagnostics()
+    {
+        super( null );
+    }
+
+    @Override public void addError( Declaration decl, String messageKey, Object... args )
+    {
+        setHasErrors( true );
+    }
+
+    @Override public void addError( AnnotationMirror ann, String messageKey, Object... args )
+    {
+        setHasErrors( true );
+    }
+
+    @Override public void addErrorArrayArgs( AnnotationMirror ann, String messageKey, Object[] args )
+    {
+        setHasErrors( true );
+    }
+
+    @Override public void addError( AnnotationValue annVal, String messageKey, Object... args )
+    {
+        setHasErrors( true );
+    }
+
+    @Override public void addWarning( Declaration decl, String messageKey, Object... args )
+    {
+    }
+
+    @Override public void addWarning( AnnotationMirror ann, String messageKey, Object... args )
+    {
+    }
+
+    @Override public void addWarning( AnnotationValue annVal, String messageKey, Object... args )
+    {
+    }
+
+    protected String getResourceString( String key, Object... args )
+    {
+        assert false;   // this should never get called
+        return null;
+    }
+}
+
+
+

Propchange: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/SilentDiagnostics.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties Tue Feb 22 22:03:16 2005
@@ -154,8 +154,8 @@
 error.annotation-invalid-base-class2 = \
 The {0} annotation is not valid on this class.  The class should extend {1} or {2}.
 
-error.controller-annotation-required = Files ending with "{0}" must have the {1} annotation.
-warning.no-controller-annotation = This class extends {0}, but it does not have the {1} annotation and is not abstract.
+error.annotation-required = Files ending with "{0}" must have the {1} annotation.
+warning.missing-annotation = This class extends {0}, but it does not have the {1} annotation and is not abstract.
 
 warning.no-such-action = There is no action "{0}" in page flow {1}.
 warning.using-default-display-name = \

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java Tue Feb 22 22:03:16 2005
@@ -315,7 +315,7 @@
     
     protected String getMergeFileName()
     {
-        return CompilerUtils.getStringValue( _jclass, CONTROLLER_TAG_NAME, STRUTSMERGE_ATTR, true );
+        return getFlowControllerInfo().getMergedControllerAnnotation().getStrutsMerge();
     }
     
     public void writeToFile()

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java Tue Feb 22 22:03:16 2005
@@ -63,7 +63,7 @@
         _strutsApp = strutsApp;
         setValidatorVersion( mca.getValidatorVersion() );
         addRulesFromBeans( jclass );
-        addRulesFromActions( jclass );
+        addRulesFromActions( jclass, mca );
         addRulesFromClass( mca );
         String mergeFileName = mca.getValidatorMerge();
         _mergeFile = strutsApp.getMergeFile( mergeFileName );
@@ -160,7 +160,7 @@
         addFieldRules( validationFieldAnn, ruleInfo, true );
     }
     
-    private void addRulesFromActions( ClassDeclaration jclass )
+    private void addRulesFromActions( ClassDeclaration jclass, MergedControllerAnnotation mca )
     {
         Collection< MethodDeclaration > methods = CompilerUtils.getClassMethods( jclass, ACTION_TAG_NAME );
         
@@ -172,11 +172,7 @@
         }
         
         
-        AnnotationMirror controllerAnnotation = CompilerUtils.getAnnotation( jclass, CONTROLLER_TAG_NAME );
-        assert controllerAnnotation != null;    // checker should enforce this
-        
-        Collection< AnnotationMirror > simpleActions =
-                CompilerUtils.getAnnotationArray( controllerAnnotation, SIMPLE_ACTIONS_ATTR, true );
+        Collection< AnnotationMirror > simpleActions = mca.getSimpleActions();
         
         if ( simpleActions != null )
         {

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java Tue Feb 22 22:03:16 2005
@@ -20,7 +20,7 @@
 import org.apache.beehive.netui.compiler.RuntimeVersionChecker;
 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.controls.runtime.generator.apt.Diagnostics;
 import org.apache.beehive.netui.compiler.CompilerUtils;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 import com.sun.mirror.declaration.*;

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionOutputGrammar.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionOutputGrammar.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionOutputGrammar.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionOutputGrammar.java Tue Feb 22 22:03:16 2005
@@ -18,7 +18,7 @@
 package org.apache.beehive.netui.compiler.grammar;
 
 import org.apache.beehive.netui.compiler.AnnotationGrammar;
-import org.apache.beehive.netui.compiler.Diagnostics;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.beehive.netui.compiler.RuntimeVersionChecker;
 import org.apache.beehive.netui.compiler.AnnotationMemberType;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseFlowControllerGrammar.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseFlowControllerGrammar.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseFlowControllerGrammar.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseFlowControllerGrammar.java Tue Feb 22 22:03:16 2005
@@ -18,7 +18,7 @@
 package org.apache.beehive.netui.compiler.grammar;
 
 import org.apache.beehive.netui.compiler.AnnotationGrammar;
-import org.apache.beehive.netui.compiler.Diagnostics;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.beehive.netui.compiler.RuntimeVersionChecker;
 import org.apache.beehive.netui.compiler.FlowControllerInfo;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;

Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseValidationRuleGrammar.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseValidationRuleGrammar.java?view=diff&r1=154964&r2=154965
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseValidationRuleGrammar.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseValidationRuleGrammar.java Tue Feb 22 22:03:16 2005
@@ -19,7 +19,7 @@
 
 import org.apache.beehive.netui.compiler.AnnotationGrammar;
 import org.apache.beehive.netui.compiler.RuntimeVersionChecker;
-import org.apache.beehive.netui.compiler.Diagnostics;
+import org.apache.beehive.controls.runtime.generator.apt.Diagnostics;
 import org.apache.beehive.netui.compiler.CompilerUtils;
 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
 import com.sun.mirror.declaration.AnnotationMirror;