KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > searchindex > CmsSearchIndexSourceRemoveList


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/searchindex/CmsSearchIndexSourceRemoveList.java,v $
3  * Date : $Date: 2006/03/27 14:52:21 $
4  * Version: $Revision: 1.2 $
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.workplace.tools.searchindex;
33
34 import org.opencms.configuration.CmsSearchConfiguration;
35 import org.opencms.i18n.CmsMessageContainer;
36 import org.opencms.jsp.CmsJspActionElement;
37 import org.opencms.main.CmsIllegalStateException;
38 import org.opencms.main.CmsLog;
39 import org.opencms.main.OpenCms;
40 import org.opencms.search.CmsSearchDocumentType;
41 import org.opencms.search.CmsSearchException;
42 import org.opencms.search.CmsSearchIndex;
43 import org.opencms.search.CmsSearchIndexSource;
44 import org.opencms.search.CmsSearchManager;
45 import org.opencms.workplace.CmsWorkplaceSettings;
46 import org.opencms.workplace.list.CmsListColumnAlignEnum;
47 import org.opencms.workplace.list.CmsListColumnDefinition;
48 import org.opencms.workplace.list.CmsListDefaultAction;
49 import org.opencms.workplace.list.CmsListDirectAction;
50 import org.opencms.workplace.list.CmsListItem;
51 import org.opencms.workplace.list.CmsListItemDetails;
52 import org.opencms.workplace.list.CmsListItemDetailsFormatter;
53 import org.opencms.workplace.list.CmsListMetadata;
54 import org.opencms.workplace.list.CmsListMultiAction;
55 import org.opencms.workplace.list.CmsListOrderEnum;
56 import org.opencms.workplace.tools.CmsToolDialog;
57
58 import java.io.IOException JavaDoc;
59 import java.util.ArrayList JavaDoc;
60 import java.util.HashMap JavaDoc;
61 import java.util.Iterator JavaDoc;
62 import java.util.List JavaDoc;
63 import java.util.Map JavaDoc;
64
65 import javax.servlet.ServletException JavaDoc;
66 import javax.servlet.http.HttpServletRequest JavaDoc;
67 import javax.servlet.http.HttpServletResponse JavaDoc;
68 import javax.servlet.jsp.PageContext JavaDoc;
69
70 import org.apache.commons.logging.Log;
71
72 /**
73  * A list that displays the <code>{@link org.opencms.search.CmsSearchIndexSource}</code>
74  * instances of the OpenCms system that are assigned to the
75  * <code>{@link org.opencms.search.CmsSearchIndex}</code> in the current request scope (param "searchindex") and allows to remove those sources to the
76  * current searchindex.<p>
77  *
78  * This list is no stand-alone page but has to be embedded in another dialog
79  * (see <code> {@link org.opencms.workplace.tools.searchindex.A_CmsEmbeddedListDialog}</code>. <p>
80  *
81  * @author Achim Westermann
82  *
83  * @version $Revision: 1.2 $
84  *
85  * @since 6.0.0
86  */

