org.tranche.get
Class GetFileToolUtil

java.lang.Object
  extended by org.tranche.get.GetFileToolUtil

public class GetFileToolUtil
extends java.lang.Object

Contains methods that are commonly used along with or at several points within the GetFileTool class.

Author:
Bryan E. Smith - bryanesmith@gmail.com, James "Augie" Hill - augman85@gmail.com

Method Summary
static java.lang.String getRegex(java.util.Set<ProjectFilePart> parts)
          Returns the regular expression that corresponds with all of the given project file parts in the set.
static void registerDownload(GetFileTool gft, GetFileToolReport report)
          Sends a notification via an HTTP POST to a web server that a successful download has occurred.
static void registerFailedDownload(GetFileTool gft, GetFileToolReport report)
          Registers a failed download only if configured to do so.
static void testDirectoryForWritability(java.io.File directory)
          Checks whether the given directory can be written to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRegex

public static java.lang.String getRegex(java.util.Set<ProjectFilePart> parts)

Returns the regular expression that corresponds with all of the given project file parts in the set.

Parameters:
parts -
Returns:

testDirectoryForWritability

public static void testDirectoryForWritability(java.io.File directory)
                                        throws java.lang.Exception

Checks whether the given directory can be written to.

Parameters:
directory -
Throws:
java.lang.Exception

registerDownload

public static void registerDownload(GetFileTool gft,
                                    GetFileToolReport report)

Sends a notification via an HTTP POST to a web server that a successful download has occurred.

The URL to send the notification to must be set using the GetFileToolUtil.setURL(String url) method for this action to be performed.

A Thread with minimum priority is spawned to handle this event, so this method is asynchronous.

Parameters:
gft -
report -

registerFailedDownload

public static void registerFailedDownload(GetFileTool gft,
                                          GetFileToolReport report)

Registers a failed download only if configured to do so.

Parameters:
gft -
report -


This code is free for use both commercially and non-commercially as stated in the project's license