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.kernel.search;
16  
17  import java.util.List;
18  
19  /**
20   * <a href="IndexerRegistryUtil.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Raymond Augé
23   */
24  public class IndexerRegistryUtil {
25  
26      public static Indexer getIndexer(Class<?> classObj) {
27          return getIndexerRegistry().getIndexer(classObj.getName());
28      }
29  
30      public static Indexer getIndexer(String className) {
31          return getIndexerRegistry().getIndexer(className);
32      }
33  
34      public static IndexerRegistry getIndexerRegistry() {
35          return _indexerRegistry;
36      }
37  
38      public static List<Indexer> getIndexers() {
39          return getIndexerRegistry().getIndexers();
40      }
41  
42      public static void register(Indexer indexer) {
43          for (String className : indexer.getClassNames()) {
44              register(className, indexer);
45          }
46  
47          register(indexer.getClass().getName(), indexer);
48      }
49  
50      public static void register(
51          String className, Indexer indexer) {
52  
53          getIndexerRegistry().register(className, indexer);
54      }
55  
56      public static void unregister(Indexer indexer) {
57          for (String className : indexer.getClassNames()) {
58              unregister(className);
59          }
60  
61          unregister(indexer.getClass().getName());
62      }
63  
64      public static void unregister(String className) {
65          getIndexerRegistry().unregister(className);
66      }
67  
68      public void setIndexerRegistry(IndexerRegistry indexerRegistry) {
69          _indexerRegistry = indexerRegistry;
70      }
71  
72      private static IndexerRegistry _indexerRegistry;
73  
74  }