diff --git a/src/main/java/org/gcube/portal/wssynclibrary/DoCheckSyncItem.java b/src/main/java/org/gcube/portal/wssynclibrary/DoCheckSyncItem.java index 6b4ee83..8b56022 100644 --- a/src/main/java/org/gcube/portal/wssynclibrary/DoCheckSyncItem.java +++ b/src/main/java/org/gcube/portal/wssynclibrary/DoCheckSyncItem.java @@ -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 { * @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; } diff --git a/src/main/java/org/gcube/portal/wssynclibrary/shared/thredds/ThSyncFolderDescriptor.java b/src/main/java/org/gcube/portal/wssynclibrary/shared/thredds/ThSyncFolderDescriptor.java index 883c6c7..cc18132 100644 --- a/src/main/java/org/gcube/portal/wssynclibrary/shared/thredds/ThSyncFolderDescriptor.java +++ b/src/main/java/org/gcube/portal/wssynclibrary/shared/thredds/ThSyncFolderDescriptor.java @@ -2,10 +2,6 @@ package org.gcube.portal.wssynclibrary.shared.thredds; import java.io.Serializable; - - -// TODO: Auto-generated Javadoc - /** * The Class ThSyncFolderDescriptor. * diff --git a/src/main/java/org/gcube/portal/wssynclibrary/thredds/WorkspaceThreddsSynchronize.java b/src/main/java/org/gcube/portal/wssynclibrary/thredds/WorkspaceThreddsSynchronize.java index 9f688a1..14aa93a 100644 --- a/src/main/java/org/gcube/portal/wssynclibrary/thredds/WorkspaceThreddsSynchronize.java +++ b/src/main/java/org/gcube/portal/wssynclibrary/thredds/WorkspaceThreddsSynchronize.java @@ -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); + } + } }