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 21 import org.codehaus.plexus.components.io.filemappers.FileMapper; 22 import org.codehaus.plexus.components.io.fileselectors.FileSelector; 23 24 public interface UnArchiver { 25 /** 26 * Extract the archive. 27 * 28 * @throws ArchiverException 29 */ 30 void extract() throws ArchiverException; 31 32 /** 33 * Take a path into the archive and extract it to the specified directory. 34 * 35 * @param path Path inside the archive to be extracted. 36 * @param outputDirectory Directory to extract to. 37 * 38 * @throws ArchiverException 39 */ 40 void extract(String path, File outputDirectory) throws ArchiverException; 41 42 File getDestDirectory(); 43 44 void setDestDirectory(File destDirectory); 45 46 // todo What is this? If you're extracting isn't it always to a directory. I think it would be cool to extract an 47 // archive to another archive but I don't think we support this right now. 48 File getDestFile(); 49 50 void setDestFile(File destFile); 51 52 File getSourceFile(); 53 54 void setSourceFile(File sourceFile); 55 56 /** 57 * Gets a flag indicating destination files are always overwritten. 58 * 59 * @return {@code true}, if destination files are overwritten, even if they are newer than the corresponding entry 60 * in the archive. 61 * 62 * @since 3.4 63 */ 64 boolean isOverwrite(); 65 66 /** 67 * Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive? 68 */ 69 void setOverwrite(boolean b); 70 71 /** 72 * Get chain of components which rewrite the target path of each unpacked file. 73 * 74 * @return {@link FileMapper}s to be used for rewriting each target path, or {@code null} if no rewriting shall happen. 75 * 76 * @since 3.7.0 77 */ 78 FileMapper[] getFileMappers(); 79 80 /*** 81 * Sets chain of components to be used for rewriting target path of each unpacked file. 82 * 83 * @param fileMappers {@link FileMapper} to be used for rewriting each target path, or {@code null} if no 84 * rewriting shall happen. 85 * 86 * @since 3.7.0 87 */ 88 void setFileMappers(FileMapper[] fileMappers); 89 90 /** 91 * Sets a set of {@link FileSelector} instances, which may be used to select the files to extract from the archive. 92 * If file selectors are present, then a file is only extracted, if it is confirmed by all file selectors. 93 */ 94 void setFileSelectors(FileSelector[] selectors); 95 96 /** 97 * Returns a set of {@link FileSelector} instances, which may be used to select the files to extract from the 98 * archive. If file selectors are present, then a file is only extracted, if it is confirmed by all file selectors. 99 */ 100 FileSelector[] getFileSelectors(); 101 102 /** 103 * to use or not the jvm method for file permissions: user all <b>not active for group permissions</b> 104 * 105 * @since 1.1 106 * @param useJvmChmod 107 * @deprecated this setting is now ignored. The jvm is always used. 108 */ 109 @Deprecated 110 void setUseJvmChmod(boolean useJvmChmod); 111 112 /** 113 * @since 1.1 114 * @return 115 * @deprecated this setting is now ignored. The jvm is always used. 116 */ 117 @Deprecated 118 boolean isUseJvmChmod(); 119 120 /** 121 * @since 1.1 122 */ 123 boolean isIgnorePermissions(); 124 125 /** 126 * @since 1.1 127 */ 128 void setIgnorePermissions(final boolean ignorePermissions); 129 }