View Javadoc
1   /**
2    *
3    * Copyright 2004 The Apache Software Foundation
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    * http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.codehaus.plexus.archiver;
18  
19  import java.io.File;
20  import org.codehaus.plexus.components.io.fileselectors.FileSelector;
21  
22  public interface UnArchiver
23  {
24  
25      String ROLE = UnArchiver.class.getName();
26  
27      /**
28       * Extract the archive.
29       *
30       * @throws ArchiverException
31       */
32      void extract()
33          throws ArchiverException;
34  
35      /**
36       * Take a patch into the archive and extract it to the specified directory.
37       *
38       * @param path Path inside the archive to be extracted.
39       * @param outputDirectory Directory to extract to.
40       *
41       * @throws ArchiverException
42       */
43      void extract( String path, File outputDirectory )
44          throws ArchiverException;
45  
46      File getDestDirectory();
47  
48      void setDestDirectory( File destDirectory );
49  
50      // todo What is this? If you're extracting isn't it always to a directory. I think it would be cool to extract an
51      // archive to another archive but I don't think we support this right now.
52      File getDestFile();
53  
54      void setDestFile( File destFile );
55  
56      File getSourceFile();
57  
58      void setSourceFile( File sourceFile );
59  
60      /**
61       * Gets a flag indicating destination files are always overwritten.
62       *
63       * @return {@code true}, if destination files are overwritten, even if they are newer than the corresponding entry
64       * in the archive.
65       *
66       * @since 3.4
67       */
68      boolean isOverwrite();
69  
70      /**
71       * Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?
72       */
73      void setOverwrite( boolean b );
74  
75      /**
76       * Sets a set of {@link FileSelector} instances, which may be used to select the files to extract from the archive.
77       * If file selectors are present, then a file is only extracted, if it is confirmed by all file selectors.
78       */
79      void setFileSelectors( FileSelector[] selectors );
80  
81      /**
82       * Returns a set of {@link FileSelector} instances, which may be used to select the files to extract from the
83       * archive. If file selectors are present, then a file is only extracted, if it is confirmed by all file selectors.
84       */
85      FileSelector[] getFileSelectors();
86  
87      /**
88       * to use or not the jvm method for file permissions : user all <b>not active for group permissions</b>
89       *
90       * @since 1.1
91       * @param useJvmChmod
92       * @deprecated this setting is now ignored. The jvm is always used.
93       */
94      @Deprecated
95      void setUseJvmChmod( boolean useJvmChmod );
96  
97      /**
98       * @since 1.1
99       * @return
100      * @deprecated this setting is now ignored. The jvm is always used.
101      */
102     @Deprecated
103     boolean isUseJvmChmod();
104 
105     /**
106      * @since 1.1
107      */
108     boolean isIgnorePermissions();
109 
110     /**
111      * @since 1.1
112      */
113     void setIgnorePermissions( final boolean ignorePermissions );
114 
115 }