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