Compare commits

...

3 Commits

4 changed files with 23 additions and 17 deletions

View File

@ -3,6 +3,7 @@
## [v4.1.0-SNAPSHOT]
* compatible with s3 storage backend
* remove retry mechanism to exist method
* add try/catch on exist method #24215
## [v3.0.0] 2021-09-10
* fix #22164

17
pom.xml
View File

@ -9,9 +9,9 @@
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-core</artifactId>
<version>4.1.0-SNAPSHOT</version>
<!-- <properties> -->
<!-- <distroDirectory>${project.basedir}/distro</distroDirectory> -->
<!-- </properties> -->
<properties>
<java_version>1.8</java_version>
</properties>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
@ -53,10 +53,11 @@
<artifactId>commons-codec</artifactId>
<version>1.8</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.contentmanagement</groupId> -->
<!-- <artifactId>storage-manager-s3-plugin</artifactId> -->
<!-- <version>1.0.0-SNAPSHOT</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.32</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -36,9 +36,8 @@ public class Exist extends Operation{
isPresent = tm.exist(bucket);
} catch (Exception e) {
tm.close();
throw new RemoteBackendException(" Error in Exist operation ", e.getCause()); }
if (logger.isDebugEnabled()) {
logger.debug(" PATH " + bucket);
logger.warn(" Error in Exist operation ", e.getCause());
isPresent=false;
}
return isPresent+"";
}

View File

@ -314,13 +314,18 @@ public class MongoOperationManager extends TransportManager{
@Override
public boolean exist(String remotePath){
boolean isPresent=false;
if(logger.isDebugEnabled())
logger.debug("MongoDB - check if file exist: "+remotePath);
GridFSDBFile f = mongoPrimaryInstance.retrieveRemoteDescriptor(remotePath, null, false);
if(f!=null){
isPresent=true;
try{
if(logger.isDebugEnabled())
logger.debug("MongoDB - check if file exist: "+remotePath);
GridFSDBFile f = mongoPrimaryInstance.retrieveRemoteDescriptor(remotePath, null, false);
if(f!=null){
isPresent=true;
}
close();
}catch(Exception e){
logger.warn("problem during the retrieve of the following id/path: "+remotePath+" "+e.getMessage());
isPresent=false;
}
close();
return isPresent;
}