public static String getBackupPath(String file) { return ENV.getTempPath() + file; }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override protected List<String> createItems(Map context) { String tmpFile = ENV.getTempPath() + "sql" + System.currentTimeMillis(); FileUtil.writeBytes(query.getBytes(), tmpFile, false); String url = StringUtil.insertProperties(this.url, context); List<String> items = new LinkedList<String>(); Properties tprops = new Properties(); tprops.put("driver", driver); tprops.put("url", url); tprops.put("userid", user); tprops.put("password", passwd); tprops.put("print", true); AntRunner.runTask("sql", tprops, tmpFile); //TODO: how to return the result? return items; }
public static void createGraph(String plotFile) { Chart chart = createChart(FileUtil.getFile(plotFile)); String file = ENV.getTempPath() + plotFile; exportGraph(file, chart); }
/** * uses xgraph to create a simple XY graph persisting it to an svg file. * * @throws IOException * @throws FileNotFoundException */ public static <N extends Number> void createGraph(String title, String xTitle, String yTitle, int width, int height, N... yData) { Chart chart = createChart(Type.XY, title, xTitle, yTitle, width, height, false, null, serie("y(x)", Arrays.asList(yData))); String file = ENV.getTempPath() + FileUtil.getValidFileName(title); exportGraph(file, chart); }
/** * getAttachmentFilename * * @param instance * @param attribute * @param name * @return */ public static String getFilename(Object instance, String attribute, String name) { return ENV.getTempPath() + FileUtil.getValidFileName(BeanValue.getBeanValue(instance, attribute).getValueId() + "." + Util.asString(name)); }
public static String createGraph(Type type, String title, String xTitle, String yTitle, int width, int height, boolean yLogarithmic, List<Object> x, Serie... yn) { Chart chart = createChart(type, title, xTitle, yTitle, width, height, yLogarithmic, x, yn); String file = ENV.getTempPath() + FileUtil.getValidFileName(title); exportGraph(file, chart); return file; }
@Override public void run() { if (BeanContainer.isInitialized()) { EMessage.broadcast(this, "APPLICATION SHUTDOWN INITIALIZED...", "*"); LOG.info("preparing shutdown of local database " + persistence.getConnectionUrl()); try { BeanContainer.instance().executeStmt(ENV.get("app.shutdown.statement", "SHUTDOWN"), true, null); Thread.sleep(2000); } catch (Exception e) { LOG.error(e.toString()); } String hsqldbScript = isH2(persistence.getConnectionUrl()) ? persistence.getDefaultSchema() + ".mv.db" : persistence.getDatabase() + ".script"; String backupFile = ENV.getTempPath() + FileUtil.getUniqueFileName(ENV.get("app.database.backup.file", persistence.getDatabase()) + ".zip"); LOG.info("creating database backup to file " + backupFile); FileUtil.writeToZip(backupFile, hsqldbScript, FileUtil.getFileBytes(ENV.getConfigPath() + hsqldbScript, null)); } } }));