87 public class CmsSearchIndexSourceRemoveList extends A_CmsEmbeddedListDialog {
88
89     /** list action dummy id constant. */
90     public static final String JavaDoc LIST_ACTION_NONE = "an";
91
92     /** list action dummy id constant. */
93     public static final String JavaDoc LIST_ACTION_REMOVESOURCE = "ars";
94
95     /** list column id constant. */
96     public static final String JavaDoc LIST_COLUMN_ICON = "ci";
97
98     /** list column id constant. */
99     public static final String JavaDoc LIST_COLUMN_INDEXER = "ca";
100
101     /** list column id constant. */
102     public static final String JavaDoc LIST_COLUMN_NAME = "cn";
103
104     /** list column id constant. */
105     public static final String JavaDoc LIST_COLUMN_REMOVESOURCE = "crs";
106
107     /** list item detail id constant. */
108     public static final String JavaDoc LIST_DETAIL_DOCTYPES = "dd";
109
110     /** list item detail id constant. */
111     public static final String JavaDoc LIST_DETAIL_RESOURCES = "dr";
112
113     /** list id constant. */
114     public static final String JavaDoc LIST_ID = "lssisr";
115
116     /** list action id constant. */
117     public static final String JavaDoc LIST_MACTION_REMOVESOURCE = "mars";
118
119     /** list action dummy id constant. */
120     protected static final String JavaDoc LIST_ACTION_REMOVESOURCE2 = LIST_ACTION_REMOVESOURCE + "2";
121
122     /** The log object for this class. */
123     private static final Log LOG = CmsLog.getLog(CmsSearchIndexSourceRemoveList.class);
124
125     /** Stores the value of the request parameter for the search index Name. */
126     private String JavaDoc m_paramIndexName;
127
128     /**
129      * Public constructor.<p>
130      *
131      * @param jsp an initialized JSP action element
132      */

133     public CmsSearchIndexSourceRemoveList(CmsJspActionElement jsp) {
134
135         this(jsp, LIST_ID, Messages.get().container(Messages.GUI_LIST_INDEXSOURCES_NAME_0));
136     }
137
138     /**
139      * Public constructor.<p>
140      *
141      * @param jsp an initialized JSP action element
142      * @param listId the id of the list
143      * @param listName the list name
144      */

145     public CmsSearchIndexSourceRemoveList(CmsJspActionElement jsp, String JavaDoc listId, CmsMessageContainer listName) {
146
147         this(jsp, listId, listName, LIST_COLUMN_NAME, CmsListOrderEnum.ORDER_ASCENDING, null);
148     }
149
150     /**
151      * Public constructor.<p>
152      *
153      * @param jsp an initialized JSP action element
154      * @param listId the id of the displayed list
155      * @param listName the name of the list
156      * @param sortedColId the a priory sorted column
157      * @param sortOrder the order of the sorted column
158      * @param searchableColId the column to search into
159      */

160     public CmsSearchIndexSourceRemoveList(
161         CmsJspActionElement jsp,
162         String JavaDoc listId,
163         CmsMessageContainer listName,
164         String JavaDoc sortedColId,
165         CmsListOrderEnum sortOrder,
166         String JavaDoc searchableColId) {
167
168         super(jsp, listId, listName, sortedColId, sortOrder, searchableColId);
169
170     }
171
172     /**
173      * Public constructor.<p>
174      *
175      * Public constructor with JSP variables.<p>
176      *
177      * @param context the JSP page context
178      * @param req the JSP request
179      * @param res the JSP response
180      */

181     public CmsSearchIndexSourceRemoveList(PageContext JavaDoc context, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res) {
182
183         this(new CmsJspActionElement(context, req, res));
184     }
185
186     /**
187      * @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions()
188      */

189     public void executeListMultiActions() {
190
191         CmsSearchManager searchManager = OpenCms.getSearchManager();
192         CmsListItem listItem = getSelectedItem();
193         String JavaDoc action = getParamListAction();
194         if (action.equals(LIST_MACTION_REMOVESOURCE)) {
195             // execute the delete multiaction
196
Iterator JavaDoc itItems = getSelectedItems().iterator();
197             CmsSearchIndex idx = searchManager.getIndex(getParamIndexName());
198             while (itItems.hasNext()) {
199                 listItem = (CmsListItem)itItems.next();
200                 if (idx.getSourceNames().size() > 1) {
201                     idx.removeSourceName((String JavaDoc)listItem.get(LIST_COLUMN_NAME));
202                     getList().removeItem(listItem.getId(), getLocale());
203                 } else {
204                     break;
205                 }
206             }
207             try {
208                 idx.initialize();
209             } catch (CmsSearchException e) {
210                 if (LOG.isErrorEnabled()) {
211                     LOG.error(e);
212                 }
213             }
214             refreshList();
215             writeConfiguration(false);
216         }
217         listSave();
218     }
219
220     /**
221      * @throws ServletException
222      * @throws IOException
223      * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
224      */

225     public void executeListSingleActions() throws IOException JavaDoc, ServletException JavaDoc {
226
227         CmsSearchManager searchManager = OpenCms.getSearchManager();
228         CmsListItem item = getSelectedItem();
229         String JavaDoc action = getParamListAction();
230         String JavaDoc indexsourceName = (String JavaDoc)item.get(LIST_COLUMN_NAME);
231         if (action.equals(LIST_ACTION_REMOVESOURCE) || action.equals(LIST_ACTION_REMOVESOURCE2)) {
232             CmsSearchIndex idx = searchManager.getIndex(getParamIndexName());
233             // Don't allow removing last index source, config file will become invalid:
234
if (idx.getSourceNames().size() > 1) {
235                 idx.removeSourceName((String JavaDoc)item.get(LIST_COLUMN_NAME));
236                 getList().removeItem(item.getId(), getLocale());
237                 try {
238                     idx.initialize();
239                 } catch (CmsSearchException e) {
240                     if (LOG.isErrorEnabled()) {
241                         LOG.error(e);
242                     }
243                 }
244                 refreshList();
245                 writeConfiguration(false);
246             }
247         } else if (action.equals(CmsSearchIndexSourceControlList.LIST_ACTION_OVERVIEW_INDEXSOURCE)) {
248
249             // currently unused action (not triggered by a column
250
Map JavaDoc params = new HashMap JavaDoc();
251             // forward to the edit indexsource screen
252
params.put(A_CmsEditIndexSourceDialog.PARAM_INDEXSOURCE, indexsourceName);
253             params.put(PARAM_STYLE, CmsToolDialog.STYLE_NEW);
254             getToolManager().jspForwardTool(this, "/searchindex/indexsources/indexsource", params);
255
256         }
257     }
258
259     /**
260      * Returns the request parameter mapped to member <code>m_searchindex</code>
261      * or null if no one was received. <p>
262      *
263      * @return the request parameter mapped to member <code>m_searchindex</code>
264      * or null if no one was received
265      */

266     public String JavaDoc getParamIndexName() {
267
268         return m_paramIndexName;
269     }
270
271     /**
272      * Maps the request parameter to member <code>m_searchindex</code>. <p>
273      *
274      * @param paramSearchIndex the request parameter <code>searchindex</code>
275      * that is filled using this method.
276      */

277     public void setParamIndexName(String JavaDoc paramSearchIndex) {
278
279         m_paramIndexName = paramSearchIndex;
280     }
281
282     /**
283      * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
284      */

285     protected void fillDetails(String JavaDoc detailId) {
286
287         // get content
288
List JavaDoc items = getList().getAllContent();
289         Iterator JavaDoc itItems = items.iterator();
290         CmsListItem item;
291         if (detailId.equals(LIST_DETAIL_DOCTYPES)) {
292             while (itItems.hasNext()) {
293                 item = (CmsListItem)itItems.next();
294                 fillDetailDocTypes(item, detailId);
295
296             }
297         }
298         if (detailId.equals(LIST_DETAIL_RESOURCES)) {
299             while (itItems.hasNext()) {
300                 item = (CmsListItem)itItems.next();
301                 fillDetailResources(item, detailId);
302
303             }
304
305         }
306
307     }
308
309     /**
310      * @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
311      */

312     protected List JavaDoc getListItems() {
313
314         List JavaDoc result = new ArrayList JavaDoc();
315         // get content
316
List JavaDoc sources = searchIndexSources();
317         Iterator JavaDoc itSources = sources.iterator();
318         CmsSearchIndexSource source;
319         while (itSources.hasNext()) {
320             source = (CmsSearchIndexSource)itSources.next();
321             CmsListItem item = getList().newItem(source.getName());
322             item.set(LIST_COLUMN_NAME, source.getName());
323             item.set(LIST_COLUMN_INDEXER, source.getIndexer().getClass().getName());
324             result.add(item);
325         }
326         return result;
327     }
328
329     /**
330      * @see org.opencms.workplace.CmsWorkplace#initMessages()
331      */

332     protected void initMessages() {
333
334         // add specific dialog resource bundle
335
addMessages(Messages.get().getBundleName());
336         // add default resource bundles
337
super.initMessages();
338     }
339
340     /**
341      * @see org.opencms.workplace.list.A_CmsListDialog#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
342      */

343     protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest JavaDoc request) {
344
345         super.initWorkplaceRequestValues(settings, request);
346     }
347
348     /**
349      * @see org.opencms.workplace.list.A_CmsListDialog#setColumns(org.opencms.workplace.list.CmsListMetadata)
350      */

