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.om.registry.RegistryEntry;
19 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
20 import org.apache.jetspeed.services.logging.JetspeedLogger;
21 import org.apache.jetspeed.services.search.BaseParsedObject;
22 import org.apache.jetspeed.services.search.AbstractObjectHandler;
23 import org.apache.jetspeed.services.search.ParsedObject;
24
25
26 /***
27 * This object handler deals with registry entries
28 *
29 * @author <a href="mailto:jford@apache.org">Jeremy Ford</a>
30 * @version $Id: RegistryEntryToDocHandler.java,v 1.4 2004/02/23 03:47:46 jford Exp $
31 */
32 public class RegistryEntryToDocHandler extends AbstractObjectHandler
33 {
34 /***
35 * Static initialization of the logger for this class
36 */
37 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(RegistryEntryToDocHandler.class.getName());
38
39 /***
40 * @see org.apache.jetspeed.services.search.ObjectHandler#parseObject(java.lang.Object)
41 * @param o
42 * @return
43 */
44 public ParsedObject parseObject(Object o)
45 {
46 ParsedObject result = new BaseParsedObject();
47
48 if ((o instanceof RegistryEntry) == false)
49 {
50 logger.error("RegistryEntryToDocHandler: invalid object type: " + o);
51 return null;
52 }
53
54 RegistryEntry regEntry = (RegistryEntry) o;
55 String desc = regEntry.getDescription();
56 result.setDescription(desc == null ? regEntry.getName() : desc);
57 result.setKey(regEntry.getName());
58 String title = regEntry.getTitle();
59 result.setTitle(title == null ? regEntry.getName() : title);
60
61 result.setClassName(o.getClass().getName());
62
63 return result;
64 }
65 }