001/*
002 *  Copyright 2015 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.web.indexing;
017
018import org.apache.solr.client.solrj.SolrClient;
019
020import org.ametys.cms.indexing.IndexingException;
021import org.ametys.web.repository.site.Site;
022import org.ametys.web.repository.sitemap.Sitemap;
023
024/**
025 * Component indexing a {@link Site}.
026 */
027public interface SiteIndexer
028{
029    
030    /** The component role. */
031    public static final String ROLE = SiteIndexer.class.getName();
032    
033    /**
034     * Index a site in all workspaces
035     * @param site the site to index.
036     * @throws IndexingException If an error occurs while indexing the site.
037     */
038    void indexSite(Site site) throws IndexingException;
039    
040    /**
041     * Index a site in all workspaces
042     * @param siteName  the name of the site to index.
043     * @throws IndexingException If an error occurs while indexing the site.
044     */
045    void indexSite(String siteName) throws IndexingException;
046    
047    /**
048     * Index a site in a specific workspace.
049     * @param siteName the name of the site to index.
050     * @param workspaceName The workspace name.
051     * @throws IndexingException If an error occurs while indexing the site.
052     */
053    void indexSite(String siteName, String workspaceName) throws IndexingException;
054    
055    /**
056     * Index a site in a specific workspace.
057     * @param siteName the name of the site to index.
058     * @param workspaceName The workspace name.
059     * @param solrClient The solr client to use
060     * @throws IndexingException If an error occurs while indexing the site.
061     */
062    void indexSite(String siteName, String workspaceName, SolrClient solrClient) throws IndexingException;
063    
064    /**
065     * Index a sitemap in all workpaces
066     * @param sitemap the sitemap to index.
067     * @throws IndexingException If an error occurs while indexing the sitemap.
068     */
069    void indexSitemap(Sitemap sitemap) throws IndexingException;
070    
071    /**
072     * Index a sitemap in all workpaces
073     * @param siteName the site name.
074     * @param sitemapName the name of the sitemap to index.
075     * @throws IndexingException If an error occurs while indexing the sitemap.
076     */
077    void indexSitemap(String siteName, String sitemapName) throws IndexingException;
078    
079    /**
080     * Index a sitemap in a specific workspace.
081     * @param siteName the site name.
082     * @param sitemapName the name of the sitemap to index.
083     * @param workspaceName The workspace name.
084     * @throws IndexingException If an error occurs while indexing the sitemap.
085     */
086    void indexSitemap(String siteName, String sitemapName, String workspaceName) throws IndexingException;
087    
088    /**
089     * Unindex a site in a specific workspace.
090     * @param siteName the name of site to unindex.
091     * @param workspaceName The workspace name.
092     * @throws IndexingException If an error occurs while unindexing the site.
093     */
094    void unindexSite(String siteName, String workspaceName) throws IndexingException;
095    
096    /**
097     * Unindex a site in all workspaces
098     * @param siteName the name of site to unindex.
099     * @throws IndexingException If an error occurs while unindexing the site.
100     */
101    void unindexSite(String siteName) throws IndexingException;
102    
103    /**
104     * Unindex a sitemap in all workpaces
105     * @param siteName the site name.
106     * @param sitemapName the name of the sitemap to index.
107     * @throws IndexingException If an error occurs while unindexing the sitemap.
108     */
109    void unindexSitemap(String siteName, String sitemapName) throws IndexingException;
110    
111    /**
112     * Unindex a sitemap in a specific workspace.
113     * @param siteName the site name.
114     * @param sitemapName the name of the sitemap to index.
115     * @param workspaceName The workspace name.
116     * @throws IndexingException If an error occurs while unindexing the sitemap.
117     */
118    void unindexSitemap(String siteName, String sitemapName, String workspaceName) throws IndexingException;
119}