1 package org.codehaus.mojo.truezip; 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 org.codehaus.plexus.util.StringUtils; 23 24 import de.schlichtherle.truezip.file.TFile; 25 26 /** 27 * Taken from assembly maven plugin 28 */ 29 public class FileItem 30 { 31 /** 32 * The absolute path of source 33 */ 34 private String source; 35 36 /** 37 * Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put 38 * the specified files in the log directory. 39 */ 40 private String outputDirectory = ""; 41 42 /** 43 * Sets the destination filename in the outputDirectory. Default is the same name as the source's file. 44 */ 45 private String destName; 46 47 /** 48 * Similar to a UNIX permission, sets the file mode of the files included. Format: (User)(Group)(Other) where each 49 * component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User 50 * read-write, Group and Other read-only. <a 51 * href="http://www.onlamp.com/pub/a/bsd/2000/09/06/FreeBSD_Basics.html">(more on unix-style permissions)</a> 52 */ 53 54 private String fileMode; 55 56 /** 57 * Sets the line-endings of the files in this file. Valid values are: 58 * <ul> 59 * <li><b>"keep"</b> - Preserve all line endings</li> 60 * <li><b>"unix"</b> - Use Unix-style line endings</li> 61 * <li><b>"lf"</b> - Use a single line-feed line endings</li> 62 * <li><b>"dos"</b> - Use DOS-style line endings</li> 63 * <li><b>"crlf"</b> - Use Carraige-return, line-feed line endings</li> 64 * </ul> 65 */ 66 67 private String lineEnding; 68 69 /** 70 * Sets whether to determine if the file is filtered. 71 */ 72 private boolean filtered; 73 74 public String getSource() 75 { 76 return source; 77 } 78 79 public void setSource( String source ) 80 { 81 this.source = source; 82 } 83 84 public String getOutputDirectory() 85 { 86 return outputDirectory; 87 } 88 89 public void setOutputDirectory( String outputDirectory ) 90 { 91 this.outputDirectory = outputDirectory; 92 } 93 94 public String getDestName() 95 { 96 return destName; 97 } 98 99 public void setDestName( String destName ) 100 { 101 this.destName = destName; 102 } 103 104 public String getFileMode() 105 { 106 return fileMode; 107 } 108 109 public void setFileMode( String fileMode ) 110 { 111 this.fileMode = fileMode; 112 } 113 114 public String getLineEnding() 115 { 116 return lineEnding; 117 } 118 119 public void setLineEnding( String lineEnding ) 120 { 121 this.lineEnding = lineEnding; 122 } 123 124 public boolean isFiltered() 125 { 126 return filtered; 127 } 128 129 public void setFiltered( boolean filtered ) 130 { 131 this.filtered = filtered; 132 } 133 134 /** 135 * return destination path 136 * 137 * @return 138 */ 139 public String getDestinationPath() 140 { 141 if ( this.destName == null ) 142 { 143 this.destName = new TFile( source ).getName(); 144 } 145 146 if ( StringUtils.isBlank( this.outputDirectory ) ) 147 { 148 return this.destName; 149 } 150 151 return this.outputDirectory + "/" + this.destName; 152 } 153 154 }