001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: * $Header:$
018: */
019: package org.apache.beehive.netui.compiler.apt;
020:
021: import org.apache.beehive.netui.compiler.JpfLanguageConstants;
022: import org.apache.beehive.netui.compiler.processor.PageFlowCoreAnnotationProcessor;
023: import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration;
024: import org.apache.beehive.netui.compiler.typesystem.env.CoreAnnotationProcessor;
025: import org.apache.beehive.netui.compiler.typesystem.env.CoreAnnotationProcessorEnv;
026:
027: import java.util.ArrayList;
028: import java.util.Collection;
029: import java.util.Collections;
030: import java.util.HashSet;
031:
032: public class PageFlowAnnotationProcessorFactory extends
033: BaseAnnotationProcessorFactory implements JpfLanguageConstants {
034: private static final HashSet PAGEFLOW_ANNOTATIONS = new HashSet();
035: private static final HashSet FACES_BACKING_ANNOTATIONS = new HashSet();
036:
037: private static final ArrayList SUPPORTED_ANNOTATION_TYPES = new ArrayList();
038:
039: static {
040: PAGEFLOW_ANNOTATIONS
041: .add(ANNOTATION_QUALIFIER + ACTION_TAG_NAME);
042: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
043: + ACTION_OUTPUT_TAG_NAME);
044: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER + CATCH_TAG_NAME);
045: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
046: + CONDITIONAL_FORWARD_TAG_NAME);
047: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
048: + CONTROLLER_TAG_NAME);
049: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
050: + EXCEPTION_HANDLER_TAG_NAME);
051: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
052: + FORM_BEAN_TAG_NAME);
053: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
054: + FORWARD_TAG_NAME);
055: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
056: + MESSAGE_ARG_TAG_NAME);
057: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
058: + MESSAGE_BUNDLE_TAG_NAME);
059: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
060: + SIMPLE_ACTION_TAG_NAME);
061: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
062: + VALIDATABLE_BEAN_TAG_NAME);
063: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
064: + VALIDATABLE_PROPERTY_TAG_NAME);
065: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
066: + VALIDATE_CREDIT_CARD_TAG_NAME);
067: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
068: + VALIDATE_CUSTOM_RULE_TAG_NAME);
069: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
070: + VALIDATE_CUSTOM_VARIABLE_TAG_NAME);
071: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
072: + VALIDATE_DATE_TAG_NAME);
073: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
074: + VALIDATE_EMAIL_TAG_NAME);
075: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
076: + VALIDATE_MASK_TAG_NAME);
077: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
078: + VALIDATE_MAX_LENGTH_TAG_NAME);
079: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
080: + VALIDATE_MIN_LENGTH_TAG_NAME);
081: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
082: + VALIDATE_RANGE_TAG_NAME);
083: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
084: + VALIDATE_REQUIRED_TAG_NAME);
085: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
086: + VALIDATE_TYPE_TAG_NAME);
087: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
088: + VALIDATE_VALID_WHEN_TAG_NAME);
089: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
090: + VALIDATE_URL_TAG_NAME);
091: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
092: + VALIDATION_LOCALE_RULES_TAG_NAME);
093: PAGEFLOW_ANNOTATIONS.add(ANNOTATION_QUALIFIER
094: + VIEW_PROPERTIES_TAG_NAME);
095:
096: FACES_BACKING_ANNOTATIONS.add(ANNOTATION_QUALIFIER
097: + COMMAND_HANDLER_TAG_NAME);
098: FACES_BACKING_ANNOTATIONS.add(ANNOTATION_QUALIFIER
099: + FACES_BACKING_TAG_NAME);
100: FACES_BACKING_ANNOTATIONS.add(ANNOTATION_QUALIFIER
101: + PAGE_FLOW_FIELD_TAG_NAME);
102: FACES_BACKING_ANNOTATIONS.add(ANNOTATION_QUALIFIER
103: + RAISE_ACTION_TAG_NAME);
104:
105: SUPPORTED_ANNOTATION_TYPES.addAll(PAGEFLOW_ANNOTATIONS);
106: SUPPORTED_ANNOTATION_TYPES.addAll(FACES_BACKING_ANNOTATIONS);
107: SUPPORTED_ANNOTATION_TYPES.add(ANNOTATION_QUALIFIER
108: + SHARED_FLOW_FIELD_TAG_NAME);
109: SUPPORTED_ANNOTATION_TYPES.add(ANNOTATION_QUALIFIER
110: + SHARED_FLOW_REF_TAG_NAME);
111: }
112:
113: public Collection supportedAnnotationTypes() {
114: return SUPPORTED_ANNOTATION_TYPES;
115: }
116:
117: public Collection supportedOptions() {
118: return Collections.EMPTY_LIST;
119: }
120:
121: /**
122: * Get the core annotation processor which is appropriate for the given annotations. Note that this is "our"
123: * annotation processor, not a Sun apt annotation processor. See
124: * {@link BaseAnnotationProcessorFactory#getProcessorFor} for the place where a Sun annotation processor is returned.
125: */
126: public CoreAnnotationProcessor getCoreProcessorFor(
127: AnnotationTypeDeclaration[] atds,
128: CoreAnnotationProcessorEnv env) {
129: return new PageFlowCoreAnnotationProcessor(atds, env);
130: }
131: }
|