View Javadoc
1   package org.apache.maven.indexer.examples.indexing;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.index.Indexer;
23  import org.apache.maven.index.Scanner;
24  import org.apache.maven.index.context.IndexCreator;
25  
26  import javax.inject.Inject;
27  import javax.inject.Named;
28  import javax.inject.Singleton;
29  import java.util.ArrayList;
30  import java.util.List;
31  import java.util.Map;
32  
33  /**
34   * A simple configuration holder class.
35   * This class contains the mapped indexers.
36   *
37   * @author mtodorov
38   */
39  @Named
40  @Singleton
41  public class IndexerConfiguration
42  {
43  
44      private Indexer indexer;
45  
46      private Scanner scanner;
47  
48      private Map<String, IndexCreator> indexers;
49  
50  
51      @Inject
52      public IndexerConfiguration( Indexer indexer, Scanner scanner, Map<String, IndexCreator> indexers )
53      {
54          this.indexer = indexer;
55          this.scanner = scanner;
56          this.indexers = indexers;
57      }
58  
59      public List<IndexCreator> getIndexersAsList()
60      {
61          return indexers == null ? //
62              new ArrayList<IndexCreator>( 0 ) //
63              : new ArrayList<>( indexers.values() );
64      }
65  
66      public Indexer getIndexer()
67      {
68          return indexer;
69      }
70  
71      public void setIndexer( Indexer indexer )
72      {
73          this.indexer = indexer;
74      }
75  
76      public Scanner getScanner()
77      {
78          return scanner;
79      }
80  
81      public void setScanner( Scanner scanner )
82      {
83          this.scanner = scanner;
84      }
85  
86      public Map<String, IndexCreator> getIndexers()
87      {
88          return indexers;
89      }
90  
91      public void setIndexers( Map<String, IndexCreator> indexers )
92      {
93          this.indexers = indexers;
94      }
95  
96  }