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.ametys.cms.indexing.IndexingException;
019import org.ametys.web.repository.site.Site;
020import org.ametys.web.repository.sitemap.Sitemap;
021
022/**
023 * Component indexing a {@link Site}.
024 */
025public interface SiteIndexer
026{
027    
028    /** The component role. */
029    public static final String ROLE = SiteIndexer.class.getName();
030    
031    /**
032     * Index a site in all workspaces
033     * @param site the site to index.
034     * @throws IndexingException If an error occurs while indexing the site.
035     */
036    void indexSite(Site site) throws IndexingException;
037    
038    /**
039     * Index a site in all workspaces
040     * @param siteName  the name of the site to index.
041     * @throws IndexingException If an error occurs while indexing the site.
042     */
043    void indexSite(String siteName) throws IndexingException;
044    
045    /**
046     * Index a site in a specific workspace.
047     * @param siteName the name of the site to index.
048     * @param workspaceName The workspace name.
049     * @throws IndexingException If an error occurs while indexing the site.
050     */
051    void indexSite(String siteName, String workspaceName) throws IndexingException;
052    
053    /**
054     * Index a sitemap in all workpaces
055     * @param sitemap the sitemap to index.
056     * @throws IndexingException If an error occurs while indexing the sitemap.
057     */
058    void indexSitemap(Sitemap sitemap) throws IndexingException;
059    
060    /**
061     * Index a sitemap in all workpaces
062     * @param siteName the site name.
063     * @param sitemapName the name of the sitemap to index.
064     * @throws IndexingException If an error occurs while indexing the sitemap.
065     */
066    void indexSitemap(String siteName, String sitemapName) throws IndexingException;
067    
068    /**
069     * Index a sitemap in a specific workspace.
070     * @param siteName the site name.
071     * @param sitemapName the name of the sitemap to index.
072     * @param workspaceName The workspace name.
073     * @throws IndexingException If an error occurs while indexing the sitemap.
074     */
075    void indexSitemap(String siteName, String sitemapName, String workspaceName) throws IndexingException;
076    
077    /**
078     * Unindex a site in a specific workspace.
079     * @param siteName the name of site to unindex.
080     * @param workspaceName The workspace name.
081     * @throws IndexingException If an error occurs while unindexing the site.
082     */
083    void unindexSite(String siteName, String workspaceName) throws IndexingException;
084    
085    /**
086     * Unindex a site in all workspaces
087     * @param siteName the name of site to unindex.
088     * @throws IndexingException If an error occurs while unindexing the site.
089     */
090    void unindexSite(String siteName) throws IndexingException;
091    
092    /**
093     * Unindex a sitemap in all workpaces
094     * @param siteName the site name.
095     * @param sitemapName the name of the sitemap to index.
096     * @throws IndexingException If an error occurs while unindexing the sitemap.
097     */
098    void unindexSitemap(String siteName, String sitemapName) throws IndexingException;
099    
100    /**
101     * Unindex a sitemap in a specific workspace.
102     * @param siteName the site name.
103     * @param sitemapName the name of the sitemap to index.
104     * @param workspaceName The workspace name.
105     * @throws IndexingException If an error occurs while unindexing the sitemap.
106     */
107    void unindexSitemap(String siteName, String sitemapName, String workspaceName) throws IndexingException;
108}