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.search.solr;
017
018import org.apache.solr.client.solrj.SolrClient;
019
020/**
021 * Component acting as a single entry point to get access to Solr clients.
022 */
023public interface SolrClientProvider
024{
025    
026    /** The component role. */
027    public static final String ROLE = SolrClientProvider.class.getName();
028    
029    /**
030     * Get the "read" mode solr client.
031     * @return the "read" mode solr client.
032     */
033    SolrClient getReadClient();
034    
035    /**
036     * Get a Solr client suited to update.
037     * @param workspaceName The name of the workspace
038     * @return a Solr client suited to update.
039     */
040    SolrClient getUpdateClient(String workspaceName);
041    
042    /**
043     * Get the name of the collection to use.
044     * @return The name of the collection to search in.
045     */
046    String getCollectionName();
047    
048    /**
049     * Get the collection to use.
050     * @param workspaceName The workspace name.
051     * @return The name of the collection to search in.
052     */
053    String getCollectionName(String workspaceName);
054}