refs 6548: TDM - Migrate TabMan to new PortalContext
Task-Url: https://support.d4science.org/issues/6548 Updated Servlet behavior git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@141732 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bf34520449
commit
c05fb4e51c
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/tabular-data-gwt-service-2.14.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/tabular-data-gwt-service-2.15.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/tabular-data-gwt-service-2.14.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/tabular-data-gwt-service-2.15.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -33,5 +33,5 @@
|
||||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/tabular-data-gwt-service-2.14.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/tabular-data-gwt-service-2.15.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-15-0" date="2017-02-15">
|
||||||
|
<Change>Updatetd to new PortalContext [issue #6548]</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-14-0" date="2016-12-01">
|
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-14-0" date="2016-12-01">
|
||||||
<Change>Updated storage support</Change>
|
<Change>Updated storage support</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -14,7 +14,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>tabular-data-gwt-service</artifactId>
|
<artifactId>tabular-data-gwt-service</artifactId>
|
||||||
<version>2.14.0-SNAPSHOT</version>
|
<version>2.15.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>tabular-data-gwt-service</name>
|
<name>tabular-data-gwt-service</name>
|
||||||
<description>tabular-data-gwt-service allows communication between the GUI and services</description>
|
<description>tabular-data-gwt-service allows communication between the GUI and services</description>
|
||||||
|
|
|
@ -14,90 +14,107 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
|
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVFileUtil;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVFileUtil;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a representation of the csv file in JSON
|
* Returns a representation of the csv file in JSON
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVImportFileServlet extends HttpServlet {
|
public class CSVImportFileServlet extends HttpServlet {
|
||||||
|
|
||||||
protected static Logger logger = LoggerFactory.getLogger(CSVImportFileServlet.class);
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(CSVImportFileServlet.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4197748678713054285L;
|
private static final long serialVersionUID = -4197748678713054285L;
|
||||||
|
|
||||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
|
||||||
|
throws ServletException, IOException {
|
||||||
handleRequest(req, resp);
|
handleRequest(req, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
|
||||||
|
throws ServletException, IOException {
|
||||||
handleRequest(req, resp);
|
handleRequest(req, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
protected void handleRequest(HttpServletRequest request,
|
||||||
|
HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
logger.info("CSVImportFileServlet");
|
logger.info("CSVImportFileServlet");
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
|
|
||||||
if(session==null){
|
if (session == null) {
|
||||||
logger.error("Error getting the upload session, no session valid found: "+session);
|
logger.error("Error getting the upload session, no session valid found: "
|
||||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "ERROR-Error getting the user session, no session found"+session);
|
+ session);
|
||||||
return ;
|
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
|
"ERROR-Error getting the user session, no session found"
|
||||||
|
+ session);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
logger.info("CSVImportFileServlet import session id: "+session.getId());
|
logger.info("CSVImportFileServlet import session id: "
|
||||||
|
+ session.getId());
|
||||||
|
|
||||||
|
ServiceCredentials serviceCredentials;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID);
|
||||||
String token = SessionUtil.getToken(aslSession);
|
serviceCredentials = SessionUtil.getServiceCredentials(request,
|
||||||
logger.debug("UserToken: " + token);
|
scopeGroupId);
|
||||||
ScopeProvider.instance.set(aslSession.getScope().toString());
|
|
||||||
|
ScopeProvider.instance.set(serviceCredentials.getScope());
|
||||||
|
|
||||||
} catch (TDGWTServiceException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(
|
||||||
e.printStackTrace();
|
"Error retrieving credentials:" + e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
throw new ServletException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSVFileUploadSession fileUploadSession = SessionUtil
|
||||||
CSVFileUploadSession fileUploadSession=SessionUtil.getCSVFileUploadSession(session);
|
.getCSVFileUploadSession(request, serviceCredentials);
|
||||||
|
|
||||||
if (fileUploadSession == null)
|
if (fileUploadSession == null) {
|
||||||
{
|
logger.error("Error getting the upload session, no fileUploadSession found: "
|
||||||
logger.error("Error getting the upload session, no fileUploadSession found: "+fileUploadSession);
|
+ fileUploadSession);
|
||||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "ERROR-Error getting the user session, no fileUploadSession found: "+fileUploadSession);
|
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
return ;
|
"ERROR-Error getting the user session, no fileUploadSession found: "
|
||||||
|
+ fileUploadSession);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setContentType("application/json; charset=utf-8");
|
response.setContentType("application/json; charset=utf-8");
|
||||||
Charset outputCharset = Charset.forName("Utf-8");
|
Charset outputCharset = Charset.forName("Utf-8");
|
||||||
|
|
||||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
CSVFileUtil.toJson(new FileInputStream(fileUploadSession.getCsvFile()), os, outputCharset, fileUploadSession.getParserConfiguration(), 100);
|
CSVFileUtil.toJson(new FileInputStream(fileUploadSession.getCsvFile()),
|
||||||
|
os, outputCharset, fileUploadSession.getParserConfiguration(),
|
||||||
logger.trace("json: "+os.toString());
|
100);
|
||||||
System.out.println("json: "+os.toString());
|
|
||||||
|
logger.trace("json: " + os.toString());
|
||||||
|
System.out.println("json: " + os.toString());
|
||||||
response.getOutputStream().write(os.toByteArray());
|
response.getOutputStream().write(os.toByteArray());
|
||||||
|
|
||||||
//CSVFileUtil.toJson(new FileInputStream(importSession.getCsvFile()), response.getOutputStream(), outputCharset, importSession.getParserConfiguration(), 100);
|
// CSVFileUtil.toJson(new FileInputStream(importSession.getCsvFile()),
|
||||||
|
// response.getOutputStream(), outputCharset,
|
||||||
|
// importSession.getParserConfiguration(), 100);
|
||||||
|
|
||||||
response.setStatus(HttpServletResponse.SC_OK);
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
logger.trace("Response in "+(System.currentTimeMillis()-startTime));
|
logger.trace("Response in " + (System.currentTimeMillis() - startTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ package org.gcube.portlets.user.td.gwtservice.server;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
@ -25,7 +26,6 @@ import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -94,8 +94,10 @@ public class CodelistMappingUploadServlet extends HttpServlet {
|
||||||
// CodelistMappingMonitor codelistMappingMonitor=new
|
// CodelistMappingMonitor codelistMappingMonitor=new
|
||||||
// CodelistMappingMonitor();
|
// CodelistMappingMonitor();
|
||||||
FileUploadMonitor fileUploadMonitor = new FileUploadMonitor();
|
FileUploadMonitor fileUploadMonitor = new FileUploadMonitor();
|
||||||
|
|
||||||
codelistMappingFileUploadSession.setId(session.getId());
|
String id=UUID.randomUUID().toString();
|
||||||
|
logger.info("Upload Id: "+id);
|
||||||
|
codelistMappingFileUploadSession.setId(id);
|
||||||
codelistMappingFileUploadSession
|
codelistMappingFileUploadSession
|
||||||
.setFileUploadState(FileUploadState.STARTED);
|
.setFileUploadState(FileUploadState.STARTED);
|
||||||
// codelistMappingFileUploadSession.setCodelistMappingMonitor(codelistMappingMonitor);
|
// codelistMappingFileUploadSession.setCodelistMappingMonitor(codelistMappingMonitor);
|
||||||
|
|
|
@ -6,6 +6,7 @@ package org.gcube.portlets.user.td.gwtservice.server;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
@ -18,13 +19,13 @@ import org.apache.commons.fileupload.FileItemFactory;
|
||||||
import org.apache.commons.fileupload.FileUploadException;
|
import org.apache.commons.fileupload.FileUploadException;
|
||||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||||
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
|
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadListener;
|
import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadListener;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil;
|
import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -32,75 +33,78 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LocalUploadServlet extends HttpServlet {
|
public class LocalUploadServlet extends HttpServlet {
|
||||||
|
|
||||||
protected static Logger logger = LoggerFactory.getLogger(LocalUploadServlet.class);
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(LocalUploadServlet.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4197748678713054285L;
|
private static final long serialVersionUID = -4197748678713054285L;
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
protected void doPost(HttpServletRequest request,
|
||||||
|
HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
logger.trace("Post");
|
logger.trace("Post");
|
||||||
|
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
|
|
||||||
if(session==null){
|
if (session == null) {
|
||||||
logger.error("Error getting the upload session, no session valid found: "+session);
|
logger.error("Error getting the upload session, no session valid found: "
|
||||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "ERROR-Error getting the user session, no session found"+session);
|
+ session);
|
||||||
return ;
|
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
|
"ERROR-Error getting the user session, no session found"
|
||||||
|
+ session);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
logger.info("CSV Import session id: "+session.getId());
|
logger.info("CSV Import session id: " + session.getId());
|
||||||
|
|
||||||
|
ServiceCredentials serviceCredentials;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID);
|
||||||
String token = SessionUtil.getToken(aslSession);
|
serviceCredentials = SessionUtil.getServiceCredentials(request,
|
||||||
logger.debug("UserToken: " + token);
|
scopeGroupId);
|
||||||
ScopeProvider.instance.set(aslSession.getScope().toString());
|
|
||||||
|
ScopeProvider.instance.set(serviceCredentials.getScope());
|
||||||
|
|
||||||
} catch (TDGWTServiceException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(
|
||||||
e.printStackTrace();
|
"Error retrieving credentials:" + e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
throw new ServletException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVFileUploadSession fileUploadSession=new CSVFileUploadSession();
|
CSVFileUploadSession fileUploadSession = new CSVFileUploadSession();
|
||||||
//CSVImportMonitor csvImportMonitor=new CSVImportMonitor();
|
// CSVImportMonitor csvImportMonitor=new CSVImportMonitor();
|
||||||
FileUploadMonitor fileUploadMonitor=new FileUploadMonitor();
|
FileUploadMonitor fileUploadMonitor = new FileUploadMonitor();
|
||||||
|
|
||||||
fileUploadSession.setId(session.getId());
|
String id = UUID.randomUUID().toString();
|
||||||
|
logger.info("Upload Id: " + id);
|
||||||
|
fileUploadSession.setId(id);
|
||||||
fileUploadSession.setFileUploadState(FileUploadState.STARTED);
|
fileUploadSession.setFileUploadState(FileUploadState.STARTED);
|
||||||
//fileUploadSession.setCsvImportMonitor(csvImportMonitor);
|
// fileUploadSession.setCsvImportMonitor(csvImportMonitor);
|
||||||
SessionUtil.setFileUploadMonitor(session, fileUploadMonitor);
|
SessionUtil.setFileUploadMonitor(request, serviceCredentials,
|
||||||
|
fileUploadMonitor);
|
||||||
|
|
||||||
|
SessionUtil.setCSVFileUploadSession(request, serviceCredentials,
|
||||||
try {
|
fileUploadSession);
|
||||||
SessionUtil.setCSVFileUploadSession(session,fileUploadSession);
|
|
||||||
} catch (TDGWTSessionExpiredException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FileItemFactory factory = new DiskFileItemFactory();
|
FileItemFactory factory = new DiskFileItemFactory();
|
||||||
ServletFileUpload upload = new ServletFileUpload(factory);
|
ServletFileUpload upload = new ServletFileUpload(factory);
|
||||||
|
|
||||||
|
FileUploadListener uploadListener = new FileUploadListener(
|
||||||
FileUploadListener uploadListener = new FileUploadListener(fileUploadMonitor);
|
fileUploadMonitor);
|
||||||
upload.setProgressListener(uploadListener);
|
upload.setProgressListener(uploadListener);
|
||||||
|
|
||||||
FileItem uploadItem = null;
|
FileItem uploadItem = null;
|
||||||
Log.info("Start upload file ");
|
Log.info("Start upload file ");
|
||||||
try {
|
try {
|
||||||
|
@ -108,82 +112,102 @@ public class LocalUploadServlet extends HttpServlet {
|
||||||
Iterator it = items.iterator();
|
Iterator it = items.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
FileItem item = (FileItem) it.next();
|
FileItem item = (FileItem) it.next();
|
||||||
if (!item.isFormField() && "uploadFormElement".equals(item.getFieldName())) {
|
if (!item.isFormField()
|
||||||
|
&& "uploadFormElement".equals(item.getFieldName())) {
|
||||||
uploadItem = item;
|
uploadItem = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (FileUploadException e) {
|
} catch (FileUploadException e) {
|
||||||
FileUploadMonitor fum=SessionUtil.getFileUploadMonitor(session);
|
FileUploadMonitor fum;
|
||||||
fum.setFailed("An error occured elaborating the HTTP request", FileUtil.exceptionDetailMessage(e));
|
|
||||||
SessionUtil.setFileUploadMonitor(session, fum);
|
|
||||||
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
|
||||||
try {
|
try {
|
||||||
SessionUtil.setCSVFileUploadSession(session, fileUploadSession);
|
fum = SessionUtil.getFileUploadMonitor(request,
|
||||||
} catch (TDGWTSessionExpiredException e1) {
|
serviceCredentials);
|
||||||
logger.error(e1.getLocalizedMessage());
|
} catch (TDGWTServiceException e1) {
|
||||||
e1.printStackTrace();
|
logger.error(e1.getLocalizedMessage(), e1);
|
||||||
throw new ServletException(e1.getLocalizedMessage());
|
throw new ServletException(e1.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
fum.setFailed("An error occured elaborating the HTTP request",
|
||||||
|
FileUtil.exceptionDetailMessage(e));
|
||||||
|
SessionUtil.setFileUploadMonitor(request, serviceCredentials, fum);
|
||||||
|
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
||||||
|
|
||||||
|
SessionUtil.setCSVFileUploadSession(request, serviceCredentials,
|
||||||
|
fileUploadSession);
|
||||||
|
|
||||||
logger.error("Error processing request in upload servlet", e);
|
logger.error("Error processing request in upload servlet", e);
|
||||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "ERROR-Error during request processing: "+e.getMessage());
|
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
|
"ERROR-Error during request processing: " + e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uploadItem == null) {
|
if (uploadItem == null) {
|
||||||
FileUploadMonitor fum=SessionUtil.getFileUploadMonitor(session);
|
FileUploadMonitor fum;
|
||||||
fum.setFailed("An error occured elaborating the HTTP request: No file found", "Upload request without file");
|
|
||||||
SessionUtil.setFileUploadMonitor(session, fum);
|
|
||||||
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
|
||||||
try {
|
try {
|
||||||
SessionUtil.setCSVFileUploadSession(session, fileUploadSession);
|
fum = SessionUtil.getFileUploadMonitor(request,
|
||||||
} catch (TDGWTSessionExpiredException e) {
|
serviceCredentials);
|
||||||
logger.error(e.getLocalizedMessage());
|
} catch (TDGWTServiceException e) {
|
||||||
e.printStackTrace();
|
logger.error(e.getLocalizedMessage(), e);
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
throw new ServletException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
fum.setFailed(
|
||||||
|
"An error occured elaborating the HTTP request: No file found",
|
||||||
|
"Upload request without file");
|
||||||
|
SessionUtil.setFileUploadMonitor(request, serviceCredentials, fum);
|
||||||
|
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
||||||
|
|
||||||
|
SessionUtil.setCSVFileUploadSession(request, serviceCredentials,
|
||||||
|
fileUploadSession);
|
||||||
|
|
||||||
logger.error("Error processing request in upload servlet: No file to upload");
|
logger.error("Error processing request in upload servlet: No file to upload");
|
||||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "No file to upload");
|
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
|
"No file to upload");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String contentType = uploadItem.getContentType();
|
String contentType = uploadItem.getContentType();
|
||||||
|
|
||||||
logger.trace("ContentType: "+contentType);
|
logger.trace("ContentType: " + contentType);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileUtil.setImportFileCSV(fileUploadSession, uploadItem.getInputStream(), uploadItem.getName(), contentType);
|
FileUtil.setImportFileCSV(fileUploadSession,
|
||||||
|
uploadItem.getInputStream(), uploadItem.getName(),
|
||||||
|
contentType);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileUploadMonitor fum=SessionUtil.getFileUploadMonitor(session);
|
FileUploadMonitor fum;
|
||||||
fum.setFailed("An error occured elaborating the file", FileUtil.exceptionDetailMessage(e));
|
|
||||||
SessionUtil.setFileUploadMonitor(session, fum);
|
|
||||||
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
|
||||||
try {
|
try {
|
||||||
SessionUtil.setCSVFileUploadSession(session, fileUploadSession);
|
fum = SessionUtil.getFileUploadMonitor(request,
|
||||||
} catch (TDGWTSessionExpiredException e1) {
|
serviceCredentials);
|
||||||
logger.error(e1.getLocalizedMessage());
|
} catch (TDGWTServiceException e1) {
|
||||||
e1.printStackTrace();
|
logger.error(e1.getLocalizedMessage(), e1);
|
||||||
throw new ServletException(e1.getLocalizedMessage());
|
throw new ServletException(e1.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
fum.setFailed("An error occured elaborating the file",
|
||||||
|
FileUtil.exceptionDetailMessage(e));
|
||||||
|
SessionUtil.setFileUploadMonitor(request, serviceCredentials, fum);
|
||||||
|
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
||||||
|
SessionUtil.setCSVFileUploadSession(request, serviceCredentials,
|
||||||
|
fileUploadSession);
|
||||||
logger.error("Error elaborating the stream", e);
|
logger.error("Error elaborating the stream", e);
|
||||||
uploadItem.delete();
|
uploadItem.delete();
|
||||||
response.getWriter().write("ERROR-"+e.getMessage());
|
response.getWriter().write("ERROR-" + e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadItem.delete();
|
uploadItem.delete();
|
||||||
|
|
||||||
logger.trace("changing state");
|
logger.trace("changing state");
|
||||||
FileUploadMonitor fum=SessionUtil.getFileUploadMonitor(session);
|
FileUploadMonitor fum;
|
||||||
fum.setState(FileUploadState.COMPLETED);
|
|
||||||
SessionUtil.setFileUploadMonitor(session, fum);
|
|
||||||
try {
|
try {
|
||||||
SessionUtil.setCSVFileUploadSession(session, fileUploadSession);
|
fum = SessionUtil.getFileUploadMonitor(request, serviceCredentials);
|
||||||
} catch (TDGWTSessionExpiredException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage(), e);
|
||||||
e.printStackTrace();
|
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
throw new ServletException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
fum.setState(FileUploadState.COMPLETED);
|
||||||
|
SessionUtil.setFileUploadMonitor(request, serviceCredentials, fum);
|
||||||
|
|
||||||
|
SessionUtil.setCSVFileUploadSession(request, serviceCredentials,
|
||||||
|
fileUploadSession);
|
||||||
response.getWriter().write("OK");
|
response.getWriter().write("OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,10 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -29,10 +30,10 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class RetrieveChartFileServlet extends HttpServlet {
|
public class RetrieveChartFileServlet extends HttpServlet {
|
||||||
private static final long serialVersionUID = -1649268678733476057L;
|
private static final long serialVersionUID = -1649268678733476057L;
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(RetrieveChartFileServlet.class);
|
.getLogger(RetrieveChartFileServlet.class);
|
||||||
|
|
||||||
private static final String ATTRIBUTE_STORAGE_URI = "storageURI";
|
private static final String ATTRIBUTE_STORAGE_URI = "storageURI";
|
||||||
private static final String IMAGE_MIME_TYPE = "image/jpeg";
|
private static final String IMAGE_MIME_TYPE = "image/jpeg";
|
||||||
private static final int BUFSIZE = 4096;
|
private static final int BUFSIZE = 4096;
|
||||||
|
@ -66,32 +67,35 @@ public class RetrieveChartFileServlet extends HttpServlet {
|
||||||
}
|
}
|
||||||
logger.debug("RetrieveChartFileServlet session id: "
|
logger.debug("RetrieveChartFileServlet session id: "
|
||||||
+ session.getId());
|
+ session.getId());
|
||||||
|
|
||||||
|
ServiceCredentials serviceCredentials;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
String scopeGroupId = request
|
||||||
String token = SessionUtil.getToken(aslSession);
|
.getParameter(Constants.CURR_GROUP_ID);
|
||||||
logger.debug("UserToken: " + token);
|
serviceCredentials = SessionUtil.getServiceCredentials(request,
|
||||||
ScopeProvider.instance.set(aslSession.getScope().toString());
|
scopeGroupId);
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(serviceCredentials.getScope());
|
||||||
|
|
||||||
} catch (TDGWTServiceException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(
|
||||||
e.printStackTrace();
|
"Error retrieving credentials:"
|
||||||
|
+ e.getLocalizedMessage(), e);
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
throw new ServletException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
String uri = (String) request.getParameter(ATTRIBUTE_STORAGE_URI);
|
String uri = (String) request.getParameter(ATTRIBUTE_STORAGE_URI);
|
||||||
logger.debug("Request storage uri: "+uri);
|
logger.debug("Request storage uri: " + uri);
|
||||||
|
|
||||||
if(uri==null|| uri.isEmpty()){
|
if (uri == null || uri.isEmpty()) {
|
||||||
logger.error("Error getting request uri: "
|
logger.error("Error getting request uri: " + uri);
|
||||||
+ uri);
|
|
||||||
response.sendError(
|
response.sendError(
|
||||||
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
"ERROR-Error getting request uri: "
|
"ERROR-Error getting request uri: " + session);
|
||||||
+ session);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesStorage storage = new FilesStorage();
|
FilesStorage storage = new FilesStorage();
|
||||||
InputStream in = storage.retrieveInputStream(uri);
|
InputStream in = storage.retrieveInputStream(uri);
|
||||||
OutputStream out = response.getOutputStream();
|
OutputStream out = response.getOutputStream();
|
||||||
|
@ -112,9 +116,9 @@ public class RetrieveChartFileServlet extends HttpServlet {
|
||||||
+ (System.currentTimeMillis() - startTime));
|
+ (System.currentTimeMillis() - startTime));
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Error retrieving file from storage: "
|
logger.error(
|
||||||
+ e.getLocalizedMessage());
|
"Error retrieving file from storage: "
|
||||||
e.printStackTrace();
|
+ e.getLocalizedMessage(), e);
|
||||||
response.sendError(
|
response.sendError(
|
||||||
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
"Error retrieving file from storage: "
|
"Error retrieving file from storage: "
|
||||||
|
|
|
@ -11,8 +11,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -62,15 +63,18 @@ public class RetrieveFileAndDiscoverMimeTypeServlet extends HttpServlet {
|
||||||
}
|
}
|
||||||
logger.debug("RetrieveFileAndDiscoverMimeTypeServlet session id: "
|
logger.debug("RetrieveFileAndDiscoverMimeTypeServlet session id: "
|
||||||
+ session.getId());
|
+ session.getId());
|
||||||
|
ServiceCredentials serviceCredentials;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID);
|
||||||
String token = SessionUtil.getToken(aslSession);
|
serviceCredentials = SessionUtil.getServiceCredentials(request,
|
||||||
logger.debug("UserToken: " + token);
|
scopeGroupId);
|
||||||
ScopeProvider.instance.set(aslSession.getScope().toString());
|
ScopeProvider.instance.set(serviceCredentials.getScope());
|
||||||
|
|
||||||
} catch (TDGWTServiceException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(
|
||||||
e.printStackTrace();
|
"Error retrieving credentials:" + e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
throw new ServletException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,9 @@ import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -64,18 +65,22 @@ public class TDLogsServlet extends HttpServlet {
|
||||||
|
|
||||||
logger.debug("TDLogsServlet import session id: " + session.getId());
|
logger.debug("TDLogsServlet import session id: " + session.getId());
|
||||||
|
|
||||||
|
ServiceCredentials serviceCredentials;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID);
|
||||||
String token = SessionUtil.getToken(aslSession);
|
serviceCredentials = SessionUtil.getServiceCredentials(request,
|
||||||
logger.debug("UserToken: " + token);
|
scopeGroupId);
|
||||||
ScopeProvider.instance.set(aslSession.getScope().toString());
|
|
||||||
|
ScopeProvider.instance.set(serviceCredentials.getScope());
|
||||||
|
|
||||||
} catch (TDGWTServiceException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(
|
||||||
e.printStackTrace();
|
"Error retrieving credentials:" + e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
throw new ServletException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayInputStream in = null;
|
ByteArrayInputStream in = null;
|
||||||
ByteArrayOutputStream out = null;
|
ByteArrayOutputStream out = null;
|
||||||
try {
|
try {
|
||||||
|
@ -96,12 +101,12 @@ public class TDLogsServlet extends HttpServlet {
|
||||||
response.setStatus(HttpServletResponse.SC_OK);
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
logger.error("File not found: " + e.getLocalizedMessage());
|
logger.error("File not found: " + e.getLocalizedMessage(), e);
|
||||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
e.getLocalizedMessage());
|
e.getLocalizedMessage());
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("IO error: " + e.getLocalizedMessage());
|
logger.error("IO error: " + e.getLocalizedMessage(), e);
|
||||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
e.getLocalizedMessage());
|
e.getLocalizedMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -14,8 +14,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -28,14 +29,13 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TDRStudioServlet extends HttpServlet {
|
public class TDRStudioServlet extends HttpServlet {
|
||||||
private static final String TAB_RESOURCE_ID_PARAMETER="TabResourceId";
|
private static final String TAB_RESOURCE_ID_PARAMETER = "TabResourceId";
|
||||||
//private static final String SECURITY_EXCEPTION_RIGHTS = "Security exception, you don't have the required rights!";
|
// private static final String SECURITY_EXCEPTION_RIGHTS =
|
||||||
|
// "Security exception, you don't have the required rights!";
|
||||||
|
|
||||||
private static final long serialVersionUID = -1649268678733476057L;
|
private static final long serialVersionUID = -1649268678733476057L;
|
||||||
private static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(TDRStudioServlet.class);
|
.getLogger(TDRStudioServlet.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
@ -64,47 +64,46 @@ public class TDRStudioServlet extends HttpServlet {
|
||||||
+ session);
|
+ session);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.debug("TDRSTudioServlet session id: "
|
logger.debug("TDRSTudioServlet session id: " + session.getId());
|
||||||
+ session.getId());
|
|
||||||
|
ServiceCredentials serviceCredentials;
|
||||||
ASLSession aslSession=null;
|
|
||||||
try {
|
try {
|
||||||
aslSession= SessionUtil.getAslSession(session);
|
String scopeGroupId = request
|
||||||
String token = SessionUtil.getToken(aslSession);
|
.getParameter(Constants.CURR_GROUP_ID);
|
||||||
logger.debug("UserToken: " + token);
|
serviceCredentials = SessionUtil.getServiceCredentials(request,
|
||||||
ScopeProvider.instance.set(aslSession.getScope().toString());
|
scopeGroupId);
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(serviceCredentials.getScope());
|
||||||
|
|
||||||
} catch (TDGWTServiceException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(
|
||||||
e.printStackTrace();
|
"Error retrieving credentials:"
|
||||||
|
+ e.getLocalizedMessage(), e);
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
throw new ServletException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String tabResourceId = request
|
||||||
String tabResourceId=request.getParameter(TAB_RESOURCE_ID_PARAMETER);
|
.getParameter(TAB_RESOURCE_ID_PARAMETER);
|
||||||
logger.debug("Request RStudio for TR: "+tabResourceId);
|
logger.debug("Request RStudio for TR: " + tabResourceId);
|
||||||
|
|
||||||
URI url=rConnector().build().connect(Long.valueOf(tabResourceId));
|
URI url = rConnector().build().connect(Long.valueOf(tabResourceId));
|
||||||
logger.debug("URL retrieved from rConnector: "+url.toString());
|
logger.debug("URL retrieved from rConnector: " + url.toString());
|
||||||
|
|
||||||
//response.setStatus(HttpServletResponse.SC_OK);
|
// response.setStatus(HttpServletResponse.SC_OK);
|
||||||
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
||||||
response.setHeader("Location", url.toString());
|
response.setHeader("Location", url.toString());
|
||||||
response.setHeader("gcube-scope", aslSession.getScope());
|
response.setHeader("gcube-scope", serviceCredentials.getScope());
|
||||||
//response.setHeader("Set-Cookie", "PippoPlutoPaperino");
|
// response.setHeader("Set-Cookie", "PippoPlutoPaperino");
|
||||||
//response.setHeader("Set-Cookie", cookieValue);
|
// response.setHeader("Set-Cookie", cookieValue);
|
||||||
|
|
||||||
logger.debug("Response: "+response.toString());
|
logger.debug("Response: " + response.toString());
|
||||||
|
|
||||||
logger.trace("Response in "
|
logger.trace("Response in "
|
||||||
+ (System.currentTimeMillis() - startTime)+"ms");
|
+ (System.currentTimeMillis() - startTime) + "ms");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Error TDRStudio: "
|
logger.error("Error TDRStudio: " + e.getLocalizedMessage(), e);
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendError(
|
response.sendError(
|
||||||
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
"Error retrieving file from storage: "
|
"Error retrieving file from storage: "
|
||||||
|
|
|
@ -12,8 +12,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@ -51,26 +52,35 @@ public class TabularDataRowsXServlet extends HttpServlet {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
|
|
||||||
if(session==null){
|
if (session == null) {
|
||||||
logger.error("Error getting the upload session, no session valid found: "+session);
|
logger.error("Error getting the upload session, no session valid found: "
|
||||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "ERROR-Error getting the user session, no session found"+session);
|
+ session);
|
||||||
return ;
|
response.sendError(
|
||||||
|
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
|
"ERROR-Error getting the user session, no session found"
|
||||||
|
+ session);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
logger.info("Session id: "+session.getId());
|
logger.info("Session id: " + session.getId());
|
||||||
|
|
||||||
|
ServiceCredentials serviceCredentials;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
String scopeGroupId = request
|
||||||
String token = SessionUtil.getToken(aslSession);
|
.getParameter(Constants.CURR_GROUP_ID);
|
||||||
logger.debug("UserToken: " + token);
|
serviceCredentials = SessionUtil.getServiceCredentials(request,
|
||||||
ScopeProvider.instance.set(aslSession.getScope().toString());
|
scopeGroupId);
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(serviceCredentials.getScope());
|
||||||
|
|
||||||
} catch (TDGWTServiceException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(
|
||||||
e.printStackTrace();
|
"Error retrieving credentials:"
|
||||||
|
+ e.getLocalizedMessage(), e);
|
||||||
throw new ServletException(e.getLocalizedMessage());
|
throw new ServletException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
ServletInputStream in = request.getInputStream();
|
ServletInputStream in = request.getInputStream();
|
||||||
InputStreamReader buffIn = new InputStreamReader(in);
|
InputStreamReader buffIn = new InputStreamReader(in);
|
||||||
char[] buffer = new char[1024];
|
char[] buffer = new char[1024];
|
||||||
|
@ -84,31 +94,31 @@ public class TabularDataRowsXServlet extends HttpServlet {
|
||||||
|
|
||||||
JSONObject jsonRequest = new JSONObject(out.toString());
|
JSONObject jsonRequest = new JSONObject(out.toString());
|
||||||
logger.debug("JSON request:" + jsonRequest.toString());
|
logger.debug("JSON request:" + jsonRequest.toString());
|
||||||
|
|
||||||
//RowIds
|
// RowIds
|
||||||
JSONArray ids = null;
|
JSONArray ids = null;
|
||||||
ArrayList<String> rowsIds=new ArrayList<String>();
|
ArrayList<String> rowsIds = new ArrayList<String>();
|
||||||
try {
|
try {
|
||||||
ids = jsonRequest.getJSONArray("rowsIds");
|
ids = jsonRequest.getJSONArray("rowsIds");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
logger.debug("rowsIds: " + e.getLocalizedMessage());
|
logger.debug("rowsIds: " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ids != null) {
|
if (ids != null) {
|
||||||
for (int i = 0; i < ids.length(); i++) {
|
for (int i = 0; i < ids.length(); i++) {
|
||||||
String filter = ids.getString(i);
|
String filter = ids.getString(i);
|
||||||
|
|
||||||
rowsIds.add(filter);
|
rowsIds.add(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.debug("rowsIds:" + rowsIds.size());
|
logger.debug("rowsIds:" + rowsIds.size());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
DataSourceX dataSource = SessionUtil.getDataSource(
|
* DataSourceX dataSource = SessionUtil.getDataSource(
|
||||||
request.getSession(), tdSessionId);*/
|
* request.getSession(), tdSessionId);
|
||||||
String json=new String();// = dataSource.getRowsAsJson(rowsIds);
|
*/
|
||||||
|
String json = new String();// = dataSource.getRowsAsJson(rowsIds);
|
||||||
|
|
||||||
response.getOutputStream().write(json.getBytes());
|
response.getOutputStream().write(json.getBytes());
|
||||||
response.setStatus(HttpServletResponse.SC_OK);
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
// logger.trace("JSON: "+json);
|
// logger.trace("JSON: "+json);
|
||||||
|
|
|
@ -8,25 +8,24 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVFileUploadSession implements Serializable {
|
public class CSVFileUploadSession implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7906477664944910362L;
|
private static final long serialVersionUID = -7906477664944910362L;
|
||||||
|
|
||||||
protected String id;
|
private String id;
|
||||||
|
|
||||||
protected FileUploadState fileUploadState;
|
private FileUploadState fileUploadState;
|
||||||
|
|
||||||
protected File csvFile;
|
private File csvFile;
|
||||||
protected String csvName;
|
private String csvName;
|
||||||
|
|
||||||
protected CSVParserConfiguration parserConfiguration;
|
protected CSVParserConfiguration parserConfiguration;
|
||||||
|
|
||||||
//protected CSVImportMonitor csvImportMonitor;
|
// protected CSVImportMonitor csvImportMonitor;
|
||||||
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -64,7 +63,8 @@ public class CSVFileUploadSession implements Serializable {
|
||||||
return parserConfiguration;
|
return parserConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParserConfiguration(CSVParserConfiguration parserConfiguration) {
|
public void setParserConfiguration(
|
||||||
|
CSVParserConfiguration parserConfiguration) {
|
||||||
this.parserConfiguration = parserConfiguration;
|
this.parserConfiguration = parserConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,5 @@ public class CSVFileUploadSession implements Serializable {
|
||||||
+ csvName + ", parserConfiguration=" + parserConfiguration
|
+ csvName + ", parserConfiguration=" + parserConfiguration
|
||||||
+ "]";
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,12 @@ public class CodelistMappingFileUploadSession implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5683392670926072167L;
|
private static final long serialVersionUID = -5683392670926072167L;
|
||||||
|
|
||||||
protected String id;
|
private String id;
|
||||||
|
|
||||||
protected FileUploadState fileUploadState;
|
private FileUploadState fileUploadState;
|
||||||
|
|
||||||
protected File codelistMappingFile;
|
private File codelistMappingFile;
|
||||||
protected String codelistMappingName;
|
private String codelistMappingName;
|
||||||
|
|
||||||
//protected CodelistMappingMonitor codelistMappingMonitor;
|
//protected CodelistMappingMonitor codelistMappingMonitor;
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ package org.gcube.portlets.user.td.gwtservice.server.file;
|
||||||
import org.apache.commons.fileupload.ProgressListener;
|
import org.apache.commons.fileupload.ProgressListener;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -17,11 +15,11 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class FileUploadListener implements ProgressListener {
|
public class FileUploadListener implements ProgressListener {
|
||||||
|
|
||||||
protected Logger logger=LoggerFactory.getLogger(FileUploadListener.class);
|
//private Logger logger=LoggerFactory.getLogger(FileUploadListener.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected FileUploadMonitor fileUploadMonitor;
|
private FileUploadMonitor fileUploadMonitor;
|
||||||
|
|
||||||
private long num100Ks = 0;
|
private long num100Ks = 0;
|
||||||
private long theBytesRead = 0;
|
private long theBytesRead = 0;
|
||||||
|
|
|
@ -17,9 +17,15 @@ import org.apache.commons.io.IOUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class FileUtil {
|
public class FileUtil {
|
||||||
|
|
||||||
protected static final Logger logger = LoggerFactory
|
private static final Logger logger = LoggerFactory
|
||||||
.getLogger(FileUtil.class);
|
.getLogger(FileUtil.class);
|
||||||
|
|
||||||
public static final String[] ZIP_MIMETYPES = new String[] {
|
public static final String[] ZIP_MIMETYPES = new String[] {
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4AddColumn extends OpExecutionBuilder {
|
public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4AddColumn.class);
|
.getLogger(OpExecution4AddColumn.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4CSVExport extends OpExecutionBuilder {
|
public class OpExecution4CSVExport extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4CSVExport.class);
|
.getLogger(OpExecution4CSVExport.class);
|
||||||
|
|
||||||
private HttpServletRequest httpRequest;
|
private HttpServletRequest httpRequest;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4CSVImport extends OpExecutionBuilder {
|
public class OpExecution4CSVImport extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4CSVImport.class);
|
.getLogger(OpExecution4CSVImport.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4ChangeColumnType extends OpExecutionBuilder {
|
public class OpExecution4ChangeColumnType extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4ChangeColumnType.class);
|
.getLogger(OpExecution4ChangeColumnType.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4ChangeTableType extends OpExecutionBuilder {
|
public class OpExecution4ChangeTableType extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4ChangeTableType.class);
|
.getLogger(OpExecution4ChangeTableType.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4ChartTopRating extends OpExecutionBuilder {
|
public class OpExecution4ChartTopRating extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4ChartTopRating.class);
|
.getLogger(OpExecution4ChartTopRating.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4Clone extends OpExecutionBuilder {
|
public class OpExecution4Clone extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4Clone.class);
|
.getLogger(OpExecution4Clone.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4CodelistMapping extends OpExecutionBuilder {
|
public class OpExecution4CodelistMapping extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4CodelistMapping.class);
|
.getLogger(OpExecution4CodelistMapping.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4DeleteColumn extends OpExecutionBuilder {
|
public class OpExecution4DeleteColumn extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4DeleteColumn.class);
|
.getLogger(OpExecution4DeleteColumn.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4DeleteRows extends OpExecutionBuilder {
|
public class OpExecution4DeleteRows extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4DeleteRows.class);
|
.getLogger(OpExecution4DeleteRows.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4Denormalization extends OpExecutionBuilder {
|
public class OpExecution4Denormalization extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4Denormalization.class);
|
.getLogger(OpExecution4Denormalization.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4Duplicates extends OpExecutionBuilder {
|
public class OpExecution4Duplicates extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4Duplicates.class);
|
.getLogger(OpExecution4Duplicates.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class OpExecution4ExtractCodelist extends
|
public class OpExecution4ExtractCodelist extends
|
||||||
OpExecutionBuilder {
|
OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4ExtractCodelist.class);
|
.getLogger(OpExecution4ExtractCodelist.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4FilterColumn extends OpExecutionBuilder {
|
public class OpExecution4FilterColumn extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4FilterColumn.class);
|
.getLogger(OpExecution4FilterColumn.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -41,7 +41,7 @@ import static org.gcube.data.analysis.tabulardata.expression.dsl.Types.*;
|
||||||
public class OpExecution4GeometryCreatePoint extends OpExecutionBuilder {
|
public class OpExecution4GeometryCreatePoint extends OpExecutionBuilder {
|
||||||
|
|
||||||
|
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4GeometryCreatePoint.class);
|
.getLogger(OpExecution4GeometryCreatePoint.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder {
|
public class OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4GeospatialCreateCoordinates.class);
|
.getLogger(OpExecution4GeospatialCreateCoordinates.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4GeospatialDownscaleCSquare extends OpExecutionBuilder {
|
public class OpExecution4GeospatialDownscaleCSquare extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4GeospatialDownscaleCSquare.class);
|
.getLogger(OpExecution4GeospatialDownscaleCSquare.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4GroupBy extends OpExecutionBuilder {
|
public class OpExecution4GroupBy extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4GroupBy.class);
|
.getLogger(OpExecution4GroupBy.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4JSONExport extends OpExecutionBuilder {
|
public class OpExecution4JSONExport extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4JSONExport.class);
|
.getLogger(OpExecution4JSONExport.class);
|
||||||
|
|
||||||
private HttpServletRequest httpRequest;
|
private HttpServletRequest httpRequest;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4LabelColumn extends OpExecutionBuilder {
|
public class OpExecution4LabelColumn extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4LabelColumn.class);
|
.getLogger(OpExecution4LabelColumn.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4MapCreation extends OpExecutionBuilder {
|
public class OpExecution4MapCreation extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4MapCreation.class);
|
.getLogger(OpExecution4MapCreation.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4MergeColumn extends OpExecutionBuilder {
|
public class OpExecution4MergeColumn extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4MergeColumn.class);
|
.getLogger(OpExecution4MergeColumn.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4Normalization extends OpExecutionBuilder {
|
public class OpExecution4Normalization extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4Normalization.class);
|
.getLogger(OpExecution4Normalization.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4ReplaceBatch extends OpExecutionBuilder {
|
public class OpExecution4ReplaceBatch extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4ReplaceBatch.class);
|
.getLogger(OpExecution4ReplaceBatch.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4ReplaceByExternal extends OpExecutionBuilder {
|
public class OpExecution4ReplaceByExternal extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4ReplaceByExternal.class);
|
.getLogger(OpExecution4ReplaceByExternal.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4ReplaceColumn extends OpExecutionBuilder {
|
public class OpExecution4ReplaceColumn extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4ReplaceColumn.class);
|
.getLogger(OpExecution4ReplaceColumn.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4ReplaceColumnByExpression extends OpExecutionBuilder {
|
public class OpExecution4ReplaceColumnByExpression extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4ReplaceColumnByExpression.class);
|
.getLogger(OpExecution4ReplaceColumnByExpression.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4SDMXCodelistExport extends OpExecutionBuilder {
|
public class OpExecution4SDMXCodelistExport extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4SDMXCodelistExport.class);
|
.getLogger(OpExecution4SDMXCodelistExport.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4SDMXCodelistImport extends OpExecutionBuilder {
|
public class OpExecution4SDMXCodelistImport extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4SDMXCodelistImport.class);
|
.getLogger(OpExecution4SDMXCodelistImport.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4SplitColumn extends OpExecutionBuilder {
|
public class OpExecution4SplitColumn extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4SplitColumn.class);
|
.getLogger(OpExecution4SplitColumn.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4StatisticalOperation extends OpExecutionBuilder {
|
public class OpExecution4StatisticalOperation extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4StatisticalOperation.class);
|
.getLogger(OpExecution4StatisticalOperation.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4TimeAggregation extends OpExecutionBuilder {
|
public class OpExecution4TimeAggregation extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4TimeAggregation.class);
|
.getLogger(OpExecution4TimeAggregation.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecution4Union extends OpExecutionBuilder {
|
public class OpExecution4Union extends OpExecutionBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OpExecution4Union.class);
|
.getLogger(OpExecution4Union.class);
|
||||||
|
|
||||||
private TabularDataService service;
|
private TabularDataService service;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceExcept
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpExecutionDirector {
|
public class OpExecutionDirector {
|
||||||
OpExecutionBuilder operationExecutionBuilder;
|
private OpExecutionBuilder operationExecutionBuilder;
|
||||||
|
|
||||||
public void setOperationExecutionBuilder(
|
public void setOperationExecutionBuilder(
|
||||||
OpExecutionBuilder operationExecutionBuilder) {
|
OpExecutionBuilder operationExecutionBuilder) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ResourceTDCreator {
|
public class ResourceTDCreator {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(ResourceTDCreator.class);
|
.getLogger(ResourceTDCreator.class);
|
||||||
|
|
||||||
protected static SimpleDateFormat sdf = new SimpleDateFormat(
|
protected static SimpleDateFormat sdf = new SimpleDateFormat(
|
||||||
|
|
|
@ -2,8 +2,6 @@ package org.gcube.portlets.user.td.gwtservice.server.resource;
|
||||||
|
|
||||||
import org.gcube.data.analysis.tabulardata.model.resources.ResourceType;
|
import org.gcube.data.analysis.tabulardata.model.resources.ResourceType;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -12,7 +10,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ResourceTypeMap {
|
public class ResourceTypeMap {
|
||||||
protected static Logger logger = LoggerFactory.getLogger(ResourceTypeMap.class);
|
//private static Logger logger = LoggerFactory.getLogger(ResourceTypeMap.class);
|
||||||
|
|
||||||
public static ResourceType getResourceType(ResourceTDType resourceTDType){
|
public static ResourceType getResourceType(ResourceTDType resourceTDType){
|
||||||
switch (resourceTDType) {
|
switch (resourceTDType) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class FilesStorage {
|
public class FilesStorage {
|
||||||
|
|
||||||
public static final Logger logger = LoggerFactory
|
private static final Logger logger = LoggerFactory
|
||||||
.getLogger(FilesStorage.class);
|
.getLogger(FilesStorage.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ColumnMap {
|
public class ColumnMap {
|
||||||
protected static Logger logger = LoggerFactory.getLogger(ColumnMap.class);
|
private static Logger logger = LoggerFactory.getLogger(ColumnMap.class);
|
||||||
|
|
||||||
public ColumnMap() {
|
public ColumnMap() {
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ExpressionGenerator {
|
public class ExpressionGenerator {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(ExpressionGenerator.class);
|
.getLogger(ExpressionGenerator.class);
|
||||||
|
|
||||||
public static Expression genReplaceValueParameterCondition(
|
public static Expression genReplaceValueParameterCondition(
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ExtractCodelistOperationMap {
|
public class ExtractCodelistOperationMap {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(ExtractCodelistOperationMap.class);
|
.getLogger(ExtractCodelistOperationMap.class);
|
||||||
|
|
||||||
public ExtractCodelistOperationMap() {
|
public ExtractCodelistOperationMap() {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ExtractReferences {
|
public class ExtractReferences {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(ExtractReferences.class);
|
.getLogger(ExtractReferences.class);
|
||||||
|
|
||||||
public static RefColumn extract(OperationExecution op) {
|
public static RefColumn extract(OperationExecution op) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OperationDefinitionMap {
|
public class OperationDefinitionMap {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OperationDefinitionMap.class);
|
.getLogger(OperationDefinitionMap.class);
|
||||||
|
|
||||||
public static OperationDefinition map(String op, TabularDataService service)
|
public static OperationDefinition map(String op, TabularDataService service)
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class QueryService {
|
public class QueryService {
|
||||||
|
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(QueryService.class);
|
.getLogger(QueryService.class);
|
||||||
|
|
||||||
public static ArrayList<Occurrences> queryOccurences(
|
public static ArrayList<Occurrences> queryOccurences(
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TDTypeValueMap {
|
public class TDTypeValueMap {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(TDTypeValueMap.class);
|
.getLogger(TDTypeValueMap.class);
|
||||||
|
|
||||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class TRTasksManager implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4517156156005181775L;
|
private static final long serialVersionUID = 4517156156005181775L;
|
||||||
|
|
||||||
protected HashMap<Long, Task> trTasksMap=new HashMap<Long, Task>();
|
private HashMap<Long, Task> trTasksMap=new HashMap<Long, Task>();
|
||||||
|
|
||||||
public void add(Task trTask){
|
public void add(Task trTask){
|
||||||
trTasksMap.put(Long.getLong(trTask.getId().getValue()),trTask);
|
trTasksMap.put(Long.getLong(trTask.getId().getValue()),trTask);
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ValueMap {
|
public class ValueMap {
|
||||||
protected static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(ValueMap.class);
|
.getLogger(ValueMap.class);
|
||||||
|
|
||||||
public ValueMap(){
|
public ValueMap(){
|
||||||
|
|
|
@ -18,14 +18,14 @@ public class CodelistMappingSession implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2381185326076784908L;
|
private static final long serialVersionUID = 2381185326076784908L;
|
||||||
|
|
||||||
protected TRId trId;
|
private TRId trId;
|
||||||
protected Source source;
|
private Source source;
|
||||||
protected ResourceTDDescriptor resourceTDDescriptor;
|
private ResourceTDDescriptor resourceTDDescriptor;
|
||||||
protected String url;
|
private String url;
|
||||||
protected String localFileName;
|
private String localFileName;
|
||||||
protected String itemId;
|
private String itemId;
|
||||||
protected TabResource connectedTR;
|
private TabResource connectedTR;
|
||||||
protected ColumnData connectedColumn;
|
private ColumnData connectedColumn;
|
||||||
|
|
||||||
public TRId getTrId() {
|
public TRId getTrId() {
|
||||||
return trId;
|
return trId;
|
||||||
|
|
|
@ -11,31 +11,34 @@ import java.util.ArrayList;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AvailableCharsetList implements Serializable {
|
public class AvailableCharsetList implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1635081144303522534L;
|
private static final long serialVersionUID = -1635081144303522534L;
|
||||||
|
|
||||||
protected ArrayList<String> charsetList;
|
private ArrayList<String> charsetList;
|
||||||
protected String defaultCharset;
|
private String defaultCharset;
|
||||||
|
|
||||||
protected AvailableCharsetList()
|
public AvailableCharsetList() {
|
||||||
{}
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param charsetList
|
* @param charsetList
|
||||||
* @param defaultCharset
|
* @param defaultCharset
|
||||||
*/
|
*/
|
||||||
public AvailableCharsetList(ArrayList<String> charsetList, String defaultCharset) {
|
public AvailableCharsetList(ArrayList<String> charsetList,
|
||||||
|
String defaultCharset) {
|
||||||
|
super();
|
||||||
this.charsetList = charsetList;
|
this.charsetList = charsetList;
|
||||||
this.defaultCharset = defaultCharset;
|
this.defaultCharset = defaultCharset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the charsetList
|
* @return the charsetList
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> getCharsetList() {
|
public ArrayList<String> getCharsetList() {
|
||||||
return charsetList;
|
return charsetList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the defaultCharset
|
* @return the defaultCharset
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
|
||||||
public class CSVFileUtil {
|
public class CSVFileUtil {
|
||||||
|
|
||||||
private static final int MAXROWCHECK = 1000000;
|
private static final int MAXROWCHECK = 1000000;
|
||||||
protected static Logger logger = LoggerFactory.getLogger(CSVFileUtil.class);
|
private static Logger logger = LoggerFactory.getLogger(CSVFileUtil.class);
|
||||||
|
|
||||||
public static ArrayList<String> getHeader(File csvFile,
|
public static ArrayList<String> getHeader(File csvFile,
|
||||||
CSVParserConfiguration parserConfiguration) throws ParseException,
|
CSVParserConfiguration parserConfiguration) throws ParseException,
|
||||||
|
|
|
@ -19,19 +19,19 @@ public class CSVImportSession implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4176034045408445284L;
|
private static final long serialVersionUID = 4176034045408445284L;
|
||||||
|
|
||||||
protected String id;
|
private String id;
|
||||||
protected Source source;
|
private Source source;
|
||||||
|
|
||||||
protected TabResource tabResource;
|
private TabResource tabResource;
|
||||||
|
|
||||||
protected ArrayList<String> headers = new ArrayList<String>();
|
private ArrayList<String> headers = new ArrayList<String>();
|
||||||
|
|
||||||
protected boolean skipInvalidLines = false;
|
private boolean skipInvalidLines = false;
|
||||||
|
|
||||||
protected ArrayList<Boolean> columnToImportMask = new ArrayList<Boolean>();
|
private ArrayList<Boolean> columnToImportMask = new ArrayList<Boolean>();
|
||||||
|
|
||||||
protected String localFileName;
|
private String localFileName;
|
||||||
protected String itemId;
|
private String itemId;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -22,12 +22,13 @@ public class CSVParserConfiguration implements Serializable{
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 5585106307191211813L;
|
private static final long serialVersionUID = 5585106307191211813L;
|
||||||
protected Charset charset;
|
private Charset charset;
|
||||||
protected char delimiter;
|
private char delimiter;
|
||||||
protected char comment;
|
private char comment;
|
||||||
protected HeaderPresence headerPresence;
|
private HeaderPresence headerPresence;
|
||||||
|
|
||||||
public CSVParserConfiguration() {
|
public CSVParserConfiguration() {
|
||||||
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +38,7 @@ public class CSVParserConfiguration implements Serializable{
|
||||||
* @param hasHeader
|
* @param hasHeader
|
||||||
*/
|
*/
|
||||||
public CSVParserConfiguration(Charset charset, char delimiter, char comment, HeaderPresence headerPresence) {
|
public CSVParserConfiguration(Charset charset, char delimiter, char comment, HeaderPresence headerPresence) {
|
||||||
|
super();
|
||||||
this.charset = charset;
|
this.charset = charset;
|
||||||
this.delimiter = delimiter;
|
this.delimiter = delimiter;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
|
|
|
@ -17,12 +17,12 @@ public class CSVRowError implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4680781887858741657L;
|
private static final long serialVersionUID = 4680781887858741657L;
|
||||||
|
|
||||||
protected static int seed;
|
private static int seed;
|
||||||
|
|
||||||
protected int id;
|
private int id;
|
||||||
protected int lineNumber;
|
private int lineNumber;
|
||||||
protected String lineValue;
|
private String lineValue;
|
||||||
protected String errorDescription;
|
private String errorDescription;
|
||||||
|
|
||||||
public CSVRowError(){}
|
public CSVRowError(){}
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,16 @@ public class CheckCSVSession implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7775024048559018931L;
|
private static final long serialVersionUID = 7775024048559018931L;
|
||||||
|
|
||||||
protected ArrayList<CSVRowError> csvRowErrorList;
|
private ArrayList<CSVRowError> csvRowErrorList;
|
||||||
protected boolean csvFileUpperMaxSizeCheck;
|
private boolean csvFileUpperMaxSizeCheck;
|
||||||
|
|
||||||
public CheckCSVSession() {
|
public CheckCSVSession() {
|
||||||
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckCSVSession(ArrayList<CSVRowError> csvRowErrorList,
|
public CheckCSVSession(ArrayList<CSVRowError> csvRowErrorList,
|
||||||
boolean csvFileUpperMaxSizeCheck) {
|
boolean csvFileUpperMaxSizeCheck) {
|
||||||
|
super();
|
||||||
this.csvFileUpperMaxSizeCheck = csvFileUpperMaxSizeCheck;
|
this.csvFileUpperMaxSizeCheck = csvFileUpperMaxSizeCheck;
|
||||||
this.csvRowErrorList = csvRowErrorList;
|
this.csvRowErrorList = csvRowErrorList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@ public class CSVExportMonitor implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5998841163159590481L;
|
private static final long serialVersionUID = -5998841163159590481L;
|
||||||
|
|
||||||
protected float progress;
|
private float progress;
|
||||||
protected State status;
|
private State status;
|
||||||
protected String statusDescription;
|
private String statusDescription;
|
||||||
protected Throwable error;
|
private Throwable error;
|
||||||
protected TRId trId;
|
private TRId trId;
|
||||||
protected TabExportMetadata trExportMetadata;
|
private TabExportMetadata trExportMetadata;
|
||||||
|
|
||||||
|
|
||||||
public float getProgress(){
|
public float getProgress(){
|
||||||
|
|
|
@ -18,11 +18,11 @@ public class CSVImportMonitor implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5998841163159590481L;
|
private static final long serialVersionUID = -5998841163159590481L;
|
||||||
|
|
||||||
protected float progress;
|
private float progress;
|
||||||
protected State status;
|
private State status;
|
||||||
protected String statusDescription;
|
private String statusDescription;
|
||||||
protected Throwable error;
|
private Throwable error;
|
||||||
protected TRId trId;
|
private TRId trId;
|
||||||
|
|
||||||
public float getProgress(){
|
public float getProgress(){
|
||||||
return progress;
|
return progress;
|
||||||
|
|
|
@ -17,13 +17,13 @@ public class SDMXExportMonitor implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5998841163159590481L;
|
private static final long serialVersionUID = -5998841163159590481L;
|
||||||
|
|
||||||
protected float progress;
|
private float progress;
|
||||||
protected State status;
|
private State status;
|
||||||
protected String statusDescription;
|
private String statusDescription;
|
||||||
protected Throwable error;
|
private Throwable error;
|
||||||
protected String url;
|
private String url;
|
||||||
protected TabExportMetadata tabExportMetadata;
|
private TabExportMetadata tabExportMetadata;
|
||||||
protected TRId trId;
|
private TRId trId;
|
||||||
|
|
||||||
public TRId getTrId() {
|
public TRId getTrId() {
|
||||||
return trId;
|
return trId;
|
||||||
|
|
|
@ -16,11 +16,11 @@ public class SDMXImportMonitor implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5998841163159590481L;
|
private static final long serialVersionUID = -5998841163159590481L;
|
||||||
|
|
||||||
protected float progress;
|
private float progress;
|
||||||
protected State status;
|
private State status;
|
||||||
protected String statusDescription;
|
private String statusDescription;
|
||||||
protected Throwable error;
|
private Throwable error;
|
||||||
protected TRId trId;
|
private TRId trId;
|
||||||
|
|
||||||
public float getProgress(){
|
public float getProgress(){
|
||||||
return progress;
|
return progress;
|
||||||
|
|
Loading…
Reference in New Issue