Author: rich
Date: Sun Feb 20 22:28:07 2005
New Revision: 154639
URL: http://svn.apache.org/viewcvs?view=rev&rev=154639
Log:
Fixes for:
- http://issues.apache.org/jira/browse/BEEHIVE-288 : Compiler: A jpf which
has 2 forward annotations with the same name on the same action, is NOT
producing a warning or error
- http://issues.apache.org/jira/browse/BEEHIVE-282 : Action annotation does
not override the parent one when implimenting an abstract action from an
abstract parent pageflow
- http://issues.apache.org/jira/browse/BEEHIVE-227 : PageFlow Action
loginRequired=false overriding loginRequired=true set in the Controller does
not work when rolesAllowed is set in the Controller
- http://issues.apache.org/jira/browse/BEEHIVE-193 : SharedFlow (.jpfs)
files should not be web-addressable
- http://issues.apache.org/jira/browse/BEEHIVE-267 : Patch for new a
coreWeb MockPortal BVT
Also, merged the two areas of code related to request interceptors
(o.a.b.netui.interceptor.request and o.a.b.netui.requeststate).
DRT/BVT: netui (WinXP)
BB: self (linux)
Added:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/AbstractInterceptor.java
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/index.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j189/index.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/actionInterceptors/someFlow/error.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/mockportal/scoping/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/mockportal/scoping/ScopedPortal.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/mockportal/scoping/ScopingController.jpf
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/mockportal/scoping/index.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/mockportal/scoping/results.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/mockportal/scoping/window1.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/mockportal/scoping/window1Results.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super0/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super0/index.jsp
(with props)
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/MockPortalScopingTest.xml
(with props)
Removed:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorConfig.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorConfig.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/requeststate/IRequestInterceptor.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/requeststate/InterceptorContext.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/requeststate/ServletInterceptorContext.java
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.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/genmodel/GenActionModel.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/AbsolutePathType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/DelegatingType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/EnumType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExternalPathOrActionType.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/JavaIdentifierType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberFieldType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberMethodType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MessageKeyType.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/RolesAllowedType.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/TilesDefinitionsConfigsType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/UniqueValueType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidActionType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateRangeGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateTypeGrammar.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/WebappPathType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WritableFieldType.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowActionServlet.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptorConfig.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptor.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorContext.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalConstants.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/xmlhttprequest/XmlHttpRequestServlet.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClientRequestInterceptor.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanelCRI.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeCRI.java
incubator/beehive/trunk/netui/src/util/netui-config-default.xml
incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd
incubator/beehive/trunk/netui/src/webapp-template/default/WEB-INF/netui-config.xml
incubator/beehive/trunk/netui/src/webapp-template/default/WEB-INF/web.xml
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/global/Global.app
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/miniTests/actionInterceptors/GlobalInterceptor.java
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNestedPopup/Controller.jpf
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNestedPopup/getZip/GetZip.jpf
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/mockportal/index.jsp
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/returnTo/test30/Jpf1.jpf
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationGrammar.java
Sun Feb 20 22:28:07 2005
@@ -81,6 +81,12 @@
public final Object check( AnnotationMirror annotation, AnnotationMirror[]
parentAnnotations,
MemberDeclaration classMember )
{
+ return check( annotation, parentAnnotations, classMember, -1 );
+ }
+
+ public final Object check( AnnotationMirror annotation, AnnotationMirror[]
parentAnnotations,
+ MemberDeclaration classMember, int
annotationArrayIndex )
+ {
if ( ! beginCheck( annotation, parentAnnotations, classMember ) )
{
return null;
@@ -129,9 +135,10 @@
{
List< AnnotationMirror > annotations =
CompilerUtils.getAnnotationArray( value );
- for ( AnnotationMirror ann : annotations )
+ for ( int j = 0; j < annotations.size(); ++j )
{
- arrayGrammar.check( ann, parentsIncludingMe,
classMember );
+ AnnotationMirror ann = annotations.get( j );
+ arrayGrammar.check( ann, parentsIncludingMe,
classMember, j );
}
}
}
@@ -141,12 +148,9 @@
if ( memberType != null ) // it will be non-null unless
there are other, more basic, errors
{
- Object result = memberType.check( decl, value,
parentsIncludingMe, classMember );
-
- if ( result != null )
- {
- checkResults.put( memberName, result );
- }
+ Object result =
+ memberType.check( decl, value, parentsIncludingMe,
classMember, annotationArrayIndex );
+ if ( result != null ) checkResults.put( memberName, result
);
}
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/AnnotationMemberType.java
Sun Feb 20 22:28:07 2005
@@ -45,7 +45,8 @@
* @return a result (any Object) that will be passed back to the parent
checker. May be <code>null</code>.
*/
public final Object check( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
//
// First check to see if this attribute requires a particular runtime
version.
@@ -56,14 +57,15 @@
_requiredRuntimeVersion, value, diags,
"error.required-runtime-version-attribute", valueName,
PAGEFLOW_RUNTIME_JAR );
- return onCheck( valueDecl, value, parentAnnotations, classMember );
// for derived classes
+ return onCheck( valueDecl, value, parentAnnotations, classMember,
annotationArrayIndex ); // for derived classes
}
/**
* @return a result (any Object) that will be passed back to the parent
checker. May be <code>null</code>.
*/
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
return null;
}
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&r1=154638&r2=154639
==============================================================================
---
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
Sun Feb 20 22:28:07 2005
@@ -391,7 +391,41 @@
{
if ( desiredAnnotation == null || getAnnotation( method,
desiredAnnotation ) != null )
{
- results.add( method );
+ boolean isDuplicate = false;
+
+ //
+ // Make sure we're not adding a duplicate method -- one
that was already overridden.
+ //
+ if ( onlyPublicOrPrivate )
+ {
+ Collection< ParameterDeclaration > methodParams =
method.getParameters();
+
+ for ( MethodDeclaration existingMethod : results )
+ {
+ if ( existingMethod.getSimpleName().equals(
method.getSimpleName() ) )
+ {
+ Collection< ParameterDeclaration >
existingMethodParams = existingMethod.getParameters();
+
+ if ( existingMethodParams.size() ==
methodParams.size() )
+ {
+ isDuplicate = true;
+ Iterator< ParameterDeclaration > i =
methodParams.iterator();
+ for ( ParameterDeclaration
existingMethodParam : existingMethodParams )
+ {
+ ParameterDeclaration methodParam =
i.next();
+
+ if ( !
existingMethodParam.getType().equals( methodParam.getType() ) )
+ {
+ isDuplicate = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ( ! isDuplicate ) results.add( method );
}
}
}
@@ -560,7 +594,6 @@
return typesAreEqual( getDeclaration( ( DeclaredType ) type ),
env.getTypeDeclaration( className ) );
}
- // TODO: this method will be unnecessary when CRXXXX is fixed.
public static boolean typesAreEqual( TypeDeclaration t1, TypeDeclaration
t2 )
{
assert t1 != null;
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java?view=diff&r1=154638&r2=154639
==============================================================================
---
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
Sun Feb 20 22:28:07 2005
@@ -234,8 +234,10 @@
super( VERSION_9_0_STRING, JpfControllerGrammar.this );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
boolean isLongLived = ( Boolean ) value.getValue();
if ( isLongLived && getFlowControllerInfo().isNested() )
addError( value, "error.nested-long-lived" );
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&r1=154638&r2=154639
==============================================================================
---
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
Sun Feb 20 22:28:07 2005
@@ -66,8 +66,11 @@
// loginRequired
//
Boolean loginRequired = CompilerUtils.getBoolean( annotation,
LOGIN_REQUIRED_ATTR, true );
+ boolean loginRequiredSetOnAction = true;
+
if ( loginRequired == null )
{
+ loginRequiredSetOnAction = false;
loginRequired =
parentApp.getFlowControllerInfo().getMergedControllerAnnotation().isLoginRequired();
}
setLoginRequired( loginRequired );
@@ -89,9 +92,12 @@
setReadonly( readOnly );
//
- // rolesAllowed
+ // rolesAllowed -- avoid setting this if loginRequired is explicitly
false.
//
- setRolesAllowed( annotation, jclass, parentApp );
+ if ( ! loginRequiredSetOnAction || loginRequired.booleanValue() )
+ {
+ setRolesAllowed( annotation, jclass, parentApp );
+ }
//
// type (delegating Action class, with the FlowController as parameter)
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/AbsolutePathType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/AbsolutePathType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/AbsolutePathType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/AbsolutePathType.java
Sun Feb 20 22:28:07 2005
@@ -32,8 +32,10 @@
super( requiredRuntimeVersion, parentGrammar);
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember)
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
AnnotationMirror parentAnnotation = parentAnnotations[
parentAnnotations.length - 1 ];
String path = CompilerUtils.getString( parentAnnotation, PATH_ATTR,
false );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
Sun Feb 20 22:28:07 2005
@@ -232,8 +232,10 @@
super( null, ActionGrammar.this );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
//
// If this value is set to true, there must be a value for
validationErrorForward.
@@ -274,11 +276,14 @@
super( OBJECT_CLASS_NAME, USE_FORM_BEAN_ATTR, null,
ActionGrammar.this );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
FieldDeclaration memberField =
- ( FieldDeclaration ) super.onCheck( valueDecl, value,
parentAnnotations, classMember );
+ ( FieldDeclaration ) super.onCheck( valueDecl, value,
parentAnnotations, classMember,
+ annotationArrayIndex );
if ( memberField != null )
{
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/DelegatingType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/DelegatingType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/DelegatingType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/DelegatingType.java
Sun Feb 20 22:28:07 2005
@@ -37,9 +37,11 @@
_baseType = baseType;
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
- return _baseType.onCheck( valueDecl, member, parentAnnotations,
classMember );
+ return _baseType.onCheck( valueDecl, member, parentAnnotations,
classMember, annotationArrayIndex );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/EnumType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/EnumType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/EnumType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/EnumType.java
Sun Feb 20 22:28:07 2005
@@ -80,8 +80,10 @@
}
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
//
// Check deprecated values.
@@ -106,7 +108,7 @@
PAGEFLOW_RUNTIME_JAR );
}
- return super.onCheck( valueDecl, member, parentAnnotations,
classMember );
+ return super.onCheck( valueDecl, member, parentAnnotations,
classMember, annotationArrayIndex );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExternalPathOrActionType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExternalPathOrActionType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExternalPathOrActionType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExternalPathOrActionType.java
Sun Feb 20 22:28:07 2005
@@ -33,8 +33,10 @@
super( pathMustBeRelative, requiredRuntimeVersion, parentGrammar,
fcInfo );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
AnnotationMirror parentAnnotation = parentAnnotations[
parentAnnotations.length - 1 ];
@@ -44,6 +46,6 @@
return null;
}
- return super.onCheck( valueDecl, value, parentAnnotations, classMember
);
+ return super.onCheck( valueDecl, value, parentAnnotations,
classMember, annotationArrayIndex );
}
}
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&r1=154638&r2=154639
==============================================================================
---
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
Sun Feb 20 22:28:07 2005
@@ -181,7 +181,7 @@
{
//
// curEntity will be either the pageflow class or an action
method, where we'll look
- // for @jpf:catch annotations that refer to exception-handler
methods, which also have
+ // for @Jpf.Catch annotations that refer to exception-handler
methods, which also have
// forwards that get rolled onto this entity.
//
List< AnnotationMirror > additionalEntities = new ArrayList<
AnnotationMirror >();
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&r1=154638&r2=154639
==============================================================================
---
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
Sun Feb 20 22:28:07 2005
@@ -40,8 +40,10 @@
super( baseType, requiredRuntimeVersion, parentGrammar );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
String stringValue = ( String ) value.getValue();
@@ -61,6 +63,6 @@
}
}
- return super.onCheck( valueDecl, value, parentAnnotations, classMember
);
+ return super.onCheck( valueDecl, value, parentAnnotations,
classMember, annotationArrayIndex );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/JavaIdentifierType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/JavaIdentifierType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/JavaIdentifierType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/JavaIdentifierType.java
Sun Feb 20 22:28:07 2005
@@ -35,8 +35,10 @@
_validChars = validChars;
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
String val = ( String ) value.getValue();
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/LocaleRulesGrammar.java
Sun Feb 20 22:28:07 2005
@@ -77,8 +77,10 @@
super( null, LocaleRulesGrammar.this );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
AnnotationMirror parentAnnotation = parentAnnotations[
parentAnnotations.length - 1 ];
String language = CompilerUtils.getString( parentAnnotation,
LANGUAGE_ATTR, true );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberFieldType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberFieldType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberFieldType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberFieldType.java
Sun Feb 20 22:28:07 2005
@@ -43,8 +43,10 @@
_requiredSuperclassName = requiredSuperclassName;
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
String fieldName = ( String ) member.getValue();
Collection< FieldDeclaration > fields =
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberMethodType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberMethodType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberMethodType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MemberMethodType.java
Sun Feb 20 22:28:07 2005
@@ -43,8 +43,10 @@
_errorCode = errorCode;
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
//
// Look through all the methods to see if there is one whose name
matches the given value.
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MessageKeyType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MessageKeyType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MessageKeyType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/MessageKeyType.java
Sun Feb 20 22:28:07 2005
@@ -34,8 +34,10 @@
super( requiredRuntimeVersion, parentGrammar );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
if ( ( ( String ) member.getValue() ).length() == 0 )
{
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&r1=154638&r2=154639
==============================================================================
---
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
Sun Feb 20 22:28:07 2005
@@ -57,8 +57,10 @@
_jpfClass = jpfClass;
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
String action = ( String ) member.getValue();
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RolesAllowedType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RolesAllowedType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RolesAllowedType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/RolesAllowedType.java
Sun Feb 20 22:28:07 2005
@@ -37,8 +37,10 @@
super( null, parentGrammar );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
AnnotationMirror parentAnnotation = parentAnnotations[
parentAnnotations.length - 1 ];
Boolean loginRequired = CompilerUtils.getBoolean( parentAnnotation,
LOGIN_REQUIRED_ATTR, true );
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&r1=154638&r2=154639
==============================================================================
---
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
Sun Feb 20 22:28:07 2005
@@ -138,8 +138,10 @@
super( null, SimpleActionGrammar.this );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
Collection< AnnotationMirror > forwards =
getFlowControllerInfo().getMergedControllerAnnotation().getForwards();
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TilesDefinitionsConfigsType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TilesDefinitionsConfigsType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TilesDefinitionsConfigsType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TilesDefinitionsConfigsType.java
Sun Feb 20 22:28:07 2005
@@ -34,8 +34,10 @@
super( false, requiredRuntimeVersion, parentGrammar, fcInfo );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
List< AnnotationValue > values = ( List< AnnotationValue > )
value.getValue();
@@ -43,7 +45,7 @@
{
for ( AnnotationValue pathValue : values )
{
- super.onCheck( valueDecl, pathValue, parentAnnotations,
classMember );
+ super.onCheck( valueDecl, pathValue, parentAnnotations,
classMember, annotationArrayIndex );
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java
Sun Feb 20 22:28:07 2005
@@ -47,8 +47,10 @@
/**
* @return the fully-qualified type (ClassDeclaration)
*/
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
Object val = value.getValue();
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/UniqueValueType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/UniqueValueType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/UniqueValueType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/UniqueValueType.java
Sun Feb 20 22:28:07 2005
@@ -52,8 +52,10 @@
/**
* @return a result (any Object) that will be passed back to the parent
checker. May be <code>null</code>.
*/
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
String val = value.getValue().toString();
@@ -65,8 +67,7 @@
if ( parentAnnotations.length < 2 ) return null; // invalid parents
-- will be caught elsewhere
AnnotationMirror parentElement = parentAnnotations[
parentAnnotations.length - 2 ];
- Collection< AnnotationMirror > memberGroup =
- CompilerUtils.getAnnotationArray( parentElement,
_memberGroupName, true );
+ List< AnnotationMirror > memberGroup =
CompilerUtils.getAnnotationArray( parentElement, _memberGroupName, true );
//
// If memberGroup is null, then this annotation was in the wrong
place, and there will be other errors.
@@ -75,18 +76,24 @@
{
String valueName = valueDecl.getSimpleName();
AnnotationMirror parentAnnotation = parentAnnotations[
parentAnnotations.length - 1 ];
- checkForDuplicates( value, valueName, parentAnnotation,
classMember, memberGroup, false );
+ checkForDuplicates( value, valueName, parentAnnotation,
classMember, memberGroup, false, annotationArrayIndex );
+ //
+ // Get a list of additional annotations (presumably not from the
this one's parent) to check.
+ //
List< AnnotationMirror > additionalAnnsToCheck =
getAdditionalAnnotationsToCheck( classMember );
if ( additionalAnnsToCheck != null )
{
- checkForDuplicates( value, valueName, parentAnnotation,
classMember, additionalAnnsToCheck, true );
+ // Check this value against the list of additional annotations.
+ checkForDuplicates( value, valueName, parentAnnotation,
classMember, additionalAnnsToCheck, true, -1 );
- for ( AnnotationMirror ann : additionalAnnsToCheck )
+ // Check for duplicates *within* within the list of additional
annotations.
+ for ( int i = 0; i < additionalAnnsToCheck.size(); ++i )
{
+ AnnotationMirror ann = additionalAnnsToCheck.get( i );
AnnotationValue valueToCheck =
CompilerUtils.getAnnotationValue( ann, valueName, true );
- checkForDuplicates( valueToCheck, valueName, ann,
classMember, additionalAnnsToCheck, true );
+ checkForDuplicates( valueToCheck, valueName, ann,
classMember, additionalAnnsToCheck, true, -1 );
}
}
}
@@ -109,14 +116,17 @@
}
protected void checkForDuplicates( AnnotationValue member, String
memberName, AnnotationMirror parentAnnotation,
- MemberDeclaration classMember,
Collection< AnnotationMirror > annotationsToCheck,
- boolean includeEntityInMsg )
+ MemberDeclaration classMember, List<
AnnotationMirror > annotationsToCheck,
+ boolean includeEntityInMsg, int
annotationArrayIndex )
{
Object memberValue = member.getValue();
- for ( AnnotationMirror annotation : annotationsToCheck )
+ for ( int i = 0; i < annotationsToCheck.size(); ++i )
{
- if ( ! CompilerUtils.annotationsAreEqual( annotation,
parentAnnotation, allowExactDuplicates(), getEnv() ) )
+ AnnotationMirror annotation = annotationsToCheck.get( i );
+
+ if ( ( annotationArrayIndex != -1 && annotationArrayIndex != i ) ||
+ ! CompilerUtils.annotationsAreEqual( annotation,
parentAnnotation, allowExactDuplicates(), getEnv() ) )
{
AnnotationValue valueToCheck =
CompilerUtils.getAnnotationValue( annotation,
memberName, _checkDefaultValues );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidActionType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidActionType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidActionType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidActionType.java
Sun Feb 20 22:28:07 2005
@@ -32,7 +32,10 @@
super( false, requiredRuntimeVersion, parentGrammar, fcInfo );
}
- public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value, AnnotationMirror[] parentAnnotations, MemberDeclaration
classMember )
+ @Override
+ public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
String stringValue = ( String ) value.getValue();
checkAction( stringValue + ACTION_EXTENSION_DOT, value, classMember );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateRangeGrammar.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateRangeGrammar.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateRangeGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateRangeGrammar.java
Sun Feb 20 22:28:07 2005
@@ -81,8 +81,10 @@
super( ValidateRangeGrammar.this.getRequiredRuntimeVersion(),
ValidateRangeGrammar.this );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
Double d = ( Double ) member.getValue();
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateTypeGrammar.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateTypeGrammar.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateTypeGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidateTypeGrammar.java
Sun Feb 20 22:28:07 2005
@@ -54,8 +54,10 @@
super( ValidateTypeGrammar.this.getRequiredRuntimeVersion(),
ValidateTypeGrammar.this );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
Object val = value.getValue();
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&r1=154638&r2=154639
==============================================================================
---
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
Sun Feb 20 22:28:07 2005
@@ -42,12 +42,14 @@
super( pathMustBeRelative, requiredRuntimeVersion, parentGrammar,
fcInfo );
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
String stringValue = ( String ) value.getValue();
checkAction( stringValue, value, classMember );
- return super.onCheck( valueDecl, value, parentAnnotations, classMember
);
+ return super.onCheck( valueDecl, value, parentAnnotations,
classMember, annotationArrayIndex );
}
protected void checkAction( String stringValue, AnnotationValue annValue,
MemberDeclaration classMember )
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
Sun Feb 20 22:28:07 2005
@@ -61,8 +61,10 @@
_flowControllerInfo = fcInfo;
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
String filePath = ( String ) value.getValue();
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&r1=154638&r2=154639
==============================================================================
---
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
Sun Feb 20 22:28:07 2005
@@ -41,8 +41,10 @@
_attrName = attrName;
}
+ @Override
public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue value,
- AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember,
+ int annotationArrayIndex )
{
//
// Look for the "readOnly" attribute on the current action method or
the current class. If it's there,
@@ -66,6 +68,6 @@
addError( value, "error.readonly-writable-field-value", _attrName
);
}
- return super.onCheck( valueDecl, value, parentAnnotations, classMember
);
+ return super.onCheck( valueDecl, value, parentAnnotations,
classMember, annotationArrayIndex );
}
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowActionServlet.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowActionServlet.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowActionServlet.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowActionServlet.java
Sun Feb 20 22:28:07 2005
@@ -23,6 +23,7 @@
import org.apache.beehive.netui.pageflow.handler.FlowControllerHandlerContext;
import org.apache.beehive.netui.pageflow.handler.ForwardRedirectHandler;
import org.apache.beehive.netui.util.ServletUtils;
+import org.apache.beehive.netui.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
@@ -31,6 +32,9 @@
import java.io.Serializable;
import java.io.IOException;
+import static
org.apache.beehive.netui.pageflow.internal.InternalConstants.FACES_BACKING_EXTENSION;
+import static
org.apache.beehive.netui.pageflow.internal.InternalConstants.SHARED_FLOW_EXTENSION;
+
/**
* ActionServlet that dynamically registers modules based on naming/location
conventions for Struts
@@ -42,6 +46,8 @@
*/
public class PageFlowActionServlet extends AutoRegisterActionServlet
{
+ private static final Logger _log = Logger.getInstance(
PageFlowActionServlet.class );
+
private Handlers _handlers;
private static final ModuleConfigLocator[] DEFAULT_MODULE_CONFIG_LOCATORS =
@@ -128,6 +134,20 @@
protected void process( HttpServletRequest request, HttpServletResponse
response )
throws IOException, ServletException
{
+ // If this is a direct request for a shared flow (.jpfs) or a Faces
backing bean (.jsfb), return a 404 status.
+ // These are not web-addressable.
+ String servletPath = request.getServletPath();
+ if ( servletPath.endsWith( SHARED_FLOW_EXTENSION ) ||
servletPath.endsWith( FACES_BACKING_EXTENSION ) )
+ {
+ if ( _log.isDebugEnabled() )
+ {
+ _log.debug( "Attempt to hit restricted URI " + servletPath +
"; 404 error returned." );
+ }
+
+ response.sendError( HttpServletResponse.SC_NOT_FOUND );
+ return;
+ }
+
// First, reinitialize the page flow classloader, for reloading when
recompile occurs in dev mode.
FlowControllerHandlerContext handlerContext = new
FlowControllerHandlerContext( request, response, null );
_handlers.getReloadableClassHandler().reloadClasses( handlerContext );
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java
Sun Feb 20 22:28:07 2005
@@ -33,7 +33,13 @@
/**
* The extension used for hitting a [EMAIL PROTECTED] PageFlowController}
through its URI.
*/
- public static final String JPF_EXTENSION = ".jpf";
+ public static final String PAGEFLOW_EXTENSION = ".jpf";
+
+ /**
+ * The extension used for hitting a [EMAIL PROTECTED] PageFlowController}
through its URI.
+ * @deprecated Use [EMAIL PROTECTED] #PAGEFLOW_EXTENSION} instead.
+ */
+ public static final String JPF_EXTENSION = PAGEFLOW_EXTENSION;
/**
* The extension for Struts action URIs used with page flows.
@@ -58,17 +64,30 @@
/**
* The filename prefix for Struts module configuration files generated
from page flow source files.
*/
- public static final String JPF_MODULE_CONFIG_PREFIX = "jpf-struts-config";
+ public static final String PAGEFLOW_MODULE_CONFIG_PREFIX =
"jpf-struts-config";
+
+ /**
+ * The filename prefix for Struts module configuration files generated
from page flow source files.
+ * @deprecated Use [EMAIL PROTECTED] #PAGEFLOW_MODULE_CONFIG_PREFIX}
instead.
+ */
+ public static final String JPF_MODULE_CONFIG_PREFIX =
PAGEFLOW_MODULE_CONFIG_PREFIX;
/**
- * The file extensionfor Struts configuration files generated by the Page
Flow compiler.
+ * The file extensioni for Struts configuration files generated by the
Page Flow compiler.
*/
- public static final String JPF_MODULE_CONFIG_EXTENSION = ".xml";
+ public static final String PAGEFLOW_MODULE_CONFIG_EXTENSION = ".xml";
+
+ /**
+ * The file extensioni for Struts configuration files generated by the
Page Flow compiler.
+ * @deprecated Use [EMAIL PROTECTED] #PAGEFLOW_MODULE_CONFIG_EXTENSION}
instead.
+ */
+ public static final String JPF_MODULE_CONFIG_EXTENSION =
PAGEFLOW_MODULE_CONFIG_EXTENSION;
/**
* The prefix for a button or imageButton that has an action.
+ * @deprecated This is an internal constant that will be removed without
replacement.
*/
- public static final String ACTION_OVERRIDE = "actionOverride:";
+ public static final String ACTION_OVERRIDE =
InternalConstants.ACTION_OVERRIDE_PREFIX;
/**
* Servlet context-param that configures the maximum number of consecutive
server forwards before error.
@@ -96,10 +115,16 @@
public static final String SECURE_FORWARDS_PARAM = "jpf-secure-forwards";
/**
- * The webapp-relative directory for Struts module configuration files
generated by the
- * page flow compiler.
+ * The default webapp-relative directory for Struts module configuration
files generated by the Page Flow compiler.
+ */
+ public static final String PAGEFLOW_MODULE_CONFIG_GEN_DIR =
InternalConstants.WEBINF_DIR + "/.pageflow-struts-generated";
+
+ /**
+ * The default webapp-relative directory for Struts module configuration
files generated by the Page Flow compiler.
+ * @deprecated Use [EMAIL PROTECTED] #PAGEFLOW_MODULE_CONFIG_GEN_DIR}
instead.
*/
- public static final String JPF_MODULE_CONFIG_GEN_DIR =
InternalConstants.WEBINF_DIR + "/.pageflow-struts-generated";
+ public static final String JPF_MODULE_CONFIG_GEN_DIR =
PAGEFLOW_MODULE_CONFIG_GEN_DIR;
+ // TODO: comment this
public static final String AUTO_VIEW_RENDER_FORWARD_NAME = "_auto";
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
Sun Feb 20 22:28:07 2005
@@ -39,6 +39,7 @@
import org.apache.beehive.netui.pageflow.interceptor.Interceptor;
import org.apache.beehive.netui.pageflow.interceptor.Interceptors;
import org.apache.beehive.netui.pageflow.interceptor.InterceptorException;
+import
org.apache.beehive.netui.pageflow.interceptor.request.RequestInterceptorContext;
import
org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptorContext;
import org.apache.beehive.netui.pageflow.interceptor.action.InterceptorForward;
import org.apache.beehive.netui.script.common.ImplicitObjectUtil;
@@ -792,25 +793,36 @@
+ " -----------------------------------" );
}
- /*
- List< Interceptor > interceptors = null;
- RequestInterceptorContext context = new RequestInterceptorContext(
getServletContext(), request, response );
+ //
+ // First reinitialize the reloadable class handler. This will bounce
a classloader if necessary.
+ //
+ ServletContext servletContext = getServletContext();
+ _handlers.getReloadableClassHandler().reloadClasses( new
RequestContext( request, response ) );
+
+ //
+ // Go through the chain of pre-request interceptors.
+ //
+ RequestInterceptorContext context = new RequestInterceptorContext(
request, response, getServletContext() );
+ List< Interceptor > interceptors = context.getRequestInterceptors();
+
try
{
- InterceptorResult result = Interceptors.doPreIntercept( context,
interceptors );
- if ( result.hasResultOverride() ) return;
+ Interceptors.doPreIntercept( context, interceptors );
+
+ if ( context.requestWasCancelled() )
+ {
+ if ( _log.isDebugEnabled() )
+ {
+ _log.debug ( "Interceptor " +
context.getOverridingInterceptor() + " cancelled the request." );
+ }
+
+ return;
+ }
}
catch ( InterceptorException e )
{
throw new ServletException( e );
}
- */
-
- //
- // First reinitialize the reloadable class handler. This will bounce
a classloader if necessary.
- //
- ServletContext servletContext = getServletContext();
- _handlers.getReloadableClassHandler().reloadClasses( new
RequestContext( request, response ) );
//
// Initialize the ServletContext in the request. Often, we need
access to the ServletContext when we only
@@ -853,6 +865,18 @@
er.endActionRequest( request, response );
}
+ //
+ // Go through the chain of pre-request interceptors.
+ //
+ try
+ {
+ Interceptors.doPostIntercept( context, interceptors );
+ }
+ catch ( InterceptorException e )
+ {
+ throw new ServletException( e );
+ }
+
if ( _log.isTraceEnabled() )
{
_log.trace( "-------------------------------- End Request #" +
localRequestCount
@@ -1045,13 +1069,15 @@
{
super.init( actionServlet, mc );
+ ServletContext servletContext = getServletContext();
+
//
// Cache a reference to the ServletContainerAdapter, the Handlers, and
the LegacySettings.
//
- _servletContainerAdapter = AdapterManager.getServletContainerAdapter(
getServletContext() );
- _legacySettings = LegacySettings.get( getServletContext() );
- _handlers = Handlers.get( getServletContext() );
- _flowControllerFactory = FlowControllerFactory.get(
getServletContext() );
+ _servletContainerAdapter = AdapterManager.getServletContainerAdapter(
servletContext );
+ _legacySettings = LegacySettings.get( servletContext );
+ _handlers = Handlers.get( servletContext );
+ _flowControllerFactory = FlowControllerFactory.get( servletContext );
//
// Cache a list of overloaded actions for each overloaded action path
(actions are overloaded by form bean type).
@@ -1063,6 +1089,12 @@
//
cacheFormClasses();
+ //
+ // Initialize the request interceptors and action interceptors.
+ //
+ ActionInterceptorContext.init( servletContext );
+ RequestInterceptorContext.init( servletContext );
+
_pageServletFilter = new PageServletFilter();
}
@@ -1372,7 +1404,6 @@
// message.
//
FlowController fc = PageFlowUtils.getCurrentPageFlow( request );
- if ( fc == null ) fc = PageFlowRequestWrapper.get( request
).getCurrentFlowController();
try
{
@@ -1913,7 +1944,6 @@
interceptors = context.getActionInterceptors();
}
}
-
try
{
Added:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/AbstractInterceptor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/AbstractInterceptor.java?view=auto&rev=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/AbstractInterceptor.java
(added)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/AbstractInterceptor.java
Sun Feb 20 22:28:07 2005
@@ -0,0 +1,47 @@
+/*
+ * 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.pageflow.interceptor;
+
+import java.io.Serializable;
+
+public abstract class AbstractInterceptor
+ implements Interceptor, Serializable
+{
+ private InterceptorConfig _config;
+
+ /**
+ * Called when this interceptor is being initialized.
+ *
+ * @param config the configuration object associated with this interceptor.
+ */
+ public void init( InterceptorConfig config )
+ {
+ _config = config;
+ }
+
+ /**
+ * Get the configuration object associated with this interceptor.
+ *
+ * @return the configuration object associated with this interceptor.
+ */
+ public InterceptorConfig getConfig()
+ {
+ return _config;
+ }
+
+}
Propchange:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/AbstractInterceptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java
Sun Feb 20 22:28:07 2005
@@ -18,11 +18,14 @@
package org.apache.beehive.netui.pageflow.interceptor;
import java.io.Serializable;
+import java.util.Map;
+import java.util.HashMap;
-public abstract class InterceptorConfig
+public class InterceptorConfig
implements Serializable
{
private String _interceptorClass;
+ private Map< String, String > _customProperties = new HashMap< String,
String >();
protected InterceptorConfig()
{
@@ -41,5 +44,20 @@
public void setInterceptorClass( String interceptorClass )
{
_interceptorClass = interceptorClass;
+ }
+
+ public Map< String, String > getCustomProperties()
+ {
+ return _customProperties;
+ }
+
+ void addCustomProperty( String name, String value )
+ {
+ _customProperties.put( name, value );
+ }
+
+ public String getCustomProperty( String name )
+ {
+ return _customProperties.get( name );
}
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java
Sun Feb 20 22:28:07 2005
@@ -17,11 +17,18 @@
*/
package org.apache.beehive.netui.pageflow.interceptor;
+import org.apache.beehive.netui.util.config.bean.CustomProperty;
+import org.apache.beehive.netui.util.DiscoveryUtils;
+import org.apache.beehive.netui.util.logging.Logger;
+
import java.io.Serializable;
+import java.util.List;
public class InterceptorContext
implements Serializable
{
+ private static final Logger _log = Logger.getInstance(
InterceptorContext.class );
+
private Object _resultOverride;
private Interceptor _overridingInterceptor;
@@ -44,6 +51,95 @@
public Interceptor getOverridingInterceptor()
{
return _overridingInterceptor;
+ }
+
+ protected static void addInterceptors(
org.apache.beehive.netui.util.config.bean.Interceptor[] configBeans,
+ List< Interceptor >
interceptorsList, Class baseClassOrInterface )
+ {
+ if ( configBeans != null )
+ {
+ for ( int i = 0; i < configBeans.length; i++ )
+ {
+ org.apache.beehive.netui.util.config.bean.Interceptor
configBean = configBeans[i];
+ String className = configBean.getInterceptorClass();
+ InterceptorConfig config = new InterceptorConfig( className );
+ CustomProperty[] customProps =
configBean.getCustomPropertyArray();
+
+ if ( customProps != null )
+ {
+ for ( int j = 0; j < customProps.length; j++ )
+ {
+ CustomProperty customProp = customProps[j];
+ config.addCustomProperty( customProp.getName(),
customProp.getValue() );
+ }
+ }
+
+ addInterceptor( config, baseClassOrInterface, interceptorsList
);
+ }
+ }
+ }
+
+ /**
+ * Instantiates an interceptor, based on the class name in the given
InterceptorConfig, and adds it to the
+ * given collection of interceptors.
+ *
+ * @param config the InterceptorConfig used to determine the interceptor
class.
+ * @param baseClassOrInterface the required base class or interface. May
be <code>null</code>.
+ * @param interceptors the List of interceptors to which to add.
+ * @return an initialized Interceptor, or <code>null</code> if an error
occurred.
+ */
+ protected static Interceptor addInterceptor( InterceptorConfig config,
Class baseClassOrInterface,
+ List< Interceptor >
interceptors )
+ {
+ Interceptor interceptor = createInterceptor( config,
baseClassOrInterface );
+ if ( interceptor != null ) interceptors.add( interceptor );
+ return interceptor;
+ }
+
+ /**
+ * Instantiates an interceptor, based on the class name in the given
InterceptorConfig.
+ *
+ * @param config the InterceptorConfig used to determine the interceptor
class.
+ * @param baseClassOrInterface the required base class or interface. May
be <code>null</code>.
+ * @return an initialized Interceptor, or <code>null</code> if an error
occurred.
+ */
+ protected static Interceptor createInterceptor( InterceptorConfig config,
Class baseClassOrInterface )
+ {
+ assert Interceptor.class.isAssignableFrom( baseClassOrInterface )
+ : baseClassOrInterface.getName() + " cannot be assigned to " +
Interceptor.class.getName();
+
+ ClassLoader cl = DiscoveryUtils.getClassLoader();
+ String className = config.getInterceptorClass();
+
+ try
+ {
+ Class interceptorClass = cl.loadClass( className );
+
+ if ( ! baseClassOrInterface.isAssignableFrom( interceptorClass ) )
+ {
+ _log.error( "Interceptor " + interceptorClass.getName() + "
does not implement or extend "
+ + baseClassOrInterface.getName() );
+ return null;
+ }
+
+ Interceptor interceptor = ( Interceptor )
interceptorClass.newInstance();
+ interceptor.init( config );
+ return interceptor;
+ }
+ catch ( ClassNotFoundException e )
+ {
+ _log.error( "Could not find interceptor class " + className, e );
+ }
+ catch ( InstantiationException e )
+ {
+ _log.error( "Could not instantiate interceptor class " +
className, e );
+ }
+ catch ( IllegalAccessException e )
+ {
+ _log.error( "Could not instantiate interceptor class " +
className, e );
+ }
+
+ return null;
}
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java
Sun Feb 20 22:28:07 2005
@@ -18,92 +18,28 @@
package org.apache.beehive.netui.pageflow.interceptor;
-import org.apache.beehive.netui.util.DiscoveryUtils;
-import org.apache.beehive.netui.util.logging.Logger;
-
import java.util.List;
-import java.util.ArrayList;
-import java.util.Collection;
public class Interceptors
{
- private static final Logger _log = Logger.getInstance( Interceptors.class
);
-
public static void doPreIntercept( InterceptorContext context, List<
Interceptor > interceptors )
throws InterceptorException
{
- PreInvokeInterceptorChain chain = new PreInvokeInterceptorChain(
context, interceptors );
- chain.continueChain();
+ if ( interceptors != null )
+ {
+ PreInvokeInterceptorChain chain = new PreInvokeInterceptorChain(
context, interceptors );
+ chain.continueChain();
+ }
}
public static void doPostIntercept( InterceptorContext context, List<
Interceptor > interceptors )
throws InterceptorException
{
- PostInvokeInterceptorChain chain = new PostInvokeInterceptorChain(
context, interceptors );
- chain.continueChain();
- }
-
- /**
- * Instantiates an interceptor, based on the class name in the given
InterceptorConfig.
- *
- * @param config the InterceptorConfig used to determine the interceptor
class.
- * @param baseClassOrInterface the required base class or interface. May
be <code>null</code>.
- * @return an initialized Interceptor, or <code>null</code> if an error
occurred.
- */
- public static Interceptor createInterceptor( InterceptorConfig config,
Class baseClassOrInterface )
- {
- assert Interceptor.class.isAssignableFrom( baseClassOrInterface )
- : baseClassOrInterface.getName() + " cannot be assigned to " +
Interceptor.class.getName();
-
- ClassLoader cl = DiscoveryUtils.getClassLoader();
- String className = config.getInterceptorClass();
-
- try
- {
- Class interceptorClass = cl.loadClass( className );
-
- if ( ! baseClassOrInterface.isAssignableFrom( interceptorClass ) )
- {
- _log.error( "Interceptor " + interceptorClass.getName() + "
does not implement or extend "
- + baseClassOrInterface.getName() );
- return null;
- }
-
- Interceptor interceptor = ( Interceptor )
interceptorClass.newInstance();
- interceptor.init( config );
- return interceptor;
- }
- catch ( ClassNotFoundException e )
- {
- _log.error( "Could not find interceptor class " + className, e );
- }
- catch ( InstantiationException e )
- {
- _log.error( "Could not instantiate interceptor class " +
className, e );
- }
- catch ( IllegalAccessException e )
+ if ( interceptors != null )
{
- _log.error( "Could not instantiate interceptor class " +
className, e );
+ PostInvokeInterceptorChain chain = new PostInvokeInterceptorChain(
context, interceptors );
+ chain.continueChain();
}
-
- return null;
- }
-
- /**
- * Instantiates an interceptor, based on the class name in the given
InterceptorConfig, and adds it to the
- * given collection of interceptors.
- *
- * @param config the InterceptorConfig used to determine the interceptor
class.
- * @param baseClassOrInterface the required base class or interface. May
be <code>null</code>.
- * @param interceptors the List of interceptors to which to add.
- * @return an initialized Interceptor, or <code>null</code> if an error
occurred.
- */
- public static Interceptor addInterceptor( InterceptorConfig config, Class
baseClassOrInterface,
- List< Interceptor > interceptors
)
- {
- Interceptor interceptor = createInterceptor( config,
baseClassOrInterface );
- if ( interceptor != null ) interceptors.add( interceptor );
- return interceptor;
}
private static final class PreInvokeInterceptorChain
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java?view=diff&r1=154638&r2=154639
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java
Sun Feb 20 22:28:07 2005
@@ -17,13 +17,10 @@
*/
package org.apache.beehive.netui.pageflow.interceptor.action;
-import org.apache.beehive.netui.pageflow.interceptor.Interceptor;
import org.apache.beehive.netui.pageflow.interceptor.InterceptorChain;
import org.apache.beehive.netui.pageflow.interceptor.InterceptorException;
import org.apache.beehive.netui.pageflow.interceptor.InterceptorContext;
-import org.apache.beehive.netui.pageflow.interceptor.InterceptorConfig;
-
-import java.io.Serializable;
+import org.apache.beehive.netui.pageflow.interceptor.AbstractInterceptor;
/**
@@ -63,25 +60,8 @@
* It should not hold any per-request or per-session state.
*/
public abstract class ActionInterceptor
- implements Interceptor, Serializable
+ extends AbstractInterceptor
{
- private ActionInterceptorConfig _config;
-
- /**
- * Called when this interceptor is being initialized.
- *
- * @param config the configuration object associated with this interceptor.
- */
- public void init( ActionInterceptorConfig config )
- {
- _config = config;
- }
-
- public void init( InterceptorConfig config )
- {
- init( ( ActionInterceptorConfig ) config );
- }
-
public abstract void preAction( ActionInterceptorContext context,
InterceptorChain chain )
throws InterceptorException;
@@ -101,11 +81,6 @@
public abstract void afterNestedIntercept( AfterNestedInterceptContext
context )
throws InterceptorException;
- public ActionInterceptorConfig getConfig()
- {
- return _config;
- }
-
protected void setOverrideForward( InterceptorForward forward,
ActionInterceptorContext context )
{
context.setOverrideForward( forward, this );