2009/05/20 - Apache Shale has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shale.test.mock;
19
20 import javax.faces.FacesException;
21 import javax.faces.application.Application;
22 import javax.faces.application.ApplicationFactory;
23
24 /***
25 * <p>Mock implementation of <code>ApplicationFactory</code>.</p>
26 *
27 * $Id$
28 */
29
30 public class MockApplicationFactory extends ApplicationFactory {
31
32
33
34
35
36 /***
37 * <p>Construct a default instance.</p>
38 */
39 public MockApplicationFactory() {
40
41 }
42
43
44
45
46
47
48
49
50 /***
51 * <p>The <code>Application</code> instance to be returned by
52 * this factory.</p>
53 */
54 private Application application = null;
55
56
57
58
59
60 /*** {@inheritDoc} */
61 public Application getApplication() {
62
63 if (this.application == null) {
64 Class clazz = null;
65 try {
66 clazz = this.getClass().getClassLoader().loadClass
67 ("org.apache.shale.test.mock.MockApplication12");
68 this.application = (MockApplication) clazz.newInstance();
69 } catch (NoClassDefFoundError e) {
70 clazz = null;
71 } catch (ClassNotFoundException e) {
72 clazz = null;
73 } catch (RuntimeException e) {
74 throw e;
75 } catch (Exception e) {
76 throw new FacesException(e);
77 }
78 if (clazz == null) {
79 try {
80 clazz = this.getClass().getClassLoader().loadClass
81 ("org.apache.shale.test.mock.MockApplication");
82 this.application = (MockApplication) clazz.newInstance();
83 } catch (RuntimeException e) {
84 throw e;
85 } catch (Exception e) {
86 throw new FacesException(e);
87 }
88 }
89 }
90 return this.application;
91
92 }
93
94
95 /*** {@inheritDoc} */
96 public void setApplication(Application application) {
97
98 this.application = application;
99
100 }
101
102
103 }