the getConfiguration method has been updated by including also the
engine.check
This commit is contained in:
parent
dd3dc4a0cc
commit
5cc52d9e3c
|
@ -176,7 +176,7 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner {
|
|||
|
||||
//at least one THREDDS rights is assigned
|
||||
GWT.log("Performing isItemSynched: "+folder.getFolderId());
|
||||
WsThreddsWidget.wsThreddsSyncService.getConfiguration(folder.getFolderId(), new AsyncCallback<WsThreddsSynchFolderDescriptor>() {
|
||||
WsThreddsWidget.wsThreddsSyncService.getConfiguration(folder.getFolderId(), true, new AsyncCallback<WsThreddsSynchFolderDescriptor>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(WsThreddsSynchFolderDescriptor result) {
|
||||
|
@ -196,7 +196,12 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
box.hide();
|
||||
try {
|
||||
hpLoader.clear();
|
||||
hpLoader.setVisible(false);
|
||||
}catch (Exception e) {
|
||||
//Silent
|
||||
}
|
||||
|
||||
if(caught instanceof WorkspaceFolderLocked){
|
||||
viewManager.showMonitorSyncToFolder(folder,syncEventsListeners);
|
||||
|
@ -204,7 +209,10 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner {
|
|||
}
|
||||
|
||||
viewManager.cancelMonitor(folder);
|
||||
Window.alert(caught.getMessage());
|
||||
Alert alert = new Alert(caught.getMessage(), AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
box.add(alert);
|
||||
//Window.alert(caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.widgets.wsthreddssync.shared.GatewayRolesThredds;
|
|||
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor;
|
||||
import org.gcube.usecases.ws.thredds.SyncEngine;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
@ -31,11 +32,15 @@ public interface ThreddsWorkspaceSyncService extends RemoteService {
|
|||
* Gets the configuration.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @return the configuration
|
||||
* @param loadStatus the load status. If true it loads the status by calling the
|
||||
* {@link SyncEngine#check(String, boolean)} but it is time
|
||||
* consuming. No otherwise.
|
||||
* @return the ws thredds synch folder descriptor
|
||||
* @throws WorkspaceFolderLocked the workspace folder locked
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
WsThreddsSynchFolderDescriptor getConfiguration(String folderId) throws WorkspaceFolderLocked, Exception;
|
||||
WsThreddsSynchFolderDescriptor getConfiguration(String folderId, boolean loadStatus)
|
||||
throws WorkspaceFolderLocked, Exception;
|
||||
|
||||
/**
|
||||
* Do sync folder.
|
||||
|
@ -91,4 +96,6 @@ public interface ThreddsWorkspaceSyncService extends RemoteService {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
Map<String, GatewayRolesThredds> getScopesWithThreddsRolesForLoggedUser() throws Exception;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescr
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface ThreddsWorkspaceSyncServiceAsync.
|
||||
*
|
||||
|
@ -52,10 +53,11 @@ public interface ThreddsWorkspaceSyncServiceAsync {
|
|||
* Gets the configuration.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param loadStatus the load status
|
||||
* @param callback the callback
|
||||
* @return the configuration
|
||||
*/
|
||||
void getConfiguration(String folderId, AsyncCallback<WsThreddsSynchFolderDescriptor> callback);
|
||||
void getConfiguration(String folderId, boolean loadStatus, AsyncCallback<WsThreddsSynchFolderDescriptor> callback);
|
||||
|
||||
/**
|
||||
* Do sync folder.
|
||||
|
@ -100,5 +102,11 @@ public interface ThreddsWorkspaceSyncServiceAsync {
|
|||
*/
|
||||
void doUnSyncFolder(String folderId, AsyncCallback<Boolean> callback);
|
||||
|
||||
/**
|
||||
* Gets the scopes with thredds roles for logged user.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @return the scopes with thredds roles for logged user
|
||||
*/
|
||||
void getScopesWithThreddsRolesForLoggedUser(AsyncCallback<Map<String, GatewayRolesThredds>> callback);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
|||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class ShowThreddsFolderInfoView.
|
||||
|
|
|
@ -15,11 +15,13 @@ import org.gcube.common.scope.api.ScopeProvider;
|
|||
import org.gcube.oidc.rest.JWTToken;
|
||||
import org.gcube.portal.oidc.lr62.OIDCUmaUtil;
|
||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||
import org.gcube.portal.wssynclibrary.shared.WorkspaceFolderLocked;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSynchFolderConfiguration;
|
||||
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
|
||||
import org.gcube.usecases.ws.thredds.SyncEngine;
|
||||
import org.gcube.usecases.ws.thredds.faults.WorkspaceNotSynchedException;
|
||||
import org.gcube.usecases.ws.thredds.model.ContainerType;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
|
@ -138,24 +140,37 @@ public class SyncronizeWithThredds {
|
|||
* Gets the configuration.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param loadStatus the load status. If true it loads the status by calling the
|
||||
* {@link SyncEngine#check(String, boolean)} but it is time
|
||||
* consuming. Otherwise it callas the
|
||||
* {@link SyncEngine#getConfig(String)} without sync status
|
||||
* @param scope the scope
|
||||
* @param userToken the user token
|
||||
* @return the configuration
|
||||
* @throws ItemNotSynched the item not synched
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public ThSyncFolderDescriptor getConfiguration(String folderId, String scope, String userToken)
|
||||
public ThSyncFolderDescriptor getConfiguration(String folderId, boolean loadStatus, String scope, String userToken)
|
||||
throws ItemNotSynched, Exception {
|
||||
|
||||
ThSyncFolderDescriptor config = null;
|
||||
try {
|
||||
setContextParameters(scope, userToken);
|
||||
|
||||
if (loadStatus) {
|
||||
config = workspaceThreddsSynchronize.checkItemSynched(folderId);
|
||||
} else {
|
||||
config = workspaceThreddsSynchronize.getConfiguration(folderId);
|
||||
}
|
||||
|
||||
} catch (WorkspaceNotSynchedException e) {
|
||||
logger.debug("WorkspaceNotSynchedException catched. The item with id: " + folderId + " is not synched");
|
||||
} catch (WorkspaceFolderLocked e1) {
|
||||
logger.info("The folder with id: " + folderId + " is locked");
|
||||
throw new Exception("The folder with id: "+folderId +" is currently locked. Another sync process is in progress");
|
||||
} catch (Exception e) {
|
||||
logger.error("Error on reading the configuration for id: " + folderId, e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return config;
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope;
|
|||
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScopeType;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor;
|
||||
import org.gcube.usecases.ws.thredds.SyncEngine;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||
|
@ -34,7 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
|
||||
/**
|
||||
* The server side implementation of the RPC service.
|
||||
*
|
||||
|
@ -112,16 +113,19 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if is item synched.
|
||||
* Gets the configuration.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param loadStatus the load status. If true it loads the status by calling the
|
||||
* {@link SyncEngine#check(String, boolean)} but it is time
|
||||
* consuming. No otherwise.
|
||||
* @return the ws thredds synch folder descriptor
|
||||
* @throws WorkspaceFolderLocked the workspace folder locked
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
// UPDATED
|
||||
@Override
|
||||
public WsThreddsSynchFolderDescriptor getConfiguration(String folderId) throws WorkspaceFolderLocked, Exception {
|
||||
public WsThreddsSynchFolderDescriptor getConfiguration(String folderId, boolean loadStatus)
|
||||
throws WorkspaceFolderLocked, Exception {
|
||||
logger.debug("called isItemSynched for folderId: " + folderId);
|
||||
|
||||
try {
|
||||
|
@ -129,7 +133,8 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
|
|||
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
|
||||
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
|
||||
|
||||
ThSyncFolderDescriptor theConfig = getSyncService().getConfiguration(folderId,wsScope,wsUserToken);
|
||||
ThSyncFolderDescriptor theConfig = getSyncService().getConfiguration(folderId, loadStatus, wsScope,
|
||||
wsUserToken);
|
||||
|
||||
if (theConfig != null) {
|
||||
logger.info("Folder id: " + folderId + " is synched");
|
||||
|
@ -205,7 +210,7 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
|
|||
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
||||
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
|
||||
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
|
||||
ThSyncFolderDescriptor foldeDesr = getSyncService().getConfiguration(folderId,wsScope,wsUserToken);
|
||||
ThSyncFolderDescriptor foldeDesr = getSyncService().getConfiguration(folderId, false, wsScope, wsUserToken);
|
||||
return getSyncService().doUnSync(folderId, true, foldeDesr.getConfiguration(), this.getThreadLocalRequest(),
|
||||
user);
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue