share-updates/src/main/java/org/gcube/portlets/user/shareupdates/server/UploadToStorageThread.java

49 lines
1.3 KiB
Java

package org.gcube.portlets.user.shareupdates.server;
import org.gcube.contentmanagement.blobstorage.service.IClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Massimiliano Assante ISTI-CNR
*
*/
public class UploadToStorageThread implements Runnable {
private static Logger _log = LoggerFactory.getLogger(UploadToStorageThread.class);
/**
* remote path (with file name) in which you want to put the file
*/
private String remoteFilePath;
/**
* the name of the file you are putting
*/
private String fileName;
/**
* the path (with name) of the file you are putting
*/
private String fileabsolutePathOnServer;
private IClient sClient;
/**
*
* @param sClient the instance of the storage client
* @param fileToUpload the absolute path of the file
*/
public UploadToStorageThread(IClient sClient, String fileName, String fileabsolutePathOnServer, String remoteFilePath) {
super();
this.sClient = sClient;
this.remoteFilePath = remoteFilePath;
this.fileName = fileName;
this.fileabsolutePathOnServer = fileabsolutePathOnServer;
}
@Override
public void run() {
String theID = sClient.put(true).LFile(fileabsolutePathOnServer).RFile(remoteFilePath);
_log.debug("Uploaded " + fileName + " - Returned Storage id=" + theID);
}
}