renamed class RequestObject to MyFile in order to preserve backward compatibility
This commit is contained in:
parent
c0cc09fd5e
commit
b12e16eb4b
|
@ -6,6 +6,11 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
|
@ -21,6 +26,7 @@
|
|||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
|
|
13
.project
13
.project
|
@ -5,6 +5,11 @@
|
|||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
|
@ -15,9 +20,17 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
|
@ -7,7 +7,9 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
|||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="storage-manager-core">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="java" version="1.8"/>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
</faceted-project>
|
|
@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory;
|
|||
* @author Roberto Cirillo (ISTI - CNR)
|
||||
*
|
||||
*/
|
||||
public class RequestObject {
|
||||
public class MyFile {
|
||||
|
||||
// file name
|
||||
private String name;
|
||||
|
@ -95,10 +95,10 @@ public class RequestObject {
|
|||
|
||||
|
||||
|
||||
final Logger logger = LoggerFactory.getLogger(RequestObject.class);
|
||||
final Logger logger = LoggerFactory.getLogger(MyFile.class);
|
||||
|
||||
|
||||
public RequestObject(boolean lock){
|
||||
public MyFile(boolean lock){
|
||||
setLock(lock);
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class RequestObject {
|
|||
* @param name name of the file
|
||||
* @param pathClient local path of the file
|
||||
*/
|
||||
public RequestObject(String author, String name, String pathClient, MemoryType memoryType){
|
||||
public MyFile(String author, String name, String pathClient, MemoryType memoryType){
|
||||
this.setOwner(author);
|
||||
this.setName(name);
|
||||
this.setLocalPath(pathClient);
|
||||
|
@ -123,7 +123,7 @@ public class RequestObject {
|
|||
* @param pathServer remote path of the file
|
||||
*/
|
||||
|
||||
public RequestObject(String author, String name, String pathClient, String pathServer, MemoryType memoryType){
|
||||
public MyFile(String author, String name, String pathClient, String pathServer, MemoryType memoryType){
|
||||
this.setOwner(author);
|
||||
this.setName(name);
|
||||
this.setLocalPath(pathClient);
|
||||
|
@ -131,7 +131,7 @@ public class RequestObject {
|
|||
setGcubeMemoryType(memoryType);
|
||||
}
|
||||
|
||||
public RequestObject(MemoryType memoryType) {
|
||||
public MyFile(MemoryType memoryType) {
|
||||
setGcubeMemoryType(memoryType);
|
||||
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class RequestObject {
|
|||
* build a new object with only the name setted
|
||||
* @param name file name
|
||||
*/
|
||||
public RequestObject(String name, MemoryType memoryType){
|
||||
public MyFile(String name, MemoryType memoryType){
|
||||
setName(name);
|
||||
setGcubeMemoryType(memoryType);
|
||||
}
|
||||
|
@ -245,8 +245,8 @@ public class RequestObject {
|
|||
* returns a copy of the current resource
|
||||
* @return the file copy
|
||||
*/
|
||||
public RequestObject copyProperties(){
|
||||
RequestObject dest=new RequestObject(getGcubeMemoryType());
|
||||
public MyFile copyProperties(){
|
||||
MyFile dest=new MyFile(getGcubeMemoryType());
|
||||
dest.setOwner(getOwner());
|
||||
dest.setLocalDir(this.getLocalDir());
|
||||
dest.setRemoteDir(this.getRemoteDir());
|
||||
|
|
|
@ -16,7 +16,7 @@ package org.gcube.contentmanagement.blobstorage.resource;
|
|||
*
|
||||
* It means that the client would be upload a file that have an absolute local path defined in pathClient field,
|
||||
* on the remote location identifies by pathServer field of the resource MyFile
|
||||
* @see org.gcube.contentmanagement.blobstorage.resource.RequestObject
|
||||
* @see org.gcube.contentmanagement.blobstorage.resource.MyFile
|
||||
*
|
||||
* @author Roberto Cirillo (ISTI-CNR)
|
||||
*
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.net.UnknownHostException;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.StorageObject;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -86,7 +86,7 @@ public class DirectoryBucket {
|
|||
* @param bucket remote file to remove
|
||||
*/
|
||||
@Deprecated
|
||||
public void removeKeysOnDirBucket(RequestObject resource, String bucket, String rootArea, String backendType, String[] dbNames){
|
||||
public void removeKeysOnDirBucket(MyFile resource, String bucket, String rootArea, String backendType, String[] dbNames){
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("CHECK REMOVE: "+bucket);
|
||||
String[] bucketList=null;
|
||||
|
@ -115,7 +115,7 @@ public class DirectoryBucket {
|
|||
* remove a remote directory and all the files that the remote directory contains
|
||||
* @param bucket
|
||||
*/
|
||||
public String removeDirBucket(RequestObject resource, String bucket, String rootArea, String backendType, String[] dbNames){
|
||||
public String removeDirBucket(MyFile resource, String bucket, String rootArea, String backendType, String[] dbNames){
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("CHECK REMOVE: "+bucket);
|
||||
String[] bucketList=null;
|
||||
|
@ -205,7 +205,7 @@ public class DirectoryBucket {
|
|||
* @param bucketCoded bucketName coded
|
||||
* @param tm a client for the cluster
|
||||
*/
|
||||
public String searchInBucket(RequestObject resource, String name, String bucketCoded,
|
||||
public String searchInBucket(MyFile resource, String name, String bucketCoded,
|
||||
TransportManager tm, String rootArea) {
|
||||
Map <String, StorageObject> dirs=null;
|
||||
try{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.directoryOperation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ public class DirectoryEntity {
|
|||
setAuthor(author);
|
||||
}
|
||||
|
||||
public DirectoryEntity(String dir, String author, RequestObject file){
|
||||
public DirectoryEntity(String dir, String author, MyFile file){
|
||||
setDirectory(dir);
|
||||
setAuthor(author);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.impl;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.LOCAL_RESOURCE;
|
||||
/**
|
||||
* This class is used from methods that can have both a RemoteResource or a LocalResource
|
||||
|
@ -10,7 +10,7 @@ import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.LOCA
|
|||
*/
|
||||
public class AmbiguousResource extends RemoteResource {
|
||||
|
||||
public AmbiguousResource(RequestObject file, ServiceEngine engine) {
|
||||
public AmbiguousResource(MyFile file, ServiceEngine engine) {
|
||||
super(file, engine);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.impl;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.LOCAL_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
|
||||
|
@ -17,7 +17,7 @@ import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMO
|
|||
public class LocalResource extends Resource{
|
||||
|
||||
|
||||
public LocalResource(RequestObject file, ServiceEngine engine) {
|
||||
public LocalResource(MyFile file, ServiceEngine engine) {
|
||||
super(file, engine);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class LocalResource extends Resource{
|
|||
if(getMyFile() != null){
|
||||
getMyFile().setInputStream(is);
|
||||
}else{
|
||||
setMyFile(new RequestObject(engine.getGcubeMemoryType()));
|
||||
setMyFile(new MyFile(engine.getGcubeMemoryType()));
|
||||
getMyFile().setInputStream(is);
|
||||
}
|
||||
getMyFile().setLocalResource(LOCAL_RESOURCE.INPUT_STREAM);
|
||||
|
@ -62,7 +62,7 @@ public class LocalResource extends Resource{
|
|||
if(getMyFile() != null){
|
||||
getMyFile().setOutputStream(os);
|
||||
}else{
|
||||
setMyFile(new RequestObject(engine.getGcubeMemoryType()));
|
||||
setMyFile(new MyFile(engine.getGcubeMemoryType()));
|
||||
getMyFile().setOutputStream(os);
|
||||
}
|
||||
getMyFile().setLocalResource(LOCAL_RESOURCE.OUTPUT_STREAM);
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.net.UnknownHostException;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.DirectoryBucket;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.DirectoryEntity;
|
||||
|
@ -29,7 +29,7 @@ public class RemoteResource extends Resource{
|
|||
|
||||
TransportManager tm;
|
||||
|
||||
public RemoteResource(RequestObject file, ServiceEngine engine) {
|
||||
public RemoteResource(MyFile file, ServiceEngine engine) {
|
||||
super(file, engine);
|
||||
logger.info("file gCube parameter costructor: "+file.getGcubeAccessType()+" "+file.getGcubeScope());
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package org.gcube.contentmanagement.blobstorage.service.impl;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class RemoteResourceBoolean extends Resource{
|
|||
* @param file
|
||||
* @param engine
|
||||
*/
|
||||
public RemoteResourceBoolean(RequestObject file, ServiceEngine engine) {
|
||||
public RemoteResourceBoolean(MyFile file, ServiceEngine engine) {
|
||||
super(file, engine);
|
||||
logger.info("file gCube parameter costructor: "+file.getGcubeAccessType()+" "+file.getGcubeScope());
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.impl;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
||||
|
@ -12,7 +12,7 @@ import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendEx
|
|||
public class RemoteResourceComplexInfo extends Resource{
|
||||
|
||||
|
||||
public RemoteResourceComplexInfo(RequestObject file, ServiceEngine engine) {
|
||||
public RemoteResourceComplexInfo(MyFile file, ServiceEngine engine) {
|
||||
super(file, engine);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class RemoteResourceComplexInfo extends Resource{
|
|||
* @throws RemoteBackendException if there are runtime exception from the remote backend
|
||||
*/
|
||||
|
||||
public RequestObject RFile(String path) throws RemoteBackendException{
|
||||
public MyFile RFile(String path) throws RemoteBackendException{
|
||||
setMyFile(setGenericProperties(engine.getContext(), engine.owner, path, "remote"));
|
||||
getMyFile().setRemotePath(path);
|
||||
getMyFile().setRemoteResource(REMOTE_RESOURCE.PATH);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.impl;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
||||
|
@ -12,7 +12,7 @@ import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendEx
|
|||
*/
|
||||
public class RemoteResourceDestination extends Resource{
|
||||
|
||||
public RemoteResourceDestination(RequestObject file, ServiceEngine engine) {
|
||||
public RemoteResourceDestination(MyFile file, ServiceEngine engine) {
|
||||
super(file, engine);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.impl;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class RemoteResourceFolderInfo extends Resource {
|
|||
private String gcubeAccessType;
|
||||
private String gcubeMemoryType;
|
||||
|
||||
public RemoteResourceFolderInfo(RequestObject file, ServiceEngine engine) {
|
||||
public RemoteResourceFolderInfo(MyFile file, ServiceEngine engine) {
|
||||
super(file, engine);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.impl;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
||||
|
@ -14,7 +14,7 @@ import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendEx
|
|||
public class RemoteResourceInfo extends Resource{
|
||||
|
||||
|
||||
public RemoteResourceInfo(RequestObject file, ServiceEngine engine) {
|
||||
public RemoteResourceInfo(MyFile file, ServiceEngine engine) {
|
||||
super(file, engine);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.impl;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.LOCAL_RESOURCE;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,7 @@ import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.LOCA
|
|||
*/
|
||||
public class RemoteResourceSource extends Resource {
|
||||
|
||||
public RemoteResourceSource(RequestObject file, ServiceEngine engine) {
|
||||
public RemoteResourceSource(MyFile file, ServiceEngine engine) {
|
||||
super(file, engine);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.impl;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.util.Costants;
|
||||
|
@ -19,11 +19,11 @@ public class Resource {
|
|||
|
||||
final Logger logger = LoggerFactory.getLogger(ServiceEngine.class);
|
||||
protected static final String BACKEND_STRING_SEPARATOR="%";
|
||||
protected RequestObject file;
|
||||
protected MyFile file;
|
||||
protected ServiceEngine engine;
|
||||
|
||||
|
||||
public Resource(RequestObject file, ServiceEngine engine){
|
||||
public Resource(MyFile file, ServiceEngine engine){
|
||||
setMyFile(file);
|
||||
setEngine(engine);
|
||||
}
|
||||
|
@ -36,11 +36,11 @@ public class Resource {
|
|||
this.engine = engine;
|
||||
}
|
||||
|
||||
protected RequestObject getMyFile(){
|
||||
protected MyFile getMyFile(){
|
||||
return file;
|
||||
}
|
||||
|
||||
protected void setMyFile(RequestObject f){
|
||||
protected void setMyFile(MyFile f){
|
||||
if (f!=null)
|
||||
file=f;
|
||||
else
|
||||
|
@ -56,11 +56,11 @@ public class Resource {
|
|||
* @param type remote or local
|
||||
* @return the current resource
|
||||
*/
|
||||
protected RequestObject setGenericProperties(String context, String owner, String path, String type) {
|
||||
protected MyFile setGenericProperties(String context, String owner, String path, String type) {
|
||||
if((path != null) && (path.length()>0)){
|
||||
if(ObjectId.isValid(path)){
|
||||
if(file==null)
|
||||
file= new RequestObject(path, engine.getGcubeMemoryType());
|
||||
file= new MyFile(path, engine.getGcubeMemoryType());
|
||||
String id = file.getId();
|
||||
if((id != null) && (!id.isEmpty()))
|
||||
file.setId2(path);
|
||||
|
@ -75,7 +75,7 @@ public class Resource {
|
|||
logger.debug("path(String) - name: " + name);
|
||||
}
|
||||
if(file == null){
|
||||
file= new RequestObject(name, engine.getGcubeMemoryType());
|
||||
file= new MyFile(name, engine.getGcubeMemoryType());
|
||||
}else{
|
||||
file.setName(name);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class Resource {
|
|||
return file;
|
||||
}
|
||||
|
||||
protected Object getRemoteObject(RequestObject file, String[] backend, String[] vltBackend)throws RemoteBackendException {
|
||||
protected Object getRemoteObject(MyFile file, String[] backend, String[] vltBackend)throws RemoteBackendException {
|
||||
Object obj=null;
|
||||
try{
|
||||
obj=retrieveRemoteObject(file, backend);
|
||||
|
@ -122,7 +122,7 @@ public class Resource {
|
|||
return obj;
|
||||
}
|
||||
|
||||
protected Object retrieveRemoteObject(RequestObject file, String[] backend) throws RemoteBackendException {
|
||||
protected Object retrieveRemoteObject(MyFile file, String[] backend) throws RemoteBackendException {
|
||||
Object obj=null;
|
||||
if(((file.getInputStream() != null) || (file.getOutputStream()!=null)) || ((file.getLocalPath() != null) || (file.getRemotePath() != null)))
|
||||
obj=engine.service.startOperation(file,file.getRemotePath(), file.getOwner(), backend, Costants.DEFAULT_CHUNK_OPTION, file.getRootPath(), file.isReplace());
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.AccessType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.StorageObject;
|
||||
|
@ -45,7 +45,7 @@ public class ServiceEngine implements IClient {
|
|||
public String[] primaryBackend;
|
||||
public String[] volatileBackend;
|
||||
protected OperationManager service;
|
||||
protected RequestObject file;
|
||||
protected MyFile file;
|
||||
protected String bucket;
|
||||
protected String bucketID;
|
||||
protected String author;
|
||||
|
@ -414,7 +414,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResource remove(String backendType){
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(getGcubeMemoryType());
|
||||
file=new MyFile(getGcubeMemoryType());
|
||||
file.setGcubeAccessType(this.getGcubeAccessType());
|
||||
file.setGcubeScope(this.getGcubeScope());
|
||||
file.setOwnerGcube(this.getOwnerGcube());
|
||||
|
@ -428,11 +428,11 @@ public class ServiceEngine implements IClient {
|
|||
}
|
||||
|
||||
|
||||
public RequestObject getMyFile() {
|
||||
public MyFile getMyFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setMyFile(RequestObject myFile) {
|
||||
public void setMyFile(MyFile myFile) {
|
||||
this.file = myFile;
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResource showDir(String backendType){
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setGcubeAccessType(this.getGcubeAccessType());
|
||||
file.setGcubeScope(this.getGcubeScope());
|
||||
file.setOwnerGcube(this.getOwnerGcube());
|
||||
|
@ -497,7 +497,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResource removeDir(String backendType){
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setGcubeAccessType(this.getGcubeAccessType());
|
||||
file.setGcubeScope(this.getGcubeScope());
|
||||
file.setOwnerGcube(this.getOwnerGcube());
|
||||
|
@ -529,7 +529,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResource getUrl(String backendType, boolean forceCreation){
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setGcubeAccessType(this.getGcubeAccessType());
|
||||
file.setGcubeScope(this.getGcubeScope());
|
||||
file.setOwnerGcube(this.getOwnerGcube());
|
||||
|
@ -564,7 +564,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResource getHttpUrl(String backendType, boolean forceCreation){
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setGcubeAccessType(this.getGcubeAccessType());
|
||||
file.setGcubeScope(this.getGcubeScope());
|
||||
file.setOwnerGcube(this.getOwnerGcube());
|
||||
|
@ -601,7 +601,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResource getHttpsUrl(String backendType, boolean forceCreation){
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setGcubeAccessType(this.getGcubeAccessType());
|
||||
file.setGcubeScope(this.getGcubeScope());
|
||||
file.setOwnerGcube(this.getOwnerGcube());
|
||||
|
@ -674,7 +674,7 @@ public class ServiceEngine implements IClient {
|
|||
|
||||
public AmbiguousResource lock(String backendType) {
|
||||
backendType=setBackendType(backendType);
|
||||
file = new RequestObject(true);
|
||||
file = new MyFile(true);
|
||||
setCurrentOperation("lock");
|
||||
this.service=new OperationManager(primaryBackend, user, password, getCurrentOperation(), file, backendType, getDbNames(), getToken());
|
||||
file=setOperationInfo(file, OPERATION.LOCK);
|
||||
|
@ -690,7 +690,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public AmbiguousResource unlock(String key, String backendType) {
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setLockedKey(key);
|
||||
// put(true);
|
||||
setCurrentOperation("unlock");
|
||||
|
@ -708,7 +708,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResourceInfo getTTL(String backendType) {
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
// put(true);
|
||||
setCurrentOperation("getTTL");
|
||||
file=setOperationInfo(file, OPERATION.GET_TTL);
|
||||
|
@ -726,7 +726,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResource getMetaInfo(String field, String backendType) {
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setGenericPropertyField(field);
|
||||
setCurrentOperation("getMetaInfo");
|
||||
file=setOperationInfo(file, OPERATION.GET_META_INFO);
|
||||
|
@ -742,7 +742,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResource setMetaInfo(String field, String value, String backendType) {
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setGenericPropertyField(field);
|
||||
file.setGenericPropertyValue(value);
|
||||
setCurrentOperation("setMetaInfo");
|
||||
|
@ -759,7 +759,7 @@ public class ServiceEngine implements IClient {
|
|||
@Override
|
||||
public RemoteResourceInfo renewTTL(String key, String backendType) {
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setLockedKey(key);
|
||||
// put(true);
|
||||
setCurrentOperation("renewTTL");
|
||||
|
@ -1001,9 +1001,9 @@ public class ServiceEngine implements IClient {
|
|||
// this.gcubeMemoryType = gcubeMemoryType;
|
||||
}
|
||||
|
||||
private RequestObject setOperationInfo(RequestObject file, OPERATION op) {
|
||||
private MyFile setOperationInfo(MyFile file, OPERATION op) {
|
||||
if(file==null)
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setOperation(op);
|
||||
if(getWriteConcern() != null)
|
||||
file.setWriteConcern(getWriteConcern());
|
||||
|
@ -1016,9 +1016,9 @@ public class ServiceEngine implements IClient {
|
|||
return file;
|
||||
}
|
||||
|
||||
private RequestObject setMimeType(RequestObject file, String mime) {
|
||||
private MyFile setMimeType(MyFile file, String mime) {
|
||||
if(file==null)
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
file.setMimeType(mime);
|
||||
return file;
|
||||
}
|
||||
|
@ -1097,7 +1097,7 @@ public class ServiceEngine implements IClient {
|
|||
|
||||
public RemoteResource getRemotePath(){
|
||||
backendType=setBackendType(backendType);
|
||||
file=new RequestObject(this.getGcubeMemoryType());
|
||||
file=new MyFile(this.getGcubeMemoryType());
|
||||
// put(true);
|
||||
setCurrentOperation("getRemotePath");
|
||||
file=setOperationInfo(file, OPERATION.GET_REMOTE_PATH);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.operation.UploadOperator;
|
||||
|
@ -28,7 +28,7 @@ public class ChunkConsumer implements Runnable {
|
|||
boolean isChunk=false;
|
||||
String[] dbNames;
|
||||
public static ThreadLocal<TransportManager> client=new ThreadLocal<TransportManager>();
|
||||
public static ThreadLocal<RequestObject> resource=new ThreadLocal<RequestObject>();
|
||||
public static ThreadLocal<MyFile> resource=new ThreadLocal<MyFile>();
|
||||
private boolean replaceOpt;
|
||||
Thread producer;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ChunkConsumer implements Runnable {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("run() - start");
|
||||
}
|
||||
RequestObject request = null;
|
||||
MyFile request = null;
|
||||
synchronized (ChunkConsumer.class) {
|
||||
request=monitor.getRequest();
|
||||
resource.set(request);
|
||||
|
@ -48,7 +48,7 @@ public class ChunkConsumer implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
private void connection(RequestObject richiesta) {
|
||||
private void connection(MyFile richiesta) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("connection(MyFile) - start");
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class ChunkConsumer implements Runnable {
|
|||
return server;
|
||||
}
|
||||
|
||||
private void putInTerrastore(RequestObject myFile) {
|
||||
private void putInTerrastore(MyFile myFile) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("putInTerrastore(MyFile) - start");
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.concurrent.ExecutorService;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.util.Costants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
|
|||
*/
|
||||
public class ChunkProducer implements Runnable{
|
||||
|
||||
RequestObject resource;
|
||||
MyFile resource;
|
||||
long dimensionChunk;
|
||||
int totChunks;
|
||||
int nThreads;
|
||||
|
@ -31,7 +31,7 @@ public class ChunkProducer implements Runnable{
|
|||
String bucketName;
|
||||
final Logger logger=LoggerFactory.getLogger(ChunkProducer.class);
|
||||
|
||||
public ChunkProducer(Monitor monitor, RequestObject resource, long dimensionChunk, int totChunks,
|
||||
public ChunkProducer(Monitor monitor, MyFile resource, long dimensionChunk, int totChunks,
|
||||
int nThreads, String bucket, ChunkConsumer consumer ) throws FileNotFoundException{
|
||||
this.resource=resource;
|
||||
this.dimensionChunk=dimensionChunk;
|
||||
|
@ -77,7 +77,7 @@ public class ChunkProducer implements Runnable{
|
|||
//---- creo i task e li invio al thread-pool ----
|
||||
String key= getBucketName()+i;
|
||||
resource.setKey(key);
|
||||
RequestObject copy=resource.copyProperties();
|
||||
MyFile copy=resource.copyProperties();
|
||||
copy.setContent(chunk);
|
||||
if(logger.isDebugEnabled()){
|
||||
logger.debug("request in queue: "+key);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -19,12 +19,12 @@ public abstract class Copy extends Operation{
|
|||
final Logger logger=LoggerFactory.getLogger(Copy.class);
|
||||
protected String sourcePath;
|
||||
protected String destinationPath;
|
||||
protected RequestObject resource;
|
||||
protected MyFile resource;
|
||||
public Copy(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
this.sourcePath=file.getLocalPath();
|
||||
this.destinationPath=remotePath;
|
||||
|
@ -37,7 +37,7 @@ public abstract class Copy extends Operation{
|
|||
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -55,7 +55,7 @@ public abstract class Copy extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String remotePath,
|
||||
public String initOperation(MyFile resource, String remotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// For terrastore, the name of bucket is formed: path_____fileName_____author
|
||||
this.sourcePath=resource.getLocalPath();
|
||||
|
@ -70,12 +70,12 @@ public abstract class Copy extends Operation{
|
|||
|
||||
// public abstract String execute(MongoIO mongoPrimaryInstance) throws UnknownHostException;
|
||||
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, RequestObject resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
public RequestObject getResource() {
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MyFile resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -23,13 +23,13 @@ public abstract class CopyDir extends Operation{
|
|||
final Logger logger=LoggerFactory.getLogger(Download.class);
|
||||
private String sourcePath;
|
||||
private String destinationPath;
|
||||
private RequestObject resource;
|
||||
private MyFile resource;
|
||||
|
||||
public CopyDir(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
this.sourcePath=file.getLocalPath();
|
||||
this.destinationPath=remotePath;
|
||||
|
@ -40,7 +40,7 @@ public abstract class CopyDir extends Operation{
|
|||
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
TransportManager tm = getTransport(myFile);
|
||||
List<String> ids=null;
|
||||
try {
|
||||
|
@ -58,7 +58,7 @@ public abstract class CopyDir extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String remotePath,
|
||||
public String initOperation(MyFile resource, String remotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// DirectoryBucket dirBuc=new DirectoryBucket(server, user, password, remotePath, author);
|
||||
// For terrastore, the name of bucket is formed: path_____fileName_____author
|
||||
|
@ -71,7 +71,7 @@ public abstract class CopyDir extends Operation{
|
|||
return bucket=destinationPath;
|
||||
}
|
||||
|
||||
public abstract List<String> execute(MongoIOManager mongoPrimaryInstance, RequestObject resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
public abstract List<String> execute(MongoIOManager mongoPrimaryInstance, MyFile resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
|
||||
public String getSourcePath() {
|
||||
return sourcePath;
|
||||
|
@ -89,11 +89,11 @@ public abstract class CopyDir extends Operation{
|
|||
this.destinationPath = destinationPath;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -27,13 +27,13 @@ public abstract class Download extends Operation{
|
|||
protected String localPath;
|
||||
protected String remotePath;
|
||||
protected OutputStream os;
|
||||
protected RequestObject resource;
|
||||
protected MyFile resource;
|
||||
|
||||
public Download(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
this.localPath=file.getLocalPath();
|
||||
this.remotePath=remotePath;
|
||||
|
@ -41,7 +41,7 @@ public abstract class Download extends Operation{
|
|||
return getRemoteIdentifier(remotePath, rootArea);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
String id=null;
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(" DOWNLOAD " + myFile.getRemotePath()
|
||||
|
@ -64,7 +64,7 @@ public abstract class Download extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String remotePath,
|
||||
public String initOperation(MyFile resource, String remotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// DirectoryBucket dirBuc=new DirectoryBucket(server, getUser(), getPassword(), remotePath, author);
|
||||
// For terrastore, the name of bucket is formed: path_____fileName_____author
|
||||
|
@ -77,11 +77,11 @@ public abstract class Download extends Operation{
|
|||
|
||||
public abstract ObjectId execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance) throws IOException;
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
@ -30,7 +30,7 @@ public class DownloadAndLock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException {
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(" DOWNLOAD " + myFile.getRemotePath()
|
||||
+ " in bucket: " + getBucket());
|
||||
|
@ -50,7 +50,7 @@ public class DownloadAndLock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String RemotePath,
|
||||
public String initOperation(MyFile file, String RemotePath,
|
||||
String author, String[] server, String rootArea,
|
||||
boolean replaceOption) {
|
||||
this.localPath=file.getLocalPath();
|
||||
|
@ -59,7 +59,7 @@ public class DownloadAndLock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -24,13 +24,13 @@ public abstract class DuplicateFile extends Operation {
|
|||
*/
|
||||
final Logger logger=LoggerFactory.getLogger(DuplicateFile.class);
|
||||
protected String sourcePath;
|
||||
protected RequestObject resource;
|
||||
protected MyFile resource;
|
||||
|
||||
public DuplicateFile(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -48,7 +48,7 @@ public abstract class DuplicateFile extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath, String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
public String initOperation(MyFile file, String remotePath, String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
if(remotePath != null){
|
||||
boolean isId=ObjectId.isValid(remotePath);
|
||||
setResource(file);
|
||||
|
@ -67,7 +67,7 @@ public abstract class DuplicateFile extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
@ -82,11 +82,11 @@ public abstract class DuplicateFile extends Operation {
|
|||
this.sourcePath = sourcePath;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
|
@ -30,7 +30,7 @@ public class Exist extends Operation{
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -47,7 +47,7 @@ public class Exist extends Operation{
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
// String[] dirs= remotePath.split(file_separator);
|
||||
if(logger.isDebugEnabled())
|
||||
|
@ -64,7 +64,7 @@ public class Exist extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with Exist operation");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
|
||||
//import org.apache.log4j.Logger;
|
||||
//import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.io.IOException;
|
||||
|
@ -36,7 +36,7 @@ public class FileWriter extends Thread{
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("run() - start");
|
||||
}
|
||||
RequestObject request = monitor.getRequest();
|
||||
MyFile request = monitor.getRequest();
|
||||
synchronized (FileWriter.class) {
|
||||
if(logger.isDebugEnabled()){
|
||||
logger.debug("recover request: "+request.getKey()+" length: "+request.getContent().length);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
@ -19,7 +19,7 @@ public class ForceClose extends Operation{
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -34,14 +34,14 @@ public class ForceClose extends Operation{
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.DirectoryBucket;
|
||||
import org.gcube.contentmanagement.blobstorage.service.impl.ServiceEngine;
|
||||
|
@ -22,7 +22,7 @@ public class GetFolderCount extends Operation {
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType,dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -39,7 +39,7 @@ public class GetFolderCount extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("remotePath: "+remotePath);
|
||||
|
@ -57,7 +57,7 @@ public class GetFolderCount extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.DirectoryBucket;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
@ -19,12 +19,12 @@ public class GetFolderLastUpdate extends Operation {
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
// String[] dirs= remotePath.split(file_separator);
|
||||
if(logger.isDebugEnabled())
|
||||
|
@ -43,7 +43,7 @@ public class GetFolderLastUpdate extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.DirectoryBucket;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
|
@ -21,7 +21,7 @@ public class GetFolderSize extends Operation {
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -38,7 +38,7 @@ public class GetFolderSize extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
// String[] dirs= remotePath.split(file_separator);
|
||||
if(logger.isDebugEnabled())
|
||||
|
@ -58,7 +58,7 @@ public class GetFolderSize extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.io.IOException;
|
|||
import java.net.URL;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.Encrypter;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.Encrypter.EncryptionException;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
|
@ -27,13 +27,13 @@ public class GetHttpUrl extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath, String author,
|
||||
public String initOperation(MyFile file, String remotePath, String author,
|
||||
String[] server, String rootArea, boolean replaceOption) {
|
||||
return getRemoteIdentifier(remotePath, rootArea);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
@ -41,7 +41,7 @@ public class GetHttpUrl extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public Object doIt(RequestObject myFile) throws RemoteBackendException {
|
||||
public Object doIt(MyFile myFile) throws RemoteBackendException {
|
||||
String resolverHost=myFile.getResolverHOst();
|
||||
String urlBase="smp://"+resolverHost+Costants.URL_SEPARATOR;
|
||||
String urlParam="";
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.net.URL;
|
|||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.Encrypter;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.Encrypter.EncryptionException;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
|
@ -29,13 +29,13 @@ public class GetHttpsUrl extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath, String author,
|
||||
public String initOperation(MyFile file, String remotePath, String author,
|
||||
String[] server, String rootArea, boolean replaceOption) {
|
||||
return getRemoteIdentifier(remotePath, rootArea);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
@ -43,7 +43,7 @@ public class GetHttpsUrl extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public Object doIt(RequestObject myFile) throws RemoteBackendException {
|
||||
public Object doIt(MyFile myFile) throws RemoteBackendException {
|
||||
String resolverHost=myFile.getResolverHOst();
|
||||
String urlBase="smp://"+resolverHost+Costants.URL_SEPARATOR;
|
||||
String urlParam="";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -30,7 +30,7 @@ public class GetMetaFile extends Operation{
|
|||
* size.
|
||||
*
|
||||
*/
|
||||
public RequestObject doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public MyFile doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -61,7 +61,7 @@ public class GetMetaFile extends Operation{
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
// String[] dirs= remotePath.split(file_separator);
|
||||
if(logger.isDebugEnabled())
|
||||
|
@ -78,7 +78,7 @@ public class GetMetaFile extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -20,7 +20,7 @@ public class GetMetaInfo extends Operation {
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -38,7 +38,7 @@ public class GetMetaInfo extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
// String[] dirs= remotePath.split(file_separator);
|
||||
if(logger.isDebugEnabled())
|
||||
|
@ -55,7 +55,7 @@ public class GetMetaInfo extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("method not compatible with getMetaInfo operation");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
@ -20,7 +20,7 @@ public class GetRemotePath extends Operation{
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType,dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -45,7 +45,7 @@ public class GetRemotePath extends Operation{
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
rootPath=file.getRootPath();
|
||||
logger.trace("rootArea is "+file.getRootPath()+ " absoluteremotepath is "+file.getAbsoluteRemotePath());
|
||||
|
@ -61,7 +61,7 @@ public class GetRemotePath extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -27,7 +27,7 @@ public class GetSize extends Operation{
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -44,7 +44,7 @@ public class GetSize extends Operation{
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("remotePath: "+remotePath);
|
||||
|
@ -60,7 +60,7 @@ public class GetSize extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
|
@ -27,7 +27,7 @@ public class GetTTL extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException {
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(" DOWNLOAD " + myFile.getRemotePath()
|
||||
+ " in bucket: " + bucket);
|
||||
|
@ -48,7 +48,7 @@ public class GetTTL extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea,
|
||||
boolean replaceOption) {
|
||||
this.localPath=file.getLocalPath();
|
||||
|
@ -60,7 +60,7 @@ public class GetTTL extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.Encrypter;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.Encrypter.EncryptionException;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
|
@ -21,13 +21,13 @@ public class GetUrl extends Operation{
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath, String author,
|
||||
public String initOperation(MyFile file, String remotePath, String author,
|
||||
String[] server, String rootArea, boolean replaceOption) {
|
||||
return getRemoteIdentifier(remotePath, rootArea);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
@ -35,7 +35,7 @@ public class GetUrl extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public Object doIt(RequestObject myFile) throws RemoteBackendException {
|
||||
public Object doIt(MyFile myFile) throws RemoteBackendException {
|
||||
String resolverHost=myFile.getResolverHOst();
|
||||
String urlBase="smp://"+resolverHost+Costants.URL_SEPARATOR;
|
||||
String urlParam="";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.DirectoryBucket;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
|
@ -19,7 +19,7 @@ public class GetUserTotalItems extends Operation {
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -38,7 +38,7 @@ public class GetUserTotalItems extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
setOwner(author);
|
||||
if((remotePath != null) && (remotePath.length() > 0)){
|
||||
|
@ -64,7 +64,7 @@ public class GetUserTotalItems extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.DirectoryBucket;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
|
@ -19,7 +19,7 @@ public class GetUserTotalVolume extends Operation {
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -38,7 +38,7 @@ public class GetUserTotalVolume extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
setOwner(author);
|
||||
if(remotePath!= null && remotePath.length()>0){
|
||||
|
@ -63,7 +63,7 @@ public class GetUserTotalVolume extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -20,12 +20,12 @@ public abstract class Link extends Operation{
|
|||
final Logger logger=LoggerFactory.getLogger(Download.class);
|
||||
private String sourcePath;
|
||||
private String destinationPath;
|
||||
private RequestObject resource;
|
||||
private MyFile resource;
|
||||
public Link(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
this.sourcePath=file.getLocalPath();
|
||||
this.destinationPath=remotePath;
|
||||
|
@ -36,7 +36,7 @@ public abstract class Link extends Operation{
|
|||
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -53,7 +53,7 @@ public abstract class Link extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String remotePath,
|
||||
public String initOperation(MyFile resource, String remotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// For terrastore, the name of bucket is formed: path_____fileName_____author
|
||||
// String bucketName=new BucketCoding().bucketFileCoding(remotePath, rootArea);
|
||||
|
@ -65,7 +65,7 @@ public abstract class Link extends Operation{
|
|||
return bucket=destinationPath;
|
||||
}
|
||||
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, RequestObject resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, MyFile resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
|
||||
public String getSourcePath() {
|
||||
return sourcePath;
|
||||
|
@ -83,11 +83,11 @@ public abstract class Link extends Operation{
|
|||
this.destinationPath = destinationPath;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -24,7 +24,7 @@ public abstract class Lock extends Operation {
|
|||
protected String localPath;
|
||||
protected String remotePath;
|
||||
protected OutputStream os;
|
||||
protected RequestObject resource;
|
||||
protected MyFile resource;
|
||||
protected Download download;
|
||||
|
||||
public Lock(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
|
@ -33,7 +33,7 @@ public abstract class Lock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException {
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(" DOWNLOAD " + myFile.getRemotePath()
|
||||
+ " in bucket: " + getBucket());
|
||||
|
@ -54,7 +54,7 @@ public abstract class Lock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea,
|
||||
boolean replaceOption) {
|
||||
String bucketName=null;
|
||||
|
@ -73,13 +73,13 @@ public abstract class Lock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, RequestObject resource, String serverLocation) throws Exception;
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, MyFile resource, String serverLocation) throws Exception;
|
||||
|
||||
public String getLocalPath() {
|
||||
return localPath;
|
||||
|
@ -105,11 +105,11 @@ public abstract class Lock extends Operation {
|
|||
this.os = os;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
|
||||
//import org.apache.log4j.Logger;
|
||||
//import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.util.Costants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -22,9 +22,9 @@ public class Monitor {
|
|||
// private static final GCUBELog logger = new GCUBELog(Monitor.class);
|
||||
final Logger logger=LoggerFactory.getLogger(Monitor.class);
|
||||
// request queue
|
||||
private Vector<RequestObject> requestQueue = new Vector<RequestObject>();
|
||||
private Vector<MyFile> requestQueue = new Vector<MyFile>();
|
||||
// fetch the first request in the queue
|
||||
public synchronized RequestObject getRequest(){
|
||||
public synchronized MyFile getRequest(){
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("getRequest() - start");
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class Monitor {
|
|||
logger.error("getRequest()", e);
|
||||
}
|
||||
}
|
||||
RequestObject myFile=requestQueue.remove(0);
|
||||
MyFile myFile=requestQueue.remove(0);
|
||||
notifyAll();
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("getRequest() - end");
|
||||
|
@ -44,7 +44,7 @@ public class Monitor {
|
|||
return myFile;
|
||||
}
|
||||
|
||||
public synchronized RequestObject getRequest(ChunkProducer producer){
|
||||
public synchronized MyFile getRequest(ChunkProducer producer){
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("getRequest(ChunkProducer) - start");
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class Monitor {
|
|||
logger.error("getRequest(ChunkProducer)", e);
|
||||
}
|
||||
}
|
||||
RequestObject myFile=requestQueue.remove(0);
|
||||
MyFile myFile=requestQueue.remove(0);
|
||||
notifyAll();
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("getRequest(ChunkProducer) - end");
|
||||
|
@ -65,7 +65,7 @@ public class Monitor {
|
|||
}
|
||||
|
||||
// Accoda una nuova richiesta
|
||||
public synchronized void putRequest(RequestObject richiesta){
|
||||
public synchronized void putRequest(MyFile richiesta){
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("putRequest(MyFile) - start");
|
||||
logger.debug("request in queue, queue size: "+requestQueue.size());
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.io.OutputStream;
|
|||
import java.net.UnknownHostException;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.DirectoryBucket;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
|
@ -23,12 +23,12 @@ public abstract class Move extends Operation{
|
|||
final Logger logger=LoggerFactory.getLogger(Download.class);
|
||||
protected String sourcePath;
|
||||
protected String destinationPath;
|
||||
protected RequestObject resource;
|
||||
protected MyFile resource;
|
||||
public Move(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
this.sourcePath=file.getLocalPath();
|
||||
this.destinationPath=remotePath;
|
||||
|
@ -39,7 +39,7 @@ public abstract class Move extends Operation{
|
|||
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -57,7 +57,7 @@ public abstract class Move extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String remotePath,
|
||||
public String initOperation(MyFile resource, String remotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
this.sourcePath=resource.getLocalPath();
|
||||
this.destinationPath=resource.getRemotePath();
|
||||
|
@ -67,7 +67,7 @@ public abstract class Move extends Operation{
|
|||
return bucket=destinationPath;
|
||||
}
|
||||
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MemoryType memoryType, RequestObject resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MemoryType memoryType, MyFile resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
|
||||
public String getSourcePath() {
|
||||
return sourcePath;
|
||||
|
@ -85,11 +85,11 @@ public abstract class Move extends Operation{
|
|||
this.destinationPath = destinationPath;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.net.UnknownHostException;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -21,13 +21,13 @@ public abstract class MoveDir extends Operation{
|
|||
final Logger logger=LoggerFactory.getLogger(Download.class);
|
||||
private String sourcePath;
|
||||
private String destinationPath;
|
||||
private RequestObject resource;
|
||||
private MyFile resource;
|
||||
// private OutputStream os;
|
||||
public MoveDir(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
this.sourcePath=file.getLocalPath();
|
||||
this.destinationPath=remotePath;
|
||||
|
@ -38,7 +38,7 @@ public abstract class MoveDir extends Operation{
|
|||
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -55,7 +55,7 @@ public abstract class MoveDir extends Operation{
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String remotePath,
|
||||
public String initOperation(MyFile resource, String remotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
this.sourcePath=resource.getLocalPath();
|
||||
this.destinationPath=resource.getRemotePath();
|
||||
|
@ -65,7 +65,7 @@ public abstract class MoveDir extends Operation{
|
|||
return bucket=destinationPath;
|
||||
}
|
||||
|
||||
public abstract List<String> execute(MongoIOManager mongoPrimaryInstance, RequestObject resource, String sourcePath, String destinationPath, MemoryType memoryType) throws UnknownHostException;
|
||||
public abstract List<String> execute(MongoIOManager mongoPrimaryInstance, MyFile resource, String sourcePath, String destinationPath, MemoryType memoryType) throws UnknownHostException;
|
||||
|
||||
public String getSourcePath() {
|
||||
return sourcePath;
|
||||
|
@ -83,11 +83,11 @@ public abstract class MoveDir extends Operation{
|
|||
this.destinationPath = destinationPath;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.service.impl.ServiceEngine;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
|
@ -99,7 +99,7 @@ public abstract class Operation {
|
|||
* @return a String that identifies a file
|
||||
* @throws Exception
|
||||
*/
|
||||
public String put(Upload upload, RequestObject resource, boolean isChunk, boolean isBase64, boolean replaceOption, boolean isLock) throws Exception{
|
||||
public String put(Upload upload, MyFile resource, boolean isChunk, boolean isBase64, boolean replaceOption, boolean isLock) throws Exception{
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("put(MyFile, boolean, boolean) - start");
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public abstract class Operation {
|
|||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public String get(Download download, RequestObject myFile, boolean isLock) throws IOException, InterruptedException, Exception {
|
||||
public String get(Download download, MyFile myFile, boolean isLock) throws IOException, InterruptedException, Exception {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("get(String) - start");
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public abstract class Operation {
|
|||
startPThreadChunk(download, myFile, tm, path);
|
||||
|
||||
}else{
|
||||
unlocKey=tm.downloadManager(download, myFile, bucket, RequestObject.class);
|
||||
unlocKey=tm.downloadManager(download, myFile, bucket, MyFile.class);
|
||||
}
|
||||
|
||||
if((path!=null) && (new File(path).length()>0)){
|
||||
|
@ -210,12 +210,12 @@ public abstract class Operation {
|
|||
* @throws InterruptedException
|
||||
* @throws IOException
|
||||
*/
|
||||
protected void startPThreadChunk(Download download,RequestObject myFile, TransportManager tm,
|
||||
protected void startPThreadChunk(Download download,MyFile myFile, TransportManager tm,
|
||||
String path) throws FileNotFoundException, InterruptedException,
|
||||
IOException {
|
||||
ExecutorService executor = Executors.newFixedThreadPool (2);
|
||||
int j=0;
|
||||
RequestObject value=null;
|
||||
MyFile value=null;
|
||||
|
||||
if(logger.isInfoEnabled())
|
||||
logger.info("localPath: "+path+" bucket: "+bucket);
|
||||
|
@ -229,7 +229,7 @@ public abstract class Operation {
|
|||
logger.debug("get(String) -");
|
||||
}
|
||||
try{
|
||||
value=(RequestObject) tm.get(download);
|
||||
value=(MyFile) tm.get(download);
|
||||
}catch(Exception e){
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("get(String) - \n Trovate " + (j) + " key");
|
||||
|
@ -283,7 +283,7 @@ public abstract class Operation {
|
|||
* @return a generic object that contains operation results
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public abstract Object doIt(RequestObject myFile) throws RemoteBackendException;
|
||||
public abstract Object doIt(MyFile myFile) throws RemoteBackendException;
|
||||
|
||||
/**
|
||||
* init a operation
|
||||
|
@ -295,7 +295,7 @@ public abstract class Operation {
|
|||
* @param replaceOption if true the file will be replaced
|
||||
* @return a string that identifies the operation
|
||||
*/
|
||||
public abstract String initOperation(RequestObject file, String remoteIdentifier, String author, String[] server, String rootArea, boolean replaceOption);
|
||||
public abstract String initOperation(MyFile file, String remoteIdentifier, String author, String[] server, String rootArea, boolean replaceOption);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -307,7 +307,7 @@ public abstract class Operation {
|
|||
* @param rootArea remote root path
|
||||
* @return a string that identifies the operation
|
||||
*/
|
||||
public abstract String initOperation(RequestObject resource, String remoteIdentifier, String author, String[] server, String rootArea);
|
||||
public abstract String initOperation(MyFile resource, String remoteIdentifier, String author, String[] server, String rootArea);
|
||||
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
|
@ -381,7 +381,7 @@ public abstract class Operation {
|
|||
this.user = user;
|
||||
}
|
||||
|
||||
protected TransportManager getTransport(RequestObject myFile) {
|
||||
protected TransportManager getTransport(MyFile myFile) {
|
||||
// if(Objects.isNull(transport)) {
|
||||
TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
transport=tmf.getTransport(transport, backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -21,7 +21,7 @@ public class OperationManager {
|
|||
private String[] server;
|
||||
// private int dimension;
|
||||
private String operation;
|
||||
private RequestObject resource;
|
||||
private MyFile resource;
|
||||
private boolean isChunk;
|
||||
private String bucketName;
|
||||
private String fileDest;
|
||||
|
@ -33,7 +33,7 @@ public class OperationManager {
|
|||
|
||||
|
||||
|
||||
public OperationManager(String[] server, String user, String password, String operation, RequestObject myFile, String backendType, String[] dbs, String token){
|
||||
public OperationManager(String[] server, String user, String password, String operation, MyFile myFile, String backendType, String[] dbs, String token){
|
||||
this.setServer(server);
|
||||
this.setUser(user);
|
||||
this.setPassword(password);
|
||||
|
@ -45,7 +45,7 @@ public class OperationManager {
|
|||
|
||||
}
|
||||
|
||||
public Object startOperation(RequestObject file, String remotePath, String author, String[] server, boolean chunkOpt, String rootArea, boolean replaceOption) throws RemoteBackendException{
|
||||
public Object startOperation(MyFile file, String remotePath, String author, String[] server, boolean chunkOpt, String rootArea, boolean replaceOption) throws RemoteBackendException{
|
||||
// setUser(author);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("connection(boolean) - start");
|
||||
|
@ -122,11 +122,11 @@ public class OperationManager {
|
|||
this.operation = operation;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -24,7 +24,7 @@ public class Remove extends Operation{
|
|||
super(server,user,pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -36,7 +36,7 @@ public class Remove extends Operation{
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
String[] dirs= remotePath.split(Costants.FILE_SEPARATOR);
|
||||
if(logger.isDebugEnabled())
|
||||
|
@ -64,7 +64,7 @@ public class Remove extends Operation{
|
|||
* @param bucketName indicates the remote directory to remove
|
||||
* @throws RemoteBackendException
|
||||
*/
|
||||
public void removeBucket(TransportManager tm, String bucketName, RequestObject resource) throws RemoteBackendException {
|
||||
public void removeBucket(TransportManager tm, String bucketName, MyFile resource) throws RemoteBackendException {
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("removing file bucket: "+bucketName);
|
||||
try {
|
||||
|
@ -77,7 +77,7 @@ public class Remove extends Operation{
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with remove operation");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -29,7 +29,7 @@ public class RenewTTL extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException {
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException {
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -45,7 +45,7 @@ public class RenewTTL extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea,
|
||||
boolean replaceOption) {
|
||||
this.localPath=file.getLocalPath();
|
||||
|
@ -56,7 +56,7 @@ public class RenewTTL extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -20,7 +20,7 @@ public class SetMetaInfo extends Operation {
|
|||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -38,7 +38,7 @@ public class SetMetaInfo extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("remotePath: "+remotePath);
|
||||
|
@ -54,7 +54,7 @@ public class SetMetaInfo extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
throw new IllegalArgumentException("Input/Output stream is not compatible with getSize operation");
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
import java.net.UnknownHostException;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -27,14 +27,14 @@ public abstract class SoftCopy extends Operation {
|
|||
final Logger logger=LoggerFactory.getLogger(SoftCopy.class);
|
||||
private String sourcePath;
|
||||
private String destinationPath;
|
||||
private RequestObject resource;
|
||||
private MyFile resource;
|
||||
|
||||
|
||||
public SoftCopy(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
super(server, user, pwd, bucket, monitor, isChunk, backendType, dbs);
|
||||
}
|
||||
|
||||
public String initOperation(RequestObject file, String remotePath, String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
public String initOperation(MyFile file, String remotePath, String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
// if(remotePath != null){
|
||||
// boolean isId=ObjectId.isValid(remotePath);
|
||||
// setResource(file);
|
||||
|
@ -59,7 +59,7 @@ public abstract class SoftCopy extends Operation {
|
|||
|
||||
}
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
// TransportManagerFactory tmf= new TransportManagerFactory(server, user, password);
|
||||
// TransportManager tm=tmf.getTransport(backendType, myFile.getGcubeMemoryType(), dbNames, myFile.getWriteConcern(), myFile.getReadPreference());
|
||||
TransportManager tm=getTransport(myFile);
|
||||
|
@ -76,7 +76,7 @@ public abstract class SoftCopy extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String remotePath, String author, String[] server, String rootArea) {
|
||||
public String initOperation(MyFile resource, String remotePath, String author, String[] server, String rootArea) {
|
||||
// For terrastore, the name of bucket is formed: path_____fileName_____author
|
||||
this.sourcePath=resource.getLocalPath();
|
||||
this.destinationPath=resource.getRemotePath();
|
||||
|
@ -100,7 +100,7 @@ public abstract class SoftCopy extends Operation {
|
|||
// }return bucket=null;//else throw new RemoteBackendException("argument cannot be null");
|
||||
}
|
||||
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, RequestObject resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MyFile resource, String sourcePath, String destinationPath) throws UnknownHostException;
|
||||
|
||||
public String getSourcePath() {
|
||||
return sourcePath;
|
||||
|
@ -118,11 +118,11 @@ public abstract class SoftCopy extends Operation {
|
|||
this.destinationPath = destinationPath;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.contentmanagement.blobstorage.service.operation;
|
|||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -23,7 +23,7 @@ public abstract class Unlock extends Operation {
|
|||
protected String localPath;
|
||||
protected String remotePath;
|
||||
protected OutputStream os;
|
||||
protected RequestObject resource;
|
||||
protected MyFile resource;
|
||||
protected Upload upload;
|
||||
|
||||
public Unlock(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String backendType, String[] dbs) {
|
||||
|
@ -32,7 +32,7 @@ public abstract class Unlock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException {
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(" UPLOAD " + myFile.getLocalPath()
|
||||
+ " author: " + myFile.getOwner());
|
||||
|
@ -54,7 +54,7 @@ public abstract class Unlock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea,
|
||||
boolean replaceOption) {
|
||||
String bucketName=null;
|
||||
|
@ -71,13 +71,13 @@ public abstract class Unlock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, RequestObject resource, String bucket, String key4unlock) throws Exception;
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, MyFile resource, String bucket, String key4unlock) throws Exception;
|
||||
|
||||
public String getLocalPath() {
|
||||
return localPath;
|
||||
|
@ -103,11 +103,11 @@ public abstract class Unlock extends Operation {
|
|||
this.os = os;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -32,7 +32,7 @@ public abstract class Upload extends Operation {
|
|||
protected String localPath;
|
||||
protected String remotePath;
|
||||
protected OutputStream os;
|
||||
protected RequestObject resource;
|
||||
protected MyFile resource;
|
||||
|
||||
public Upload(String[] server, String user, String pwd, String bucket, Monitor monitor, boolean isChunk, String bck, String[] dbs) {
|
||||
super(server, user, pwd, bucket, monitor, isChunk, bck, dbs);
|
||||
|
@ -40,7 +40,7 @@ public abstract class Upload extends Operation {
|
|||
|
||||
|
||||
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException{
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException{
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(" UPLOAD " + myFile.getLocalPath()
|
||||
+ " author: " + myFile.getOwner());
|
||||
|
@ -64,7 +64,7 @@ public abstract class Upload extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath, String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
public String initOperation(MyFile file, String remotePath, String author, String[] server, String rootArea, boolean replaceOption) {
|
||||
// set replace option
|
||||
this.replaceOption=replaceOption;
|
||||
setResource(file);
|
||||
|
@ -81,7 +81,7 @@ public abstract class Upload extends Operation {
|
|||
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String remotePath,
|
||||
public String initOperation(MyFile resource, String remotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// the name of bucket is formed: path_____fileName_____author
|
||||
String bucketName=new BucketCoding().bucketFileCoding(remotePath, rootArea);
|
||||
|
@ -91,7 +91,7 @@ public abstract class Upload extends Operation {
|
|||
}
|
||||
|
||||
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, RequestObject resource, String bucket, boolean replace) throws IOException;
|
||||
public abstract String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, MyFile resource, String bucket, boolean replace) throws IOException;
|
||||
|
||||
public InputStream getIs() {
|
||||
return is;
|
||||
|
@ -153,13 +153,13 @@ public abstract class Upload extends Operation {
|
|||
|
||||
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.contentmanagement.blobstorage.service.operation;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.directoryOperation.BucketCoding;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManager;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.TransportManagerFactory;
|
||||
|
@ -21,7 +21,7 @@ public class UploadAndUnlock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String doIt(RequestObject myFile) throws RemoteBackendException {
|
||||
public String doIt(MyFile myFile) throws RemoteBackendException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(" UPLOAD " + myFile.getLocalPath()
|
||||
+ " author: " + myFile.getOwner());
|
||||
|
@ -42,7 +42,7 @@ public class UploadAndUnlock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject file, String remotePath,
|
||||
public String initOperation(MyFile file, String remotePath,
|
||||
String author, String[] server, String rootArea,
|
||||
boolean replaceOption) {
|
||||
// set replace option
|
||||
|
@ -54,7 +54,7 @@ public class UploadAndUnlock extends Operation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String initOperation(RequestObject resource, String RemotePath,
|
||||
public String initOperation(MyFile resource, String RemotePath,
|
||||
String author, String[] server, String rootArea) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.StorageObject;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.*;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.operation.LockOperator;
|
||||
|
@ -49,7 +49,7 @@ public abstract class TransportManager {
|
|||
* @return the key of remote resource
|
||||
* @throws IOException if there are IO problems
|
||||
*/
|
||||
public String downloadManager(Download download, RequestObject myFile, String key, Class <? extends Object> type) throws Exception{
|
||||
public String downloadManager(Download download, MyFile myFile, String key, Class <? extends Object> type) throws Exception{
|
||||
String key4lock=null;
|
||||
if(myFile.isLock()){
|
||||
download.setResource(myFile);
|
||||
|
@ -76,7 +76,7 @@ public abstract class TransportManager {
|
|||
*/
|
||||
public String uploadManager(Upload upload, Object resource, String bucket, String key, boolean replace) throws Exception{
|
||||
String id=null;
|
||||
RequestObject file=(RequestObject)resource;
|
||||
MyFile file=(MyFile)resource;
|
||||
if((file.getLockedKey()!=null) && (!file.getLockedKey().isEmpty())){
|
||||
Unlock unlock= new UnlockOperator(upload.getServer(), upload.getUser(), upload.getPassword(), upload.getBucket(), upload.getMonitor(), upload.isChunk(), upload.getBackendType(), upload.getDbNames());
|
||||
unlock.setResource(file);
|
||||
|
@ -133,14 +133,14 @@ public abstract class TransportManager {
|
|||
* @return map that contains the object in the direcotry
|
||||
* @throws UnknownHostException
|
||||
*/
|
||||
public abstract Map<String, StorageObject> getValues(RequestObject resource, String bucket, Class< ? extends Object> type);
|
||||
public abstract Map<String, StorageObject> getValues(MyFile resource, String bucket, Class< ? extends Object> type);
|
||||
|
||||
/**
|
||||
* delete a remote file
|
||||
* @param bucket identifies the remote file
|
||||
* @throws UnknownHostException
|
||||
*/
|
||||
public abstract void removeRemoteFile(String bucket, RequestObject resource) throws UnknownHostException;
|
||||
public abstract void removeRemoteFile(String bucket, MyFile resource) throws UnknownHostException;
|
||||
|
||||
/**
|
||||
* delete a remote directory
|
||||
|
@ -150,7 +150,7 @@ public abstract class TransportManager {
|
|||
* @throws UnknownHostException
|
||||
*
|
||||
*/
|
||||
public abstract void removeDir(String remoteDir, RequestObject myFile) throws UnknownHostException;
|
||||
public abstract void removeDir(String remoteDir, MyFile myFile) throws UnknownHostException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -160,7 +160,7 @@ public abstract class TransportManager {
|
|||
* @return the size of the remote file
|
||||
* @throws UnknownHostException
|
||||
*/
|
||||
public abstract long getSize(String bucket, RequestObject myFile);
|
||||
public abstract long getSize(String bucket, MyFile myFile);
|
||||
|
||||
/**
|
||||
* lock a remote file
|
||||
|
@ -210,7 +210,7 @@ public abstract class TransportManager {
|
|||
* @throws UnknownHostException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public abstract long renewTTL(RequestObject resource) throws UnknownHostException, IllegalAccessException;
|
||||
public abstract long renewTTL(MyFile resource) throws UnknownHostException, IllegalAccessException;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
|
@ -125,7 +125,7 @@ public class MongoIOManager {
|
|||
return db;
|
||||
}
|
||||
//PATCHED METHODS
|
||||
protected ObjectId getRemoteObject(GridFS gfs, RequestObject resource, GridFSDBFile f) throws IOException, IllegalAccessError {
|
||||
protected ObjectId getRemoteObject(GridFS gfs, MyFile resource, GridFSDBFile f) throws IOException, IllegalAccessError {
|
||||
ObjectId id;
|
||||
id=(ObjectId)f.getId();
|
||||
String lock=(String)f.get("lock");
|
||||
|
@ -141,7 +141,7 @@ public class MongoIOManager {
|
|||
return id;
|
||||
}
|
||||
|
||||
public ObjectId getRemoteObject(RequestObject resource, GridFSDBFile f) throws IOException, IllegalAccessError {
|
||||
public ObjectId getRemoteObject(MyFile resource, GridFSDBFile f) throws IOException, IllegalAccessError {
|
||||
ObjectId id;
|
||||
id=(ObjectId)f.getId();
|
||||
String lock=(String)f.get("lock");
|
||||
|
@ -187,7 +187,7 @@ public class MongoIOManager {
|
|||
* @param isLock indicates if the file must be locked
|
||||
* @throws IOException
|
||||
*/
|
||||
private void download(GridFS gfs, RequestObject resource, GridFSDBFile f, boolean isLock) throws IOException {
|
||||
private void download(GridFS gfs, MyFile resource, GridFSDBFile f, boolean isLock) throws IOException {
|
||||
OperationDefinition op=resource.getOperationDefinition();
|
||||
logger.info("MongoClient download method: "+op.toString());
|
||||
// if contains the field link it means that is a link hence I follow ne or more links
|
||||
|
@ -218,7 +218,7 @@ public class MongoIOManager {
|
|||
* @param isLock indicates if the file must be locked
|
||||
* @throws IOException
|
||||
*/
|
||||
private void download( RequestObject resource, GridFSDBFile f, boolean isLock) throws IOException {
|
||||
private void download( MyFile resource, GridFSDBFile f, boolean isLock) throws IOException {
|
||||
OperationDefinition op=resource.getOperationDefinition();
|
||||
logger.info("MongoClient download method: "+op.toString());
|
||||
// if contains the field link it means that is a link hence I follow ne or more links
|
||||
|
@ -242,7 +242,7 @@ public class MongoIOManager {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateCommonFields(DBObject f, RequestObject resource, OPERATION op) {
|
||||
public void updateCommonFields(DBObject f, MyFile resource, OPERATION op) {
|
||||
f.put("lastAccess", DateUtils.now("dd MM yyyy 'at' hh:mm:ss z"));
|
||||
String owner=resource.getOwner();
|
||||
f.put("lastUser", owner);
|
||||
|
@ -289,7 +289,7 @@ public class MongoIOManager {
|
|||
close();
|
||||
throw new IllegalAccessError("The file is locked");
|
||||
}else{
|
||||
oldId=checkAndRemove(fold, (RequestObject)resource);
|
||||
oldId=checkAndRemove(fold, (MyFile)resource);
|
||||
}
|
||||
}
|
||||
// }else if(oldir == null){
|
||||
|
@ -301,7 +301,7 @@ public class MongoIOManager {
|
|||
}
|
||||
|
||||
|
||||
public ObjectId checkAndRemove(GridFSDBFile f, RequestObject resource){
|
||||
public ObjectId checkAndRemove(GridFSDBFile f, MyFile resource){
|
||||
String idToRemove=f.getId().toString();
|
||||
logger.info("check and remove object with id "+idToRemove+" and path: "+f.get("filename"));
|
||||
ObjectId idFile=null;
|
||||
|
@ -408,12 +408,12 @@ public class MongoIOManager {
|
|||
//maybe this close is not needed
|
||||
// clean();
|
||||
try{
|
||||
if(((RequestObject)resource).getInputStream()!= null){
|
||||
if(((MyFile)resource).getInputStream()!= null){
|
||||
//upload with client inputStream
|
||||
f2 = writeByInputStream(resource, bucket, name, dir,idFile);
|
||||
f2.save();
|
||||
|
||||
}else if(((((RequestObject)resource).getType() != null) && (((RequestObject)resource).getType().equals("output")))){
|
||||
}else if(((((MyFile)resource).getType() != null) && (((MyFile)resource).getType().equals("output")))){
|
||||
// upload with outputstream
|
||||
f2 = writeByOutputStream(resource, bucket, name, dir, idFile);
|
||||
}else{
|
||||
|
@ -429,7 +429,7 @@ public class MongoIOManager {
|
|||
logger.debug("ObjectId: "+id);
|
||||
|
||||
// if it is an outputstream don't close
|
||||
if(!((((RequestObject)resource).getType() != null) && (((RequestObject)resource).getType().equals("output")))){
|
||||
if(!((((MyFile)resource).getType() != null) && (((MyFile)resource).getType().equals("output")))){
|
||||
close();
|
||||
}
|
||||
}catch(IOException e1){
|
||||
|
@ -454,9 +454,9 @@ public class MongoIOManager {
|
|||
throws IOException {
|
||||
GridFSInputFile f2;
|
||||
if(!(memoryType== MemoryType.VOLATILE))
|
||||
f2 = createGFSFileObject(new File(((RequestObject)resource).getLocalPath()), ((RequestObject)resource).getWriteConcern(), ((RequestObject)resource).getReadPreference());
|
||||
f2 = createGFSFileObject(new File(((MyFile)resource).getLocalPath()), ((MyFile)resource).getWriteConcern(), ((MyFile)resource).getReadPreference());
|
||||
else
|
||||
f2 = createGFSFileObject(new File(((RequestObject)resource).getLocalPath()));
|
||||
f2 = createGFSFileObject(new File(((MyFile)resource).getLocalPath()));
|
||||
fillInputFile(resource, bucket, name, dir, f2, idFile);
|
||||
saveGFSFileObject(f2);
|
||||
return f2;
|
||||
|
@ -466,11 +466,11 @@ public class MongoIOManager {
|
|||
String bucket, String name, String dir, ObjectId idFile) throws IOException {
|
||||
GridFSInputFile f2;
|
||||
if(!(memoryType== MemoryType.VOLATILE))
|
||||
f2 = createGFSFileObject(((RequestObject)resource).getName(), ((RequestObject)resource).getWriteConcern(), ((RequestObject)resource).getReadPreference());
|
||||
f2 = createGFSFileObject(((MyFile)resource).getName(), ((MyFile)resource).getWriteConcern(), ((MyFile)resource).getReadPreference());
|
||||
else
|
||||
f2 = createGFSFileObject(((RequestObject)resource).getName());
|
||||
f2 = createGFSFileObject(((MyFile)resource).getName());
|
||||
fillInputFile(resource, bucket, name, dir, f2, idFile);
|
||||
((RequestObject)resource).setOutputStream(new MongoOutputStream(mongo, f2.getOutputStream()));
|
||||
((MyFile)resource).setOutputStream(new MongoOutputStream(mongo, f2.getOutputStream()));
|
||||
return f2;
|
||||
}
|
||||
|
||||
|
@ -479,13 +479,13 @@ public class MongoIOManager {
|
|||
throws IOException {
|
||||
GridFSInputFile f2;
|
||||
if(!(memoryType== MemoryType.VOLATILE))
|
||||
f2 = createGFSFileObject(((RequestObject)resource).getInputStream(), ((RequestObject)resource).getWriteConcern(),((RequestObject)resource).getReadPreference());
|
||||
f2 = createGFSFileObject(((MyFile)resource).getInputStream(), ((MyFile)resource).getWriteConcern(),((MyFile)resource).getReadPreference());
|
||||
else
|
||||
f2 = createGFSFileObject(((RequestObject)resource).getInputStream());
|
||||
f2 = createGFSFileObject(((MyFile)resource).getInputStream());
|
||||
fillInputFile(resource, bucket, name, dir, f2, idFile);
|
||||
saveGFSFileObject(f2);
|
||||
((RequestObject)resource).getInputStream().close();
|
||||
((RequestObject)resource).setInputStream(null);
|
||||
((MyFile)resource).getInputStream().close();
|
||||
((MyFile)resource).setInputStream(null);
|
||||
return f2;
|
||||
}
|
||||
|
||||
|
@ -503,14 +503,14 @@ public class MongoIOManager {
|
|||
f2.put("name", name);
|
||||
if(dir!=null)
|
||||
f2.put("dir", dir);
|
||||
if(((RequestObject)resource).getOwner() !=null)
|
||||
f2.put("owner", ((RequestObject)resource).getOwner());
|
||||
String mime= ((RequestObject)resource).getMimeType();
|
||||
if(((MyFile)resource).getOwner() !=null)
|
||||
f2.put("owner", ((MyFile)resource).getOwner());
|
||||
String mime= ((MyFile)resource).getMimeType();
|
||||
if( mime !=null){
|
||||
f2.put("mimetype", mime);
|
||||
}
|
||||
f2.put("creationTime", DateUtils.now("dd MM yyyy 'at' hh:mm:ss z"));
|
||||
updateCommonFields(f2, (RequestObject)resource, null);
|
||||
updateCommonFields(f2, (MyFile)resource, null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -521,7 +521,7 @@ public class MongoIOManager {
|
|||
* @param query
|
||||
* @throws UnknownHostException
|
||||
*/
|
||||
protected void removeObject(GridFS gfs, BasicDBObject query, RequestObject resource){
|
||||
protected void removeObject(GridFS gfs, BasicDBObject query, MyFile resource){
|
||||
List<GridFSDBFile> list = gfs.find(query);
|
||||
for(Iterator<GridFSDBFile> it=list.iterator(); it.hasNext();){
|
||||
GridFSDBFile f=(GridFSDBFile)it.next();
|
||||
|
@ -535,19 +535,19 @@ public class MongoIOManager {
|
|||
}
|
||||
|
||||
|
||||
public void setGenericProperties(RequestObject resource, String destination,
|
||||
public void setGenericProperties(MyFile resource, String destination,
|
||||
String dir, GridFSInputFile destinationFile, String name) {
|
||||
updateCommonFields(destinationFile, resource, null);
|
||||
destinationFile.put("filename", destination);
|
||||
destinationFile.put("type", "file");
|
||||
destinationFile.put("name", name);
|
||||
destinationFile.put("dir", dir);
|
||||
destinationFile.put("owner", ((RequestObject)resource).getOwner());
|
||||
destinationFile.put("mimetype", ((RequestObject)resource).getMimeType());
|
||||
destinationFile.put("owner", ((MyFile)resource).getOwner());
|
||||
destinationFile.put("mimetype", ((MyFile)resource).getMimeType());
|
||||
destinationFile.put("creationTime", DateUtils.now("dd MM yyyy 'at' hh:mm:ss z"));
|
||||
}
|
||||
|
||||
public DBObject setGenericMoveProperties(RequestObject resource, String filename, String dir,
|
||||
public DBObject setGenericMoveProperties(MyFile resource, String filename, String dir,
|
||||
String name, DBObject sourcePathMetaCollection) {
|
||||
sourcePathMetaCollection.put("filename", filename);
|
||||
sourcePathMetaCollection.put("type", "file");
|
||||
|
@ -835,7 +835,7 @@ public class MongoIOManager {
|
|||
* @param isLock
|
||||
* @return
|
||||
*/
|
||||
protected String readByInputStream(RequestObject resource, GridFSDBFile f, boolean isLock, int count) {
|
||||
protected String readByInputStream(MyFile resource, GridFSDBFile f, boolean isLock, int count) {
|
||||
String key=null;
|
||||
resource.setInputStream(new MongoInputStream(mongo, f.getInputStream()));
|
||||
return key;
|
||||
|
@ -848,7 +848,7 @@ public class MongoIOManager {
|
|||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
protected String readByOutputStream(RequestObject resource, GridFSDBFile f, boolean isLock, int count)
|
||||
protected String readByOutputStream(MyFile resource, GridFSDBFile f, boolean isLock, int count)
|
||||
throws IOException {
|
||||
String key=null;
|
||||
f.writeTo(resource.getOutputStream());
|
||||
|
@ -866,7 +866,7 @@ public class MongoIOManager {
|
|||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
protected String readByPath(RequestObject resource, GridFSDBFile f, boolean isLock, int count)
|
||||
protected String readByPath(MyFile resource, GridFSDBFile f, boolean isLock, int count)
|
||||
throws IOException {
|
||||
String key=null;
|
||||
try{
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition;
|
||||
import org.gcube.contentmanagement.blobstorage.service.impl.ServiceEngine;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.*;
|
||||
|
@ -152,7 +152,7 @@ public class MongoOperationManager extends TransportManager{
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<String, StorageObject> getValues(RequestObject resource, String bucket, Class<? extends Object> type){
|
||||
public Map<String, StorageObject> getValues(MyFile resource, String bucket, Class<? extends Object> type){
|
||||
Map<String, StorageObject> map=null;
|
||||
try{
|
||||
OperationDefinition op=resource.getOperationDefinition();
|
||||
|
@ -225,7 +225,7 @@ public class MongoOperationManager extends TransportManager{
|
|||
|
||||
|
||||
@Override
|
||||
public void removeRemoteFile(String bucket, RequestObject resource) throws UnknownHostException{
|
||||
public void removeRemoteFile(String bucket, MyFile resource) throws UnknownHostException{
|
||||
logger.info("Check file: "+bucket+ " for removing operation");
|
||||
GridFSDBFile f=mongoPrimaryInstance.retrieveRemoteDescriptor(bucket, null, true);
|
||||
if(f!=null){
|
||||
|
@ -248,7 +248,7 @@ public class MongoOperationManager extends TransportManager{
|
|||
|
||||
|
||||
@Override
|
||||
public void removeDir(String remoteDir, RequestObject resource){
|
||||
public void removeDir(String remoteDir, MyFile resource){
|
||||
ArrayList<String> dirs=new ArrayList<String>();
|
||||
dirs.add(remoteDir);
|
||||
// patch for incompatibility v 1-2
|
||||
|
@ -301,7 +301,7 @@ public class MongoOperationManager extends TransportManager{
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getSize(String remotePath, RequestObject file){
|
||||
public long getSize(String remotePath, MyFile file){
|
||||
long length=-1;
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("MongoDB - get Size for pathServer: "+remotePath);
|
||||
|
@ -347,9 +347,9 @@ public class MongoOperationManager extends TransportManager{
|
|||
}
|
||||
|
||||
@Override
|
||||
public long renewTTL(RequestObject resource) throws UnknownHostException, IllegalAccessException{
|
||||
public long renewTTL(MyFile resource) throws UnknownHostException, IllegalAccessException{
|
||||
long ttl=-1;
|
||||
RequestObject file=(RequestObject)resource;
|
||||
MyFile file=(MyFile)resource;
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=file.getOperation().getRemoteResource();
|
||||
String key=file.getLockedKey();
|
||||
String remotePath=file.getRemotePath();
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.net.UnknownHostException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
|
||||
import org.gcube.contentmanagement.blobstorage.service.impl.ServiceEngine;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.CopyDir;
|
||||
|
@ -52,7 +52,7 @@ public class CopyDirOperator extends CopyDir {
|
|||
* @see org.gcube.contentmanagement.blobstorage.service.operation.CopyDir#execute(org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO, org.gcube.contentmanagement.blobstorage.resource.MyFile, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public List<String> execute(MongoIOManager mongoPrimaryInstance, RequestObject resource, String sourcePath, String destinationPath)
|
||||
public List<String> execute(MongoIOManager mongoPrimaryInstance, MyFile resource, String sourcePath, String destinationPath)
|
||||
throws UnknownHostException {
|
||||
String source=sourcePath;
|
||||
source = appendFileSeparator(source);
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.io.InputStream;
|
|||
import java.net.UnknownHostException;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.Copy;
|
||||
|
@ -47,13 +47,13 @@ public class CopyOperator extends Copy {
|
|||
*/
|
||||
@Override
|
||||
// public String execute(MongoIO mongoPrimaryInstance) throws UnknownHostException {
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, RequestObject resource, String sourcePath, String destinationPath) throws UnknownHostException {
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MyFile resource, String sourcePath, String destinationPath) throws UnknownHostException {
|
||||
String source=sourcePath;
|
||||
String destination=destinationPath;
|
||||
String dir=((RequestObject)resource).getRemoteDir();
|
||||
String originalDir=((RequestObject)resource).getLocalDir();
|
||||
String dir=((MyFile)resource).getRemoteDir();
|
||||
String originalDir=((MyFile)resource).getLocalDir();
|
||||
logger.debug("from directory: "+originalDir+ "to directory: "+dir);
|
||||
String name=((RequestObject)resource).getName();
|
||||
String name=((MyFile)resource).getName();
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=resource.getOperation().getRemoteResource();
|
||||
ObjectId destinationId=null;
|
||||
logger.debug("copy operation on Mongo backend, parameters: source path: "+source+" destination path: "+destination);
|
||||
|
@ -96,11 +96,11 @@ public class CopyOperator extends Copy {
|
|||
|
||||
|
||||
public String safePut(MongoIOManager mongoPrimaryInstance, Object resource, String bucket, String key, boolean replace) throws UnknownHostException{
|
||||
OperationDefinition op=((RequestObject)resource).getOperationDefinition();
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=((RequestObject)resource).getOperation().getRemoteResource();
|
||||
OperationDefinition op=((MyFile)resource).getOperationDefinition();
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=((MyFile)resource).getOperation().getRemoteResource();
|
||||
logger.info("MongoClient put method: "+op.toString());
|
||||
String dir=((RequestObject)resource).getRemoteDir();
|
||||
String name=((RequestObject)resource).getName();
|
||||
String dir=((MyFile)resource).getRemoteDir();
|
||||
String name=((MyFile)resource).getName();
|
||||
ObjectId id=null;
|
||||
ObjectId oldId=null;
|
||||
// id of the remote file if present
|
||||
|
|
|
@ -5,7 +5,7 @@ package org.gcube.contentmanagement.blobstorage.transport.backend.operation;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.DuplicateFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.Monitor;
|
||||
|
@ -46,8 +46,8 @@ public class DuplicateOperator extends DuplicateFile {
|
|||
*/
|
||||
@Override
|
||||
public String execute(MongoIOManager mongoPrimaryInstance){
|
||||
String destination=((RequestObject)getResource()).getRemotePath()+Costants.DUPLICATE_SUFFIX;
|
||||
String dir=((RequestObject)getResource()).getRemoteDir();
|
||||
String destination=((MyFile)getResource()).getRemotePath()+Costants.DUPLICATE_SUFFIX;
|
||||
String dir=((MyFile)getResource()).getRemoteDir();
|
||||
// String name=((MyFile)getResource()).getName();
|
||||
if((getBucket() != null) && (!getBucket().isEmpty())){
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=resource.getOperation().getRemoteResource();
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.net.UnknownHostException;
|
|||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.Link;
|
||||
|
@ -49,7 +49,7 @@ public class LinkOperator extends Link {
|
|||
* @see org.gcube.contentmanagement.blobstorage.service.operation.Link#execute(org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO, org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO, org.gcube.contentmanagement.blobstorage.resource.MyFile, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, RequestObject resource, String sourcePath, String destinationPath) throws UnknownHostException {
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, MyFile resource, String sourcePath, String destinationPath) throws UnknownHostException {
|
||||
boolean replace=true;
|
||||
String source=sourcePath;
|
||||
String destination=destinationPath;
|
||||
|
@ -82,7 +82,7 @@ public class LinkOperator extends Link {
|
|||
String oldir=(String)fold.get("dir");
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("old dir found "+oldir);
|
||||
if((oldir.equalsIgnoreCase(((RequestObject)resource).getRemoteDir()))){
|
||||
if((oldir.equalsIgnoreCase(((MyFile)resource).getRemoteDir()))){
|
||||
ObjectId oldId=(ObjectId) fold.getId();
|
||||
if(!replace){
|
||||
return oldId.toString();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
package org.gcube.contentmanagement.blobstorage.transport.backend.operation;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
|
@ -46,7 +46,7 @@ public class LockOperator extends Lock {
|
|||
* @see org.gcube.contentmanagement.blobstorage.service.operation.Lock#execute(org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO, org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO)
|
||||
*/
|
||||
@Override
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, RequestObject resource, String serverLocation) throws Exception {
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, MyFile resource, String serverLocation) throws Exception {
|
||||
OperationDefinition op=resource.getOperationDefinition();
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=resource.getOperation().getRemoteResource();
|
||||
// if((resource.getLocalPath()!= null) && (!resource.getLocalPath().isEmpty())){
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
|
||||
import org.gcube.contentmanagement.blobstorage.service.impl.ServiceEngine;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.Monitor;
|
||||
|
@ -53,7 +53,7 @@ public class MoveDirOperator extends MoveDir {
|
|||
* @see org.gcube.contentmanagement.blobstorage.service.operation.MoveDir#execute(org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO, org.gcube.contentmanagement.blobstorage.resource.MyFile, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public List<String> execute(MongoIOManager mongoPrimaryInstance, RequestObject resource, String sourcePath,
|
||||
public List<String> execute(MongoIOManager mongoPrimaryInstance, MyFile resource, String sourcePath,
|
||||
String destinationPath, MemoryType memoryType) throws UnknownHostException {
|
||||
String source=sourcePath;
|
||||
source = appendFileSeparator(source);
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.net.InetAddress;
|
|||
import java.net.UnknownHostException;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
|
||||
import org.gcube.contentmanagement.blobstorage.service.impl.ServiceEngine;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.Monitor;
|
||||
|
@ -54,12 +54,12 @@ public class MoveOperator extends Move {
|
|||
*/
|
||||
@Override
|
||||
// public String execute(MongoIO mongoPrimaryInstance, MemoryType memoryType) throws UnknownHostException {
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MemoryType memoryType, RequestObject resource, String sourcePath, String destinationPath) throws UnknownHostException {
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MemoryType memoryType, MyFile resource, String sourcePath, String destinationPath) throws UnknownHostException {
|
||||
String source=sourcePath;
|
||||
String destination=destinationPath;
|
||||
resource.setLocalPath(sourcePath);
|
||||
String dir=((RequestObject)resource).getRemoteDir();
|
||||
String name=((RequestObject)resource).getName();
|
||||
String dir=((MyFile)resource).getRemoteDir();
|
||||
String name=((MyFile)resource).getName();
|
||||
String destinationId=null;
|
||||
String sourceId=null;
|
||||
logger.info("move operation on Mongo backend, parameters: source path: "+source+" destination path: "+destination);
|
||||
|
@ -112,7 +112,7 @@ public class MoveOperator extends Move {
|
|||
// update fields
|
||||
mongoPrimaryInstance.buildDirTree(mongoPrimaryInstance.getMetaDataCollection(mongoPrimaryInstance.getConnectionDB( MongoOperationManager.getPrimaryCollectionName(), true)), dir);
|
||||
sourcePathMetaCollection= new BasicDBObject();
|
||||
sourcePathMetaCollection.put("$set", new BasicDBObject().append("dir", dir).append("filename", destinationPath).append("name", name).append("owner", ((RequestObject)resource).getOwner()));
|
||||
sourcePathMetaCollection.put("$set", new BasicDBObject().append("dir", dir).append("filename", destinationPath).append("name", name).append("owner", ((MyFile)resource).getOwner()));
|
||||
logger.info("new object merged ");
|
||||
mongoPrimaryInstance.printObject(sourcePathMetaCollection);
|
||||
//applies the update
|
||||
|
@ -175,7 +175,7 @@ public class MoveOperator extends Move {
|
|||
|
||||
}
|
||||
|
||||
private DBObject setCommonFields(DBObject sourcePathMetaCollection, RequestObject resource, OPERATION op) {
|
||||
private DBObject setCommonFields(DBObject sourcePathMetaCollection, MyFile resource, OPERATION op) {
|
||||
String owner=resource.getOwner();
|
||||
if(op == null){
|
||||
op=resource.getOperationDefinition().getOperation();
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.net.UnknownHostException;
|
|||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.LOCAL_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
|
@ -37,7 +37,7 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
Logger logger=LoggerFactory.getLogger(SoftCopyOperator.class);
|
||||
private MemoryType memoryType;
|
||||
private MongoIOManager mongoPrimaryInstance;
|
||||
private RequestObject resource;
|
||||
private MyFile resource;
|
||||
/**
|
||||
* @param server
|
||||
* @param user
|
||||
|
@ -55,7 +55,7 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, RequestObject resource, String sourcePath, String destinationPath)
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MyFile resource, String sourcePath, String destinationPath)
|
||||
throws UnknownHostException {
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=resource.getOperation().getRemoteResource();
|
||||
LOCAL_RESOURCE localResourceIdentifier=resource.getOperation().getLocalResource();
|
||||
|
@ -70,9 +70,9 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
else
|
||||
destination=destinationPath;
|
||||
if(resource!=null){
|
||||
String dir=((RequestObject)resource).getRemoteDir();
|
||||
String name=((RequestObject)resource).getName();
|
||||
setMemoryType(((RequestObject)resource).getGcubeMemoryType());
|
||||
String dir=((MyFile)resource).getRemoteDir();
|
||||
String name=((MyFile)resource).getName();
|
||||
setMemoryType(((MyFile)resource).getGcubeMemoryType());
|
||||
}
|
||||
setMongoPrimaryInstance(mongoPrimaryInstance);
|
||||
ObjectId mapId=null;
|
||||
|
@ -153,7 +153,7 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
return destObject.getId().toString();
|
||||
}
|
||||
|
||||
private String fillGenericDestinationFields(RequestObject resource, ObjectId souceId) {
|
||||
private String fillGenericDestinationFields(MyFile resource, ObjectId souceId) {
|
||||
String destination;
|
||||
destination=resource.getRootPath()+souceId;
|
||||
resource.setName(souceId.toString());
|
||||
|
@ -173,17 +173,17 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
*/
|
||||
private ObjectId createNewDuplicatesMap(DBCollection metaCollectionInstance, Object resource, GridFSDBFile sourceObject, String bucket, ObjectId sourceId) throws UnknownHostException {
|
||||
ObjectId id = null;
|
||||
String dir= ((RequestObject)resource).getRemoteDir();
|
||||
String dir= ((MyFile)resource).getRemoteDir();
|
||||
// create new dir (is it really needed in case of map object?)
|
||||
if((dir !=null && !dir.isEmpty()) && (bucket !=null && !bucket.isEmpty())){
|
||||
getMongoPrimaryInstance().buildDirTree(getMongoPrimaryInstance().getMetaDataCollection(null), dir);
|
||||
}
|
||||
// create new map object
|
||||
id= createNewObjectMap(metaCollectionInstance, (RequestObject)resource, sourceObject, sourceId);
|
||||
id= createNewObjectMap(metaCollectionInstance, (MyFile)resource, sourceObject, sourceId);
|
||||
return id;
|
||||
}
|
||||
|
||||
private ObjectId createNewObjectMap(DBCollection metaCollectionInstance, RequestObject resource, GridFSDBFile source, ObjectId sourceId) throws UnknownHostException {
|
||||
private ObjectId createNewObjectMap(DBCollection metaCollectionInstance, MyFile resource, GridFSDBFile source, ObjectId sourceId) throws UnknownHostException {
|
||||
String md5=source.getMD5();
|
||||
// set type of object
|
||||
DBObject document=new BasicDBObject("type", "map");
|
||||
|
@ -198,7 +198,7 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
return id;
|
||||
}
|
||||
|
||||
private DBObject createNewLinkObject(RequestObject resource, GridFSDBFile sourceObject, String destination, DBCollection metaCollectionInstance, String md5, ObjectId mapId, ObjectId newId){
|
||||
private DBObject createNewLinkObject(MyFile resource, GridFSDBFile sourceObject, String destination, DBCollection metaCollectionInstance, String md5, ObjectId mapId, ObjectId newId){
|
||||
DBObject document=new BasicDBObject("type", "file");
|
||||
document.put("filename", destination);
|
||||
document.put("name", resource.getName());
|
||||
|
@ -218,8 +218,8 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
return fillCommonfields(document, resource, sourceObject, metaCollectionInstance, md5);
|
||||
}
|
||||
|
||||
private DBObject fillCommonfields(DBObject document, RequestObject resource, GridFSDBFile sourceObject, DBCollection metaCollectionInstance, String md5) {
|
||||
document.put("mimetype", ((RequestObject)resource).getMimeType());
|
||||
private DBObject fillCommonfields(DBObject document, MyFile resource, GridFSDBFile sourceObject, DBCollection metaCollectionInstance, String md5) {
|
||||
document.put("mimetype", ((MyFile)resource).getMimeType());
|
||||
document.put("creationTime", DateUtils.now("dd MM yyyy 'at' hh:mm:ss z"));
|
||||
document.put("md5", md5);
|
||||
document.put("length", sourceObject.getLength());
|
||||
|
@ -305,11 +305,11 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
this.mongoPrimaryInstance = mongoPrimaryInstance;
|
||||
}
|
||||
|
||||
public RequestObject getResource() {
|
||||
public MyFile getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(RequestObject resource) {
|
||||
public void setResource(MyFile resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ package org.gcube.contentmanagement.blobstorage.transport.backend.operation;
|
|||
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
|
@ -46,7 +46,7 @@ public class UnlockOperator extends Unlock {
|
|||
* @see org.gcube.contentmanagement.blobstorage.service.operation.Unlock#execute(org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO, org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO)
|
||||
*/
|
||||
@Override
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, RequestObject resource, String bucket, String key4unlock) throws Exception {
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, MyFile resource, String bucket, String key4unlock) throws Exception {
|
||||
String id=null;
|
||||
OperationDefinition op=resource.getOperationDefinition();
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=resource.getOperation().getRemoteResource();
|
||||
|
@ -59,8 +59,8 @@ public class UnlockOperator extends Unlock {
|
|||
// mongoPrimaryInstance.close();
|
||||
// resource.setOperation(op);
|
||||
// }
|
||||
String dir=((RequestObject)resource).getRemoteDir();
|
||||
String name=((RequestObject)resource).getName();
|
||||
String dir=((MyFile)resource).getRemoteDir();
|
||||
String name=((MyFile)resource).getName();
|
||||
String path=getBucket();
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("DIR: "+dir+" name: "+name+" fullPath "+path+" bucket: "+bucket);
|
||||
|
@ -69,7 +69,7 @@ public class UnlockOperator extends Unlock {
|
|||
String oldir=(String)f.get("dir");
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("old dir found "+oldir);
|
||||
if((oldir.equalsIgnoreCase(((RequestObject)resource).getRemoteDir())) || ((RequestObject)resource).getRemoteDir()==null){
|
||||
if((oldir.equalsIgnoreCase(((MyFile)resource).getRemoteDir())) || ((MyFile)resource).getRemoteDir()==null){
|
||||
String lock=(String)f.get("lock");
|
||||
//check if the od file is locked
|
||||
if((lock !=null) && (!lock.isEmpty())){
|
||||
|
@ -77,14 +77,14 @@ public class UnlockOperator extends Unlock {
|
|||
if(lck.equalsIgnoreCase(key4unlock)){
|
||||
f.put("lock", null);
|
||||
f.put("timestamp", null);
|
||||
mongoPrimaryInstance.updateCommonFields((GridFSFile)f, (RequestObject)resource, OPERATION.UNLOCK);
|
||||
mongoPrimaryInstance.updateCommonFields((GridFSFile)f, (MyFile)resource, OPERATION.UNLOCK);
|
||||
f.save();
|
||||
}else{
|
||||
mongoPrimaryInstance.close();
|
||||
throw new IllegalAccessError("bad key for unlock");
|
||||
}
|
||||
}else{
|
||||
mongoPrimaryInstance.updateCommonFields((GridFSFile)f, (RequestObject)resource, OPERATION.UNLOCK);
|
||||
mongoPrimaryInstance.updateCommonFields((GridFSFile)f, (MyFile)resource, OPERATION.UNLOCK);
|
||||
f.save();
|
||||
}
|
||||
}else{
|
||||
|
|
|
@ -5,7 +5,7 @@ package org.gcube.contentmanagement.blobstorage.transport.backend.operation;
|
|||
|
||||
import java.io.IOException;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.RequestObject;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.Monitor;
|
||||
|
@ -44,12 +44,12 @@ public class UploadOperator extends Upload {
|
|||
* @see org.gcube.contentmanagement.blobstorage.service.operation.Upload#execute(org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO, org.gcube.contentmanagement.blobstorage.transport.backend.MongoIO)
|
||||
*/
|
||||
@Override
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, RequestObject resource, String bucket, boolean replace) throws IOException {
|
||||
OperationDefinition op=((RequestObject)resource).getOperationDefinition();
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=((RequestObject)resource).getOperation().getRemoteResource();
|
||||
public String execute(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance, MyFile resource, String bucket, boolean replace) throws IOException {
|
||||
OperationDefinition op=((MyFile)resource).getOperationDefinition();
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=((MyFile)resource).getOperation().getRemoteResource();
|
||||
logger.info("MongoClient put method: "+op.toString());
|
||||
String dir=((RequestObject)resource).getRemoteDir();
|
||||
String name=((RequestObject)resource).getName();
|
||||
String dir=((MyFile)resource).getRemoteDir();
|
||||
String name=((MyFile)resource).getName();
|
||||
Object id=null;
|
||||
ObjectId oldId=null;
|
||||
// id of the remote file if present
|
||||
|
@ -79,11 +79,11 @@ public class UploadOperator extends Upload {
|
|||
}
|
||||
|
||||
public String executeSafeMode(MongoIOManager mongoPrimaryInstance, MongoIOManager mongoSecondaryInstance) throws IOException {
|
||||
OperationDefinition op=((RequestObject)resource).getOperationDefinition();
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=((RequestObject)resource).getOperation().getRemoteResource();
|
||||
OperationDefinition op=((MyFile)resource).getOperationDefinition();
|
||||
REMOTE_RESOURCE remoteResourceIdentifier=((MyFile)resource).getOperation().getRemoteResource();
|
||||
logger.info("MongoClient put method: "+op.toString());
|
||||
String dir=((RequestObject)resource).getRemoteDir();
|
||||
String name=((RequestObject)resource).getName();
|
||||
String dir=((MyFile)resource).getRemoteDir();
|
||||
String name=((MyFile)resource).getName();
|
||||
ObjectId id=null;
|
||||
ObjectId oldId=null;
|
||||
// id of the remote file if present
|
||||
|
|
Loading…
Reference in New Issue