Updated pom version at 6.12

Removed unused code and servlets

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@128590 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-05-13 09:14:42 +00:00
parent ca0f8a1754
commit 8a4dfa7acf
12 changed files with 666 additions and 730 deletions

View File

@ -23,5 +23,6 @@
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

46
pom.xml
View File

@ -10,7 +10,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId>
<version>6.11.2-SNAPSHOT</version>
<version>6.12.0-SNAPSHOT</version>
<name>gCube Workspace Tree Widget</name>
<description>
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
@ -62,12 +62,13 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-server</artifactId>
<version>${gwtVersion}</version>
<scope>runtime</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.google.web.bindery</groupId> -->
<!-- <artifactId>requestfactory-server</artifactId> -->
<!-- <version>${gwtVersion}</version> -->
<!-- <scope>runtime</scope> -->
<!-- </dependency> -->
<!-- Google Web Toolkit (GWT) -->
<dependency>
@ -145,37 +146,15 @@
<scope>compile</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.apache.directory.studio</groupId> -->
<!-- <artifactId>org.apache.commons.io</artifactId> -->
<!-- <version>2.1</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>commons-io</groupId> -->
<!-- <artifactId>commons-io</artifactId> -->
<!-- <version>2.4</version> -->
<!-- </dependency> -->
<!-- HOME LIBRARY -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-model</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-jcr</artifactId>
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
<exclusions>
<exclusion>
@ -184,17 +163,22 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-jcr</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<!-- <version>3.1</version> -->
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.5</version>
<!-- <version>1.4.5</version> -->
</dependency>
<dependency>

View File

@ -14,13 +14,8 @@
<inherits name="org.gcube.portlets.widgets.workspacesharingwidget.WorkspaceSharingWidget" />
<servlet path="/WorkspaceService" class="org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl" />
<inherits name="org.gcube.portlets.widgets.workspaceuploader.WorkspaceUploader"></inherits>
<!--
<servlet path="/ImageService" class="org.gcube.portlets.user.workspace.server.ImageServlet" />
<servlet path="/MetadataService" class="org.gcube.portlets.user.workspace.server.MetadataServlet" />
-->
<inherits name='org.gcube.portlets.widgets.fileupload.FileUpload' />
<inherits name="org.gcube.portlets.widgets.workspaceuploader.WorkspaceUploader"></inherits>
<servlet path="/UploadService" class="org.gcube.portlets.user.workspace.server.UploadServlet" />
<servlet path="/LocalUploadService" class="org.gcube.portlets.user.workspace.server.LocalUploadServlet" />
@ -29,8 +24,7 @@
<!-- Specify the application specific style sheet. -->
<stylesheet src='workspacetree.css' />
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>

View File

