org.rhq.enterprise.agent
Class AgentUpdateDownload

java.lang.Object
  extended by org.rhq.enterprise.agent.AgentUpdateDownload

public class AgentUpdateDownload
extends Object

Downloads the agent update binary from the server, if one is available.

Author:
John Mazzitelli

Constructor Summary
AgentUpdateDownload(AgentMain agent)
           
 
Method Summary
 void download()
          Downloads the agent update binary and stores it to the local file system.
 File getAgentUpdateBinaryFile()
          If the agent update binary has been downloaded, this will return the file where the downloaded content was stored.
 AgentUpdateVersion getAgentUpdateVersion()
           
 URL getDownloadUrl()
          Returns the URL that will be accessed to download the agent update binary.
 File getLocalDownloadDirectory()
          Returns the location on the local file system where any downloaded files will be stored.
 void validate()
          This will validate the MD5 of the downloaded binary file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentUpdateDownload

public AgentUpdateDownload(AgentMain agent)
Method Detail

getAgentUpdateVersion

public AgentUpdateVersion getAgentUpdateVersion()

getDownloadUrl

public URL getDownloadUrl()
                   throws Exception
Returns the URL that will be accessed to download the agent update binary.

Returns:
download URL
Throws:
Exception - if for some reason a valid URL could not be obtained

getAgentUpdateBinaryFile

public File getAgentUpdateBinaryFile()
If the agent update binary has been downloaded, this will return the file where the downloaded content was stored.

Returns:
the file of the downloaded agent update binary; null if it was never downloaded

getLocalDownloadDirectory

public File getLocalDownloadDirectory()
Returns the location on the local file system where any downloaded files will be stored.

Returns:
local file system location where the downloaded files are stored

validate

public void validate()
              throws Exception
This will validate the MD5 of the downloaded binary file. If it validates, this method returns normally, otherwise, an exception is thrown. You must first download the file first before calling this method.

Throws:
Exception - if the downloaded agent update binary file does not validate with the expected MD5, or the agent update binary has not been downloaded yet.

download

public void download()
              throws Exception
Downloads the agent update binary and stores it to the local file system.

Throws:
Exception - if agent has disabled updates or it failed to download the update


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.