git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application/perform-service@176143 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
288c2c4208
commit
99e8c65b93
8
pom.xml
8
pom.xml
|
@ -83,6 +83,14 @@
|
||||||
<version>${weld-version}</version> <!-- 2.0.4 doesn't find implementations. 2.2.4 doesn't find CDI... -->
|
<version>${weld-version}</version> <!-- 2.0.4 doesn't find implementations. 2.2.4 doesn't find CDI... -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- DM -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.data.analysis</groupId>
|
||||||
|
<artifactId>data-miner-manager-cl</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -13,4 +13,13 @@ public interface ServiceConstants {
|
||||||
public static final String FARM_METHOD="farm";
|
public static final String FARM_METHOD="farm";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static interface Execution{
|
||||||
|
public static final String PATH="execution";
|
||||||
|
public static final String IMPORT_METHOD="import";
|
||||||
|
public static final String BATCH_TYPE_PARAMETER="batch_type";
|
||||||
|
public static final String FARM_ID_PARAMETER="farmid";
|
||||||
|
public static final String EXCEL_FILE_PARAMETER="source";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package org.gcube.application.perform.service.engine;
|
||||||
|
|
||||||
|
import org.gcube.application.perform.service.engine.model.importer.ImportRequest;
|
||||||
|
import org.gcube.application.perform.service.engine.model.importer.ImportTicket;
|
||||||
|
|
||||||
|
public interface Importer {
|
||||||
|
|
||||||
|
|
||||||
|
public ImportTicket importExcel(ImportRequest request);
|
||||||
|
public ImportRoutineDescriptor getDescriptor(ImportTicket ticket);
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.gcube.application.perform.service.engine;
|
||||||
|
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
import org.gcube.application.perform.service.engine.model.importer.ImportRequest;
|
||||||
|
import org.gcube.application.perform.service.engine.model.importer.ImportTicket;
|
||||||
|
|
||||||
|
import lombok.Synchronized;
|
||||||
|
|
||||||
|
public class ImporterImpl implements Importer {
|
||||||
|
|
||||||
|
|
||||||
|
// Keeps track of imported jobs in -separated?- DB
|
||||||
|
// Static thread pool for monitoring
|
||||||
|
private static ThreadPoolExecutor executor=null;
|
||||||
|
|
||||||
|
public ImporterImpl() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImportTicket importExcel(ImportRequest request) {
|
||||||
|
|
||||||
|
|
||||||
|
throw new RuntimeException("IMPLEMENT THIS SHIT");
|
||||||
|
// Check if already present?
|
||||||
|
|
||||||
|
// Insert reference in DB
|
||||||
|
// Submit to DM
|
||||||
|
// return ticket
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
private static void exec() {
|
||||||
|
if(executor==null) {
|
||||||
|
//init executor
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.gcube.application.perform.service.engine.dm;
|
||||||
|
|
||||||
|
public interface DMInterface {
|
||||||
|
|
||||||
|
public static DMInterface get() {
|
||||||
|
return new DMInterfaceImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void submitJob();
|
||||||
|
public void getJobStatus();
|
||||||
|
public void getJobOutput();
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package org.gcube.application.perform.service.engine.dm;
|
||||||
|
|
||||||
|
public class DMInterfaceImpl implements DMInterface{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitJob() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getJobStatus() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getJobOutput() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.gcube.application.perform.service.engine.dm;
|
||||||
|
|
||||||
|
public abstract class DMPoolMonitor<T extends PostProcess>{
|
||||||
|
|
||||||
|
|
||||||
|
private T PostProcess;
|
||||||
|
private PoolMonitorConfiguration configuration;
|
||||||
|
|
||||||
|
public DMPoolMonitor(T PostProcess){
|
||||||
|
// INIT THREAD POOL
|
||||||
|
// .. queue, core/max size
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void submitRequest() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.application.perform.service.engine.dm;
|
||||||
|
|
||||||
|
public class PoolMonitorConfiguration {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.application.perform.service.engine.dm;
|
||||||
|
|
||||||
|
public interface PostProcess {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.application.perform.service.engine.model.importer;
|
||||||
|
|
||||||
|
public class ImportRequest {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.application.perform.service.engine.model.importer;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ImportRoutineDescriptor {
|
||||||
|
|
||||||
|
private String sourceFile;
|
||||||
|
private Instant startTime;
|
||||||
|
private Instant endTime;
|
||||||
|
private Long producedKpiRows;
|
||||||
|
private Long producedAggregatedKpiRows;
|
||||||
|
private String status;
|
||||||
|
private String executionID;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.application.perform.service.engine.model.importer;
|
||||||
|
|
||||||
|
public class ImportTicket {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.gcube.application.perform.service.rest;
|
||||||
|
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
|
||||||
|
import org.gcube.application.perform.service.PerformServiceManager;
|
||||||
|
import org.gcube.application.perform.service.ServiceConstants;
|
||||||
|
import org.gcube.smartgears.annotations.ManagedBy;
|
||||||
|
|
||||||
|
@Path(ServiceConstants.Execution.PATH)
|
||||||
|
|
||||||
|
@ManagedBy(PerformServiceManager.class)
|
||||||
|
public class Execution {
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path(ServiceConstants.Execution.IMPORT_METHOD)
|
||||||
|
public void importExcel(@QueryParam(ServiceConstants.Execution.BATCH_TYPE_PARAMETER)String batchType,
|
||||||
|
@QueryParam(ServiceConstants.Execution.FARM_ID_PARAMETER)Long farmid,
|
||||||
|
@QueryParam(ServiceConstants.Execution.EXCEL_FILE_PARAMETER)String sourceFile) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue