KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > compiler > grammar > ForwardToExternalPathType


1 /*
2  * B E A S Y S T E M S
3  * Copyright 2002-2004 BEA Systems, Inc.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * $Header:$
18  */

19 package org.apache.beehive.netui.compiler.grammar;
20
21 import org.apache.beehive.netui.compiler.AnnotationGrammar;
22 import org.apache.beehive.netui.compiler.AnnotationMemberType;
23 import org.apache.beehive.netui.compiler.FatalCompileTimeException;
24 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance;
25 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration;
26 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue;
27 import org.apache.beehive.netui.compiler.typesystem.declaration.MemberDeclaration;
28
29 import java.util.Collection JavaDoc;
30
31 public class ForwardToExternalPathType
32         extends DelegatingType
33 {
34     public ForwardToExternalPathType( AnnotationMemberType baseType, String JavaDoc requiredRuntimeVersion,
35                                       AnnotationGrammar parentGrammar )
36     {
37         super( baseType, requiredRuntimeVersion, parentGrammar );
38     }
39
40     
41     public Object JavaDoc onCheck( AnnotationTypeElementDeclaration valueDecl, AnnotationValue value,
42                            AnnotationInstance[] parentAnnotations, MemberDeclaration classMember,
43                            int annotationArrayIndex )
44         throws FatalCompileTimeException
45     {
46         String JavaDoc stringValue = ( String JavaDoc ) value.getValue();
47         
48         //
49
// If we're forwarding to an external page, print a warning about error messages on the destination page not
50
// having access to messages defined in the current page flow... *unless* the current page flow has no message
51
// resources defined.
52
//
53
if ( stringValue.indexOf( '/' ) != -1 )
54         {
55             BaseFlowControllerGrammar fcGrammar = ( BaseFlowControllerGrammar ) getParentGrammar();
56             Collection JavaDoc messageResources =
57                     fcGrammar.getFlowControllerInfo().getMergedControllerAnnotation().getMessageResources();
58             if ( messageResources != null && messageResources.size() > 0 )
59             {
60                 addWarning( value, "warning.exception-handler-forward-to-external-page", stringValue );
61             }
62         }
63         
64         return super.onCheck( valueDecl, value, parentAnnotations, classMember, annotationArrayIndex );
65     }
66 }
67
Popular Tags