KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > backup > status > ListBackupStatus


1 /*
2  * BackupStatus.java
3  *
4  * Created on December 13, 2000, 6:52 AM
5  */

6
7 package com.sun.enterprise.config.backup.status;
8
9 import java.util.Date JavaDoc;
10 import java.io.File JavaDoc;
11 import java.io.FileInputStream JavaDoc;
12 import java.io.EOFException JavaDoc;
13 import com.sun.enterprise.config.backup.BackupException;
14 import com.sun.enterprise.config.backup.utils.BackupHelper;
15 import com.sun.enterprise.config.backup.utils.FactoryHelper;
16
17 /**
18  * Backup Status is used to keep the status for
19  * the backup action.
20  * @author sridatta
21  */

22 public class ListBackupStatus extends BackupStatus {
23     
24     private String JavaDoc _tmpStringValue;
25     public ListBackupStatus(File JavaDoc f) throws BackupException {
26         init(f);
27     }
28     
29     /**
30      * NYI, needs to parse and initiate the objects fully
31      * Fixme
32      */

33     private void init(File JavaDoc f) throws BackupException {
34     /* setAbsoluteBackupFileName(f.getAbsolutePath());
35         _relativeName = f.getName();
36         initUserInfo(f);
37      */

38         //FIXME NYI
39
initStatusInfo(f);
40     }
41     
42     private void initStatusInfo(File JavaDoc file) {
43         FileInputStream JavaDoc fis = null;
44         String JavaDoc res = "";
45         File JavaDoc fReadMe = new File JavaDoc(file, FactoryHelper.getEnv().getStatusInfoFileName());
46         try {
47             fis = new FileInputStream JavaDoc(fReadMe);
48             byte[] buf = new byte[1000];
49             
50             int len = 0;
51             try {
52                 len = fis.read(buf, 0, buf.length);
53             } catch (EOFException JavaDoc eof) {
54             }
55             res = new String JavaDoc(buf).trim();
56             
57         } catch(Exception JavaDoc e) {
58         } finally {
59             try {
60                 fis.close();
61             } catch(Exception JavaDoc ex1) {}
62         }
63         _tmpStringValue = res;
64     }
65     /*
66     protected String thisToString() {
67         String res = super.thisToString();
68         
69         String userInfo = getUserInfo();
70         res += ", Backup Name=" + _relativeName;
71         
72         if(userInfo != null && !userInfo.equals("") ) {
73             res += ", User Info=" + userInfo;
74         }
75         return res;
76     }
77     
78      */

79     public String JavaDoc toString() {
80         return _tmpStringValue;
81     }
82 }
83
Popular Tags