Added interface Snapshot
This commit is contained in:
parent
49dbf76b8e
commit
2330c6ab6d
|
@ -27,9 +27,15 @@ public interface ServiceConstants {
|
|||
public static final String EXCEL_FILE_VERSION_PARAMETER="source_version";
|
||||
public static final String STATUS_PARAMETER="status";
|
||||
public static final String LAST_METHOD="last";
|
||||
|
||||
public static final String SNAPSHOT_METHOD="snapshot";
|
||||
}
|
||||
|
||||
|
||||
public static interface Snapshot{
|
||||
public static final String PATH="snapshot";
|
||||
public static final String BATCH_TYPE_PARAMETER="batch_type";
|
||||
public static final String FARM_ID_PARAMETER="farmid";
|
||||
}
|
||||
public static interface Performance{
|
||||
public static final String PATH="performance";
|
||||
public static final String FARM_ID_PARAMETER="farmid";
|
||||
|
|
|
@ -18,4 +18,7 @@ public interface PerformanceManager {
|
|||
public void loadOutputData(ImportRoutineDescriptor desc)throws SQLException, InvalidRequestException, InternalException, IOException, DMException;
|
||||
|
||||
public Map<String,String> getStatistics(AnalysisType type)throws SQLException, InvalidRequestException, InternalException, IOException;
|
||||
|
||||
|
||||
public void snapshotImportedData(ImportRoutineDescriptor desc)throws SQLException, InvalidRequestException, InternalException, IOException;
|
||||
}
|
||||
|
|
|
@ -293,6 +293,12 @@ public class PerformanceManagerImpl implements PerformanceManager{
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void snapshotImportedData(ImportRoutineDescriptor desc)
|
||||
throws SQLException, InvalidRequestException, InternalException, IOException {
|
||||
throw new RuntimeException("Method not yet implemented");
|
||||
}
|
||||
|
||||
// ************************** SCHEMA PARSING
|
||||
private static final String FLOAT_REGEX="\\d*\\.\\d*";
|
||||
|
|
|
@ -118,4 +118,6 @@ public class Import {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package org.gcube.application.perform.service.rest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.gcube.application.perform.service.PerformServiceManager;
|
||||
import org.gcube.application.perform.service.ServiceConstants;
|
||||
import org.gcube.application.perform.service.engine.Importer;
|
||||
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.importer.ImportRoutineDescriptor;
|
||||
import org.gcube.smartgears.annotations.ManagedBy;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
@Path(ServiceConstants.Snapshot.PATH)
|
||||
@ManagedBy(PerformServiceManager.class)
|
||||
public class Snapshot {
|
||||
|
||||
private static final Logger log= LoggerFactory.getLogger(Snapshot.class);
|
||||
|
||||
@Inject
|
||||
private Importer importer;
|
||||
|
||||
@PUT
|
||||
public void snapshot(@QueryParam(ServiceConstants.Snapshot.BATCH_TYPE_PARAMETER) String batchType,
|
||||
@QueryParam(ServiceConstants.Snapshot.FARM_ID_PARAMETER)Long farmid) {
|
||||
|
||||
InterfaceCommons.checkMandatory(batchType, ServiceConstants.Snapshot.BATCH_TYPE_PARAMETER);
|
||||
InterfaceCommons.checkMandatory(farmid, ServiceConstants.Snapshot.FARM_ID_PARAMETER);
|
||||
try {
|
||||
List<ImportRoutineDescriptor> found=importer.getDescriptors(new DBQueryDescriptor().add(
|
||||
DBField.ImportRoutine.fields.get(DBField.ImportRoutine.FARM_ID), farmid).
|
||||
add(DBField.ImportRoutine.fields.get(DBField.ImportRoutine.BATCH_TYPE), batchType));
|
||||
|
||||
|
||||
|
||||
}catch(Throwable t) {
|
||||
log.warn("Unexpected Exception ",t);
|
||||
throw new WebApplicationException("Unexpected Exception.", t,Response.Status.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -13,5 +13,5 @@ schema.load.skipError=true
|
|||
schema.load.commit=true
|
||||
|
||||
deanonimization.default_include_SNAPSHOT=false
|
||||
performance.default_exclude_SNAPSHOT=false
|
||||
performance.default_include_SNAPSHOT=false
|
||||
|
Loading…
Reference in New Issue