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