001/*
002 *  Copyright 2016 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.cms.indexing.solr;
017
018import org.apache.solr.client.solrj.SolrClient;
019
020import org.ametys.cms.indexing.IndexingException;
021import org.ametys.core.schedule.progression.ContainerProgressionTracker;
022import org.ametys.runtime.i18n.I18nizableText;
023
024/**
025 * Provides additional documents when indexing a workspace.
026 */
027public interface DocumentProvider
028{
029    /**
030     * The label of the document provider
031     * @return The label
032     */
033    I18nizableText getLabel();
034    
035    /**
036     * Index additional documents for the given workspace.
037     * @param workspaceName The workspace name.
038     * @param solrClient The solr client to use
039     * @throws IndexingException If an error occurs indexing the documents.
040     */
041    void indexDocuments(String workspaceName, SolrClient solrClient) throws IndexingException;
042    
043    /**
044     * Index additional documents for the given workspace.
045     * @param workspaceName The workspace name.
046     * @param solrClient The solr client to use
047     * @param progressionTracker The progression tracker
048     * @throws IndexingException If an error occurs indexing the documents.
049     */
050    void indexDocuments(String workspaceName, SolrClient solrClient, ContainerProgressionTracker progressionTracker) throws IndexingException;
051}