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.cms.indexing;
017
018import javax.jcr.RepositoryException;
019
020import org.ametys.core.schedule.progression.ContainerProgressionTracker;
021
022/**
023 * Component indexing a workspace.
024 */
025public interface WorkspaceIndexer
026{
027    /** The component role. */
028    public static final String ROLE = WorkspaceIndexer.class.getName();
029
030    /**
031     * Index all the workspaces.
032     * @throws IndexingException If an error occurs while indexing.
033     */
034    void indexAllWorkspaces() throws IndexingException;
035
036    /**
037     * Index all the workspaces.
038     * @param progressionTracker The progression of the indexation
039     * @throws IndexingException If an error occurs while indexing.
040     */
041    void indexAllWorkspaces(ContainerProgressionTracker progressionTracker) throws IndexingException;
042    
043    /**
044     * Index a workspace.
045     * @param workspaceName The workspace name.
046     * @throws IndexingException If an error occurs while indexing the workspace.
047     */
048    void index(String workspaceName) throws IndexingException;
049    
050    /**
051     * Index a workspace.
052     * @param workspaceName The workspace name.
053     * @param progressionTracker The progression tracker
054     * @throws IndexingException If an error occurs while indexing the workspace.
055     */
056    void index(String workspaceName, ContainerProgressionTracker progressionTracker) throws IndexingException;
057
058    /**
059     * Get the workspaces labels
060     * @return The list of labels
061     * @throws RepositoryException If an error occurs
062     */
063    String[] getWorkspacesNames() throws RepositoryException;
064}