|
|
|
@ -4,6 +4,7 @@
|
|
|
|
|
package org.gcube.portlets.widgets.wsthreddssync.server;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
|
@ -20,6 +21,7 @@ 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.faults.WorkspaceNotSynchedException;
|
|
|
|
|
import org.gcube.usecases.ws.thredds.model.ContainerType;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
@ -116,28 +118,44 @@ public class SyncronizeWithThredds {
|
|
|
|
|
/**
|
|
|
|
|
* Checks if is item synched.
|
|
|
|
|
*
|
|
|
|
|
* @param folderId the folder id
|
|
|
|
|
* @param scope the scope
|
|
|
|
|
* @param userToken the user token
|
|
|
|
|
* @param itemProperties the item properties
|
|
|
|
|
* @param itemType the item type
|
|
|
|
|
* @return true, if is item synched
|
|
|
|
|
* @throws ItemNotSynched the item not synched
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
public boolean isItemSynched(String folderId, String scope, String userToken, Map<String, Object> itemProperties,
|
|
|
|
|
ContainerType itemType) throws ItemNotSynched, Exception {
|
|
|
|
|
|
|
|
|
|
setContextParameters(scope, userToken);
|
|
|
|
|
return workspaceThreddsSynchronize.isItemSynched(folderId, itemProperties, itemType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the configuration.
|
|
|
|
|
*
|
|
|
|
|
* @param folderId the folder id
|
|
|
|
|
* @param scope the scope
|
|
|
|
|
* @param userToken the user token
|
|
|
|
|
* @return the th sync folder descriptor
|
|
|
|
|
* @return the configuration
|
|
|
|
|
* @throws ItemNotSynched the item not synched
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
public ThSyncFolderDescriptor isItemSynched(String folderId, String scope, String userToken)
|
|
|
|
|
public ThSyncFolderDescriptor getConfiguration(String folderId, String scope, String userToken)
|
|
|
|
|
throws ItemNotSynched, Exception {
|
|
|
|
|
|
|
|
|
|
setContextParameters(scope, userToken);
|
|
|
|
|
|
|
|
|
|
ThSyncFolderDescriptor config = null;
|
|
|
|
|
try {
|
|
|
|
|
setContextParameters(scope, userToken);
|
|
|
|
|
config = workspaceThreddsSynchronize.getConfiguration(folderId);
|
|
|
|
|
|
|
|
|
|
} catch (WorkspaceNotSynchedException e) {
|
|
|
|
|
logger.debug("WorkspaceNotSynchedException catched, the item id: " + folderId + " is not synched");
|
|
|
|
|
throw new ItemNotSynched("the item id: " + folderId + " is not synched");
|
|
|
|
|
logger.debug("WorkspaceNotSynchedException catched. The item with id: " + folderId + " is not synched");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.debug("Error on getting configuration for the item id: " + folderId
|
|
|
|
|
+ ", returning null (means not synched)");
|
|
|
|
|
return null;
|
|
|
|
|
logger.error("Error on reading the configuration for id: " + folderId, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return config;
|
|
|
|
@ -384,19 +402,4 @@ public class SyncronizeWithThredds {
|
|
|
|
|
workspaceThreddsSynchronize.registerCallbackForId(folderId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// /**
|
|
|
|
|
// * Gets the sync status info.
|
|
|
|
|
// *
|
|
|
|
|
// * @param itemId the item id
|
|
|
|
|
// * @param scope the scope
|
|
|
|
|
// * @param userToken the user token
|
|
|
|
|
// * @return the sync status info
|
|
|
|
|
// * @throws Exception the exception
|
|
|
|
|
// */
|
|
|
|
|
// public Sync_Status getSyncStatusInfo(String itemId, String scope, String userToken) throws Exception {
|
|
|
|
|
// setContextParameters(scope, userToken);
|
|
|
|
|
// return workspaceThreddsSynchronize.getInfoAfterCheck(itemId);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|