git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application/perform-service@176313 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5b2124e74e
commit
51577389a5
|
@ -1,7 +1,10 @@
|
|||
package org.gcube.application.perform.service.engine;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.perform.service.engine.dm.DMException;
|
||||
import org.gcube.application.perform.service.engine.model.BeanNotFound;
|
||||
import org.gcube.application.perform.service.engine.model.DBQueryDescriptor;
|
||||
import org.gcube.application.perform.service.engine.model.importer.ImportRequest;
|
||||
import org.gcube.application.perform.service.engine.model.importer.ImportRoutineDescriptor;
|
||||
|
@ -9,6 +12,6 @@ import org.gcube.application.perform.service.engine.model.importer.ImportRoutine
|
|||
public interface Importer {
|
||||
|
||||
|
||||
public ImportRoutineDescriptor importExcel(ImportRequest request);
|
||||
public ImportRoutineDescriptor importExcel(ImportRequest request) throws DMException, BeanNotFound, SQLException;
|
||||
public List<ImportRoutineDescriptor> getDescriptors(DBQueryDescriptor query);
|
||||
}
|
||||
|
|
|
@ -3,10 +3,14 @@ package org.gcube.application.perform.service.engine;
|
|||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.perform.service.LocalConfiguration;
|
||||
import org.gcube.application.perform.service.engine.dm.DMException;
|
||||
import org.gcube.application.perform.service.engine.dm.DMUtils;
|
||||
import org.gcube.application.perform.service.engine.dm.ImporterMonitor;
|
||||
import org.gcube.application.perform.service.engine.model.BeanNotFound;
|
||||
import org.gcube.application.perform.service.engine.model.DBField.ImportRoutine;
|
||||
import org.gcube.application.perform.service.engine.model.DBQueryDescriptor;
|
||||
import org.gcube.application.perform.service.engine.model.ISQueryDescriptor;
|
||||
|
@ -23,7 +27,7 @@ public class ImporterImpl implements Importer {
|
|||
|
||||
private static final String ORPHAN_IMPORTS="";
|
||||
private static final String ACQUIRE_PS="";
|
||||
|
||||
private static final String GET_BY_ID="";
|
||||
|
||||
private static ISQueryDescriptor isQueryDescriptor=null;
|
||||
|
||||
|
@ -85,7 +89,7 @@ public class ImporterImpl implements Importer {
|
|||
|
||||
|
||||
@Override
|
||||
public ImportRoutineDescriptor importExcel(ImportRequest request) {
|
||||
public ImportRoutineDescriptor importExcel(ImportRequest request) throws DMException, BeanNotFound, SQLException {
|
||||
log.debug("Submitting {} ",request);
|
||||
ComputationId id=submit(request);
|
||||
log.debug("Registering {} computationID {} ",request,id);
|
||||
|
@ -97,9 +101,11 @@ public class ImporterImpl implements Importer {
|
|||
|
||||
|
||||
|
||||
private void monitor(ImportRoutineDescriptor desc) {
|
||||
throw new RuntimeException("IMPLEMENT THIS SHIT");
|
||||
private void monitor(ImportRoutineDescriptor desc) throws DMException {
|
||||
log.debug("Monitoring {} ",desc);
|
||||
DMUtils.monitor(DMUtils.getComputation(desc), new ImporterMonitor(desc,getISQueryDescriptor()));
|
||||
}
|
||||
|
||||
private ComputationId submit(ImportRequest request) {
|
||||
throw new RuntimeException("IMPLEMENT THIS SHIT");
|
||||
}
|
||||
|
@ -108,8 +114,15 @@ public class ImporterImpl implements Importer {
|
|||
throw new RuntimeException("IMPLEMENT THIS SHIT");
|
||||
}
|
||||
|
||||
private ImportRoutineDescriptor getDescriptorById(Long id) {
|
||||
throw new RuntimeException("IMPLEMENT THIS SHIT");
|
||||
private ImportRoutineDescriptor getDescriptorById(Long id) throws BeanNotFound, SQLException {
|
||||
DataBaseManager db=DataBaseManager.get(getISQueryDescriptor());
|
||||
Connection conn=db.getConnection();
|
||||
PreparedStatement ps=conn.prepareStatement(GET_BY_ID);
|
||||
ps.setLong(1, id);
|
||||
ResultSet rs=ps.executeQuery();
|
||||
if(rs.next()) return rowToDescriptor(rs);
|
||||
else throw new BeanNotFound("Unable to find Routine with ID "+id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.gcube.application.perform.service.LocalConfiguration;
|
|||
import org.gcube.application.perform.service.engine.model.BeanNotFound;
|
||||
import org.gcube.application.perform.service.engine.model.DBField;
|
||||
import org.gcube.application.perform.service.engine.model.DBQueryDescriptor;
|
||||
import org.gcube.application.perform.service.engine.model.DBType;
|
||||
import org.gcube.application.perform.service.engine.model.ISQueryDescriptor;
|
||||
import org.gcube.application.perform.service.engine.model.anagraphic.Batch;
|
||||
import org.gcube.application.perform.service.engine.model.anagraphic.Farm;
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.application.perform.service.engine.dm;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.perform.service.engine.model.importer.ImportRoutineDescriptor;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.DataMinerService;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.dmservice.SClient;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.monitor.DMMonitor;
|
||||
|
@ -23,6 +24,10 @@ public class DMUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static ComputationId getComputation(ImportRoutineDescriptor desc) {
|
||||
return new ComputationId(desc.getComputationId(), desc.getComputationUrl(), desc.getComputationOperator(), desc.getComputationOperatorName(), desc.getComputationRequest());
|
||||
}
|
||||
|
||||
|
||||
public static void monitor(SClient client,ComputationId computationId,DMMonitorListener listener) {
|
||||
DMMonitor monitor=new DMMonitor(computationId,client);
|
||||
|
@ -30,6 +35,11 @@ public class DMUtils {
|
|||
monitor.start();
|
||||
}
|
||||
|
||||
public static void monitor(ComputationId computationId,DMMonitorListener listener) throws DMException {
|
||||
DMMonitor monitor=new DMMonitor(computationId,getClient());
|
||||
monitor.add(listener);
|
||||
monitor.start();
|
||||
}
|
||||
|
||||
public static ComputationId submitJob(SClient client, String operatorId, Map<String,String> parameters) throws DMException {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue