1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.modules.actions.portlets;
18
19
20 import java.util.Iterator;
21 import java.util.Collection;
22 import java.util.ArrayList;
23
24
25 import org.apache.turbine.util.RunData;
26 import org.apache.jetspeed.services.search.Search;
27
28
29 import org.apache.jetspeed.om.registry.PortletEntry;
30 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
31 import org.apache.jetspeed.services.logging.JetspeedLogger;
32 import org.apache.jetspeed.services.Registry;
33 import org.apache.jetspeed.portal.Portlet;
34
35
36 /***
37 * This class is responsible for indexing the registry.
38 *
39 * @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a>
40 * @version $Id: IndexPortletRegistry.java,v 1.6 2004/03/31 04:49:10 morciuch Exp $
41 */
42 public class IndexPortletRegistry extends SecureGenericMVCAction
43 {
44
45 /***
46 * Static initialization of the logger for this class
47 */
48 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(IndexPortletRegistry.class.getName());
49
50 /***
51 * Build the normal state content for this portlet.
52 *
53 * @param portlet The jsp-based portlet that is being built.
54 * @param rundata The turbine rundata context for this request.
55 */
56 protected void buildNormalContext(Portlet portlet, RunData rundata)
57 {
58
59 }
60
61 /***
62 * Continue event handler.
63 *
64 * @param portlet The jsp-based portlet that is being built.
65 * @param rundata The turbine rundata context for this request.
66 */
67 public void doIndex(RunData rundata, Portlet portlet)
68 {
69 if (portlet == null)
70 {
71 return;
72 }
73
74 Collection c = new ArrayList();
75
76 for (Iterator i = Registry.get(Registry.PORTLET).listEntryNames(); i.hasNext();)
77 {
78 PortletEntry entry = (PortletEntry) Registry.getEntry(Registry.PORTLET, (String) i.next());
79 if (!entry.getType().equals(PortletEntry.TYPE_ABSTRACT) && !entry.isHidden())
80 {
81 c.add(entry);
82
83 }
84 }
85
86 try
87 {
88
89 Search.remove(c);
90 }
91 catch (Throwable e)
92 {
93 logger.error("Throwable", e);
94 }
95
96 try
97 {
98
99 Search.add(c);
100 }
101 catch (Throwable e)
102 {
103 logger.error("Throwable", e);
104 }
105 }
106
107 }