Revision 4705
Added by daigle about 16 years ago
src/edu/ucsb/nceas/metacat/admin/AuthAdmin.java | ||
---|---|---|
41 | 41 |
import edu.ucsb.nceas.metacat.AuthSession; |
42 | 42 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
43 | 43 |
import edu.ucsb.nceas.metacat.util.RequestUtil; |
44 |
import edu.ucsb.nceas.utilities.FileUtil; |
|
45 | 44 |
import edu.ucsb.nceas.utilities.GeneralPropertyException; |
46 | 45 |
import edu.ucsb.nceas.utilities.MetaDataProperty; |
47 | 46 |
import edu.ucsb.nceas.utilities.PropertiesMetaData; |
... | ... | |
168 | 167 |
// and preserve their entries. |
169 | 168 |
validationErrors.addAll(validateOptions(request)); |
170 | 169 |
|
171 |
// Try to create data file and backup directories if |
|
172 |
// necessary. |
|
173 |
String backupDir = PropertyService.getBackupDir(); |
|
174 |
try { |
|
175 |
FileUtil.createDirectory(backupDir); |
|
176 |
} catch (IOException ioe) { |
|
177 |
String errorString = "Could not create directory: " + backupDir |
|
178 |
+ " : " + ioe.getMessage(); |
|
179 |
logMetacat.error(errorString); |
|
180 |
validationErrors.add(errorString); |
|
181 |
} |
|
182 | 170 |
|
183 | 171 |
// Write out the configurable properties to a backup file |
184 | 172 |
// outside the install directory. Note that we allow them to |
185 | 173 |
// do this even if they have validation errors. They will |
186 | 174 |
// need to go back and fix the errors before they can run metacat. |
187 |
PropertyService.persistAuthBackupProperties(request.getSession() |
|
175 |
|
|
176 |
// This is a special case, since it is possible that the backup directory |
|
177 |
// may not have been specified yet. If not, authentication values need to be |
|
178 |
// persisted by the BackupAdmin when the backup directory is specified. |
|
179 |
String backupDir = PropertyService.getProperty("application.backupDir"); |
|
180 |
if (backupDir != null) { |
|
181 |
PropertyService.persistAuthBackupProperties(request.getSession() |
|
188 | 182 |
.getServletContext()); |
183 |
} |
|
189 | 184 |
|
190 | 185 |
} catch (GeneralPropertyException gpe) { |
191 | 186 |
String errorMessage = "Problem getting or setting property while " |
Also available in: Unified diff
Do not worry about creating backup directories here