351     protected void setColumns(CmsListMetadata metadata) {
352
353         // create dummy column for icon
354
CmsListColumnDefinition editCol = new CmsListColumnDefinition(LIST_COLUMN_ICON);
355         editCol.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_ICON_NAME_0));
356         editCol.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_ICON_NAME_HELP_0));
357         editCol.setWidth("5");
358         editCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
359         editCol.setSorteable(false);
360         // add dummy icon
361
CmsListDirectAction editAction = new CmsListDirectAction(LIST_ACTION_NONE);
362         editAction.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_ICON_NAME_0));
363         editAction.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_ICON_NAME_HELP_0));
364         editAction.setIconPath(CmsSearchIndexList.LIST_ICON_INDEXSOURCE);
365         // disable!
366
editAction.setEnabled(false);
367         editCol.addDirectAction(editAction);
368         // add it to the list definition
369
metadata.addColumn(editCol);
370
371         // add column for remove action
372
CmsListColumnDefinition addCol = new CmsListColumnDefinition(LIST_COLUMN_REMOVESOURCE);
373         addCol.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_REMOVESOURCE_NAME_0));
374         addCol.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_REMOVESOURCE_NAME_HELP_0));
375         addCol.setWidth("5");
376         addCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
377         addCol.setSorteable(false);
378         // add remove action
379
CmsListDirectAction addAction = new CmsListDirectAction(LIST_ACTION_REMOVESOURCE);
380         addAction.setName(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_ACTION_REMOVESOURCE_NAME_0));
381         addAction.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_REMOVESOURCE_NAME_HELP_0));
382         addAction.setIconPath(ICON_MINUS);
383         addCol.addDirectAction(addAction);
384         // add it to the list definition
385
metadata.addColumn(addCol);
386
387         // add column for name
388
CmsListColumnDefinition nameCol = new CmsListColumnDefinition(LIST_COLUMN_NAME);
389         nameCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
390         nameCol.setName(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_COL_NAME_0));
391         nameCol.setWidth("55%");
392         // add a duplicate action
393
CmsListDefaultAction defEditAction = new CmsListDefaultAction(LIST_ACTION_REMOVESOURCE2);
394         defEditAction.setName(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_ACTION_REMOVESOURCE_NAME_0));
395         defEditAction.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_REMOVESOURCE_NAME_HELP_0));
396         nameCol.addDefaultAction(defEditAction);
397         metadata.addColumn(nameCol);
398
399         // add column for analyzer
400
CmsListColumnDefinition analyzerCol = new CmsListColumnDefinition(LIST_COLUMN_INDEXER);
401         analyzerCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
402         analyzerCol.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_INDEXER_0));
403         analyzerCol.setWidth("30%");
404         metadata.addColumn(analyzerCol);
405
406     }
407
408     /**
409      * @see org.opencms.workplace.list.A_CmsListDialog#setIndependentActions(org.opencms.workplace.list.CmsListMetadata)
410      */

