You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by mr...@apache.org on 2005/09/14 18:21:05 UTC

svn commit: r280879 [9/16] - in /struts/sandbox/trunk/ti: ./ jars/compiler-apt/ jars/compiler-apt/src/ jars/compiler-apt/src/java/ jars/compiler-apt/src/java/org/ jars/compiler-apt/src/java/org/apache/ jars/compiler-apt/src/java/org/apache/ti/ jars/com...

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ControllerGrammar.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ControllerGrammar.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ControllerGrammar.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ControllerGrammar.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,62 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.Diagnostics;
+import org.apache.ti.compiler.internal.FlowControllerInfo;
+import org.apache.ti.compiler.internal.RuntimeVersionChecker;
+import org.apache.ti.compiler.internal.typesystem.env.AnnotationProcessorEnvironment;
+import org.apache.ti.schema.validator11.FormValidationDocument;
+
+
+public class ControllerGrammar
+        extends BaseFlowControllerGrammar {
+
+    public ControllerGrammar(AnnotationProcessorEnvironment env, Diagnostics diags, RuntimeVersionChecker rvc,
+                             FlowControllerInfo fcInfo) {
+        super(env, diags, null, rvc, fcInfo);
+
+        addMemberType(LOGIN_REQUIRED_ATTR, new AnnotationMemberType(null, this));
+        addMemberType(ROLES_ALLOWED_ATTR, new RolesAllowedType(this));
+        addMemberType(READONLY_ATTR, new AnnotationMemberType(null, this));
+        addMemberType(VALIDATOR_VERSION_ATTR, new AnnotationMemberType(null, this));
+        addMemberType(VALIDATOR_MERGE_ATTR, new ValidXmlFileType(FormValidationDocument.type, null, this, fcInfo));
+        addMemberType(TILES_DEFINITIONS_CONFIGS_ATTR, new TilesDefinitionsConfigsType(null, this, fcInfo));
+        addMemberType(MULTIPART_HANDLER_ATTR, new AnnotationMemberType(null, this));
+
+        addMemberArrayGrammar(SHARED_FLOW_REFS_ATTR, new SharedFlowRefGrammar(env, diags, rvc));
+        addMemberArrayGrammar(FORWARDS_ATTR, new ForwardGrammar(env, diags, null, rvc, fcInfo));
+        addMemberArrayGrammar(CATCHES_ATTR, new CatchGrammar(env, diags, null, rvc, CONTROLLER_TAG_NAME, fcInfo));
+        addMemberArrayGrammar(MESSAGE_BUNDLES_ATTR, new MessageBundleGrammar(env, diags, null, rvc, fcInfo));
+        addMemberArrayGrammar(VALIDATABLE_BEANS_ATTR, new ValidatableBeanGrammar(env, diags, rvc));
+        addMemberArrayGrammar(SIMPLE_ACTIONS_ATTR, new SimpleActionGrammar(env, diags, rvc, fcInfo));
+    }
+
+    public String[][] getMutuallyExclusiveAttrs() {
+        return null;
+    }
+
+    public String[][] getRequiredAttrs() {
+        return null;
+    }
+
+    public String[][] getAttrDependencies() {
+        return null;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/DelegatingType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/DelegatingType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/DelegatingType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/DelegatingType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,47 @@
+/*
+ * B E A   S Y S T E M S
+ * Copyright 2002-2004  BEA Systems, Inc.
+ *
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.FatalCompileTimeException;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+
+public class DelegatingType
+        extends AnnotationMemberType {
+
+    private AnnotationMemberType _baseType;
+
+    public DelegatingType(AnnotationMemberType baseType, String requiredRuntimeVersion,
+                          AnnotationGrammar parentGrammar) {
+        super(requiredRuntimeVersion, parentGrammar);
+        _baseType = baseType;
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex)
+            throws FatalCompileTimeException {
+        return _baseType.onCheck(valueDecl, member, parentAnnotations, classMember, annotationArrayIndex);
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/EnumType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/EnumType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/EnumType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/EnumType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,108 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.FatalCompileTimeException;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * Supports deprecated values and values that require particular runtime versions.
+ */
+public class EnumType
+        extends AnnotationMemberType {
+
+    /**
+     * map of enum-val (String) -> required-runtime-version (String, may be null)
+     */
+    private Map _enumRequiredRuntimeVersions = null;
+
+    /**
+     * Map of deprecated-value (String) -> error message key (String) *
+     */
+    private Map _deprecatedValues;
+
+
+    public EnumType(String[][] enumValues, String[][] deprecatedValues, String requiredRuntimeVersion,
+                    AnnotationGrammar parentGrammar) {
+        super(requiredRuntimeVersion, parentGrammar);
+
+        if (deprecatedValues != null) {
+            _deprecatedValues = new HashMap();
+
+            for (int i = 0; i < deprecatedValues.length; ++i) {
+                String[] valueAndDiagnostic = deprecatedValues[i];
+                assert valueAndDiagnostic.length == 2;
+                _deprecatedValues.put(valueAndDiagnostic[0], valueAndDiagnostic[1]);
+            }
+        }
+
+        if (enumValues != null) {
+            _enumRequiredRuntimeVersions = new HashMap();
+
+            for (int i = 0; i < enumValues.length; i++) {
+                String[] valueAndRequiredRuntimeVersion = enumValues[i];
+                assert valueAndRequiredRuntimeVersion.length == 2;
+                String enumValue = valueAndRequiredRuntimeVersion[0];
+                String enumValRequiredRuntimeVersion = valueAndRequiredRuntimeVersion[1];
+
+                if (enumValRequiredRuntimeVersion != null) {
+                    _enumRequiredRuntimeVersions.put(enumValue, enumValRequiredRuntimeVersion);
+                }
+            }
+        }
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex)
+            throws FatalCompileTimeException {
+        //
+        // Check deprecated values.
+        //
+        String val = CompilerUtils.getEnumFieldName(member);
+        String errorKey = _deprecatedValues != null ? (String) _deprecatedValues.get(val) : null;
+
+        if (errorKey != null) {
+            addWarning(member, errorKey, val);
+        }
+
+        //
+        // Check required runtime version for enum values.
+        //
+        String ver = _enumRequiredRuntimeVersions != null ? (String) _enumRequiredRuntimeVersions.get(val) : null;
+
+        if (ver != null) {
+            getParentGrammar().getRuntimeVersionChecker().checkRuntimeVersion(
+                    ver, member, getParentGrammar().getDiagnostics(), "error.required-runtime-version-enumval", null);
+        }
+
+        return super.onCheck(valueDecl, member, parentAnnotations, classMember, annotationArrayIndex);
+    }
+
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ExceptionHandlerGrammar.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ExceptionHandlerGrammar.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ExceptionHandlerGrammar.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ExceptionHandlerGrammar.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,84 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.Diagnostics;
+import org.apache.ti.compiler.internal.FatalCompileTimeException;
+import org.apache.ti.compiler.internal.FlowControllerInfo;
+import org.apache.ti.compiler.internal.RuntimeVersionChecker;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.MethodDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.Modifier;
+import org.apache.ti.compiler.internal.typesystem.declaration.TypeDeclaration;
+import org.apache.ti.compiler.internal.typesystem.env.AnnotationProcessorEnvironment;
+
+
+public class ExceptionHandlerGrammar
+        extends BaseFlowControllerGrammar {
+
+    public ExceptionHandlerGrammar(AnnotationProcessorEnvironment env, Diagnostics diags,
+                                   RuntimeVersionChecker runtimeVersionChecker, FlowControllerInfo fcInfo) {
+        super(env, diags, null, runtimeVersionChecker, fcInfo);
+
+        addMemberType(READONLY_ATTR, new AnnotationMemberType(VERSION_8_SP2_STRING, this));
+        addMemberArrayGrammar(FORWARDS_ATTR, new ExceptionHandlerForwardGrammar(fcInfo));
+    }
+
+    protected boolean onBeginCheck(AnnotationInstance annotation, AnnotationInstance[] parentAnnotations,
+                                   MemberDeclaration classMember)
+            throws FatalCompileTimeException {
+        if (classMember.hasModifier(Modifier.ABSTRACT)) {
+            addWarning(annotation, "warning.annotated-abstract-method", null);
+            return false;
+        }
+
+        TypeDeclaration outerType = CompilerUtils.getOuterClass(classMember);
+        String thisMethodName = classMember.getSimpleName();
+        MethodDeclaration[] classMethods = CompilerUtils.getClassMethods(outerType, EXCEPTION_HANDLER_TAG_NAME);
+
+        for (int i = 0; i < classMethods.length; i++) {
+            MethodDeclaration method = classMethods[i];
+
+            if (! method.equals(classMember) && method.getSimpleName().equals(thisMethodName)) {
+                addError(annotation, "error.duplicate-exception-handler");
+            }
+        }
+
+        return super.onBeginCheck(annotation, parentAnnotations, classMember);
+    }
+
+    private class ExceptionHandlerForwardGrammar
+            extends ForwardGrammar {
+
+        public ExceptionHandlerForwardGrammar(FlowControllerInfo fcInfo) {
+            super(ExceptionHandlerGrammar.this.getEnv(), ExceptionHandlerGrammar.this.getDiagnostics(),
+                    ExceptionHandlerGrammar.this.getRequiredRuntimeVersion(),
+                    ExceptionHandlerGrammar.this.getRuntimeVersionChecker(), fcInfo);
+            ExternalPathOrActionType baseType = new ExternalPathOrActionType(false, null, this, fcInfo);
+            addMemberType(PATH_ATTR, new ForwardToExternalPathType(baseType, null, ExceptionHandlerGrammar.this));
+        }
+
+        protected AnnotationMemberType getNameType() {
+            return new UniqueValueType(FORWARDS_ATTR, false, false, null, this);
+        }
+    }
+
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ExternalPathOrActionType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ExternalPathOrActionType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ExternalPathOrActionType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ExternalPathOrActionType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,50 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.FatalCompileTimeException;
+import org.apache.ti.compiler.internal.FlowControllerInfo;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+
+public class ExternalPathOrActionType extends WebappPathOrActionType {
+
+    public ExternalPathOrActionType(boolean pathMustBeRelative, String requiredRuntimeVersion,
+                                    AnnotationGrammar parentGrammar, FlowControllerInfo fcInfo) {
+        super(pathMustBeRelative, requiredRuntimeVersion, parentGrammar, fcInfo);
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue value,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex)
+            throws FatalCompileTimeException {
+        AnnotationInstance parentAnnotation = parentAnnotations[parentAnnotations.length - 1];
+
+        // if we have an external redirect just bail
+        if (CompilerUtils.getBoolean(parentAnnotation, EXTERNAL_REDIRECT_ATTR, false).booleanValue()) {
+            return null;
+        }
+
+        return super.onCheck(valueDecl, value, parentAnnotations, classMember, annotationArrayIndex);
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ForwardGrammar.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ForwardGrammar.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ForwardGrammar.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ForwardGrammar.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,225 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.Diagnostics;
+import org.apache.ti.compiler.internal.FlowControllerInfo;
+import org.apache.ti.compiler.internal.RuntimeVersionChecker;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.MethodDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.TypeDeclaration;
+import org.apache.ti.compiler.internal.typesystem.env.AnnotationProcessorEnvironment;
+import org.apache.ti.compiler.internal.typesystem.type.DeclaredType;
+import org.apache.ti.compiler.internal.typesystem.type.TypeInstance;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class ForwardGrammar
+        extends BaseFlowControllerGrammar {
+
+    private static final String[][] NAVIGATE_TO_VALS = new String[][]
+            {
+                    {NAVIGATE_TO_CURRENT_PAGE_STR, VERSION_8_SP2_STRING},
+                    {NAVIGATE_TO_PREVIOUS_PAGE_STR, VERSION_8_SP2_STRING},
+                    {NAVIGATE_TO_PREVIOUS_ACTION_STR, VERSION_8_SP2_STRING},
+            };
+
+    private static String[][] MUTUALLY_EXCLUSIVE_ATTRS =
+            {
+                    {PATH_ATTR, TILES_DEFINITION_ATTR, RETURN_ACTION_ATTR, NAVIGATE_TO_ATTR, ACTION_ATTR},
+                    {OUTPUT_FORM_BEAN_TYPE_ATTR, OUTPUT_FORM_BEAN_ATTR},
+                    {REDIRECT_ATTR, EXTERNAL_REDIRECT_ATTR}
+            };
+
+    private static String[][] REQUIRED_ATTRS =
+            {
+                    {NAME_ATTR},
+                    {PATH_ATTR, TILES_DEFINITION_ATTR, RETURN_ACTION_ATTR, NAVIGATE_TO_ATTR, ACTION_ATTR}
+            };
+
+    private static String[][] ATTR_DEPENDENCIES =
+            {
+                    {REDIRECT_ATTR, PATH_ATTR, NAVIGATE_TO_ATTR, ACTION_ATTR},
+                    {EXTERNAL_REDIRECT_ATTR, PATH_ATTR},
+                    {RESTORE_QUERY_STRING_ATTR, NAVIGATE_TO_ATTR}
+            };
+
+
+    public ForwardGrammar(AnnotationProcessorEnvironment env, Diagnostics diags, String requiredRuntimeVersion,
+                          RuntimeVersionChecker runtimeVersionChecker, FlowControllerInfo fcInfo) {
+        super(env, diags, requiredRuntimeVersion, runtimeVersionChecker, fcInfo);
+
+        addMemberType(NAME_ATTR, getNameType());
+        addMemberType(OUTPUT_FORM_BEAN_TYPE_ATTR, new TypeNameType(null, false, null, this));
+        addMemberType(OUTPUT_FORM_BEAN_ATTR, new MemberFieldType(null, null, this));
+        addMemberType(RETURN_ACTION_ATTR, new JavaIdentifierType(null, this, new char[]{'.'}));
+        addMemberType(PATH_ATTR, new ExternalPathOrActionType(false, null, this, fcInfo));
+        addMemberType(ACTION_ATTR, new ValidActionType(null, this, fcInfo));
+        addMemberType(TILES_DEFINITION_ATTR, new AnnotationMemberType(null, this));
+        addMemberType(REDIRECT_ATTR, new AnnotationMemberType(null, this));
+        addMemberType(EXTERNAL_REDIRECT_ATTR, new AbsolutePathType(null, this));
+        addMemberType(NAVIGATE_TO_ATTR, new EnumType(NAVIGATE_TO_VALS, null, null, this));
+        addMemberType(RESTORE_QUERY_STRING_ATTR, new AnnotationMemberType(null, this));
+
+        addMemberArrayGrammar(ACTION_OUTPUTS_ATTR, new ActionOutputGrammar(env, diags, runtimeVersionChecker));
+    }
+
+    protected AnnotationMemberType getNameType() {
+        return new ForwardNameType();
+    }
+
+    public String[][] getMutuallyExclusiveAttrs() {
+        return MUTUALLY_EXCLUSIVE_ATTRS;
+    }
+
+    public String[][] getRequiredAttrs() {
+        return REQUIRED_ATTRS;
+    }
+
+    public String[][] getAttrDependencies() {
+        return ATTR_DEPENDENCIES;
+    }
+
+    protected void onCheckMember(AnnotationTypeElementDeclaration memberDecl, AnnotationValue value,
+                                 AnnotationInstance annotation, AnnotationInstance[] parentAnnotations,
+                                 MemberDeclaration classMember) {
+        String valueName = memberDecl.getSimpleName();
+        boolean isReturnAction = valueName.equals(RETURN_ACTION_ATTR);
+
+        if (isReturnAction) {
+            if (! getFlowControllerInfo().isNested()) {
+                addError(value, "error.only-valid-in-nested", new Object[]{valueName});
+            }
+        }
+
+        if (valueName.equals(ACTION_OUTPUTS_ATTR) && ((List) value.getValue()).size() > 0) {
+            if (CompilerUtils.getBoolean(annotation, REDIRECT_ATTR, false).booleanValue()) {
+                addError(value, "error.action-outputs-with-redirect", REDIRECT_ATTR);
+            }
+
+            String path = CompilerUtils.getString(annotation, PATH_ATTR, true);
+            if (path != null && CompilerUtils.isAbsoluteURI(path)) {
+                addError(value, "error.action-outputs-with-absolute-uri", PATH_ATTR);
+            }
+        }
+
+        //
+        // If this is a return-action, store its info in the FlowControllerInfo (which is eventually provided to tools).
+        //
+        if (isReturnAction) {
+            TypeDeclaration outerType = CompilerUtils.getOuterClass(classMember);
+            TypeInstance formBeanType =
+                    getFlowControllerInfo().addReturnAction((String) value.getValue(), annotation, outerType);
+
+            if (formBeanType != null && ! (formBeanType instanceof DeclaredType)) {
+                addError(annotation, "error.action-invalid-form-bean-type", formBeanType.toString());
+            }
+        }
+    }
+
+    protected class ForwardNameType
+            extends UniqueValueType {
+
+        public ForwardNameType() {
+            this(FORWARDS_ATTR);
+        }
+
+        protected ForwardNameType(String memberGroupName) {
+            super(memberGroupName, false, false, null, ForwardGrammar.this);
+        }
+
+        /**
+         * @return a List of AnnotationInstance
+         */
+        protected List getAdditionalAnnotationsToCheck(MemberDeclaration classMember) {
+            //
+            // 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
+            // forwards that get rolled onto this entity.
+            //
+            List additionalEntities = new ArrayList();
+
+            TypeDeclaration outerType = CompilerUtils.getOuterClass(classMember);
+
+            Collection classLevelCatches =
+                    getFlowControllerInfo().getMergedControllerAnnotation().getCatches();
+            addAdditionalAnnotationsToCheck(classLevelCatches, outerType, additionalEntities);
+
+            if (classMember instanceof MethodDeclaration) {
+                Collection methodLevelCatches =
+                        CompilerUtils.getAnnotationArrayValue(classMember, ACTION_TAG_NAME, CATCHES_ATTR, true);
+                addAdditionalAnnotationsToCheck(methodLevelCatches, outerType, additionalEntities);
+            }
+
+            return additionalEntities;
+        }
+
+        private void addAdditionalAnnotationsToCheck(Collection catches,
+                                                     TypeDeclaration outerType, List additionalEntities) {
+            //
+            // For each of the given @Jpf.Catch annotations, find the matching @Jpf.ExceptionHandler method and
+            // add all of its @Jpf.Forward annotations to the list.
+            //
+            if (catches != null) {
+                for (Iterator ii = catches.iterator(); ii.hasNext();) {
+                    AnnotationInstance catchAnnotation = (AnnotationInstance) ii.next();
+                    String methodName = CompilerUtils.getString(catchAnnotation, METHOD_ATTR, false);
+
+                    if (methodName.length() > 0) {
+                        MethodDeclaration[] allMethods = CompilerUtils.getClassMethods(outerType, null);
+
+                        for (int i = 0; i < allMethods.length; i++) {
+                            MethodDeclaration method = allMethods[i];
+                            AnnotationInstance exHandlerAnnotation =
+                                    CompilerUtils.getAnnotation(method, EXCEPTION_HANDLER_TAG_NAME);
+
+                            if (exHandlerAnnotation != null && method.getSimpleName().equals(methodName)) {
+                                Collection forwardAnnotations =
+                                        CompilerUtils.getAnnotationArray(exHandlerAnnotation, FORWARDS_ATTR, false);
+
+                                for (Iterator i3 = forwardAnnotations.iterator(); i3.hasNext();) {
+                                    AnnotationInstance forwardAnnotation = (AnnotationInstance) i3.next();
+                                    additionalEntities.add(forwardAnnotation);
+                                }
+                            }
+                        }
+                    }
+
+                }
+            }
+        }
+
+        protected String getErrorMessageExtraInfo() {
+            return CATCH_TAG_NAME;
+        }
+
+
+        protected boolean allowExactDuplicates() {
+            return true;
+        }
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ForwardToExternalPathType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ForwardToExternalPathType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ForwardToExternalPathType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/ForwardToExternalPathType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,62 @@
+/*
+ * B E A   S Y S T E M S
+ * Copyright 2002-2004  BEA Systems, Inc.
+ *
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.FatalCompileTimeException;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+
+import java.util.Collection;
+
+public class ForwardToExternalPathType
+        extends DelegatingType {
+
+    public ForwardToExternalPathType(AnnotationMemberType baseType, String requiredRuntimeVersion,
+                                     AnnotationGrammar parentGrammar) {
+        super(baseType, requiredRuntimeVersion, parentGrammar);
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue value,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex)
+            throws FatalCompileTimeException {
+        String stringValue = (String) value.getValue();
+
+        //
+        // If we're forwarding to an external page, print a warning about error messages on the destination page not
+        // having access to messages defined in the current page flow... *unless* the current page flow has no message
+        // resources defined.
+        //
+        if (stringValue.indexOf('/') != -1) {
+            BaseFlowControllerGrammar fcGrammar = (BaseFlowControllerGrammar) getParentGrammar();
+            Collection messageResources =
+                    fcGrammar.getFlowControllerInfo().getMergedControllerAnnotation().getMessageResources();
+            if (messageResources != null && messageResources.size() > 0) {
+                addWarning(value, "warning.exception-handler-forward-to-external-page", stringValue);
+            }
+        }
+
+        return super.onCheck(valueDecl, value, parentAnnotations, classMember, annotationArrayIndex);
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/InvalidAttributeType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/InvalidAttributeType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/InvalidAttributeType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/InvalidAttributeType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,51 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.FatalCompileTimeException;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+
+/**
+ * Type that simply causes an error if present.
+ */
+public class InvalidAttributeType
+        extends AnnotationMemberType {
+
+    private String _errorKey;
+    private Object[] _errorArgs;
+
+    public InvalidAttributeType(String requiredRuntimeVersion, AnnotationGrammar parentGrammar, String errorKey,
+                                Object[] errorArgs) {
+        super(requiredRuntimeVersion, parentGrammar);
+        _errorKey = errorKey;
+        _errorArgs = errorArgs;
+    }
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex)
+            throws FatalCompileTimeException {
+        addError(member, _errorKey, _errorArgs);
+        return null;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/JavaIdentifierType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/JavaIdentifierType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/JavaIdentifierType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/JavaIdentifierType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,73 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+
+public class JavaIdentifierType
+        extends AnnotationMemberType {
+
+    private char[] _validChars;
+
+    public JavaIdentifierType(String requiredRuntimeVersion, AnnotationGrammar parentGrammar, char[] validChars) {
+        super(requiredRuntimeVersion, parentGrammar);
+        _validChars = validChars;
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue value,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex) {
+        String val = (String) value.getValue();
+
+        if (val.length() > 0) {
+            char firstChar = val.charAt(0);
+
+            if (! Character.isJavaIdentifierStart(firstChar)) {
+                Object[] args = new Object[]{new Character(firstChar)};
+                addError(value, "error.invalid-java-identifier-start", args);
+            }
+
+            for (int i = 1; i < val.length(); i++) {
+                char c = val.charAt(i);
+
+                if (! Character.isJavaIdentifierPart(val.charAt(i)) && ! isValid(c)) {
+                    Object[] args = new Object[]{new Character(c)};
+                    addError(value, "error.invalid-java-identifier-part", args);
+                }
+            }
+        }
+
+        return null;
+    }
+
+    private boolean isValid(char c) {
+        if (_validChars != null) {
+            for (int i = 0; i < _validChars.length; i++) {
+                if (c == _validChars[i]) return true;
+            }
+        }
+
+        return false;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/LocaleRulesGrammar.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/LocaleRulesGrammar.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/LocaleRulesGrammar.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/LocaleRulesGrammar.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,94 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.Diagnostics;
+import org.apache.ti.compiler.internal.JpfLanguageConstants;
+import org.apache.ti.compiler.internal.RuntimeVersionChecker;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.env.AnnotationProcessorEnvironment;
+
+
+public class LocaleRulesGrammar
+        extends ValidationRulesContainerGrammar
+        implements JpfLanguageConstants {
+
+    private static final String[][] REQUIRED_ATTRS =
+            {
+                    {APPLY_TO_UNHANDLED_LOCALES_ATTR, LANGUAGE_ATTR},
+            };
+
+    private static final String[][] ATTR_DEPENDENCIES =
+            {
+                    {COUNTRY_ATTR, LANGUAGE_ATTR},
+                    {VARIANT_ATTR, LANGUAGE_ATTR}
+            };
+
+    public LocaleRulesGrammar(AnnotationProcessorEnvironment env, Diagnostics diags,
+                              RuntimeVersionChecker rvc) {
+        super(env, diags, rvc);
+
+        addMemberType(LANGUAGE_ATTR, new AnnotationMemberType(null, this));
+        addMemberType(COUNTRY_ATTR, new AnnotationMemberType(null, this));
+        addMemberType(VARIANT_ATTR, new AnnotationMemberType(null, this));
+        addMemberType(APPLY_TO_UNHANDLED_LOCALES_ATTR, new ApplyToUnhandledLocalesType());
+    }
+
+    public String[][] getRequiredAttrs() {
+        return REQUIRED_ATTRS;
+    }
+
+    public String[][] getAttrDependencies() {
+        return ATTR_DEPENDENCIES;
+    }
+
+    private class ApplyToUnhandledLocalesType
+            extends AnnotationMemberType {
+
+        public ApplyToUnhandledLocalesType() {
+            super(null, LocaleRulesGrammar.this);
+        }
+
+
+        public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+                              AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                              int annotationArrayIndex) {
+            AnnotationInstance parentAnnotation = parentAnnotations[parentAnnotations.length - 1];
+            String language = CompilerUtils.getString(parentAnnotation, LANGUAGE_ATTR, true);
+
+            if (((Boolean) member.getValue()).booleanValue()) {
+                if (language != null) {
+                    addError(member, "error.incompatible-locale-annotations", LANGUAGE_ATTR,
+                            APPLY_TO_UNHANDLED_LOCALES_ATTR);
+                }
+            } else {
+                if (language == null || language.length() == 0) {
+                    addError(member, "error.missing-locale-annotations", LANGUAGE_ATTR,
+                            APPLY_TO_UNHANDLED_LOCALES_ATTR);
+                }
+            }
+
+            return null;
+        }
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MemberFieldType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MemberFieldType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MemberFieldType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MemberFieldType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.FieldDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.type.TypeInstance;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+
+public class MemberFieldType
+        extends AnnotationMemberType {
+
+    private String _requiredSuperclassName;
+
+
+    public MemberFieldType(String requiredSuperclassName, String requiredRuntimeVersion,
+                           AnnotationGrammar parentGrammar) {
+        super(requiredRuntimeVersion, parentGrammar);
+        _requiredSuperclassName = requiredSuperclassName;
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex) {
+        String fieldName = (String) member.getValue();
+        Collection fields =
+                CompilerUtils.getClassFields(CompilerUtils.getOuterClass(classMember));
+
+        for (Iterator ii = fields.iterator(); ii.hasNext();) {
+            FieldDeclaration field = (FieldDeclaration) ii.next();
+            if (field.getSimpleName().equals(fieldName)) {
+                TypeInstance fieldType = CompilerUtils.getGenericBoundsType(field.getType());
+
+                if (_requiredSuperclassName != null
+                        && ! CompilerUtils.isAssignableFrom(_requiredSuperclassName, fieldType, getEnv())) {
+                    addError(member, "error.wrong-field-type", new Object[]{fieldName, _requiredSuperclassName});
+                    return null;
+                }
+
+                return field;
+            }
+        }
+
+        addError(member, "error.unresolved-field", fieldName);
+        return null;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MemberMethodType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MemberMethodType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MemberMethodType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MemberMethodType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,93 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.MethodDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.TypeDeclaration;
+
+public class MemberMethodType
+        extends AnnotationMemberType {
+
+    private String _requiredMethodAnnotation;
+    private String _errorCode;
+
+    public MemberMethodType(String requiredMethodAnnotation, String errorCode, String requiredRuntimeVersion,
+                            AnnotationGrammar parentGrammar) {
+        super(requiredRuntimeVersion, parentGrammar);
+        _requiredMethodAnnotation = requiredMethodAnnotation;
+        _errorCode = errorCode;
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue value,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex) {
+        //
+        // Look through all the methods to see if there is one whose name matches the given value.
+        //
+        TypeDeclaration outerType = CompilerUtils.getOuterClass(classMember);
+        MethodDeclaration[] methods = CompilerUtils.getClassMethods(outerType, null);
+        String methodName = (String) value.getValue();
+
+        for (int i = 0; i < methods.length; i++) {
+            MethodDeclaration method = methods[i];
+
+            if (method.getSimpleName().equals(methodName)) {
+                if (_requiredMethodAnnotation == null
+                        || CompilerUtils.getAnnotation(method, _requiredMethodAnnotation) != null) {
+                    checkMethod(method, value, parentAnnotations, classMember);
+                    return method;
+                }
+            }
+        }
+
+        addError(value, _errorCode, methodName);
+        return null;
+    }
+
+    protected MethodDeclaration findMethod(String methodName, TypeDeclaration outerType) {
+        MethodDeclaration[] methods = CompilerUtils.getClassMethods(outerType, null);
+
+        for (int i = 0; i < methods.length; i++) {
+            MethodDeclaration method = methods[i];
+
+            if (method.getSimpleName().equals(methodName)) {
+                if (_requiredMethodAnnotation == null
+                        || CompilerUtils.getAnnotation(method, _requiredMethodAnnotation) != null) {
+                    return method;
+                }
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Derived classes can plug in here to do additional checks.
+     */
+    protected void checkMethod(MethodDeclaration method, AnnotationValue member, AnnotationInstance[] parentAnnotations,
+                               MemberDeclaration classMember) {
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MessageBundleGrammar.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MessageBundleGrammar.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MessageBundleGrammar.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MessageBundleGrammar.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,76 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.Diagnostics;
+import org.apache.ti.compiler.internal.FlowControllerInfo;
+import org.apache.ti.compiler.internal.RuntimeVersionChecker;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.env.AnnotationProcessorEnvironment;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+
+public class MessageBundleGrammar
+        extends BaseFlowControllerGrammar {
+
+    private static final String[][] REQUIRED_ATTRS = {{BUNDLE_PATH_ATTR}};
+
+
+    public MessageBundleGrammar(AnnotationProcessorEnvironment env, Diagnostics diags,
+                                String requiredRuntimeVersion, RuntimeVersionChecker runtimeVersionChecker,
+                                FlowControllerInfo fcInfo) {
+        super(env, diags, requiredRuntimeVersion, runtimeVersionChecker, fcInfo);
+
+        addMemberType(BUNDLE_PATH_ATTR,
+                new UniqueValueType(MESSAGE_BUNDLES_ATTR, false, false, null, this));
+        addMemberType(BUNDLE_NAME_ATTR, new UniqueValueType(MESSAGE_BUNDLES_ATTR, true, true, null, this));
+    }
+
+    public String[][] getRequiredAttrs() {
+        return REQUIRED_ATTRS;
+    }
+
+    protected Object onEndCheck(AnnotationInstance annotation, AnnotationInstance[] parentAnnotations,
+                                MemberDeclaration classMember, Map checkResults) {
+        String bundlePath = CompilerUtils.getString(annotation, BUNDLE_PATH_ATTR, false);
+        String bundleName = CompilerUtils.getString(annotation, BUNDLE_NAME_ATTR, false);
+
+        if (bundleName.length() == 0) {
+            AnnotationInstance immediateParent = parentAnnotations[parentAnnotations.length - 1];
+            List peerAnnotations =
+                    CompilerUtils.getAnnotationArray(immediateParent, MESSAGE_BUNDLES_ATTR, false);
+
+            for (Iterator ii = peerAnnotations.iterator(); ii.hasNext();) {
+                AnnotationInstance peerAnnotation = (AnnotationInstance) ii.next();
+                if (! CompilerUtils.annotationsAreEqual(annotation, peerAnnotation, false, getEnv())
+                        && CompilerUtils.getString(peerAnnotation, BUNDLE_NAME_ATTR, false).length() == 0) {
+                    addError(annotation, "error.multiple-default-message-resources", BUNDLE_NAME_ATTR);
+                }
+            }
+        }
+
+        getFlowControllerInfo().addMessageBundle(bundleName, bundlePath);
+
+        return null;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MessageKeyType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MessageKeyType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MessageKeyType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/MessageKeyType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,70 @@
+/*
+* 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+
+
+public class MessageKeyType
+        extends AnnotationMemberType {
+
+    public MessageKeyType(String requiredRuntimeVersion, AnnotationGrammar parentGrammar) {
+        super(requiredRuntimeVersion, parentGrammar);
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex) {
+        if (((String) member.getValue()).length() == 0) {
+            addError(member, "error.empty-string-not-allowed");
+        }
+        // We're not currently supporting generation of validation messages.
+        /*
+        //
+        // If there is a list of (generated) validation messages, and if the current message key isn't in it,
+        // output a warning.
+        //
+        TypeDeclaration outerType = CompilerUtils.getOutermostClass( classMember );
+        Collection validationMessages = 
+                CompilerUtils.getAnnotationArrayValue( outerType, CONTROLLER_TAG_NAME, VALIDATION_MESSAGES_ATTR, true );
+        
+        if ( validationMessages != null )
+        {
+            String value = ( String ) member.getValue();
+            
+            for ( java.util.Iterator ii = validationMessages.iterator(); ii.hasNext(); )  
+            {
+                AnnotationInstance validationMessage = ( AnnotationInstance ) ii.next();
+                String msgKey = CompilerUtils.getString( validationMessage, KEY_ATTR, true );
+                assert msgKey != null;
+                if ( value.equals( msgKey ) ) return null;  // ok, we found it.
+            }
+        
+            addWarning( member, "warning.missing-validation-message", VALIDATION_MESSAGE_TAG_NAME, value );
+        }
+        */
+
+        return null;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/RaiseActionGrammar.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/RaiseActionGrammar.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/RaiseActionGrammar.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/RaiseActionGrammar.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,75 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.Diagnostics;
+import org.apache.ti.compiler.internal.FlowControllerInfo;
+import org.apache.ti.compiler.internal.RuntimeVersionChecker;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.ClassDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.env.AnnotationProcessorEnvironment;
+
+
+public class RaiseActionGrammar
+        extends BaseFlowControllerGrammar {
+
+    private static final String[][] REQUIRED_ATTRS = {{ACTION_ATTR}};
+
+    public RaiseActionGrammar(AnnotationProcessorEnvironment env, Diagnostics diags, String requiredRuntimeVersion,
+                              RuntimeVersionChecker runtimeVersionChecker, ClassDeclaration jpfClass,
+                              FlowControllerInfo fcInfo) {
+        super(env, diags, requiredRuntimeVersion, runtimeVersionChecker, fcInfo);
+        addMemberType(ACTION_ATTR, new PageFlowActionType(jpfClass));
+        addMemberType(OUTPUT_FORM_BEAN_ATTR, new MemberFieldType(null, null, this));
+    }
+
+    private class PageFlowActionType
+            extends AnnotationMemberType {
+
+        private ClassDeclaration _jpfClass;
+
+        public PageFlowActionType(ClassDeclaration jpfClass) {
+            super(RaiseActionGrammar.this.getRequiredRuntimeVersion(), RaiseActionGrammar.this);
+            _jpfClass = jpfClass;
+        }
+
+
+        public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+                              AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                              int annotationArrayIndex) {
+            String action = (String) member.getValue();
+
+            if (_jpfClass != null
+                    && ! WebappPathOrActionType.actionExists(action, _jpfClass, null, getEnv(), getFlowControllerInfo(), true)) {
+                getDiagnostics().addWarning(member, "warning.no-such-action", action,
+                        CompilerUtils.getSourceFile(_jpfClass, true));
+            }
+
+            return null;
+        }
+    }
+
+    public String[][] getRequiredAttrs() {
+        return REQUIRED_ATTRS;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/RolesAllowedType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/RolesAllowedType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/RolesAllowedType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/RolesAllowedType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,52 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+
+
+/**
+ * String type that ensures a peer loginRequired attribute is not set to false.
+ */
+public class RolesAllowedType
+        extends AnnotationMemberType {
+
+    public RolesAllowedType(AnnotationGrammar parentGrammar) {
+        super(null, parentGrammar);
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex) {
+        AnnotationInstance parentAnnotation = parentAnnotations[parentAnnotations.length - 1];
+        Boolean loginRequired = CompilerUtils.getBoolean(parentAnnotation, LOGIN_REQUIRED_ATTR, true);
+
+        if (loginRequired != null && ! loginRequired.booleanValue()) {
+            addError(member, "error.roles-with-no-login-required");
+        }
+
+        return null;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/SharedFlowRefGrammar.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/SharedFlowRefGrammar.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/SharedFlowRefGrammar.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/SharedFlowRefGrammar.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,58 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.Diagnostics;
+import org.apache.ti.compiler.internal.FatalCompileTimeException;
+import org.apache.ti.compiler.internal.RuntimeVersionChecker;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.TypeDeclaration;
+import org.apache.ti.compiler.internal.typesystem.env.AnnotationProcessorEnvironment;
+
+public class SharedFlowRefGrammar
+        extends AnnotationGrammar {
+
+    private static final String[][] REQUIRED_ATTRS = {{NAME_ATTR}, {TYPE_ATTR}};
+
+    public SharedFlowRefGrammar(AnnotationProcessorEnvironment env, Diagnostics diags, RuntimeVersionChecker rvc) {
+        super(env, diags, null, rvc);
+
+        // NAME_ATTR does not need a custom type
+        addMemberType(TYPE_ATTR, new TypeNameType(SHARED_FLOW_BASE_CLASS, false, null, this));
+    }
+
+    protected boolean onBeginCheck(AnnotationInstance annotation, AnnotationInstance[] parentAnnotations,
+                                   MemberDeclaration classMember)
+            throws FatalCompileTimeException {
+        assert classMember instanceof TypeDeclaration : classMember.getClass().getName();   // enforced in Jpf.java
+
+        if (! CompilerUtils.isAssignableFrom(JPF_BASE_CLASS, (TypeDeclaration) classMember, getEnv())) {
+            addError(annotation, "error.annotation-invalid-base-class", SHARED_FLOW_REF_TAG_NAME, JPF_BASE_CLASS);
+            return false;
+        }
+
+        return super.onBeginCheck(annotation, parentAnnotations, classMember);
+    }
+
+    public String[][] getRequiredAttrs() {
+        return REQUIRED_ATTRS;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/SimpleActionGrammar.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/SimpleActionGrammar.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/SimpleActionGrammar.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/SimpleActionGrammar.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,182 @@
+/*
+* 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.Diagnostics;
+import org.apache.ti.compiler.internal.FatalCompileTimeException;
+import org.apache.ti.compiler.internal.FlowControllerInfo;
+import org.apache.ti.compiler.internal.RuntimeVersionChecker;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.TypeDeclaration;
+import org.apache.ti.compiler.internal.typesystem.env.AnnotationProcessorEnvironment;
+import org.apache.ti.compiler.internal.typesystem.type.TypeInstance;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+
+public class SimpleActionGrammar
+        extends ActionGrammar {
+
+    private static String[][] REQUIRED_ATTRS =
+            {
+                    {NAME_ATTR},
+                    {PATH_ATTR, TILES_DEFINITION_ATTR, RETURN_ACTION_ATTR, NAVIGATE_TO_ATTR, FORWARD_REF_ATTR, ACTION_ATTR}
+            };
+
+    private static String[][] MUTUALLY_EXCLUSIVE_ATTRS =
+            {
+                    {USE_FORM_BEAN_ATTR, USE_FORM_BEAN_TYPE_ATTR}
+            };
+
+
+    private ForwardGrammar _forwardGrammar;
+
+
+    public SimpleActionGrammar(AnnotationProcessorEnvironment env, Diagnostics diags, RuntimeVersionChecker rvc,
+                               FlowControllerInfo fcInfo) {
+        super(env, diags, rvc, fcInfo);
+
+        addMemberType(FORWARD_REF_ATTR, new ForwardRefType());
+        addMemberArrayGrammar(CONDITIONAL_FORWARDS_ATTR,
+                new SimpleActionForwardGrammar(env, diags, null, rvc, fcInfo));
+
+        //
+        // The rest of the attributes are checked by ForwardGrammar.
+        //
+        _forwardGrammar = new SimpleActionGrammarPart2();
+    }
+
+    public String[][] getMutuallyExclusiveAttrs() {
+        return MUTUALLY_EXCLUSIVE_ATTRS;
+    }
+
+    protected boolean onBeginCheck(AnnotationInstance annotation, AnnotationInstance[] parentAnnotations,
+                                   MemberDeclaration classMember)
+            throws FatalCompileTimeException {
+        String name = CompilerUtils.getString(annotation, NAME_ATTR, false);
+
+        TypeDeclaration outerClass = CompilerUtils.getOuterClass(classMember);
+        if (WebappPathOrActionType.actionExists(name, outerClass, annotation, getEnv(), getFlowControllerInfo(), false)) {
+            if (! UniqueValueType.alreadyAddedErrorForValue(classMember, annotation, name, getEnv())) {
+                addError(annotation, "error.duplicate-action", new Object[]{name});
+            }
+        }
+
+        //
+        // A simple action is really like a combination of an action and a forward.  We extend ActionGrammar and
+        // then delegate to a ForwardGrammar here.
+        //
+        _forwardGrammar.check(annotation, parentAnnotations, classMember);
+
+        return super.onBeginCheck(annotation, parentAnnotations, classMember);
+    }
+
+    protected String getActionName(AnnotationInstance annotation, MemberDeclaration classMember) {
+        return CompilerUtils.getString(annotation, NAME_ATTR, false);
+    }
+
+    protected TypeInstance getFormBeanType(AnnotationInstance annotation, MemberDeclaration classMember) {
+        // for a SimpleAction, the form bean type is wholly defined by the useFormBean attribute.
+        return getUseFormBeanType(annotation, classMember);
+    }
+
+    private static class SimpleActionForwardGrammar
+            extends ForwardGrammar {
+
+        private static String[][] REQUIRED_SIMPLEACTION_ATTRS =
+                {
+                        {CONDITION_ATTR},
+                        {PATH_ATTR, TILES_DEFINITION_ATTR, RETURN_ACTION_ATTR, NAVIGATE_TO_ATTR, ACTION_ATTR}
+                };
+
+        public SimpleActionForwardGrammar(AnnotationProcessorEnvironment env, Diagnostics diags,
+                                          String requiredRuntimeVersion, RuntimeVersionChecker runtimeVersionChecker,
+                                          FlowControllerInfo fcInfo) {
+            super(env, diags, requiredRuntimeVersion, runtimeVersionChecker, fcInfo);
+        }
+
+        public String[][] getRequiredAttrs() {
+            return REQUIRED_SIMPLEACTION_ATTRS;
+        }
+
+        protected AnnotationMemberType getNameType() {
+            return new SimpleActionForwardNameType();
+        }
+
+        private class SimpleActionForwardNameType
+                extends ForwardNameType {
+
+            public SimpleActionForwardNameType() {
+                super(CONDITIONAL_FORWARDS_ATTR);
+            }
+        }
+    }
+
+    private class ForwardRefType
+            extends AnnotationMemberType {
+
+        public ForwardRefType() {
+            super(null, SimpleActionGrammar.this);
+        }
+
+
+        public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+                              AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                              int annotationArrayIndex) {
+            Collection forwards =
+                    getFlowControllerInfo().getMergedControllerAnnotation().getForwards();
+            String forwardName = (String) member.getValue();
+
+            for (Iterator ii = forwards.iterator(); ii.hasNext();) {
+                AnnotationInstance forwardAnn = (AnnotationInstance) ii.next();
+                if (forwardName.equals(CompilerUtils.getString(forwardAnn, NAME_ATTR, true))) return null;
+            }
+
+            // TODO: comment
+            if (forwardName.equals("_auto")) return null;
+
+            addError(member, "error.unresolvable-global-forward", forwardName);
+            return null;
+        }
+    }
+
+    private class SimpleActionGrammarPart2
+            extends ForwardGrammar {
+
+        public SimpleActionGrammarPart2() {
+            super(SimpleActionGrammar.this.getEnv(), SimpleActionGrammar.this.getDiagnostics(), null,
+                    SimpleActionGrammar.this.getRuntimeVersionChecker(),
+                    SimpleActionGrammar.this.getFlowControllerInfo());
+        }
+
+        protected AnnotationMemberType getNameType() {
+            // We don't want to use the normal name type, which checks for duplicate names among *forwards*.
+            return new AnnotationMemberType(null, SimpleActionGrammar.this);
+        }
+
+        public String[][] getRequiredAttrs() {
+            return REQUIRED_ATTRS;
+        }
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/TilesDefinitionsConfigsType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/TilesDefinitionsConfigsType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/TilesDefinitionsConfigsType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/TilesDefinitionsConfigsType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,66 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.FatalCompileTimeException;
+import org.apache.ti.compiler.internal.FlowControllerInfo;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+
+import java.util.Iterator;
+import java.util.List;
+
+public class TilesDefinitionsConfigsType extends WebappPathType {
+
+    public TilesDefinitionsConfigsType(String requiredRuntimeVersion, AnnotationGrammar parentGrammar,
+                                       FlowControllerInfo fcInfo) {
+        super(false, requiredRuntimeVersion, parentGrammar, fcInfo);
+    }
+
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue value,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex)
+            throws FatalCompileTimeException {
+        List values = (List) value.getValue();
+
+        if (values != null) {
+            for (Iterator ii = values.iterator(); ii.hasNext();) {
+                AnnotationValue pathValue = (AnnotationValue) ii.next();
+
+                if (pathValue != null) {
+                    String filePath = (String) pathValue.getValue();
+                    if (filePath == null || filePath.length() == 0 || filePath.charAt(0) != '/') {
+                        addError(value, "error.absolute-path-required-for-tiles-def");
+                    }
+                }
+
+                super.onCheck(valueDecl, pathValue, parentAnnotations, classMember, annotationArrayIndex);
+            }
+        }
+
+        return null;
+    }
+
+    protected boolean checkAnyExtension() {
+        return true;
+    }
+}

Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/TypeNameType.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/TypeNameType.java?rev=280879&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/TypeNameType.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/compiler/internal/grammar/TypeNameType.java Wed Sep 14 09:20:05 2005
@@ -0,0 +1,97 @@
+/*
+ * 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.ti.compiler.internal.grammar;
+
+import org.apache.ti.compiler.internal.AnnotationGrammar;
+import org.apache.ti.compiler.internal.AnnotationMemberType;
+import org.apache.ti.compiler.internal.CompilerUtils;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationInstance;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.ti.compiler.internal.typesystem.declaration.AnnotationValue;
+import org.apache.ti.compiler.internal.typesystem.declaration.MemberDeclaration;
+import org.apache.ti.compiler.internal.typesystem.type.ArrayType;
+import org.apache.ti.compiler.internal.typesystem.type.PrimitiveType;
+import org.apache.ti.compiler.internal.typesystem.type.ReferenceType;
+import org.apache.ti.compiler.internal.typesystem.type.VoidType;
+
+public class TypeNameType
+        extends AnnotationMemberType {
+
+    private String _requiredSuperclassName;
+    private boolean _allowArrayType;
+
+
+    public TypeNameType(String requiredSuperclassName, boolean allowArrayType, String requiredRuntimeVersion,
+                        AnnotationGrammar parentGrammar) {
+        super(requiredRuntimeVersion, parentGrammar);
+        _requiredSuperclassName = requiredSuperclassName;
+        _allowArrayType = allowArrayType;
+    }
+
+    /**
+     * @return the fully-qualified type (ClassDeclaration)
+     */
+
+    public Object onCheck(AnnotationTypeElementDeclaration valueDecl, AnnotationValue value,
+                          AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
+                          int annotationArrayIndex) {
+        Object val = value.getValue();
+
+        if (CompilerUtils.isErrorString(val)) {
+            // This means that there is already an error related to the type itself.
+            return null;
+        }
+
+        if (val instanceof PrimitiveType) {
+            addError(value, "error.primitive-type-not-allowed");
+            return null;
+        } else if (val instanceof VoidType) {
+            addError(value, "error.void-type-not-allowed");
+            return null;
+        }
+
+        if (val instanceof String) {
+            assert CompilerUtils.isErrorString(val) : val;
+            return null;
+        }
+
+        assert val instanceof ReferenceType : val.getClass().getName();
+        ReferenceType type = (ReferenceType) val;
+
+        if (! _allowArrayType && type instanceof ArrayType) {
+            addError(value, "error.array-type-not-allowed");
+            return null;
+        }
+
+        if (_requiredSuperclassName != null) {
+            if (! CompilerUtils.isAssignableFrom(_requiredSuperclassName, type, getEnv())) {
+                addError(value, "error.does-not-extend-base", new Object[]{_requiredSuperclassName});
+                return null;
+            }
+        }
+
+        checkType(type, value);
+        return type;
+    }
+
+    /**
+     * Derived classes can plug in here to do further checks on the type.
+     */
+    protected void checkType(ReferenceType type, AnnotationValue member) {
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org