Revision 4760
Added by daigle about 15 years ago
MetaCatAdminServlet.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
import edu.ucsb.nceas.metacat.MetaCatServlet; |
42 | 42 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
43 |
import edu.ucsb.nceas.metacat.service.ServiceException; |
|
44 |
import edu.ucsb.nceas.metacat.service.ServiceService; |
|
43 | 45 |
import edu.ucsb.nceas.metacat.service.SessionService; |
44 | 46 |
import edu.ucsb.nceas.metacat.util.AuthUtil; |
45 | 47 |
import edu.ucsb.nceas.metacat.util.MetacatUtil; |
... | ... | |
47 | 49 |
import edu.ucsb.nceas.metacat.util.SkinUtil; |
48 | 50 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
49 | 51 |
import edu.ucsb.nceas.metacat.util.UtilException; |
50 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
|
|
52 |
import edu.ucsb.nceas.utilities.GeneralPropertyException;
|
|
51 | 53 |
|
52 | 54 |
/** |
53 | 55 |
* Entry servlet for the metadata configuration utility |
... | ... | |
103 | 105 |
SessionService.touchSession(httpSession.getId()); |
104 | 106 |
} |
105 | 107 |
|
106 |
if (!MetacatUtil.isBackupDirConfigured()) { |
|
107 |
// If the user is logged in, make sure the backup directory has been configured. |
|
108 |
// If not, go to the backup configuration page. |
|
109 |
processingMessage.add("You must configure the backup directory" + |
|
110 |
" before you can continue with Metacat configuration."); |
|
111 |
RequestUtil.setRequestMessage(request, processingMessage); |
|
112 |
action = "backup"; |
|
113 |
logMetacat.debug("Admin action changed to 'backup'"); |
|
108 |
if (!MetacatUtil.isBackupDirConfigured()) { |
|
109 |
String discoveredBackupDir = SystemUtil.discoverExternalBaseDir(); |
|
110 |
if (discoveredBackupDir == null) { |
|
111 |
// if the backup dir has not been configured, and the system |
|
112 |
// cannot find a suitable directory, then show the backup |
|
113 |
// directory configuration screen. |
|
114 |
processingMessage.add("You must configure the backup directory" |
|
115 |
+ " before you can continue with Metacat configuration."); |
|
116 |
RequestUtil.setRequestMessage(request, processingMessage); |
|
117 |
action = "backup"; |
|
118 |
logMetacat.debug("Admin action changed to 'backup'"); |
|
119 |
} else { |
|
120 |
// if the backup dir has not been configured, and the system |
|
121 |
// can find a suitable directory, then set the application.backupDir |
|
122 |
// property to the discovered value |
|
123 |
PropertyService.setProperty("application.backupDir", discoveredBackupDir); |
|
124 |
ServiceService.refreshService("PropertyService"); |
|
125 |
} |
|
114 | 126 |
} else if (!AuthUtil.isAuthConfigured()) { |
115 | 127 |
// if authentication isn't configured, change the action to auth. |
116 | 128 |
// Authentication needs to be set up before we do anything else |
... | ... | |
183 | 195 |
logMetacat.error(errorMessage); |
184 | 196 |
processingErrors.add(errorMessage); |
185 | 197 |
} |
186 |
} catch (PropertyNotFoundException pnfe) {
|
|
198 |
} catch (GeneralPropertyException ge) {
|
|
187 | 199 |
String errorMessage = |
188 |
"Property problem while handling request: " + pnfe.getMessage();
|
|
200 |
"Property problem while handling request: " + ge.getMessage();
|
|
189 | 201 |
logMetacat.error(errorMessage); |
190 | 202 |
processingErrors.add(errorMessage); |
191 | 203 |
} catch (AdminException ae) { |
... | ... | |
198 | 210 |
"Utility problem while handling request: " + ue.getMessage(); |
199 | 211 |
logMetacat.error(errorMessage); |
200 | 212 |
processingErrors.add(errorMessage); |
213 |
} catch (ServiceException se) { |
|
214 |
String errorMessage = |
|
215 |
"Utility problem while handling request: " + se.getMessage(); |
|
216 |
logMetacat.error(errorMessage); |
|
217 |
processingErrors.add(errorMessage); |
|
201 | 218 |
} |
202 | 219 |
|
203 | 220 |
if (processingErrors.size() > 0) { |
Also available in: Unified diff
Only show the backup configuration screen if the system cannot discover a directory.