1 |
94284c9a
|
Marc NICOLAS
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
package fr.ias.sitools.vo.tap;
|
8 |
|
|
|
9 |
|
|
import fr.cnes.sitools.extensions.astro.application.uws.common.Util;
|
10 |
|
|
import fr.cnes.sitools.extensions.astro.application.uws.jobmanager.AbstractJobTask;
|
11 |
|
|
import fr.cnes.sitools.xml.uws.v1.Job;
|
12 |
|
|
import java.util.ArrayList;
|
13 |
|
|
import java.util.Date;
|
14 |
|
|
import java.util.List;
|
15 |
|
|
import java.util.logging.Level;
|
16 |
|
|
import javax.xml.datatype.DatatypeConfigurationException;
|
17 |
|
|
import net.ivoa.xml.uws.v1.ErrorSummary;
|
18 |
|
|
import net.ivoa.xml.uws.v1.ErrorType;
|
19 |
|
|
import net.ivoa.xml.uws.v1.ExecutionPhase;
|
20 |
|
|
import org.restlet.engine.Engine;
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
public class TableAccessProtocolAsynchronousResponse extends AbstractJobTask {
|
27 |
|
|
|
28 |
|
|
final TableAccessProtocolInputParameters inputParams;
|
29 |
|
|
|
30 |
|
|
public TableAccessProtocolAsynchronousResponse(final TableAccessProtocolInputParameters inputParameters) {
|
31 |
|
|
this.inputParams = inputParameters;
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
@Override
|
35 |
|
|
public void run() {
|
36 |
|
|
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE, "***************** JE SUIS DANS LE RUN !!!");
|
37 |
|
|
try {
|
38 |
|
|
setBlinker(Thread.currentThread());
|
39 |
|
|
setStartTime(Util.convertIntoXMLGregorian(new Date()));
|
40 |
|
|
setPhase(ExecutionPhase.EXECUTING);
|
41 |
|
|
final List<String> filenameList = createJob();
|
42 |
|
|
|
43 |
|
|
setEndTime(Util.convertIntoXMLGregorian(new Date()));
|
44 |
|
|
setPhase(ExecutionPhase.COMPLETED);
|
45 |
|
|
} catch (DatatypeConfigurationException ex) {
|
46 |
|
|
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE, null, ex);
|
47 |
|
|
final ErrorSummary errorSumm = new ErrorSummary();
|
48 |
|
|
errorSumm.setMessage(ex.getMessage());
|
49 |
|
|
errorSumm.setType(ErrorType.FATAL);
|
50 |
|
|
errorSumm.setHasDetail(true);
|
51 |
|
|
setError(errorSumm);
|
52 |
|
|
setPhase(ExecutionPhase.ERROR);
|
53 |
|
|
} catch (Error error) {
|
54 |
|
|
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE, null, error);
|
55 |
|
|
final ErrorSummary errorSumm = new ErrorSummary();
|
56 |
|
|
errorSumm.setMessage(error.getMessage());
|
57 |
|
|
errorSumm.setType(ErrorType.FATAL);
|
58 |
|
|
errorSumm.setHasDetail(true);
|
59 |
|
|
setError(errorSumm);
|
60 |
|
|
setPhase(ExecutionPhase.ERROR);
|
61 |
|
|
}
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
private List<String> createJob(){
|
65 |
|
|
List<String> a = new ArrayList<String>();
|
66 |
|
|
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE,"+++++++++++++++++++++++");
|
67 |
|
|
|
68 |
|
|
final String query = this.inputParams.getQuery();
|
69 |
|
|
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE,"+++++++++++++++++++++++ QUERY : "+query);
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
Engine.getLogger(TableAccessProtocolAsynchronousResponse.class.getName()).log(Level.SEVERE,"+++++++++++++++++++++++ getJobInfo "+getJobInfo().toString());
|
73 |
|
|
return a;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
@Override
|
77 |
|
|
public Job getCapabilities() {
|
78 |
|
|
throw new UnsupportedOperationException("Not supported yet.");
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
} |