1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.jetspeed.services.search.handlers;
17
18 import org.apache.jetspeed.portal.Portlet;
19 import org.apache.jetspeed.services.rundata.JetspeedRunDataService;
20 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
21 import org.apache.jetspeed.services.logging.JetspeedLogger;
22 import org.apache.jetspeed.services.search.AbstractObjectHandler;
23 import org.apache.jetspeed.services.search.BaseParsedObject;
24 import org.apache.jetspeed.services.search.ParsedObject;
25
26 import org.apache.turbine.services.TurbineServices;
27 import org.apache.turbine.services.rundata.RunDataService;
28
29 /***
30 * This object handler deals with portlets
31 *
32 * @author <a href="mailto:caius1440@hotmail.com">Jeremy Ford</a>
33 * @version $Id: PortletToDocHandler.java,v 1.4 2004/02/23 03:47:46 jford Exp $
34 */
35 public class PortletToDocHandler extends AbstractObjectHandler
36 {
37 /***
38 * Static initialization of the logger for this class
39 */
40 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(PortletToDocHandler.class.getName());
41
42
43
44
45 public ParsedObject parseObject(Object o)
46 {
47 ParsedObject result = new BaseParsedObject();
48
49 if ((o instanceof Portlet) == false)
50 {
51 logger.error("PortletToDocHandler: invalid object type: " + o);
52 return null;
53 }
54
55 Portlet portlet = (Portlet) o;
56
57
58 JetspeedRunDataService rds = (JetspeedRunDataService) ((TurbineServices) TurbineServices.getInstance())
59 .getResources(RunDataService.SERVICE_NAME);
60 result.setContent(portlet.getContent(rds.getCurrentRunData()).toString());
61 result.setDescription(portlet.getDescription());
62 result.setType(this.getClass().getName());
63
64 result.setKey(portlet.getName());
65
66
67 result.setTitle(portlet.getTitle());
68
69
70 return result;
71 }
72 }