77 lines
2.2 KiB
Java
77 lines
2.2 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 org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
public class ImporterMonitor implements DMMonitorListener {
|
|
|
|
private static final Logger log= LoggerFactory.getLogger(ImporterMonitor.class);
|
|
|
|
private static final String UPDATE_ROUTINE="";
|
|
|
|
|
|
public ImporterMonitor(ImportRoutineDescriptor routine, ISQueryDescriptor isQuery) {
|
|
super();
|
|
this.routine = routine;
|
|
this.isQuery = isQuery;
|
|
}
|
|
|
|
|
|
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");
|
|
}
|
|
}
|