int returnVal =
browse.showOpenDialog(Administrator.getDesktop());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = browse.getSelectedFile();
Administrator.setLastDir(file.getParentFile());
ObjectFormatDialog fmtDialog =
new ObjectFormatDialog("Select XML Format of Ingest File(s)");
if (fmtDialog.getSelection() != null) {
String ingestFormat = fmtDialog.getSelection();
String pid =
Ingest.oneFromFile(file,
ingestFormat,
Administrator.APIA,
Administrator.APIM,
null);
JOptionPane.showMessageDialog(Administrator
.getDesktop(), "Ingest succeeded. PID='" + pid
+ "'.");
}
}
} else if (kind == MULTI_FROM_DIR) {
wasMultiple = true;
JFileChooser browse =
new JFileChooser(Administrator.getLastDir());
browse.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal =
browse.showOpenDialog(Administrator.getDesktop());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = browse.getSelectedFile();
Administrator.setLastDir(file);;
logRootName = "ingest-from-dir";
logFile = IngestLogger.newLogFile(logRootName);
log =
new PrintStream(new FileOutputStream(logFile),
true,
"UTF-8");
IngestLogger.openLog(log, logRootName);
long st = System.currentTimeMillis();
ObjectFormatDialog fmtDialog =
new ObjectFormatDialog("Select XML Format of Ingest File(s)");
if (fmtDialog.getSelection() != null) {
String ingestFormat = fmtDialog.getSelection();
Ingest.multiFromDirectory(file,
ingestFormat,
Administrator.APIA,
Administrator.APIM,
null,