1/*2 * Copyright 2000-2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16packageorg.apache.jetspeed.services.search.handlers;
1718import org.apache.jetspeed.om.registry.RegistryEntry;
19import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
20import org.apache.jetspeed.services.logging.JetspeedLogger;
21import org.apache.jetspeed.services.search.BaseParsedObject;
22import org.apache.jetspeed.services.search.AbstractObjectHandler;
23import org.apache.jetspeed.services.search.ParsedObject;
242526/***27 * This object handler deals with registry entries28 * 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 */32publicclassRegistryEntryToDocHandlerextendsAbstractObjectHandler33 {
34/***35 * Static initialization of the logger for this class36 */37privatestaticfinalJetspeedLogger logger = JetspeedLogFactoryService.getLogger(RegistryEntryToDocHandler.class.getName());
3839/***40 * @see org.apache.jetspeed.services.search.ObjectHandler#parseObject(java.lang.Object)41 * @param o42 * @return 43 */44publicParsedObject parseObject(Object o)
45 {
46ParsedObject result = newBaseParsedObject();
4748if ((o instanceof RegistryEntry) == false)
49 {
50 logger.error("RegistryEntryToDocHandler: invalid object type: " + o);
51returnnull;
52 }
5354RegistryEntry 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);
6061 result.setClassName(o.getClass().getName());
6263return result;
64 }
65 }