/** * Program entry point. * * @param args The command-line arguments. * @throws Exception If there is an error. */ public static void main(String[] args) throws Exception { System.exit(new FijiToolLauncher().run(new DeleteTool(), args)); } }
/** * Deletes an entire Fiji instance. * * @param instanceURI The Fiji instance to delete. * @return tool exit code. * @throws Exception on error. */ private int deleteInstance(FijiURI instanceURI) throws Exception { final Fiji fiji = Fiji.Factory.open(instanceURI); try { getPrintStream().println("WARNING: This instance contains the table(s):"); for (String name : fiji.getTableNames()) { getPrintStream().println(name); } if (isInteractive() && !inputConfirmation( String.format("Are you sure you want to delete Fiji instance '%s'?", instanceURI), instanceURI.getInstance())) { getPrintStream().println("Delete aborted."); return FAILURE; } } finally { fiji.release(); } FijiInstaller.get().uninstall(fiji.getURI(), getConf()); getPrintStream().println(String.format("Fiji instance '%s' deleted.", fiji.getURI())); return SUCCESS; }
/** * Delete an entire table. * * @param fiji Fiji instance where the table to delete lives. * @param tableURI URI of the table to delete. * @return tool exit code. * @throws Exception on error. */ private int deleteTable(Fiji fiji, FijiURI tableURI) throws Exception { if (isInteractive() && !inputConfirmation( String.format("Are you sure you want to delete Fiji table '%s'?", tableURI), tableURI.getTable())) { getPrintStream().println("Delete aborted."); return FAILURE; } fiji.deleteTable(tableURI.getTable()); getPrintStream().println(String.format("Fiji table '%s' deleted.", tableURI)); return SUCCESS; }
if (mTargetURI.getTable() == null) { return deleteInstance(mTargetURI); final Fiji fiji = Fiji.Factory.open(mTargetURI, getConf()); try { final List<FijiColumnName> columns = mTargetURI.getColumns(); // never null return deleteTable(fiji, mTargetURI); } else { final EntityId entityId = ToolUtils.createEntityIdFromUserInputs(mEntityIdFlag, table.getLayout()); return deleteFromRow(table, entityId, columns, mTimestampMode, mTimestamp); } finally { table.release();
if (mayProceed("Are you sure you want to delete all cells with timestamp <= %d" + " from row '%s' in table '%s'?", timestamp, entityId, table.getURI())) { if (mayProceed("Are you sure you want to delete row '%s' from table '%s'?", entityId, table.getURI())) { writer.deleteRow(entityId); case EXACT: { Preconditions.checkState(families.isEmpty()); if (!mayProceed("Are you sure you want to delete cell with timestamp %d of columns %s " + "from row '%s' in table '%s'?", timestamp, Joiner.on(",").join(columns), entityId, table.getURI())) { if (!mayProceed("Are you sure you want to delete the most recent cells of columns %s " + "from row '%s' in table '%s'?", timestamp, Joiner.on(",").join(columns), entityId, table.getURI())) { if (!mayProceed("Are you sure you want to delete all cells of columns %s " + "with timestamp <= %d from row '%s' in table '%s'?", Joiner.on(",").join(columns), timestamp, entityId, table.getURI())) { if (!mayProceed("Are you sure you want to delete columns %s from row '%s' in table '%s'?", Joiner.on(",").join(columns), entityId, table.getURI())) { return SUCCESS;