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.usecases.jndi;
19
20 import javax.faces.application.Application;
21 import javax.faces.context.FacesContext;
22 import javax.faces.el.ValueBinding;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26 import org.apache.shale.view.AbstractViewController;
27
28 /***
29 * <p>Test page for JNDI access use case.</p>
30 *
31 * $Id: Test.java 464373 2006-10-16 04:21:54Z rahul $
32 */
33 public class Test extends AbstractViewController {
34
35
36
37
38
39 /***
40 * <p>The <code>Log</code> instance for this class.</p>
41 */
42 private static final Log log = LogFactory.getLog(Test.class);
43
44
45
46
47
48 /***
49 * <p>The calculated actual value.</p>
50 */
51 private String actual = null;
52
53
54 /***
55 * <p>Return the actual calculated value.</p>
56 */
57 public String getActual() {
58
59 return actual;
60
61 }
62
63
64 /***
65 * <p>Return the expected trace string for the first page, which is
66 * only rendered.</p>
67 */
68 public String getExpected() {
69
70 return "String Value/class java.lang.String/10/class java.lang.Integer/";
71
72 }
73
74
75
76
77
78 /***
79 * <p>Calculate the actual value.</p>
80 */
81 public void prerender() {
82
83 FacesContext context = FacesContext.getCurrentInstance();
84 Application application = context.getApplication();
85 ValueBinding vb = null;
86 StringBuffer sb = new StringBuffer();
87
88 vb = application.createValueBinding("#{jndi['env/String']}");
89 sb.append("" + vb.getValue(context) + "/");
90 sb.append("" + vb.getType(context) + "/");
91
92 vb = application.createValueBinding("#{jndi['env/Integer']}");
93 sb.append("" + vb.getValue(context) + "/");
94 sb.append("" + vb.getType(context) + "/");
95
96 actual = sb.toString();
97
98 }
99
100
101 }