KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > backup > pluggable > impl > DirectoryStorage


1 /*
2  * DirectoryStorage.java
3  *
4  * Created on December 19, 2003, 11:39 PM
5  */

6
7 package com.sun.enterprise.config.backup.pluggable.impl;
8
9 import java.io.*;
10 import java.util.*;
11
12 import com.sun.enterprise.util.io.FileUtils;
13 import com.sun.enterprise.util.StringUtils;
14 import com.sun.enterprise.config.backup.pluggable.BackupStorage;
15 import com.sun.enterprise.config.backup.utils.FactoryHelper;
16 import com.sun.enterprise.config.backup.utils.LoggerHelper;
17 import com.sun.enterprise.config.backup.BackupException;
18 import com.sun.enterprise.config.backup.DefaultConstants;
19 import com.sun.enterprise.config.backup.status.Status;
20
21 /**
22  *
23  * @author bnevins
24  */

25
26 public class DirectoryStorage extends GenericStorage
27 {
28     long copyFiles(File fromDir, File toDir) throws BackupException
29     {
30         toDir.mkdirs();
31         LoggerHelper.fine("Writing to " + toDir.getPath());
32         
33         try
34         {
35             FileUtils.copyTree(fromDir, toDir);
36             //return FileUtils.getLastCopyTreeTotalBytes();
37
return 100;
38         }
39         catch(IOException ioe)
40         {
41             throw new BackupException("backup error", "IOException copying "
42             + fromDir.getPath() + " to " + toDir.getPath(), ioe);
43         }
44     }
45 }
46
Popular Tags