com.dtolabs.rundeck.core.common
Class UpdateUtils

java.lang.Object
  extended by com.dtolabs.rundeck.core.common.UpdateUtils

public class UpdateUtils
extends java.lang.Object

UpdateUtils provides updateFileFromUrl(String, String) to GET a file from remote URL and store it to a file. This utility will provide locks and synchronization to prevent two threads or jvms from overwriting the destination file at the same time, and will use last modification time from the source URL to skip URL acquisition based on file modification time.


Nested Class Summary
static class UpdateUtils.UpdateException
          An exception caused by the UpdateUtils methods.
 
Constructor Summary
UpdateUtils()
           
 
Method Summary
static void update(FileUpdater updater, java.io.File destFile)
          Update a destination file with an updater implementation, while maintaining appropriate locks around the action and file
static void updateFileFromFile(java.io.File sourceFile, java.lang.String destinationFilePath)
          Get the source URL and store it to a destination file path
static void updateFileFromInputStream(java.io.InputStream input, java.lang.String destinationFilePath)
          Get the source URL and store it to a destination file path
static void updateFileFromUrl(java.lang.String sourceUrl, java.lang.String destinationFilePath)
          Get the source URL and store it to a destination file path
static void updateFileFromUrl(java.lang.String sourceUrl, java.lang.String destinationFilePath, java.lang.String username, java.lang.String password)
          Get the source URL and store it to a destination file path
static void updateFileFromUrl(java.lang.String sourceUrl, java.lang.String destinationFilePath, java.lang.String username, java.lang.String password, URLFileUpdaterFactory factory)
          Get the source URL and store it to a destination file path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateUtils

public UpdateUtils()
Method Detail

updateFileFromUrl

public static void updateFileFromUrl(java.lang.String sourceUrl,
                                     java.lang.String destinationFilePath)
                              throws UpdateUtils.UpdateException
Get the source URL and store it to a destination file path

Parameters:
sourceUrl -
destinationFilePath -
Throws:
UpdateUtils.UpdateException

updateFileFromFile

public static void updateFileFromFile(java.io.File sourceFile,
                                      java.lang.String destinationFilePath)
                               throws UpdateUtils.UpdateException
Get the source URL and store it to a destination file path

Parameters:
sourceUrl -
destinationFilePath -
Throws:
UpdateUtils.UpdateException

updateFileFromInputStream

public static void updateFileFromInputStream(java.io.InputStream input,
                                             java.lang.String destinationFilePath)
                                      throws UpdateUtils.UpdateException
Get the source URL and store it to a destination file path

Parameters:
sourceUrl -
destinationFilePath -
Throws:
UpdateUtils.UpdateException

updateFileFromUrl

public static void updateFileFromUrl(java.lang.String sourceUrl,
                                     java.lang.String destinationFilePath,
                                     java.lang.String username,
                                     java.lang.String password)
                              throws UpdateUtils.UpdateException
Get the source URL and store it to a destination file path

Parameters:
sourceUrl -
destinationFilePath -
username -
password -
Throws:
UpdateUtils.UpdateException

updateFileFromUrl

public static void updateFileFromUrl(java.lang.String sourceUrl,
                                     java.lang.String destinationFilePath,
                                     java.lang.String username,
                                     java.lang.String password,
                                     URLFileUpdaterFactory factory)
                              throws UpdateUtils.UpdateException
Get the source URL and store it to a destination file path

Parameters:
sourceUrl -
destinationFilePath -
username -
password -
Throws:
UpdateUtils.UpdateException

update

public static void update(FileUpdater updater,
                          java.io.File destFile)
                   throws UpdateUtils.UpdateException
Update a destination file with an updater implementation, while maintaining appropriate locks around the action and file

Throws:
UpdateUtils.UpdateException