use of lotus.domino.NotesThread in project org.openntf.nsfodp by OpenNTF.
the class ExporterApplication method start.
@Override
public Object start(IApplicationContext context) throws Exception {
String notesIni = System.getenv(NSFODPConstants.PROP_NOTESINI);
if (notesIni != null && !notesIni.isEmpty()) {
// $NON-NLS-1$
String execDir = System.getenv("Notes_ExecDirectory");
try (NotesAPI api = NotesAPI.get()) {
// $NON-NLS-1$
api.NotesInitExtended(execDir, "=" + notesIni);
}
}
String databasePath = System.getenv(NSFODPConstants.PROP_EXPORTER_DATABASE_PATH);
if (databasePath == null) {
throw new IllegalArgumentException(MessageFormat.format(Messages.ExporterApplication_dbPathCannotBeEmpty, NSFODPConstants.PROP_EXPORTER_DATABASE_PATH));
}
Path odpDir = Paths.get(System.getenv(NSFODPConstants.PROP_OUTPUTFILE));
// $NON-NLS-1$
boolean binaryDxl = "true".equals(System.getenv(NSFODPConstants.PROP_EXPORTER_BINARY_DXL));
// $NON-NLS-1$
boolean swiperFilter = "true".equals(System.getenv(NSFODPConstants.PROP_EXPORTER_SWIPER_FILTER));
// $NON-NLS-1$
boolean richTextAsItemData = "true".equals(System.getenv(NSFODPConstants.PROP_RICH_TEXT_AS_ITEM_DATA));
String projectName = System.getenv(NSFODPConstants.PROP_PROJECT_NAME);
NotesThread runner = new NotesThread(() -> {
try (NotesAPI session = NotesAPI.get()) {
try (NDatabase database = session.openDatabase(databasePath)) {
ODPExporter exporter = new ODPExporter(database);
exporter.setBinaryDxl(binaryDxl);
exporter.setSwiperFilter(swiperFilter);
exporter.setRichTextAsItemData(richTextAsItemData);
exporter.setProjectName(projectName);
Path result = exporter.export();
// $NON-NLS-1$
Path eclipseProject = odpDir.resolve(".project");
if (Files.exists(eclipseProject)) {
// $NON-NLS-1$ //$NON-NLS-2$
Path tempPath = Files.createTempFile("nsfodp", ".project");
Files.move(eclipseProject, tempPath, StandardCopyOption.REPLACE_EXISTING);
eclipseProject = tempPath;
} else {
eclipseProject = null;
}
if (Files.exists(odpDir)) {
NSFODPUtil.deltree(Collections.singleton(odpDir));
}
Files.createDirectories(odpDir);
NSFODPUtil.moveDirectory(result, odpDir);
if (eclipseProject != null) {
// $NON-NLS-1$
Files.move(eclipseProject, odpDir.resolve(".project"), StandardCopyOption.REPLACE_EXISTING);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
});
runner.run();
runner.join();
return EXIT_OK;
}
use of lotus.domino.NotesThread in project org.openntf.domino by OpenNTF.
the class DominoRunner method main.
public static void main(final String[] args) throws InterruptedException {
try {
NotesThread.sinitThread();
for (int i = 0; i < 20; i++) {
DominoRunner run = new DominoRunner();
NotesThread nt = new NotesThread(run, "Thread " + i);
nt.start();
Thread.sleep(500);
}
} finally {
NotesThread.stermThread();
}
}
use of lotus.domino.NotesThread in project org.openntf.domino by OpenNTF.
the class LegacyCollectionPerfTest method main.
public static void main(final String[] args) throws InterruptedException {
try {
// Properties props = System.getProperties();
// for (Object key : props.keySet()) {
// Object value = props.get(key);
// System.out.println(String.valueOf(key) + " : " + String.valueOf(value));
// }
NotesThread.sinitThread();
for (int i = 0; i < 1; i++) {
LegacyCollectionPerfTest run = new LegacyCollectionPerfTest();
NotesThread nt = new NotesThread(run, "Thread " + i);
nt.start();
Thread.sleep(500);
}
} finally {
NotesThread.stermThread();
}
}
use of lotus.domino.NotesThread in project org.openntf.domino by OpenNTF.
the class LegacyCollectionTest method main.
public static void main(final String[] args) throws InterruptedException {
try {
// Properties props = System.getProperties();
// for (Object key : props.keySet()) {
// Object value = props.get(key);
// System.out.println(String.valueOf(key) + " : " + String.valueOf(value));
// }
NotesThread.sinitThread();
for (int i = 0; i < 1; i++) {
LegacyCollectionTest run = new LegacyCollectionTest();
NotesThread nt = new NotesThread(run, "Thread " + i);
nt.start();
Thread.sleep(500);
}
} finally {
NotesThread.stermThread();
}
}
use of lotus.domino.NotesThread in project org.openntf.domino by OpenNTF.
the class NotesRunner method main.
public static void main(final String[] args) throws InterruptedException {
try {
// Properties props = System.getProperties();
// for (Object key : props.keySet()) {
// Object value = props.get(key);
// System.out.println(String.valueOf(key) + " : " + String.valueOf(value));
// }
NotesThread.sinitThread();
for (int i = 0; i < 1; i++) {
NotesRunner run = new NotesRunner();
NotesThread nt = new NotesThread(run, "Thread " + i);
nt.start();
Thread.sleep(500);
}
} finally {
NotesThread.stermThread();
}
}
Aggregations