Added doUnSync method
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portal/ws-synchronized-module-library@165013 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
003642f673
commit
4500fe31d5
|
@ -24,6 +24,20 @@ public interface DoSyncItem<O> {
|
|||
O doSync(String itemId) throws ItemNotSynched, Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Do un sync.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param deleteRemoteContent the delete remote content
|
||||
* @return the boolean
|
||||
* @throws ItemNotSynched the item not synched
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
Boolean doUnSync(String itemId, boolean deleteRemoteContent)
|
||||
throws ItemNotSynched, Exception;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the sync status.
|
||||
*
|
||||
|
@ -40,6 +54,7 @@ public interface DoSyncItem<O> {
|
|||
*
|
||||
* @param itemId the item id
|
||||
* @return true, if successful
|
||||
* @throws ItemNotSynched the item not synched
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
Boolean removeSync(String itemId) throws ItemNotSynched, Exception;
|
||||
|
@ -51,6 +66,7 @@ public interface DoSyncItem<O> {
|
|||
*
|
||||
* @param itemId the item id
|
||||
* @return true, if successful
|
||||
* @throws ItemNotSynched the item not synched
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
Boolean stopSync(String itemId) throws ItemNotSynched, Exception;
|
||||
|
@ -61,7 +77,6 @@ public interface DoSyncItem<O> {
|
|||
* Register callback for id.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @throws ItemNotSynched the item not synched
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
void registerCallbackForId(String itemId) throws Exception;
|
||||
|
|
|
@ -83,9 +83,6 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
return instance;
|
||||
}
|
||||
|
||||
//setSynchronizedFolder(config, folder.getId());
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#isItemSynchronized(java.lang.String)
|
||||
*/
|
||||
|
@ -111,12 +108,6 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
logger.warn("Workspace locked, going to force unlock..");
|
||||
throw new WorkspaceFolderLocked(itemId, "The folder id: "+itemId +" is currently locked. Another sync process is in progress");
|
||||
//engine.forceUnlock(itemId);
|
||||
//System.out.println("Workspace locked, going to force unlock.."); // MAINLY FOR TEST PURPOSES, OR WHEN SOMETHIGN GOES WRONG.. USE CAUTIOUSLY
|
||||
//engine.forceUnlock(folder.getId());
|
||||
|
||||
//TODO???
|
||||
//return null;
|
||||
//???
|
||||
} catch (WorkspaceInteractionException | InternalException e) {
|
||||
logger.error("Error: ",e);
|
||||
if(e instanceof WorkspaceInteractionException)
|
||||
|
@ -171,7 +162,6 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
try {
|
||||
// INVOKE SYNCHRONIZATION ON FOLDER
|
||||
ProcessDescriptor descriptor = engine.doSync(itemId);
|
||||
|
||||
ThSyncStatus synStatus = mapCallBack.get(itemId);
|
||||
|
||||
if(synStatus==null) {
|
||||
|
@ -196,8 +186,6 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
throw new Exception("Sorry, an error occurred server side during syncronization for the itemId: "+itemId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,13 +195,10 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
@Override
|
||||
public ThSyncStatus monitorSyncStatus(String itemId) throws ItemNotSynched, Exception {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
ThSyncStatus synStatus = mapCallBack.get(itemId);
|
||||
|
||||
if(synStatus==null) {
|
||||
|
||||
try{
|
||||
|
||||
registerCallbackForId(itemId);
|
||||
|
@ -318,7 +303,7 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
public Sync_Status getSynchedStatusFromItemProperty(String folderId, String username) throws ItemNotSynched, Exception{
|
||||
|
||||
if(folderId==null)
|
||||
throw new Exception("Invalid pareter itemId is null");
|
||||
throw new Exception("Invalid parameter itemId is null");
|
||||
|
||||
String scope = ScopeProvider.instance.get();
|
||||
if(scope == null || scope.isEmpty())
|
||||
|
@ -444,4 +429,23 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
logger.debug("Returning sorted Catalogue list with: "+listCtlgs.size() +" item/s");
|
||||
return listCtlgs;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.DoSyncItem#doUnSync(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Boolean doUnSync(String itemId, boolean deleteRemoteContent) throws Exception {
|
||||
|
||||
if(itemId==null)
|
||||
throw new Exception("Invalid parameter: itemId is null");
|
||||
|
||||
try{
|
||||
engine.unsetSynchronizedFolder(itemId, deleteRemoteContent);
|
||||
return true;
|
||||
}catch(Exception e){
|
||||
logger.error("Unset Syncronized folder exception: ",e);
|
||||
throw new Exception("An error occurred on deleting configuration to the item id: "+itemId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue