Coverage Report - org.apache.maven.index.packer.IndexPackingRequest
 
Classes in this File Line Coverage Branch Coverage Complexity
IndexPackingRequest
86 %
26/30
N/A
1
IndexPackingRequest$IndexFormat
100 %
2/2
N/A
1
 
 1  
 package org.apache.maven.index.packer;
 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.io.File;
 23  
 import java.util.Arrays;
 24  
 import java.util.Collection;
 25  
 
 26  
 import org.apache.maven.index.context.IndexingContext;
 27  
 
 28  
 /**
 29  
  * An index packing request.
 30  
  */
 31  
 public class IndexPackingRequest
 32  
 {
 33  
     private static final int MAX_CHUNKS = 30;
 34  
 
 35  
     private IndexingContext context;
 36  
 
 37  
     private File targetDir;
 38  
 
 39  
     private boolean createIncrementalChunks;
 40  
 
 41  
     private boolean createChecksumFiles;
 42  
 
 43  
     private int maxIndexChunks;
 44  
 
 45  
     private boolean useTargetProperties;
 46  
 
 47  
     private Collection<IndexFormat> formats;
 48  
 
 49  
     public IndexPackingRequest( IndexingContext context, File targetDir )
 50  178
     {
 51  178
         this.context = context;
 52  
 
 53  178
         this.targetDir = targetDir;
 54  
 
 55  178
         this.createIncrementalChunks = true;
 56  
 
 57  178
         this.createChecksumFiles = false;
 58  
 
 59  178
         this.maxIndexChunks = MAX_CHUNKS;
 60  
 
 61  178
         this.useTargetProperties = false;
 62  
 
 63  178
         this.formats = Arrays.asList( IndexFormat.FORMAT_LEGACY, IndexFormat.FORMAT_V1 );
 64  178
     }
 65  
 
 66  
     public IndexingContext getContext()
 67  
     {
 68  1402
         return context;
 69  
     }
 70  
 
 71  
     public void setContext( IndexingContext context )
 72  
     {
 73  0
         this.context = context;
 74  0
     }
 75  
 
 76  
     /**
 77  
      * Sets index formats to be created
 78  
      */
 79  
     public void setFormats( Collection<IndexFormat> formats )
 80  
     {
 81  8
         this.formats = formats;
 82  8
     }
 83  
 
 84  
     /**
 85  
      * Returns index formats to be created.
 86  
      */
 87  
     public Collection<IndexFormat> getFormats()
 88  
     {
 89  392
         return formats;
 90  
     }
 91  
 
 92  
     public File getTargetDir()
 93  
     {
 94  1419
         return targetDir;
 95  
     }
 96  
 
 97  
     public void setTargetDir( File targetDir )
 98  
     {
 99  0
         this.targetDir = targetDir;
 100  0
     }
 101  
 
 102  
     public boolean isCreateIncrementalChunks()
 103  
     {
 104  159
         return createIncrementalChunks;
 105  
     }
 106  
 
 107  
     public void setCreateIncrementalChunks( boolean createIncrementalChunks )
 108  
     {
 109  164
         this.createIncrementalChunks = createIncrementalChunks;
 110  164
     }
 111  
 
 112  
     public boolean isCreateChecksumFiles()
 113  
     {
 114  602
         return createChecksumFiles;
 115  
     }
 116  
 
 117  
     public void setCreateChecksumFiles( boolean createChecksumFiles )
 118  
     {
 119  7
         this.createChecksumFiles = createChecksumFiles;
 120  7
     }
 121  
 
 122  
     public int getMaxIndexChunks()
 123  
     {
 124  20
         return maxIndexChunks;
 125  
     }
 126  
 
 127  
     public void setMaxIndexChunks( int maxIndexChunks )
 128  
     {
 129  2
         this.maxIndexChunks = maxIndexChunks;
 130  2
     }
 131  
 
 132  
     public boolean isUseTargetProperties()
 133  
     {
 134  196
         return useTargetProperties;
 135  
     }
 136  
 
 137  
     public void setUseTargetProperties( boolean useTargetProperties )
 138  
     {
 139  8
         this.useTargetProperties = useTargetProperties;
 140  8
     }
 141  
 
 142  
     /**
 143  
      * Index format enumeration.
 144  
      */
 145  3
     public static enum IndexFormat
 146  
     {
 147  1
         FORMAT_LEGACY, FORMAT_V1;
 148  
     }
 149  
 }