Search in sources :

Example 1 with CouldNotRemoveProcessException

use of de.ipbhalle.exception.CouldNotRemoveProcessException in project MetFragRelaunched by ipb-halle.

the class MetFragRestController method removeProcess.

/*
	 * some helper methods
	 */
/**
 * @param processid
 * @throws CouldNotRemoveProcessException
 */
private void removeProcess(String processid) throws CouldNotRemoveProcessException {
    File file = new File(this.getResultFolderName(processid));
    if (!file.exists())
        throw new CouldNotRemoveProcessException("Process with id " + processid + " not found");
    if (!file.canWrite())
        throw new CouldNotRemoveProcessException("Process with id " + processid + " cannot be deleted");
    try {
        FileUtils.deleteDirectory(file);
    } catch (Exception e) {
        throw new CouldNotRemoveProcessException(e.getMessage());
    }
    System.out.println("Deleted " + file.getAbsolutePath());
}
Also used : CouldNotRemoveProcessException(de.ipbhalle.exception.CouldNotRemoveProcessException) File(java.io.File) CouldNotReadStatusException(de.ipbhalle.exception.CouldNotReadStatusException) CouldNotFetchResultsException(de.ipbhalle.exception.CouldNotFetchResultsException) ParameterNotKnownException(de.ipbhalle.metfraglib.exceptions.ParameterNotKnownException) CouldNotCreateProcessException(de.ipbhalle.exception.CouldNotCreateProcessException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) CouldNotRemoveProcessException(de.ipbhalle.exception.CouldNotRemoveProcessException) ExecutionException(java.util.concurrent.ExecutionException) CouldNotReadHostException(de.ipbhalle.exception.CouldNotReadHostException) CouldNotWriteStatusException(de.ipbhalle.exception.CouldNotWriteStatusException)

Aggregations

CouldNotCreateProcessException (de.ipbhalle.exception.CouldNotCreateProcessException)1 CouldNotFetchResultsException (de.ipbhalle.exception.CouldNotFetchResultsException)1 CouldNotReadHostException (de.ipbhalle.exception.CouldNotReadHostException)1 CouldNotReadStatusException (de.ipbhalle.exception.CouldNotReadStatusException)1 CouldNotRemoveProcessException (de.ipbhalle.exception.CouldNotRemoveProcessException)1 CouldNotWriteStatusException (de.ipbhalle.exception.CouldNotWriteStatusException)1 ParameterNotKnownException (de.ipbhalle.metfraglib.exceptions.ParameterNotKnownException)1 File (java.io.File)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 ExecutionException (java.util.concurrent.ExecutionException)1