org.fuin.kickstart4j
Class SrcFile

java.lang.Object
  extended by org.fuin.kickstart4j.AbstractFile
      extended by org.fuin.kickstart4j.SrcFile
All Implemented Interfaces:
org.fuin.utils4j.ToDebugStringCapable

public final class SrcFile
extends AbstractFile
implements org.fuin.utils4j.ToDebugStringCapable

A file at the source directory. This class is immutable.


Field Summary
static java.lang.String UNZIP_TOKEN
          Token used to mark archives to be unzipped at the target location.
 
Constructor Summary
SrcFile(java.io.File baseDir, java.io.File file, boolean unzip, boolean loadAlways, boolean addToClasspath, java.lang.String srcFileUrl)
          Constructor with base directory and file.
SrcFile(SrcFile srcFile, java.io.File file)
          Copy-Constructor with source file and local file.
SrcFile(java.lang.String path, java.lang.String filename, java.lang.String md5Hash, long size, boolean unzip, boolean loadAlways, boolean addToClasspath, java.lang.String srcFileUrl, int order)
          Constructor with all arguments.
 
Method Summary
 int getOrder()
          Returns the order the files should be installed or updated.
 long getSize()
          Returns the size of the file.
 int getSizeAsInt()
          Returns the size as integer value.
 java.lang.String getSrcFileUrl()
          Returns the URL where the source file is located.
 java.net.URL getSrcFileURL()
          Returns the URL where the source file is located.
 boolean isAddToClasspath()
          Returns if this is a JAR file to be added to the classpath.
 boolean isLoadAlways()
          Returns if this file sould be loaded always (no matter if lazy loading is enabled or not).
 boolean isUnzip()
          Returns if the file is an atchive and should be decompressed at the target location.
 java.lang.String toDebugString()
          
 java.lang.String toString()
          
 java.lang.String toXML()
          Creates an XML representation of the object.
 
Methods inherited from class org.fuin.kickstart4j.AbstractFile
equals, getCanonicalPathAndFilename, getDestFile, getFilename, getMd5Hash, getPath, getRelativeSlashPathAndFilename, getSlashPath, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNZIP_TOKEN

public static final java.lang.String UNZIP_TOKEN
Token used to mark archives to be unzipped at the target location.

See Also:
Constant Field Values
Constructor Detail

SrcFile

public SrcFile(java.io.File baseDir,
               java.io.File file,
               boolean unzip,
               boolean loadAlways,
               boolean addToClasspath,
               java.lang.String srcFileUrl)
Constructor with base directory and file.

Parameters:
baseDir - Base directory for calculating the relative path.
file - File inside the base directory.
unzip - If the file is an archive and should be decompressed at the target location true else false.
loadAlways - Load file always (no matter if lazy loading is enabled or not).
addToClasspath - JAR file to be added to the classpath.
srcFileUrl - URL where the source file is located.

SrcFile

public SrcFile(java.lang.String path,
               java.lang.String filename,
               java.lang.String md5Hash,
               long size,
               boolean unzip,
               boolean loadAlways,
               boolean addToClasspath,
               java.lang.String srcFileUrl,
               int order)
Constructor with all arguments.

Parameters:
path - Path relative to the base directory.
filename - Filename without path.
md5Hash - MD5 hash code of the file.
size - Size of the file.
unzip - If the file is an archive and should be decompressed at the target location true else false.
loadAlways - Load file always (no matter if lazy loading is enabled or not).
addToClasspath - JAR file to be added to the classpath.
srcFileUrl - URL where the source file is located.
order - Order the files should be updated or installed.

SrcFile

public SrcFile(SrcFile srcFile,
               java.io.File file)
Copy-Constructor with source file and local file.

Parameters:
srcFile - Source file to copy values from (except hash and file size).
file - File to create hash for and get file size from.
Method Detail

getSize

public final long getSize()
Returns the size of the file.

Returns:
File size.

getSizeAsInt

public final int getSizeAsInt()
Returns the size as integer value. If the size is greater than Integer.MAX_VALUE is returned.

Returns:
Size.

isUnzip

public final boolean isUnzip()
Returns if the file is an atchive and should be decompressed at the target location.

Returns:
Unzip the file at the destination directory true else false

isAddToClasspath

public final boolean isAddToClasspath()
Returns if this is a JAR file to be added to the classpath.

Returns:
If added to the classpath true else false.

isLoadAlways

public final boolean isLoadAlways()
Returns if this file sould be loaded always (no matter if lazy loading is enabled or not).

Returns:
If loaded always true else false.

getSrcFileUrl

public final java.lang.String getSrcFileUrl()
Returns the URL where the source file is located.

Returns:
URL (as String).

getSrcFileURL

public final java.net.URL getSrcFileURL()
Returns the URL where the source file is located. A MalformedURLException is wrapped into a RuntimeException.

Returns:
URL.

getOrder

public final int getOrder()
Returns the order the files should be installed or updated.

Returns:
Number starting with 0 (default).

toXML

public final java.lang.String toXML()
Creates an XML representation of the object.

Returns:
XML for element "file"

toString

public final java.lang.String toString()

Overrides:
toString in class java.lang.Object

toDebugString

public final java.lang.String toDebugString()

Specified by:
toDebugString in interface org.fuin.utils4j.ToDebugStringCapable


Copyright © 2010 Future Invent Informationsmanagement GmbH. All Rights Reserved.