411     protected void setIndependentActions(CmsListMetadata metadata) {
412
413         // add document types of index source detail help
414
CmsListItemDetails doctypeDetails = new CmsListItemDetails(LIST_DETAIL_DOCTYPES);
415         doctypeDetails.setAtColumn(LIST_COLUMN_NAME);
416         doctypeDetails.setVisible(false);
417         doctypeDetails.setShowActionName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_NAME_0));
418         doctypeDetails.setShowActionHelpText(Messages.get().container(
419             Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_SHOW_HELP_0));
420         doctypeDetails.setHideActionName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_NAME_0));
421         doctypeDetails.setHideActionHelpText(Messages.get().container(
422             Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_HIDE_HELP_0));
423         doctypeDetails.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_NAME_0));
424         doctypeDetails.setFormatter(new CmsListItemDetailsFormatter(Messages.get().container(
425             Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_NAME_0)));
426         metadata.addItemDetails(doctypeDetails);
427
428         // add resources of index source detail help
429
CmsListItemDetails resourceDetails = new CmsListItemDetails(LIST_DETAIL_RESOURCES);
430         resourceDetails.setAtColumn(LIST_COLUMN_NAME);
431         resourceDetails.setVisible(false);
432         resourceDetails.setShowActionName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_NAME_0));
433         resourceDetails.setShowActionHelpText(Messages.get().container(
434             Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_SHOW_HELP_0));
435         resourceDetails.setHideActionName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_NAME_0));
436         resourceDetails.setHideActionHelpText(Messages.get().container(
437             Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_HIDE_HELP_0));
438         resourceDetails.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_NAME_0));
439         resourceDetails.setFormatter(new CmsListItemDetailsFormatter(Messages.get().container(
440             Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_NAME_0)));
441         metadata.addItemDetails(resourceDetails);
442
443     }
444
445     /**
446      * @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata)
447      */

