perform-service_broken/src/main/java/org/gcube/application/perform/service/engine/dm/ImporterMonitor.java

70 lines
2.0 KiB
Java

package org.gcube.application.perform.service.engine.dm;
import org.gcube.application.perform.service.engine.model.ISQueryDescriptor;
import org.gcube.application.perform.service.engine.model.importer.ImportRoutineDescriptor;
import org.gcube.application.perform.service.engine.model.importer.ImportStatus;
import org.gcube.data.analysis.dataminermanagercl.server.monitor.DMMonitorListener;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@AllArgsConstructor
@Slf4j
public class ImporterMonitor implements DMMonitorListener {
private static final String UPDATE_ROUTINE="";
private ImportRoutineDescriptor routine;
private ISQueryDescriptor isQuery;
@Override
public void accepted() {
updateStatus(ImportStatus.ACCEPTED,routine,isQuery);
}
@Override
public void cancelled() {
updateStatus(ImportStatus.CANCELLED,routine,isQuery);
}
@Override
public void complete(double percentage) {
updateStatus(ImportStatus.COMPLETE,routine,isQuery);
loadOutputData(routine,isQuery);
}
@Override
public void failed(String message, Exception exception) {
updateStatus(ImportStatus.FAILED,routine,isQuery);
}
@Override
public void running(double percentage) {
updateStatus(ImportStatus.RUNNING,routine,isQuery);
}
private static final void updateStatus(ImportStatus status,ImportRoutineDescriptor routine,ISQueryDescriptor is) {
throw new RuntimeException("NEED TO SET PS STMT");
// try{
// log.debug("Updateing status {} for {} ",status,routine);
// DataBaseManager db=DataBaseManager.get(is);
// Connection conn=db.getConnection();
// conn.setAutoCommit(true);
// PreparedStatement psUpdate=conn.prepareStatement(UPDATE_ROUTINE);
// //TODO SET PARAMS
//
// psUpdate.executeUpdate();
// }catch(Throwable t) {
// log.warn("Unable to update status on database");
// }
}
private static final void loadOutputData(ImportRoutineDescriptor routine, ISQueryDescriptor is) {
throw new RuntimeException("NEED TO IMPLEMENT THIS");
}
}