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      public IndexUpdateRequest( final IndexingContext context, final ResourceFetcher resourceFetcher )
59      {
60          assert context != null : "Context to be updated cannot be null!";
61          assert resourceFetcher != null : "ResourceFetcher has to be provided!";
62  
63          this.context = context;
64          this.resourceFetcher = resourceFetcher;
65          this.forceFullUpdate = false;
66          this.incrementalOnly = false;
67      }
68  
69      public IndexingContext getIndexingContext()
70      {
71          return context;
72      }
73  
74      public ResourceFetcher getResourceFetcher()
75      {
76          return resourceFetcher;
77      }
78  
79      public DocumentFilter getDocumentFilter()
80      {
81          return documentFilter;
82      }
83  
84      public void setDocumentFilter( DocumentFilter documentFilter )
85      {
86          this.documentFilter = documentFilter;
87      }
88  
89      public void setForceFullUpdate( boolean forceFullUpdate )
90      {
91          this.forceFullUpdate = forceFullUpdate;
92      }
93  
94      public boolean isForceFullUpdate()
95      {
96          return forceFullUpdate;
97      }
98      
99      public boolean isIncrementalOnly()
100     {
101         return incrementalOnly;
102     }
103 
104     public void setIncrementalOnly( boolean incrementalOnly )
105     {
106         this.incrementalOnly = incrementalOnly;
107     }
108 
109     public File getLocalIndexCacheDir()
110     {
111         return localIndexCacheDir;
112     }
113 
114     public void setLocalIndexCacheDir( File dir )
115     {
116         this.localIndexCacheDir = dir;
117     }
118 
119     public Locker getLocker()
120     {
121         return locker;
122     }
123 
124     public void setLocker( Locker locker )
125     {
126         this.locker = locker;
127     }
128 
129     public void setOffline( boolean offline )
130     {
131         this.offline = offline;
132     }
133 
134     public boolean isOffline()
135     {
136         return offline;
137     }
138 
139     public void setCacheOnly( boolean cacheOnly )
140     {
141         this.cacheOnly = cacheOnly;
142     }
143 
144     public boolean isCacheOnly()
145     {
146         return cacheOnly;
147     }
148 
149     public void setFSDirectoryFactory( FSDirectoryFactory factory )
150     {
151         this.directoryFactory = factory;
152     }
153 
154     public FSDirectoryFactory getFSDirectoryFactory()
155     {
156         return directoryFactory != null ? directoryFactory : FSDirectoryFactory.DEFAULT;
157     }
158 
159     public void setIndexTempDir( File indexTempDir )
160     {
161         this.indexTempDir = indexTempDir;
162     }
163 
164     public File getIndexTempDir()
165     {
166         return indexTempDir;
167     }
168 }