KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > backup > FeatureFactory


1 /*
2  * EnvironmentFactory.java
3  *
4  * Created on December 15, 2003, 10:33 PM
5  */

6
7 package com.sun.enterprise.config.backup;
8
9 import com.sun.enterprise.config.backup.utils.LoggerHelper;
10 import java.util.logging.Logger JavaDoc;
11 import com.sun.enterprise.config.backup.status.StatusConstants;
12 import com.sun.enterprise.config.backup.BackupStorageMonitor;
13 import com.sun.enterprise.config.backup.HistoryManager;
14
15 import com.sun.enterprise.config.backup.EnvironmentConstants;
16
17
18 /**
19  * provides a basic implementation of factory. Users can
20  * extend this class and implement required methods and set their
21  * class in environment variable ENVIRONMENT_FACTORY_CLASS. The
22  * statis create method in this class reads the variable and
23  * instantiates the class. Note that the implemented factory
24  * needs a no arg constructor.
25  *
26  * @author sridatta
27  */

28 public class FeatureFactory implements StatusConstants, EnvironmentConstants {
29     
30     private static HistoryManager _HM = null;
31     private static BackupStorageMonitor _MBM = null;
32     private static SnapShotStorageMonitor _MSM = null;
33     
34     public static synchronized HistoryManager getHistoryManager()
35                                     throws BackupException {
36         if(_HM == null)
37             _HM = createHistoryManager();
38         
39         return _HM;
40     }
41     private static HistoryManager createHistoryManager()
42                                 throws BackupException {
43         return new HistoryManager();
44     }
45     
46     public static synchronized BackupStorageMonitor getBackupStorageMonitor()
47                                         throws BackupException {
48         
49         if(_MBM == null)
50             _MBM = createBackupStorageMonitor();
51         
52         return _MBM;
53     }
54     
55     private static BackupStorageMonitor createBackupStorageMonitor()
56                                 throws BackupException {
57         return new BackupStorageMonitor();
58     }
59     
60     public static synchronized SnapShotStorageMonitor getSnapShotStorageMonitor()
61                                         throws BackupException {
62         
63         if(_MSM == null)
64             _MSM = createSnapShotStorageMonitor();
65         
66         return _MSM;
67     }
68     
69     private static SnapShotStorageMonitor createSnapShotStorageMonitor()
70                                 throws BackupException {
71         return new SnapShotStorageMonitor();
72     }
73     
74     /*
75     public static synchronized BackupDeleteHandler getBackupDeleteHandler()
76                                         {
77         
78         if(_DH == null)
79             _DH = createBackupDeleteHandler();
80         
81         return _DH;
82     }
83      */

84     
85     /*private static BackupDeleteHandler createBackupDeleteHandler()
86                                 {
87         return new BackupDeleteHandler();
88     }
89      */

90 }
Popular Tags