integrated with methods

https://support.d4science.org/issues/21346#note-4
This commit is contained in:
Francesco Mangiacrapa 2021-05-10 10:12:46 +02:00
parent 38c4012194
commit 3816d9f04b
3 changed files with 34 additions and 4 deletions

View File

@ -4,6 +4,8 @@
package org.gcube.portal.wssynclibrary;
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
import org.gcube.usecases.ws.thredds.faults.WorkspaceInteractionException;
import org.gcube.usecases.ws.thredds.faults.WorkspaceNotSynchedException;
// TODO: Auto-generated Javadoc
/**
@ -25,5 +27,17 @@ public interface DoCheckSyncItem<T> {
* @throws Exception the exception
*/
T checkItemSynched(String itemId) throws ItemNotSynched, Exception;
/**
* Gets the configuration.
*
* @param itemId the item id
* @return the configuration
* @throws WorkspaceInteractionException the workspace interaction exception
* @throws WorkspaceNotSynchedException the workspace not synched exception
* @throws Exception
*/
T getConfiguration(String itemId) throws WorkspaceInteractionException, WorkspaceNotSynchedException, Exception;
}

View File

@ -2,10 +2,6 @@ package org.gcube.portal.wssynclibrary.shared.thredds;
import java.io.Serializable;
// TODO: Auto-generated Javadoc
/**
* The Class ThSyncFolderDescriptor.
*

View File

@ -520,4 +520,24 @@ public class WorkspaceThreddsSynchronize
throw new Exception("An error occurred on deleting configuration to the item id: " + itemId, e);
}
}
@Override
public ThSyncFolderDescriptor getConfiguration(String itemId)
throws WorkspaceInteractionException, WorkspaceNotSynchedException, Exception {
if (itemId == null)
throw new Exception("Invalid parameter: itemId is null");
try {
SynchFolderConfiguration syncFolderConfig = engine.getConfig(itemId);
ThSynchFolderConfiguration toFolderConfig = ThreddsConverter.toThSynchFolderConfiguration
.apply(syncFolderConfig);
return new ThSyncFolderDescriptor(itemId, null, toFolderConfig, false, null);
} catch (Exception e) {
logger.error("GetConfig error on folder: "+itemId, e);
throw new Exception("An error occurred on getting (sync) configuration for the item id: " + itemId, e);
}
}
}