root / src / gZFS / zserver.java @ 28
Historique | Voir | Annoter | Télécharger (16,32 ko)
1 | 14 | kreverch | package gZFS; |
---|---|---|---|
2 | 14 | kreverch | |
3 | 14 | kreverch | import java.io.File; |
4 | 14 | kreverch | import java.io.FileInputStream; |
5 | 14 | kreverch | import java.io.FileNotFoundException; |
6 | 14 | kreverch | import java.io.FileOutputStream; |
7 | 14 | kreverch | import java.io.IOException; |
8 | 14 | kreverch | import java.util.ArrayList; |
9 | 14 | kreverch | import java.util.Arrays; |
10 | 14 | kreverch | import java.util.Hashtable; |
11 | 14 | kreverch | import java.util.List; |
12 | 14 | kreverch | import java.util.Properties; |
13 | 14 | kreverch | |
14 | 14 | kreverch | import org.apache.log4j.Logger; |
15 | 14 | kreverch | |
16 | 14 | kreverch | |
17 | 14 | kreverch | public class zserver { |
18 | 14 | kreverch | private Logger log = Logger.getLogger(getClass().getPackage().getName()+" "+getClass().getCanonicalName()); |
19 | 14 | kreverch | public Hashtable<String,zProperties> zProperties = new Hashtable<String, zProperties>(); |
20 | 14 | kreverch | zserver(){ |
21 | 14 | kreverch | List<Object> permitValueServerIP = new ArrayList<Object>(); |
22 | 14 | kreverch | zProperties zPropertyServerIP = new zProperties();
|
23 | 14 | kreverch | permitValueServerIP.clear(); |
24 | 14 | kreverch | zPropertyServerIP.setNameProperty("serverIP");
|
25 | 14 | kreverch | zPropertyServerIP.setLabelProperty("Address IP or Server Name");
|
26 | 14 | kreverch | zPropertyServerIP.setType("freeentry");
|
27 | 14 | kreverch | zPropertyServerIP.setValue("");
|
28 | 14 | kreverch | zPropertyServerIP.setPermitValue(null);
|
29 | 14 | kreverch | zProperties.put("serverIP", zPropertyServerIP);
|
30 | 14 | kreverch | |
31 | 14 | kreverch | List<Object> permitValueUserLogin = new ArrayList<Object>(); |
32 | 14 | kreverch | zProperties zPropertyUserLogin = new zProperties();
|
33 | 14 | kreverch | permitValueServerIP.clear(); |
34 | 14 | kreverch | zPropertyUserLogin.setNameProperty("userLogin");
|
35 | 14 | kreverch | zPropertyUserLogin.setLabelProperty("User Login");
|
36 | 14 | kreverch | zPropertyUserLogin.setType("freeentry");
|
37 | 14 | kreverch | zPropertyUserLogin.setValue("");
|
38 | 14 | kreverch | zPropertyUserLogin.setPermitValue(null);
|
39 | 14 | kreverch | zProperties.put("userLogin", zPropertyUserLogin);
|
40 | 14 | kreverch | |
41 | 14 | kreverch | List<Object> permitValueUserPasswd = new ArrayList<Object>(); |
42 | 14 | kreverch | zProperties zPropertyUserPasswd = new zProperties();
|
43 | 14 | kreverch | permitValueUserPasswd.clear(); |
44 | 14 | kreverch | zPropertyUserPasswd.setNameProperty("userPasswd");
|
45 | 14 | kreverch | zPropertyUserPasswd.setLabelProperty("User Password");
|
46 | 14 | kreverch | zPropertyUserPasswd.setType("freeentry");
|
47 | 14 | kreverch | zPropertyUserPasswd.setValue("");
|
48 | 14 | kreverch | zPropertyUserPasswd.setPermitValue(null);
|
49 | 14 | kreverch | zProperties.put("userPasswd", zPropertyUserPasswd);
|
50 | 14 | kreverch | |
51 | 14 | kreverch | List<Object> permitValueZfsBinStatus = new ArrayList<Object>(); |
52 | 14 | kreverch | zProperties zPropertyZfsBinStatus = new zProperties();
|
53 | 14 | kreverch | permitValueZfsBinStatus.clear(); |
54 | 14 | kreverch | zPropertyZfsBinStatus.setNameProperty("binzfs");
|
55 | 14 | kreverch | zPropertyZfsBinStatus.setLabelProperty("Binary : ZFS");
|
56 | 14 | kreverch | zPropertyZfsBinStatus.setType("noupdateable");
|
57 | 14 | kreverch | zPropertyZfsBinStatus.setValue("");
|
58 | 14 | kreverch | zPropertyZfsBinStatus.setPermitValue(null);
|
59 | 14 | kreverch | zProperties.put("binzfs", zPropertyZfsBinStatus);
|
60 | 14 | kreverch | |
61 | 14 | kreverch | List<Object> permitValueBinZpool = new ArrayList<Object>(); |
62 | 14 | kreverch | zProperties zPropertyBinZpool = new zProperties();
|
63 | 14 | kreverch | permitValueBinZpool.clear(); |
64 | 14 | kreverch | zPropertyBinZpool.setNameProperty("binzpool");
|
65 | 14 | kreverch | zPropertyBinZpool.setLabelProperty("Binary : Zpool");
|
66 | 14 | kreverch | zPropertyBinZpool.setType("noupdateable");
|
67 | 14 | kreverch | zPropertyBinZpool.setValue("");
|
68 | 14 | kreverch | zPropertyBinZpool.setPermitValue(null);
|
69 | 14 | kreverch | zProperties.put("binzpool", zPropertyBinZpool);
|
70 | 14 | kreverch | |
71 | 14 | kreverch | List<Object> permitValueIscsiGetConfBinStatus = new ArrayList<Object>(); |
72 | 14 | kreverch | zProperties zPropertyIscsiGetConfBinStatus = new zProperties();
|
73 | 14 | kreverch | permitValueIscsiGetConfBinStatus.clear(); |
74 | 14 | kreverch | zPropertyIscsiGetConfBinStatus.setNameProperty("biniscsigetconf");
|
75 | 14 | kreverch | zPropertyIscsiGetConfBinStatus.setLabelProperty("Tool : get ISCSI Configuration");
|
76 | 14 | kreverch | zPropertyIscsiGetConfBinStatus.setType("noupdateable");
|
77 | 14 | kreverch | zPropertyIscsiGetConfBinStatus.setValue("");
|
78 | 14 | kreverch | zPropertyIscsiGetConfBinStatus.setPermitValue(null);
|
79 | 14 | kreverch | zProperties.put("biniscsigetconf", zPropertyIscsiGetConfBinStatus);
|
80 | 14 | kreverch | |
81 | 14 | kreverch | List<Object> permitValueBinGetProvisionedSpace = new ArrayList<Object>(); |
82 | 14 | kreverch | zProperties zPropertyBinGetProvisionedSpace = new zProperties();
|
83 | 14 | kreverch | permitValueBinGetProvisionedSpace.clear(); |
84 | 14 | kreverch | zPropertyBinGetProvisionedSpace.setNameProperty("bingetprovisionedspace");
|
85 | 14 | kreverch | zPropertyBinGetProvisionedSpace.setLabelProperty("Tool : Provisionned Space");
|
86 | 14 | kreverch | zPropertyBinGetProvisionedSpace.setType("noupdateable");
|
87 | 14 | kreverch | zPropertyBinGetProvisionedSpace.setValue("");
|
88 | 14 | kreverch | zPropertyBinGetProvisionedSpace.setPermitValue(null);
|
89 | 14 | kreverch | zProperties.put("bingetprovisionedspace", zPropertyBinGetProvisionedSpace);
|
90 | 14 | kreverch | |
91 | 14 | kreverch | List<Object> permitValueGetConfSnapshot = new ArrayList<Object>(); |
92 | 14 | kreverch | zProperties zPropertyGetConfSnapshot = new zProperties();
|
93 | 14 | kreverch | permitValueGetConfSnapshot.clear(); |
94 | 14 | kreverch | zPropertyGetConfSnapshot.setNameProperty("bingetconfsnapshot");
|
95 | 14 | kreverch | zPropertyGetConfSnapshot.setLabelProperty("Tool : get Snapshot Configuration");
|
96 | 14 | kreverch | zPropertyGetConfSnapshot.setType("noupdateable");
|
97 | 14 | kreverch | zPropertyGetConfSnapshot.setValue("");
|
98 | 14 | kreverch | zPropertyGetConfSnapshot.setPermitValue(null);
|
99 | 14 | kreverch | zProperties.put("bingetconfsnapshot", zPropertyGetConfSnapshot);
|
100 | 14 | kreverch | |
101 | 14 | kreverch | |
102 | 14 | kreverch | List<Object> permitValueBinZfsSnapshots = new ArrayList<Object>(); |
103 | 14 | kreverch | zProperties zPropertyBinZfsSnapshots = new zProperties();
|
104 | 14 | kreverch | permitValueBinZfsSnapshots.clear(); |
105 | 14 | kreverch | zPropertyBinZfsSnapshots.setNameProperty("binzfssnapshots");
|
106 | 14 | kreverch | zPropertyBinZfsSnapshots.setLabelProperty("Tool : ZFS Snapshots");
|
107 | 14 | kreverch | zPropertyBinZfsSnapshots.setType("noupdateable");
|
108 | 14 | kreverch | zPropertyBinZfsSnapshots.setValue("");
|
109 | 14 | kreverch | zPropertyBinZfsSnapshots.setPermitValue(null);
|
110 | 14 | kreverch | zProperties.put("binzfssnapshots", zPropertyBinZfsSnapshots);
|
111 | 14 | kreverch | |
112 | 14 | kreverch | List<Object> permitValueBinZfsEnableSnapshots = new ArrayList<Object>(); |
113 | 14 | kreverch | zProperties zPropertyBinZfsEnableSnapshots = new zProperties();
|
114 | 14 | kreverch | permitValueBinZfsEnableSnapshots.clear(); |
115 | 14 | kreverch | zPropertyBinZfsEnableSnapshots.setNameProperty("binzfsenablesnapshots");
|
116 | 14 | kreverch | zPropertyBinZfsEnableSnapshots.setLabelProperty("Tool : Enable ZFS Snapshots");
|
117 | 14 | kreverch | zPropertyBinZfsEnableSnapshots.setType("noupdateable");
|
118 | 14 | kreverch | zPropertyBinZfsEnableSnapshots.setValue("");
|
119 | 14 | kreverch | zPropertyBinZfsEnableSnapshots.setPermitValue(null);
|
120 | 14 | kreverch | zProperties.put("binzfsenablesnapshots", zPropertyBinZfsEnableSnapshots);
|
121 | 14 | kreverch | |
122 | 14 | kreverch | List<Object> permitValueBinZfsDisableSnapshots = new ArrayList<Object>(); |
123 | 14 | kreverch | zProperties zPropertyBinZfsDisableSnapshots = new zProperties();
|
124 | 14 | kreverch | permitValueBinZfsDisableSnapshots.clear(); |
125 | 14 | kreverch | zPropertyBinZfsDisableSnapshots.setNameProperty("binzfsdisablesnapshots");
|
126 | 14 | kreverch | zPropertyBinZfsDisableSnapshots.setLabelProperty("Tool : Disable ZFS Snapshots");
|
127 | 14 | kreverch | zPropertyBinZfsDisableSnapshots.setType("noupdateable");
|
128 | 14 | kreverch | zPropertyBinZfsDisableSnapshots.setValue("");
|
129 | 14 | kreverch | zPropertyBinZfsDisableSnapshots.setPermitValue(null);
|
130 | 14 | kreverch | zProperties.put("binzfsdisablesnapshots", zPropertyBinZfsDisableSnapshots);
|
131 | 14 | kreverch | |
132 | 14 | kreverch | |
133 | 14 | kreverch | List<Object> permitValuePathZfsconfSnapshots = new ArrayList<Object>(); |
134 | 14 | kreverch | zProperties zPropertyPathZfsconfSnapshots = new zProperties();
|
135 | 14 | kreverch | permitValuePathZfsconfSnapshots.clear(); |
136 | 14 | kreverch | zPropertyPathZfsconfSnapshots.setNameProperty("pathzfsconfsnapshots");
|
137 | 14 | kreverch | zPropertyPathZfsconfSnapshots.setLabelProperty("Path : Snapshot Configuration File");
|
138 | 14 | kreverch | zPropertyPathZfsconfSnapshots.setType("noupdateable");
|
139 | 14 | kreverch | zPropertyPathZfsconfSnapshots.setValue("");
|
140 | 14 | kreverch | zPropertyPathZfsconfSnapshots.setPermitValue(null);
|
141 | 14 | kreverch | zProperties.put("pathzfsconfsnapshots", zPropertyPathZfsconfSnapshots);
|
142 | 14 | kreverch | |
143 | 14 | kreverch | List<Object> permitValuePathZfsConfTools = new ArrayList<Object>(); |
144 | 14 | kreverch | zProperties zPropertyPathZfsConfTools = new zProperties();
|
145 | 14 | kreverch | permitValuePathZfsConfTools.clear(); |
146 | 14 | kreverch | zPropertyPathZfsConfTools.setNameProperty("pathzfsconftools");
|
147 | 14 | kreverch | zPropertyPathZfsConfTools.setLabelProperty("Path : ZFS Tools");
|
148 | 14 | kreverch | zPropertyPathZfsConfTools.setType("noupdateable");
|
149 | 14 | kreverch | zPropertyPathZfsConfTools.setValue("");
|
150 | 14 | kreverch | zPropertyPathZfsConfTools.setPermitValue(null);
|
151 | 14 | kreverch | zProperties.put("pathzfsconftools", zPropertyPathZfsConfTools);
|
152 | 14 | kreverch | |
153 | 14 | kreverch | List<Object> permitValuePathZfsConf = new ArrayList<Object>(); |
154 | 14 | kreverch | zProperties zPropertyPathZfsConf = new zProperties();
|
155 | 14 | kreverch | permitValuePathZfsConf.clear(); |
156 | 14 | kreverch | zPropertyPathZfsConf.setNameProperty("pathzfsconf");
|
157 | 14 | kreverch | zPropertyPathZfsConf.setLabelProperty("Path : gZFS");
|
158 | 14 | kreverch | zPropertyPathZfsConf.setType("noupdateable");
|
159 | 14 | kreverch | zPropertyPathZfsConf.setValue("");
|
160 | 14 | kreverch | zPropertyPathZfsConf.setPermitValue(null);
|
161 | 14 | kreverch | zProperties.put("pathzfsconf", zPropertyPathZfsConf);
|
162 | 14 | kreverch | |
163 | 14 | kreverch | List<Object> permitValuePathZfsVolDevice = new ArrayList<Object>(); |
164 | 14 | kreverch | zProperties zPropertyPathZfsVolDevice = new zProperties();
|
165 | 14 | kreverch | permitValuePathZfsVolDevice.clear(); |
166 | 14 | kreverch | zPropertyPathZfsVolDevice.setNameProperty("pathzfsvoldevice");
|
167 | 14 | kreverch | zPropertyPathZfsVolDevice.setLabelProperty("Path : ZFS Volume Device");
|
168 | 14 | kreverch | zPropertyPathZfsVolDevice.setType("noupdateable");
|
169 | 14 | kreverch | zPropertyPathZfsVolDevice.setValue("");
|
170 | 14 | kreverch | zPropertyPathZfsVolDevice.setPermitValue(null);
|
171 | 14 | kreverch | zProperties.put("pathzfsvoldevice", zPropertyPathZfsVolDevice);
|
172 | 14 | kreverch | |
173 | 14 | kreverch | List<Object> permitValueBinZfsAddISCSI = new ArrayList<Object>(); |
174 | 14 | kreverch | zProperties zPropertyBinZfsAddISCSI = new zProperties();
|
175 | 14 | kreverch | permitValueBinZfsAddISCSI.clear(); |
176 | 14 | kreverch | zPropertyBinZfsAddISCSI.setNameProperty("binzfsaddiscsi");
|
177 | 14 | kreverch | zPropertyBinZfsAddISCSI.setLabelProperty("Tool : Create ISCSI Volume");
|
178 | 14 | kreverch | zPropertyBinZfsAddISCSI.setType("noupdateable");
|
179 | 14 | kreverch | zPropertyBinZfsAddISCSI.setValue("");
|
180 | 14 | kreverch | zPropertyBinZfsAddISCSI.setPermitValue(null);
|
181 | 14 | kreverch | zProperties.put("binzfsaddiscsi", zPropertyBinZfsAddISCSI);
|
182 | 14 | kreverch | |
183 | 14 | kreverch | List<Object> permitValueBinZfsDelISCSI = new ArrayList<Object>(); |
184 | 14 | kreverch | zProperties zPropertyBinZfsDelISCSI = new zProperties();
|
185 | 14 | kreverch | permitValueBinZfsDelISCSI.clear(); |
186 | 14 | kreverch | zPropertyBinZfsDelISCSI.setNameProperty("binzfsadelscsi");
|
187 | 14 | kreverch | zPropertyBinZfsDelISCSI.setLabelProperty("Tool : Delete ISCSI Volume");
|
188 | 14 | kreverch | zPropertyBinZfsDelISCSI.setType("noupdateable");
|
189 | 14 | kreverch | zPropertyBinZfsDelISCSI.setValue("");
|
190 | 14 | kreverch | zPropertyBinZfsDelISCSI.setPermitValue(null);
|
191 | 14 | kreverch | zProperties.put("binzfsdeliscsi", zPropertyBinZfsDelISCSI);
|
192 | 14 | kreverch | |
193 | 14 | kreverch | List<Object> permitValueBinZfsCreateVol = new ArrayList<Object>(); |
194 | 14 | kreverch | zProperties zPropertyBinZfsCreateVol = new zProperties();
|
195 | 14 | kreverch | permitValueBinZfsCreateVol.clear(); |
196 | 14 | kreverch | zPropertyBinZfsCreateVol.setNameProperty("binzfscreatevolume");
|
197 | 14 | kreverch | zPropertyBinZfsCreateVol.setLabelProperty("Tool : Create ZFS Volume");
|
198 | 14 | kreverch | zPropertyBinZfsCreateVol.setType("noupdateable");
|
199 | 14 | kreverch | zPropertyBinZfsCreateVol.setValue("");
|
200 | 14 | kreverch | zPropertyBinZfsCreateVol.setPermitValue(null);
|
201 | 14 | kreverch | zProperties.put("binzfscreatevolume", zPropertyBinZfsCreateVol);
|
202 | 14 | kreverch | |
203 | 14 | kreverch | List<Object> permitValueBinZfsCreateFS = new ArrayList<Object>(); |
204 | 14 | kreverch | zProperties zPropertyBinZfsCreateFS = new zProperties();
|
205 | 14 | kreverch | permitValueBinZfsCreateFS.clear(); |
206 | 14 | kreverch | zPropertyBinZfsCreateFS.setNameProperty("binzfscreatefilesystem");
|
207 | 14 | kreverch | zPropertyBinZfsCreateFS.setLabelProperty("Tool : Create ZFS FileSystem");
|
208 | 14 | kreverch | zPropertyBinZfsCreateFS.setType("noupdateable");
|
209 | 14 | kreverch | zPropertyBinZfsCreateFS.setValue("");
|
210 | 14 | kreverch | zPropertyBinZfsCreateFS.setPermitValue(null);
|
211 | 14 | kreverch | zProperties.put("binzfscreatefilesystem", zPropertyBinZfsCreateFS);
|
212 | 14 | kreverch | |
213 | 14 | kreverch | List<Object> permitValueBinZfsDelFS = new ArrayList<Object>(); |
214 | 14 | kreverch | zProperties zPropertyBinZfsDelFS = new zProperties();
|
215 | 14 | kreverch | permitValueBinZfsDelFS.clear(); |
216 | 14 | kreverch | zPropertyBinZfsDelFS.setNameProperty("binzfsdelfilesystem");
|
217 | 14 | kreverch | zPropertyBinZfsDelFS.setLabelProperty("Tool : Delete ZFS FileSystem");
|
218 | 14 | kreverch | zPropertyBinZfsDelFS.setType("noupdateable");
|
219 | 14 | kreverch | zPropertyBinZfsDelFS.setValue("");
|
220 | 14 | kreverch | zPropertyBinZfsDelFS.setPermitValue(null);
|
221 | 14 | kreverch | zProperties.put("binzfsdelfilesystem", zPropertyBinZfsDelFS);
|
222 | 14 | kreverch | |
223 | 14 | kreverch | List<Object> permitValueBinZfsDelVolume = new ArrayList<Object>(); |
224 | 14 | kreverch | zProperties zPropertyBinZfsDelVolume = new zProperties();
|
225 | 14 | kreverch | permitValueBinZfsDelVolume.clear(); |
226 | 14 | kreverch | zPropertyBinZfsDelVolume.setNameProperty("binzfsdelvolume");
|
227 | 14 | kreverch | zPropertyBinZfsDelVolume.setLabelProperty("Tool : Delete ZFS Volume");
|
228 | 14 | kreverch | zPropertyBinZfsDelVolume.setType("noupdateable");
|
229 | 14 | kreverch | zPropertyBinZfsDelVolume.setValue("");
|
230 | 14 | kreverch | zPropertyBinZfsDelVolume.setPermitValue(null);
|
231 | 14 | kreverch | zProperties.put("binzfsdelvolume", zPropertyBinZfsDelVolume);
|
232 | 14 | kreverch | |
233 | 14 | kreverch | List<Object> permitValueBinGetDiskInfo = new ArrayList<Object>(); |
234 | 14 | kreverch | zProperties zPropertyBinGetDiskInfo = new zProperties();
|
235 | 14 | kreverch | permitValueBinGetDiskInfo.clear(); |
236 | 14 | kreverch | zPropertyBinGetDiskInfo.setNameProperty("bingetdiskinfo");
|
237 | 14 | kreverch | zPropertyBinGetDiskInfo.setLabelProperty("Tool : Get Disk Informations");
|
238 | 14 | kreverch | zPropertyBinGetDiskInfo.setType("noupdateable");
|
239 | 14 | kreverch | zPropertyBinGetDiskInfo.setValue("");
|
240 | 14 | kreverch | zPropertyBinGetDiskInfo.setPermitValue(null);
|
241 | 14 | kreverch | zProperties.put("bingetdiskinfo", zPropertyBinGetDiskInfo);
|
242 | 14 | kreverch | |
243 | 14 | kreverch | List<Object> permitValueBinZFSClone = new ArrayList<Object>(); |
244 | 14 | kreverch | zProperties zPropertyBinZFSClone = new zProperties();
|
245 | 14 | kreverch | permitValueBinZFSClone.clear(); |
246 | 14 | kreverch | zPropertyBinZFSClone.setNameProperty("binzfsclone");
|
247 | 14 | kreverch | zPropertyBinZFSClone.setLabelProperty("Tool : ZFS Clone");
|
248 | 14 | kreverch | zPropertyBinZFSClone.setType("noupdateable");
|
249 | 14 | kreverch | zPropertyBinZFSClone.setValue("");
|
250 | 14 | kreverch | zPropertyBinZFSClone.setPermitValue(null);
|
251 | 14 | kreverch | zProperties.put("binzfsclone", zPropertyBinZFSClone);
|
252 | 14 | kreverch | |
253 | 14 | kreverch | List<Object> permitValueBinZpoolGetState = new ArrayList<Object>(); |
254 | 14 | kreverch | zProperties zPropertyBinZpoolGetState = new zProperties();
|
255 | 14 | kreverch | permitValueBinZpoolGetState.clear(); |
256 | 14 | kreverch | zPropertyBinZpoolGetState.setNameProperty("binzpoolgetstate");
|
257 | 14 | kreverch | zPropertyBinZpoolGetState.setLabelProperty("Tool : ZFS Clone");
|
258 | 14 | kreverch | zPropertyBinZpoolGetState.setType("noupdateable");
|
259 | 14 | kreverch | zPropertyBinZpoolGetState.setValue("");
|
260 | 14 | kreverch | zPropertyBinZpoolGetState.setPermitValue(null);
|
261 | 14 | kreverch | zProperties.put("binzpoolgetstate", zPropertyBinZpoolGetState);
|
262 | 14 | kreverch | |
263 | 14 | kreverch | List<Object> permitValueBinGetConfReplica = new ArrayList<Object>(); |
264 | 14 | kreverch | zProperties zPropertyBinGetConfReplica = new zProperties();
|
265 | 14 | kreverch | permitValueBinGetConfReplica.clear(); |
266 | 14 | kreverch | zPropertyBinGetConfReplica.setNameProperty("bingetconfreplica");
|
267 | 14 | kreverch | zPropertyBinGetConfReplica.setLabelProperty("Tool : ZFS Replication");
|
268 | 14 | kreverch | zPropertyBinGetConfReplica.setType("noupdateable");
|
269 | 14 | kreverch | zPropertyBinGetConfReplica.setValue("");
|
270 | 14 | kreverch | zPropertyBinGetConfReplica.setPermitValue(null);
|
271 | 14 | kreverch | zProperties.put("bingetconfreplica", zPropertyBinGetConfReplica);
|
272 | 14 | kreverch | |
273 | 14 | kreverch | List<Object> permitValueBinEnableReplica = new ArrayList<Object>(); |
274 | 14 | kreverch | zProperties zPropertyBinEnableReplica = new zProperties();
|
275 | 14 | kreverch | permitValueBinEnableReplica.clear(); |
276 | 14 | kreverch | zPropertyBinEnableReplica.setNameProperty("binzfsenablereplicas");
|
277 | 14 | kreverch | zPropertyBinEnableReplica.setLabelProperty("Tool :Enable ZFS Replication");
|
278 | 14 | kreverch | zPropertyBinEnableReplica.setType("noupdateable");
|
279 | 14 | kreverch | zPropertyBinEnableReplica.setValue("");
|
280 | 14 | kreverch | zPropertyBinEnableReplica.setPermitValue(null);
|
281 | 14 | kreverch | zProperties.put("binzfsenablereplicas", zPropertyBinEnableReplica);
|
282 | 14 | kreverch | |
283 | 14 | kreverch | List<Object> permitValueBinDisableReplica = new ArrayList<Object>(); |
284 | 14 | kreverch | zProperties zPropertyBinDisableReplica = new zProperties();
|
285 | 14 | kreverch | permitValueBinDisableReplica.clear(); |
286 | 14 | kreverch | zPropertyBinDisableReplica.setNameProperty("binzfsdisablereplicas");
|
287 | 14 | kreverch | zPropertyBinDisableReplica.setLabelProperty("Tool :Disable ZFS Replication");
|
288 | 14 | kreverch | zPropertyBinDisableReplica.setType("noupdateable");
|
289 | 14 | kreverch | zPropertyBinDisableReplica.setValue("");
|
290 | 14 | kreverch | zPropertyBinDisableReplica.setPermitValue(null);
|
291 | 14 | kreverch | zProperties.put("binzfsdisablereplicas", zPropertyBinDisableReplica);
|
292 | 14 | kreverch | |
293 | 14 | kreverch | List<Object> permitValueBinReplica = new ArrayList<Object>(); |
294 | 14 | kreverch | zProperties zPropertyBinReplica = new zProperties();
|
295 | 14 | kreverch | permitValueBinReplica.clear(); |
296 | 14 | kreverch | zPropertyBinReplica.setNameProperty("binzfsreplica");
|
297 | 14 | kreverch | zPropertyBinReplica.setLabelProperty("Tool : Binary ZFS Replication");
|
298 | 14 | kreverch | zPropertyBinReplica.setType("noupdateable");
|
299 | 14 | kreverch | zPropertyBinReplica.setValue("");
|
300 | 14 | kreverch | zPropertyBinReplica.setPermitValue(null);
|
301 | 14 | kreverch | zProperties.put("binzfsreplica", zPropertyBinReplica);
|
302 | 14 | kreverch | |
303 | 14 | kreverch | /*List<Object> permitValueBinDisableReplica = new ArrayList<Object>();
|
304 | 14 | kreverch | zProperties zPropertyBinDisableReplica = new zProperties();
|
305 | 14 | kreverch | permitValueBinDisableReplica.clear();
|
306 | 14 | kreverch | zPropertyBinDisableReplica.setNameProperty("binzfsdisablereplicas");
|
307 | 14 | kreverch | zPropertyBinDisableReplica.setLabelProperty("Tool :Disable ZFS Replication");
|
308 | 14 | kreverch | zPropertyBinDisableReplica.setType("noupdateable");
|
309 | 14 | kreverch | zPropertyBinDisableReplica.setValue("");
|
310 | 14 | kreverch | zPropertyBinDisableReplica.setPermitValue(null);
|
311 | 14 | kreverch | zProperties.put("binzfsdisablereplicas", zPropertyBinDisableReplica);*/
|
312 | 14 | kreverch | |
313 | 14 | kreverch | } |
314 | 14 | kreverch | |
315 | 14 | kreverch | |
316 | 14 | kreverch | public boolean add(String fileName){ |
317 | 14 | kreverch | |
318 | 14 | kreverch | try {
|
319 | 14 | kreverch | Properties prop = new Properties(); |
320 | 14 | kreverch | String[] keysProp = (String[])this.zProperties.keySet().toArray(new String[0]); |
321 | 14 | kreverch | Arrays.sort(keysProp);
|
322 | 14 | kreverch | for (int i = 0; i < keysProp.length; i++) { |
323 | 14 | kreverch | String keyProp = keysProp[i];
|
324 | 14 | kreverch | log.debug("keyProp :"+keyProp);
|
325 | 14 | kreverch | prop.setProperty(keyProp, this.zProperties.get(keyProp).getValue());
|
326 | 14 | kreverch | } |
327 | 14 | kreverch | prop.store(new FileOutputStream(fileName), null); |
328 | 14 | kreverch | } catch (FileNotFoundException e) { |
329 | 14 | kreverch | // TODO Auto-generated catch block
|
330 | 14 | kreverch | e.printStackTrace(); |
331 | 14 | kreverch | return false; |
332 | 14 | kreverch | } catch (IOException e) { |
333 | 14 | kreverch | // TODO Auto-generated catch block
|
334 | 14 | kreverch | e.printStackTrace(); |
335 | 14 | kreverch | return false; |
336 | 14 | kreverch | } |
337 | 14 | kreverch | return true; |
338 | 14 | kreverch | } |
339 | 14 | kreverch | |
340 | 14 | kreverch | public boolean load(String fileName){ |
341 | 14 | kreverch | try {
|
342 | 14 | kreverch | Properties prop = new Properties(); |
343 | 14 | kreverch | prop.load(new FileInputStream(fileName)); |
344 | 14 | kreverch | String[] keysProp = (String[])this.zProperties.keySet().toArray(new String[0]); |
345 | 14 | kreverch | Arrays.sort(keysProp);
|
346 | 14 | kreverch | for (int i = 0; i < keysProp.length; i++) { |
347 | 14 | kreverch | String keyProp = keysProp[i];
|
348 | 14 | kreverch | if ( prop.containsKey(keyProp)){
|
349 | 14 | kreverch | this.zProperties.get(keyProp).setValue(prop.getProperty(keyProp));
|
350 | 14 | kreverch | }else{
|
351 | 14 | kreverch | this.zProperties.get(keyProp).setValue(""); |
352 | 14 | kreverch | } |
353 | 14 | kreverch | |
354 | 14 | kreverch | } |
355 | 14 | kreverch | } catch (FileNotFoundException e) { |
356 | 14 | kreverch | // TODO Auto-generated catch block
|
357 | 14 | kreverch | e.printStackTrace(); |
358 | 14 | kreverch | return false; |
359 | 14 | kreverch | } catch (IOException e) { |
360 | 14 | kreverch | // TODO Auto-generated catch block
|
361 | 14 | kreverch | e.printStackTrace(); |
362 | 14 | kreverch | return false; |
363 | 14 | kreverch | } |
364 | 14 | kreverch | return true; |
365 | 14 | kreverch | } |
366 | 14 | kreverch | |
367 | 14 | kreverch | public boolean remove(String fileName){ |
368 | 14 | kreverch | File f = new File(fileName); |
369 | 14 | kreverch | if (f.exists()){
|
370 | 14 | kreverch | if (f.delete()){
|
371 | 14 | kreverch | return true; |
372 | 14 | kreverch | } |
373 | 14 | kreverch | } |
374 | 14 | kreverch | return false; |
375 | 14 | kreverch | } |
376 | 14 | kreverch | } |