KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > setup > xml > CmsXmlRemovePageSearchIndexSource1


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/setup/xml/CmsXmlRemovePageSearchIndexSource1.java,v $
3  * Date : $Date: 2006/03/27 14:52:44 $
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.setup.xml;
33
34 import org.opencms.configuration.CmsConfigurationManager;
35 import org.opencms.configuration.CmsSearchConfiguration;
36 import org.opencms.configuration.I_CmsXmlConfiguration;
37
38 import java.util.Collections JavaDoc;
39 import java.util.List JavaDoc;
40
41 /**
42  * Removes the doctype 'page' from the search index source 'source1'.<p>
43  *
44  * @author Michael Moossen
45  *
46  * @version $Revision: 1.2 $
47  *
48  * @since 6.1.8
49  */

50 public class CmsXmlRemovePageSearchIndexSource1 extends A_CmsSetupXmlUpdate {
51
52     /** List of xpaths to remove. */
53     private List JavaDoc m_xpaths;
54
55     /**
56      * @see org.opencms.setup.xml.I_CmsSetupXmlUpdate#getName()
57      */

58     public String JavaDoc getName() {
59
60         return "Remove document type 'page' from the search index source 'source1'";
61     }
62
63     /**
64      * @see org.opencms.setup.xml.I_CmsSetupXmlUpdate#getXmlFilename()
65      */

66     public String JavaDoc getXmlFilename() {
67
68         return CmsSearchConfiguration.DEFAULT_XML_FILE_NAME;
69     }
70
71     /**
72      * @see org.opencms.setup.xml.A_CmsSetupXmlUpdate#getXPathsToUpdate()
73      */

74     protected List JavaDoc getXPathsToRemove() {
75
76         if (m_xpaths == null) {
77             // /opencms/search/indexsources/indexsource[name='source1']/documenttypes-indexed/name[text()='page']
78
StringBuffer JavaDoc xp = new StringBuffer JavaDoc(256);
79             xp.append("/");
80             xp.append(CmsConfigurationManager.N_ROOT);
81             xp.append("/");
82             xp.append(CmsSearchConfiguration.N_SEARCH);
83             xp.append("/");
84             xp.append(CmsSearchConfiguration.N_INDEXSOURCES);
85             xp.append("/");
86             xp.append(CmsSearchConfiguration.N_INDEXSOURCE);
87             xp.append("[");
88             xp.append(I_CmsXmlConfiguration.N_NAME);
89             xp.append("='source1']/");
90             xp.append(CmsSearchConfiguration.N_DOCUMENTTYPES_INDEXED);
91             xp.append("/");
92             xp.append(I_CmsXmlConfiguration.N_NAME);
93             xp.append("[text()='page']");
94             m_xpaths = Collections.singletonList(xp.toString());
95         }
96         return m_xpaths;
97     }
98 }
Popular Tags