Coverage Report - org.apache.maven.index.context.IndexCreator
 
Classes in this File Line Coverage Branch Coverage Complexity
IndexCreator
N/A
N/A
1
 
 1  
 package org.apache.maven.index.context;
 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.lucene.document.Document;
 23  
 import org.apache.maven.index.ArtifactContext;
 24  
 import org.apache.maven.index.ArtifactInfo;
 25  
 import org.apache.maven.index.IndexerField;
 26  
 
 27  
 import java.io.IOException;
 28  
 import java.util.Collection;
 29  
 import java.util.List;
 30  
 
 31  
 /**
 32  
  * An index creator is responsible for storing and reading data to and from Lucene index.
 33  
  * 
 34  
  * @author Jason van Zyl
 35  
  * @see org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator
 36  
  * @see org.apache.maven.index.creator.JarFileContentsIndexCreator
 37  
  */
 38  
 public interface IndexCreator
 39  
 {
 40  
     /**
 41  
      * Returns IndexCreator ID, that has to be unique across all existing creators.
 42  
      * 
 43  
      * @return
 44  
      */
 45  
     String getId();
 46  
 
 47  
     /**
 48  
      * Returns list of IndexCreator IDs that this creator depends on. Needed to perform a topological sort on
 49  
      * IndexCreators to guarantee proper ordering of them, as some IndexCreators might rely on informations already
 50  
      * extracted by some other IndexCreator.
 51  
      * 
 52  
      * @return
 53  
      */
 54  
     List<String> getCreatorDependencies();
 55  
 
 56  
     /**
 57  
      * Returns the indexer fields that this IndexCreator introduces to index.
 58  
      * 
 59  
      * @return
 60  
      */
 61  
     Collection<IndexerField> getIndexerFields();
 62  
 
 63  
     /**
 64  
      * Populate an <code>ArtifactContext</code> with information about corresponding artifact.
 65  
      */
 66  
     void populateArtifactInfo( ArtifactContext artifactContext )
 67  
         throws IOException;
 68  
 
 69  
     /**
 70  
      * Update Lucene <code>Document</code> from a given <code>ArtifactInfo</code>.
 71  
      */
 72  
     void updateDocument( ArtifactInfo artifactInfo, Document document );
 73  
 
 74  
     /**
 75  
      * Update an <code>ArtifactInfo</code> from given Lucene <code>Document</code>.
 76  
      * 
 77  
      * @return true is artifact info has been updated
 78  
      */
 79  
     boolean updateArtifactInfo( Document document, ArtifactInfo artifactInfo );
 80  
 
 81  
 }