| IndexerRegistryImpl.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
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 }