- Create an instance - call a using* to set the XSL - call a from* to set the source XML - call a to* to make the transformation and store the XML
96979899100101102103104105106
// Register the directories try { fsWatchService = FileSystems.getDefault().newWatchService(); registerRecursively(basePath); } catch (IOException e) { throw new StLightException(e); } // Start the watch thread start();
127128129130131132133134
protected void register(Path path) { try { WatchKey key = path.register(fsWatchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY); pathByKey.put(key, path); } catch (IOException e) { throw new StLightException(e); } }
163164165166167168169170171172173
// Wait for the next event WatchKey key; try { key = fsWatchService.take(); } catch (InterruptedException e) { throw new StLightException(e); } // Go through all the events for (WatchEvent<?> event : key.pollEvents()) { WatchEvent<Path> pathEvent = (WatchEvent<Path>) event;
4445464748495051
* @param message * the error message to throw */ public static void assertFalse(boolean actual, String message) { if (actual) { throw new StLightException(message); } }
6869707172737475
* @param message * the error message to throw */ public static void assertNotNull(Object actual, String message) { if (actual == null) { throw new StLightException(message); } }
9293949596979899
* @param message * the error message to throw */ public static void assertNull(Object actual, String message) { if (actual != null) { throw new StLightException(message); } }
116117118119120121122123
* @param message * the error message to throw */ public static void assertTrue(boolean actual, String message) { if (!actual) { throw new StLightException(message); } }
3839404142434445
*/ public static String getFileAsString(File file) { try { return StreamsUtils.consumeAsString(new FileInputStream(file)); } catch (Exception e) { throw new StLightException(e); } }
5354555657585960
*/ public static String getFileAsString(String fileName) { try { return StreamsUtils.consumeAsString(new FileInputStream(fileName)); } catch (Exception e) { throw new StLightException(e); } }
process.getOutputStream().close(); StreamsUtils.flowStreamNonBlocking(process.getInputStream(), System.out); StreamsUtils.flowStreamNonBlocking(process.getErrorStream(), System.err); process.waitFor(); } catch (Exception e) { throw new StLightException(e); } }