All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.javaswift.joss.command.impl.object.ObjectMetadataCommandImpl Maven / Gradle / Ivy

package org.javaswift.joss.command.impl.object;

import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.javaswift.joss.command.impl.core.httpstatus.HttpStatusChecker;
import org.javaswift.joss.command.impl.core.httpstatus.HttpStatusFailCondition;
import org.javaswift.joss.command.impl.core.httpstatus.HttpStatusMatch;
import org.javaswift.joss.command.impl.core.httpstatus.HttpStatusSuccessCondition;
import org.javaswift.joss.command.shared.object.ObjectMetadataCommand;
import org.javaswift.joss.headers.Header;
import org.javaswift.joss.model.Access;
import org.javaswift.joss.model.Account;
import org.javaswift.joss.model.StoredObject;

import java.util.Collection;

public class ObjectMetadataCommandImpl extends AbstractObjectCommand implements ObjectMetadataCommand {

    public ObjectMetadataCommandImpl(Account account, HttpClient httpClient, Access access, StoredObject object, Collection headers) {
        super(account, httpClient, access, object);
        addHeaders(headers);
    }

    @Override
    protected HttpPost createRequest(String url) {
        return new HttpPost(url);
    }

    @Override
    public HttpStatusChecker[] getStatusCheckers() {
        return new HttpStatusChecker[] {
            new HttpStatusSuccessCondition(new HttpStatusMatch(HttpStatus.SC_ACCEPTED)),
            new HttpStatusFailCondition(new HttpStatusMatch(HttpStatus.SC_NOT_FOUND))
        };
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy