org.fuin.kickstart4j
Class SrcFileLoader

java.lang.Object
  extended by org.fuin.kickstart4j.SrcFileLoader
All Implemented Interfaces:
FileLoader

public final class SrcFileLoader
extends java.lang.Object
implements FileLoader

Supports loading files defined in a update set into a local directory.


Constructor Summary
SrcFileLoader()
          Default constructor.
SrcFileLoader(Config config)
          Constructor with configuration.
SrcFileLoader(java.lang.String configPathAndFilename)
          Constructor with configuration path and filename.
SrcFileLoader(java.net.URL configFileURL)
          Constructor with URL.
 
Method Summary
 void deleteFile(java.lang.String path, java.lang.String filename)
          Delete a file in the given directory.
 void deletePath(java.lang.String path)
          Delete all files in the given directory.
 Config getConfig()
          Returns the configuration.
 java.io.File loadFile(java.lang.String path, java.lang.String filename)
          Loads a file from a source into a local directory.If the file is already up to date nothing will be copied.
 java.io.File loadFile(java.lang.String path, java.lang.String filename, org.fuin.utils4swing.progress.FileCopyProgressListener listener)
          Loads a file from a source into a local directory.If the file is already up to date nothing will be copied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SrcFileLoader

public SrcFileLoader()
              throws InvalidConfigException
Default constructor. Assumes the configuration file is named "application.xml" and is located in the current directory.

Throws:
InvalidConfigException - Cannot read the configuration XML file.

SrcFileLoader

public SrcFileLoader(java.lang.String configPathAndFilename)
              throws InvalidConfigException
Constructor with configuration path and filename.

Parameters:
configPathAndFilename - Path and filename of XML configuration.
Throws:
InvalidConfigException - Cannot read the configuration XML file.

SrcFileLoader

public SrcFileLoader(java.net.URL configFileURL)
              throws InvalidConfigException
Constructor with URL.

Parameters:
configFileURL - URL of the configuration file.
Throws:
InvalidConfigException - Error reading the file.

SrcFileLoader

public SrcFileLoader(Config config)
Constructor with configuration.

Parameters:
config - Configuration.
Method Detail

getConfig

public final Config getConfig()
Returns the configuration.

Returns:
Configuration used for loading the files.

loadFile

public java.io.File loadFile(java.lang.String path,
                             java.lang.String filename)
                      throws LoadingFileException
Loads a file from a source into a local directory.If the file is already up to date nothing will be copied.

Specified by:
loadFile in interface FileLoader
Parameters:
path - Path inside the current directory.
filename - Filename (without path).
Returns:
File reference.
Throws:
LoadingFileException - Loading the file failed for some reason.

loadFile

public java.io.File loadFile(java.lang.String path,
                             java.lang.String filename,
                             org.fuin.utils4swing.progress.FileCopyProgressListener listener)
                      throws LoadingFileException
Loads a file from a source into a local directory.If the file is already up to date nothing will be copied.

Specified by:
loadFile in interface FileLoader
Parameters:
path - Path inside the current directory.
filename - Filename (without path).
listener - Listener to inform about progress - Can be null if no progress information is needed.
Returns:
File reference.
Throws:
LoadingFileException - Loading the file failed for some reason.

deleteFile

public final void deleteFile(java.lang.String path,
                             java.lang.String filename)
                      throws DeleteException
Delete a file in the given directory.

Specified by:
deleteFile in interface FileLoader
Parameters:
path - Path inside the current directory - Cannot be null but may be empty.
filename - Filename (without path) - Cannot be null or empty
Throws:
DeleteException - There was a problem deleting the file.

deletePath

public final void deletePath(java.lang.String path)
                      throws DeleteException
Delete all files in the given directory.

Specified by:
deletePath in interface FileLoader
Parameters:
path - Path inside the current directory - Cannot be null or empty (it's not allowed to delete the base directory!=.
Throws:
DeleteException - There was a problem deleting the files.


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