1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 package org.apache.myfaces.orchestra.viewController;
21
22 /**
23 * A {@link ViewControllerManager} implementation which uses
24 * annotations on backing beans to determine the beans responsible for a given view and execute
25 * the appropriate annotated methods.
26 *
27 * <p>When using Spring, every bean declaration in the spring config files is checked to see if the
28 * referenced class has annotations, and if so that information is cached. Here, that information is
29 * then used to locate a bean which has a ViewController annotation that references the current view.</p>
30 *
31 * <p>See also org.apache.myfaces.orchestra.viewController.annotations.*.</p>
32 *
33 * @see ViewControllerManager
34 */
35
36 // TODO: add a feature to the core that allows (view, beanname) pairs to be added to a list
37 // held by a normal ViewController. A ViewController annotation is then just one of the
38 // ways in which a bean's name can be added to the list. Maybe also add a map of (event->Method)
39 // that can be added, so that method annotations are then just another way of configuring these
40 // method mappings? Watch out for environments that allow hot-deploy/replace though!
41 //
42 // TODO: how can this be configured by an application?
43 public class PlainAnnotationsViewControllerManager extends AbstractAnnotationsViewControllerManager
44 {
45 private ViewControllerNameMapper viewControllerNameMapper;
46 private ViewControllerExecutor viewControllerExecutor;
47
48 public PlainAnnotationsViewControllerManager()
49 {
50 }
51
52 public void initManager()
53 {
54 viewControllerNameMapper = new AnnotationsViewControllerNameMapper(getAnnotationInfoManager());
55 viewControllerExecutor = new AnnotationsViewControllerExecutor(getAnnotationInfoManager());
56 }
57
58 protected ViewControllerNameMapper getViewControllerNameMapper()
59 {
60 return viewControllerNameMapper;
61 }
62
63 protected ViewControllerExecutor getViewControllerExecutor()
64 {
65 return viewControllerExecutor;
66 }
67 }