448     protected void setMultiActions(CmsListMetadata metadata) {
449
450         // add add multi action
451
CmsListMultiAction addMultiAction = new CmsListMultiAction(LIST_MACTION_REMOVESOURCE);
452         addMultiAction.setName(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_MACTION_REMOVESOURCE_NAME_0));
453         addMultiAction.setHelpText(Messages.get().container(
454             Messages.GUI_LIST_SEARCHINDEX_MACTION_REMOVESOURCE_NAME_HELP_0));
455         addMultiAction.setIconPath(ICON_MULTI_MINUS);
456         metadata.addMultiAction(addMultiAction);
457     }
458
459     /**
460      * @see org.opencms.workplace.list.A_CmsListDialog#validateParamaters()
461      */

462     protected void validateParamaters() throws Exception JavaDoc {
463
464         // test the needed parameters
465
if (getParamIndexName() == null) {
466             throw new CmsIllegalStateException(Messages.get().container(
467                 Messages.ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1,
468                 A_CmsEditSearchIndexDialog.PARAM_INDEXNAME));
469         }
470     }
471
472     /**
473      * Writes the updated search configuration back to the XML
474      * configuration file and refreshes the complete list.<p>
475      *
476      * @param refresh if true, the list items are refreshed
477      */

478     protected void writeConfiguration(boolean refresh) {
479
480         // update the XML configuration
481
OpenCms.writeConfiguration(CmsSearchConfiguration.class);
482         if (refresh) {
483             refreshList();
484         }
485     }
486
487     /**
488      * Fills details about document types of the index source into the given item. <p>
489      *
490      * @param item the list item to fill
491      * @param detailId the id for the detail to fill
492      *
493      */

494     private void fillDetailDocTypes(CmsListItem item, String JavaDoc detailId) {
495
496         CmsSearchManager searchManager = OpenCms.getSearchManager();
497         StringBuffer JavaDoc html = new StringBuffer JavaDoc();
498
499         // search for the corresponding CmsSearchIndexSource:
500
String JavaDoc idxSourceName = (String JavaDoc)item.get(LIST_COLUMN_NAME);
501         CmsSearchIndexSource idxSource = searchManager.getIndexSource(idxSourceName);
502
503         // get the index sources doc types
504
List JavaDoc docTypes = idxSource.getDocumentTypes();
505         // output of found index sources
506
Iterator JavaDoc itDocTypes = docTypes.iterator();
507         CmsSearchDocumentType docType;
508         html.append("<ul>\n");
509         while (itDocTypes.hasNext()) {
510             // get the instance (instead of plain name) for more detail in future...
511
docType = searchManager.getDocumentTypeConfig(itDocTypes.next().toString());
512             // harden against unconfigured doctypes that are refferred to by indexsource nodes
513
if (docType != null) {
514
515                 html.append(" <li>\n").append(" ").append(docType.getName()).append("\n");
516                 html.append(" </li>");
517             }
518         }
519
520         html.append("</ul>\n");
521         item.set(detailId, html.toString());
522     }
523
524     /**
525      * Fills details about resource paths of the index source into the given item. <p>
526      *
527      * @param item the list item to fill
528      * @param detailId the id for the detail to fill
529      *
530      */

531     private void fillDetailResources(CmsListItem item, String JavaDoc detailId) {
532
533         CmsSearchManager searchManager = OpenCms.getSearchManager();
534         StringBuffer JavaDoc html = new StringBuffer JavaDoc();
535
536         // search for the corresponding CmsSearchIndexSource:
537
String JavaDoc idxSourceName = (String JavaDoc)item.get(LIST_COLUMN_NAME);
538         CmsSearchIndexSource idxSource = searchManager.getIndexSource(idxSourceName);
539
540         // get the index sources resource strings
541
List JavaDoc resources = idxSource.getResourcesNames();
542         // output of found index sources
543
Iterator JavaDoc itResources = resources.iterator();
544         html.append("<ul>\n");
545         while (itResources.hasNext()) {
546
547             html.append(" <li>\n").append(" ").append(itResources.next().toString()).append("\n");
548             html.append(" </li>");
549         }
550
551         html.append("</ul>\n");
552
553         item.set(detailId, html.toString());
554     }
555
556     /**
557      * Returns the available search indexes of this installation.
558      *
559      * @return the available search indexes of this installation
560      */

561     private List JavaDoc searchIndexSources() {
562
563         CmsSearchManager manager = OpenCms.getSearchManager();
564         CmsSearchIndex index = manager.getIndex(getParamIndexName());
565         List JavaDoc sources = index.getSources();
566         return sources;
567     }
568
569 }
570
Popular Tags