1 31 32 package org.opencms.search.documents; 33 34 import org.opencms.file.CmsFile; 35 import org.opencms.file.CmsObject; 36 import org.opencms.file.CmsResource; 37 import org.opencms.main.CmsException; 38 import org.opencms.search.A_CmsIndexResource; 39 import org.opencms.search.CmsIndexException; 40 import org.opencms.search.extractors.CmsExtractorRtf; 41 import org.opencms.search.extractors.I_CmsExtractionResult; 42 43 54 public class CmsDocumentRtf extends A_CmsVfsDocument { 55 56 61 public CmsDocumentRtf(String name) { 62 63 super(name); 64 } 65 66 71 public I_CmsExtractionResult extractContent(CmsObject cms, A_CmsIndexResource indexResource, String language) 72 throws CmsException { 73 74 CmsResource resource = (CmsResource)indexResource.getData(); 75 CmsFile file = readFile(cms, resource); 76 77 try { 78 return CmsExtractorRtf.getExtractor().extractText(file.getContents()); 79 } catch (Exception e) { 80 throw new CmsIndexException( 81 Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), 82 e); 83 } 84 } 85 } | Popular Tags |