Added icons for: .odt, .ods, .ott, .odg, .odp

Updated pom version at 6.11.0

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@124528 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-02-24 10:00:19 +00:00
parent 2fe12b9bbe
commit bd9966c5ac
14 changed files with 594 additions and 523 deletions

View File

@ -16,7 +16,7 @@ Author
Version and Release Date
------------------------
v. 6.11.0 January 2016
v. 6.11.1 February 2016
Description

View File

@ -1,4 +1,9 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-11-1"
date="2016-02-24">
<Change>Added icons for: .odt, .ods, .ott, .odg, .odp
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-11-0"
date="2016-01-20">
<Change>[Feature #1925] Added, new public link format:

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId>
<version>6.11.0-SNAPSHOT</version>
<version>6.11.1-SNAPSHOT</version>
<name>gCube Workspace Tree Widget</name>
<description>
gCube Workspace Tree Widget.

View File

@ -4,58 +4,58 @@ import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
public interface Icons extends ClientBundle {
@Source("icons/cloud-drive.png")
ImageResource cloudDrive();
@Source("icons/table.png")
ImageResource table();
@Source("icons/close.gif")
ImageResource close();
@Source("icons/mime/gif.gif")
ImageResource gif();
@Source("icons/mime/pdf.gif")
ImageResource pdf();
@Source("icons/mime/jpeg.gif")
ImageResource jpeg();
@Source("icons/mime/png.gif")
ImageResource png();
@Source("icons/mime/tiff.gif")
ImageResource tiff();
@Source("icons/mime/svg.png")
ImageResource svg();
@Source("icons/mime/xml.gif")
ImageResource xml();
@Source("icons/mime/ico_htm.gif")
ImageResource html();
@Source("icons/mime/doc.gif")
ImageResource doc();
@Source("icons/mime/txt.gif")
ImageResource txt();
@Source("icons/mime/movie.png")
ImageResource movie();
@Source("icons/new-folder.png")
ImageResource addFolder();
@Source("icons/mime/deletefolder.jpg")
ImageResource deleteFolder();
@Source("icons/mime/delete.png")
ImageResource deleteItem();
@Source("icons/rename2.png")
ImageResource renameItem();
@ -82,13 +82,13 @@ public interface Icons extends ClientBundle {
@Source("icons/mime/download.png")
ImageResource download();
@Source("icons/mime/forward.png")
ImageResource separatorPath();
@Source("icons/mime/search16.png")
ImageResource search();
@Source("icons/mime/search.png")
ImageResource search2();
@ -103,10 +103,10 @@ public interface Icons extends ClientBundle {
@Source("icons/mime/togglelist.png")
ImageResource toggleList();
@Source("icons/mime/togglegroup.png")
ImageResource toggleGroup();
@Source("icons/mime/toggleicon.png")
ImageResource toggleIcon();
@ -121,13 +121,13 @@ public interface Icons extends ClientBundle {
@Source("icons/report.png")
ImageResource report();
@Source("icons/timeseries.png")
ImageResource timeSeries();
@Source("icons/document.png")
ImageResource documents();
@Source("icons/mime/save.gif")
ImageResource save();
@ -142,10 +142,10 @@ public interface Icons extends ClientBundle {
@Source("icons/link.gif")
ImageResource openUrl();
@Source("icons/linkadd.png")
ImageResource addUrl();
@Source("icons/send.png")
ImageResource sendTo();
@ -187,19 +187,31 @@ public interface Icons extends ClientBundle {
@Source("icons/paste.png")
ImageResource paste();
@Source("icons/icon-odp.gif")
@Source("icons/odp.png")
ImageResource odp();
@Source("icons/odt.png")
ImageResource odt();
@Source("icons/ods.png")
ImageResource ods();
@Source("icons/odg.png")
ImageResource odg();
@Source("icons/ott.png")
ImageResource ott();
@Source("icons/refresh.gif")
ImageResource refresh();
@Source("icons/loading.gif")
ImageResource loading();
@Source("icons/loading-off.gif")
ImageResource loadingOff();
@Source("icons/loading2.gif")
ImageResource loading2();
@ -226,112 +238,112 @@ public interface Icons extends ClientBundle {
@Source("icons/workflowtemplate.png")
ImageResource workflowTemplate();
@Source("icons/webdav.png")
ImageResource webDav();
@Source("icons/mail-reply.png")
ImageResource replyMail();
@Source("icons/mail-reply-all.png")
ImageResource replyAllMail();
@Source("icons/application-link.png")
ImageResource resourceLink();
@Source("icons/sharingFolder.png")
ImageResource shareFolder();
@Source("icons/sharedFolder4.png")
ImageResource sharedFolder();
@Source("icons/unSharingFolder.gif")
ImageResource unShareFolder();
@Source("icons/unShareUsers.png")
ImageResource unShareUser();
@Source("icons/categorize2.png")
ImageResource gridView();
@Source("icons/users.png")
ImageResource users();
@Source("icons/info-icon.png")
ImageResource info();
@Source("icons/mime/csv.gif")
ImageResource csv();
@Source("icons/excel.gif")
ImageResource excel();
@Source("icons/ppt.gif")
ImageResource ppt();
@Source("icons/read.png")
ImageResource read();
@Source("icons/notread.png")
ImageResource notread();
@Source("icons/history.png")
ImageResource history();
@Source("icons/cut.png")
ImageResource cut();
@Source("icons/new_create.png")
ImageResource createNew();
@Source("icons/get-link.png")
ImageResource refreshFolder();
@Source("icons/link-try.png")
ImageResource shareLink();
@Source("icons/openURL.png")
ImageResource extLink();
@Source("icons/sharelink.png")
ImageResource publicLink();
// @Source("icons/user_trash_full.png")
@Source("icons/full_trash.png")
ImageResource trash_full();
// @Source("icons/user_trash.png")
@Source("icons/empty_trash.png")
ImageResource trash_empty();
@Source("icons/readonly.png")
ImageResource readonly();
@Source("icons/writeown.png")
ImageResource writeown();
@Source("icons/writeall.png")
ImageResource writeall();
@Source("icons/specialfolder2.png")
ImageResource vreFolder();
@Source("icons/admin.png")
ImageResource administrator();
@Source("icons/add_admin.png")
ImageResource addAdmin();
@Source("icons/admin_keys.png")
ImageResource manageAdmin();
@Source("icons/specialfolder2.png")
ImageResource specialFolder();
@Source("icons/shareuser.png")
ImageResource user();
@Source("icons/sharegroup.png")
ImageResource groupusers();
@ -346,64 +358,64 @@ public interface Icons extends ClientBundle {
*/
@Source("icons/aoneleft.png")
ImageResource selectedLeft();
/**
* @return
*/
@Source("icons/aoneright.png")
ImageResource selectedRight();
/**
* @return
*/
@Source("icons/amoreleft.png")
ImageResource allLeft();
/**
* @return
*/
@Source("icons/amoreright.png")
ImageResource allRight();
/**
* @return
*/
@Source("icons/recycle.png")
ImageResource recycle();
/**
* @return
*/
@Source("icons/edit-permissions.png")
ImageResource permissions();
@Source("icons/pencil16.png")
ImageResource pencil();
@Source("icons/edit16.png")
ImageResource edit();
@Source("icons/gcubeItem.jpeg")
ImageResource gcubeItem();
@Source("icons/dvi.gif")
ImageResource dvi();
@Source("icons/ps.gif")
ImageResource postscript();
@Source("icons/shell-script.png")
ImageResource shell();
@Source("icons/tex.png")
ImageResource tex();
@Source("icons/zip.gif")
ImageResource zip();
@Source("icons/archive-icon.png")
ImageResource archive();
@Source("icons/java.png")
ImageResource java();
@ -412,7 +424,7 @@ public interface Icons extends ClientBundle {
*/
@Source("icons/hand.gif")
ImageResource hand();
@Source("icons/about.png")
ImageResource about();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

View File

@ -1,5 +1,5 @@
/**
*
*
*/
package org.gcube.portlets.user.workspace.server;
@ -64,16 +64,16 @@ public class DownloadServlet extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String itemId = req.getParameter("id");
boolean viewContent = (req.getParameter("viewContent")==null)?false:req.getParameter("viewContent").equals("true");
boolean isValidItem = (req.getParameter(ConstantsExplorer.VALIDATEITEM)==null)?false:req.getParameter(ConstantsExplorer.VALIDATEITEM).equals("true");
boolean urlRedirectOnError = (req.getParameter(ConstantsExplorer.REDIRECTONERROR)==null)?false:req.getParameter(ConstantsExplorer.REDIRECTONERROR).equals("true");
boolean viewContent = req.getParameter("viewContent")==null?false:req.getParameter("viewContent").equals("true");
boolean isValidItem = req.getParameter(ConstantsExplorer.VALIDATEITEM)==null?false:req.getParameter(ConstantsExplorer.VALIDATEITEM).equals("true");
boolean urlRedirectOnError = req.getParameter(ConstantsExplorer.REDIRECTONERROR)==null?false:req.getParameter(ConstantsExplorer.REDIRECTONERROR).equals("true");
logger.trace("Input Params [id: "+itemId + ", viewContent: "+viewContent+", "+ConstantsExplorer.VALIDATEITEM +": " +isValidItem+", urlRedirectOnError:" +urlRedirectOnError+"]");
if(itemId==null || itemId.isEmpty()){
sendError(resp,HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Item id is null");
return;
}
logger.trace("FILE DOWNLOAD REQUEST "+itemId);
Workspace wa = null;
try {
@ -84,12 +84,12 @@ public class DownloadServlet extends HttpServlet{
wa = WsUtil.getWorkspace(session);
} catch (Exception e) {
if (e instanceof SessionExpiredException){
sendErrorForStatus(resp, HttpServletResponse.SC_UNAUTHORIZED +": Session expired", HttpServletResponse.SC_UNAUTHORIZED);
return;
}
handleError(urlRedirectOnError, req, resp, itemId, HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Error during workspace retrieving");
return;
}
@ -101,7 +101,7 @@ public class DownloadServlet extends HttpServlet{
WorkspaceItem item;
try {
item = wa.getItem(itemId);
if(isValidItem){ //ADDED 25/06/2013 - THIS CODE RETURN A SC_ACCEPT IS ITEM EXIST
String message = HttpServletResponse.SC_ACCEPTED+ ": The resource is available";
@ -109,10 +109,10 @@ public class DownloadServlet extends HttpServlet{
logger.trace("response return: "+message);
return;
}
try{
//ACCOUNTING
item.markAsRead(true);
item.markAsRead(true);
} catch (InternalErrorException e) {
logger.error("Requested item "+itemId+" has thrown an internal error exception",e);
}
@ -124,7 +124,7 @@ public class DownloadServlet extends HttpServlet{
}
switch (item.getType()) {
case SHARED_FOLDER:
case FOLDER:{
try {
@ -133,11 +133,11 @@ public class DownloadServlet extends HttpServlet{
resp.setContentType("application/zip");
resp = setContentLength(resp, tmpZip.length());
OutputStream out = resp.getOutputStream();
FileInputStream fileTmpZip = new FileInputStream(tmpZip);
IOUtils.copy(fileTmpZip, resp.getOutputStream());
fileTmpZip.close();
out.close();
tmpZip.delete();
return;
@ -152,30 +152,30 @@ public class DownloadServlet extends HttpServlet{
FolderItem folderItem = (FolderItem) item;
switch (folderItem.getFolderItemType()) {
case REPORT_TEMPLATE:{
try{
ReportTemplate reportTemplate = (ReportTemplate)folderItem;
String extension = FilenameUtils.getExtension(item.getName());
String itemName = item.getName();
logger.trace("case REPORT_TEMPLATE extension is" +extension);
if(extension.compareToIgnoreCase(Extensions.REPORT_TEMPLATE.getName())!=0) //ADD EXTENSION?
itemName = "." + Extensions.REPORT_TEMPLATE.getName();
logger.trace("case REPORT_TEMPLATE itemName is" +extension);
String contentDisposition = (viewContent)?"inline":"attachment";
String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType("application/zip");
resp = setContentLength(resp, reportTemplate.getLength());
OutputStream out = resp.getOutputStream();
//MODIFIED 22-05-2013 CLOSE STREAM
InputStream is = reportTemplate.getData();
IOUtils.copy(is, resp.getOutputStream());
is.close();
out.close();
} catch (Exception e) {
logger.error("Error during external item sending "+itemId,e);
@ -191,23 +191,23 @@ public class DownloadServlet extends HttpServlet{
String extension = FilenameUtils.getExtension(item.getName());
String itemName = item.getName();
logger.trace("case REPORT extension is" +extension);
if(extension.compareToIgnoreCase(Extensions.REPORT.getName())!=0) //ADD EXTENSION?
itemName = "." + Extensions.REPORT.getName();
logger.trace("case REPORT itemName is" +extension);
String contentDisposition = (viewContent)?"inline":"attachment";
String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType("application/zip");
resp = setContentLength(resp, report.getLength());
OutputStream out = resp.getOutputStream();
//MODIFIED 22-05-2013 CLOSE STREAM
InputStream is = report.getData();
IOUtils.copy(is, resp.getOutputStream());
is.close();
out.close();
} catch (Exception e) {
logger.error("Error during external item sending "+itemId,e);
@ -219,23 +219,23 @@ public class DownloadServlet extends HttpServlet{
}
case EXTERNAL_PDF_FILE:
case EXTERNAL_FILE:{
InputStream is = null;
OutputStream out = null;
try{
ExternalFile externalFile = (ExternalFile)folderItem;
String mimeType = externalFile.getMimeType();
logger.trace("EXTERNAL_FILE DOWNLOAD FOR "+externalFile.getId());
String contentDisposition = (viewContent)?"inline":"attachment";
String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + item.getName() + "\"" );
resp.setContentType(mimeType);
resp = setContentLength(resp, externalFile.getLength());
is = externalFile.getData();
out = resp.getOutputStream();
IOUtils.copy(is, out);
is.close();
out.close();
@ -248,14 +248,14 @@ public class DownloadServlet extends HttpServlet{
}
case EXTERNAL_IMAGE:{
try{
ExternalImage externalImage = (ExternalImage)folderItem;
String mimeType = externalImage.getMimeType();
String itemName = MimeTypeUtil.getNameWithExtension(item.getName(), mimeType);
String contentDisposition = (viewContent)?"inline":"attachment";
String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType(externalImage.getMimeType());
resp = setContentLength(resp, externalImage.getLength());
@ -263,7 +263,7 @@ public class DownloadServlet extends HttpServlet{
InputStream is = externalImage.getData();
IOUtils.copy(is, out);
is.close();
out.close();
return;
} catch (Exception e) {
@ -275,18 +275,18 @@ public class DownloadServlet extends HttpServlet{
case EXTERNAL_URL:{
try{
ExternalUrl externalUrl = (ExternalUrl)folderItem;
String itemName = MimeTypeUtil.getNameWithExtension(externalUrl.getName(), "text/uri-list");
String contentDisposition = (viewContent)?"inline":"attachment";
String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType("text/uri-list");
resp = setContentLength(resp, externalUrl.getLength());
//MODIFIED 22-05-2013 CLOSE STREAM
StringReader sr = new StringReader(externalUrl.getUrl());
OutputStream out = resp.getOutputStream();
IOUtils.copy(sr, out);
sr.close();
out.close();
return;
@ -307,13 +307,13 @@ public class DownloadServlet extends HttpServlet{
handleError(urlRedirectOnError, req, resp, itemId, HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Error during data retrieving: "+e.getMessage());
return;
}
//MODIFIED 22-05-2013 CLOSE STREAM
OutputStream out = resp.getOutputStream();
StringReader sr = new StringReader(query.getQuery());
IOUtils.copy(sr, out);
sr.close();
out.close();
return;
@ -323,17 +323,17 @@ public class DownloadServlet extends HttpServlet{
TimeSeries ts = (TimeSeries)folderItem;
File tmpZip = ZipUtil.zipTimeSeries(ts);
String contentDisposition = (viewContent)?"inline":"attachment";
String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + item.getName() + ".zip\"" );
resp.setContentType("application/zip");
resp = setContentLength(resp, tmpZip.length());
//MODIFIED 22-05-2013 CLOSE STREAM
OutputStream out = resp.getOutputStream();
FileInputStream fileTmpZip = new FileInputStream(tmpZip);
IOUtils.copy(fileTmpZip, out);
fileTmpZip.close();
out.close();
tmpZip.delete();
return;
@ -357,13 +357,13 @@ public class DownloadServlet extends HttpServlet{
resp.setHeader( "Content-Disposition", "attachment; filename=\"" + item.getName() + ".zip\"" );
resp.setContentType("application/zip");
resp = setContentLength(resp, tmpZip.length());
//MODIFIED 22-05-2013 CLOSE STREAM
OutputStream out = resp.getOutputStream();
FileInputStream fileTmpZip = new FileInputStream(tmpZip);
IOUtils.copy(fileTmpZip, out);
fileTmpZip.close();
out.close();
tmpZip.delete();
}
@ -378,7 +378,7 @@ public class DownloadServlet extends HttpServlet{
InputStream is = document.getData();
IOUtils.copy(is, out);
is.close();
out.close();
}
return;
@ -393,10 +393,10 @@ public class DownloadServlet extends HttpServlet{
try{
// Metadata document = (Metadata)item;
GCubeItem metadata = (GCubeItem) item; //Cast GCubeItem
resp.setContentType("text/html");
resp = setContentLength(resp, metadata.getLength());
//MODIFIED 22-05-2013 CLOSE STREAM
OutputStream out = resp.getOutputStream();
InputStream is = metadata.getData();
@ -415,11 +415,11 @@ public class DownloadServlet extends HttpServlet{
}
}
handleError(urlRedirectOnError, req, resp, itemId,HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Error during data retrieving");
return;
}
/**
* Method to manage HttpServletResponse content length also to big data
* @param resp
@ -437,20 +437,20 @@ public class DownloadServlet extends HttpServlet{
}
return resp;
}
protected void handleError(boolean urlRedirectOnError, HttpServletRequest req, HttpServletResponse resp, String itemId, String message) throws IOException{
logger.warn("Handle error occurred: "+message);
logger.trace("urlRedirectOnError is active: "+urlRedirectOnError);
if(urlRedirectOnError){
urlRedirect(req, resp, itemId);
}else
sendError(resp,message);
}
protected void sendError(HttpServletResponse response, String message) throws IOException
{
{
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
HandlerResultMessage resultMessage = HandlerResultMessage.errorResult(message);
logger.trace("error message: "+resultMessage);
@ -461,10 +461,10 @@ public class DownloadServlet extends HttpServlet{
logger.trace("response writed");
response.flushBuffer();
}
protected void sendErrorForStatus(HttpServletResponse response, String message, int status) throws IOException
{
{
response.setStatus(status);
HandlerResultMessage resultMessage = HandlerResultMessage.errorResult(message);
logger.trace("error message: "+resultMessage);
@ -475,7 +475,7 @@ public class DownloadServlet extends HttpServlet{
logger.trace("response writed");
response.flushBuffer();
}
protected void sendMessage(HttpServletResponse response, String message) throws IOException
{
response.setStatus(HttpServletResponse.SC_ACCEPTED);
@ -483,15 +483,15 @@ public class DownloadServlet extends HttpServlet{
response.getWriter().write(resultMessage.toString());
response.flushBuffer();
}
protected void sendMessageResourceAvailable(HttpServletResponse response, String message) throws IOException
protected void sendMessageResourceAvailable(HttpServletResponse response, String message) throws IOException
{
response.setStatus(HttpServletResponse.SC_ACCEPTED);
HandlerResultMessage resultMessage = HandlerResultMessage.okResult(message);
response.getWriter().write(resultMessage.toString());
response.flushBuffer();
}
protected void sendWarnMessage(HttpServletResponse response, String message) throws IOException
{
response.setStatus(HttpServletResponse.SC_ACCEPTED);
@ -499,7 +499,7 @@ public class DownloadServlet extends HttpServlet{
response.getWriter().write(resultMessage.toString());
response.flushBuffer();
}
protected void urlRedirect(HttpServletRequest req, HttpServletResponse response, String fakePath) throws IOException {
String requestUrl = getRequestURL(req) +fakePath;
@ -508,7 +508,7 @@ public class DownloadServlet extends HttpServlet{
response.sendRedirect(response.encodeRedirectURL(requestUrl));
return;
}
public static String getRequestURL(HttpServletRequest req) {
String scheme = req.getScheme(); // http
@ -523,7 +523,7 @@ public class DownloadServlet extends HttpServlet{
StringBuffer url = new StringBuffer();
url.append(scheme).append("://").append(serverName);
if ((serverPort != 80) && (serverPort != 443)) {
if (serverPort != 80 && serverPort != 443) {
url.append(":").append(serverPort);
}
@ -531,50 +531,50 @@ public class DownloadServlet extends HttpServlet{
logger.trace("omitted contextPath: "+contextPath);
// logger.trace("servletPath: "+servletPath);
// url.append(contextPath).append(servletPath);
// if (pathInfo != null) {
// url.append(pathInfo);
// }
// if (queryString != null) {
// url.append("?").append(queryString);
// }
PortalUrlGroupGatewayProperty p = new PortalUrlGroupGatewayProperty();
int lenght = p.getPath().length();
String groupgatewaypath = "/";
if(lenght>1){
String lastChar = p.getPath().substring(lenght-1, lenght-1);
groupgatewaypath+= lastChar.compareTo("/")!=0?p.getPath()+"/":p.getPath();
}
url.append(groupgatewaypath);
return url.toString();
}
/*
public static void main(String[] args) {
InputStream is = null;
logger.trace("start");
// is = GCUBEStorage.getRemoteFile("/Home/test.user/Workspace3d660604-03ef-49eb-89c3-4c73f8a47914");
try{
Workspace ws = HomeLibrary.getHomeManagerFactory().getHomeManager().getHome("francesco.mangiacrapa").getWorkspace();
//
//
// ExternalFile f = (ExternalFile) ws.getItem("907ce8ef-5c0b-4601-83ac-215d1f432f6b");
WorkspaceItem wsItem = ws.getItem("907ce8ef-5c0b-4601-83ac-215d1f432f6b");
logger.trace("metadata info recovered from HL: [ID: "+wsItem.getId() +", name: "+wsItem.getName()+"]");
FileOutputStream out = new FileOutputStream(new File("/tmp/bla"));
@ -583,21 +583,21 @@ public class DownloadServlet extends HttpServlet{
// while ((len = is.read(buffer)) != -1) {
// out.write(buffer, 0, len);
// }
logger.trace("cast as external file");
ExternalFile f = (ExternalFile) wsItem;
is = f.getData();
IOUtils.copy(is, out);
is.close();
out.close();
// logger.trace("Sleeping");
// Thread.sleep(20000);
// logger.trace("Alive");
logger.trace("end");
}catch (Exception e) {
e.printStackTrace();

View File

@ -31,9 +31,9 @@ public class ItemRetrieve {
// public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps"; //PRODUCTION
public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV
public static String TEST_USER = "giancarlo.panichi";
public static String TEST_USER = "francesco.mangiacrapa";
// public static String ITEMID = "63832213-098d-42d1-8774-89b6349764c0"; //Activity T3.4 working drafts/T2-EC-IMAR-HO-14-015 iMarine Sustainability WP - Business Model tools.pdf
public static String ITEMID = "79b2490b-43aa-40b0-98ec-e073cf7d4887";
// public static String ITEMID = "79b2490b-43aa-40b0-98ec-e073cf7d4887";
// d81d3a64-603f-4907-ae74-be8353211807
protected static Logger logger = Logger.getLogger(ItemRetrieve.class);
@ -48,14 +48,14 @@ public class ItemRetrieve {
Workspace ws = getWorkspace();
// retrieveFirstLevel(ws, null);
retrieveFirstLevel(ws, null);
retrieveFirstLevel(ws, ITEMID);
// retrieveFirstLevel(ws, ITEMID);
System.out.println("get workspace -> OK");
WorkspaceItem item = ws.getItem(ITEMID);
System.out.println("get item id: "+item.getId()+", name: "+item.getName() +", parent: "+item.getParent());
System.out.println(item);
// WorkspaceItem item = ws.getItem(ITEMID);
// System.out.println("get item id: "+item.getId()+", name: "+item.getName() +", parent: "+item.getParent());
// System.out.println(item);
}catch(Exception e){
e.printStackTrace();
}
@ -100,9 +100,14 @@ public class ItemRetrieve {
startTime = System.currentTimeMillis();
System.out.println("Start foundFolder at time: "+startTime);
// WorkspaceItem root = ws.getItem(ITEMID);
WorkspaceItem fd = ws.getItem(foundFolder);
System.out.println("foundFolder id: "+foundFolder);
System.out.println("start get children");
WorkspaceItem fd;
if(foundFolder!=null){
fd = ws.getItem(foundFolder);
System.out.println("foundFolder id: "+foundFolder);
System.out.println("start get children");
}else
fd = ws.getRoot();
List<? extends WorkspaceItem> children = fd.getChildren();
System.out.println("tree getChildren() returning "+children.size()+" elements in " + time);

View File

@ -1,9 +1,8 @@
/**
*
*
*/
package org.gcube.portlets.user.workspace;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -22,7 +21,6 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistEx
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException;
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
import org.gcube.common.homelibrary.util.MimeTypeUtil;
import org.gcube.common.homelibrary.util.WorkspaceUtil;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean;
@ -30,7 +28,7 @@ import org.gcube.common.scope.impl.ScopeBean;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jun 20, 2013
*
*
*/
public class UploadServletTest {
@ -48,7 +46,7 @@ public class UploadServletTest {
String filePath = "/home/francesco-mangiacrapa";
String fileName = "ASFIS 6 languages_2013.csv";
String fileName = "Geo Explorer 2016-01-15 18-51-51.png";
String fullPath = filePath + "/" + fileName;
@ -65,16 +63,16 @@ public class UploadServletTest {
// ExternalImage file = (ExternalImage) root.find(name);
// UPLOAD FILE
String contentType = MimeTypeUtil.getMimeType(fileName, new BufferedInputStream(
new FileInputStream(new File(fullPath))));
// String contentType = MimeTypeUtil.getMimeType(fileName, new BufferedInputStream(
// new FileInputStream(new File(fullPath))));
String itemName = WorkspaceUtil.getUniqueName(fileName, root);
System.out.println("Storing data....");
System.out.println("content type " + contentType);
System.out.println("content type " + null);
System.out.println("itemName " + itemName);
ExternalFile file = (ExternalFile) WorkspaceUtil.createExternalFile(
root, itemName, "", contentType, new FileInputStream(new File(
root, itemName, "", null, new FileInputStream(new File(
fullPath)));
System.out.println("Storing data - OK" + "File [id: " + file.getId()
@ -95,7 +93,7 @@ public class UploadServletTest {
InputStream inputStream = file.getData();
// write the inputStream to a FileOutputStream
OutputStream out = new FileOutputStream(new File(
"/home/francesco-mangiacrapa/Desktop/result"));
"/home/francesco-mangiacrapa/Desktop/download/"+fileName));
int read = 0;
byte[] bytes = new byte[1024];