use of lotus.domino.AdministrationProcess in project org.openntf.nsfodp by OpenNTF.
the class DeployNSFTask method run.
@Override
public void run() {
try {
Session session = NotesFactory.createSession();
try {
String server, filePath;
// $NON-NLS-1$
int bangIndex = destPath.indexOf("!!");
if (bangIndex > -1) {
server = destPath.substring(0, bangIndex);
filePath = destPath.substring(bangIndex + 2);
} else {
// $NON-NLS-1$
server = "";
filePath = destPath;
}
Database dest = session.getDatabase(server, filePath, true);
if (dest.isOpen() && !replaceDesign) {
throw new IllegalStateException(MessageFormat.format(Messages.DeployNSFTask_dbExists, destPath));
}
if (dest.isOpen()) {
// Then do a replace design
ReplaceDesignTaskLocal task = new ReplaceDesignTaskLocal(filePath, nsfFile, new NullProgressMonitor());
DominoThreadFactory.getExecutor().submit(task).get();
} else {
// $NON-NLS-1$
Database source = session.getDatabase("", nsfFile.toAbsolutePath().toString());
dest = source.createFromTemplate(server, filePath, false);
}
if (this.signDatabase) {
AdministrationProcess adminp = session.createAdministrationProcess(server);
adminp.signDatabaseWithServerID(server, filePath);
// $NON-NLS-1$
session.sendConsoleCommand(server, "tell adminp p im");
}
} finally {
session.recycle();
}
} catch (NotesException | ExecutionException | InterruptedException ne) {
throw new RuntimeException(Messages.DeployNSFTask_exceptionDeploying, ne);
}
}
Aggregations