com.dtolabs.rundeck.core.common.impl
Class URLFileUpdater

java.lang.Object
  extended by com.dtolabs.rundeck.core.common.impl.URLFileUpdater
All Implemented Interfaces:
FileUpdater

public class URLFileUpdater
extends java.lang.Object
implements FileUpdater

URLUpdater updates a file by getting the contents of a url, with optional caching, and mime type accept header.


Nested Class Summary
static class URLFileUpdater.Factory
          Factory for constructing URLFileUpdater with basic settings
static interface URLFileUpdater.httpClientInteraction
          Interface for interaction with HTTPClient api, or mock instance.
 
Field Summary
static java.lang.String CONTENT_TYPE
           
static int DEFAULT_TIMEOUT
           
static java.lang.String E_TAG
           
static URLFileUpdater.Factory FACTORY
           
static java.lang.String IF_MODIFIED_SINCE
           
static java.lang.String IF_NONE_MATCH
           
static java.lang.String LAST_MODIFIED
           
 
Constructor Summary
URLFileUpdater(java.net.URL url, java.lang.String acceptHeader, int timeout, java.io.File cacheMetadataFile, java.io.File cachedContent, boolean useCaching, java.lang.String username, java.lang.String password)
          Create a URLUpdater
 
Method Summary
static URLFileUpdaterFactory factory()
          Return a URLFileUpdaterFactory for constructing the FileUpdater
 java.lang.String getContentType()
           
 java.lang.String getReasonCode()
           
 int getResultCode()
           
 void setInteraction(URLFileUpdater.httpClientInteraction interaction)
           
 void updateFile(java.io.File destinationFile)
          Update the destination file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
See Also:
Constant Field Values

E_TAG

public static final java.lang.String E_TAG
See Also:
Constant Field Values

IF_NONE_MATCH

public static final java.lang.String IF_NONE_MATCH
See Also:
Constant Field Values

LAST_MODIFIED

public static final java.lang.String LAST_MODIFIED
See Also:
Constant Field Values

IF_MODIFIED_SINCE

public static final java.lang.String IF_MODIFIED_SINCE
See Also:
Constant Field Values

DEFAULT_TIMEOUT

public static final int DEFAULT_TIMEOUT
See Also:
Constant Field Values

FACTORY

public static final URLFileUpdater.Factory FACTORY
Constructor Detail

URLFileUpdater

public URLFileUpdater(java.net.URL url,
                      java.lang.String acceptHeader,
                      int timeout,
                      java.io.File cacheMetadataFile,
                      java.io.File cachedContent,
                      boolean useCaching,
                      java.lang.String username,
                      java.lang.String password)
Create a URLUpdater

Parameters:
url - the URL
acceptHeader - contents of accept header, or null
timeout - in seconds, -1 means use the default timeout, and 0 means no timeout
cacheMetadataFile - file to store cache metadata
cachedContent - file containing previously cached content
useCaching -
username -
password -
Method Detail

setInteraction

public void setInteraction(URLFileUpdater.httpClientInteraction interaction)

factory

public static URLFileUpdaterFactory factory()
Return a URLFileUpdaterFactory for constructing the FileUpdater


updateFile

public void updateFile(java.io.File destinationFile)
                throws FileUpdaterException
Description copied from interface: FileUpdater
Update the destination file.

Specified by:
updateFile in interface FileUpdater
Throws:
FileUpdaterException

getContentType

public java.lang.String getContentType()

getResultCode

public int getResultCode()

getReasonCode

public java.lang.String getReasonCode()