KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > search > I_CmsIndexer


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/search/I_CmsIndexer.java,v $
3  * Date : $Date: 2005/08/31 16:20:24 $
4  * Version: $Revision: 1.15 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.search;
33
34 import org.opencms.file.CmsObject;
35 import org.opencms.main.CmsException;
36 import org.opencms.report.I_CmsReport;
37
38 import java.util.List JavaDoc;
39
40 import org.apache.lucene.document.Document;
41 import org.apache.lucene.index.IndexReader;
42 import org.apache.lucene.index.IndexWriter;
43
44 /**
45  * Interface for an indexer indexing Cms resources.<p>
46  *
47  * @author Carsten Weinholz
48  * @author Thomas Weckert
49  *
50  * @version $Revision: 1.15 $
51  *
52  * @since 6.0.0
53  */

54 public interface I_CmsIndexer {
55
56     /**
57      * Incremental index update - delete the index entry for all resources in the given list.<p>
58      *
59      * @param reader the index reader to delete the entries from
60      * @param resourcesToDelete a list of <code>{@link org.opencms.db.CmsPublishedResource}</code> instances that must be deleted
61      *
62      * @throws CmsIndexException if something goes wrong
63      */

64     void deleteResources(IndexReader reader, List JavaDoc resourcesToDelete) throws CmsIndexException;
65
66     /**
67      * Returns an index resource for a specified Lucene search result document.<p>
68      *
69      * Implementations of this method have to check if the current user has read permissions
70      * on the Cms resource represented by the Lucene document.<p>
71      *
72      * If this check fails, the implementation must return null as a result.<p>
73      *
74      * @param cms the OpenCms context to use when reading resources from the VFS
75      * @param doc the Lucene search result document
76      * @return a new index resource
77      *
78      * @throws CmsException if something goes wrong
79      *
80      * @see A_CmsIndexResource
81      */

82     A_CmsIndexResource getIndexResource(CmsObject cms, Document doc) throws CmsException;
83
84     /**
85      * Calculates the data for an incremental search index update.<p>
86      *
87      * @param source the search index source to update
88      * @param publishedResources a list of <code>{@link org.opencms.db.CmsPublishedResource}</code> objects that are to be updated
89      *
90      * @return a container with the information about the resources to delete and / or update
91      *
92      * @throws CmsIndexException if something goes wrong
93      */

94     CmsSearchIndexUpdateData getUpdateData(CmsSearchIndexSource source, List JavaDoc publishedResources)
95     throws CmsIndexException;
96
97     /**
98      * Creates and initializes a new instance of this indexer implementation.<p>
99      *
100      * @param cms the OpenCms user context to use when reading resources from the VFS during indexing
101      * @param report the report to write the indexing output to
102      * @param index the search index to update
103      *
104      * @return a new instance of this indexer implementation
105      */

106     I_CmsIndexer newInstance(CmsObject cms, I_CmsReport report, CmsSearchIndex index);
107
108     /**
109      * Rebuilds the index for the given configured index source.<p>
110      *
111      * This is used when the index is fully rebuild, not for updating only some parts
112      * of an existing index.<p>
113      *
114      * @param writer the index writer to write the update to
115      * @param source the search index source to update
116      * @param threadManager the thread manager to use when extracting the document text
117      *
118      * @throws CmsIndexException if something goes wrong
119      */

120     void rebuildIndex(IndexWriter writer, CmsIndexingThreadManager threadManager, CmsSearchIndexSource source)
121     throws CmsIndexException;
122
123     /**
124      * Incremental index update - create a new index entry for all resources in the given list.<p>
125      *
126      * @param writer the index writer to write the update to
127      * @param resourcesToUpdate a list of <code>{@link org.opencms.db.CmsPublishedResource}</code> instances that must be updated
128      * @param threadManager the thread manager to use when extracting the document text
129      *
130      * @throws CmsIndexException if something goes wrong
131      */

132     void updateResources(IndexWriter writer, CmsIndexingThreadManager threadManager, List JavaDoc resourcesToUpdate)
133     throws CmsIndexException;
134 }
Popular Tags