01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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.FlowControllerInfo;
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.List;
30: import java.util.Iterator;
31:
32: public class TilesDefinitionsConfigsType extends WebappPathType {
33: public TilesDefinitionsConfigsType(String requiredRuntimeVersion,
34: AnnotationGrammar parentGrammar, FlowControllerInfo fcInfo) {
35: super (false, requiredRuntimeVersion, parentGrammar, fcInfo);
36: }
37:
38: public Object onCheck(AnnotationTypeElementDeclaration valueDecl,
39: AnnotationValue value,
40: AnnotationInstance[] parentAnnotations,
41: MemberDeclaration classMember, int annotationArrayIndex)
42: throws FatalCompileTimeException {
43: List values = (List) value.getValue();
44:
45: if (values != null) {
46: for (Iterator ii = values.iterator(); ii.hasNext();) {
47: AnnotationValue pathValue = (AnnotationValue) ii.next();
48:
49: if (pathValue != null) {
50: String filePath = (String) pathValue.getValue();
51: if (filePath == null || filePath.length() == 0
52: || filePath.charAt(0) != '/') {
53: addError(value,
54: "error.absolute-path-required-for-tiles-def");
55: }
56: }
57:
58: super .onCheck(valueDecl, pathValue, parentAnnotations,
59: classMember, annotationArrayIndex);
60: }
61: }
62:
63: return null;
64: }
65:
66: protected boolean checkAnyExtension() {
67: return true;
68: }
69: }
|