1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  package org.apache.maven.index.packer;
20  
21  import java.io.File;
22  import java.util.Arrays;
23  import java.util.Collection;
24  
25  import org.apache.lucene.index.IndexReader;
26  import org.apache.maven.index.context.IndexingContext;
27  
28  import static java.util.Objects.requireNonNull;
29  
30  
31  
32  
33  public class IndexPackingRequest {
34      public static final int MAX_CHUNKS = 30;
35  
36      private final IndexingContext context;
37  
38      private final IndexReader indexReader;
39  
40      private final File targetDir;
41  
42      private boolean createIncrementalChunks;
43  
44      private boolean createChecksumFiles;
45  
46      private int maxIndexChunks;
47  
48      private boolean useTargetProperties;
49  
50      private Collection<IndexFormat> formats;
51  
52      public IndexPackingRequest(final IndexingContext context, final IndexReader indexReader, final File targetDir) {
53          this.context = requireNonNull(context);
54  
55          this.indexReader = requireNonNull(indexReader);
56  
57          this.targetDir = requireNonNull(targetDir);
58  
59          this.createIncrementalChunks = true;
60  
61          this.createChecksumFiles = false;
62  
63          this.maxIndexChunks = MAX_CHUNKS;
64  
65          this.useTargetProperties = false;
66  
67          this.formats = Arrays.asList(IndexFormat.FORMAT_V1);
68      }
69  
70      public IndexingContext getContext() {
71          return context;
72      }
73  
74      public IndexReader getIndexReader() {
75          return indexReader;
76      }
77  
78      
79  
80  
81      public void setFormats(Collection<IndexFormat> formats) {
82          this.formats = formats;
83      }
84  
85      
86  
87  
88      public Collection<IndexFormat> getFormats() {
89          return formats;
90      }
91  
92      public File getTargetDir() {
93          return targetDir;
94      }
95  
96      public boolean isCreateIncrementalChunks() {
97          return createIncrementalChunks;
98      }
99  
100     public void setCreateIncrementalChunks(boolean createIncrementalChunks) {
101         this.createIncrementalChunks = createIncrementalChunks;
102     }
103 
104     public boolean isCreateChecksumFiles() {
105         return createChecksumFiles;
106     }
107 
108     public void setCreateChecksumFiles(boolean createChecksumFiles) {
109         this.createChecksumFiles = createChecksumFiles;
110     }
111 
112     public int getMaxIndexChunks() {
113         return maxIndexChunks;
114     }
115 
116     public void setMaxIndexChunks(int maxIndexChunks) {
117         this.maxIndexChunks = maxIndexChunks;
118     }
119 
120     public boolean isUseTargetProperties() {
121         return useTargetProperties;
122     }
123 
124     public void setUseTargetProperties(boolean useTargetProperties) {
125         this.useTargetProperties = useTargetProperties;
126     }
127 
128     
129 
130 
131     public enum IndexFormat {
132         FORMAT_V1
133     }
134 }