001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License version 2
011: * as published by the Free Software Foundation.
012: *
013: * Resin Open Source is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
016: * of NON-INFRINGEMENT. See the GNU General Public License for more
017: * details.
018: *
019: * You should have received a copy of the GNU General Public License
020: * along with Resin Open Source; if not, write to the
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package com.caucho.jsf.cfg;
030:
031: import com.caucho.config.program.ConfigProgram;
032: import java.util.*;
033:
034: import javax.annotation.*;
035:
036: import javax.faces.application.*;
037: import javax.faces.event.*;
038:
039: import javax.xml.bind.annotation.*;
040:
041: public class FacesConfig {
042: private String _id;
043:
044: private String _version;
045:
046: private ApplicationConfig _application;
047:
048: private FactoryConfig _factory;
049:
050: private ArrayList<ComponentConfig> _componentList = new ArrayList<ComponentConfig>();
051:
052: private ArrayList<ConverterConfig> _converterList = new ArrayList<ConverterConfig>();
053:
054: private ArrayList<LifecycleConfig> _lifecycleList = new ArrayList<LifecycleConfig>();
055:
056: private ArrayList<ValidatorConfig> _validatorList = new ArrayList<ValidatorConfig>();
057:
058: private ArrayList<ReferencedBeanConfig> _referencedBeanList = new ArrayList<ReferencedBeanConfig>();
059:
060: private ArrayList<RenderKitConfig> _renderKitList = new ArrayList<RenderKitConfig>();
061:
062: private ArrayList<ManagedBeanConfig> _managedBeanList = new ArrayList<ManagedBeanConfig>();
063:
064: private List<NavigationRule> _navigationRuleList = new ArrayList<NavigationRule>();
065:
066: public void setId(String id) {
067: }
068:
069: @XmlAttribute(name="schemaLocation")
070: public void setSchemaLocation(String location) {
071: }
072:
073: public String getSchemaLocation() {
074: return null;
075: }
076:
077: public void setVersion(String version) {
078: }
079:
080: @XmlElement(name="faces-config-extension")
081: public void setFacesConfigExtension(ConfigProgram program) {
082: }
083:
084: public void addManagedBean(ManagedBeanConfig managedBean) {
085: _managedBeanList.add(managedBean);
086: }
087:
088: public ArrayList<ManagedBeanConfig> getManagedBeans() {
089: return _managedBeanList;
090: }
091:
092: public void addComponent(ComponentConfig component) {
093: _componentList.add(component);
094: }
095:
096: public void addReferencedBean(ReferencedBeanConfig referencedBean) {
097: _referencedBeanList.add(referencedBean);
098: }
099:
100: public void addConverter(ConverterConfig converter) {
101: _converterList.add(converter);
102: }
103:
104: public void addLifecycle(LifecycleConfig lifecycle) {
105: _lifecycleList.add(lifecycle);
106: }
107:
108: public void addValidator(ValidatorConfig validator) {
109: _validatorList.add(validator);
110: }
111:
112: public void addRenderKit(RenderKitConfig renderKit) {
113: _renderKitList.add(renderKit);
114: }
115:
116: public ApplicationConfig getApplication() {
117: return _application;
118: }
119:
120: public void setApplication(ApplicationConfig app) {
121: _application = app;
122: }
123:
124: public void setFactory(FactoryConfig factory) {
125: _factory = factory;
126: }
127:
128: public void addNavigationRule(NavigationRule rule) {
129: _navigationRuleList.add(rule);
130: }
131:
132: public List<NavigationRule> getNavigationRules() {
133: return _navigationRuleList;
134: }
135:
136: @PostConstruct
137: public void init() {
138: if (_factory != null)
139: _factory.init();
140: }
141:
142: public void configure(Application app) {
143: for (int i = 0; i < _componentList.size(); i++)
144: _componentList.get(i).configure(app);
145:
146: for (int i = 0; i < _converterList.size(); i++)
147: _converterList.get(i).configure(app);
148:
149: for (int i = 0; i < _validatorList.size(); i++)
150: _validatorList.get(i).configure(app);
151:
152: for (int i = 0; i < _renderKitList.size(); i++)
153: _renderKitList.get(i).configure();
154: }
155:
156: public void configurePhaseListeners(ArrayList<PhaseListener> list) {
157: for (int i = 0; i < _lifecycleList.size(); i++)
158: _lifecycleList.get(i).configurePhaseListeners(list);
159: }
160: }
|