updated project to support fws

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@82447 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-10-04 11:58:07 +00:00
parent a029e402a5
commit 2b152f7ad4
15 changed files with 313 additions and 536 deletions

32
pom.xml
View File

@ -67,17 +67,39 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- PORTAL MANAGER -->
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<version>[0.1.0-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
</dependency>
<!-- FWS -->
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<!-- UNCOMMENT THIS FOR RELEASE -->
<!-- <scope>provided</scope> -->
</dependency>
<!-- END FWS -->
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-encryption</artifactId> <artifactId>common-encryption</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <!-- <dependency> -->
<groupId>org.gcube.core</groupId> <!-- <groupId>org.gcube.core</groupId> -->
<artifactId>gcf</artifactId> <!-- <artifactId>gcf</artifactId> -->
<scope>provided</scope> <!-- <scope>provided</scope> -->
</dependency> <!-- </dependency> -->
<dependency> <dependency>
<groupId>org.gcube.dvos</groupId> <groupId>org.gcube.dvos</groupId>

View File

@ -14,7 +14,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.gcube.common.core.utils.logging.GCUBELog; import org.apache.log4j.Logger;
import org.gcube.common.homelibrary.home.HomeLibrary; import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace; import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
@ -33,7 +33,7 @@ public class DownloadPublicLinkServlet extends HttpServlet{
private static final long serialVersionUID = -8423345575690165644L; private static final long serialVersionUID = -8423345575690165644L;
protected static GCUBELog logger = new GCUBELog(DownloadPublicLinkServlet.class); protected static Logger logger = Logger.getLogger(DownloadPublicLinkServlet.class);
/** /**
* {@inheritDoc} * {@inheritDoc}

View File

@ -19,7 +19,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.gcube.common.core.utils.logging.GCUBELog; import org.apache.log4j.Logger;
import org.gcube.common.homelibrary.home.HomeLibrary; import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.Workspace; import org.gcube.common.homelibrary.home.workspace.Workspace;
@ -56,7 +56,7 @@ public class DownloadServlet extends HttpServlet{
private static final long serialVersionUID = -8423345575690165644L; private static final long serialVersionUID = -8423345575690165644L;
protected static GCUBELog logger = new GCUBELog(DownloadServlet.class); protected static Logger logger = Logger.getLogger(DownloadServlet.class);
/** /**
* {@inheritDoc} * {@inheritDoc}

View File

@ -13,7 +13,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.gcube.common.core.utils.logging.GCUBEClientLog; import org.apache.log4j.Logger;
import org.gcube.common.homelibrary.home.User; import org.gcube.common.homelibrary.home.User;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.Properties; import org.gcube.common.homelibrary.home.workspace.Properties;
@ -102,7 +102,7 @@ import org.gcube.vomanagement.usermanagement.model.UserModel;
public class GWTWorkspaceBuilder { public class GWTWorkspaceBuilder {
protected static final String IMAGE_SERVICE_URL = "ImageService"; protected static final String IMAGE_SERVICE_URL = "ImageService";
protected GCUBEClientLog logger; protected static Logger logger = Logger.getLogger(GWTWorkspaceBuilder.class);
private InfoContactModel userLogged; private InfoContactModel userLogged;
protected static HashMap<String, InfoContactModel> hashTestUser = null; protected static HashMap<String, InfoContactModel> hashTestUser = null;
// private final String UNKNOWN = "unknown"; // private final String UNKNOWN = "unknown";
@ -114,7 +114,6 @@ public class GWTWorkspaceBuilder {
* @param logger * @param logger
*/ */
public GWTWorkspaceBuilder() { public GWTWorkspaceBuilder() {
logger = new GCUBEClientLog(GWTWorkspaceBuilder.class);
} }

View File

@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.common.homelibrary.home.Home; import org.gcube.common.homelibrary.home.Home;
import org.gcube.common.homelibrary.home.HomeLibrary; import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException; import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
@ -66,7 +64,6 @@ import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.UserManager; import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayGroupManager; import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayGroupManager;
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager; import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
import org.gcube.vomanagement.usermanagement.model.UserModel;
import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@ -78,6 +75,10 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWTWorkspaceService{ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWTWorkspaceService{
/**
*
*/
protected static final String IDENTIFIER_IS_NULL = "Identifier is null";
protected static final String RETRIEVING_ITEM_EITHER_ITEM_DOESN_T_EXIST = " retrieving item. Either the item doesn't exist anymore or you do not have the permission to access it"; protected static final String RETRIEVING_ITEM_EITHER_ITEM_DOESN_T_EXIST = " retrieving item. Either the item doesn't exist anymore or you do not have the permission to access it";
private static final long serialVersionUID = 2828885661214875589L; private static final long serialVersionUID = 2828885661214875589L;
@ -131,23 +132,18 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
workspaceLogger.trace("getting workspace"); workspaceLogger.trace("getting workspace");
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.info("getRoot");
WorkspaceFolder root = workspace.getRoot(); WorkspaceFolder root = workspace.getRoot();
if (root == null) { if (root == null) {
logger.error("The root is null"); workspaceLogger.error("The root is null");
throw new Exception("The root is null"); throw new Exception("The root is null");
} }
logger.trace("Root loaded, gxt conversion");
workspaceLogger.trace("Root loaded, gxt conversion"); workspaceLogger.trace("Root loaded, gxt conversion");
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
FolderModel gwtroot =builder.buildWorkspaceFileModelRoot(root); FolderModel gwtroot =builder.buildWorkspaceFileModelRoot(root);
logger.trace("Root converted, returnig...");
workspaceLogger.trace("Root converted, returnig..."); workspaceLogger.trace("Root converted, returnig...");
return gwtroot; return gwtroot;
} catch (Exception e) { } catch (Exception e) {
@ -169,32 +165,23 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.info("getRoot for scope " + scopeId);
workspaceLogger.trace("on server getRoot for scope: " + scopeId); workspaceLogger.trace("on server getRoot for scope: " + scopeId);
GCUBEScope gcubeScope = null; // GCUBEScope gcubeScope = null;
//
if(scopeId.compareTo(ScopeUtilFilter.IDALLSCOPE)!=0){ // if(scopeId.compareTo(ScopeUtilFilter.IDALLSCOPE)!=0){
gcubeScope = GCUBEScope.getScope(scopeId); // gcubeScope = GCUBEScope.getScope(scopeId);
} // }
WorkspaceFolder root = workspace.getRoot(); WorkspaceFolder root = workspace.getRoot();
// WorkspaceFolder root = workspace.getRoot();
// WorkspaceFolder root = workspace.getRoot(scopeId);
if (root == null) { if (root == null) {
logger.error("The root is null"); workspaceLogger.error("The root is null");
throw new Exception("The root is null"); throw new Exception("The root is null");
} }
logger.trace("Root loaded, gxt conversion");
workspaceLogger.trace("Root loaded, gxt conversion"); workspaceLogger.trace("Root loaded, gxt conversion");
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
logger.trace("Root converted, returnig...");
workspaceLogger.trace("Root converted, returnig..."); workspaceLogger.trace("Root converted, returnig...");
return builder.buildWorkspaceFileModelRoot(root); return builder.buildWorkspaceFileModelRoot(root);
@ -217,17 +204,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
List<SearchItem> listSearchItems = workspace.searchByName(text); List<SearchItem> listSearchItems = workspace.searchByName(text);
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
List<FileGridModel> listFileGridModels = new ArrayList<FileGridModel>(); List<FileGridModel> listFileGridModels = new ArrayList<FileGridModel>();
logger.trace("Call search HL.."); workspaceLogger.trace("Call search HL..");
listFileGridModels = builder.buildGXTListFileGridModelItemForSearch(listSearchItems, null); listFileGridModels = builder.buildGXTListFileGridModelItemForSearch(listSearchItems, null);
logger.trace("Search converted, completed..."); workspaceLogger.trace("Search converted, completed...");
return listFileGridModels; return listFileGridModels;
} catch (Exception e) { } catch (Exception e) {
@ -249,13 +234,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
if(folder == null)
throw new Exception("Folder is null");
workspaceLogger.trace("get folder children for: "+folder.getIdentifier());
workspace = getWorkspace(); workspace = getWorkspace();
List<FileModel> listFileModels = new ArrayList<FileModel>(); List<FileModel> listFileModels = new ArrayList<FileModel>();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.info("get children");
WorkspaceItem wsItem = workspace.getItem(folder.getIdentifier()); WorkspaceItem wsItem = workspace.getItem(folder.getIdentifier());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -275,22 +261,21 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public List<FileGridModel> getFolderChildrenForFileGrid(FileModel folder) throws Exception, SessionExpiredException { public List<FileGridModel> getFolderChildrenForFileGrid(FileModel folder) throws Exception, SessionExpiredException {
Workspace workspace;
if(isSessionExpired()) if(isSessionExpired())
throw new SessionExpiredException(); throw new SessionExpiredException();
try { try {
workspace = getWorkspace(); if(folder == null)
throw new Exception("Folder is null");
workspaceLogger.trace("get children for Grid for folder: "+folder.getIdentifier());
Workspace workspace = getWorkspace();
List<FileGridModel> listFileGridModels = new ArrayList<FileGridModel>(); List<FileGridModel> listFileGridModels = new ArrayList<FileGridModel>();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.trace("get children for Grid");
workspaceLogger.trace("get children for Grid");
WorkspaceFolder wsFolder = (WorkspaceFolder) workspace.getItem(folder.getIdentifier()); WorkspaceFolder wsFolder = (WorkspaceFolder) workspace.getItem(folder.getIdentifier());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -302,7 +287,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Long endTime = System.currentTimeMillis() - startTime; Long endTime = System.currentTimeMillis() - startTime;
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime)); String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
logger.trace("##HL FILLING: grid getChildren() returning "+listItems.size()+" elements in " + time); workspaceLogger.debug("##HL FILLING: grid getChildren() returning "+listItems.size()+" elements in " + time);
listFileGridModels = builder.buildGXTListFileGridModelItem(listItems, folder); listFileGridModels = builder.buildGXTListFileGridModelItem(listItems, folder);
@ -322,22 +307,23 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public List<FileGridModel> getFolderChildrenForFileGridById(String folderId) throws Exception, SessionExpiredException { public List<FileGridModel> getFolderChildrenForFileGridById(String folderId) throws Exception, SessionExpiredException {
Workspace workspace;
if(isSessionExpired()) if(isSessionExpired())
throw new SessionExpiredException(); throw new SessionExpiredException();
try { try {
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
workspace = getWorkspace(); if(folderId == null)
throw new Exception("Folder id is null");
logger.trace("get children for Grid by id: "+folderId); Workspace workspace = getWorkspace();
workspaceLogger.trace("get children for Grid by id: "+folderId);
List<FileGridModel> listFileGridModels = new ArrayList<FileGridModel>(); List<FileGridModel> listFileGridModels = new ArrayList<FileGridModel>();
if(folderId==null || folderId.isEmpty()){ if(folderId==null || folderId.isEmpty()){
logger.trace("id is null or empty, return"); workspaceLogger.trace("id is null or empty, return");
return listFileGridModels; return listFileGridModels;
} }
@ -378,7 +364,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Long endTime = System.currentTimeMillis() - startTime; Long endTime = System.currentTimeMillis() - startTime;
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime)); String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
logger.trace("grid getChildren() returning "+listItems.size()+" elements in " + time); workspaceLogger.debug("grid getChildren() returning "+listItems.size()+" elements in " + time);
listFileGridModels = builder.buildGXTListFileGridModelItem(listItems, wsParent); listFileGridModels = builder.buildGXTListFileGridModelItem(listItems, wsParent);
@ -399,16 +385,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public FileGridModel getItemForFileGrid(String itemId) throws Exception { public FileGridModel getItemForFileGrid(String itemId) throws Exception {
Workspace workspace;
try { try {
workspace = getWorkspace(); if(itemId == null)
throw new Exception(IDENTIFIER_IS_NULL);
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); Workspace workspace = getWorkspace();
logger.trace("get child for Grid by id: "+itemId);
workspaceLogger.trace("get children for Grid"); workspaceLogger.trace("get child for Grid by id: "+itemId);
WorkspaceItem wsItem = workspace.getItem(itemId); WorkspaceItem wsItem = workspace.getItem(itemId);
@ -418,7 +403,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Long endTime = System.currentTimeMillis() - startTime; Long endTime = System.currentTimeMillis() - startTime;
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime)); String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
logger.trace("get child for Grid by id returning element in " + time); workspaceLogger.debug("get child for Grid by id returning element in " + time);
//BUILD PARENT //BUILD PARENT
@ -443,8 +428,11 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.trace("moveItem item: "+itemId+" destination: "+destinationId); if(itemId == null)
throw new Exception(IDENTIFIER_IS_NULL);
workspaceLogger.trace("moveItem item: "+itemId+" destination: "+destinationId);
WorkspaceItem sourceItem = workspace.getItem(itemId); //GET SOURCE ITEM BEFORE OF MOVE WorkspaceItem sourceItem = workspace.getItem(itemId); //GET SOURCE ITEM BEFORE OF MOVE
@ -615,13 +603,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public Boolean removeItem(String itemId) throws Exception { public Boolean removeItem(String itemId) throws Exception {
workspaceLogger.trace("removeItem itemId: "+itemId);
try { try {
Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.trace("removeItem item: "+itemId);
if(itemId == null)
throw new Exception(IDENTIFIER_IS_NULL);
Workspace workspace = getWorkspace();
workspaceLogger.trace("removeItem item for id: "+itemId);
//NOTIFICATION //NOTIFICATION
WorkspaceItem wsItem = workspace.getItem(itemId); WorkspaceItem wsItem = workspace.getItem(itemId);
@ -631,7 +621,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
String itemName = wsItem.getName(); String itemName = wsItem.getName();
String sourceFolderSharedId = null; String sourceFolderSharedId = null;
if(sourceItemIsShared){ if(sourceItemIsShared){
sourceFolderSharedId = wsItem.getIdSharedFolder(); sourceFolderSharedId = wsItem.getIdSharedFolder();
} }
@ -666,14 +655,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public Boolean renameItem(String itemId, String newName, String previousName) throws Exception { public Boolean renameItem(String itemId, String newName, String previousName) throws Exception {
workspaceLogger.trace("renameItem itemId: "+itemId+" newName: "+newName);
try { try {
if(itemId == null)
throw new Exception(IDENTIFIER_IS_NULL);
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
workspaceLogger.trace("rename item itemId: "+itemId+" old name "+ previousName +", new name: "+newName);
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.trace("rename item itemId: "+itemId+" old name "+ previousName +", new name: "+newName);
workspace.renameItem(itemId, newName); workspace.renameItem(itemId, newName);
@ -718,17 +707,17 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public FolderModel createFolder(String nameFolder, String description, FileModel parent) throws Exception { public FolderModel createFolder(String nameFolder, String description, FileModel parent) throws Exception {
workspaceLogger.trace("create folder"); workspaceLogger.trace("create folder: "+nameFolder +" parent is null"+parent==null);
try { try {
if(nameFolder == null)
throw new Exception("Folder name is null");
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.trace("create folder: " + nameFolder);
WorkspaceFolder wsFolder = workspace.createFolder(nameFolder, description, parent.getIdentifier()); WorkspaceFolder wsFolder = workspace.createFolder(nameFolder, description, parent.getIdentifier());
WorkspaceItem folderDestinationItem = workspace.getItem(parent.getIdentifier()); WorkspaceItem folderDestinationItem = workspace.getItem(parent.getIdentifier());
checkNotifyAddItemToShare(wsFolder, null, folderDestinationItem); checkNotifyAddItemToShare(wsFolder, null, folderDestinationItem);
@ -739,8 +728,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server create folder", e); workspaceLogger.error("Error in server create folder", e);
// workspaceLogger.trace("Error in server create folder " + e);
//GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -749,13 +736,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public FileDetailsModel getDetailsFile(FileModel folder) throws Exception { public FileDetailsModel getDetailsFile(FileModel folder) throws Exception {
workspaceLogger.trace("load file details");
try { try {
Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); if(folder == null)
logger.trace("load file details: " + folder.getName()); throw new Exception("Folder is null");
workspaceLogger.trace("load file details: " + folder.getName());
Workspace workspace = getWorkspace();
WorkspaceItem wsItem = workspace.getItem(folder.getIdentifier()); WorkspaceItem wsItem = workspace.getItem(folder.getIdentifier());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -764,8 +752,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in load server file details", e); workspaceLogger.error("Error in load server file details", e);
// workspaceLogger.trace("Error in server load file details" + e);
//GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
} }
@ -778,10 +764,12 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
if(itemIdentifier == null)
throw new Exception(IDENTIFIER_IS_NULL);
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("search itemId: "+itemIdentifier);
logger.trace("search itemId: "+itemIdentifier);
WorkspaceItem item = workspace.getItem(itemIdentifier); //get item from workspace WorkspaceItem item = workspace.getItem(itemIdentifier); //get item from workspace
getListsChildrenByParents(listSubTree, item); getListsChildrenByParents(listSubTree, item);
@ -789,8 +777,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server find Item", e); workspaceLogger.error("Error in server find Item", e);
// workspaceLogger.trace("Error in server find Item " + e);
//GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -804,16 +790,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("get smart folder by category: "+category);
logger.trace("get smart folder by category: "+category);
// listWorkspaceItems = workspace.getWorkspaceTree(workspace.getRoot()); //get item from workspace
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
// List<FileGridModel> listFileGridModel = new ArrayList<FileGridModel>();
// ArrayList<FolderItemType> listFolderItemType = builder.getListWorkspaceType(category);
List<SearchItem> listWorkspaceItems = new ArrayList<SearchItem>(); List<SearchItem> listWorkspaceItems = new ArrayList<SearchItem>();
//Category IMAGES //Category IMAGES
@ -862,13 +842,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
return builder.filterListFileGridModelItemByCategory(listWorkspaceItems, category); return builder.filterListFileGridModelItemByCategory(listWorkspaceItems, category);
// workspaceLogger.trace("listFileGridModel " + listFileGridModel.size());
// return builder.filterListByCategory(listFileGridModel, category);
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server get smart folder by category", e); workspaceLogger.error("Error in server get smart folder by category", e);
// workspaceLogger.trace("Error in server get smart folder by category " + e);
//GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -899,21 +875,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("create smart folder by name: "+name);
logger.trace("create smart folder by name: "+name); workspaceLogger.trace("description " + description);
workspaceLogger.trace("name " + name);
workspaceLogger.trace("query " + query); workspaceLogger.trace("query " + query);
/*WorkspaceFolder wsFolder = workspace.createSmartFolder(name, query); //create Smart Folder from workspace
workspaceLogger.trace("create : " +wsFolder.getName() + " id "+ wsFolder.getId());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
return builder.buildGXTSmartFolderModel(wsFolder,query);*/
WorkspaceSmartFolder wsSmartFolder = workspace.createSmartFolder(name, description, query); //create Smart Folder from workspace WorkspaceSmartFolder wsSmartFolder = workspace.createSmartFolder(name, description, query); //create Smart Folder from workspace
workspaceLogger.trace("create : " +wsSmartFolder.getName() + " id "+ wsSmartFolder.getId()); workspaceLogger.trace("create : " +wsSmartFolder.getName() + " id "+ wsSmartFolder.getId());
@ -934,12 +899,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public Boolean removeSmartFolder(String itemId, String name) throws Exception { public Boolean removeSmartFolder(String itemId, String name) throws Exception {
if(itemId==null)
return null;
try { try {
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("remove smart folder by id: "+itemId);
logger.trace("remove smart folder by id: "+itemId);
workspace.removeItem(itemId); //remove Smart Folder from workspace workspace.removeItem(itemId); //remove Smart Folder from workspace
@ -947,8 +914,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in remove smart folder by id: ", e); workspaceLogger.error("Error in remove smart folder by id: ", e);
// workspaceLogger.trace("Error in get smart folder by id " + e);
//GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
} }
@ -960,18 +925,13 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("get all smart folder");
logger.trace("get all smart folder");
// workspaceLogger.trace("get all smart folder");
// List<WorkspaceFolder> listWorkspaceFolder = new ArrayList<WorkspaceFolder>();
// listWorkspaceFolder = workspace.getAllSmartFolders(); //create Smart Folder from workspace
List<WorkspaceSmartFolder> listWorkspaceFolder = new ArrayList<WorkspaceSmartFolder>(); List<WorkspaceSmartFolder> listWorkspaceFolder = new ArrayList<WorkspaceSmartFolder>();
listWorkspaceFolder = workspace.getAllSmartFolders(); //create Smart Folder from workspace listWorkspaceFolder = workspace.getAllSmartFolders(); //create Smart Folder from workspace
workspaceLogger.trace("listWorkspaceFolder size" + listWorkspaceFolder.size()); workspaceLogger.trace("list smart folders size" + listWorkspaceFolder.size());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -979,8 +939,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server get all smart folder: ", e); workspaceLogger.error("Error in server get all smart folder: ", e);
// workspaceLogger.trace("Error in server get all smart folder:" + e.getMessage());
//GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
} }
@ -988,14 +946,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public List<FileGridModel> getSmartFolderResultsById(String folderId) throws Exception { public List<FileGridModel> getSmartFolderResultsById(String folderId) throws Exception {
if(folderId == null)
return null;
try { try {
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("get smart folder by id: "+folderId);
logger.trace("get smart folder by id: "+folderId);
// WorkspaceFolder wsFolder = workspace.getSmartFolder(folderId); //get Smart Folder from workspace
WorkspaceSmartFolder wsSmartFolder = workspace.getSmartFolder(folderId); //get Smart Folder from workspace WorkspaceSmartFolder wsSmartFolder = workspace.getSmartFolder(folderId); //get Smart Folder from workspace
@ -1009,8 +967,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in get server smart folder by id", e); workspaceLogger.error("Error in get server smart folder by id", e);
// workspaceLogger.trace("Error in server get smart folder by id " + e);
//GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
} }
@ -1018,12 +974,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public GWTWorkspaceItem getImageById(String identifier, boolean isInteralImage, boolean fullDetails) throws Exception { public GWTWorkspaceItem getImageById(String identifier, boolean isInteralImage, boolean fullDetails) throws Exception {
if(identifier==null)
return null;
try { try {
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("get image by id: "+identifier);
logger.trace("get image by id: "+identifier);
WorkspaceItem item = workspace.getItem(identifier); //get item from workspace WorkspaceItem item = workspace.getItem(identifier); //get item from workspace
@ -1036,13 +994,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
return builder.buildGWTWorkspaceImage(item, isInteralImage, fullDetails); return builder.buildGWTWorkspaceImage(item, isInteralImage, fullDetails);
// workspaceLogger.trace(" children "+wsFolder.getChildren().size());
// return builder.buildGWTWorkspaceItemsForGrid(wsFolder.getChildren(), null);
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server get image by id", e); workspaceLogger.error("Error in server get image by id", e);
// workspaceLogger.trace("Error in server get image by id " + e);
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
} }
@ -1050,12 +1003,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override @Override
public GWTWorkspaceItem getTimeSeriesById(String identifier) throws Exception { public GWTWorkspaceItem getTimeSeriesById(String identifier) throws Exception {
if(identifier==null)
return null;
try { try {
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("get timeseries by id: "+identifier);
logger.trace("get timeseries by id: "+identifier);
WorkspaceItem item = workspace.getItem(identifier); //get item from workspace WorkspaceItem item = workspace.getItem(identifier); //get item from workspace
@ -1076,10 +1031,12 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
if(identifier==null)
throw new Exception(IDENTIFIER_IS_NULL);
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("get url by id: "+identifier);
logger.trace("get url by id: "+identifier);
WorkspaceItem item = workspace.getItem(identifier); //get item from workspace WorkspaceItem item = workspace.getItem(identifier); //get item from workspace
@ -1105,8 +1062,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); if(parentFileModel==null)
logger.trace("create url in parent id: "+parentFileModel.getIdentifier()); throw new Exception("Parent item is null");
workspaceLogger.trace("create url in parent id: "+parentFileModel.getIdentifier());
//DEBUG //DEBUG
// workspaceLogger.trace("Name " + name); // workspaceLogger.trace("Name " + name);
@ -1118,11 +1077,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
ExternalUrl ext = workspace.createExternalUrl(name, description, url, parentFileModel.getIdentifier()); ExternalUrl ext = workspace.createExternalUrl(name, description, url, parentFileModel.getIdentifier());
WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
workspaceLogger.trace("parent name " + parent.getName()); workspaceLogger.trace("parent name " + parent.getName());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
return builder.buildGXTFileModelItem(ext, parentFileModel); return builder.buildGXTFileModelItem(ext, parentFileModel);
@ -1144,6 +1101,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try{ try{
if(oid==null)
throw new Exception(IDENTIFIER_IS_NULL);
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest().getSession()); ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest().getSession());
if(WsUtil.isVRE(session)){ if(WsUtil.isVRE(session)){
@ -1190,7 +1150,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest().getSession()); ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest().getSession());
session.setAttribute(name, value); session.setAttribute(name, value);
workspaceLogger.trace("set value in session with name: "+name+", value: "+value); workspaceLogger.trace("set value in session with name: "+name+", value: "+value);
workspaceLogger.debug("WS Session Id = " + session.getExternalSessionID()); // workspaceLogger.debug("WS Session Id = " + session.getExternalSessionID());
// System.out.println("set value in session with name: "+name+", value: "+value); // System.out.println("set value in session with name: "+name+", value: "+value);
@ -1207,8 +1167,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("get all scope");
logger.trace("get all scope");
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -1312,12 +1271,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.info("send To");
// WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
// workspace.getAllScope();
//
workspaceLogger.trace("######### SEND TO: "); workspaceLogger.trace("######### SEND TO: ");
workspaceLogger.trace("subject " + subject); workspaceLogger.trace("subject " + subject);
workspaceLogger.trace("body " + body); workspaceLogger.trace("body " + body);
@ -1325,18 +1278,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
for(String contactId : listContactsId) for(String contactId : listContactsId)
workspaceLogger.trace("contactId " + contactId); workspaceLogger.trace("contactId " + contactId);
for(String id : listAttachmentsId) for(String id : listAttachmentsId)
workspaceLogger.trace("attachId " + id); workspaceLogger.trace("attachId " + id);
workspace.getWorkspaceMessageManager().sendMessageToPortalLogins(subject, body, listAttachmentsId, listContactsId); workspace.getWorkspaceMessageManager().sendMessageToPortalLogins(subject, body, listAttachmentsId, listContactsId);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server sendTo ", e); workspaceLogger.error("Error in server sendTo ", e);
// workspaceLogger.trace("Error in server get sendTo " + e.getMessage());
//GWT can't serialize all exceptions //GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -1349,8 +1299,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.info("getAllMessagesSent");
workspaceLogger.trace("get All Messages Sent "); workspaceLogger.trace("get All Messages Sent ");
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -1373,8 +1321,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.info("getAllMessagesReceived");
workspaceLogger.trace("get All Messages Received "); workspaceLogger.trace("get All Messages Received ");
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -1397,16 +1343,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("get Message by Id: "+messageIdentifier);
logger.info("get Message by Id");
// WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
// workspace.getAllScope();
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
// return builder.buildGXTListMessageModel();
WorkspaceMessage message = null; WorkspaceMessage message = null;
if(messageType.equals(GXTCategoryItemInterface.MS_RECEIVED)) if(messageType.equals(GXTCategoryItemInterface.MS_RECEIVED))
message = workspace.getWorkspaceMessageManager().getReceivedMessage(messageIdentifier); message = workspace.getWorkspaceMessageManager().getReceivedMessage(messageIdentifier);
@ -1421,7 +1361,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server get Message by Id ", e); workspaceLogger.error("Error in server get Message by Id ", e);
// workspaceLogger.trace("Error in server get Message by Id " + e.getMessage());
//GWT can't serialize all exceptions //GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -1453,8 +1392,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
List<FolderBulkCreator> listFBC = workspace.getFolderBulkCreatorManager().getActiveFolderBulkCreators(); List<FolderBulkCreator> listFBC = workspace.getFolderBulkCreatorManager().getActiveFolderBulkCreators();
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -1483,9 +1420,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.info("save attachments by messageIdentifier");
workspaceLogger.trace(" save attachments by messageIdentifier " + messageIdentifier); workspaceLogger.trace(" save attachments by messageIdentifier " + messageIdentifier);
if(messageType.equals(GXTCategoryItemInterface.MS_SENT)) if(messageType.equals(GXTCategoryItemInterface.MS_SENT))
workspace.getWorkspaceMessageManager().getSentMessage(messageIdentifier).saveAttachments(workspace.getRoot().getId()); workspace.getWorkspaceMessageManager().getSentMessage(messageIdentifier).saveAttachments(workspace.getRoot().getId());
@ -1497,7 +1431,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server save attachments by messageIdentifier ", e); workspaceLogger.error("Error in server save attachments by messageIdentifier ", e);
// workspaceLogger.trace("Error in server save attachments by messageIdentifier " + e.getMessage());
//GWT can't serialize all exceptions //GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -1516,9 +1449,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
// logger.info("markMessageAsRead");
workspaceLogger.trace(" markMessageAsRead by messageIdentifier " + messageIdentifier + " boolMark " + boolMark + " messageType " +messageType); workspaceLogger.trace(" markMessageAsRead by messageIdentifier " + messageIdentifier + " boolMark " + boolMark + " messageType " +messageType);
if(messageType.equals(GXTCategoryItemInterface.MS_RECEIVED)){ if(messageType.equals(GXTCategoryItemInterface.MS_RECEIVED)){
@ -1557,7 +1487,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server markMessageAsRead by messageIdentifier ", e); workspaceLogger.error("Error in server markMessageAsRead by messageIdentifier ", e);
// workspaceLogger.trace("Error in server markMessageAsRead by messageIdentifier " + e.getMessage());
//GWT can't serialize all exceptions //GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -1570,9 +1499,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
// logger.info("deleteMessage by messageIdentifier");
workspaceLogger.trace("deleteMessage by messageIdentifier " + messageIdentifier); workspaceLogger.trace("deleteMessage by messageIdentifier " + messageIdentifier);
if(messageType.equals(GXTCategoryItemInterface.MS_RECEIVED)) if(messageType.equals(GXTCategoryItemInterface.MS_RECEIVED))
@ -1585,7 +1511,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server deleteMessage by messageIdentifier ", e); workspaceLogger.error("Error in server deleteMessage by messageIdentifier ", e);
// workspaceLogger.trace("Error in server deleteMessage by messageIdentifier " + e.getMessage());
//GWT can't serialize all exceptions //GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -1598,10 +1523,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
// workspaceLogger.trace("in server getNewMessagesReceived ");
int count = workspace.getWorkspaceMessageManager().getMessagesNotOpened(); int count = workspace.getWorkspaceMessageManager().getMessagesNotOpened();
List<MessageModel> listMessageModels = new ArrayList<MessageModel>(); List<MessageModel> listMessageModels = new ArrayList<MessageModel>();
@ -1614,7 +1535,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server getNewMessagesReceived by messageIdentifier ", e); workspaceLogger.error("Error in server getNewMessagesReceived by messageIdentifier ", e);
// workspaceLogger.trace("Error in server getNewMessagesReceived by messageIdentifier " + e.getMessage());
//GWT can't serialize all exceptions //GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -1628,9 +1548,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("searchInSentMessagesByText "+text);
logger.info("searchInSentMessagesByText");
// workspaceLogger.trace("searchInSentMessagesByText ");
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -1652,9 +1570,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("searchInSentMessagesByText: "+text);
logger.info("searchInSentMessagesByText");
// workspaceLogger.trace("searchInSentMessagesByText ");
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
@ -1681,8 +1597,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
WorkspaceItem sourceItem = workspace.getItem(itemId); //GET SOURCE ITEM BEFORE COPY WorkspaceItem sourceItem = workspace.getItem(itemId); //GET SOURCE ITEM BEFORE COPY
String sourceSharedId = sourceItem.getIdSharedFolder(); String sourceSharedId = sourceItem.getIdSharedFolder();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("copyItem by id: " + itemId);
logger.info("copyItem by id: " + itemId);
WorkspaceItem item = workspace.copy(itemId, destinationFolderId); //copy item WorkspaceItem item = workspace.copy(itemId, destinationFolderId); //copy item
@ -1714,10 +1629,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class); workspaceLogger.trace("delete bulk " + bulkId);
logger.info("delete bulk " + bulkId);
// workspaceLogger.trace("delete bulk " + bulkId);
workspace.getFolderBulkCreatorManager().getActiveFolderBulkCreator(bulkId).remove(); workspace.getFolderBulkCreatorManager().getActiveFolderBulkCreator(bulkId).remove();
@ -1737,9 +1649,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.info("getWebDavUrl " + itemId);
workspaceLogger.trace("getWebDavUrl" + itemId); workspaceLogger.trace("getWebDavUrl" + itemId);
return workspace.getUrlWebDav(); return workspace.getUrlWebDav();
@ -2344,7 +2253,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
String userUsername = WsUtil.getAslSession(this.getThreadLocalRequest().getSession()).getUsername(); String userUsername = WsUtil.getAslSession(this.getThreadLocalRequest().getSession()).getUsername();
boolean isTestUser = userUsername.compareTo(WsUtil.TEST_USER)==0; boolean isTestUser = userUsername.compareTo(WsUtil.TEST_USER)==0;
// //TODO COMMENT THIS FOR RELEASE // //TODO COMMENT THIS FOR DEVELOPMENT
// workspaceLogger.trace("is "+WsUtil.TEST_USER+" user: "+isTestUser + " is test mode: "+isTestMode()); // workspaceLogger.trace("is "+WsUtil.TEST_USER+" user: "+isTestUser + " is test mode: "+isTestMode());
// //
// if(isTestUser && !isTestMode()){ // if(isTestUser && !isTestMode()){

View File

@ -13,7 +13,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.gcube.common.core.utils.logging.GCUBELog; import org.apache.log4j.Logger;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.Workspace; import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
@ -32,7 +32,9 @@ import org.gcube.portlets.user.workspace.server.util.WsUtil;
public class ImageServlet extends HttpServlet{ public class ImageServlet extends HttpServlet{
private static final long serialVersionUID = -8423345575690165644L; private static final long serialVersionUID = -8423345575690165644L;
protected GCUBELog logger = new GCUBELog(ImageServlet.class);
protected static Logger logger = Logger.getLogger(ImageServlet.class);
/** /**
* {@inheritDoc} * {@inheritDoc}
@ -40,7 +42,8 @@ public class ImageServlet extends HttpServlet{
@Override @Override
public void init() throws ServletException { public void init() throws ServletException {
super.init(); super.init();
System.out.println("Workspace ImageServlet ready.");
logger.trace("Workspace ImageServlet ready.");
} }

View File

@ -22,7 +22,7 @@ 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.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.gcube.common.core.utils.logging.GCUBELog; import org.apache.log4j.Logger;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.Workspace; import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
@ -62,7 +62,7 @@ public class UploadServlet extends HttpServlet {
public static final String FILE = "File"; public static final String FILE = "File";
protected GCUBELog logger = new GCUBELog(UploadServlet.class); protected static Logger logger = Logger.getLogger(UploadServlet.class);
public static final String D4ST = Extensions.REPORT_TEMPLATE.getName(); //extension of Report Template type public static final String D4ST = Extensions.REPORT_TEMPLATE.getName(); //extension of Report Template type
public static final String D4SR = Extensions.REPORT.getName(); //extension of Report type public static final String D4SR = Extensions.REPORT.getName(); //extension of Report type

View File

@ -1,143 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.workspace.server.notifications;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import org.apache.log4j.Logger;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.informationsystem.client.AtomicCondition;
import org.gcube.common.core.informationsystem.client.ISClient;
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
import org.gcube.common.core.scope.GCUBEScope;
import com.liferay.portal.model.Organization;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class FeedScheduler {
protected Timer scheduler;
protected Map<GCUBEScope, NotificationsProducer> scheduledScopes;
protected Logger logger = Logger.getLogger(FeedScheduler.class);
public FeedScheduler(long refreshTime)
{
scheduledScopes = new HashMap<GCUBEScope, NotificationsProducer>();
scheduler = new Timer(true);
scheduler.schedule(new TimerTask() {
@Override
public void run() {
checkScopes();
}
}, 0, refreshTime);
}
public void schedule() throws Exception
{
List<GCUBEScope> scopes = getAvailableScopes();
for (GCUBEScope scope:scopes) {
logger.trace("checking scope: "+scope);
if (isServicePresentInScope(scope)) {
logger.trace("service present");
schedule(scope);
} else logger.trace("service not present");
}
checkScopes();
}
protected void schedule(GCUBEScope scope)
{
// if (!scheduledScopes.containsKey(scope)) {
// NotificationsProducer feeder = new NotificationsProducer(scope);
// scheduledScopes.put(scope, feeder);
// }
}
protected void checkScopes()
{
for (NotificationsProducer feeder:scheduledScopes.values()) {
try {
// feeder.checkOperatorsForFeed();
} catch (Exception e) {
}
}
}
protected boolean isServicePresentInScope(GCUBEScope scope) throws Exception
{
ISClient isClient = GHNContext.getImplementation(ISClient.class);
GCUBERIQuery query = isClient.getQuery(GCUBERIQuery.class);
query.addAtomicConditions(new AtomicCondition("/Profile/ServiceName", "statistical-manager-gcubews"));
query.addAtomicConditions(new AtomicCondition("/Profile/ServiceClass", "DataAnalysis"));
return isClient.execute(query, scope).size()>0;
}
protected static List<GCUBEScope> getAvailableScopes() throws Exception
{
//FIXME for test only
//return Arrays.asList(GCUBEScope.getScope("/gcube/devsec/devVRE"));
GHNContext ctx = GHNContext.getContext();
String rootScopeName = (String) ctx.getProperty(GHNContext.INFRASTRUCTURE_NAME, true);
GCUBEScope rootScope = GCUBEScope.getScope("/"+rootScopeName);
List<GCUBEScope> scopes = findAvailableScopes(rootScope);
return scopes;
}
protected static List<GCUBEScope> findAvailableScopes(GCUBEScope infrastructure) throws Exception {
List<GCUBEScope> scopes = new ArrayList<GCUBEScope>();
//************* PORTAL MODE, Checking organizations
scopes.add(infrastructure);
///************* GET ROOT ORGANIZATION
List<Organization> organizations = OrganizationLocalServiceUtil.getOrganizations(0, OrganizationLocalServiceUtil.getOrganizationsCount());
Organization rootOrganization = null;
for (Organization organization : organizations) {
if (organization.getName().equals(infrastructure.getName()) ) {
rootOrganization = organization;
break;
}
}
if(rootOrganization==null) throw new Exception("Unable to find infrastructure scope "+infrastructure.getName()+" among organizations");
//************** GET VO
for (Organization vOrg : rootOrganization.getSuborganizations()){
String VOScopeString="/"+vOrg.getParentOrganization().getName()+"/"+vOrg.getName();
try{
scopes.add(GCUBEScope.getScope(VOScopeString));
for (Organization vre : vOrg.getSuborganizations()){
String VREScopeString=VOScopeString+"/"+vre.getName();
try{
scopes.add(GCUBEScope.getScope(VREScopeString));
}catch(Exception e){
}
}
}catch(Exception e){
}
//************* GET VRE
}
return scopes;
}
public static void main(String[] args) throws Exception
{
FeedScheduler scheduler = new FeedScheduler(1000);
scheduler.schedule();
}
}

View File

@ -6,15 +6,15 @@ package org.gcube.portlets.user.workspace.server.notifications;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger;
import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager; import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.applicationsupportlayer.social.NotificationsManager; import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.portlets.user.workspace.client.model.InfoContactModel; import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
import org.gcube.portlets.user.workspace.server.util.DiffereceBeetweenInfoContactModel; import org.gcube.portlets.user.workspace.server.util.DiffereceBeetweenInfoContactModel;
import org.gcube.portlets.user.workspace.server.util.UserUtil; import org.gcube.portlets.user.workspace.server.util.UserUtil;
@ -27,8 +27,9 @@ import org.gcube.portlets.user.workspace.server.util.WsUtil;
*/ */
public class NotificationsProducer { public class NotificationsProducer {
protected GCUBEClientLog gcubeLogger = new GCUBEClientLog(NotificationsProducer.class); protected ScopeBean scope;
protected GCUBEScope scope;
protected static Logger logger = Logger.getLogger(NotificationsProducer.class);
protected NotificationsManager notificationsMng; protected NotificationsManager notificationsMng;
protected ASLSession aslSession; protected ASLSession aslSession;
@ -69,14 +70,14 @@ public class NotificationsProducer {
@Override @Override
public void run() { public void run() {
gcubeLogger.trace("Send notifies folder sharing is running..."); logger.trace("Send notifies folder sharing is running...");
for (InfoContactModel infoContactModel : listContacts) { for (InfoContactModel infoContactModel : listContacts) {
try{ try{
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER //NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getLogin().compareTo(userId)!=0){ if(infoContactModel.getLogin().compareTo(userId)!=0){
gcubeLogger.trace("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin()); logger.trace("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
//DEBUG //DEBUG
System.out.println("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin()); System.out.println("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
@ -85,15 +86,15 @@ public class NotificationsProducer {
if(!notify) if(!notify)
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin()); logger.error("An error occured when notify user: "+infoContactModel.getLogin());
} }
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occured in notifyFolderSharing ", e); logger.error("An error occured in notifyFolderSharing ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
gcubeLogger.trace("notifies share folder is completed"); logger.trace("notifies share folder is completed");
} }
}.start(); }.start();
@ -114,17 +115,17 @@ public class NotificationsProducer {
@Override @Override
public void run() { public void run() {
gcubeLogger.trace("Send notifies shared folder was renamed is running..."); logger.trace("Send notifies shared folder was renamed is running...");
try { try {
if(NotificationsUtil.checkIsRootFolderShared(folderItem.getId(), idsharedFolder)){ if(NotificationsUtil.checkIsRootFolderShared(folderItem.getId(), idsharedFolder)){
gcubeLogger.trace("Notification isn't sent because the event is on root shared folder"); logger.trace("Notification isn't sent because the event is on root shared folder");
return; return;
} }
} catch (InternalErrorException e1) { } catch (InternalErrorException e1) {
gcubeLogger.error("An error occurred in checkIsRootFolderShared ", e1); logger.error("An error occurred in checkIsRootFolderShared ", e1);
return; return;
} }
@ -133,7 +134,7 @@ public class NotificationsProducer {
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER //NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getLogin().compareTo(userId)!=0){ if(infoContactModel.getLogin().compareTo(userId)!=0){
gcubeLogger.trace("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin()); logger.trace("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
//DEBUG //DEBUG
System.out.println("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin()); System.out.println("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
@ -142,15 +143,15 @@ public class NotificationsProducer {
if(!notify) if(!notify)
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin()); logger.error("An error occured when notify user: "+infoContactModel.getLogin());
} }
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occured in notifyFolderRenamed ", e); logger.error("An error occured in notifyFolderRenamed ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
gcubeLogger.trace("notifies share folder was renamed is completed"); logger.trace("notifies share folder was renamed is completed");
} }
}.start(); }.start();
@ -169,14 +170,14 @@ public class NotificationsProducer {
@Override @Override
public void run() { public void run() {
gcubeLogger.trace("Send notifies shared item was updated is running..."); logger.trace("Send notifies shared item was updated is running...");
for (InfoContactModel infoContactModel : listSharedContact) { for (InfoContactModel infoContactModel : listSharedContact) {
try{ try{
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER //NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getLogin().compareTo(userId)!=0){ if(infoContactModel.getLogin().compareTo(userId)!=0){
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName()); logger.trace("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
//DEBUG //DEBUG
System.out.println("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName()); System.out.println("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
@ -186,15 +187,15 @@ public class NotificationsProducer {
boolean notify = notificationsMng.notifyItemRenaming(infoContactModel.getLogin(), previousName, item); boolean notify = notificationsMng.notifyItemRenaming(infoContactModel.getLogin(), previousName, item);
if(!notify) if(!notify)
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin()); logger.error("An error occured when notify user: "+infoContactModel.getLogin());
} }
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occured in notifyItemUpdated ", e); logger.error("An error occured in notifyItemUpdated ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
gcubeLogger.trace("notifies shared item was updated is completed"); logger.trace("notifies shared item was updated is completed");
} }
}.start(); }.start();
@ -232,7 +233,7 @@ public class NotificationsProducer {
try{ try{
gcubeLogger.trace("Sending notification to user "+contact.getLogin()+", added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName()); logger.trace("Sending notification to user "+contact.getLogin()+", added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName());
//DEBUG //DEBUG
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin()); // System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
@ -240,10 +241,10 @@ public class NotificationsProducer {
boolean notify = notificationsMng.notifyFolderAddedUser(contact.getLogin(), sharedFolder, infoContactModel.getLogin()); boolean notify = notificationsMng.notifyFolderAddedUser(contact.getLogin(), sharedFolder, infoContactModel.getLogin());
if(!notify) if(!notify)
gcubeLogger.error("An error occured when notifies user: "+contact.getLogin()); logger.error("An error occured when notifies user: "+contact.getLogin());
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occured in notifyFolderAddedUser ", e); logger.error("An error occured in notifyFolderAddedUser ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -260,7 +261,7 @@ public class NotificationsProducer {
try{ try{
gcubeLogger.trace("Sending notification to user "+contact.getLogin()+", added "+listLogins.size()+" users to share folder "+sharedFolder.getName()); logger.trace("Sending notification to user "+contact.getLogin()+", added "+listLogins.size()+" users to share folder "+sharedFolder.getName());
//DEBUG //DEBUG
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin()); // System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
@ -268,10 +269,10 @@ public class NotificationsProducer {
boolean notify = notificationsMng.notifyFolderAddedUsers(contact.getLogin(), sharedFolder, listLogins); boolean notify = notificationsMng.notifyFolderAddedUsers(contact.getLogin(), sharedFolder, listLogins);
if(!notify) if(!notify)
gcubeLogger.error("An error occured when notifies user: "+contact.getLogin()); logger.error("An error occured when notifies user: "+contact.getLogin());
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occured in notifyFolderAddedUser ", e); logger.error("An error occured in notifyFolderAddedUser ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -284,7 +285,7 @@ public class NotificationsProducer {
} }
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occured in notifyAddedUserToSharing ", e); logger.error("An error occured in notifyAddedUserToSharing ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -307,7 +308,7 @@ public class NotificationsProducer {
public void run() { public void run() {
// printContacts(listContacts); // printContacts(listContacts);
gcubeLogger.trace("Send notifies folder un share is running..."); logger.trace("Send notifies folder un share is running...");
for (InfoContactModel infoContactModel : listContacts) { for (InfoContactModel infoContactModel : listContacts) {
try{ try{
@ -315,7 +316,7 @@ public class NotificationsProducer {
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER //NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getLogin().compareTo(userId)!=0){ if(infoContactModel.getLogin().compareTo(userId)!=0){
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName()); logger.trace("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
//DEBUG //DEBUG
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName()); System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
@ -323,15 +324,15 @@ public class NotificationsProducer {
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), unSharedFolder); boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), unSharedFolder);
if(!notify) if(!notify)
gcubeLogger.error("An error occured when notifies user: "+infoContactModel.getLogin()); logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
} }
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occured in notifyFolderUnSharing ", e); logger.error("An error occured in notifyFolderUnSharing ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
gcubeLogger.trace("notifies of un share notifications is completed"); logger.trace("notifies of un share notifications is completed");
} }
}.start(); }.start();
@ -352,7 +353,7 @@ public class NotificationsProducer {
public void run() { public void run() {
// printContacts(listContacts); // printContacts(listContacts);
gcubeLogger.trace("Send notifies added item in sharedfolder is running..."); logger.trace("Send notifies added item in sharedfolder is running...");
//DEBUG //DEBUG
System.out.println("Send notifies added item in sharedfolder is running..."); System.out.println("Send notifies added item in sharedfolder is running...");
@ -363,7 +364,7 @@ public class NotificationsProducer {
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER //NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getLogin().compareTo(userId)!=0){ if(infoContactModel.getLogin().compareTo(userId)!=0){
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); logger.trace("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
//DEBUG //DEBUG
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); System.out.println("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
@ -374,18 +375,18 @@ public class NotificationsProducer {
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder); boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
if(!notify){ if(!notify){
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin()); logger.error("An error occured when notify user: "+infoContactModel.getLogin());
//DEBUG //DEBUG
System.out.println("An error occured when notify user: "+infoContactModel.getLogin()); System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
} }
} }
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occured in notifyAddedItemToSharing ", e); logger.error("An error occured in notifyAddedItemToSharing ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
gcubeLogger.trace("notifies of added item in shared folder is completed"); logger.trace("notifies of added item in shared folder is completed");
//DEBUG //DEBUG
System.out.println("notifies of added item in shared folder is completed"); System.out.println("notifies of added item in shared folder is completed");
@ -407,7 +408,7 @@ public class NotificationsProducer {
public void run() { public void run() {
// printContacts(listContacts); // printContacts(listContacts);
gcubeLogger.trace("Send notifies updated item in shared folder is running..."); logger.trace("Send notifies updated item in shared folder is running...");
//DEBUG //DEBUG
System.out.println("Send notifies updated item in shared folder is running..."); System.out.println("Send notifies updated item in shared folder is running...");
@ -418,7 +419,7 @@ public class NotificationsProducer {
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER //NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getLogin().compareTo(userId)!=0){ if(infoContactModel.getLogin().compareTo(userId)!=0){
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); logger.trace("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
//DEBUG //DEBUG
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); System.out.println("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
@ -429,18 +430,18 @@ public class NotificationsProducer {
boolean notify = notificationsMng.notifyUpdatedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder); boolean notify = notificationsMng.notifyUpdatedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
if(!notify){ if(!notify){
gcubeLogger.error("An error updated when notify user: "+infoContactModel.getLogin()); logger.error("An error updated when notify user: "+infoContactModel.getLogin());
//DEBUG //DEBUG
System.out.println("An error updated when notify user: "+infoContactModel.getLogin()); System.out.println("An error updated when notify user: "+infoContactModel.getLogin());
} }
} }
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error updated in notifyAddedItemToSharing ", e); logger.error("An error updated in notifyAddedItemToSharing ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
gcubeLogger.trace("notifies of updated item in shared folder is completed"); logger.trace("notifies of updated item in shared folder is completed");
//DEBUG //DEBUG
System.out.println("notifies of updated item in shared folder is completed"); System.out.println("notifies of updated item in shared folder is completed");
@ -465,22 +466,22 @@ public class NotificationsProducer {
@Override @Override
public void run() { public void run() {
gcubeLogger.trace("Sending notification remove item in shared folder is running..."); logger.trace("Sending notification remove item in shared folder is running...");
// printContacts(listContacts); // printContacts(listContacts);
try { try {
if(NotificationsUtil.checkIsRootFolderShared(workspaceItem.getId(), sharedFolder.getId())){ if(NotificationsUtil.checkIsRootFolderShared(workspaceItem.getId(), sharedFolder.getId())){
gcubeLogger.trace("Notification isn't sent because the event is on root shared folder"); logger.trace("Notification isn't sent because the event is on root shared folder");
return; return;
} }
} catch (InternalErrorException e1) { } catch (InternalErrorException e1) {
gcubeLogger.error("An error occurred in checkIsRootFolderShared ", e1); logger.error("An error occurred in checkIsRootFolderShared ", e1);
return; return;
} }
gcubeLogger.trace("Sending notification moved item in shared folder is running..."); logger.trace("Sending notification moved item in shared folder is running...");
System.out.println("Sending notification moved item in shared folder is running..."); System.out.println("Sending notification moved item in shared folder is running...");
@ -490,7 +491,7 @@ public class NotificationsProducer {
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER //NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getLogin().compareTo(userId)!=0){ if(infoContactModel.getLogin().compareTo(userId)!=0){
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); logger.trace("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
//DEBUG //DEBUG
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); System.out.println("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
@ -498,19 +499,19 @@ public class NotificationsProducer {
boolean notify = notificationsMng.notifyMovedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder); boolean notify = notificationsMng.notifyMovedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
if(!notify){ if(!notify){
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin()); logger.error("An error occured when notify user: "+infoContactModel.getLogin());
//DEBUG //DEBUG
System.out.println("An error occured when notify user: "+infoContactModel.getLogin()); System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
} }
} }
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occurred in notifyMovedItemToSharing ", e); logger.error("An error occurred in notifyMovedItemToSharing ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
gcubeLogger.trace("notifies of moved item in shared folder is completed"); logger.trace("notifies of moved item in shared folder is completed");
//DEBUG //DEBUG
System.out.println("notifies of moved item in shared folder is completed"); System.out.println("notifies of moved item in shared folder is completed");
@ -535,19 +536,19 @@ public class NotificationsProducer {
@Override @Override
public void run() { public void run() {
gcubeLogger.trace("Sending notification remove item in shared folder is running..."); logger.trace("Sending notification remove item in shared folder is running...");
// printContacts(listContacts); // printContacts(listContacts);
if(itemName==null || itemName.isEmpty()){ if(itemName==null || itemName.isEmpty()){
gcubeLogger.trace("Notification isn't sent - itemName is null or empty"); logger.trace("Notification isn't sent - itemName is null or empty");
return; return;
} }
if(sharedFolder==null){ if(sharedFolder==null){
gcubeLogger.trace("Notification isn't sent - sharedFolder is null"); logger.trace("Notification isn't sent - sharedFolder is null");
} }
gcubeLogger.trace("Sending notification removed item in shared folder is running..."); logger.trace("Sending notification removed item in shared folder is running...");
System.out.println("Sending notification removed item in shared folder is running..."); System.out.println("Sending notification removed item in shared folder is running...");
@ -557,7 +558,7 @@ public class NotificationsProducer {
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER //NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getLogin().compareTo(userId)!=0){ if(infoContactModel.getLogin().compareTo(userId)!=0){
gcubeLogger.trace("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName()); logger.trace("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
//DEBUG //DEBUG
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName()); System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
@ -568,19 +569,19 @@ public class NotificationsProducer {
if(!notify){ if(!notify){
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getLogin()); logger.error("An error occured when notify user: "+infoContactModel.getLogin());
//DEBUG //DEBUG
System.out.println("An error occured when notify user: "+infoContactModel.getLogin()); System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
} }
} }
}catch (Exception e) { }catch (Exception e) {
gcubeLogger.error("An error occurred in notifyRemovedItemToSharing ", e); logger.error("An error occurred in notifyRemovedItemToSharing ", e);
e.printStackTrace(); e.printStackTrace();
} }
} }
gcubeLogger.trace("notifies of moved item in shared folder is completed"); logger.trace("notifies of moved item in shared folder is completed");
//DEBUG //DEBUG
System.out.println("notifies of moved item in shared folder is completed"); System.out.println("notifies of moved item in shared folder is completed");
@ -610,11 +611,11 @@ public class NotificationsProducer {
String scopeString = "/gcube/devsec/devVRE"; String scopeString = "/gcube/devsec/devVRE";
String fullName = "Francesco Mangiacrapa"; String fullName = "Francesco Mangiacrapa";
GCUBEScope scope; ScopeBean scope;
ASLSession session; ASLSession session;
session = SessionManager.getInstance().getASLSession(sessionID, user); session = SessionManager.getInstance().getASLSession(sessionID, user);
scope = GCUBEScope.getScope(scopeString); scope = new ScopeBean(scopeString);
session.setScope(scope.toString()); session.setScope(scope.toString());
session.setUserAvatarId(user + "Avatar"); session.setUserAvatarId(user + "Avatar");
session.setUserFullName(fullName); session.setUserFullName(fullName);

View File

@ -23,10 +23,10 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.gcube.application.framework.core.genericresources.model.ISGenericResource; import org.gcube.application.framework.core.genericresources.model.ISGenericResource;
import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.util.GenericResource; import org.gcube.application.framework.core.util.GenericResource;
import org.gcube.common.core.utils.logging.GCUBELog;
/** /**
@ -35,7 +35,7 @@ import org.gcube.common.core.utils.logging.GCUBELog;
*/ */
public class MetadataConverter { public class MetadataConverter {
protected GCUBELog logger; protected Logger logger;
/** /**
* FIXME public as generic resource * FIXME public as generic resource
@ -57,7 +57,7 @@ public class MetadataConverter {
/** /**
* Create a new MetadataConverter. * Create a new MetadataConverter.
*/ */
public MetadataConverter(GCUBELog logger) public MetadataConverter(Logger logger)
{ {
this.logger = logger; this.logger = logger;
} }

View File

@ -6,7 +6,7 @@ package org.gcube.portlets.user.workspace.server.util;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import org.gcube.common.core.utils.logging.GCUBELog; import org.apache.log4j.Logger;
import org.gcube.common.homelibrary.home.workspace.events.WorkspaceEvent; import org.gcube.common.homelibrary.home.workspace.events.WorkspaceEvent;
import org.gcube.common.homelibrary.home.workspace.events.WorkspaceListener; import org.gcube.common.homelibrary.home.workspace.events.WorkspaceListener;
@ -16,14 +16,14 @@ import org.gcube.common.homelibrary.home.workspace.events.WorkspaceListener;
*/ */
public class WorkspaceEventCollector implements WorkspaceListener { public class WorkspaceEventCollector implements WorkspaceListener {
protected GCUBELog logger; protected Logger logger;
protected BlockingQueue<WorkspaceEvent> eventsQueue = new LinkedBlockingQueue<WorkspaceEvent>(); protected BlockingQueue<WorkspaceEvent> eventsQueue = new LinkedBlockingQueue<WorkspaceEvent>();
/** /**
* @param logger * @param logger
*/ */
public WorkspaceEventCollector(GCUBELog logger) { public WorkspaceEventCollector(Logger logger) {
this.logger = logger; this.logger = logger;
} }

View File

@ -11,8 +11,6 @@ import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager; import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager; import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
import org.gcube.applicationsupportlayer.social.NotificationsManager; import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.common.core.utils.logging.GCUBELog;
import org.gcube.common.homelibrary.home.HomeLibrary; import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException; import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
@ -62,8 +60,6 @@ public class WsUtil {
public static final String TEST_USER_FULL_NAME = "Test User"; public static final String TEST_USER_FULL_NAME = "Test User";
public static GCUBEClientLog defaultLogger = new GCUBEClientLog(WsUtil.class);
protected static Logger logger = Logger.getLogger(WsUtil.class); protected static Logger logger = Logger.getLogger(WsUtil.class);
public static boolean withoutPortal = false; public static boolean withoutPortal = false;
@ -83,11 +79,11 @@ public class WsUtil {
//UNCOMMENT THIS IN DEVELOP ENVIROMENT //UNCOMMENT THIS IN DEVELOP ENVIROMENT
// user = "francesco.mangiacrapa"; // user = "francesco.mangiacrapa";
defaultLogger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:"); logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
defaultLogger.warn("session id: "+sessionID); logger.warn("session id: "+sessionID);
defaultLogger.warn("TEST_USER: "+user); logger.warn("TEST_USER: "+user);
defaultLogger.warn("TEST_SCOPE: "+TEST_SCOPE); logger.warn("TEST_SCOPE: "+TEST_SCOPE);
defaultLogger.warn("USERNAME_ATTRIBUTE: "+USERNAME_ATTRIBUTE); logger.warn("USERNAME_ATTRIBUTE: "+USERNAME_ATTRIBUTE);
session = SessionManager.getInstance().getASLSession(sessionID, user); session = SessionManager.getInstance().getASLSession(sessionID, user);
session.setScope(TEST_SCOPE); session.setScope(TEST_SCOPE);
@ -129,8 +125,6 @@ public class WsUtil {
Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername()); Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername());
final GCUBELog logger = getLogger(workspace);
if (session.getAttribute(METADATACONVERTER_ATTRIBUTE) == null){ if (session.getAttribute(METADATACONVERTER_ATTRIBUTE) == null){
logger.trace("Initializing the Metadata converter"); logger.trace("Initializing the Metadata converter");
@ -178,21 +172,8 @@ public class WsUtil {
} }
public static GCUBELog getLogger(Workspace workspace)
{
/* TODO if (workspace instanceof PersistentFSWorkspace){
PersistentFSWorkspace persistentFSWorkspace = (PersistentFSWorkspace) workspace;
try {
return persistentFSWorkspace.getWorkspacePortletLogger();
} catch (InternalErrorException e) {
e.printStackTrace();
}
}*/
return defaultLogger; public static MetadataConverter getMetadataConverter(Logger logger, HttpSession httpSession)
}
public static MetadataConverter getMetadataConverter(GCUBELog logger, HttpSession httpSession)
{ {
MetadataConverter mc = (MetadataConverter) httpSession.getAttribute(METADATACONVERTER_ATTRIBUTE); MetadataConverter mc = (MetadataConverter) httpSession.getAttribute(METADATACONVERTER_ATTRIBUTE);
@ -228,7 +209,7 @@ public class WsUtil {
NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER); NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER);
if (notifMng == null) { if (notifMng == null) {
defaultLogger.trace("Create new NotificationsManager for user: "+session.getUsername()); logger.trace("Create new NotificationsManager for user: "+session.getUsername());
notifMng = new ApplicationNotificationsManager(session, NOTIFICATION_PORTLET_CLASS_ID); notifMng = new ApplicationNotificationsManager(session, NOTIFICATION_PORTLET_CLASS_ID);
session.setAttribute(NOTIFICATION_MANAGER, notifMng); session.setAttribute(NOTIFICATION_MANAGER, notifMng);
} }
@ -242,7 +223,7 @@ public class WsUtil {
NotificationsProducer notifProducer = (NotificationsProducer) session.getAttribute(NOTIFICATION_PRODUCER); NotificationsProducer notifProducer = (NotificationsProducer) session.getAttribute(NOTIFICATION_PRODUCER);
if (notifProducer == null) { if (notifProducer == null) {
defaultLogger.trace("Create new Notification Producer for user: "+session.getUsername()); logger.trace("Create new Notification Producer for user: "+session.getUsername());
notifProducer = new NotificationsProducer(session); notifProducer = new NotificationsProducer(session);
session.setAttribute(NOTIFICATION_PRODUCER, notifProducer); session.setAttribute(NOTIFICATION_PRODUCER, notifProducer);
} }
@ -264,11 +245,11 @@ public class WsUtil {
int slashCount = StringUtils.countMatches(currentScope, "/"); int slashCount = StringUtils.countMatches(currentScope, "/");
if(slashCount < 3){ if(slashCount < 3){
defaultLogger.trace("currentScope is not VRE"); logger.trace("currentScope is not VRE");
return false; return false;
} }
defaultLogger.trace("currentScope is VRE"); logger.trace("currentScope is VRE");
return true; return true;
} }
@ -285,7 +266,7 @@ public class WsUtil {
} }
}catch (Exception e) { }catch (Exception e) {
defaultLogger.error("an error occurred in getscope filter "+e); logger.error("an error occurred in getscope filter "+e);
} }
return scopeUtil; return scopeUtil;
@ -309,7 +290,7 @@ public class WsUtil {
} }
}catch (Exception e) { }catch (Exception e) {
defaultLogger.error("an error occurred in instancing url shortener ",e); logger.error("an error occurred in instancing url shortener ",e);
} }
return shortener; return shortener;
@ -334,7 +315,7 @@ public class WsUtil {
} }
}catch (Exception e) { }catch (Exception e) {
defaultLogger.error("an error occurred in instancing uri resolver ",e); logger.error("an error occurred in instancing uri resolver ",e);
} }
return uriResolver; return uriResolver;

View File

@ -6,14 +6,14 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.gcube.common.core.utils.logging.GCUBEClientLog; import org.apache.log4j.Logger;
public class ScopeUtilFilter { public class ScopeUtilFilter {
private static final String SCOPE_SEPARATOR = "/"; private static final String SCOPE_SEPARATOR = "/";
private String scopeRoot = null; private String scopeRoot = null;
public static GCUBEClientLog logger = new GCUBEClientLog(ScopeUtilFilter.class); public static Logger logger = Logger.getLogger(ScopeUtilFilter.class);
public Map<String, String> hashScopesFiltered = new HashMap<String, String>(); public Map<String, String> hashScopesFiltered = new HashMap<String, String>();
public static final String ALLSCOPE = "All spaces"; public static final String ALLSCOPE = "All spaces";

View File

@ -6,7 +6,6 @@ package org.gcube.portlets.user.workspace;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.homelibrary.home.HomeLibrary; import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.Workspace; import org.gcube.common.homelibrary.home.workspace.Workspace;
@ -19,6 +18,7 @@ import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalImage;
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalPDFFile; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalPDFFile;
import org.gcube.common.homelibrary.home.workspace.folder.items.gcube.ImageDocument; import org.gcube.common.homelibrary.home.workspace.folder.items.gcube.ImageDocument;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
@ -34,7 +34,7 @@ public class PublicLinkTest {
try { try {
GCUBEScope scope = GCUBEScope.getScope("/gcube/devsec"); ScopeBean scope = new ScopeBean("/gcube/devsec");
ScopeProvider.instance.set(scope.toString()); ScopeProvider.instance.set(scope.toString());
Workspace ws = HomeLibrary Workspace ws = HomeLibrary

View File

@ -11,7 +11,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import org.gcube.common.core.scope.GCUBEScope.MalformedScopeExpressionException;
import org.gcube.common.homelibrary.home.HomeLibrary; import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException; import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
@ -25,6 +24,8 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationEx
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
import org.gcube.common.homelibrary.util.MimeTypeUtil; import org.gcube.common.homelibrary.util.MimeTypeUtil;
import org.gcube.common.homelibrary.util.WorkspaceUtil; import org.gcube.common.homelibrary.util.WorkspaceUtil;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
@ -33,64 +34,68 @@ import org.gcube.common.homelibrary.util.WorkspaceUtil;
*/ */
public class UploadServletTest { public class UploadServletTest {
public static void main(String[] args) throws InternalErrorException, MalformedScopeExpressionException, WorkspaceFolderNotFoundException, HomeNotFoundException, UserNotFoundException, InsufficientPrivilegesException, ItemAlreadyExistException, WrongDestinationException, IOException { public static void main(String[] args) throws InternalErrorException,
WorkspaceFolderNotFoundException, HomeNotFoundException,
UserNotFoundException, InsufficientPrivilegesException,
ItemAlreadyExistException, WrongDestinationException, IOException {
// HomeManagerFactory factory = HomeLibrary.getHomeManagerFactory(); ScopeBean scope = new ScopeBean("/gcube/devsec");
// Workspace workspace = factory.getHomeManager().getHome("francesco.mangiacrapa",GCUBEScope.getScope("/gcube/devsec")).getWorkspace(); ScopeProvider.instance.set(scope.toString());
Workspace workspace = HomeLibrary Workspace workspace = HomeLibrary.getHomeManagerFactory()
.getHomeManagerFactory() .getHomeManager().getHome("francesco.mangiacrapa")
.getHomeManager()
.getHome("francesco.mangiacrapa")
.getWorkspace(); .getWorkspace();
String filePath = "/home/francesco-mangiacrapa/Desktop/icongeoexplorer"; String filePath = "/home/francesco-mangiacrapa/Desktop/icongeoexplorer";
String fileName = "testupload.txt"; String fileName = "testupload.txt";
String fullPath = filePath+"/"+fileName; String fullPath = filePath + "/" + fileName;
// String newFilePath = "/home/francesco-mangiacrapa/Desktop/icongeoexplorer/testupload.txt"; // String newFilePath =
// "/home/francesco-mangiacrapa/Desktop/icongeoexplorer/testupload.txt";
// String name = "TestReplaceContentImage"; // String name = "TestReplaceContentImage";
// ExternalPDFFile file = workspace.createExternalPDFFile(name, "", null, new FileInputStream(new File(filePath)), // ExternalPDFFile file = workspace.createExternalPDFFile(name, "",
// workspace.getRoot().getId()); // null, new FileInputStream(new File(filePath)),
// workspace.getRoot().getId());
WorkspaceFolder root = workspace.getRoot(); WorkspaceFolder root = workspace.getRoot();
// ExternalImage file = (ExternalImage) root.find(name); // ExternalImage file = (ExternalImage) root.find(name);
// UPLOAD FILE
//UPLOAD FILE String contentType = MimeTypeUtil.getMimeType(new BufferedInputStream(
String contentType = MimeTypeUtil.getMimeType(new BufferedInputStream(new FileInputStream(new File(fullPath)))); new FileInputStream(new File(fullPath))));
String itemName = WorkspaceUtil.getUniqueName(fileName, root); String itemName = WorkspaceUtil.getUniqueName(fileName, root);
System.out.println("Storing data...."); System.out.println("Storing data....");
System.out.println("content type "+contentType); System.out.println("content type " + contentType);
System.out.println("itemName "+itemName); System.out.println("itemName " + itemName);
ExternalFile file = (ExternalFile) WorkspaceUtil.createExternalFile(root, itemName, "", contentType, new FileInputStream(new File(fullPath))); ExternalFile file = (ExternalFile) WorkspaceUtil.createExternalFile(
root, itemName, "", contentType, new FileInputStream(new File(
System.out.println("Storing data - OK" + "File [id: "+file.getId() + ", name: "+file.getName()+"]"); fullPath)));
//
// System.out.println("File mimeType" + file.getMimeType());
// System.out.println("File size" + file.getLength());
//
//
// file.setData(new FileInputStream(new File(newFilePath)));
// System.out.println("New File mimeType" + file.getMimeType());
// System.out.println("New File size" + file.getLength());
//
System.out.println("Storing data - OK" + "File [id: " + file.getId()
+ ", name: " + file.getName() + "]");
//
// System.out.println("File mimeType" + file.getMimeType());
// System.out.println("File size" + file.getLength());
//
//
// file.setData(new FileInputStream(new File(newFilePath)));
// System.out.println("New File mimeType" + file.getMimeType());
// System.out.println("New File size" + file.getLength());
//
System.out.println("Recovering data"); System.out.println("Recovering data");
InputStream inputStream = file.getData(); InputStream inputStream = file.getData();
// write the inputStream to a FileOutputStream // write the inputStream to a FileOutputStream
OutputStream out = new FileOutputStream(new File("/home/francesco-mangiacrapa/Desktop/result")); OutputStream out = new FileOutputStream(new File(
"/home/francesco-mangiacrapa/Desktop/result"));
int read = 0; int read = 0;
byte[] bytes = new byte[1024]; byte[] bytes = new byte[1024];
@ -105,8 +110,8 @@ public static void main(String[] args) throws InternalErrorException, MalformedS
System.out.println("Recovering data - OK"); System.out.println("Recovering data - OK");
// File file = new File("/home/gioia/Desktop/test"); // File file = new File("/home/gioia/Desktop/test");
// InputStream is = new FileInputStream(file); // InputStream is = new FileInputStream(file);
} }