Search in sources :

Example 1 with CreateObjectRequest

use of com.emc.atmos.api.request.CreateObjectRequest 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

ObjectId (com.emc.atmos.api.ObjectId)1 ObjectPath (com.emc.atmos.api.ObjectPath)1 CreateObjectRequest (com.emc.atmos.api.request.CreateObjectRequest)1 FileInputStream (java.io.FileInputStream)1