@ -152,7 +152,7 @@ public interface GWTWorkspaceService extends RemoteService{
* @return the smart folder results by id
* @throws Exception the exception
*/
public List<FileGridModel> getSmartFolderResultsById(String folderId) throws Exception;
public List<FileGridModel> getSmartFolderResultsById(String folderId) throws Exception;
/**
* Gets the all smart folders.
@ -283,7 +283,7 @@ public interface GWTWorkspaceService extends RemoteService{
* @throws Exception the exception
*/
public boolean sendToById(List<String> listContactsId, List<String> listAttachmentsId, String subject, String text) throws Exception;
/**
* Copy item.
*
@ -372,15 +372,6 @@ public interface GWTWorkspaceService extends RemoteService{
*/
public String itemExistsInWorkpaceFolder(String parentId, String itemName) throws Exception;
/**
* Gets the list user shared by shared item.
*
* @param sharedItemId the shared item id
* @return the list user shared by shared item
* @throws Exception the exception
*/
public List<InfoContactModel> getListUserSharedBySharedItem(String sharedItemId) throws Exception;
/**
* Gets the item creation date by id.
*
@ -568,7 +559,7 @@ public interface GWTWorkspaceService extends RemoteService{
*/
List<FileTrashedModel> getTrashContent() throws Exception;
/**
* Gets the AC ls description for workspace item by id.
*

View File

@ -37,7 +37,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
* Jul 14, 2015
*/
public interface GWTWorkspaceServiceAsync {
/**
* Gets the user workspace size.
*
@ -45,7 +45,7 @@ public interface GWTWorkspaceServiceAsync {
* @return the user workspace size
*/
void getUserWorkspaceSize(AsyncCallback<String> callback);
/**
* Gets the root for tree.
*
@ -53,7 +53,7 @@ public interface GWTWorkspaceServiceAsync {
* @return the root for tree
*/
void getRootForTree(AsyncCallback<FolderModel> callback);
/**
* Gets the root for tree.
*
@ -107,7 +107,7 @@ public interface GWTWorkspaceServiceAsync {
* @param callback the callback
*/
void renameItem(String itemId, String newName, String oldName, AsyncCallback<Boolean> callback);
/**
* Creates the folder.
*
@ -172,7 +172,7 @@ public interface GWTWorkspaceServiceAsync {
* @return the smart folder results by id
*/
void getSmartFolderResultsById(String folderId, AsyncCallback<List<FileGridModel>> callback);
/**
* Gets the all smart folders.
*
@ -213,7 +213,7 @@ public interface GWTWorkspaceServiceAsync {
* @param callback the callback
*/
void createExternalUrl(FileModel parentFileModel, String name, String description, String url, AsyncCallback<FileModel> callback);
/**
* Sets the value in session.
*
@ -239,7 +239,7 @@ public interface GWTWorkspaceServiceAsync {
* @return the all scope
*/
void getAllScope(AsyncCallback<List<ScopeModel>> callback);
/**
* Gets the all contacts.
*
@ -249,7 +249,7 @@ public interface GWTWorkspaceServiceAsync {
void getAllContacts(AsyncCallback<List<InfoContactModel>> callback);
// void sendTo(List<InfoContactModel> listContacts, List<FileModel> listAttachments, String subject, String text, AsyncCallback<Boolean> callback);
/**
* Send to by id.
*
@ -340,7 +340,7 @@ public interface GWTWorkspaceServiceAsync {
* @return the URL from application profile
*/
void getURLFromApplicationProfile(String oid, AsyncCallback<String> callback);
/**
* Gets the owner by item id.
*
@ -361,16 +361,6 @@ public interface GWTWorkspaceServiceAsync {
void itemExistsInWorkpaceFolder(String parentId, String itemName,
AsyncCallback<String> callback);
/**
* Gets the list user shared by shared item.
*
* @param sharedItemId the shared item id
* @param callback the callback
* @return the list user shared by shared item
*/
void getListUserSharedBySharedItem(String sharedItemId,
AsyncCallback<List<InfoContactModel>> callback);
/**
* Gets the item creation date by id.
*
@ -436,7 +426,7 @@ public interface GWTWorkspaceServiceAsync {
* @return the item for file grid
*/
void getItemForFileGrid(String itemId, AsyncCallback<FileGridModel> callback);
/**
* @param itemId
* @param asyncCallback
@ -597,7 +587,7 @@ public interface GWTWorkspaceServiceAsync {
void executeOperationOnTrash(List<String> listTrashItemIds,
WorkspaceTrashOperation operation,
AsyncCallback<TrashOperationContent> callback);
/**
* Adds the administrators by folder id.
*
@ -616,8 +606,8 @@ public interface GWTWorkspaceServiceAsync {
* @return the administrators by folder id
*/
void getAdministratorsByFolderId(String identifier, AsyncCallback<List<InfoContactModel>> callback);
/**
* Gets the ACL by shared folder id.
*

View File

@ -1782,7 +1782,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override
public List<InfoContactModel> getListUserSharedByFolderSharedId(String folderSharedId) throws Exception{
workspaceLogger.trace("getListUserSharedByFolderSharedId "+ folderSharedId);
workspaceLogger.debug("getListUserSharedByFolderSharedId "+ folderSharedId);
try {
Workspace workspace = getWorkspace();
@ -1793,7 +1793,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) wsItem;
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
List<String> listPortalLogin = wsFolder.getUsers();
workspaceLogger.trace("getListUserSharedByFolderSharedId return "+ listPortalLogin.size() + " user");
workspaceLogger.debug("HL return "+ listPortalLogin.size() + " user/s");
if(isTestMode())
return builder.buildGxtInfoContactFromPortalLoginTestMode(listPortalLogin);
@ -1815,8 +1815,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#getListUserSharedBySharedItem(java.lang.String)
*/
@Override
public List<InfoContactModel> getListUserSharedBySharedItem(String sharedItemId) throws Exception{
/*@Override
public List<InfoContactModel> getListUserSharedBySharedItem(String sharedItemId) throws Exception{
workspaceLogger.trace("Get ListUserSharedBySharedItem "+ sharedItemId);
try {
@ -1845,7 +1846,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
workspaceLogger.error("Error in getListUserSharedByItemId ", e);
throw new Exception(e.getMessage());
}
}
}*/
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#unSharedFolderByFolderSharedId(java.lang.String)

View File

@ -1,5 +1,5 @@
/**
*
*
*/
package org.gcube.portlets.user.workspace.server.notifications;
@ -23,10 +23,10 @@ import org.gcube.portlets.user.workspace.server.util.WsUtil;
*
*/
public class NotificationsUtil {
protected static Logger logger = Logger.getLogger(NotificationsUtil.class);
/**
* Send a notification if an item is added or updated to sharing folder
* @param httpSession
@ -35,77 +35,77 @@ public class NotificationsUtil {
* @param folderDestinationItem
*/
public static void checkSendNotifyChangedItemToShare(HttpSession httpSession, final WorkspaceItem sourceItem, final String sourceSharedId, final WorkspaceItem folderDestinationItem, boolean isOverwrite) {
logger.trace("checkSendNotifyAddItemToShare");
if(folderDestinationItem!=null){
if(folderDestinationItem!=null){
try{
if(folderDestinationItem.isShared()){ //Notify Added Item To Sharing?
logger.trace("checkNotifyAddItemToShare source item: "+sourceItem.getName()+" sourceSharedId: "+sourceSharedId + " folder destination: "+folderDestinationItem.getName() + " folder destination shared folder id: "+folderDestinationItem.getIdSharedFolder());
//share condition is true if source shared folder is not null
boolean shareChangeCondition = sourceSharedId==null?false:true;
//System.out.println("shareChangeCondition add item: "+ shareChangeCondition);
logger.trace("shareChangeCondition add item: "+shareChangeCondition);
//if shareChangeCondition is true.. notifies added item to sharing
if(shareChangeCondition){
if(shareChangeCondition){
Workspace workspace = WsUtil.getWorkspace(httpSession);
List<InfoContactModel> listContacts = getListUserSharedByFolderSharedId(workspace, folderDestinationItem.getIdSharedFolder());
List<InfoContactModel> listContacts = getListUsersSharedByFolderSharedId(workspace, folderDestinationItem.getIdSharedFolder());
WorkspaceItem destinationSharedFolder = workspace.getItem(folderDestinationItem.getIdSharedFolder());
NotificationsProducer np = new NotificationsProducer(WsUtil.getAslSession(httpSession));
if(destinationSharedFolder instanceof WorkspaceSharedFolder){
//SWITCH BEETWEEN ADDED OR UPDATED
if(!isOverwrite)
np.notifyAddedItemToSharing(listContacts, sourceItem, (WorkspaceSharedFolder) destinationSharedFolder);
np.notifyAddedItemToSharing(listContacts, sourceItem, (WorkspaceSharedFolder) destinationSharedFolder);
else
np.notifyUpdatedItemToSharing(listContacts, sourceItem, (WorkspaceSharedFolder) destinationSharedFolder);
np.notifyUpdatedItemToSharing(listContacts, sourceItem, (WorkspaceSharedFolder) destinationSharedFolder);
logger.trace("The notifies was sent correctly");
}else
logger.trace("The notifies doesn't sent because "+destinationSharedFolder+ " is not instance of WorkspaceSharedFolder");
// np.notifyAddedItemToSharing(listContacts, (WorkspaceFolder) folderDestinationItem);
}
// np.notifyAddedItemToSharing(listContacts, (WorkspaceFolder) folderDestinationItem);
}
}
else
logger.trace("folder destination is not shared");
}catch (Exception e) {
logger.error("An error occurred in checkSendNotifyAddItemToShare ",e);
}
}else
logger.warn("The notifies is failure in checkSendNotifyAddItemToShare because folder destination item is null");
logger.warn("The notifies is failure in checkSendNotifyAddItemToShare because folder destination item is null");
}
/**
*
*
* @param workspace
* @param idSharedFolder
* @return
* @throws Exception
*/
public static List<InfoContactModel> getListUserSharedByFolderSharedId(Workspace workspace, String idSharedFolder) throws Exception {
logger.trace("getListUserSharedByFolderSharedId "+ idSharedFolder);
public static List<InfoContactModel> getListUsersSharedByFolderSharedId(Workspace workspace, String idSharedFolder) throws Exception {
logger.trace("getListUsersSharedByFolderSharedId "+ idSharedFolder);
try {
WorkspaceItem wsItem = workspace.getItem(idSharedFolder);
if(isASharedFolder(wsItem)){
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) wsItem;
GWTWorkspaceBuilder builder = new GWTWorkspaceBuilder();
@ -115,16 +115,16 @@ public class NotificationsUtil {
logger.trace("getListUserSharedByFolderSharedId return "+ listPortalLogin.size() + " user");
return builder.buildGxtInfoContactsFromPortalLogins(listPortalLogin);
}
else{
logger.trace("the item with id: "+idSharedFolder+ " is not "+WorkspaceItemType.SHARED_FOLDER);
//DEBUG
//System.out.println("the item with id: "+folderSharedId+ " is not "+WorkspaceItemType.SHARED_FOLDER);
}
return new ArrayList<InfoContactModel>();
} catch (Exception e) {
logger.error("Error in getListUserSharedByItemId ", e);
throw new Exception(e.getMessage());
@ -133,9 +133,9 @@ public class NotificationsUtil {
/**
*
*
* @param httpSession
* @param sourceItemIsShared
* @param oldItemName
@ -143,51 +143,51 @@ public class NotificationsUtil {
* @param sourceFolderSharedId
*/
public static void checkSendNotifyRemoveItemToShare(HttpSession httpSession, final boolean sourceItemIsShared, final String oldItemName, String oldItemId, final String sourceFolderSharedId) {
logger.trace("checkNotifyRemoveItemToShare:");
try{
if(!sourceItemIsShared){
if(!sourceItemIsShared){
logger.trace("checkSendNotifyRemoveItemToShare returned, source item is not shared");
return;
}
String idSharedFolder = sourceFolderSharedId!=null?sourceFolderSharedId:"";
// System.out.println("shareChangeCondition remove item: "+ shareChangeCondition);
boolean isRootFolderShared = checkIsRootFolderShared(oldItemId, idSharedFolder);
logger.trace("isRootFolderShared is: "+ isRootFolderShared);
/*
if(isRootFolderShared){
logger.trace("Notification doesn't sent because the event is on root shared folder");
return;
}*/
boolean isSharedFolder = isASharedFolderForId(httpSession,idSharedFolder);
if(isSharedFolder){
logger.trace("idSharedFolder is: "+ idSharedFolder +" is shared folder: "+isSharedFolder);
Workspace workspace = WsUtil.getWorkspace(httpSession);
//get contacts
List<InfoContactModel> listContacts = getListUserSharedByFolderSharedId(workspace, idSharedFolder);
List<InfoContactModel> listContacts = getListUsersSharedByFolderSharedId(workspace, idSharedFolder);
WorkspaceItem sourceSharedFolder = workspace.getItem(idSharedFolder);
//System.out.println(" name sourceSharedFolder: "+ sourceSharedFolder.getName());
NotificationsProducer np = new NotificationsProducer(WsUtil.getAslSession(httpSession));
//Notify Removed Item To Sharing?
if(!isRootFolderShared){
if(sourceSharedFolder instanceof WorkspaceSharedFolder){
@ -196,21 +196,21 @@ public class NotificationsUtil {
}
else
logger.trace("The notifies doesn't sent because "+sourceSharedFolder+ " is not instance of WorkspaceSharedFolder");
}else{
//Case removed shared folder
np.notifySharedFolderDeleted(listContacts, oldItemName);
}
}
}catch (Exception e) {
logger.error("An error occurred in checkSendNotifyRemoveItemToShare ",e);
}
}
/**
*
*
* @param wsItem
* @return
*/
@ -219,52 +219,52 @@ public class NotificationsUtil {
return wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER);
return false;
}
/**
*
*
* @param wsItem
* @return
*/
public static boolean isASharedFolderForId(HttpSession httpSession, String itemId){
if(itemId==null || itemId.isEmpty())
return false;
try {
Workspace workspace = WsUtil.getWorkspace(httpSession);
WorkspaceItem wsItem = workspace.getItem(itemId);
if(wsItem!=null)
return wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER);
return false;
} catch (Exception e) {
logger.error("An errror occurred in isASharedFolderForId", e);
return false;
}
}
/**
*
*
* @param itemId
* @param rootFolderSharedId
* @return
*/
public static boolean checkIsRootFolderShared(String itemId, String rootFolderSharedId) {
logger.trace("checkIsRootFolderShared between [itemid: "+itemId +", rootFolderSharedId: "+rootFolderSharedId+"]");
if(itemId==null)
return false;
if(rootFolderSharedId==null)
return false;
if(itemId.compareTo(rootFolderSharedId)==0)
return true;
return false;
}
}

View File

@ -1,5 +1,5 @@
/**
*
*
*/
package org.gcube.portlets.user.workspace.server.resolver;
@ -29,12 +29,12 @@ import org.gcube.resources.discovery.client.queries.impl.XQuery;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jan 12, 2016
*/
public class UriResolverReaderParameterForResolverIndex {
public class UriResolverReaderParameterForResolverIndex {
protected static final String CONTENT_TYPE_PARAMETER = "contentType_parameter";
protected static final String FILE_NAME_PARAMETER = "fileName_parameter";
protected static final String SMP_ID_PARAMETER = "SMP_ID_parameter";
//Base Address
private String baseUri = "";
//Query URL parameter
@ -44,15 +44,15 @@ public class UriResolverReaderParameterForResolverIndex {
private String query = "";
private boolean isAvailable = false;
public static Logger logger = Logger.getLogger(UriResolverReaderParameterForResolverIndex.class);
/**
* The Enum RESOLVER_TYPE.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jan 12, 2016
*/
public static enum RESOLVER_TYPE {SMP_URI, SMP_ID};
public static enum RESOLVER_TYPE {SMP_URI, SMP_ID};
/**
* Instantiates a new uri resolver reader parameter for resolver index.
*
@ -61,43 +61,50 @@ public class UriResolverReaderParameterForResolverIndex {
* @throws Exception the exception
*/
public UriResolverReaderParameterForResolverIndex(String scope, RESOLVER_TYPE resolverType) throws Exception {
logger.trace("UriResolverReaderParameter is istancing with scope: "+scope);
ScopeUtilFilter scopeUtil = new ScopeUtilFilter(scope,true);
ScopeProvider.instance.set(scopeUtil.getScopeRoot());
XQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Name/text() eq 'HTTP-URI-Resolver'").setResult("$resource/Profile/AccessPoint");
DiscoveryClient<AccessPoint> client = clientFor(AccessPoint.class);
List<AccessPoint> endpoints = client.submit(query);
if (endpoints.size() == 0)
throw new Exception("No Resolver available");
//THE FIRST ACCESS POINT (endpoints.get(0)) IS SMP-URI, THE SECOND (endpoints.get(1)) IS SMP-ID
int useResolverIndex;
switch(resolverType){
case SMP_ID:
useResolverIndex = 1;
break;
case SMP_URI:
useResolverIndex = 0;
break;
default:
useResolverIndex = 1;
try{
logger.trace("UriResolverReaderParameter is istancing with scope: "+scope);
ScopeUtilFilter scopeUtil = new ScopeUtilFilter(scope,true);
ScopeProvider.instance.set(scopeUtil.getScopeRoot());
XQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Name/text() eq 'HTTP-URI-Resolver'").setResult("$resource/Profile/AccessPoint");
DiscoveryClient<AccessPoint> client = clientFor(AccessPoint.class);
List<AccessPoint> endpoints = client.submit(query);
if (endpoints.size() == 0)
throw new Exception("No Resolver available");
//THE FIRST ACCESS POINT (endpoints.get(0)) IS SMP-URI, THE SECOND (endpoints.get(1)) IS SMP-ID
int useResolverIndex;
switch(resolverType){
case SMP_ID:
useResolverIndex = 1;
break;
case SMP_URI:
useResolverIndex = 0;
break;
default:
useResolverIndex = 1;
}
AccessPoint ap2 = endpoints.get(useResolverIndex);
baseUri = ap2!=null?endpoints.get(useResolverIndex).address():"";
if(ap2!=null){
storageIDParameter = ap2.propertyMap()!=null?ap2.propertyMap().get(SMP_ID_PARAMETER).value():"";
fileNameParameter = ap2.propertyMap()!=null?ap2.propertyMap().get(FILE_NAME_PARAMETER).value():"";
contentTypeParameter = ap2.propertyMap()!=null?ap2.propertyMap().get(CONTENT_TYPE_PARAMETER).value():"";
}
isAvailable = true;
}catch(Exception e){
}finally{
ScopeProvider.instance.reset();
}
AccessPoint ap2 = endpoints.get(useResolverIndex);
baseUri = ap2!=null?endpoints.get(useResolverIndex).address():"";
if(ap2!=null){
storageIDParameter = ap2.propertyMap()!=null?ap2.propertyMap().get(SMP_ID_PARAMETER).value():"";
fileNameParameter = ap2.propertyMap()!=null?ap2.propertyMap().get(FILE_NAME_PARAMETER).value():"";
contentTypeParameter = ap2.propertyMap()!=null?ap2.propertyMap().get(CONTENT_TYPE_PARAMETER).value():"";
}
isAvailable = true;
}
/**
* Resolve - open stream with http get method.
*
@ -111,16 +118,16 @@ public class UriResolverReaderParameterForResolverIndex {
String query = resolveAsUriRequest(smp, fileName, contentType, true);
URL url = new URL(query);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("charset", "utf-8");
connection.connect();
return connection.getInputStream();
}
/**
* Resolve as uri request.
@ -134,16 +141,16 @@ public class UriResolverReaderParameterForResolverIndex {
* @throws Exception the exception
*/
public String resolveAsUriRequest(String storageID, String fileName, String contentType, boolean encodeParams) throws Exception{
if(storageID==null || storageID.isEmpty())
throw new Exception("storage ID is null or empty");
if(!encodeParams){ //ENCODE URI
query = storageIDParameter+"="+storageID;
if(fileName!=null && !fileName.isEmpty())
query+="&"+fileNameParameter+"="+fileName;
if(contentType!=null && !contentType.isEmpty())
query+="&"+contentTypeParameter+"="+contentType;
}
@ -155,8 +162,8 @@ public class UriResolverReaderParameterForResolverIndex {
logger.trace("resolve url request: "+uriRequest);
return uriRequest;
}
/**
* Resolve as storage id request.
@ -167,7 +174,7 @@ public class UriResolverReaderParameterForResolverIndex {
* @throws Exception the exception
*/
public String resolveAsStorageIdRequest(String storageID, boolean encodeParams) throws Exception{
if(storageID==null || storageID.isEmpty())
throw new Exception("storage ID is null or empty");
@ -175,10 +182,10 @@ public class UriResolverReaderParameterForResolverIndex {
query = storageID;
else
query = UrlEncoderUtil.encodeQueryValue(storageID);
if(baseUri.endsWith("/id"))
baseUri = baseUri.substring(0, baseUri.length()-3);
String uriRequest = baseUri+"/"+query;
logger.trace("resolve storageID request: "+uriRequest);
return uriRequest;
@ -195,24 +202,24 @@ public class UriResolverReaderParameterForResolverIndex {
* @throws Exception the exception
*/
public Map<String, String> getHashParameters(String storageID, String fileName, String contentType) throws Exception{
Map<String, String> hashParameters = new HashMap<String, String>();
if(storageID==null || storageID.isEmpty())
throw new Exception("smp url is null or empty");
hashParameters.put(storageIDParameter, storageID);
if(fileName!=null && !fileName.isEmpty())
hashParameters.put(fileNameParameter, fileName);
if(contentType!=null && !contentType.isEmpty())
hashParameters.put(contentTypeParameter, contentType);
hashParameters.put(contentTypeParameter, contentType);
return hashParameters;
}
/**
* Checks if is available.
*
@ -230,7 +237,7 @@ public class UriResolverReaderParameterForResolverIndex {
public String getBaseUri() {
return baseUri;
}
/**
* Gets the storage id parameter.
*
@ -257,7 +264,7 @@ public class UriResolverReaderParameterForResolverIndex {
public String getContentTypeParameter() {
return contentTypeParameter;
}
/**
* Gets the query.
*
@ -267,7 +274,7 @@ public class UriResolverReaderParameterForResolverIndex {
return query;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/

View File

@ -115,6 +115,8 @@ public final class UrlShortener {
isAvailable = false;
logger.error("an error occurred in reading RR: ", e);
throw new Exception(NO_HTTP_URL_SHORTENER_AVAILABLE);
}finally{
ScopeProvider.instance.reset();
}
}

View File

@ -161,7 +161,6 @@ public class WsUtil {
public static Workspace getWorkspace(final HttpSession httpSession) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException
{
logger.trace("Get Workspace");
final ASLSession session = getAslSession(httpSession);
logger.trace("ASLSession scope: "+session.getScope() + " username: "+session.getUsername());
@ -170,82 +169,11 @@ public class WsUtil {
logger.trace("Scope provider instancied");
Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername());
/*
if (session.getAttribute(METADATACONVERTER_ATTRIBUTE) == null){
logger.trace("Initializing the Metadata converter");
Thread mcLoader = new Thread(new Runnable(){
public void run() {
try {
MetadataConverter mc = new MetadataConverter(logger);
mc.setup(session);
session.setAttribute(METADATACONVERTER_ATTRIBUTE, mc);
}catch (Exception e) {
logger.error("Error initializing the Metadata Converter: "+e.getMessage());
}
}
});
mcLoader.start();
}
if (session.getAttribute(WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE) == null){
logger.trace("Initializing the event collector");
//we prepare the event collector
WorkspaceEventCollector eventCollector = new WorkspaceEventCollector();
workspace.addWorkspaceListener(eventCollector);
session.setAttribute(WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE, eventCollector);
}
*/
/*
if (session.getAttribute(WORKSPACEBUILDER_ATTRIBUTE) == null)
{
logger.trace("Initializing the workspace area builder");
GWTWorkspaceBuilder builder = new GWTWorkspaceBuilder();
//ADDED 03/09/2013
builder.setUserLogged(new InfoContactModel(session.getUsername(), session.getUsername(), session.getUserFullName(), false));
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
}*/
return workspace;
}
// public static MetadataConverter getMetadataConverter(Logger logger, HttpSession httpSession)
// {
// MetadataConverter mc = (MetadataConverter) httpSession.getAttribute(METADATACONVERTER_ATTRIBUTE);
//
// if (mc==null)
// {
//
// mc = new MetadataConverter(logger);
// ASLSession session = getAslSession(httpSession);
// mc.setup(session);
// session.setAttribute(METADATACONVERTER_ATTRIBUTE, mc);
// }
//
// mc.isReady();
//
// return mc;
// }
// public static WorkspaceEventCollector getEventCollector(HttpSession httpSession)
// {
// ASLSession session = getAslSession(httpSession);
// return (WorkspaceEventCollector) session.getAttribute(WsUtil.WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE);
// }
public static GWTWorkspaceBuilder getGWTWorkspaceBuilder(HttpSession httpSession)
{
ASLSession session = getAslSession(httpSession);

View File

@ -0,0 +1,35 @@
/**
*
*/
package org.gcube.portlets.user.workspace;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 9, 2016
*/
public class DataMinerTest {
public static void main(String[] args) {
String myToken = "4620e6d0-2313-4f48-9d54-eb3efd01a810";
try {
URL url = new URL("http://dataminer1-d-d4s.d4science.org/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token="+myToken+"&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.BIOCLIMATE_HCAF&DataInputs=HCAF_Table_List=http://goo.gl/LTqufC|http://goo.gl/LTqufC;HCAF_Table_Names=h1|h2");
url.openConnection();
}
catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}