1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.modules.actions.portlets.security;
18
19 import java.util.Iterator;
20
21
22 import org.apache.velocity.context.Context;
23
24
25 import org.apache.turbine.util.RunData;
26 import org.apache.turbine.util.StringUtils;
27
28
29
30 import org.apache.jetspeed.services.JetspeedSecurity;
31
32
33 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
34 import org.apache.jetspeed.services.logging.JetspeedLogger;
35 import org.apache.jetspeed.services.resources.JetspeedResources;
36
37
38 import org.apache.jetspeed.modules.actions.portlets.VelocityPortletAction;
39 import org.apache.jetspeed.portal.portlets.VelocityPortlet;
40
41
42 /***
43 * This action sets up the template context for browsing of security groups in the Turbine database.
44 *
45 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
46 * @version $Id: GroupBrowserAction.java,v 1.7 2004/02/23 02:53:08 jford Exp $
47 */
48
49 public class GroupBrowserAction extends VelocityPortletAction
50 {
51 /***
52 * Static initialization of the logger for this class
53 */
54 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(GroupBrowserAction.class.getName());
55
56 /***
57 * Build the maximized state content for this portlet. (Same as normal state).
58 *
59 * @param portlet The velocity-based portlet that is being built.
60 * @param context The velocity context for this request.
61 * @param rundata The turbine rundata context for this request.
62 */
63 protected void buildMaximizedContext( VelocityPortlet portlet,
64 Context context,
65 RunData rundata )
66 {
67 buildNormalContext( portlet, context, rundata);
68 }
69
70 /***
71 * Build the configure state content for this portlet.
72 * TODO: we could configure this portlet with configurable skins, etc..
73 *
74 * @param portlet The velocity-based portlet that is being built.
75 * @param context The velocity context for this request.
76 * @param rundata The turbine rundata context for this request.
77 */
78 protected void buildConfigureContext( VelocityPortlet portlet,
79 Context context,
80 RunData rundata )
81 {
82
83 buildNormalContext( portlet, context, rundata);
84 }
85
86 /***
87 * Build the normal state content for this portlet.
88 *
89 * @param portlet The velocity-based portlet that is being built.
90 * @param context The velocity context for this request.
91 * @param rundata The turbine rundata context for this request.
92 */
93 protected void buildNormalContext( VelocityPortlet portlet,
94 Context context,
95 RunData rundata )
96 {
97 try
98 {
99 Iterator groups = JetspeedSecurity.getGroups();
100 context.put(SecurityConstants.CONTEXT_GROUPS, groups);
101 }
102 catch (Exception e)
103 {
104
105 logger.error("Exception", e);
106
107 rundata.setMessage("Error in Jetspeed Group Security: " + e.toString());
108 rundata.setStackTrace(StringUtils.stackTrace(e), e);
109 rundata.setScreenTemplate(JetspeedResources.getString("template.error","Error"));
110 }
111 }
112
113 }