View Javadoc

1   package org.apache.maven.index.creator;
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 java.util.ArrayList;
23  import java.util.Collections;
24  import java.util.List;
25  
26  import org.apache.maven.index.context.IndexCreator;
27  import org.codehaus.plexus.logging.AbstractLogEnabled;
28  
29  /**
30   * An abstract base class for {@link IndexCreator} implementations.
31   * 
32   * @author Jason van Zyl
33   */
34  public abstract class AbstractIndexCreator
35      extends AbstractLogEnabled
36      implements IndexCreator
37  {
38      private final String id;
39  
40      private final List<String> creatorDependencies;
41  
42      protected AbstractIndexCreator( final String id )
43      {
44          this( id, null );
45      }
46  
47      protected AbstractIndexCreator( final String id, final List<String> creatorDependencies )
48      {
49          this.id = id;
50  
51          final ArrayList<String> deps = new ArrayList<String>();
52  
53          if ( creatorDependencies != null && !creatorDependencies.isEmpty() )
54          {
55              deps.addAll( creatorDependencies );
56          }
57  
58          this.creatorDependencies = Collections.unmodifiableList( deps );
59      }
60  
61      public String getId()
62      {
63          return id;
64      }
65  
66      public List<String> getCreatorDependencies()
67      {
68          return creatorDependencies;
69      }
70  
71      public static String bos( boolean b )
72      {
73          return b ? "1" : "0";
74      }
75  
76      public static boolean sob( String b )
77      {
78          return b.equals( "1" );
79      }
80  }