Browse Source

update to version 2.6.0-SNAPSHOT, added new input param backendType

feature20113
roberto cirillo 2 years ago
parent
commit
055827e3f2
  1. 4
      CHANGELOG.md
  2. 2
      pom.xml
  3. 15
      src/main/java/log4j.properties
  4. 5
      src/main/java/org/gcube/contentmanager/storageclient/wrapper/BackendType.java
  5. 60
      src/main/java/org/gcube/contentmanager/storageclient/wrapper/StorageClient.java

4
CHANGELOG.md

@ -1,5 +1,9 @@
# Changelog for storage-manager-wrapper
## [v2.6.0-SNAPSHOT] 2020-11-12
* adding new constructor with the backendType as input parameter
## [v2.5.3] 2019-03-20
* Added wrapper for HomeLibrary configuration related to the new preproduction infrastructure

2
pom.xml

@ -8,7 +8,7 @@
</parent>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-wrapper</artifactId>
<version>2.5.3</version>
<version>2.6.0-SNAPSHOT</version>
<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>

15
src/main/java/log4j.properties

@ -1,15 +0,0 @@
log4j.rootLogger=DEBUG, A1, stdout
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=log.txt
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
# ***** Max file size is set to 100KB
log4j.appender.A1.MaxFileSize=100MB
# ***** Keep one backup file
log4j.appender.A1.MaxBackupIndex=1
#CONSOLE
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Threshold=INFO
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%t] %-5p %c %d{dd MMM yyyy ;HH:mm:ss.SSS} - %m%n

5
src/main/java/org/gcube/contentmanager/storageclient/wrapper/BackendType.java

@ -0,0 +1,5 @@
package org.gcube.contentmanager.storageclient.wrapper;
public enum BackendType {
MongoDB, S3
}

60
src/main/java/org/gcube/contentmanager/storageclient/wrapper/StorageClient.java

@ -1,6 +1,6 @@
package org.gcube.contentmanager.storageclient.wrapper;
//import org.gcube.contentmanagement.blobstorage.resource.AccessType;
import org.gcube.contentmanager.storageclient.wrapper.BackendType;
import org.gcube.contentmanager.storageclient.wrapper.AccessType;
//import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
import org.gcube.contentmanager.storageclient.wrapper.MemoryType;
@ -96,6 +96,34 @@ public class StorageClient {
}
/**
* New constructor with another optional argument created for gcube infrastructure internal use.
* Available in v1.6.0
* It's possible to specify a specific backend.
* @param ServiceClass
* @param ServiceName
* @param owner
* @param typeAccess
* @param scope
*/
public StorageClient(String serviceClass, String serviceName, String owner, AccessType accessType, BackendType backend){
checkScopeProvider();
String id=owner;
this.owner=owner;
this.scopeString=ScopeProvider.instance.get();
if(accessType!=null)
this.typeAccess=accessType;
else throw new RuntimeException("AccessType parameter must be not null");
this.memoryType=MemoryType.BOTH;
this.serviceClass=serviceClass;
this.serviceName=serviceName;
this.setBackendType(backend.toString());
setClientId(serviceClass, serviceName, id);
}
/**
* Constructor created for external use
* @param owner
@ -170,6 +198,35 @@ public class StorageClient {
this.serviceName=serviceName;
setClientId(serviceClass, serviceName, id);
}
/**
* Available in v1.6.0
* It's possible to specify a specific backend.
* @param ServiceClass
* @param ServiceName
* @param owner
* @param typeAccess
* @param backend: specify mongodb (default) or s3
* @param memory defines the kind of memory: VOLATILE or PERSISTENT
* @param scope
*/
public StorageClient(String serviceClass, String serviceName, String owner, AccessType accessType, MemoryType memory, BackendType backend){
checkScopeProvider();
String id=owner;
this.owner=owner;
this.scopeString=ScopeProvider.instance.get();
if(accessType!=null)
this.typeAccess=accessType;
else throw new RuntimeException("AccessType parameter must be not null");
if(memory!=null)
this.memoryType=memory;
else throw new RuntimeException("MemoryType parameter must be not null");
this.serviceClass=serviceClass;
this.serviceName=serviceName;
setClientId(serviceClass, serviceName, id);
this.setBackendType(backend.toString());
}
@ -370,6 +427,7 @@ public class StorageClient {
public String getBackendType() {
logger.debug("backend type returned is "+backendType);
return backendType;
}

Loading…
Cancel
Save