Search in sources :

Example 6 with ObjectPath

use of com.emc.atmos.api.ObjectPath in project camel by apache.

the class AtmosAPIFacade method putSingleFile.

private ObjectId putSingleFile(File inputFile, String atmosPath) throws Exception {
    FileInputStream inputStream = new FileInputStream(inputFile);
    ObjectId uploadedFile = null;
    try {
        ObjectPath op = new ObjectPath(atmosPath);
        CreateObjectRequest request = new CreateObjectRequest();
        request.identifier(op).content(inputStream).contentLength(inputFile.length());
        uploadedFile = AtmosAPIFacade.client.createObject(request).getObjectId();
        return uploadedFile;
    } finally {
        inputStream.close();
    }
}
Also used : ObjectPath(com.emc.atmos.api.ObjectPath) CreateObjectRequest(com.emc.atmos.api.request.CreateObjectRequest) ObjectId(com.emc.atmos.api.ObjectId) FileInputStream(java.io.FileInputStream)

Aggregations

ObjectPath (com.emc.atmos.api.ObjectPath)6 AtmosResult (org.apache.camel.component.atmos.dto.AtmosResult)3 AtmosException (org.apache.camel.component.atmos.util.AtmosException)3 ObjectId (com.emc.atmos.api.ObjectId)2 IOException (java.io.IOException)2 DirectoryEntry (com.emc.atmos.api.bean.DirectoryEntry)1 CreateObjectRequest (com.emc.atmos.api.request.CreateObjectRequest)1 ListDirectoryRequest (com.emc.atmos.api.request.ListDirectoryRequest)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 AtmosDelResult (org.apache.camel.component.atmos.dto.AtmosDelResult)1 AtmosFileUploadResult (org.apache.camel.component.atmos.dto.AtmosFileUploadResult)1 AtmosMoveResult (org.apache.camel.component.atmos.dto.AtmosMoveResult)1 AtmosResultCode (org.apache.camel.component.atmos.util.AtmosResultCode)1