01: /*
02: * Copyright 2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.apache.myfaces.application;
17:
18: import org.apache.commons.logging.Log;
19: import org.apache.commons.logging.LogFactory;
20:
21: import javax.faces.application.Application;
22: import javax.faces.application.ApplicationFactory;
23:
24: /**
25: * @author Manfred Geiler (latest modification by $Author: matzew $)
26: * @author Thomas Spiegl
27: * @version $Revision: 510434 $ $Date: 2007-02-22 08:45:11 +0100 (Do, 22 Feb 2007) $
28: */
29: public class ApplicationFactoryImpl extends ApplicationFactory {
30: private static final Log log = LogFactory
31: .getLog(ApplicationFactoryImpl.class);
32:
33: /**
34: * Application is thread-safe (see Application javadoc)
35: * "Application represents a per-web-application singleton object..."
36: * FactoryFinder has a ClassLoader-Factory Map. Since each webapp has it's
37: * own ClassLoader, each webapp will have it's own private factory instances.
38: */
39: private Application _application;
40:
41: public ApplicationFactoryImpl() {
42: _application = new ApplicationImpl();
43: if (log.isTraceEnabled())
44: log.trace("New ApplicationFactory instance created");
45: }
46:
47: public Application getApplication() {
48: return _application;
49: }
50:
51: public void setApplication(Application application) {
52: if (application == null) {
53: throw new NullPointerException(
54: "Cannot set a null application in the ApplicationFactory");
55: }
56: _application = application;
57: }
58:
59: }
|