View Javadoc

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      {
51          this.context = context;
52  
53          this.targetDir = targetDir;
54  
55          this.createIncrementalChunks = true;
56  
57          this.createChecksumFiles = false;
58  
59          this.maxIndexChunks = MAX_CHUNKS;
60  
61          this.useTargetProperties = false;
62  
63          this.formats = Arrays.asList( IndexFormat.FORMAT_LEGACY, IndexFormat.FORMAT_V1 );
64      }
65  
66      public IndexingContext getContext()
67      {
68          return context;
69      }
70  
71      public void setContext( IndexingContext context )
72      {
73          this.context = context;
74      }
75  
76      /**
77       * Sets index formats to be created
78       */
79      public void setFormats( Collection<IndexFormat> formats )
80      {
81          this.formats = formats;
82      }
83  
84      /**
85       * Returns index formats to be created.
86       */
87      public Collection<IndexFormat> getFormats()
88      {
89          return formats;
90      }
91  
92      public File getTargetDir()
93      {
94          return targetDir;
95      }
96  
97      public void setTargetDir( File targetDir )
98      {
99          this.targetDir = targetDir;
100     }
101 
102     public boolean isCreateIncrementalChunks()
103     {
104         return createIncrementalChunks;
105     }
106 
107     public void setCreateIncrementalChunks( boolean createIncrementalChunks )
108     {
109         this.createIncrementalChunks = createIncrementalChunks;
110     }
111 
112     public boolean isCreateChecksumFiles()
113     {
114         return createChecksumFiles;
115     }
116 
117     public void setCreateChecksumFiles( boolean createChecksumFiles )
118     {
119         this.createChecksumFiles = createChecksumFiles;
120     }
121 
122     public int getMaxIndexChunks()
123     {
124         return maxIndexChunks;
125     }
126 
127     public void setMaxIndexChunks( int maxIndexChunks )
128     {
129         this.maxIndexChunks = maxIndexChunks;
130     }
131 
132     public boolean isUseTargetProperties()
133     {
134         return useTargetProperties;
135     }
136 
137     public void setUseTargetProperties( boolean useTargetProperties )
138     {
139         this.useTargetProperties = useTargetProperties;
140     }
141 
142     /**
143      * Index format enumeration.
144      */
145     public static enum IndexFormat
146     {
147         FORMAT_LEGACY, FORMAT_V1;
148     }
149 }