public void doService( EngineStartServletIOManager servletIOManager ) throws SpagoBIEngineException {
boolean isMultipart;
FileItemFactory factory;
ServletFileUpload upload;
JobDeploymentDescriptor jobDeploymentDescriptor;
logger.debug("IN");
try {
auditServiceStartEvent();
// Check that we have a file upload request
isMultipart = ServletFileUpload.isMultipartContent( servletIOManager.getRequest() );
// Create a factory for disk-based file items
factory = new DiskFileItemFactory();
// Create a new file upload handler
upload = new ServletFileUpload(factory);
// Parse the request
List items = null;
try {
items = upload.parseRequest(servletIOManager.getRequest());
} catch (FileUploadException e) {
throw new SpagoBIEngineException("Impossible to upload file", "impossible.to.upload.file", e );
}
jobDeploymentDescriptor = getJobsDeploymetDescriptor(items);
// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
processFormField(item);
} else {
String[] jobNames = processUploadedFile(item, jobDeploymentDescriptor);
if(TalendEngine.getConfig().isAutoPublishActive()) {
if(jobNames == null) continue;
for(int i = 0; i < jobNames.length; i++) {
publishOnSpagoBI(servletIOManager, jobDeploymentDescriptor.getLanguage(), jobDeploymentDescriptor.getProject(), jobNames[i]);
}
}
}
}