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