KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > backup > appserver > Util


1 /*
2  * Util.java
3  *
4  * Created on December 21, 2003, 12:30 AM
5  */

6
7 package com.sun.enterprise.config.backup.appserver;
8 import java.io.*;
9 import java.util.*;
10 import com.sun.enterprise.config.backup.BackupRestore;
11 import com.sun.enterprise.config.backup.BackupRestoreImpl;
12 import com.sun.enterprise.config.backup.status.StatusConstants;
13
14
15 /**
16  *
17  * @author sridatta
18  */

19 public class Util {
20     private static final String JavaDoc BACKUP_ENVIRONMENT_PATH =
21       "/com/sun/enterprise/config/backup/appserver/BackupEnvironment.properties";
22     
23     /** Creates a new instance of Util */
24     public Util() {
25     }
26     
27      private static void loadProperties() throws Exception JavaDoc {
28          try {
29             InputStream i = Util.class.getResourceAsStream( BACKUP_ENVIRONMENT_PATH );
30             Properties p = new Properties();
31             p.load(i);
32             
33             if(p == null) return;
34
35             //set here.
36
// System.out.println("System Properties=" + p);
37
} catch (Exception JavaDoc io) {
38             //fail
39
//io.printStackTrace();
40
throw new RuntimeException JavaDoc("ERROR in loading properties", io);
41         }
42     }
43      
44      static BackupRestore getBackupRestore() {
45          try {
46            loadProperties();
47             return new BackupRestoreImpl(StatusConstants.TYPE_OFFLINE);
48         } catch(Exception JavaDoc e) {
49            // e.printStackTrace();
50
throw new RuntimeException JavaDoc("ERROR creating BackupRestoreImpl", e);
51         }
52      }
53 }
54
Popular Tags