updated pom version at 6.19.0
starting integration with new ws-thredds engine [Task #11127] removed previous ws-thredss classes/dependecies git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@164628 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d79efe03c3
commit
bc1e67e430
|
@ -1,7 +1,12 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-20-0"
|
||||||
|
date="2018-03-01">
|
||||||
|
<Change>[Task #11127] Porting to new ws-thredds engine</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-19-0"
|
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-19-0"
|
||||||
date="2019-01-09">
|
date="2018-01-09">
|
||||||
<Change>Issue #10831, Workspace download folder tomcat temp occupation issue</Change>
|
<Change>Issue #10831, Workspace download folder tomcat temp occupation
|
||||||
|
issue</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-18-0"
|
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-18-0"
|
||||||
date="2017-09-29">
|
date="2017-09-29">
|
||||||
|
@ -10,7 +15,8 @@
|
||||||
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-2"
|
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-2"
|
||||||
date="2017-09-13">
|
date="2017-09-13">
|
||||||
<Change>Incident #9676: fixed. Removed check on get sub-folder public
|
<Change>Incident #9676: fixed. Removed check on get sub-folder public
|
||||||
link when operation is performed by an administrator</Change>
|
link when operation is performed by an administrator
|
||||||
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-1"
|
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-1"
|
||||||
date="2017-07-10">
|
date="2017-07-10">
|
||||||
|
|
15
pom.xml
15
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>workspace-tree-widget</artifactId>
|
<artifactId>workspace-tree-widget</artifactId>
|
||||||
<version>6.19.0-SNAPSHOT</version>
|
<version>6.20.0-SNAPSHOT</version>
|
||||||
<name>gCube Workspace Tree Widget</name>
|
<name>gCube Workspace Tree Widget</name>
|
||||||
<description>
|
<description>
|
||||||
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
|
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<!-- GWT needs at least java 1.6 -->
|
<!-- GWT needs at least java 1.6 -->
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<!-- <additionalparam>-Xdoclint:none</additionalparam> -->
|
<!-- <additionalparam>-Xdoclint:none</additionalparam> -->
|
||||||
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
@ -115,9 +115,16 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- <dependency> -->
|
||||||
|
<!-- <groupId>org.gcube.spatial-data</groupId> -->
|
||||||
|
<!-- <artifactId>ws-thredds</artifactId> -->
|
||||||
|
<!-- <version>[0.0.1-SNAPSHOT, 1.0.0-SNAPSHOT)</version> -->
|
||||||
|
<!-- <scope>compile</scope> -->
|
||||||
|
<!-- </dependency> -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.spatial-data</groupId>
|
<groupId>org.gcube.portlets.widgtes</groupId>
|
||||||
<artifactId>ws-thredds</artifactId>
|
<artifactId>ws-thredds-sync-widget</artifactId>
|
||||||
<version>[0.0.1-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
|
<version>[0.0.1-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
|
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
|
||||||
|
|
||||||
|
<inherits name='org.gcube.portlets.widgtes.wsthreddssync.WsThreddsWidget' />
|
||||||
|
|
||||||
<!-- Specify the application specific style sheet. -->
|
<!-- Specify the application specific style sheet. -->
|
||||||
<stylesheet src='workspacetree.css' />
|
<stylesheet src='workspacetree.css' />
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,6 @@ import org.gcube.portlets.user.workspace.client.event.PasteItemEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PasteItemEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.PasteItemEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PublishOnDataCatalogueEvent;
|
import org.gcube.portlets.user.workspace.client.event.PublishOnDataCatalogueEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PublishOnDataCatalogueEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.PublishOnDataCatalogueEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PublishOnThreddsCatalogueEvent;
|
|
||||||
import org.gcube.portlets.user.workspace.client.event.PublishOnThreddsCatalogueEventHandler;
|
|
||||||
import org.gcube.portlets.user.workspace.client.event.RefreshFolderEvent;
|
import org.gcube.portlets.user.workspace.client.event.RefreshFolderEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.RefreshItemEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.RefreshItemEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
|
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
|
||||||
|
@ -83,6 +81,8 @@ import org.gcube.portlets.user.workspace.client.event.SubTreeLoadedEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SubTreeLoadedEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.SubTreeLoadedEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SwitchViewEvent;
|
import org.gcube.portlets.user.workspace.client.event.SwitchViewEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SwitchViewEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.SwitchViewEventHandler;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.SyncWithThreddsCatalogueEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.SyncWithThreddsCatalogueEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.TrashEvent;
|
import org.gcube.portlets.user.workspace.client.event.TrashEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.TrashEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.TrashEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.UnShareFolderEvent;
|
import org.gcube.portlets.user.workspace.client.event.UnShareFolderEvent;
|
||||||
|
@ -123,7 +123,6 @@ import org.gcube.portlets.user.workspace.client.view.windows.DialogAddUrl;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfo;
|
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfo;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink;
|
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink.Link_Type;
|
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink.Link_Type;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogPublishOnThredds;
|
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogShareLink;
|
import org.gcube.portlets.user.workspace.client.view.windows.DialogShareLink;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogText;
|
import org.gcube.portlets.user.workspace.client.view.windows.DialogText;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogWebDavUrl;
|
import org.gcube.portlets.user.workspace.client.view.windows.DialogWebDavUrl;
|
||||||
|
@ -271,15 +270,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(PublishOnThreddsCatalogueEvent.TYPE, new PublishOnThreddsCatalogueEventHandler() {
|
eventBus.addHandler(SyncWithThreddsCatalogueEvent.TYPE, new SyncWithThreddsCatalogueEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPublish(PublishOnThreddsCatalogueEvent publishEvent) {
|
public void onSync(SyncWithThreddsCatalogueEvent publishEvent) {
|
||||||
|
|
||||||
final FileModel folder = publishEvent.getFolderToPublish();
|
final FileModel folder = publishEvent.getFolderToPublish();
|
||||||
|
|
||||||
if(folder!=null){
|
if(folder!=null){
|
||||||
DialogPublishOnThredds publishOnThredds = new DialogPublishOnThredds(folder);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ConstantsExplorer {
|
||||||
public static final String MESSAGE_ADD_FOLDER = "New Folder";
|
public static final String MESSAGE_ADD_FOLDER = "New Folder";
|
||||||
public static final String MESSAGE_ADD_SHARED_FOLDER = "New Shared Folder";
|
public static final String MESSAGE_ADD_SHARED_FOLDER = "New Shared Folder";
|
||||||
public static final String MESSAGE_DATA_CATALOGUE_PUBLISH = "Publish on Catalogue";
|
public static final String MESSAGE_DATA_CATALOGUE_PUBLISH = "Publish on Catalogue";
|
||||||
public static final String MESSAGE_THREDDS_PUBLISH = "Publish on Thredds";
|
public static final String MESSAGE_THREDDS_PUBLISH = "Sync with Thredds";
|
||||||
public static final String MESSAGE_ADD = "Add";
|
public static final String MESSAGE_ADD = "Add";
|
||||||
public static final String MESSAGE_ADD_FOLDER_IN = "Create a new folder in: ";
|
public static final String MESSAGE_ADD_FOLDER_IN = "Create a new folder in: ";
|
||||||
public static final String MESSAGE_ITEM_NAME = "Item Name";
|
public static final String MESSAGE_ITEM_NAME = "Item Name";
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
package org.gcube.portlets.user.workspace.client.event;
|
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Interface PublishOnThreddsCatalogueEventHandler.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
||||||
* Sep 27, 2017
|
|
||||||
*/
|
|
||||||
public interface PublishOnThreddsCatalogueEventHandler extends EventHandler {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On publish.
|
|
||||||
*
|
|
||||||
* @param loadSelecteReleaseEvent the load selecte release event
|
|
||||||
*/
|
|
||||||
void onPublish(PublishOnThreddsCatalogueEvent loadSelecteReleaseEvent);
|
|
||||||
}
|
|
|
@ -5,29 +5,32 @@ import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class PublishOnThreddsCatalogueEvent.
|
* The Class SyncWithThreddsCatalogueEvent.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Sep 27, 2017
|
* Mar 1, 2018
|
||||||
*/
|
*/
|
||||||
public class PublishOnThreddsCatalogueEvent extends GwtEvent<PublishOnThreddsCatalogueEventHandler> {
|
public class SyncWithThreddsCatalogueEvent extends GwtEvent<SyncWithThreddsCatalogueEventHandler> {
|
||||||
public static Type<PublishOnThreddsCatalogueEventHandler> TYPE = new Type<PublishOnThreddsCatalogueEventHandler>();
|
public static Type<SyncWithThreddsCatalogueEventHandler> TYPE = new Type<SyncWithThreddsCatalogueEventHandler>();
|
||||||
|
|
||||||
private FileModel folderToPublish;
|
private FileModel folderToPublish;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new publish on thredds catalogue event.
|
* Instantiates a new sync with thredds catalogue event.
|
||||||
*
|
*
|
||||||
* @param folderToPublish the folder to publish
|
* @param folderToPublish the folder to publish
|
||||||
*/
|
*/
|
||||||
public PublishOnThreddsCatalogueEvent(FileModel folderToPublish) {
|
public SyncWithThreddsCatalogueEvent(FileModel folderToPublish) {
|
||||||
this.folderToPublish = folderToPublish;
|
this.folderToPublish = folderToPublish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the folder to publish.
|
||||||
|
*
|
||||||
* @return the folderToPublish
|
* @return the folderToPublish
|
||||||
*/
|
*/
|
||||||
public FileModel getFolderToPublish() {
|
public FileModel getFolderToPublish() {
|
||||||
|
@ -40,7 +43,7 @@ public class PublishOnThreddsCatalogueEvent extends GwtEvent<PublishOnThreddsCat
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Type<PublishOnThreddsCatalogueEventHandler> getAssociatedType() {
|
public Type<SyncWithThreddsCatalogueEventHandler> getAssociatedType() {
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +51,8 @@ public class PublishOnThreddsCatalogueEvent extends GwtEvent<PublishOnThreddsCat
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void dispatch(PublishOnThreddsCatalogueEventHandler handler) {
|
protected void dispatch(SyncWithThreddsCatalogueEventHandler handler) {
|
||||||
handler.onPublish(this);
|
handler.onSync(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.workspace.client.event;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
|
/**
|
||||||
|
* The Interface SyncWithThreddsCatalogueEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Mar 1, 2018
|
||||||
|
*/
|
||||||
|
public interface SyncWithThreddsCatalogueEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On sync.
|
||||||
|
*
|
||||||
|
* @param synWithThreddsEvent the syn with thredds event
|
||||||
|
*/
|
||||||
|
void onSync(SyncWithThreddsCatalogueEvent synWithThreddsEvent);
|
||||||
|
}
|
|
@ -24,8 +24,6 @@ import org.gcube.portlets.user.workspace.shared.GarbageItem;
|
||||||
import org.gcube.portlets.user.workspace.shared.PublicLink;
|
import org.gcube.portlets.user.workspace.shared.PublicLink;
|
||||||
import org.gcube.portlets.user.workspace.shared.ReportAssignmentACL;
|
import org.gcube.portlets.user.workspace.shared.ReportAssignmentACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferOnThreddsReport;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferToThreddsProperty;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.UserBean;
|
import org.gcube.portlets.user.workspace.shared.UserBean;
|
||||||
|
@ -791,35 +789,4 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
List<GcubeVRE> getListOfVREsForLoggedUser()
|
List<GcubeVRE> getListOfVREsForLoggedUser()
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* Publish on thredds catalogue.
|
|
||||||
*
|
|
||||||
* @param folderToPublishId the folder to publish id
|
|
||||||
* @param folderMetadataId the folder metadata id
|
|
||||||
* @param vreName the vre name
|
|
||||||
* @param vreScope the vre scope
|
|
||||||
* @param catalogueName the catalogue name
|
|
||||||
* @return the transfer on thredds report
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
TransferOnThreddsReport publishOnThreddsCatalogue(
|
|
||||||
String folderToPublishId, String folderMetadataId, String vreName, String vreScope,
|
|
||||||
String catalogueName)
|
|
||||||
throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the status of publishing on thredds catalogue.
|
|
||||||
*
|
|
||||||
* @param transferId the transfer id
|
|
||||||
* @return the status of publishing on thredds catalogue
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
TransferOnThreddsReport getStatusOfPublishingOnThreddsCatalogue(String transferId)
|
|
||||||
throws Exception;
|
|
||||||
/**
|
|
||||||
* @param folderId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
TransferToThreddsProperty getTransferToThreddsProperty(String folderId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@ import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.GarbageItem;
|
import org.gcube.portlets.user.workspace.shared.GarbageItem;
|
||||||
import org.gcube.portlets.user.workspace.shared.PublicLink;
|
import org.gcube.portlets.user.workspace.shared.PublicLink;
|
||||||
import org.gcube.portlets.user.workspace.shared.ReportAssignmentACL;
|
import org.gcube.portlets.user.workspace.shared.ReportAssignmentACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferOnThreddsReport;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferToThreddsProperty;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.UserBean;
|
import org.gcube.portlets.user.workspace.shared.UserBean;
|
||||||
|
@ -786,34 +784,4 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
* @return the list of vr es for logged user
|
* @return the list of vr es for logged user
|
||||||
*/
|
*/
|
||||||
void getListOfVREsForLoggedUser(AsyncCallback<List<GcubeVRE>> callback);
|
void getListOfVREsForLoggedUser(AsyncCallback<List<GcubeVRE>> callback);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Publish on thredds catalogue.
|
|
||||||
*
|
|
||||||
* @param folderToPublishId the folder to publish id
|
|
||||||
* @param folderMetadataId the folder metadata id
|
|
||||||
* @param vreName the vre name
|
|
||||||
* @param vreScope the vre scope
|
|
||||||
* @param catalogueName the catalogue name
|
|
||||||
* @param callback the callback
|
|
||||||
*/
|
|
||||||
void publishOnThreddsCatalogue(
|
|
||||||
String folderToPublishId, String folderMetadataId, String vreName, String vreScope,
|
|
||||||
String catalogueName, AsyncCallback<TransferOnThreddsReport> callback);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the status of publishing on thredds catalogue.
|
|
||||||
*
|
|
||||||
* @param transferId the transfer id
|
|
||||||
* @param callback the callback
|
|
||||||
* @return the status of publishing on thredds catalogue
|
|
||||||
*/
|
|
||||||
void getStatusOfPublishingOnThreddsCatalogue(
|
|
||||||
String transferId, AsyncCallback<TransferOnThreddsReport> callback);
|
|
||||||
|
|
||||||
void getTransferToThreddsProperty(
|
|
||||||
String folderId, AsyncCallback<TransferToThreddsProperty> callback);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,11 @@ import org.realityforge.gwt.websockets.client.WebSocketListener;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.Icon;
|
import com.github.gwtbootstrap.client.ui.Icon;
|
||||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.http.client.RequestBuilder;
|
|
||||||
import com.google.gwt.typedarrays.shared.ArrayBuffer;
|
import com.google.gwt.typedarrays.shared.ArrayBuffer;
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
|
|
|
@ -27,10 +27,10 @@ import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.OpenUrlEvent;
|
import org.gcube.portlets.user.workspace.client.event.OpenUrlEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PasteItemEvent;
|
import org.gcube.portlets.user.workspace.client.event.PasteItemEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PublishOnDataCatalogueEvent;
|
import org.gcube.portlets.user.workspace.client.event.PublishOnDataCatalogueEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PublishOnThreddsCatalogueEvent;
|
|
||||||
import org.gcube.portlets.user.workspace.client.event.RefreshFolderEvent;
|
import org.gcube.portlets.user.workspace.client.event.RefreshFolderEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
|
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SendMessageEvent;
|
import org.gcube.portlets.user.workspace.client.event.SendMessageEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.SyncWithThreddsCatalogueEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.UnShareFolderEvent;
|
import org.gcube.portlets.user.workspace.client.event.UnShareFolderEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.VRESettingPermissionEvent;
|
import org.gcube.portlets.user.workspace.client.event.VRESettingPermissionEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.VersioningHistoryShowEvent;
|
import org.gcube.portlets.user.workspace.client.event.VersioningHistoryShowEvent;
|
||||||
|
@ -384,7 +384,7 @@ public class ContextMenuTree {
|
||||||
|
|
||||||
FileModel sourceFileModel = listSelectedItems.get(0);
|
FileModel sourceFileModel = listSelectedItems.get(0);
|
||||||
if (sourceFileModel != null) {
|
if (sourceFileModel != null) {
|
||||||
eventBus.fireEvent(new PublishOnThreddsCatalogueEvent(sourceFileModel));
|
eventBus.fireEvent(new SyncWithThreddsCatalogueEvent(sourceFileModel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,428 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.workspace.client.view.windows;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
|
||||||
import org.gcube.portlets.user.workspace.client.event.RefreshFolderEvent;
|
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
|
||||||
import org.gcube.portlets.user.workspace.client.model.GcubeVRE;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferOnThreddsReport;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferToThreddsProperty;
|
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
|
|
||||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
|
||||||
import com.extjs.gxt.ui.client.core.XDOM;
|
|
||||||
import com.extjs.gxt.ui.client.event.BaseEvent;
|
|
||||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
|
||||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
|
||||||
import com.extjs.gxt.ui.client.event.Events;
|
|
||||||
import com.extjs.gxt.ui.client.event.KeyListener;
|
|
||||||
import com.extjs.gxt.ui.client.event.KeyboardEvents;
|
|
||||||
import com.extjs.gxt.ui.client.event.Listener;
|
|
||||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
|
||||||
import com.extjs.gxt.ui.client.store.ListStore;
|
|
||||||
import com.extjs.gxt.ui.client.util.Format;
|
|
||||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
|
||||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
|
||||||
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
|
||||||
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
|
||||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
|
||||||
import com.extjs.gxt.ui.client.widget.form.TriggerField;
|
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
|
||||||
import com.github.gwtbootstrap.client.ui.Label;
|
|
||||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.user.client.Timer;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class DialogPublishOnThredds.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
||||||
* Sep 27, 2017
|
|
||||||
*/
|
|
||||||
public class DialogPublishOnThredds extends Dialog {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private int widthDialog = 570;
|
|
||||||
private TextField<String> txtCatalogueName;
|
|
||||||
private TriggerField<String> triggerFieldMetadataFolderName;
|
|
||||||
private ComboBox<GcubeVRE> selectVRE;
|
|
||||||
//private Button browse = new Button("Browse...");
|
|
||||||
private FileModel metadataFolder = null;
|
|
||||||
private FileModel theFolderToPublish;
|
|
||||||
private ListStore<GcubeVRE> vreStore = new ListStore<GcubeVRE>();
|
|
||||||
|
|
||||||
public static List<GcubeVRE> listOfVres = null;
|
|
||||||
private Label infoOnLoading = new Label("");
|
|
||||||
|
|
||||||
private DialogPublishOnThredds INSTANCE = this;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new dialog publish on thredds.
|
|
||||||
*
|
|
||||||
* @param theFolderToPublish the the folder to publish
|
|
||||||
*/
|
|
||||||
public DialogPublishOnThredds(FileModel theFolderToPublish) {
|
|
||||||
|
|
||||||
this.theFolderToPublish = theFolderToPublish;
|
|
||||||
infoOnLoading.setType(LabelType.INFO);
|
|
||||||
infoOnLoading.setVisible(true);
|
|
||||||
infoOnLoading.setText("Loading Configurations...");
|
|
||||||
initLayout();
|
|
||||||
INSTANCE.enablePublish(false);
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getTransferToThreddsProperty(theFolderToPublish.getIdentifier(), new AsyncCallback<TransferToThreddsProperty>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
GWT.log("Error on loading TransferToThreddsProperty: "+caught.getMessage());
|
|
||||||
infoOnLoading.setVisible(false);
|
|
||||||
//initiFormFields();
|
|
||||||
INSTANCE.enablePublish(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(TransferToThreddsProperty result) {
|
|
||||||
GWT.log("Loaded TransferToThreddsProperty: "+result);
|
|
||||||
//initiFormFields();
|
|
||||||
|
|
||||||
if(result!=null){
|
|
||||||
txtCatalogueName.setValue(result.getCatalogueName());
|
|
||||||
|
|
||||||
for (GcubeVRE gvre : vreStore.getModels()) {
|
|
||||||
if(gvre.getScope().compareTo(result.getVreScope())==0){
|
|
||||||
selectVRE.setValue(gvre);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(result.getMetadataFolderId()!=null && result.getMetadataFolderName()!=null){
|
|
||||||
|
|
||||||
metadataFolder = new FileModel(result.getMetadataFolderId(), result.getMetadataFolderName(), true);
|
|
||||||
triggerFieldMetadataFolderName.setValue(metadataFolder.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
infoOnLoading.setVisible(false);
|
|
||||||
INSTANCE.enablePublish(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load vres for logged user.
|
|
||||||
*/
|
|
||||||
private void loadVresForLoggedUser() {
|
|
||||||
|
|
||||||
selectVRE.mask();
|
|
||||||
selectVRE.setLoadingText("Loading VREs...");
|
|
||||||
getButtonById(Dialog.OK).setEnabled(false);
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getListOfVREsForLoggedUser(new AsyncCallback<List<GcubeVRE>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<GcubeVRE> result) {
|
|
||||||
|
|
||||||
listOfVres = result;
|
|
||||||
setStoreToSelectVre();
|
|
||||||
getButtonById(Dialog.OK).setEnabled(true);
|
|
||||||
selectVRE.unmask();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
|
|
||||||
GWT.log("Error on getting VREs");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the store to select vre.
|
|
||||||
*/
|
|
||||||
private void setStoreToSelectVre() {
|
|
||||||
vreStore.removeAll();
|
|
||||||
vreStore.add(listOfVres);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new dialog add folder and smart.
|
|
||||||
*/
|
|
||||||
private void initLayout() {
|
|
||||||
|
|
||||||
FormLayout layout = new FormLayout();
|
|
||||||
layout.setLabelWidth(140);
|
|
||||||
layout.setDefaultWidth(380);
|
|
||||||
setLayout(layout);
|
|
||||||
setButtonAlign(HorizontalAlignment.CENTER);
|
|
||||||
// setHideOnButtonClick(true);
|
|
||||||
// setIcon(IconHelper.createStyle("user"));
|
|
||||||
setHeading("Publish "+Format.ellipse(theFolderToPublish.getName(), 20)+" on Thredds...");
|
|
||||||
setModal(true);
|
|
||||||
// setBodyBorder(true);
|
|
||||||
setBodyStyle("padding: 9px; background: none");
|
|
||||||
setWidth(widthDialog);
|
|
||||||
setResizable(false);
|
|
||||||
setButtons(Dialog.OKCANCEL);
|
|
||||||
|
|
||||||
this.getButtonById(Dialog.OK).setText("Publish");
|
|
||||||
this.getButtonById(Dialog.CANCEL).setText("Close");
|
|
||||||
// this.getButtonById(Dialog.CANCEL).setText("Reset");
|
|
||||||
|
|
||||||
txtCatalogueName = new TextField<String>();
|
|
||||||
txtCatalogueName.setEmptyText("Type a Name...");
|
|
||||||
txtCatalogueName.setAllowBlank(false);
|
|
||||||
txtCatalogueName.setAutoValidate(true);
|
|
||||||
txtCatalogueName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
|
|
||||||
txtCatalogueName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
|
|
||||||
txtCatalogueName.setFieldLabel("Catalogue Name *");
|
|
||||||
|
|
||||||
|
|
||||||
triggerFieldMetadataFolderName = new TriggerField<String>();
|
|
||||||
triggerFieldMetadataFolderName.setAllowBlank(true);
|
|
||||||
triggerFieldMetadataFolderName.setReadOnly(true);
|
|
||||||
triggerFieldMetadataFolderName.setAutoValidate(true);
|
|
||||||
triggerFieldMetadataFolderName.setFieldLabel("Metadata Folder");
|
|
||||||
triggerFieldMetadataFolderName.setEmptyText("Browse a Metadata Folder...");
|
|
||||||
triggerFieldMetadataFolderName.addListener(Events.OnClick, new Listener<BaseEvent>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleEvent(BaseEvent be) {
|
|
||||||
showWsExplorer();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
selectVRE = new ComboBox<GcubeVRE>();
|
|
||||||
selectVRE.setEmptyText("Select a VRE...");
|
|
||||||
selectVRE.setFieldLabel("Publish in the VRE *");
|
|
||||||
selectVRE.setDisplayField("name");
|
|
||||||
selectVRE.setStore(vreStore);
|
|
||||||
// selectVRE.setAllowBlank(false);
|
|
||||||
// selectVRE.setAutoValidate(true);
|
|
||||||
if(listOfVres==null || listOfVres.isEmpty())
|
|
||||||
loadVresForLoggedUser();
|
|
||||||
else
|
|
||||||
setStoreToSelectVre();
|
|
||||||
//selectVRE.setStore(scopeNameModels);
|
|
||||||
selectVRE.setTypeAhead(true);
|
|
||||||
selectVRE.setEditable(false);
|
|
||||||
selectVRE.setTriggerAction(TriggerAction.ALL);
|
|
||||||
|
|
||||||
txtCatalogueName.addKeyListener(new KeyListener() { // KEY ENTER
|
|
||||||
|
|
||||||
public void componentKeyPress(ComponentEvent event) {
|
|
||||||
|
|
||||||
if (event.getKeyCode() == KeyboardEvents.Enter.getEventCode())
|
|
||||||
getButtonById(Dialog.OK).fireEvent(Events.Select);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.getButtonById(Dialog.CANCEL).addSelectionListener(
|
|
||||||
new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void componentSelected(ButtonEvent ce) {
|
|
||||||
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.getButtonById(Dialog.OK).addSelectionListener(
|
|
||||||
new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void componentSelected(ButtonEvent ce) {
|
|
||||||
|
|
||||||
if (isValidForm()){
|
|
||||||
hide();
|
|
||||||
|
|
||||||
GWT.log("metadataFolder: "+metadataFolder);
|
|
||||||
|
|
||||||
String metadataFolderId = metadataFolder!=null?metadataFolder.getIdentifier():null;
|
|
||||||
|
|
||||||
GcubeVRE vre = selectVRE.getSelection().get(0);
|
|
||||||
GWT.log("metadataFolderId: "+metadataFolderId);
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.publishOnThreddsCatalogue(theFolderToPublish.getIdentifier(), metadataFolderId, vre.getName(), vre.getScope(), txtCatalogueName.getValue(), new AsyncCallback<TransferOnThreddsReport>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
|
|
||||||
new MessageBoxAlert("Error", caught.getMessage(), null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(TransferOnThreddsReport result) {
|
|
||||||
GWT.log("Publishing on Thredds return: "+result);
|
|
||||||
InfoDisplay.display("On going", "Transferring started correclty...");
|
|
||||||
if(result!=null){
|
|
||||||
pollingStart(result);
|
|
||||||
}else
|
|
||||||
new MessageBoxAlert("Error", "An error occurred during the transferring. Refresh the folder and try again", null);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
setFocusWidget(txtCatalogueName);
|
|
||||||
add(infoOnLoading);
|
|
||||||
add(txtCatalogueName);
|
|
||||||
add(selectVRE);
|
|
||||||
//add(browse);
|
|
||||||
add(triggerFieldMetadataFolderName);
|
|
||||||
Label mandatory = new Label("* mandatory");
|
|
||||||
mandatory.setType(LabelType.INFO);
|
|
||||||
//mandatory.getElement().getStyle().set("#FF0000");
|
|
||||||
add(mandatory);
|
|
||||||
this.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable publish.
|
|
||||||
*
|
|
||||||
* @param enable the enable
|
|
||||||
*/
|
|
||||||
private void enablePublish(boolean enable){
|
|
||||||
this.getButtonById(Dialog.OK).setEnabled(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show result.
|
|
||||||
*
|
|
||||||
* @param result the result
|
|
||||||
*/
|
|
||||||
public void showResult(TransferOnThreddsReport result){
|
|
||||||
|
|
||||||
|
|
||||||
if(result.isOnError()){
|
|
||||||
MessageBox.alert("Error", result.getReportMessage(), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(result.isTransferringReportAvailable()){
|
|
||||||
InfoDisplay.display("Transferring completed", "Refreshing folder content...");
|
|
||||||
FileModel folderTarget = new FileModel(result.getFolderId(), "", true);
|
|
||||||
AppControllerExplorer.getEventBus().fireEvent(new RefreshFolderEvent(folderTarget, false, false, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Polling start.
|
|
||||||
*
|
|
||||||
* @param result the result
|
|
||||||
*/
|
|
||||||
public void pollingStart(final TransferOnThreddsReport result){
|
|
||||||
|
|
||||||
showResult(result);
|
|
||||||
|
|
||||||
final Timer t = new Timer(){
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getStatusOfPublishingOnThreddsCatalogue(result.getTransferId(), new AsyncCallback<TransferOnThreddsReport>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
MessageBox.alert("Error", caught.getMessage(), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(TransferOnThreddsReport result) {
|
|
||||||
GWT.log("Get status of Publishing on Thredds return: "+result);
|
|
||||||
|
|
||||||
showResult(result);
|
|
||||||
if(result.isOnError() || result.isTransferringReportAvailable()){
|
|
||||||
GWT.log("Cancelling timer for Transferring: "+result);
|
|
||||||
cancelTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
public void cancelTimer(){
|
|
||||||
this.cancel();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
t.scheduleRepeating(2000);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is valid form.
|
|
||||||
*
|
|
||||||
* @return true, if is valid form
|
|
||||||
*/
|
|
||||||
public boolean isValidForm() {
|
|
||||||
|
|
||||||
if (txtCatalogueName.isValid() && txtCatalogueName.getValue() != null && selectVRE.getSelection().size()>0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// if(selectVRE.getSelection().size()==0)
|
|
||||||
// selectVRE.forceInvalid("Required");
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show ws explorer.
|
|
||||||
*/
|
|
||||||
public void showWsExplorer(){
|
|
||||||
|
|
||||||
final WorkspaceExplorerSelectDialog navigator = new WorkspaceExplorerSelectDialog("Select a folder...", true);
|
|
||||||
|
|
||||||
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSelectedItem(Item item) {
|
|
||||||
GWT.log("onSelectedItem: "+item);
|
|
||||||
navigator.hide();
|
|
||||||
triggerFieldMetadataFolderName.setValue(item.getName());
|
|
||||||
metadataFolder = new FileModel(item.getId(), item.getName(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Throwable throwable) {
|
|
||||||
GWT.log("onFailed..");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAborted() {
|
|
||||||
GWT.log("onAborted..");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNotValidSelection() {
|
|
||||||
GWT.log("onNotValidSelection..");
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
navigator.addWorkspaceExplorerSelectNotificationListener(listener);
|
|
||||||
navigator.setZIndex(XDOM.getTopZIndex()+50);
|
|
||||||
navigator.show();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -63,7 +63,6 @@ import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.WorkspaceHandledException;
|
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.WorkspaceHandledException;
|
||||||
import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
||||||
import org.gcube.portlets.user.workspace.server.notifications.NotificationsUtil;
|
import org.gcube.portlets.user.workspace.server.notifications.NotificationsUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.publish.PublishOnThredds;
|
|
||||||
import org.gcube.portlets.user.workspace.server.reader.ApplicationProfile;
|
import org.gcube.portlets.user.workspace.server.reader.ApplicationProfile;
|
||||||
import org.gcube.portlets.user.workspace.server.reader.ApplicationProfileReader;
|
import org.gcube.portlets.user.workspace.server.reader.ApplicationProfileReader;
|
||||||
import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameterForResolverIndex;
|
import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameterForResolverIndex;
|
||||||
|
@ -71,7 +70,6 @@ import org.gcube.portlets.user.workspace.server.util.AclTypeComparator;
|
||||||
import org.gcube.portlets.user.workspace.server.util.DifferenceBetweenInfoContactModel;
|
import org.gcube.portlets.user.workspace.server.util.DifferenceBetweenInfoContactModel;
|
||||||
import org.gcube.portlets.user.workspace.server.util.PortalContextInfo;
|
import org.gcube.portlets.user.workspace.server.util.PortalContextInfo;
|
||||||
import org.gcube.portlets.user.workspace.server.util.StringUtil;
|
import org.gcube.portlets.user.workspace.server.util.StringUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.util.TransferringToThreddsUtil;
|
|
||||||
import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader;
|
import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader;
|
||||||
|
@ -82,8 +80,6 @@ import org.gcube.portlets.user.workspace.shared.GarbageItem;
|
||||||
import org.gcube.portlets.user.workspace.shared.PublicLink;
|
import org.gcube.portlets.user.workspace.shared.PublicLink;
|
||||||
import org.gcube.portlets.user.workspace.shared.ReportAssignmentACL;
|
import org.gcube.portlets.user.workspace.shared.ReportAssignmentACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferOnThreddsReport;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferToThreddsProperty;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.UserBean;
|
import org.gcube.portlets.user.workspace.shared.UserBean;
|
||||||
|
@ -4236,64 +4232,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Publish on thredds catalogue.
|
|
||||||
*
|
|
||||||
* @param folderToPublishId the folder to publish id
|
|
||||||
* @param metadataFolderId the folder metadata id
|
|
||||||
* @param vreName the vre name
|
|
||||||
* @param vreTargetScope the vre scope
|
|
||||||
* @param catalogueName the catalogue name
|
|
||||||
* @return the transfer on thredds report
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public TransferOnThreddsReport publishOnThreddsCatalogue(final String folderToPublishId, final String metadataFolderId, final String vreName, final String vreTargetScope, final String catalogueName) throws Exception{
|
|
||||||
workspaceLogger.info("Publishing on thredds the folderId: "+folderToPublishId+", metadataFolderId: "+metadataFolderId +", vre target scope: "+vreTargetScope);
|
|
||||||
try{
|
|
||||||
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
|
||||||
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
|
|
||||||
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
|
|
||||||
String targetScopeUserToken = PortalContext.getConfiguration().getCurrentUserToken(vreTargetScope, user.getUsername());
|
|
||||||
PublishOnThredds pub = new PublishOnThredds(wsUserToken, user.getUsername(), this.getThreadLocalRequest().getSession());
|
|
||||||
TransferOnThreddsReport report = pub.publishFolder(folderToPublishId, metadataFolderId, targetScopeUserToken, catalogueName);
|
|
||||||
workspaceLogger.debug("Report created: "+report);
|
|
||||||
|
|
||||||
try{
|
|
||||||
//SAVING THREDDS TRANSFERING CONFIGURATIONS
|
|
||||||
String metadataFolderName = null;
|
|
||||||
if(metadataFolderId!=null){
|
|
||||||
Workspace ws = getWorkspace();
|
|
||||||
WorkspaceItem metadataFolder = ws.getItem(metadataFolderId);
|
|
||||||
metadataFolderName = metadataFolder.getName();
|
|
||||||
}
|
|
||||||
//System.out.println("metadataFolderName name: "+metadataFolderName);
|
|
||||||
String xmlProperties = TransferringToThreddsUtil.toXML(new TransferToThreddsProperty(folderToPublishId, catalogueName, vreName, vreTargetScope, metadataFolderId, metadataFolderName));
|
|
||||||
workspaceLogger.debug("Transfer to Thredds xmlProperties is:"+ xmlProperties);
|
|
||||||
Map<String, String> properties = getPropertiesForWorkspaceItemId(folderToPublishId);
|
|
||||||
|
|
||||||
if(properties!=null){
|
|
||||||
String key = TransferToThreddsProperty.class.getSimpleName();
|
|
||||||
properties.put(key, xmlProperties);
|
|
||||||
workspaceLogger.info("Adding gcube property ["+key+ ", "+xmlProperties +"] to itemId: "+folderToPublishId);
|
|
||||||
setPropertiesForWorkspaceItemId(folderToPublishId, properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch (Exception e) {
|
|
||||||
workspaceLogger.warn("Error adding the TransferToThreddsProperty to item: "+folderToPublishId, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return report;
|
|
||||||
|
|
||||||
}catch(Exception e){
|
|
||||||
workspaceLogger.error("Error occurred server-side when transfer to Thredds: ", e);
|
|
||||||
throw new Exception("Sorry, an error occurred server-side performing transfer to Thredds, try again later");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the properties for workspace item id.
|
* Gets the properties for workspace item id.
|
||||||
*
|
*
|
||||||
|
@ -4338,73 +4276,4 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the transfer to thredds property read from folderId.
|
|
||||||
*
|
|
||||||
* @param folderId the folder id
|
|
||||||
* @return the transfer to thredds property
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public TransferToThreddsProperty getTransferToThreddsProperty(String folderId){
|
|
||||||
workspaceLogger.debug("Performing getTransferToThreddsProperty for folderId: "+folderId);
|
|
||||||
try {
|
|
||||||
Map<String, String> properties = getPropertiesForWorkspaceItemId(folderId);
|
|
||||||
workspaceLogger.trace("Properties are: "+properties);
|
|
||||||
|
|
||||||
if(properties==null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
String theXMLThreddsProperty = properties.get(TransferToThreddsProperty.class.getSimpleName());
|
|
||||||
workspaceLogger.trace(TransferToThreddsProperty.class.getSimpleName() +" is: "+theXMLThreddsProperty);
|
|
||||||
if(theXMLThreddsProperty==null){
|
|
||||||
workspaceLogger.info("Transfer To Thredds properties does not exist for the folder id: "+folderId +", returning null");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
TransferToThreddsProperty theObject = TransferringToThreddsUtil.toObject(theXMLThreddsProperty);
|
|
||||||
|
|
||||||
if(theObject.getMetadataFolderId()!=null){
|
|
||||||
Workspace ws = getWorkspace();
|
|
||||||
String metadataFolderName = null;
|
|
||||||
try{
|
|
||||||
FolderItem metadataFolder = (FolderItem) ws.getItem(theObject.getMetadataFolderId());
|
|
||||||
metadataFolderName = metadataFolder.getName();
|
|
||||||
theObject.setMetadataFolderName(metadataFolderName);
|
|
||||||
}catch(Exception e){
|
|
||||||
workspaceLogger.warn("Error on getting metadata folder name for id: "+metadataFolderName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println("Returning: "+theObject);
|
|
||||||
workspaceLogger.debug("Returning: "+theObject);
|
|
||||||
return theObject;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
workspaceLogger.error("Error occurred server-side when gettomg TransferToThreddsProperty for folderId: "+folderId, e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the publishing on thredds catalogue.
|
|
||||||
*
|
|
||||||
* @param transferId the transfer id
|
|
||||||
* @return the publishing on thredds catalogue
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public TransferOnThreddsReport getStatusOfPublishingOnThreddsCatalogue(String transferId) throws Exception{
|
|
||||||
workspaceLogger.debug("Getting publishing on thredds for transfer id: "+transferId);
|
|
||||||
TransferOnThreddsReport tr = null;
|
|
||||||
try{
|
|
||||||
return PublishOnThredds.getStatusOfTransferId(this.getThreadLocalRequest().getSession(), transferId);
|
|
||||||
}catch(Exception e){
|
|
||||||
workspaceLogger.error("Error occurred server-side when getting the status of transferring on Thredds: ", e);
|
|
||||||
tr.setOnError(true);
|
|
||||||
WsUtil.setTransferPublishingOnThredds(this.getThreadLocalRequest().getSession(), tr);
|
|
||||||
throw new Exception("Sorry, an error occurred server-side getting the status of transferring on Thredds, try again later");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,199 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.workspace.server.publish;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
|
||||||
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
|
||||||
import org.gcube.common.homelibrary.home.exceptions.UserNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.InsufficientPrivilegesException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException;
|
|
||||||
import org.gcube.portlets.user.workspace.server.reader.ApplicationProfileReader;
|
|
||||||
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferOnThreddsReport;
|
|
||||||
import org.gcube.usecases.ws.thredds.FolderConfiguration;
|
|
||||||
import org.gcube.usecases.ws.thredds.PublishFolders;
|
|
||||||
import org.gcube.usecases.ws.thredds.TokenSetter;
|
|
||||||
import org.gcube.usecases.ws.thredds.engine.TransferRequestServer;
|
|
||||||
import org.gcube.usecases.ws.thredds.engine.TransferRequestServer.Report;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class PublishOnThredds.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
||||||
* Sep 27, 2017
|
|
||||||
*/
|
|
||||||
public class PublishOnThredds {
|
|
||||||
|
|
||||||
private HashSet<FolderConfiguration> configs;
|
|
||||||
private Logger logger = Logger.getLogger(ApplicationProfileReader.class);
|
|
||||||
private String username;
|
|
||||||
private HttpSession httpSession;
|
|
||||||
private String wsScopeUserToken;
|
|
||||||
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new publish on thredds.
|
|
||||||
*
|
|
||||||
* @param wsScopeUserToken the ws scope user token
|
|
||||||
* @param username the username
|
|
||||||
* @param httpSession the http session
|
|
||||||
*/
|
|
||||||
public PublishOnThredds(String wsScopeUserToken, String username, HttpSession httpSession) {
|
|
||||||
this.wsScopeUserToken = wsScopeUserToken;
|
|
||||||
this.configs = new HashSet<FolderConfiguration>();
|
|
||||||
this.username = username;
|
|
||||||
this.httpSession = httpSession;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Publish folder.
|
|
||||||
*
|
|
||||||
* @param folderId the folder id
|
|
||||||
* @param metadataFolderID the metadata folder id
|
|
||||||
* @param publishingTargetScopeUserToken the publishing user token
|
|
||||||
* @param catalogueName the catalogue name
|
|
||||||
* @return the transfer on thredds report
|
|
||||||
*/
|
|
||||||
public TransferOnThreddsReport publishFolder(final String folderId, final String metadataFolderID, final String publishingTargetScopeUserToken, final String catalogueName){
|
|
||||||
|
|
||||||
final String transferId = UUID.randomUUID().toString();
|
|
||||||
final TransferOnThreddsReport tr = new TransferOnThreddsReport(transferId, folderId, false, null);
|
|
||||||
|
|
||||||
new Thread(){
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Thread#run()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
WsUtil.setTransferPublishingOnThredds(httpSession, tr);
|
|
||||||
//System.out.println("Setting ws user token : "+wsScopeUserToken);
|
|
||||||
|
|
||||||
TokenSetter.setToken(wsScopeUserToken);
|
|
||||||
FolderConfiguration folderConfig=new FolderConfiguration(publishingTargetScopeUserToken,folderId,catalogueName);
|
|
||||||
folderConfig.setProvidedMetadata(false);
|
|
||||||
|
|
||||||
if(metadataFolderID!=null){
|
|
||||||
folderConfig.setProvidedMetadata(true);
|
|
||||||
folderConfig.setMetadataFolderId(metadataFolderID);
|
|
||||||
}
|
|
||||||
configs.add(folderConfig);
|
|
||||||
TransferRequestServer server=new TransferRequestServer();
|
|
||||||
for(FolderConfiguration entry:configs){
|
|
||||||
|
|
||||||
try{
|
|
||||||
Workspace ws = HomeLibrary.getHomeManagerFactory().getHomeManager().getHome(username).getWorkspace();
|
|
||||||
// FolderReport report=new FolderReport(entry);
|
|
||||||
logger.debug("Managing {} "+entry);
|
|
||||||
WorkspaceFolder folder = (WorkspaceFolder) ws.getItem(entry.getFolderId());
|
|
||||||
PublishFolders.handleFolder(ws,entry,server,folder);
|
|
||||||
|
|
||||||
|
|
||||||
}catch(WorkspaceException | HomeNotFoundException | InternalErrorException | UserNotFoundException e){
|
|
||||||
logger.error("WORKSPACE EXC ", e);
|
|
||||||
setStatusOnTransferId(transferId, true, "Sorry, an error has occurred during getting workspace for user: "+e.getMessage(), false);
|
|
||||||
}catch(Exception e){
|
|
||||||
logger.error("UNEXPECTED EXC ", e);
|
|
||||||
setStatusOnTransferId(transferId, true, "Sorry, an unexpected error has occurred during getting workspace for user", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("Waiting for service.. ");
|
|
||||||
server.waitCompletion();
|
|
||||||
|
|
||||||
Report report = server.getReport();
|
|
||||||
File reportFile = report.toFile(folderConfig);
|
|
||||||
if(reportFile!=null){
|
|
||||||
Workspace workspace;
|
|
||||||
try {
|
|
||||||
workspace = HomeLibrary.getHomeManagerFactory().getHomeManager().getHome(username).getWorkspace();
|
|
||||||
InputStream fileData = new FileInputStream(reportFile);
|
|
||||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
|
||||||
workspace.createExternalFile("Transferring on Thredds report file "+sdf.format(timestamp), "", "text/plain", fileData, folderId);
|
|
||||||
setStatusOnTransferId(transferId, false, "Sorry, an unexpected error has occurred during getting workspace for user",true);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (WorkspaceFolderNotFoundException
|
|
||||||
| InternalErrorException
|
|
||||||
| HomeNotFoundException
|
|
||||||
| UserNotFoundException e) {
|
|
||||||
logger.error("Error on getting workspace for thredds transferring to folder: "+folderId, e);
|
|
||||||
setStatusOnTransferId(transferId, true, "Sorry, an error has occurred during getting workspace for user: "+e.getMessage(),false);
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException | InsufficientPrivilegesException | ItemAlreadyExistException | WrongDestinationException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
logger.error("Error on writing report for thredds transferring to folder: "+folderId, e);
|
|
||||||
setStatusOnTransferId(transferId, true, "Sorry, an error has occurred during report creation to transfer resulting: "+e.getMessage(),false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
logger.error("Unexpected error has occurred when performing the tranferring to Thredds, folderID is: "+folderId, e);
|
|
||||||
e.printStackTrace();
|
|
||||||
setStatusOnTransferId(transferId, true, "Sorry, an unexpected error has occurred when performing the tranferring on Thredds. Refresh and try again later",false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}.start();
|
|
||||||
|
|
||||||
return tr;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the status of transfer id.
|
|
||||||
*
|
|
||||||
* @param httpSession the http session
|
|
||||||
* @param transferId the transfer id
|
|
||||||
* @return the status of transfer id
|
|
||||||
*/
|
|
||||||
public static TransferOnThreddsReport getStatusOfTransferId(HttpSession httpSession, String transferId){
|
|
||||||
return WsUtil.geTransferPublishingOnThreddsForId(httpSession, transferId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the error on transfer id.
|
|
||||||
*
|
|
||||||
* @param transferId the new error on transfer id
|
|
||||||
* @param error the error
|
|
||||||
* @param reportMessage the report message
|
|
||||||
* @param reportCreated the report created
|
|
||||||
*/
|
|
||||||
public void setStatusOnTransferId(String transferId, Boolean error, String reportMessage, Boolean reportCreated){
|
|
||||||
TransferOnThreddsReport tr = WsUtil.geTransferPublishingOnThreddsForId(httpSession, transferId);
|
|
||||||
|
|
||||||
if(tr!=null){
|
|
||||||
tr.setOnError(error);
|
|
||||||
tr.setReportMessage(reportMessage);
|
|
||||||
tr.setReportCreatedOnWorkspace(reportCreated);
|
|
||||||
WsUtil.setTransferPublishingOnThredds(httpSession, tr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,88 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.workspace.server.util;
|
|
||||||
|
|
||||||
import java.io.StringReader;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXBContext;
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import javax.xml.bind.Marshaller;
|
|
||||||
import javax.xml.bind.Unmarshaller;
|
|
||||||
import javax.xml.transform.stream.StreamSource;
|
|
||||||
|
|
||||||
import org.apache.commons.io.output.ByteArrayOutputStream;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferToThreddsProperty;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class TransferringToThreddsUtil.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
||||||
* Sep 29, 2017
|
|
||||||
*/
|
|
||||||
public class TransferringToThreddsUtil {
|
|
||||||
|
|
||||||
public static Logger logger = Logger.getLogger(TransferringToThreddsUtil.class);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To xml.
|
|
||||||
*
|
|
||||||
* @param property the property
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
public static String toXML(TransferToThreddsProperty property) {
|
|
||||||
logger.debug("Marshalling: "+property);
|
|
||||||
System.out.println("Marshalling: "+property);
|
|
||||||
try{
|
|
||||||
// Create a JaxBContext
|
|
||||||
JAXBContext jc = JAXBContext.newInstance(TransferToThreddsProperty.class);
|
|
||||||
// Create the Marshaller Object using the JaxB Context
|
|
||||||
Marshaller marshaller = jc.createMarshaller();
|
|
||||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
||||||
marshaller.marshal(property, baos);
|
|
||||||
String marshallingJsonString = baos.toString("UTF-8");
|
|
||||||
//System.out.println("XML: "+marshallingJsonString);
|
|
||||||
return marshallingJsonString;
|
|
||||||
}catch(JAXBException | UnsupportedEncodingException e){
|
|
||||||
logger.warn("Error during marshalling: "+property, e);
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unmarshalling To OBJECT.
|
|
||||||
*
|
|
||||||
* @param xml the xml
|
|
||||||
* @return the transfering to thredds property
|
|
||||||
*/
|
|
||||||
public static TransferToThreddsProperty toObject(String xml){
|
|
||||||
// Create a JaxBContext
|
|
||||||
JAXBContext jc;
|
|
||||||
try {
|
|
||||||
|
|
||||||
jc = JAXBContext.newInstance(TransferToThreddsProperty.class);
|
|
||||||
|
|
||||||
// Create the Unmarshaller Object using the JaxB Context
|
|
||||||
Unmarshaller unmarshaller = jc.createUnmarshaller();
|
|
||||||
|
|
||||||
// Create the StreamSource by creating StringReader using the JSON input
|
|
||||||
StreamSource stream = new StreamSource(new StringReader(xml));
|
|
||||||
|
|
||||||
// Getting the TransferingToThreddsProperty pojo again from the json
|
|
||||||
return unmarshaller.unmarshal(stream, TransferToThreddsProperty.class).getValue();
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (JAXBException e) {
|
|
||||||
logger.warn("Error during unmarshalling: "+xml, e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,9 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspace.server.util;
|
package org.gcube.portlets.user.workspace.server.util;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
@ -30,7 +27,6 @@ import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParame
|
||||||
import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameterForResolverIndex.RESOLVER_TYPE;
|
import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameterForResolverIndex.RESOLVER_TYPE;
|
||||||
import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader;
|
import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader;
|
||||||
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
||||||
import org.gcube.portlets.user.workspace.shared.TransferOnThreddsReport;
|
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
|
|
||||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
|
@ -417,67 +413,4 @@ public class WsUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the folder publishing on thredds.
|
|
||||||
*
|
|
||||||
* @param session the session
|
|
||||||
* @param report the report
|
|
||||||
*/
|
|
||||||
public static void setTransferPublishingOnThredds(HttpSession session, TransferOnThreddsReport report){
|
|
||||||
|
|
||||||
Map<String, TransferOnThreddsReport> map = getMapTransferPublishingOnThredds(session);
|
|
||||||
|
|
||||||
if(map!=null)
|
|
||||||
map.put(report.getTransferId(), report);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the folder publishing on thredds.
|
|
||||||
*
|
|
||||||
* @param session the session
|
|
||||||
* @return the folder publishing on thredds
|
|
||||||
*/
|
|
||||||
public static Map<String, TransferOnThreddsReport> getMapTransferPublishingOnThredds(HttpSession session){
|
|
||||||
|
|
||||||
Map<String, TransferOnThreddsReport> map = null;
|
|
||||||
try{
|
|
||||||
|
|
||||||
map = (Map<String,TransferOnThreddsReport>) session.getAttribute(FOLDER_PUBLISHING_ON_THREDDS);
|
|
||||||
|
|
||||||
if(map==null){
|
|
||||||
logger.info("Creating new map to trace publishing on thredds... ");
|
|
||||||
map = new HashMap<String, TransferOnThreddsReport>();
|
|
||||||
session.setAttribute(FOLDER_PUBLISHING_ON_THREDDS, map);
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch (Exception e) {
|
|
||||||
logger.error("an error occurred instancing PropertySpecialFolderReader ",e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ge transfer publishing on thredds for id.
|
|
||||||
*
|
|
||||||
* @param session the session
|
|
||||||
* @param transferId the transfer id
|
|
||||||
* @return the transfer on thredds report
|
|
||||||
*/
|
|
||||||
public static TransferOnThreddsReport geTransferPublishingOnThreddsForId(HttpSession session, String transferId){
|
|
||||||
|
|
||||||
Map<String, TransferOnThreddsReport> map = getMapTransferPublishingOnThredds(session);
|
|
||||||
|
|
||||||
if(map!=null){
|
|
||||||
return map.get(transferId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,190 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.workspace.shared;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class TransferOnThreddsReport.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
||||||
* Sep 27, 2017
|
|
||||||
*/
|
|
||||||
public class TransferOnThreddsReport implements Serializable, IsSerializable{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -8593731354178551332L;
|
|
||||||
private String transferId;
|
|
||||||
private String folderId;
|
|
||||||
private Boolean onError = false;
|
|
||||||
private String reportMessage = null;
|
|
||||||
private Boolean reportCreatedOnWorkspace = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new transfer on thredds report.
|
|
||||||
*/
|
|
||||||
public TransferOnThreddsReport() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new transfer on thredds report.
|
|
||||||
*
|
|
||||||
* @param transferId the transfer id
|
|
||||||
* @param folderId the folder id
|
|
||||||
* @param onError the on error
|
|
||||||
* @param reportMessage the report message
|
|
||||||
*/
|
|
||||||
public TransferOnThreddsReport(String transferId, String folderId, Boolean onError, String reportMessage) {
|
|
||||||
|
|
||||||
this.transferId = transferId;
|
|
||||||
this.folderId = folderId;
|
|
||||||
this.onError = onError;
|
|
||||||
this.reportMessage = reportMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the report created on workspace.
|
|
||||||
*
|
|
||||||
* @param reportCreatedOnWorkspace the reportCreated to set
|
|
||||||
*/
|
|
||||||
public void setReportCreatedOnWorkspace(Boolean reportCreatedOnWorkspace) {
|
|
||||||
|
|
||||||
this.reportCreatedOnWorkspace = reportCreatedOnWorkspace;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is transferring report available.
|
|
||||||
*
|
|
||||||
* @return the boolean
|
|
||||||
*/
|
|
||||||
public Boolean isTransferringReportAvailable() {
|
|
||||||
|
|
||||||
return reportCreatedOnWorkspace;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the transfer id.
|
|
||||||
*
|
|
||||||
* @return the transferId
|
|
||||||
*/
|
|
||||||
public String getTransferId() {
|
|
||||||
|
|
||||||
return transferId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the folder id.
|
|
||||||
*
|
|
||||||
* @return the folderId
|
|
||||||
*/
|
|
||||||
public String getFolderId() {
|
|
||||||
|
|
||||||
return folderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the on error.
|
|
||||||
*
|
|
||||||
* @return the onError
|
|
||||||
*/
|
|
||||||
public Boolean isOnError() {
|
|
||||||
|
|
||||||
return onError;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the transfer id.
|
|
||||||
*
|
|
||||||
* @param transferId the transferId to set
|
|
||||||
*/
|
|
||||||
public void setTransferId(String transferId) {
|
|
||||||
|
|
||||||
this.transferId = transferId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the folder id.
|
|
||||||
*
|
|
||||||
* @param folderId the folderId to set
|
|
||||||
*/
|
|
||||||
public void setFolderId(String folderId) {
|
|
||||||
|
|
||||||
this.folderId = folderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the on error.
|
|
||||||
*
|
|
||||||
* @param onError the onError to set
|
|
||||||
*/
|
|
||||||
public void setOnError(Boolean onError) {
|
|
||||||
|
|
||||||
this.onError = onError;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the report message.
|
|
||||||
*
|
|
||||||
* @return the reportMessage
|
|
||||||
*/
|
|
||||||
public String getReportMessage() {
|
|
||||||
|
|
||||||
return reportMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the report message.
|
|
||||||
*
|
|
||||||
* @param reportMessage the reportMessage to set
|
|
||||||
*/
|
|
||||||
public void setReportMessage(String reportMessage) {
|
|
||||||
|
|
||||||
this.reportMessage = reportMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#toString()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("TransferOnThreddsReport [transferId=");
|
|
||||||
builder.append(transferId);
|
|
||||||
builder.append(", folderId=");
|
|
||||||
builder.append(folderId);
|
|
||||||
builder.append(", onError=");
|
|
||||||
builder.append(onError);
|
|
||||||
builder.append(", reportMessage=");
|
|
||||||
builder.append(reportMessage);
|
|
||||||
builder.append(", reportCreated=");
|
|
||||||
builder.append(reportCreatedOnWorkspace);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,199 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.workspace.shared;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class TransferToThreddsProperty.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
||||||
* Sep 29, 2017
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement
|
|
||||||
public class TransferToThreddsProperty implements Serializable{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -7160662779647989154L;
|
|
||||||
|
|
||||||
|
|
||||||
private String folderId;
|
|
||||||
private String catalogueName;
|
|
||||||
private String vreName;
|
|
||||||
private String vreScope;
|
|
||||||
private String metadataFolderId;
|
|
||||||
private String metadataFolderName;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new transfering to thredds property.
|
|
||||||
*/
|
|
||||||
public TransferToThreddsProperty() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new transfering to thredds property.
|
|
||||||
*
|
|
||||||
* @param folderId the folder id
|
|
||||||
* @param catalogueName the catalogue name
|
|
||||||
* @param vreName the vre name
|
|
||||||
* @param vreScope the vre scope
|
|
||||||
* @param metadataFolderId the metadata folder id
|
|
||||||
*/
|
|
||||||
public TransferToThreddsProperty(
|
|
||||||
String folderId, String catalogueName, String vreName,
|
|
||||||
String vreScope, String metadataFolderId, String metadataFolderName) {
|
|
||||||
|
|
||||||
super();
|
|
||||||
this.folderId = folderId;
|
|
||||||
this.catalogueName = catalogueName;
|
|
||||||
this.vreName = vreName;
|
|
||||||
this.vreScope = vreScope;
|
|
||||||
this.metadataFolderId = metadataFolderId;
|
|
||||||
this.metadataFolderName = metadataFolderName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the folderId
|
|
||||||
*/
|
|
||||||
public String getFolderId() {
|
|
||||||
|
|
||||||
return folderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the catalogueName
|
|
||||||
*/
|
|
||||||
public String getCatalogueName() {
|
|
||||||
|
|
||||||
return catalogueName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the vreName
|
|
||||||
*/
|
|
||||||
public String getVreName() {
|
|
||||||
|
|
||||||
return vreName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the vreScope
|
|
||||||
*/
|
|
||||||
public String getVreScope() {
|
|
||||||
|
|
||||||
return vreScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the metadataFolderId
|
|
||||||
*/
|
|
||||||
public String getMetadataFolderId() {
|
|
||||||
|
|
||||||
return metadataFolderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the metadataFolderName
|
|
||||||
*/
|
|
||||||
public String getMetadataFolderName() {
|
|
||||||
|
|
||||||
return metadataFolderName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param folderId the folderId to set
|
|
||||||
*/
|
|
||||||
public void setFolderId(String folderId) {
|
|
||||||
|
|
||||||
this.folderId = folderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param catalogueName the catalogueName to set
|
|
||||||
*/
|
|
||||||
public void setCatalogueName(String catalogueName) {
|
|
||||||
|
|
||||||
this.catalogueName = catalogueName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param vreName the vreName to set
|
|
||||||
*/
|
|
||||||
public void setVreName(String vreName) {
|
|
||||||
|
|
||||||
this.vreName = vreName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param vreScope the vreScope to set
|
|
||||||
*/
|
|
||||||
public void setVreScope(String vreScope) {
|
|
||||||
|
|
||||||
this.vreScope = vreScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param metadataFolderId the metadataFolderId to set
|
|
||||||
*/
|
|
||||||
public void setMetadataFolderId(String metadataFolderId) {
|
|
||||||
|
|
||||||
this.metadataFolderId = metadataFolderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param metadataFolderName the metadataFolderName to set
|
|
||||||
*/
|
|
||||||
public void setMetadataFolderName(String metadataFolderName) {
|
|
||||||
|
|
||||||
this.metadataFolderName = metadataFolderName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#toString()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("TransferToThreddsProperty [folderId=");
|
|
||||||
builder.append(folderId);
|
|
||||||
builder.append(", catalogueName=");
|
|
||||||
builder.append(catalogueName);
|
|
||||||
builder.append(", vreName=");
|
|
||||||
builder.append(vreName);
|
|
||||||
builder.append(", vreScope=");
|
|
||||||
builder.append(vreScope);
|
|
||||||
builder.append(", metadataFolderId=");
|
|
||||||
builder.append(metadataFolderId);
|
|
||||||
builder.append(", metadataFolderName=");
|
|
||||||
builder.append(metadataFolderName);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
package org.gcube.portlets.user.workspace;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.homelibary.model.items.type.WorkspaceItemType;
|
||||||
|
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.accessmanager.ACLType;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
|
|
||||||
|
public class ShareFolder {
|
||||||
|
|
||||||
|
private static final String SUB_FOLDER_NAME = "subfoldermycourse";
|
||||||
|
private static final String FOLDER_NAME = "_mycourse";
|
||||||
|
public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV
|
||||||
|
// public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps";
|
||||||
|
public static String TEST_USER = "francesco.mangiacrapa";
|
||||||
|
// public static String FOLDER_ID = "4f0ff79d-3c1e-4d2a-bc74-6f731edcac98";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// System.out.println("start");
|
||||||
|
// ScopeBean scope = new ScopeBean(DEFAULT_SCOPE);
|
||||||
|
ScopeProvider.instance.set(DEFAULT_SCOPE);
|
||||||
|
|
||||||
|
Workspace workspace = HomeLibrary
|
||||||
|
.getHomeManagerFactory()
|
||||||
|
.getHomeManager()
|
||||||
|
.getHome(TEST_USER)
|
||||||
|
.getWorkspace();
|
||||||
|
//
|
||||||
|
|
||||||
|
System.out.println("start get root");
|
||||||
|
WorkspaceItem theRoot = workspace.getRoot();
|
||||||
|
|
||||||
|
System.out.println("\n\n CREATING folder: "+FOLDER_NAME + "\n\n");
|
||||||
|
|
||||||
|
WorkspaceFolder myCourseFolder = workspace.createFolder(FOLDER_NAME, "", theRoot.getId());
|
||||||
|
|
||||||
|
System.out.println("\n\n FOLDER id: "+myCourseFolder.getId() +"\n\n");
|
||||||
|
|
||||||
|
System.out.println("\n\n CREATING sub folder: "+SUB_FOLDER_NAME+"\n\n");
|
||||||
|
|
||||||
|
WorkspaceFolder subFolderMyCourse = workspace.createFolder(SUB_FOLDER_NAME, "", myCourseFolder.getId());
|
||||||
|
|
||||||
|
System.out.println("\n\n SUB_FOLDER id: "+subFolderMyCourse.getId() +"\n\n");
|
||||||
|
|
||||||
|
List<String> users = new ArrayList<String>();
|
||||||
|
users.add("costantino.perciante");
|
||||||
|
WorkspaceSharedFolder subShareFolder = workspace.shareFolder(users, subFolderMyCourse.getId());
|
||||||
|
subShareFolder.setACL(users, ACLType.READ_ONLY);
|
||||||
|
System.out.println("\n\n SHARED SUB_FOLDER id: "+subShareFolder.getId() +"\n\n");
|
||||||
|
|
||||||
|
// WorkspaceSharedFolder sharedFolder = subFolderMyCourse.share(users);
|
||||||
|
|
||||||
|
|
||||||
|
// System.out.println("\n\n SHARED subFolderMyCourse id: "+sharedFolder.getId());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// WorkspaceFolder folder = (WorkspaceFolder) workspace.getItem(sharedFolder.getId());
|
||||||
|
//
|
||||||
|
// System.out.println("\n\n FINAL id: "+folder.getId());
|
||||||
|
|
||||||
|
System.out.println("end");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue