View Javadoc
1   /*
2    * Copyright 2014 The Codehaus Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.codehaus.plexus.archiver.diags;
17  
18  import java.io.File;
19  import java.io.IOException;
20  import java.nio.charset.Charset;
21  import java.util.Collections;
22  import java.util.Map;
23  import javax.annotation.Nonnull;
24  import org.codehaus.plexus.archiver.ArchiveEntry;
25  import org.codehaus.plexus.archiver.ArchivedFileSet;
26  import org.codehaus.plexus.archiver.Archiver;
27  import org.codehaus.plexus.archiver.ArchiverException;
28  import org.codehaus.plexus.archiver.FileSet;
29  import org.codehaus.plexus.archiver.ResourceIterator;
30  import org.codehaus.plexus.components.io.resources.PlexusIoResource;
31  import org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection;
32  
33  /**
34   * An archiver that does nothing. Really.
35   */
36  @SuppressWarnings( "UnusedDeclaration" )
37  public class NoOpArchiver implements Archiver
38  {
39  
40      boolean useJvmChmod;
41  
42      private boolean ignorePermissions;
43  
44      @Override
45      public void createArchive()
46          throws ArchiverException, IOException
47      {
48  
49      }
50  
51      @Override
52      public void addDirectory( @Nonnull File directory )
53          throws ArchiverException
54      {
55  
56      }
57  
58      @Override
59      public void addDirectory( @Nonnull File directory, String prefix )
60          throws ArchiverException
61      {
62  
63      }
64  
65      @Override
66      public void addDirectory( @Nonnull File directory, String[] includes, String[] excludes )
67          throws ArchiverException
68      {
69  
70      }
71  
72      @Override
73      public void addDirectory( @Nonnull File directory, String prefix, String[] includes, String[] excludes )
74          throws ArchiverException
75      {
76  
77      }
78  
79      @Override
80      public void addFileSet( @Nonnull FileSet fileSet )
81          throws ArchiverException
82      {
83  
84      }
85  
86      @Override
87      public void addSymlink( String symlinkName, String symlinkDestination )
88          throws ArchiverException
89      {
90  
91      }
92  
93      @Override
94      public void addSymlink( String symlinkName, int permissions, String symlinkDestination )
95          throws ArchiverException
96      {
97  
98      }
99  
100     @Override
101     public void addFile( @Nonnull File inputFile, @Nonnull String destFileName )
102         throws ArchiverException
103     {
104 
105     }
106 
107     @Override
108     public void addFile( @Nonnull File inputFile, @Nonnull String destFileName, int permissions )
109         throws ArchiverException
110     {
111 
112     }
113 
114     @Override
115     public void addArchivedFileSet( @Nonnull File archiveFile )
116         throws ArchiverException
117     {
118 
119     }
120 
121     @Override
122     public void addArchivedFileSet( @Nonnull File archiveFile, String prefix )
123         throws ArchiverException
124     {
125 
126     }
127 
128     @Override
129     public void addArchivedFileSet( File archiveFile, String[] includes, String[] excludes )
130         throws ArchiverException
131     {
132 
133     }
134 
135     @Override
136     public void addArchivedFileSet( @Nonnull File archiveFile, String prefix, String[] includes, String[] excludes )
137         throws ArchiverException
138     {
139 
140     }
141 
142     @Override
143     public void addArchivedFileSet( ArchivedFileSet fileSet )
144         throws ArchiverException
145     {
146 
147     }
148 
149     @Override
150     public void addArchivedFileSet( ArchivedFileSet fileSet, Charset charset )
151         throws ArchiverException
152     {
153 
154     }
155 
156     @Override
157     public void addResource( PlexusIoResource resource, String destFileName, int permissions )
158         throws ArchiverException
159     {
160 
161     }
162 
163     @Override
164     public void addResources( PlexusIoResourceCollection resources )
165         throws ArchiverException
166     {
167 
168     }
169 
170     @Override
171     public File getDestFile()
172     {
173         return null;
174     }
175 
176     @Override
177     public void setDestFile( File destFile )
178     {
179 
180     }
181 
182     @Override
183     public void setFileMode( int mode )
184     {
185 
186     }
187 
188     @Override
189     public int getFileMode()
190     {
191         return 0;
192     }
193 
194     @Override
195     public int getOverrideFileMode()
196     {
197         return 0;
198     }
199 
200     @Override
201     public void setDefaultFileMode( int mode )
202     {
203 
204     }
205 
206     @Override
207     public int getDefaultFileMode()
208     {
209         return 0;
210     }
211 
212     @Override
213     public void setDirectoryMode( int mode )
214     {
215 
216     }
217 
218     @Override
219     public int getDirectoryMode()
220     {
221         return 0;
222     }
223 
224     @Override
225     public int getOverrideDirectoryMode()
226     {
227         return 0;
228     }
229 
230     @Override
231     public void setDefaultDirectoryMode( int mode )
232     {
233 
234     }
235 
236     @Override
237     public int getDefaultDirectoryMode()
238     {
239         return 0;
240     }
241 
242     @Override
243     public boolean getIncludeEmptyDirs()
244     {
245         return false;
246     }
247 
248     @Override
249     public void setIncludeEmptyDirs( boolean includeEmptyDirs )
250     {
251 
252     }
253 
254     @Override
255     public void setDotFileDirectory( File dotFileDirectory )
256     {
257 
258     }
259 
260     @Nonnull
261     @Override
262     public ResourceIterator getResources()
263         throws ArchiverException
264     {
265         return new ResourceIterator()
266         {
267 
268             @Override
269             public boolean hasNext()
270             {
271                 return false;
272             }
273 
274             @Override
275             public ArchiveEntry next()
276             {
277                 return null;
278             }
279 
280             @Override
281             public void remove()
282             {
283                 throw new UnsupportedOperationException( "remove" );
284             }
285 
286         };
287     }
288 
289     @Override
290     public Map<String, ArchiveEntry> getFiles()
291     {
292         return Collections.emptyMap();
293     }
294 
295     @Override
296     public boolean isForced()
297     {
298         return false;
299     }
300 
301     @Override
302     public void setForced( boolean forced )
303     {
304 
305     }
306 
307     @Override
308     public boolean isSupportingForced()
309     {
310         return false;
311     }
312 
313     @Override
314     public String getDuplicateBehavior()
315     {
316         return null;
317     }
318 
319     @Override
320     public void setDuplicateBehavior( String duplicate )
321     {
322 
323     }
324 
325     @Override
326     public void setUseJvmChmod( boolean useJvmChmod )
327     {
328         this.useJvmChmod = useJvmChmod;
329     }
330 
331     @Override
332     public boolean isUseJvmChmod()
333     {
334         return useJvmChmod;
335     }
336 
337     @Override
338     public boolean isIgnorePermissions()
339     {
340         return ignorePermissions;
341     }
342 
343     @Override
344     public void setIgnorePermissions( boolean ignorePermissions )
345     {
346         this.ignorePermissions = ignorePermissions;
347     }
348 
349 }