View Javadoc
1   package org.apache.maven.index.updater;
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  
24  import org.apache.maven.index.context.DocumentFilter;
25  import org.apache.maven.index.context.IndexingContext;
26  import org.apache.maven.index.fs.Locker;
27  
28  /**
29   * Request to update indexes.
30   * 
31   * @author Eugene Kuleshov
32   * @author cstamas
33   */
34  public class IndexUpdateRequest
35  {
36      private final IndexingContext context;
37  
38      private final ResourceFetcher resourceFetcher;
39  
40      private DocumentFilter documentFilter;
41  
42      private boolean forceFullUpdate;
43      
44      private boolean incrementalOnly;
45  
46      private File indexTempDir;
47  
48      private File localIndexCacheDir;
49  
50      private Locker locker;
51  
52      private boolean offline;
53  
54      private boolean cacheOnly;
55  
56      private FSDirectoryFactory directoryFactory;
57  
58      private int threads;
59  
60      public IndexUpdateRequest( final IndexingContext context, final ResourceFetcher resourceFetcher )
61      {
62          assert context != null : "Context to be updated cannot be null!";
63          assert resourceFetcher != null : "ResourceFetcher has to be provided!";
64  
65          this.context = context;
66          this.resourceFetcher = resourceFetcher;
67          this.forceFullUpdate = false;
68          this.incrementalOnly = false;
69          this.threads = 1;
70      }
71  
72      public IndexingContext getIndexingContext()
73      {
74          return context;
75      }
76  
77      public ResourceFetcher getResourceFetcher()
78      {
79          return resourceFetcher;
80      }
81  
82      public DocumentFilter getDocumentFilter()
83      {
84          return documentFilter;
85      }
86  
87      public void setDocumentFilter( DocumentFilter documentFilter )
88      {
89          this.documentFilter = documentFilter;
90      }
91  
92      public void setForceFullUpdate( boolean forceFullUpdate )
93      {
94          this.forceFullUpdate = forceFullUpdate;
95      }
96  
97      public boolean isForceFullUpdate()
98      {
99          return forceFullUpdate;
100     }
101     
102     public boolean isIncrementalOnly()
103     {
104         return incrementalOnly;
105     }
106 
107     public void setIncrementalOnly( boolean incrementalOnly )
108     {
109         this.incrementalOnly = incrementalOnly;
110     }
111 
112     public File getLocalIndexCacheDir()
113     {
114         return localIndexCacheDir;
115     }
116 
117     public void setLocalIndexCacheDir( File dir )
118     {
119         this.localIndexCacheDir = dir;
120     }
121 
122     public Locker getLocker()
123     {
124         return locker;
125     }
126 
127     public void setLocker( Locker locker )
128     {
129         this.locker = locker;
130     }
131 
132     public void setOffline( boolean offline )
133     {
134         this.offline = offline;
135     }
136 
137     public boolean isOffline()
138     {
139         return offline;
140     }
141 
142     public void setCacheOnly( boolean cacheOnly )
143     {
144         this.cacheOnly = cacheOnly;
145     }
146 
147     public boolean isCacheOnly()
148     {
149         return cacheOnly;
150     }
151 
152     public void setFSDirectoryFactory( FSDirectoryFactory factory )
153     {
154         this.directoryFactory = factory;
155     }
156 
157     public FSDirectoryFactory getFSDirectoryFactory()
158     {
159         return directoryFactory != null ? directoryFactory : FSDirectoryFactory.DEFAULT;
160     }
161 
162     public void setIndexTempDir( File indexTempDir )
163     {
164         this.indexTempDir = indexTempDir;
165     }
166 
167     public File getIndexTempDir()
168     {
169         return indexTempDir;
170     }
171 
172     public int getThreads()
173     {
174         return threads;
175     }
176 
177     public void setThreads( int threads )
178     {
179         this.threads = threads;
180     }
181 }