1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.search;
16  
17  import com.liferay.portal.kernel.search.Indexer;
18  import com.liferay.portal.kernel.search.IndexerRegistry;
19  import com.liferay.portal.kernel.util.ListUtil;
20  
21  import java.util.List;
22  import java.util.Map;
23  import java.util.concurrent.ConcurrentHashMap;
24  
25  /**
26   * <a href="IndexerRegistryImpl.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Raymond Augé
29   */
30  public class IndexerRegistryImpl implements IndexerRegistry {
31  
32      public Indexer getIndexer(String className) {
33          return _indexers.get(className);
34      }
35  
36      public List<Indexer> getIndexers() {
37          return ListUtil.fromCollection(_indexers.values());
38      }
39  
40      public void register(String className, Indexer indexerInstance) {
41          _indexers.put(className, indexerInstance);
42      }
43  
44      public void unregister(String className) {
45          _indexers.remove(className);
46      }
47  
48      private Map<String, Indexer> _indexers =
49          new ConcurrentHashMap<String, Indexer>();
50  
51  }