
nl.tweeenveertig.openstack.command.object.ObjectMetadataCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of joss Show documentation
Show all versions of joss Show documentation
Java Client library for OpenStack Storage (Swift)
package nl.tweeenveertig.openstack.command.object;
import nl.tweeenveertig.openstack.command.identity.access.AccessImpl;
import nl.tweeenveertig.openstack.model.Account;
import nl.tweeenveertig.openstack.command.core.httpstatus.HttpStatusChecker;
import nl.tweeenveertig.openstack.command.core.httpstatus.HttpStatusFailCondition;
import nl.tweeenveertig.openstack.command.core.httpstatus.HttpStatusMatch;
import nl.tweeenveertig.openstack.command.core.httpstatus.HttpStatusSuccessCondition;
import nl.tweeenveertig.openstack.model.Container;
import nl.tweeenveertig.openstack.model.StoredObject;
import nl.tweeenveertig.openstack.headers.Header;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import java.util.Collection;
public class ObjectMetadataCommand extends AbstractObjectCommand {
public ObjectMetadataCommand(Account account, HttpClient httpClient, AccessImpl access, StoredObject object, Collection headers) {
super(account, httpClient, access, object);
addHeaders(headers);
}
@Override
protected HttpPost createRequest(String url) {
return new HttpPost(url);
}
@Override
protected HttpStatusChecker[] getStatusCheckers() {
return new HttpStatusChecker[] {
new HttpStatusSuccessCondition(new HttpStatusMatch(HttpStatus.SC_ACCEPTED)),
new HttpStatusFailCondition(new HttpStatusMatch(HttpStatus.SC_NOT_FOUND))
};
}
}