org.codehaus.mojo.truezip.FileItem Maven / Gradle / Ivy
package org.codehaus.mojo.truezip;
import org.codehaus.plexus.util.StringUtils;
import de.schlichtherle.io.File;
/**
* Taken from assembly maven plugin
*
*/
public class FileItem
{
/**
* The absolute path of source
*/
private String source;
/**
* Sets the output directory relative to the root
* of the root directory of the assembly. For example,
* "log" will put the specified files in the log directory.
*/
private String outputDirectory = "";
/**
* Sets the destination filename in the outputDirectory.
* Default is the same name as the source's file.
*/
private String destName;
/**
* Similar to a UNIX permission, sets the file mode of the files included.
* Format: (User)(Group)(Other) where each component is a sum of Read = 4,
* Write = 2, and Execute = 1. For example, the value 0644
* translates to User read-write, Group and Other read-only.
* (more on unix-style permissions)
*/
private String fileMode;
/**
*
* Sets the line-endings of the files in this file.
* Valid values are:
*
* - "keep" - Preserve all line endings
* - "unix" - Use Unix-style line endings
* - "lf" - Use a single line-feed line endings
* - "dos" - Use DOS-style line endings
* - "crlf" - Use Carraige-return, line-feed line endings
*
*/
private String lineEnding;
/**
* Sets whether to determine if the file is filtered.
*/
private boolean filtered;
public String getSource()
{
return source;
}
public void setSource( String source )
{
this.source = source;
}
public String getOutputDirectory()
{
return outputDirectory;
}
public void setOutputDirectory( String outputDirectory )
{
this.outputDirectory = outputDirectory;
}
public String getDestName()
{
return destName;
}
public void setDestName( String destName )
{
this.destName = destName;
}
public String getFileMode()
{
return fileMode;
}
public void setFileMode( String fileMode )
{
this.fileMode = fileMode;
}
public String getLineEnding()
{
return lineEnding;
}
public void setLineEnding( String lineEnding )
{
this.lineEnding = lineEnding;
}
public boolean isFiltered()
{
return filtered;
}
public void setFiltered( boolean filtered )
{
this.filtered = filtered;
}
/**
* return destination path
* @return
*/
public String getDestinationPath()
{
if ( this.destName == null )
{
this.destName = new File( source ).getName();
}
if ( StringUtils.isBlank( this.outputDirectory ) )
{
return this.destName;
}
return this.outputDirectory + "/" + this.destName;
}
}