Author: rich
Date: Thu Dec 16 01:54:20 2004
New Revision: 122539
URL: http://svn.apache.org/viewcvs?view=rev&rev=122539
Log:
Changes to support page flow (and shared flow) inheritance. Now, a page flow
or shared flow can inherit actions, exception handlers, and metadata in
general. The concept is simple: when a page flow or shared flow extends a base
class,
- it inherits all actions and exception-handlers (methods with @Jpf.Action
and @Jpf.ExceptionHandler annotations).
- it *merges* the @Jpf.Controller annotations from all superclasses,
overriding values when there are conflicts.
DRT/BVT: netui (WinXP)
BB: self (WinXP)
Added:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/pageFlowCore/inheritance/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/pageFlowCore/inheritance/super0/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/pageFlowCore/inheritance/super0/Super0.java
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/Controller.jpf
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/index.jsp
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/success.jsp
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super1/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super1/Super1.jpf
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super1/index.jsp
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super2/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super2/Super2.jpf
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super2/index.jsp
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PfInheritance.xml
(contents, props changed)
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.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/FlowControllerInfo.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/apt/PageFlowAnnotationProcessor.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenExceptionModel.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java
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/BaseFlowControllerGrammar.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/ForwardGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardToExternalPathType.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/SimpleActionGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathOrActionType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WritableFieldType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultReloadableClassHandler.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/BaseChecker.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -39,17 +39,25 @@
_diagnostics = diagnostics;
}
+ Map check( ClassDeclaration jclass, File webappRoot )
+ {
+ _webappRoot = webappRoot;
+ setRuntimeVersionChecker( new RuntimeVersionChecker( _webappRoot ) );
+ return onCheck( jclass );
+ }
+
public final Map check( ClassDeclaration jclass )
{
//
// Get a RuntimeVersionChecker (which looks at the manifest of
beehive-netui-pageflow.jar).
//
+ File webappRoot;
File sourceFile = CompilerUtils.getOriginalFile( jclass );
+ assert sourceFile != null : "could not get source file for " +
jclass.getQualifiedName();
try
{
- _webappRoot = StrutsApp.getWebappRootFromJpf( sourceFile );
- setRuntimeVersionChecker( new RuntimeVersionChecker( _webappRoot )
);
+ webappRoot = StrutsApp.getWebappRootFromJpf( sourceFile );
}
catch ( NoWebInfDirectoryException e )
{
@@ -57,7 +65,7 @@
return null;
}
- return onCheck( jclass );
+ return check( jclass, webappRoot );
}
public abstract Map onCheck( ClassDeclaration jclass );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
Thu Dec 16 01:54:20 2004
@@ -576,12 +576,6 @@
return ( ClassDeclaration ) classMember;
}
- public static boolean isInNestedPageFlow( MemberDeclaration classMember )
- {
- AnnotationValue val = getAnnotationValue( getOuterClass( classMember
), CONTROLLER_TAG_NAME, NESTED_ATTR );
- return val != null && ( ( Boolean ) val.getValue() ).booleanValue();
- }
-
public static boolean hasDefaultConstructor( TypeDeclaration jclass )
{
if ( ! ( jclass instanceof ClassDeclaration ) ) return false;
@@ -646,14 +640,6 @@
public static String getLoadableName( DeclaredType jclass )
{
return getLoadableName( getDeclaration( jclass ) );
- }
-
- public static boolean getMethodOrClassFlag( AnnotationMirror
methodAnnotation, ClassDeclaration jclass,
- String attrName )
- {
- Boolean flag = CompilerUtils.getBoolean( methodAnnotation, attrName,
true );
- if ( flag == null ) flag = CompilerUtils.getBooleanValue( jclass,
CONTROLLER_TAG_NAME, attrName, true );
- return flag != null && flag.booleanValue();
}
/**
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingChecker.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FacesBackingChecker.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -71,8 +71,11 @@
}
}
+ FlowControllerInfo fcInfo = new FlowControllerInfo( jpfClass );
+ fcInfo.startBuild( getEnv(), jpfClass );
+
CommandHandlerGrammar chg =
- new CommandHandlerGrammar( getEnv(), getDiagnostics(),
getRuntimeVersionChecker(), jpfClass );
+ new CommandHandlerGrammar( getEnv(), getDiagnostics(),
getRuntimeVersionChecker(), jpfClass, fcInfo );
Collection< MethodDeclaration > methods =
CompilerUtils.getClassMethods( jclass, COMMAND_HANDLER_TAG_NAME );
for ( MethodDeclaration method : methods )
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -79,8 +79,20 @@
_formBeanChecker = new FormBeanChecker( getEnv(), getDiagnostics() );
_fcInfo.setWebappRoot( getWebappRoot() );
- _fcInfo.startBuild();
+ _fcInfo.startBuild( getEnv(), jclass );
+ try
+ {
+ return onCheckInternal( jclass );
+ }
+ finally
+ {
+ _fcInfo.endBuild();
+ }
+ }
+
+ private Map onCheckInternal( ClassDeclaration jclass )
+ {
//
// Check the base class.
//
@@ -150,7 +162,6 @@
}
endCheckClass( jclass );
- _fcInfo.endBuild();
_checkResultMap.put(
JpfLanguageConstants.ExtraInfoKeys.flowControllerInfo, _fcInfo );
return _checkResultMap;
}
@@ -160,9 +171,8 @@
//
// Look through Forwards and SimpleActions in the Controller
annotation.
//
- AnnotationMirror controllerAnn = CompilerUtils.getAnnotation(
flowControllerClass, CONTROLLER_TAG_NAME );
- enableNavigateTo( controllerAnn, FORWARDS_ATTR, fcInfo );
- enableNavigateTo( controllerAnn, SIMPLE_ACTIONS_ATTR, fcInfo );
+ enableNavigateTo(
fcInfo.getMergedControllerAnnotation().getForwards(), fcInfo );
+ enableNavigateTo(
fcInfo.getMergedControllerAnnotation().getSimpleActions(), fcInfo );
//
// Look through Forwards on Action and ExceptionHandler methods.
@@ -172,14 +182,12 @@
{
AnnotationMirror ann = CompilerUtils.getAnnotation( method,
ACTION_TAG_NAME );
if ( ann == null ) ann = CompilerUtils.getAnnotation( method,
EXCEPTION_HANDLER_TAG_NAME );
- if ( ann != null ) enableNavigateTo( ann, FORWARDS_ATTR, fcInfo );
+ if ( ann != null ) enableNavigateTo(
CompilerUtils.getAnnotationArray( ann, FORWARDS_ATTR, true ), fcInfo );
}
}
- private static void enableNavigateTo( AnnotationMirror ann, String
memberArrayName, FlowControllerInfo fcInfo )
+ private static void enableNavigateTo( Collection< AnnotationMirror >
childAnnotations, FlowControllerInfo fcInfo )
{
- List< AnnotationMirror > childAnnotations =
CompilerUtils.getAnnotationArray( ann, memberArrayName, true );
-
if ( childAnnotations != null )
{
for ( AnnotationMirror childAnnotation : childAnnotations )
@@ -273,19 +281,17 @@
//
- // Check the Jpf.Controller annotation.
+ // Check the Jpf.Controller annotation on this class and all
superclasses.
//
- Collection< AnnotationMirror > annotations =
jclass.getAnnotationMirrors();
-
- for ( AnnotationMirror annotation : annotations )
+ ClassDeclaration i = jclass;
+ do
{
- AnnotationTypeDeclaration annotationTypeDecl =
annotation.getAnnotationType().getDeclaration();
-
- if ( annotationTypeDecl != null &&
annotationTypeDecl.getSimpleName().equals( CONTROLLER_TAG_NAME ) )
- {
- _controllerGrammar.check( annotation, null, jclass );
- }
- }
+ AnnotationMirror controllerAnnotation =
CompilerUtils.getAnnotation( i, CONTROLLER_TAG_NAME );
+ if ( controllerAnnotation != null ) _controllerGrammar.check(
controllerAnnotation, null, i );
+ ClassType superClass = i.getSuperclass();
+ if ( superClass == null ) break;
+ i = superClass.getDeclaration();
+ } while ( i != null );
}
protected void checkField( FieldDeclaration field, TypeDeclaration jclass )
@@ -330,7 +336,7 @@
protected void checkInnerClass( ClassDeclaration innerClass )
{
- _formBeanChecker.check( innerClass );
+ _formBeanChecker.check( innerClass, getWebappRoot() );
}
private void checkActionMethod( MethodDeclaration method, ClassDeclaration
jclass, AnnotationMirror annotation )
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerGenerator.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -52,6 +52,7 @@
public void generate( ClassDeclaration publicClass )
{
GenStrutsApp app = null;
+ _fcInfo.startBuild( getEnv(), publicClass );
try
{
@@ -73,6 +74,10 @@
|| e instanceof FileNotFoundException;
getDiagnostics().addError( publicClass,
"error.could-not-generate-struts-config",
app != null ? app.getStrutsConfigFile()
: null );
+ }
+ finally
+ {
+ _fcInfo.endBuild();
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerInfo.java
Thu Dec 16 01:54:20 2004
@@ -18,6 +18,12 @@
package org.apache.beehive.netui.compiler;
import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.AnnotationMirror;
+import com.sun.mirror.type.ClassType;
+import com.sun.mirror.type.TypeMirror;
+import com.sun.mirror.type.DeclaredType;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import java.util.Set;
import java.util.HashSet;
@@ -27,8 +33,11 @@
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Collections;
+import java.util.Collection;
import java.io.File;
+import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
+
public class FlowControllerInfo
extends SourceFileInfo
@@ -36,7 +45,6 @@
private static final ActionInfo[] EMPTY_ACTION_INFO_ARRAY = new
ActionInfo[0];
private Set< ActionInfo > _actions = new HashSet< ActionInfo >();
- private boolean _nested = false;
private Set _returnActions = null;
private File _webappRoot = null;
private Map< String, TypeDeclaration > _sharedFlowTypes =
Collections.emptyMap();
@@ -47,6 +55,7 @@
private Map< String, String > _messageResourcesByKey = new HashMap<
String, String >();
private boolean _navigateToActionEnabled = false;
private boolean _navigateToPageEnabled = false;
+ private MergedControllerAnnotation _mergedControllerAnnotation;
public static class ActionInfo
@@ -103,21 +112,24 @@
}
- public FlowControllerInfo( File sourceFile, String controllerClassName )
+ public FlowControllerInfo( ClassDeclaration jclass )
{
- super( sourceFile, controllerClassName );
+ super( CompilerUtils.getOriginalFile( jclass ),
jclass.getQualifiedName() );
}
- void startBuild()
+ void startBuild( AnnotationProcessorEnvironment env, ClassDeclaration
jclass )
{
_isBuilding = true;
- _sharedFlowTypes = Collections.emptyMap();
+ _mergedControllerAnnotation = new MergedControllerAnnotation();
+ mergeControllerAnnotations( _mergedControllerAnnotation, jclass );
+ setSharedFlowInfo( env );
}
void endBuild()
{
_isBuilding = false;
_sharedFlowTypes = null; // don't hang onto ClassDeclarations
+ _mergedControllerAnnotation = null;
}
public ActionInfo[] getActions()
@@ -127,7 +139,7 @@
public boolean isNested()
{
- return _nested;
+ return _mergedControllerAnnotation.isNested();
}
public ActionInfo[] getReturnActions()
@@ -173,11 +185,6 @@
_actions.add( new ActionInfo( actionName, formBeanType ) );
}
- public void setNested( boolean nested )
- {
- _nested = nested;
- }
-
public void addReturnAction( String returnActionName, String formBeanType )
{
if ( _returnActions == null )
@@ -204,9 +211,52 @@
}
}
- void setSharedFlowInfo( Map< String, TypeDeclaration > sharedFlowTypes )
+ private void setSharedFlowInfo( AnnotationProcessorEnvironment env )
{
- _sharedFlowTypes = sharedFlowTypes;
+ //
+ // First, find all referenced Shared Flow types.
+ //
+ _sharedFlowTypes = new LinkedHashMap< String, TypeDeclaration >();
+
+ Collection< AnnotationMirror > sharedFlowRefs =
_mergedControllerAnnotation.getSharedFlowRefs();
+
+ if ( sharedFlowRefs != null )
+ {
+ for ( AnnotationMirror sharedFlowRef : sharedFlowRefs )
+ {
+ String name = CompilerUtils.getString( sharedFlowRef,
NAME_ATTR, true );
+ TypeMirror type = CompilerUtils.getTypeMirror( sharedFlowRef,
TYPE_ATTR, true );
+
+ if ( type instanceof DeclaredType ) // if it's not a
DeclaredType, the error will be caught elsewhere.
+ {
+ TypeDeclaration typeDecl = ( ( DeclaredType ) type
).getDeclaration();
+
+ if ( typeDecl != null ) // If the declaration is null,
it's an error type.
+ {
+ _sharedFlowTypes.put( name, typeDecl );
+ }
+ }
+ }
+ }
+
+ //
+ // If there's no SharedFlowController, fall back to the deprecated
Global.app.
+ //
+ if ( _sharedFlowTypes.isEmpty() )
+ {
+ File globalAppFile = new File( getWebappRoot().getPath() +
GLOBALAPP_URI );
+
+ if ( globalAppFile.exists() )
+ {
+ TypeDeclaration type = env.getTypeDeclaration(
GLOBALAPP_FULL_CLASSNAME );
+
+ if ( type != null )
+ {
+ _sharedFlowTypes.put( GLOBALAPP_SHARED_FLOW_NAME, type );
+ }
+ }
+ }
+
_sharedFlowTypeNames = new LinkedHashMap< String, String >();
_sharedFlowFiles = new LinkedHashMap< String, File >();
@@ -222,7 +272,7 @@
public Map< String, TypeDeclaration > getSharedFlowTypes()
{
- assert _isBuilding : "use getSharedFlowTypeNames after check phase";
+ assert _isBuilding : "use getSharedFlowTypeNames after check or
generate phases";
return _sharedFlowTypes;
}
@@ -231,6 +281,12 @@
return _sharedFlowTypeNames;
}
+ public MergedControllerAnnotation getMergedControllerAnnotation()
+ {
+ assert _isBuilding : "only valid during the check or generate phases";
+ return _mergedControllerAnnotation;
+ }
+
public File getWebappRoot()
{
return _webappRoot;
@@ -279,5 +335,19 @@
public boolean isNavigateToPageEnabled()
{
return _navigateToPageEnabled;
+ }
+
+ private static void mergeControllerAnnotations( MergedControllerAnnotation
ann, ClassDeclaration jclass )
+ {
+ //
+ // Merge in all the controller annotations, starting with the most
remote superclass first.
+ //
+ if ( jclass != null )
+ {
+ ClassType superClass = jclass.getSuperclass();
+ if ( superClass != null ) mergeControllerAnnotations( ann,
superClass.getDeclaration() );
+ AnnotationMirror controllerAnnotation =
CompilerUtils.getAnnotation( jclass, CONTROLLER_TAG_NAME );
+ if ( controllerAnnotation != null ) ann.mergeAnnotation(
controllerAnnotation );
+ }
}
}
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -172,7 +172,6 @@
public static final String LOCALE_RULES_ATTR = "localeRules";
public static final String VALIDATABLE_BEANS_ATTR = "validatableBeans";
public static final String KEY_ATTR = "key";
- public static final String VALIDATION_MESSAGES_ATTR = "validationMessages";
public static final String SIMPLE_ACTIONS_ATTR = "simpleActions";
public static final String CONDITION_ATTR = "condition";
public static final String CONDITIONAL_FORWARDS_ATTR =
"conditionalForwards";
Added:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java?view=auto&rev=122539
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
Thu Dec 16 01:54:20 2004
@@ -0,0 +1,165 @@
+/*
+ * 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.declaration.AnnotationMirror;
+
+import java.util.List;
+import java.util.LinkedHashMap;
+import java.util.Collection;
+
+import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
+
+public class MergedControllerAnnotation
+{
+ private String _strutsMerge;
+ private String _validatorMerge;
+ private boolean _nested;
+ private boolean _longLived;
+ private String[] _rolesAllowed;
+ private boolean _loginRequired;
+ private boolean _readOnly;
+ private LinkedHashMap< String, AnnotationMirror > _forwards = new
LinkedHashMap< String, AnnotationMirror >();
+ private LinkedHashMap< String, AnnotationMirror > _sharedFlowRefs = new
LinkedHashMap< String, AnnotationMirror >();
+ private LinkedHashMap< String, AnnotationMirror > _catches = new
LinkedHashMap< String, AnnotationMirror >();
+ private LinkedHashMap< String, AnnotationMirror > _simpleActions = new
LinkedHashMap< String, AnnotationMirror >();
+ private LinkedHashMap< String, AnnotationMirror > _validatableBeans = new
LinkedHashMap< String, AnnotationMirror >();
+ private LinkedHashMap< String, AnnotationMirror> _messageResources = new
LinkedHashMap< String, AnnotationMirror >();
+ private String _multipartHandler;
+
+ public void mergeAnnotation( AnnotationMirror controllerAnnotation )
+ {
+ String strutsMerge = CompilerUtils.getString( controllerAnnotation,
STRUTSMERGE_ATTR, true );
+ if ( strutsMerge != null ) _strutsMerge = strutsMerge;
+
+ String validatorMerge = CompilerUtils.getString( controllerAnnotation,
VALIDATOR_MERGE_ATTR, true );
+ if ( validatorMerge != null ) _validatorMerge = validatorMerge;
+
+ Boolean nested = CompilerUtils.getBoolean( controllerAnnotation,
NESTED_ATTR, true );
+ if ( nested != null ) _nested = nested;
+
+ Boolean longLived = CompilerUtils.getBoolean( controllerAnnotation,
LONGLIVED_ATTR, true );
+ if ( longLived != null ) _longLived = longLived;
+
+ Boolean loginRequired = CompilerUtils.getBoolean(
controllerAnnotation, LOGIN_REQUIRED_ATTR, true );
+ if ( loginRequired != null ) _loginRequired = loginRequired;
+
+ Boolean readOnly = CompilerUtils.getBoolean( controllerAnnotation,
READONLY_ATTR, true );
+ if ( readOnly != null ) _readOnly = readOnly;
+
+ List< String > rolesAllowed = CompilerUtils.getStringArray(
controllerAnnotation, ROLES_ALLOWED_ATTR, true );
+ if ( rolesAllowed != null ) _rolesAllowed = rolesAllowed.toArray( new
String[ rolesAllowed.size() ] );
+
+ mergeAnnotationArray( _forwards, controllerAnnotation, FORWARDS_ATTR,
NAME_ATTR );
+ mergeAnnotationArray( _sharedFlowRefs, controllerAnnotation,
SHARED_FLOW_REFS_ATTR, NAME_ATTR );
+ mergeAnnotationArray( _catches, controllerAnnotation, CATCHES_ATTR,
TYPE_ATTR );
+ mergeAnnotationArray( _simpleActions, controllerAnnotation,
SIMPLE_ACTIONS_ATTR, NAME_ATTR );
+ mergeAnnotationArray( _validatableBeans, controllerAnnotation,
VALIDATABLE_BEANS_ATTR, TYPE_ATTR );
+ mergeAnnotationArray( _messageResources, controllerAnnotation,
MESSAGE_RESOURCES_ATTR, NAME_ATTR );
+
+ String multipartHandler = CompilerUtils.getEnumFieldName(
controllerAnnotation, MULTIPART_HANDLER_ATTR, true );
+ if ( multipartHandler != null ) _multipartHandler = multipartHandler;
+ }
+
+ private static void mergeAnnotationArray( LinkedHashMap< String,
AnnotationMirror > keyedList,
+ AnnotationMirror
parentAnnotation, String attr, String keyAttr )
+ {
+ List< AnnotationMirror > annotations =
CompilerUtils.getAnnotationArray( parentAnnotation, attr, true );
+
+ if ( annotations != null )
+ {
+ for ( AnnotationMirror ann : annotations )
+ {
+ Object key = CompilerUtils.getAnnotationValue( ann, keyAttr,
true );
+ assert key != null : "missing value for " + keyAttr + " on "
+ +
ann.getAnnotationType().getDeclaration().getQualifiedName();
+ keyedList.put( key.toString(), ann );
+ }
+ }
+ }
+
+ public String getStrutsMerge()
+ {
+ return _strutsMerge;
+ }
+
+ public String getValidatorMerge()
+ {
+ return _validatorMerge;
+ }
+
+ public boolean isNested()
+ {
+ return _nested;
+ }
+
+ public boolean isLongLived()
+ {
+ return _longLived;
+ }
+
+ public String[] getRolesAllowed()
+ {
+ return _rolesAllowed;
+ }
+
+ public boolean isLoginRequired()
+ {
+ return _loginRequired;
+ }
+
+ public boolean isReadOnly()
+ {
+ return _readOnly;
+ }
+
+ public Collection< AnnotationMirror > getForwards()
+ {
+ return _forwards.values();
+ }
+
+ public Collection< AnnotationMirror> getSharedFlowRefs()
+ {
+ return _sharedFlowRefs.values();
+ }
+
+ public Collection< AnnotationMirror > getCatches()
+ {
+ return _catches.values();
+ }
+
+ public Collection< AnnotationMirror > getSimpleActions()
+ {
+ return _simpleActions.values();
+ }
+
+ public Collection< AnnotationMirror > getValidatableBeans()
+ {
+ return _validatableBeans.values();
+ }
+
+ public Collection< AnnotationMirror > getMessageResources()
+ {
+ return _messageResources.values();
+ }
+
+ public String getMultipartHandler()
+ {
+ return _multipartHandler;
+ }
+}
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -82,8 +82,8 @@
String sharedFlowName = CompilerUtils.getString( sfFieldAnn,
NAME_ATTR, true );
assert sharedFlowName != null;
- List< AnnotationMirror > sharedFlowRefs =
- CompilerUtils.getAnnotationArrayValue( jclass,
CONTROLLER_TAG_NAME, SHARED_FLOW_REFS_ATTR, true );
+ Collection< AnnotationMirror > sharedFlowRefs =
+
getFlowControllerInfo().getMergedControllerAnnotation().getSharedFlowRefs();
boolean foundOne = false;
@@ -119,58 +119,6 @@
super.checkField( field, jclass );
}
- protected void startCheckClass( ClassDeclaration jclass )
- {
- //
- // First, find all referenced Shared Flow types.
- //
- LinkedHashMap< String, TypeDeclaration > sharedFlowTypes = new
LinkedHashMap< String, TypeDeclaration >();
-
- AnnotationMirror ann = CompilerUtils.getAnnotation( jclass,
CONTROLLER_TAG_NAME );
- List< AnnotationMirror > sharedFlowRefs =
CompilerUtils.getAnnotationArray( ann, SHARED_FLOW_REFS_ATTR, true );
-
- if ( sharedFlowRefs != null )
- {
- for ( AnnotationMirror sharedFlowRef : sharedFlowRefs )
- {
- String name = CompilerUtils.getString( sharedFlowRef,
NAME_ATTR, true );
- TypeMirror type = CompilerUtils.getTypeMirror( sharedFlowRef,
TYPE_ATTR, true );
-
- if ( type instanceof DeclaredType ) // if it's not a
DeclaredType, the error will be caught elsewhere.
- {
- TypeDeclaration typeDecl = ( ( DeclaredType ) type
).getDeclaration();
-
- if ( typeDecl != null ) // If the declaration is null,
it's an error type.
- {
- sharedFlowTypes.put( name, typeDecl );
- }
- }
- }
- }
-
- //
- // If there's no SharedFlowController, fall back to the deprecated
Global.app.
- //
- if ( sharedFlowTypes.isEmpty() )
- {
- File globalAppFile = new File( getWebappRoot().getPath() +
GLOBALAPP_URI );
-
- if ( globalAppFile.exists() )
- {
- TypeDeclaration type = getEnv().getTypeDeclaration(
GLOBALAPP_FULL_CLASSNAME );
-
- if ( type != null )
- {
- sharedFlowTypes.put( GLOBALAPP_SHARED_FLOW_NAME, type );
- }
- }
- }
-
- getFlowControllerInfo().setSharedFlowInfo( sharedFlowTypes );
-
- super.startCheckClass( jclass );
- }
-
protected void doAdditionalClassChecks( ClassDeclaration jpfClass, File
webappRoot )
{
File jpfFile = CompilerUtils.getOriginalFile( jpfClass );
@@ -286,7 +234,7 @@
//
// Make sure every .jpf has a begin action.
//
- if ( ! WebappPathOrActionType.actionExists( BEGIN_ACTION_NAME,
jpfClass, null, getEnv() ) )
+ if ( ! WebappPathOrActionType.actionExists( BEGIN_ACTION_NAME,
jpfClass, null, getEnv(), getFlowControllerInfo(), true ) )
{
getDiagnostics().addError( jpfClass, "error.no-begin-action" );
}
@@ -294,10 +242,8 @@
//
// Make sure every nested pageflow has a returnAction.
//
- if ( CompilerUtils.isInNestedPageFlow( jpfClass ) )
+ if ( getFlowControllerInfo().isNested() )
{
- getFlowControllerInfo().setNested( true );
-
if ( getFlowControllerInfo().countReturnActions() == 0 )
{
getDiagnostics().addError( jpfClass, "error.no-return-action",
@@ -345,11 +291,7 @@
AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
{
boolean isLongLived = ( Boolean ) value.getValue();
- if ( isLongLived && CompilerUtils.isInNestedPageFlow(
classMember ) )
- {
- addError( value, "error.nested-long-lived" );
- }
-
+ if ( isLongLived && getFlowControllerInfo().isNested() )
addError( value, "error.nested-long-lived" );
return null;
}
}
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/apt/PageFlowAnnotationProcessor.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -18,17 +18,9 @@
package org.apache.beehive.netui.compiler.apt;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.Messager;
-import com.sun.mirror.apt.Filer;
-import com.sun.mirror.apt.AnnotationProcessorListener;
import com.sun.mirror.declaration.AnnotationMirror;
import com.sun.mirror.declaration.ClassDeclaration;
import com.sun.mirror.declaration.Modifier;
-import com.sun.mirror.declaration.PackageDeclaration;
-import com.sun.mirror.declaration.TypeDeclaration;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-import com.sun.mirror.util.Declarations;
-import com.sun.mirror.util.Types;
import org.apache.beehive.netui.compiler.BaseChecker;
import org.apache.beehive.netui.compiler.CompilerUtils;
import org.apache.beehive.netui.compiler.Diagnostics;
@@ -48,8 +40,6 @@
import static
org.apache.beehive.netui.compiler.JpfLanguageConstants.ANNOTATIONS_CLASSNAME;
import java.io.File;
-import java.util.Map;
-import java.util.Collection;
public class PageFlowAnnotationProcessor
@@ -72,8 +62,7 @@
}
else if ( CompilerUtils.isAssignableFrom( JPF_BASE_CLASS, classDecl,
getEnv() ) )
{
- File originalFile = CompilerUtils.getOriginalFile( classDecl );
- FlowControllerInfo fcInfo = new FlowControllerInfo( originalFile,
className );
+ FlowControllerInfo fcInfo = new FlowControllerInfo( classDecl );
if ( expectControllerAnnotation( classDecl,
JPF_FILE_EXTENSION_DOT, JPF_BASE_CLASS, diagnostics ) )
{
@@ -82,8 +71,7 @@
}
else if ( CompilerUtils.isAssignableFrom( SHARED_FLOW_BASE_CLASS,
classDecl, getEnv() ) )
{
- File originalFile = CompilerUtils.getOriginalFile( classDecl );
- FlowControllerInfo fcInfo = new FlowControllerInfo( originalFile,
className );
+ FlowControllerInfo fcInfo = new FlowControllerInfo( classDecl );
if ( expectControllerAnnotation( classDecl,
SHARED_FLOW_FILE_EXTENSION_DOT, SHARED_FLOW_BASE_CLASS,
diagnostics ) )
@@ -93,8 +81,7 @@
}
else if ( CompilerUtils.isAssignableFrom( GLOBALAPP_BASE_CLASS,
classDecl, getEnv() ) )
{
- File originalFile = CompilerUtils.getOriginalFile( classDecl );
- FlowControllerInfo fcInfo = new FlowControllerInfo( originalFile,
className );
+ FlowControllerInfo fcInfo = new FlowControllerInfo( classDecl );
if ( expectControllerAnnotation( classDecl,
GLOBALAPP_FILE_EXTENSION_DOT, GLOBALAPP_BASE_CLASS,
diagnostics ) )
@@ -116,25 +103,23 @@
return null;
}
- private boolean expectControllerAnnotation( ClassDeclaration classDecl,
String fileExtensionRequiresAnnotation,
- String baseClass, Diagnostics
diagnostics )
+ private static boolean expectControllerAnnotation( ClassDeclaration
classDecl,
+ String
fileExtensionRequiresAnnotation, String baseClass,
+ Diagnostics diagnostics
)
{
- if ( CompilerUtils.getAnnotation( classDecl, CONTROLLER_TAG_NAME ) !=
null )
- {
- return true;
- }
+ if ( CompilerUtils.getAnnotation( classDecl, CONTROLLER_TAG_NAME ) !=
null ) return true;
String fileName = classDecl.getPosition().file().getName();
if ( fileExtensionRequiresAnnotation != null && fileName.endsWith(
fileExtensionRequiresAnnotation ) )
{
diagnostics.addError( classDecl,
"error.controller-annotation-required",
- fileExtensionRequiresAnnotation,
ANNOTATIONS_CLASSNAME + "." + CONTROLLER_TAG_NAME );
+ fileExtensionRequiresAnnotation,
ANNOTATIONS_CLASSNAME + '.' + CONTROLLER_TAG_NAME );
}
else if ( ! CompilerUtils.hasModifier( classDecl, Modifier.ABSTRACT ) )
{
diagnostics.addWarning( classDecl,
"warning.no-controller-annotation", baseClass,
- ANNOTATIONS_CLASSNAME + "." +
CONTROLLER_TAG_NAME );
+ ANNOTATIONS_CLASSNAME + '.' +
CONTROLLER_TAG_NAME );
}
return false;
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java
Thu Dec 16 01:54:20 2004
@@ -26,6 +26,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Iterator;
+import java.util.Arrays;
import com.sun.mirror.declaration.Declaration;
import com.sun.mirror.declaration.ClassDeclaration;
@@ -63,17 +64,27 @@
//
// loginRequired
//
- setLoginRequired( CompilerUtils.getMethodOrClassFlag( annotation,
jclass, LOGIN_REQUIRED_ATTR ) );
+ Boolean loginRequired = CompilerUtils.getBoolean( annotation,
LOGIN_REQUIRED_ATTR, true );
+ if ( loginRequired == null )
+ {
+ loginRequired =
parentApp.getFlowControllerInfo().getMergedControllerAnnotation().isLoginRequired();
+ }
+ setLoginRequired( loginRequired );
//
// readOnly
//
- setReadonly( CompilerUtils.getMethodOrClassFlag( annotation, jclass,
READONLY_ATTR ) );
+ Boolean readOnly = CompilerUtils.getBoolean( annotation,
READONLY_ATTR, true );
+ if ( readOnly == null )
+ {
+ readOnly =
parentApp.getFlowControllerInfo().getMergedControllerAnnotation().isReadOnly();
+ }
+ setReadonly( readOnly );
//
// rolesAllowed
//
- setRolesAllowed( annotation, jclass );
+ setRolesAllowed( annotation, jclass, parentApp );
//
// type (delegating Action class, with the FlowController as parameter)
@@ -108,11 +119,11 @@
GenExceptionModel.addCatches( annotation, this, jclass, parentApp,
this );
}
- private void setRolesAllowed( AnnotationMirror annotation,
ClassDeclaration jclass )
+ private void setRolesAllowed( AnnotationMirror annotation,
ClassDeclaration jclass, GenStrutsApp parentApp )
{
List< String > rolesAllowed = CompilerUtils.getStringArray(
annotation, ROLES_ALLOWED_ATTR, true );
- List< String > classLevelRA =
- CompilerUtils.getStringArrayValue( jclass,
CONTROLLER_TAG_NAME, ROLES_ALLOWED_ATTR, true );
+ String[] classLevelRAList =
parentApp.getFlowControllerInfo().getMergedControllerAnnotation().getRolesAllowed();
+ List< String > classLevelRA = classLevelRAList != null ?
Arrays.asList( classLevelRAList ) : null;
Iterator< String > it = null;
if ( rolesAllowed != null && classLevelRA != null )
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenExceptionModel.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenExceptionModel.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenExceptionModel.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenExceptionModel.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenExceptionModel.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenExceptionModel.java
Thu Dec 16 01:54:20 2004
@@ -27,6 +27,7 @@
import com.sun.mirror.declaration.ClassDeclaration;
import java.util.List;
+import java.util.Collection;
public class GenExceptionModel
@@ -60,16 +61,24 @@
//
// Also, if the exception-handler was marked "read-only", note
this on the <exception> tag.
//
- setReadonly( CompilerUtils.getMethodOrClassFlag(
exHandlerAnnotation, jclass, READONLY_ATTR ) );
+ Boolean readOnly = CompilerUtils.getBoolean( exHandlerAnnotation,
READONLY_ATTR, true );
+ if ( readOnly == null )
+ {
+ readOnly =
parentApp.getFlowControllerInfo().getMergedControllerAnnotation().isReadOnly();
+ }
+ setReadonly( readOnly );
}
}
static void addCatches( AnnotationMirror annotation, ExceptionContainer
container, ClassDeclaration jclass,
GenStrutsApp strutsApp, ForwardContainer
forwardContainer )
{
- List< AnnotationMirror > catches =
- CompilerUtils.getAnnotationArray( annotation, CATCHES_ATTR,
true );
-
+ List< AnnotationMirror > catches = CompilerUtils.getAnnotationArray(
annotation, CATCHES_ATTR, true );
+ addCatches( catches, container, jclass, strutsApp, forwardContainer );
+ }
+ static void addCatches( Collection< AnnotationMirror > catches,
ExceptionContainer container,
+ ClassDeclaration jclass, GenStrutsApp strutsApp,
ForwardContainer forwardContainer )
+ {
if ( catches != null )
{
for ( AnnotationMirror i : catches )
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java
Thu Dec 16 01:54:20 2004
@@ -27,6 +27,7 @@
import com.sun.mirror.type.DeclaredType;
import java.util.List;
+import java.util.Collection;
public class GenForwardModel
extends ForwardModel
@@ -137,7 +138,12 @@
GenStrutsApp strutsApp, String commentSuffix )
{
List< AnnotationMirror > forwards = CompilerUtils.getAnnotationArray(
annotation, FORWARDS_ATTR, true );
-
+ addForwards( forwards, container, jclass, strutsApp, commentSuffix );
+ }
+
+ static void addForwards( Collection< AnnotationMirror > forwards,
ForwardContainer container,
+ ClassDeclaration jclass, GenStrutsApp strutsApp,
String commentSuffix )
+ {
if ( forwards != null )
{
for ( AnnotationMirror ann : forwards )
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -24,6 +24,7 @@
import org.apache.beehive.netui.compiler.model.ActionModel;
import org.apache.beehive.netui.compiler.CompilerUtils;
import org.apache.beehive.netui.compiler.FlowControllerInfo;
+import org.apache.beehive.netui.compiler.MergedControllerAnnotation;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
@@ -35,7 +36,6 @@
import java.io.PrintStream;
import java.util.Date;
import java.util.Collection;
-import java.util.List;
import com.sun.mirror.declaration.ClassDeclaration;
import com.sun.mirror.declaration.AnnotationMirror;
@@ -59,13 +59,19 @@
private File _sourceFile;
private File _webappRoot;
private AnnotationProcessorEnvironment _env;
+ private FlowControllerInfo _fcInfo;
protected void recalculateStrutsConfigFile()
throws XmlException, IOException
{
_strutsConfigFile = calculateStrutsConfigFile(); // caching this
}
-
+
+ FlowControllerInfo getFlowControllerInfo()
+ {
+ return _fcInfo;
+ }
+
public GenStrutsApp( File sourceFile, ClassDeclaration jclass,
AnnotationProcessorEnvironment env,
FlowControllerInfo fcInfo, boolean checkOnly )
throws NoWebInfDirectoryException, XmlException, IOException
@@ -77,6 +83,8 @@
_sourceFile = sourceFile;
_webappRoot = getWebappRootFromJpf( sourceFile ).getAbsoluteFile();
_env = env;
+ assert fcInfo != null;
+ _fcInfo = fcInfo;
recalculateStrutsConfigFile();
@@ -84,21 +92,14 @@
if ( _jclass != null )
{
- AnnotationMirror controllerAnnotation =
CompilerUtils.getAnnotation( jclass, CONTROLLER_TAG_NAME );
-
- if ( controllerAnnotation != null )
- {
- boolean nested = CompilerUtils.getBoolean(
controllerAnnotation, NESTED_ATTR, false );
- boolean longLived = CompilerUtils.getBoolean(
controllerAnnotation, LONGLIVED_ATTR, false );
- setNestedPageFlow( nested );
- setLongLivedPageFlow( longLived );
- addMessageResources( controllerAnnotation );
- addValidationMessages( controllerAnnotation );
- addSimpleActions( controllerAnnotation );
- setMultipartHandler( controllerAnnotation );
- GenForwardModel.addForwards( controllerAnnotation, this,
_jclass, this, null );
- GenExceptionModel.addCatches( controllerAnnotation, this,
_jclass, this, this );
- }
+ MergedControllerAnnotation mca =
fcInfo.getMergedControllerAnnotation();
+ setNestedPageFlow( mca.isNested() );
+ setLongLivedPageFlow( mca.isLongLived() );
+ addMessageResources( mca.getMessageResources() );
+ addSimpleActions( mca.getSimpleActions() );
+ setMultipartHandler( mca.getMultipartHandler() );
+ GenForwardModel.addForwards( mca.getForwards(), this, _jclass,
this, null );
+ GenExceptionModel.addCatches( mca.getCatches(), this, _jclass,
this, this );
addActionMethods();
addFormBeans( _jclass );
@@ -164,11 +165,8 @@
return formBeanName;
}
- private void addMessageResources( AnnotationMirror controllerAnnotation )
+ private void addMessageResources( Collection< AnnotationMirror >
messageResources )
{
- List< AnnotationMirror > messageResources =
- CompilerUtils.getAnnotationArray( controllerAnnotation,
MESSAGE_RESOURCES_ATTR, true );
-
if ( messageResources != null )
{
for ( AnnotationMirror ann : messageResources )
@@ -178,11 +176,8 @@
}
}
- private void addValidationMessages( AnnotationMirror controllerAnnotation )
+ private void addValidationMessages( Collection< AnnotationMirror >
validationMessages )
{
- List< AnnotationMirror > validationMessages =
- CompilerUtils.getAnnotationArray( controllerAnnotation,
VALIDATION_MESSAGES_ATTR, true );
-
if ( validationMessages != null )
{
String packagePrefix = _jclass.getPackage().getQualifiedName();
@@ -190,11 +185,8 @@
}
}
- private void addSimpleActions( AnnotationMirror controllerAnnotation )
+ private void addSimpleActions( Collection< AnnotationMirror >
simpleActionAnnotations )
{
- List< AnnotationMirror > simpleActionAnnotations =
- CompilerUtils.getAnnotationArray( controllerAnnotation,
SIMPLE_ACTIONS_ATTR, true );
-
if ( simpleActionAnnotations != null )
{
for ( AnnotationMirror ann : simpleActionAnnotations )
@@ -204,10 +196,8 @@
}
}
- private void setMultipartHandler( AnnotationMirror controllerAnnotation )
+ private void setMultipartHandler( String mpHandler )
{
- String mpHandler = CompilerUtils.getEnumFieldName(
controllerAnnotation, MULTIPART_HANDLER_ATTR, true );
-
if ( mpHandler != null )
{
if ( mpHandler.equals( MULTIPART_HANDLER_MEMORY_STR ) )
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -24,6 +24,7 @@
import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
import org.apache.beehive.netui.compiler.CompilerUtils;
import org.apache.beehive.netui.compiler.JpfLanguageConstants;
+import org.apache.beehive.netui.compiler.MergedControllerAnnotation;
import org.apache.xmlbeans.XmlException;
import com.sun.mirror.declaration.ClassDeclaration;
import com.sun.mirror.declaration.TypeDeclaration;
@@ -57,11 +58,12 @@
public GenValidationModel( ClassDeclaration jclass, GenStrutsApp strutsApp
)
throws NoWebInfDirectoryException
{
+ MergedControllerAnnotation mca =
strutsApp.getFlowControllerInfo().getMergedControllerAnnotation();
_strutsApp = strutsApp;
addRulesFromBeans( jclass );
addRulesFromActions( jclass );
- addRulesFromClass( jclass );
- String mergeFileName = CompilerUtils.getStringValue( jclass,
CONTROLLER_TAG_NAME, VALIDATOR_MERGE_ATTR, true );
+ addRulesFromClass( jclass, mca );
+ String mergeFileName = mca.getValidatorMerge();
_mergeFile = strutsApp.getMergeFile( mergeFileName );
}
@@ -199,36 +201,30 @@
return formBean.getName();
}
- private void addRulesFromClass( ClassDeclaration jclass )
+ private void addRulesFromClass( ClassDeclaration jclass,
MergedControllerAnnotation mca )
{
- AnnotationMirror controllerAnnotation = CompilerUtils.getAnnotation(
jclass, CONTROLLER_TAG_NAME );
+ Collection< AnnotationMirror > validationBeanAnnotations =
mca.getValidatableBeans();
- if ( controllerAnnotation != null )
+ for ( AnnotationMirror validationBeanAnnotation :
validationBeanAnnotations )
{
- Collection< AnnotationMirror > validationBeanAnnotations =
- CompilerUtils.getAnnotationArray( controllerAnnotation,
VALIDATABLE_BEANS_ATTR, false );
+ DeclaredType beanType = CompilerUtils.getDeclaredType(
validationBeanAnnotation, TYPE_ATTR, true );
+ assert beanType != null; // checker should enforce this
- for ( AnnotationMirror validationBeanAnnotation :
validationBeanAnnotations )
+ Collection< AnnotationMirror > validationFieldAnnotations =
+ CompilerUtils.getAnnotationArray(
validationBeanAnnotation, VALIDATABLE_PROPERTIES_ATTR, false );
+
+ for ( AnnotationMirror validationFieldAnnotation :
validationFieldAnnotations )
{
- DeclaredType beanType = CompilerUtils.getDeclaredType(
validationBeanAnnotation, TYPE_ATTR, true );
- assert beanType != null; // checker should enforce this
-
- Collection< AnnotationMirror > validationFieldAnnotations =
- CompilerUtils.getAnnotationArray(
validationBeanAnnotation, VALIDATABLE_PROPERTIES_ATTR, false );
+ String propName = CompilerUtils.getString(
validationFieldAnnotation, PROPERTY_NAME_ATTR, true );
+ assert propName != null; // checker should enforce
this
+ assert ! propName.equals( "" ); // TODO: get checker to
enforce this
- for ( AnnotationMirror validationFieldAnnotation :
validationFieldAnnotations )
- {
- String propName = CompilerUtils.getString(
validationFieldAnnotation, PROPERTY_NAME_ATTR, true );
- assert propName != null; // checker should
enforce this
- assert ! propName.equals( "" ); // TODO: get checker
to enforce this
-
- //
- // Add the rules. If the bean is derived from ActionForm,
associate the rules with the *name* of
- // the form; otherwise, associate them with the classname
of the bean type.
- //
- String formName = getFormBeanName(
CompilerUtils.getDeclaration( beanType ) );
- addRulesFromAnnotation( validationFieldAnnotation,
formName, propName );
- }
+ //
+ // Add the rules. If the bean is derived from ActionForm,
associate the rules with the *name* of
+ // the form; otherwise, associate them with the classname of
the bean type.
+ //
+ String formName = getFormBeanName(
CompilerUtils.getDeclaration( beanType ) );
+ addRulesFromAnnotation( validationFieldAnnotation, formName,
propName );
}
}
}
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&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseFlowControllerGrammar.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/BaseFlowControllerGrammar.java&r2=122539
==============================================================================
---
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
Thu Dec 16 01:54:20 2004
@@ -36,7 +36,7 @@
_flowControllerInfo = flowControllerInfo;
}
- protected FlowControllerInfo getFlowControllerInfo()
+ FlowControllerInfo getFlowControllerInfo()
{
return _flowControllerInfo;
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/CommandHandlerGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/CommandHandlerGrammar.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/CommandHandlerGrammar.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/CommandHandlerGrammar.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/CommandHandlerGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/CommandHandlerGrammar.java
Thu Dec 16 01:54:20 2004
@@ -20,6 +20,7 @@
import org.apache.beehive.netui.compiler.AnnotationGrammar;
import org.apache.beehive.netui.compiler.Diagnostics;
import org.apache.beehive.netui.compiler.RuntimeVersionChecker;
+import org.apache.beehive.netui.compiler.FlowControllerInfo;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import com.sun.mirror.declaration.ClassDeclaration;
@@ -27,12 +28,12 @@
public class CommandHandlerGrammar
- extends AnnotationGrammar
+ extends BaseFlowControllerGrammar
{
public CommandHandlerGrammar( AnnotationProcessorEnvironment env,
Diagnostics diags, RuntimeVersionChecker rvc,
- ClassDeclaration jpfClass )
+ ClassDeclaration jpfClass,
FlowControllerInfo fcInfo )
{
- super( env, diags, null, rvc );
- addMemberArrayGrammar( RAISE_ACTIONS_ATTR, new RaiseActionGrammar(
env, diags, null, rvc, jpfClass ) );
+ super( env, diags, null, rvc, fcInfo );
+ addMemberArrayGrammar( RAISE_ACTIONS_ATTR, new RaiseActionGrammar(
env, diags, null, rvc, jpfClass, fcInfo ) );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java
Thu Dec 16 01:54:20 2004
@@ -123,7 +123,7 @@
if ( isReturnAction )
{
- if ( ! CompilerUtils.isInNestedPageFlow( classMember ) )
+ if ( ! getFlowControllerInfo().isNested() )
{
addError( value, "error.only-valid-in-nested", new Object[]{
valueName } );
}
@@ -212,7 +212,7 @@
TypeDeclaration outerType = CompilerUtils.getOuterClass(
classMember );
Collection< AnnotationMirror > classLevelCatches =
- CompilerUtils.getAnnotationArrayValue( outerType,
CONTROLLER_TAG_NAME, CATCHES_ATTR, true );
+
getFlowControllerInfo().getMergedControllerAnnotation().getCatches();
addAdditionalAnnotationsToCheck( classLevelCatches, outerType,
additionalEntities );
if ( classMember instanceof MethodDeclaration )
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardToExternalPathType.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardToExternalPathType.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardToExternalPathType.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardToExternalPathType.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardToExternalPathType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardToExternalPathType.java
Thu Dec 16 01:54:20 2004
@@ -29,6 +29,7 @@
import org.apache.beehive.netui.compiler.CompilerUtils;
import java.util.List;
+import java.util.Collection;
public class ForwardToExternalPathType
extends DelegatingType
@@ -51,9 +52,9 @@
//
if ( stringValue.indexOf( '/' ) != -1 )
{
- TypeDeclaration fcClass = CompilerUtils.getOutermostClass(
classMember );
- List< String > messageResources =
- CompilerUtils.getStringArrayValue( fcClass,
CONTROLLER_TAG_NAME, MESSAGE_RESOURCES_ATTR, true );
+ BaseFlowControllerGrammar fcGrammar = ( BaseFlowControllerGrammar
) getParentGrammar();
+ Collection< AnnotationMirror > messageResources =
+
fcGrammar.getFlowControllerInfo().getMergedControllerAnnotation().getMessageResources();
if ( messageResources != null && messageResources.size() > 0 )
{
addWarning( value,
"warning.exception-handler-forward-to-external-page", stringValue );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RaiseActionGrammar.java
Thu Dec 16 01:54:20 2004
@@ -22,6 +22,7 @@
import org.apache.beehive.netui.compiler.RuntimeVersionChecker;
import org.apache.beehive.netui.compiler.AnnotationMemberType;
import org.apache.beehive.netui.compiler.CompilerUtils;
+import org.apache.beehive.netui.compiler.FlowControllerInfo;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import com.sun.mirror.declaration.ClassDeclaration;
import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
@@ -34,12 +35,13 @@
public class RaiseActionGrammar
- extends AnnotationGrammar
+ extends BaseFlowControllerGrammar
{
public RaiseActionGrammar( AnnotationProcessorEnvironment env, Diagnostics
diags, String requiredRuntimeVersion,
- RuntimeVersionChecker runtimeVersionChecker,
ClassDeclaration jpfClass )
+ RuntimeVersionChecker runtimeVersionChecker,
ClassDeclaration jpfClass,
+ FlowControllerInfo fcInfo )
{
- super( env, diags, requiredRuntimeVersion, runtimeVersionChecker );
+ super( env, diags, requiredRuntimeVersion, runtimeVersionChecker,
fcInfo );
addMemberType( ACTION_ATTR, new PageFlowActionType( jpfClass ) );
addMemberType( OUTPUT_FORM_BEAN_ATTR, new MemberFieldType( null ,
null, this ) );
}
@@ -60,7 +62,8 @@
{
String action = ( String ) member.getValue();
- if ( _jpfClass != null && ! WebappPathOrActionType.actionExists(
action, _jpfClass, null, getEnv() ) )
+ if ( _jpfClass != null
+ && ! WebappPathOrActionType.actionExists( action, _jpfClass,
null, getEnv(), getFlowControllerInfo(), true ) )
{
getDiagnostics().addWarning( member, "warning.no-such-action",
action,
CompilerUtils.getOriginalFile(
_jpfClass ) );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java
Thu Dec 16 01:54:20 2004
@@ -26,6 +26,7 @@
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import com.sun.mirror.declaration.AnnotationMirror;
import com.sun.mirror.declaration.MemberDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
@@ -70,8 +71,9 @@
MemberDeclaration classMember )
{
String name = CompilerUtils.getString( annotation, NAME_ATTR, false );
-
- if ( WebappPathOrActionType.actionExists( name,
CompilerUtils.getOuterClass( classMember ), annotation, getEnv() ) )
+
+ TypeDeclaration outerClass = CompilerUtils.getOuterClass( classMember
);
+ if ( WebappPathOrActionType.actionExists( name, outerClass,
annotation, getEnv(), getFlowControllerInfo(), false ) )
{
addError( annotation, "error.duplicate-action", new Object[]{ name
} );
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathOrActionType.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathOrActionType.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathOrActionType.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathOrActionType.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathOrActionType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathOrActionType.java
Thu Dec 16 01:54:20 2004
@@ -20,6 +20,7 @@
import org.apache.beehive.netui.compiler.CompilerUtils;
import org.apache.beehive.netui.compiler.FlowControllerInfo;
import org.apache.beehive.netui.compiler.AnnotationGrammar;
+import org.apache.beehive.netui.compiler.MergedControllerAnnotation;
import com.sun.mirror.declaration.AnnotationValue;
import com.sun.mirror.declaration.AnnotationMirror;
import com.sun.mirror.declaration.MemberDeclaration;
@@ -51,7 +52,8 @@
{
int extensionPos = stringValue.lastIndexOf(
ACTION_EXTENSION_DOT );
String actionMethodName = stringValue.substring( 0,
extensionPos );
- boolean foundIt = actionExists( actionMethodName, outerType,
null, getEnv() );
+ FlowControllerInfo fcInfo = getFlowControllerInfo();
+ boolean foundIt = actionExists( actionMethodName, outerType,
null, getEnv(), fcInfo, false );
if ( ! foundIt )
{
@@ -68,7 +70,7 @@
if ( sfTypeDecl != null )
{
actionMethodName = actionMethodName.substring( dot
+ 1 );
- foundIt = actionExists( actionMethodName,
sfTypeDecl, null, getEnv() );
+ foundIt = actionExists( actionMethodName,
sfTypeDecl, null, getEnv(), fcInfo, false );
}
}
}
@@ -81,7 +83,7 @@
TypeDeclaration globalAppDecl =
getEnv().getTypeDeclaration( GLOBALAPP_FULL_CLASSNAME );
if ( globalAppDecl != null )
{
- foundIt = actionExists( actionMethodName,
globalAppDecl, null, getEnv() );
+ foundIt = actionExists( actionMethodName,
globalAppDecl, null, getEnv(), fcInfo, false );
}
}
@@ -96,7 +98,8 @@
}
public static boolean actionExists( String actionName, TypeDeclaration
type, AnnotationMirror annotationToIgnore,
- AnnotationProcessorEnvironment env )
+ AnnotationProcessorEnvironment env,
FlowControllerInfo fcInfo,
+ boolean checkInheritedSimpleActions )
{
//
// First look through the action methods.
@@ -115,24 +118,22 @@
//
// Next, look through the simple actions (annotations).
//
- AnnotationMirror controllerAnnotation = CompilerUtils.getAnnotation(
type, CONTROLLER_TAG_NAME );
+ MergedControllerAnnotation mca =
fcInfo.getMergedControllerAnnotation();
+ Collection< AnnotationMirror > simpleActionAnnotations =
+ checkInheritedSimpleActions
+ ? mca.getSimpleActions()
+ : CompilerUtils.getAnnotationArrayValue( type,
CONTROLLER_TAG_NAME, SIMPLE_ACTIONS_ATTR, true );
- if ( controllerAnnotation != null )
+ if ( simpleActionAnnotations != null )
{
- Collection< AnnotationMirror > simpleActionAnnotations =
- CompilerUtils.getAnnotationArray( controllerAnnotation,
SIMPLE_ACTIONS_ATTR, true );
-
- if ( simpleActionAnnotations != null )
+ for ( AnnotationMirror ann : simpleActionAnnotations )
{
- for ( AnnotationMirror ann : simpleActionAnnotations )
+ String name = CompilerUtils.getString( ann, NAME_ATTR, false );
+
+ if ( actionName.equals( name )
+ && ! CompilerUtils.annotationsAreEqual( ann,
annotationToIgnore, false, env ) )
{
- String name = CompilerUtils.getString( ann, NAME_ATTR,
false );
-
- if ( actionName.equals( name )
- && ! CompilerUtils.annotationsAreEqual( ann,
annotationToIgnore, false, env ) )
- {
- return true;
- }
+ return true;
}
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WritableFieldType.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WritableFieldType.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WritableFieldType.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WritableFieldType.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WritableFieldType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WritableFieldType.java
Thu Dec 16 01:54:20 2004
@@ -57,8 +57,8 @@
if ( readonlyValue == null )
{
- TypeDeclaration outerType = CompilerUtils.getOuterClass(
classMember );
- readonlyValue = CompilerUtils.getBooleanValue( outerType,
CONTROLLER_TAG_NAME, READONLY_ATTR, true );
+ BaseFlowControllerGrammar fcGrammar = ( BaseFlowControllerGrammar
) getParentGrammar();
+ readonlyValue =
fcGrammar.getFlowControllerInfo().getMergedControllerAnnotation().isReadOnly();
}
if ( readonlyValue != null && readonlyValue.booleanValue() )
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java&r1=122538&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
Thu Dec 16 01:54:20 2004
@@ -254,7 +254,7 @@
File webappRoot = null;
// TODO: cache the stringValue of getWebappRootFromJpf. It's
expensive to calculate.
- for ( File dir = jpf.getAbsoluteFile().getParentFile(); dir != null &&
webappRoot == null; dir = dir.getParentFile() )
+ for ( File dir = jpf.getAbsoluteFile().getParentFile(); dir != null;
dir = dir.getParentFile() )
{
if ( new File( dir, WEBINF_DIR_NAME ).isDirectory() )
{
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java&r1=122538&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java
Thu Dec 16 01:54:20 2004
@@ -20,6 +20,7 @@
import org.apache.struts.action.ActionForward;
import java.util.ArrayList;
+import java.io.Serializable;
/**
@@ -118,7 +119,7 @@
_externalRedirect = externalRedirect;
}
- public static class ActionOutput
+ public static class ActionOutput implements Serializable
{
private String _name;
private String _type;
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultReloadableClassHandler.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultReloadableClassHandler.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultReloadableClassHandler.java&r1=122538&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultReloadableClassHandler.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultReloadableClassHandler.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultReloadableClassHandler.java
Thu Dec 16 01:54:20 2004
@@ -23,6 +23,7 @@
import org.apache.beehive.netui.util.classloader.BouncyClassLoader;
import org.apache.beehive.netui.util.cache.ClassLevelCache;
import org.apache.beehive.netui.util.logging.Logger;
+import org.apache.beehive.netui.util.DiscoveryUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@@ -120,7 +121,7 @@
}
else
{
- return Class.forName( className );
+ return DiscoveryUtils.getClassLoader().loadClass( className );
}
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java&r1=122538&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
Thu Dec 16 01:54:20 2004
@@ -55,6 +55,7 @@
import org.apache.struts.config.ModuleConfig;
import org.apache.struts.config.ControllerConfig;
import org.apache.struts.config.FormBeanConfig;
+import org.apache.struts.config.ActionConfig;
import org.apache.struts.Globals;
import static org.apache.beehive.netui.pageflow.internal.InternalConstants.*;
@@ -221,7 +222,8 @@
}
catch ( NoSuchMethodException e )
{
- return null;
+ Class superClass = parentClass.getSuperclass();
+ return superClass != null ? lookupMethod( superClass, methodName,
signature ) : null;
}
}
@@ -1134,5 +1136,42 @@
}
throw effect;
+ }
+
+ /**
+ * Get the Struts ActionConfig for the given action config path and module
path.
+ */
+ public static ActionConfig findActionConfig( String actionConfigPath,
String modulePath, ServletContext context )
+ {
+ ModuleConfig moduleConfig = getModuleConfig( modulePath, context );
+ assert moduleConfig != null;
+ return moduleConfig.findActionConfig( actionConfigPath );
+ }
+
+ /**
+ * Get the Struts ActionMapping path from the ActionMapping that is in the
request under the key
+ * Globals.MAPPING_KEY.
+ *
+ * @return the path for the ActionMapping, as found with
ActionMapping.getPath()
+ */
+ public static String getActionMappingPath( ServletRequest request )
+ {
+ ActionMapping actionMapping = ( ActionMapping ) request.getAttribute(
Globals.MAPPING_KEY );
+ return actionMapping != null ? actionMapping.getPath() : null;
+ }
+
+ /**
+ * Gets the Struts module path from the input request. If a ModuleConfig
+ * object has been populated into the request it is used to get the module
prefix,
+ * otherwise getModulePath is called, which derives the module path from
+ * the request URI.
+ */
+ public static String getModulePathFromReqAttr( HttpServletRequest request )
+ {
+ //
+ // If a config was in the request, use its associated prefix;
otherwise, fall back to the URI.
+ //
+ ModuleConfig config = ( ModuleConfig ) request.getAttribute(
Globals.MODULE_KEY );
+ return config != null ? config.getPrefix() :
PageFlowUtils.getModulePath( request );
}
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java&r1=122538&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java
Thu Dec 16 01:54:20 2004
@@ -35,6 +35,7 @@
import java.util.Map;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
+import java.beans.beancontext.BeanContext;
import org.apache.beehive.netui.util.logging.Logger;
@@ -190,7 +191,8 @@
public static void destroyControl( Object controlInstance )
{
assert controlInstance instanceof ControlBean :
controlInstance.getClass().getName();
- ( ( ControlBean ) controlInstance ).getBeanContext().remove(
controlInstance );
+ BeanContext beanContext = ( ( ControlBean ) controlInstance
).getBeanContext();
+ if ( beanContext != null ) beanContext.remove( controlInstance );
}
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java&r1=122538&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java
Thu Dec 16 01:54:20 2004
@@ -780,7 +780,7 @@
* where the tree only contains the things necessary to render the base
tree. Less commmonly used
* features are not exposed by this structure.
*/
- private static class ExtendedInfo
+ private static class ExtendedInfo implements Serializable
{
public String _clientAction; // Action to run on the client.
public String _href; // href to call if the node is selected
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/pageFlowCore/inheritance/super0/Super0.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/pageFlowCore/inheritance/super0/Super0.java?view=auto&rev=122539
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/pageFlowCore/inheritance/super0/Super0.java
Thu Dec 16 01:54:20 2004
@@ -0,0 +1,28 @@
+package pageFlowCore.inheritance.super0;
+
+import org.apache.beehive.netui.pageflow.*;
+import org.apache.beehive.netui.pageflow.annotations.*;
+
+import java.util.Arrays;
+
[EMAIL PROTECTED](
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp"),
+ @Jpf.SimpleAction(name="simpleAction0", path="index.jsp")
+ }
+)
+public class Super0 extends PageFlowController
+{
+ @Jpf.Action
+ public Forward methodAction0()
+ {
+ return null;
+ }
+
+ public String[] getSortedActions()
+ {
+ String[] actions = getActions();
+ Arrays.sort( actions );
+ return actions;
+ }
+}
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/Controller.jpf
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/Controller.jpf?view=auto&rev=122539
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/Controller.jpf
Thu Dec 16 01:54:20 2004
@@ -0,0 +1,21 @@
+package pageFlowCore.inheritance;
+
+import org.apache.beehive.netui.pageflow.*;
+import org.apache.beehive.netui.pageflow.annotations.*;
+
+import pageFlowCore.inheritance.super1.Super1;
+import pageFlowCore.inheritance.super2.Super2;
+
[EMAIL PROTECTED](
+ simpleActions={
+ @Jpf.SimpleAction(name="overrideMe", path="success.jsp")
+ }
+)
+public class Controller extends Super2
+{
+ @Jpf.Action
+ public Forward throwException() throws Exception
+ {
+ throw new Super1.Ex();
+ }
+}
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/index.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/index.jsp?view=auto&rev=122539
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/index.jsp
Thu Dec 16 01:54:20 2004
@@ -0,0 +1,37 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="beehive-netui-tags-html.tld" prefix="netui" %>
+<%@ taglib uri="beehive-netui-tags-databinding.tld" prefix="netui-data"%>
+
+<html>
+<head>
+<title>Page Flow Inheritance</title>
+</head>
+<body>
+<h3>Page Flow Inheritance</h3>
+
+ <b>Actions:</b>
+ <ul>
+ <netui-data:repeater dataSource="pageFlow.sortedActions">
+
<netui-data:repeaterItem><li>${container.item}</li></netui-data:repeaterItem>
+ </netui-data:repeater>
+ </ul>
+
+ <br/>
+ <netui:anchor action="methodAction1">action in superclass</netui:anchor>
+ <br/>
+ <netui:anchor action="throwException">throw exception</netui:anchor>
+ <br/>
+ <netui:anchor action="overrideMe">hit overridden action</netui:anchor>
+
+ <br/>
+ <br/>
+ Message: <b>${pageInput.message}</b>
+
+
+</body>
+</html>
+
+
+
+
+
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/success.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/success.jsp?view=auto&rev=122539
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/success.jsp
Thu Dec 16 01:54:20 2004
@@ -0,0 +1,23 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="beehive-netui-tags-html.tld" prefix="netui" %>
+<%@ taglib uri="beehive-netui-tags-databinding.tld" prefix="netui-data"%>
+
+<html>
+<head>
+<title>Page Flow Inheritance</title>
+</head>
+<body>
+<h3>Page Flow Inheritance</h3>
+
+ Success. We hit the overridden "overrideMe" action.
+ <br/>
+ <netui:anchor action="begin">start over</netui:anchor>
+
+
+</body>
+</html>
+
+
+
+
+
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super1/Super1.jpf
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super1/Super1.jpf?view=auto&rev=122539
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super1/Super1.jpf
Thu Dec 16 01:54:20 2004
@@ -0,0 +1,40 @@
+package pageFlowCore.inheritance.super1;
+
+import org.apache.beehive.netui.pageflow.*;
+import org.apache.beehive.netui.pageflow.annotations.*;
+import pageFlowCore.inheritance.super0.Super0; // in WEB-INF/src
+
[EMAIL PROTECTED](
+ simpleActions={
+ @Jpf.SimpleAction(name="simpleAction1", path="index.jsp")
+ },
+ catches={
+ @Jpf.Catch(type=Super1.Ex.class, method="handleEx")
+ }
+)
+public class Super1 extends Super0
+{
+ public static class Ex extends Exception
+ {
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="current", navigateTo=Jpf.NavigateTo.currentPage)
+ }
+ )
+ public Forward methodAction1()
+ {
+ return new Forward( "current", "message", "in " +
Super1.class.getName() + ".methodAction1()" );
+ }
+
+ @Jpf.ExceptionHandler(
+ forwards={
+ @Jpf.Forward(name="cur", navigateTo=Jpf.NavigateTo.currentPage)
+ }
+ )
+ public Forward handleEx( Ex ex, String actionName, String message, Object
form )
+ {
+ return new Forward( "cur", "message", "in " + Super1.class.getName() +
".handleEx()" );
+ }
+}
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super1/index.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super1/index.jsp?view=auto&rev=122539
==============================================================================
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super2/Super2.jpf
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super2/Super2.jpf?view=auto&rev=122539
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super2/Super2.jpf
Thu Dec 16 01:54:20 2004
@@ -0,0 +1,21 @@
+package pageFlowCore.inheritance.super2;
+
+import pageFlowCore.inheritance.super1.Super1;
+
+import org.apache.beehive.netui.pageflow.*;
+import org.apache.beehive.netui.pageflow.annotations.*;
+
[EMAIL PROTECTED](
+ simpleActions={
+ @Jpf.SimpleAction(name="simpleAction2", path="index.jsp"),
+ @Jpf.SimpleAction(name="overrideMe", path="index.jsp")
+ }
+)
+public class Super2 extends Super1
+{
+ @Jpf.Action
+ public Forward methodAction2()
+ {
+ return null;
+ }
+}
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super2/index.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super2/index.jsp?view=auto&rev=122539
==============================================================================
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?view=diff&rev=122539&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=122538&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=122539
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Thu Dec 16 01:54:20 2004
@@ -3658,6 +3658,19 @@
</features>
</test>
<test>
+ <name>PfInheritance</name>
+ <description>Tests inheritance of actions and
catch/exception-handlers in page flows.</description>
+ <webapp>coreWeb</webapp>
+ <categories>
+ <category>bvt</category>
+ <category>corePageFlow</category>
+ </categories>
+ <features>
+ <feature>PageFlow</feature>
+ <feature>Inheritance</feature>
+ </features>
+ </test>
+ <test>
<name>PfLifecycle</name>
<description>Tests of all the PageFlow lifecycle methods</description>
<webapp>coreWeb</webapp>
Added:
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PfInheritance.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PfInheritance.xml?view=auto&rev=122539
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PfInheritance.xml
Thu Dec 16 01:54:20 2004
@@ -0,0 +1,355 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+ <ses:sessionName>PfInheritance</ses:sessionName>
+ <ses:tester>rich</ses:tester>
+ <ses:startDate>16 Dec 2004, 12:05:08.838 AM MST</ses:startDate>
+ <ses:description>Test of action and catch/exception-handler inheritance in
page flows.</ses:description>
+ <ses:tests>
+ <ses:test>
+ <ses:testNumber>1</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+ <ses:uri>/coreWeb/pageFlowCore/inheritance/Controller.jpf</ses:uri>
+ <ses:method>GET</ses:method>
+ <ses:parameters/>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>7D0CDDA448602248351F4DEB4CF35903</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=7D0CDDA448602248351F4DEB4CF35903</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<html>
+<head>
+<title>Page Flow Inheritance</title>
+</head>
+<body>
+<h3>Page Flow Inheritance</h3>
+
+ <b>Actions:</b>
+ <ul>
+
<li>begin</li><li>methodAction0</li><li>methodAction1</li><li>methodAction2</li><li>overrideMe</li><li>simpleAction0</li><li>simpleAction1</li><li>simpleAction2</li><li>throwException</li>
+ </ul>
+
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/methodAction1.do">action in
superclass</a>
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/throwException.do">throw
exception</a>
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/overrideMe.do">hit overridden
action</a>
+
+ <br/>
+ <br/>
+ Message: <b></b>
+
+
+</body>
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ <ses:test>
+ <ses:testNumber>2</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+
<ses:uri>/coreWeb/pageFlowCore/inheritance/methodAction1.do</ses:uri>
+ <ses:method>GET</ses:method>
+ <ses:parameters/>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>7D0CDDA448602248351F4DEB4CF35903</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=7D0CDDA448602248351F4DEB4CF35903</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>referer</ses:name>
+
<ses:value>http://localhost:8080/coreWeb/pageFlowCore/inheritance/Controller.jpf</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<html>
+<head>
+<title>Page Flow Inheritance</title>
+</head>
+<body>
+<h3>Page Flow Inheritance</h3>
+
+ <b>Actions:</b>
+ <ul>
+
<li>begin</li><li>methodAction0</li><li>methodAction1</li><li>methodAction2</li><li>overrideMe</li><li>simpleAction0</li><li>simpleAction1</li><li>simpleAction2</li><li>throwException</li>
+ </ul>
+
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/methodAction1.do">action in
superclass</a>
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/throwException.do">throw
exception</a>
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/overrideMe.do">hit overridden
action</a>
+
+ <br/>
+ <br/>
+ Message: <b>in pageFlowCore.inheritance.super1.Super1.methodAction1()</b>
+
+
+</body>
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ <ses:test>
+ <ses:testNumber>3</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+
<ses:uri>/coreWeb/pageFlowCore/inheritance/throwException.do</ses:uri>
+ <ses:method>GET</ses:method>
+ <ses:parameters/>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>7D0CDDA448602248351F4DEB4CF35903</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=7D0CDDA448602248351F4DEB4CF35903</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>referer</ses:name>
+
<ses:value>http://localhost:8080/coreWeb/pageFlowCore/inheritance/methodAction1.do</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<html>
+<head>
+<title>Page Flow Inheritance</title>
+</head>
+<body>
+<h3>Page Flow Inheritance</h3>
+
+ <b>Actions:</b>
+ <ul>
+
<li>begin</li><li>methodAction0</li><li>methodAction1</li><li>methodAction2</li><li>overrideMe</li><li>simpleAction0</li><li>simpleAction1</li><li>simpleAction2</li><li>throwException</li>
+ </ul>
+
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/methodAction1.do">action in
superclass</a>
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/throwException.do">throw
exception</a>
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/overrideMe.do">hit overridden
action</a>
+
+ <br/>
+ <br/>
+ Message: <b>in pageFlowCore.inheritance.super1.Super1.handleEx()</b>
+
+
+</body>
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ <ses:test>
+ <ses:testNumber>4</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+ <ses:uri>/coreWeb/pageFlowCore/inheritance/overrideMe.do</ses:uri>
+ <ses:method>GET</ses:method>
+ <ses:parameters/>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>7D0CDDA448602248351F4DEB4CF35903</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=7D0CDDA448602248351F4DEB4CF35903</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>referer</ses:name>
+
<ses:value>http://localhost:8080/coreWeb/pageFlowCore/inheritance/throwException.do</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<html>
+<head>
+<title>Page Flow Inheritance</title>
+</head>
+<body>
+<h3>Page Flow Inheritance</h3>
+
+ Success. We hit the overridden "overrideMe" action.
+ <br/>
+ <a href="/coreWeb/pageFlowCore/inheritance/begin.do">start over</a>
+
+
+</body>
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ </ses:tests>
+ <ses:endDate>16 Dec 2004, 12:05:28.957 AM MST</ses:endDate>
+ <ses:testCount>4</ses:testCount>
+</ses:recorderSession>
\ No newline at end of file