moved to 1.5.0-SNAPSHOT. Starting migration to ws-thredds.1.x
This commit is contained in:
parent
59498cd6b3
commit
38c4012194
|
@ -4,6 +4,10 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.5.0-SNAPSHOT] - 2021-05-07
|
||||
|
||||
[#21374] Moved to ws-thredds 1.x
|
||||
|
||||
|
||||
## [v1.4.0] - 2021-03-10
|
||||
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -12,7 +12,7 @@
|
|||
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>ws-synchronized-module-library</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>ws-synchronized-module-library</name>
|
||||
<description>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.1</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.spatial.data</groupId>
|
||||
<artifactId>ws-thredds</artifactId>
|
||||
<version>[0.1.0, 1.0.0-SNAPSHOT)</version>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package org.gcube.portal.wssynclibrary;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface DoConnectRepository.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 14, 2018
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 14, 2018
|
||||
*/
|
||||
public interface DoConnectRepository {
|
||||
|
||||
|
@ -14,8 +11,9 @@ public interface DoConnectRepository {
|
|||
* Inits the repository.
|
||||
*
|
||||
* @return true, if successful
|
||||
* @throws Exception
|
||||
*/
|
||||
Boolean initRepository();
|
||||
Boolean initRepository() throws Exception;
|
||||
|
||||
/**
|
||||
* Shutdown repository.
|
||||
|
|
|
@ -2,13 +2,11 @@ package org.gcube.portal.wssynclibrary.shared.thredds;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class ThSynchFolderConfiguration.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 8, 2018
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 8, 2018
|
||||
*/
|
||||
public class ThSynchFolderConfiguration implements Serializable {
|
||||
|
||||
|
@ -21,8 +19,7 @@ public class ThSynchFolderConfiguration implements Serializable{
|
|||
/** The filter. */
|
||||
private String filter;
|
||||
|
||||
/** The target token. */
|
||||
private String targetToken;
|
||||
private String targetContext;
|
||||
|
||||
/** The to create catalog name. */
|
||||
private String toCreateCatalogName;
|
||||
|
@ -32,25 +29,37 @@ public class ThSynchFolderConfiguration implements Serializable{
|
|||
|
||||
private String rootFolderId;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new th synch folder configuration.
|
||||
*/
|
||||
public ThSynchFolderConfiguration() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ThSynchFolderConfiguration(String remotePath, String filter, String targetToken, String toCreateCatalogName,
|
||||
String remotePersistence, String rootFolderId) {
|
||||
/**
|
||||
* Instantiates a new th synch folder configuration.
|
||||
*
|
||||
* @param remotePath the remote path
|
||||
* @param filter the filter
|
||||
* @param targetContext the target context
|
||||
* @param toCreateCatalogName the to create catalog name
|
||||
* @param remotePersistence the remote persistence
|
||||
* @param rootFolderId the root folder id
|
||||
*/
|
||||
public ThSynchFolderConfiguration(String remotePath, String filter, String targetContext,
|
||||
String toCreateCatalogName, String remotePersistence, String rootFolderId) {
|
||||
super();
|
||||
this.remotePath = remotePath;
|
||||
this.filter = filter;
|
||||
this.targetToken = targetToken;
|
||||
this.targetContext = targetContext;
|
||||
this.toCreateCatalogName = toCreateCatalogName;
|
||||
this.remotePersistence = remotePersistence;
|
||||
this.rootFolderId = rootFolderId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the root folder id.
|
||||
*
|
||||
* @return the rootFolderId
|
||||
*/
|
||||
public String getRootFolderId() {
|
||||
|
@ -58,8 +67,9 @@ public class ThSynchFolderConfiguration implements Serializable{
|
|||
return rootFolderId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the root folder id.
|
||||
*
|
||||
* @param rootFolderId the rootFolderId to set
|
||||
*/
|
||||
public void setRootFolderId(String rootFolderId) {
|
||||
|
@ -67,87 +77,105 @@ public class ThSynchFolderConfiguration implements Serializable{
|
|||
this.rootFolderId = rootFolderId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the remote path.
|
||||
*
|
||||
* @return the remote path
|
||||
*/
|
||||
public String getRemotePath() {
|
||||
return remotePath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the remote path.
|
||||
*
|
||||
* @param remotePath the new remote path
|
||||
*/
|
||||
public void setRemotePath(String remotePath) {
|
||||
this.remotePath = remotePath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the filter.
|
||||
*
|
||||
* @return the filter
|
||||
*/
|
||||
public String getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the filter.
|
||||
*
|
||||
* @param filter the new filter
|
||||
*/
|
||||
public void setFilter(String filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getTargetToken() {
|
||||
return targetToken;
|
||||
/**
|
||||
* Gets the target context.
|
||||
*
|
||||
* @return the target context
|
||||
*/
|
||||
public String getTargetContext() {
|
||||
return targetContext;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void setTargetToken(String targetToken) {
|
||||
this.targetToken = targetToken;
|
||||
/**
|
||||
* Sets the target context.
|
||||
*
|
||||
* @param targetContext the new target context
|
||||
*/
|
||||
public void setTargetContext(String targetContext) {
|
||||
this.targetContext = targetContext;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the to create catalog name.
|
||||
*
|
||||
* @return the to create catalog name
|
||||
*/
|
||||
public String getToCreateCatalogName() {
|
||||
return toCreateCatalogName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the to create catalog name.
|
||||
*
|
||||
* @param toCreateCatalogName the new to create catalog name
|
||||
*/
|
||||
public void setToCreateCatalogName(String toCreateCatalogName) {
|
||||
this.toCreateCatalogName = toCreateCatalogName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the remote persistence.
|
||||
*
|
||||
* @return the remote persistence
|
||||
*/
|
||||
public String getRemotePersistence() {
|
||||
return remotePersistence;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the remote persistence.
|
||||
*
|
||||
* @param remotePersistence the new remote persistence
|
||||
*/
|
||||
public void setRemotePersistence(String remotePersistence) {
|
||||
this.remotePersistence = remotePersistence;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ThSynchFolderConfiguration [remotePath=");
|
||||
builder.append(remotePath);
|
||||
builder.append(", filter=");
|
||||
builder.append(filter);
|
||||
builder.append(", targetToken=");
|
||||
builder.append(targetToken);
|
||||
builder.append(", targetContext=");
|
||||
builder.append(targetContext);
|
||||
builder.append(", toCreateCatalogName=");
|
||||
builder.append(toCreateCatalogName);
|
||||
builder.append(", remotePersistence=");
|
||||
|
@ -159,4 +187,6 @@ public class ThSynchFolderConfiguration implements Serializable{
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,15 +16,10 @@ import org.gcube.usecases.ws.thredds.model.gui.CatalogBean;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class ThreddsConverter.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 14, 2018
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 14, 2018
|
||||
*/
|
||||
public class ThreddsConverter {
|
||||
|
||||
|
@ -38,7 +33,8 @@ public class ThreddsConverter {
|
|||
public ThSyncFolderDescriptor apply(SyncFolderDescriptor t) {
|
||||
ThSyncFolderDescriptor mySync = new ThSyncFolderDescriptor();
|
||||
if (t == null) {
|
||||
logger.info("Input "+SyncFolderDescriptor.class.getSimpleName()+" is null, returning empty "+ThSyncFolderDescriptor.class.getSimpleName());
|
||||
logger.info("Input " + SyncFolderDescriptor.class.getSimpleName() + " is null, returning empty "
|
||||
+ ThSyncFolderDescriptor.class.getSimpleName());
|
||||
return mySync;
|
||||
}
|
||||
|
||||
|
@ -79,39 +75,41 @@ public class ThreddsConverter {
|
|||
return null;
|
||||
}
|
||||
|
||||
String filter = t.getFilter()!=null && !t.getFilter().isEmpty()?t.getFilter():THREDDS_FILTER_NC_NCML_ASC;
|
||||
return new SynchFolderConfiguration(t.getRemotePath(), filter, t.getTargetToken(), t.getToCreateCatalogName(), t.getRootFolderId());
|
||||
String filter = t.getFilter() != null && !t.getFilter().isEmpty() ? t.getFilter()
|
||||
: THREDDS_FILTER_NC_NCML_ASC;
|
||||
return new SynchFolderConfiguration(t.getRemotePath(), filter, t.getTargetContext(),
|
||||
t.getToCreateCatalogName(), t.getRootFolderId());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** The to S synch folder configuration. */
|
||||
public static Function<SynchFolderConfiguration, ThSynchFolderConfiguration> toThSynchFolderConfiguration = new Function<SynchFolderConfiguration, ThSynchFolderConfiguration>() {
|
||||
|
||||
public ThSynchFolderConfiguration apply(SynchFolderConfiguration t) {
|
||||
ThSynchFolderConfiguration mySync = new ThSynchFolderConfiguration();
|
||||
if (t == null) {
|
||||
logger.info("Input "+SynchFolderConfiguration.class.getSimpleName()+" is null, returning empty "+ThSynchFolderConfiguration.class.getSimpleName());
|
||||
logger.info("Input " + SynchFolderConfiguration.class.getSimpleName() + " is null, returning empty "
|
||||
+ ThSynchFolderConfiguration.class.getSimpleName());
|
||||
return mySync;
|
||||
}
|
||||
mySync.setFilter(t.getFilter());
|
||||
mySync.setRemotePath(t.getRemotePath());
|
||||
mySync.setRemotePersistence(t.getRemotePersistence());
|
||||
mySync.setTargetToken(t.getTargetToken());
|
||||
mySync.setTargetContext(t.getTargetContext());
|
||||
mySync.setToCreateCatalogName(t.getToCreateCatalogName());
|
||||
mySync.setRootFolderId(t.getRootFolderId());
|
||||
return mySync;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** The to S sync folder descriptor. */
|
||||
public static Function<ProcessDescriptor, ThProcessDescriptor> toThProcessDescriptor = new Function<ProcessDescriptor, ThProcessDescriptor>() {
|
||||
|
||||
public ThProcessDescriptor apply(ProcessDescriptor t) {
|
||||
ThProcessDescriptor mySync = new ThProcessDescriptor();
|
||||
if (t == null) {
|
||||
logger.info("Input "+ProcessDescriptor.class.getSimpleName()+" is null, returning empty "+ThProcessDescriptor.class.getSimpleName());
|
||||
logger.info("Input " + ProcessDescriptor.class.getSimpleName() + " is null, returning empty "
|
||||
+ ThProcessDescriptor.class.getSimpleName());
|
||||
return mySync;
|
||||
}
|
||||
|
||||
|
@ -124,7 +122,6 @@ public class ThreddsConverter {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/** The to th catalogue bean. */
|
||||
public static Function<CatalogBean, ThCatalogueBean> toThCatalogueBean = new Function<CatalogBean, ThCatalogueBean>() {
|
||||
|
||||
|
@ -138,14 +135,14 @@ public class ThreddsConverter {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/** The to th process status. */
|
||||
public static Function<ProcessStatus, ThProcessStatus> toThProcessStatus = new Function<ProcessStatus, ThProcessStatus>() {
|
||||
|
||||
public ThProcessStatus apply(ProcessStatus t) {
|
||||
ThProcessStatus mySync = new ThProcessStatus();
|
||||
if (t == null) {
|
||||
logger.info("Input "+ProcessStatus.class.getSimpleName()+" is null, returning empty "+ThProcessStatus.class.getSimpleName());
|
||||
logger.info("Input " + ProcessStatus.class.getSimpleName() + " is null, returning empty "
|
||||
+ ThProcessStatus.class.getSimpleName());
|
||||
return mySync;
|
||||
}
|
||||
|
||||
|
@ -189,6 +186,4 @@ public class ThreddsConverter {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -34,15 +34,13 @@ import org.gcube.usecases.ws.thredds.model.gui.CatalogBean;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class WorkspaceThreddsSynchronize.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 14, 2018
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 14, 2018
|
||||
*/
|
||||
public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronizedRepository<ThSyncStatus, ThSyncFolderDescriptor>{
|
||||
public class WorkspaceThreddsSynchronize
|
||||
implements WorkspaceThreddsSynchronizedRepository<ThSyncStatus, ThSyncFolderDescriptor> {
|
||||
|
||||
/** The logger. */
|
||||
private static Logger logger = LoggerFactory.getLogger(WorkspaceThreddsSynchronize.class);
|
||||
|
@ -69,7 +67,6 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
engine = SyncEngine.get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the single instance of WorkspaceThreddsSynchronize.
|
||||
*
|
||||
|
@ -97,10 +94,11 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#isItemSynchronized(java.lang.String)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#
|
||||
* isItemSynchronized(java.lang.String)
|
||||
*/
|
||||
/**
|
||||
* Check item synched.
|
||||
|
@ -112,7 +110,8 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public ThSyncFolderDescriptor checkItemSynched(String itemId) throws ItemNotSynched, WorkspaceFolderLocked, Exception {
|
||||
public ThSyncFolderDescriptor checkItemSynched(String itemId)
|
||||
throws ItemNotSynched, WorkspaceFolderLocked, Exception {
|
||||
logger.debug("Perfoming checkItemSynched for id: " + itemId);
|
||||
try {
|
||||
// WHEN OPENING A FOLDER, INVOKE CHECK TO UPDATE SYNCH STATUS
|
||||
|
@ -131,21 +130,25 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
// engine.setSynchronizedFolder(config, folder.getId());
|
||||
} catch (WorkspaceLockedException e) {
|
||||
// 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");
|
||||
throw new WorkspaceFolderLocked(itemId,
|
||||
"The folder id: " + itemId + " is currently locked. Another sync process is in progress");
|
||||
// engine.forceUnlock(itemId);
|
||||
} catch (WorkspaceInteractionException | InternalException e) {
|
||||
logger.error("Error: ", e);
|
||||
if (e instanceof WorkspaceInteractionException)
|
||||
throw new Exception("Sorry, an error occurred during check syncronization due to WS interection for the itemId: "+itemId);
|
||||
throw new Exception(
|
||||
"Sorry, an error occurred during check syncronization due to WS interection for the itemId: "
|
||||
+ itemId);
|
||||
else if (e instanceof InternalException)
|
||||
throw new Exception("Sorry, an Internal Exception occurred during check syncronization for the itemId: "+itemId);
|
||||
throw new Exception(
|
||||
"Sorry, an Internal Exception occurred during check syncronization for the itemId: " + itemId);
|
||||
|
||||
throw new Exception("Sorry, an error occurred server side during chck syncronization for the itemId: "+itemId);
|
||||
throw new Exception(
|
||||
"Sorry, an error occurred server side during chck syncronization for the itemId: " + itemId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the synchronized folder.
|
||||
*
|
||||
|
@ -154,7 +157,8 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
* @return the th sync folder descriptor
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public ThSyncFolderDescriptor setSynchronizedFolder(ThSynchFolderConfiguration thConfig, String itemId) throws Exception {
|
||||
public ThSyncFolderDescriptor setSynchronizedFolder(ThSynchFolderConfiguration thConfig, String itemId)
|
||||
throws Exception {
|
||||
SynchFolderConfiguration config = ThreddsConverter.toSynchFolderConfiguration.apply(thConfig);
|
||||
|
||||
if (thConfig.getRemotePath() == null || thConfig.getRemotePath().isEmpty())
|
||||
|
@ -163,9 +167,6 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
if (thConfig.getToCreateCatalogName() == null || thConfig.getToCreateCatalogName().isEmpty())
|
||||
throw new Exception("A valid Catalogue Name must be provided");
|
||||
|
||||
if(thConfig.getTargetToken()==null || thConfig.getTargetToken().isEmpty())
|
||||
throw new Exception("A valid Target Token must be provided");
|
||||
|
||||
try {
|
||||
engine.setSynchronizedFolder(config, itemId);
|
||||
} catch (WorkspaceInteractionException | InternalException e) {
|
||||
|
@ -176,10 +177,11 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#doSynchronization(java.lang.String)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#
|
||||
* doSynchronization(java.lang.String)
|
||||
*/
|
||||
/**
|
||||
* Do sync.
|
||||
|
@ -211,18 +213,24 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
logger.error("Error: ", e);
|
||||
|
||||
if (e instanceof WorkspaceInteractionException)
|
||||
throw new Exception("Sorry, an error occurred during syncronization due to WS interection for the itemId: "+itemId);
|
||||
throw new Exception(
|
||||
"Sorry, an error occurred during syncronization due to WS interection for the itemId: "
|
||||
+ itemId);
|
||||
else if (e instanceof InternalException)
|
||||
throw new Exception("Sorry, an Internal Exception occurred during syncronization for the itemId: "+itemId);
|
||||
throw new Exception(
|
||||
"Sorry, an Internal Exception occurred during syncronization for the itemId: " + itemId);
|
||||
|
||||
throw new Exception("Sorry, an error occurred server side during syncronization for the itemId: "+itemId);
|
||||
throw new Exception(
|
||||
"Sorry, an error occurred server side during syncronization for the itemId: " + itemId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.DoSyncItem#getSyncStatus(java.lang.String)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.gcube.portal.wssynclibrary.DoSyncItem#getSyncStatus(java.lang.String)
|
||||
*/
|
||||
/**
|
||||
* Monitor sync status.
|
||||
|
@ -253,7 +261,8 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
return thSyncStatus;
|
||||
|
||||
} catch (ProcessNotFoundException e) {
|
||||
throw new Exception("Monitor is not available here. The sync process is in progress on another machine");
|
||||
throw new Exception(
|
||||
"Monitor is not available here. The sync process is in progress on another machine");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,57 +283,67 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#removeSync(java.lang.String)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#removeSync(
|
||||
* java.lang.String)
|
||||
*/
|
||||
/**
|
||||
* Removes the sync.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @return the boolean
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public Boolean removeSync(String itemId) {
|
||||
return null;
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
public Boolean removeSync(String itemId) throws Exception {
|
||||
throw new Exception("removeSync not implemented");
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#stopSync(java.lang.String)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#stopSync(java.
|
||||
* lang.String)
|
||||
*/
|
||||
/**
|
||||
* Stop sync.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @return the boolean
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public Boolean stopSync(String itemId) {
|
||||
return false;
|
||||
|
||||
public Boolean stopSync(String itemId) throws Exception {
|
||||
throw new Exception("stopSync not implemented");
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#initRepository()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#initRepository
|
||||
* ()
|
||||
*/
|
||||
/**
|
||||
* Inits the repository.
|
||||
*
|
||||
* @return the boolean
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public Boolean initRepository() {
|
||||
return false;
|
||||
|
||||
public Boolean initRepository() throws Exception {
|
||||
throw new Exception("initRepository not implemented");
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#shutDownRepository()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portal.wssynclibrary.WorkspaceSynchronizedRepository#
|
||||
* shutDownRepository()
|
||||
*/
|
||||
/**
|
||||
* Shut down repository.
|
||||
|
@ -342,9 +361,12 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronizedRepository#decribeSyncRepository()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronizedRepository
|
||||
* #decribeSyncRepository()
|
||||
*/
|
||||
/**
|
||||
* Decribe sync repository.
|
||||
|
@ -356,7 +378,6 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
return "Sync repository for Thredds";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the synched status from item property.
|
||||
*
|
||||
|
@ -366,7 +387,8 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
* @throws ItemNotSynched the item not synched
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public Sync_Status getSynchedStatusFromItemProperty(String itemId, String username) throws ItemNotSynched, Exception{
|
||||
public Sync_Status getSynchedStatusFromItemProperty(String itemId, String username)
|
||||
throws ItemNotSynched, Exception {
|
||||
|
||||
if (itemId == null)
|
||||
throw new Exception("Invalid parameter itemId is null");
|
||||
|
@ -380,7 +402,8 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
|
||||
Map<String, Object> map = storageHubInstance.open(itemId).asItem().get().getMetadata().getMap();
|
||||
wsSyncStatus = (String) map.get(WS_SYNCH_SYNCH_STATUS);
|
||||
logger.debug("Item id: "+itemId+" read from Shub has current: "+WS_SYNCH_SYNCH_STATUS +" value at: "+wsSyncStatus);
|
||||
logger.debug("Item id: " + itemId + " read from Shub has current: " + WS_SYNCH_SYNCH_STATUS + " value at: "
|
||||
+ wsSyncStatus);
|
||||
if (wsSyncStatus == null)
|
||||
return null;
|
||||
|
||||
|
@ -391,7 +414,6 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register callback for id.
|
||||
*
|
||||
|
@ -429,7 +451,6 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update map callback.
|
||||
*
|
||||
|
@ -444,44 +465,37 @@ public class WorkspaceThreddsSynchronize implements WorkspaceThreddsSynchronized
|
|||
logger.debug("Update map for " + itemId + " with new " + thStatus);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the available catalogues by token.
|
||||
* Gets the available catalogues. you need to set the context caller.
|
||||
*
|
||||
* @param token the token
|
||||
* @return the available catalogues by token
|
||||
* @return the available catalogues
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public List<ThCatalogueBean> getAvailableCataloguesByToken(String token) throws Exception{
|
||||
|
||||
if(token==null || token.isEmpty())
|
||||
throw new Exception("Invalid parameter token null or empty");
|
||||
|
||||
String printToken = token.substring(0, token.length()-5)+"XXXXX";
|
||||
logger.debug("Get Available Catalogues by token: "+printToken);
|
||||
Set<CatalogBean> ctlgs = engine.getAvailableCatalogsByToken(token);
|
||||
public List<ThCatalogueBean> getAvailableCatalogues() throws Exception {
|
||||
logger.debug("called Get Available Catalogues");
|
||||
Set<CatalogBean> ctlgs = engine.getAvailableCatalogs();
|
||||
|
||||
if (ctlgs == null || ctlgs.size() == 0) {
|
||||
logger.debug("No Catalogue available for token: "+printToken +" returning empty list");
|
||||
logger.info("No Catalogue available in the current context, returning empty list");
|
||||
return new ArrayList<ThCatalogueBean>(1);
|
||||
}
|
||||
|
||||
List<ThCatalogueBean> listCtlgs = new ArrayList<ThCatalogueBean>(ctlgs.size());
|
||||
for (CatalogBean bean : ctlgs) {
|
||||
System.out.println(bean.getName()+" in "+bean.getPath()+" Default : "+bean.getIsDefault());
|
||||
logger.debug(bean.getName() + " in " + bean.getPath() + " Default : " + bean.getIsDefault());
|
||||
ThCatalogueBean toBean = ThreddsConverter.toThCatalogueBean.apply(bean);
|
||||
if (toBean != null)
|
||||
listCtlgs.add(toBean);
|
||||
}
|
||||
|
||||
Collections.sort(listCtlgs);
|
||||
logger.debug("Returning sorted Catalogue list with: "+listCtlgs.size() +" item/s");
|
||||
logger.info("Returning sorted Catalogue list with: " + listCtlgs.size() + " item/s");
|
||||
return listCtlgs;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portal.wssynclibrary.DoSyncItem#doUnSync(java.lang.String)
|
||||
*/
|
||||
/**
|
||||
|
|
|
@ -4,8 +4,6 @@ import org.gcube.portal.wssynclibrary.DoCheckSyncItem;
|
|||
import org.gcube.portal.wssynclibrary.DoConnectRepository;
|
||||
import org.gcube.portal.wssynclibrary.DoSyncItem;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface WorkspaceThreddsSynchronizedRepository.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue