Package com.dtolabs.rundeck.core.common
Class UpdateUtils
- java.lang.Object
-
- com.dtolabs.rundeck.core.common.UpdateUtils
-
public class UpdateUtils extends java.lang.Object
UpdateUtils providesupdateFileFromUrl(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
Nested Classes Modifier and Type Class Description static class
UpdateUtils.UpdateException
An exception caused by the UpdateUtils methods.
-
Constructor Summary
Constructors Constructor Description UpdateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 filestatic void
updateFileFromFile(java.io.File sourceFile, java.lang.String destinationFilePath)
Get the source File and store it to a destination file pathstatic void
updateFileFromInputStream(java.io.InputStream input, java.lang.String destinationFilePath)
Get the source URL and store it to a destination file pathstatic void
updateFileFromUrl(java.lang.String sourceUrl, java.lang.String destinationFilePath)
Get the source URL and store it to a destination file pathstatic 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 pathstatic 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
-
-
-
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
- urldestinationFilePath
- destination- Throws:
UpdateUtils.UpdateException
- on error
-
updateFileFromFile
public static void updateFileFromFile(java.io.File sourceFile, java.lang.String destinationFilePath) throws UpdateUtils.UpdateException
Get the source File and store it to a destination file path- Parameters:
sourceFile
- sourcedestinationFilePath
- destination- Throws:
UpdateUtils.UpdateException
- on error
-
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:
input
- input streamdestinationFilePath
- destination- Throws:
UpdateUtils.UpdateException
- on error
-
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
- urldestinationFilePath
- destinationusername
- usernamepassword
- password- Throws:
UpdateUtils.UpdateException
- on error
-
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
- urldestinationFilePath
- destinationusername
- usernamepassword
- passwordfactory
- updater factory- Throws:
UpdateUtils.UpdateException
- on error
-
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- Parameters:
updater
- updaterdestFile
- destination- Throws:
UpdateUtils.UpdateException
- on error
-
-