EMMA Coverage Report (generated Sun Apr 20 22:38:01 CEST 2008)
[all classes][net.sf.jomic.tools]

COVERAGE SUMMARY FOR SOURCE FILE [CopyDirTask.java]

nameclass, %method, %block, %line, %
CopyDirTask.java0%   (0/1)0%   (0/3)0%   (0/62)0%   (0/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CopyDirTask0%   (0/1)0%   (0/3)0%   (0/62)0%   (0/13)
CopyDirTask (File, CopyFileTask []): void 0%   (0/1)0%   (0/21)0%   (0/5)
CopyDirTask (File, File): void 0%   (0/1)0%   (0/8)0%   (0/2)
start (): void 0%   (0/1)0%   (0/33)0%   (0/6)

1// Jomic - a viewer for comic book archives.
2// Copyright (C) 2004-2008 Thomas Aglassinger
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16package net.sf.jomic.tools;
17 
18import java.io.File;
19 
20import net.sf.wraplog.Logger;
21 
22/**
23 *  Task to recursively copy all files and directories in <code>newSourceDir</code> to <code>newTargetDir</code>
24 *  .
25 *
26 * @author    Thomas Aglassinger
27 */
28public class CopyDirTask extends NestedTask
29{
30    private boolean allCopied;
31    private FileTools fileTools;
32    private Logger logger = Logger.getLogger(CopyDirTask.class);
33    private File targetDir;
34 
35    public CopyDirTask(File newSourceDir, File newTargetDir) {
36        this(newTargetDir, FileTools.instance().createCopyDirTasks(newSourceDir, newTargetDir));
37    }
38 
39    private CopyDirTask(File newTargetDir, CopyFileTask[] copyFileTasks) {
40        super(copyFileTasks);
41        fileTools = FileTools.instance();
42        targetDir = newTargetDir;
43    }
44 
45    public void start()
46        throws Exception {
47        allCopied = false;
48        try {
49            start();
50            allCopied = true;
51        } finally {
52            if (!allCopied) {
53                fileTools.attemptToDeleteAll(targetDir, logger);
54            }
55        }
56    }
57}

[all classes][net.sf.jomic.tools]
EMMA 2.0.4217 (C) Vladimir Roubtsov