CacheMonitorRouter monitor = Transit.getInstance().getCacheMonitorRouter();
    private boolean download( ResourceHost host, Artifact artifact, File destination )        throws IOException, TransitException    {        if( host == null )        {            return false;        }        File parentDir = destination.getParentFile();        File tempFile = File.createTempFile( "~dpml", ".tmp", parentDir );        tempFile.deleteOnExit(); // safety harness in case we abort abnormally                                 // like a Ctrl-C.        FileOutputStream tempOut = new FileOutputStream( tempFile );        CacheMonitorRouter monitor = Transit.getInstance().getCacheMonitorRouter();        try        {            Date lastModified = host.download( artifact, tempOut );            // An atomic operation and no risk of a corrupted            // artifact content.            tempFile.renameTo( destination );            destination.setLastModified( lastModified.getTime() );            return true;        }        catch( IOException e )        {            tempFile.delete();            if( monitor != null )            {                monitor.failedDownloadFromHost( host.toString(), artifact, e );            }            return false;        }    }