You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2015/10/26 04:40:29 UTC
[4/9] jclouds git commit: JCLOUDS-786: Remove legacy swift provider
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/SwiftObject.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/SwiftObject.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/SwiftObject.java
deleted file mode 100644
index 9780004..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/SwiftObject.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.domain;
-
-import org.jclouds.io.PayloadEnclosing;
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.collect.Multimap;
-
-public interface SwiftObject extends PayloadEnclosing, Comparable<SwiftObject> {
- public interface Factory {
- SwiftObject create(@Nullable MutableObjectInfoWithMetadata info);
- }
-
- /**
- * @return System and User metadata relevant to this object.
- */
- MutableObjectInfoWithMetadata getInfo();
-
- Multimap<String, String> getAllHeaders();
-
- void setAllHeaders(Multimap<String, String> allHeaders);
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/DelegatingMutableObjectInfoWithMetadata.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/DelegatingMutableObjectInfoWithMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/DelegatingMutableObjectInfoWithMetadata.java
deleted file mode 100644
index 6115147..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/DelegatingMutableObjectInfoWithMetadata.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.domain.internal;
-
-import java.net.URI;
-import java.util.Date;
-import java.util.Map;
-
-import org.jclouds.io.payloads.BaseMutableContentMetadata;
-import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
-import org.jclouds.openstack.swift.domain.ObjectInfo;
-
-public class DelegatingMutableObjectInfoWithMetadata extends BaseMutableContentMetadata implements
- MutableObjectInfoWithMetadata {
-
- private final MutableObjectInfoWithMetadata delegate;
-
- public DelegatingMutableObjectInfoWithMetadata(MutableObjectInfoWithMetadata delegate) {
- this.delegate = delegate;
- }
-
- @Override
- public Long getContentLength() {
- return delegate.getBytes();
- }
-
- @Override
- public String getContentType() {
- return delegate.getContentType();
- }
-
- @Override
- public byte[] getContentMD5() {
- return delegate.getHash();
- }
-
- @Override
- public int hashCode() {
- return delegate.hashCode();
- }
-
- @Override
- public void setContentLength(Long bytes) {
- if (bytes != null)
- delegate.setBytes(bytes);
- }
-
- @Override
- public void setContentType(String contentType) {
- delegate.setContentType(contentType);
- }
-
- @Override
- public void setContentMD5(byte[] hash) {
- delegate.setHash(hash);
- }
-
- public MutableObjectInfoWithMetadata getDelegate() {
- return delegate;
- }
-
- @Override
- public Map<String, String> getMetadata() {
- return delegate.getMetadata();
- }
-
- @Override
- public void setBytes(Long bytes) {
- delegate.setBytes(bytes);
- }
-
- @Override
- public void setHash(byte[] hash) {
- delegate.setHash(hash);
- }
-
- @Override
- public void setLastModified(Date lastModified) {
- delegate.setLastModified(lastModified);
- }
-
- @Override
- public void setName(String name) {
- delegate.setName(name);
- }
-
- @Override
- public Long getBytes() {
- return delegate.getBytes();
- }
-
- @Override
- public byte[] getHash() {
- return delegate.getHash();
- }
-
- @Override
- public Date getLastModified() {
- return delegate.getLastModified();
- }
-
- @Override
- public String getName() {
- return delegate.getName();
- }
-
- @Override
- public int compareTo(ObjectInfo o) {
- return delegate.compareTo(o);
- }
-
- @Override
- public void setContainer(String container) {
- delegate.setContainer(container);
- }
-
- @Override
- public String getContainer() {
- return delegate.getContainer();
- }
-
- @Override
- public void setUri(URI uri) {
- delegate.setUri(uri);
- }
-
- @Override
- public URI getUri() {
- return delegate.getUri();
- }
-
- @Override
- public void setObjectManifest(String objectManifest) {
- delegate.setObjectManifest(objectManifest);
- }
-
- @Override
- public String getObjectManifest() {
- return delegate.getObjectManifest();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/MutableObjectInfoWithMetadataImpl.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/MutableObjectInfoWithMetadataImpl.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/MutableObjectInfoWithMetadataImpl.java
deleted file mode 100644
index d722419..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/MutableObjectInfoWithMetadataImpl.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.domain.internal;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.Map;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
-import org.jclouds.openstack.swift.domain.ObjectInfo;
-
-import com.google.common.collect.Maps;
-
-public class MutableObjectInfoWithMetadataImpl implements MutableObjectInfoWithMetadata {
- private String name;
- private String container;
- private URI uri;
- private Long bytes;
- private byte[] hash;
- private String contentType = MediaType.APPLICATION_OCTET_STREAM;
- private Date lastModified;
- private String objectManifest;
- private final Map<String, String> metadata = Maps.newLinkedHashMap();
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setBytes(Long bytes) {
- this.bytes = bytes;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setHash(byte[] hash) {
- this.hash = hash;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Long getBytes() {
- return bytes;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getContentType() {
- return contentType;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public byte[] getHash() {
- return hash;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Date getLastModified() {
- return lastModified;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((container == null) ? 0 : container.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((objectManifest == null) ? 0 : objectManifest.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- MutableObjectInfoWithMetadataImpl other = (MutableObjectInfoWithMetadataImpl) obj;
- if (container == null) {
- if (other.container != null)
- return false;
- } else if (!container.equals(other.container))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (objectManifest == null) {
- if (other.objectManifest != null)
- return false;
- } else if (!objectManifest.equals(other.objectManifest))
- return false;
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int compareTo(ObjectInfo o) {
- return (this == o) ? 0 : getName().compareTo(o.getName());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setLastModified(Date lastModified) {
- this.lastModified = lastModified;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getContainer() {
- return container;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setContainer(String container) {
- this.container = container;
- }
-
- @Override
- public void setUri(URI uri) {
- this.uri = uri;
- }
-
- @Override
- public URI getUri() {
- return uri;
- }
-
- @Override
- public String getObjectManifest() {
- return objectManifest;
- }
-
- @Override
- public void setObjectManifest(String objectManifest) {
- this.objectManifest = objectManifest;
- }
-
- @Override
- public String toString() {
- return String.format("[name=%s, container=%s, uri=%s, bytes=%s, contentType=%s, lastModified=%s, hash=%s, objectManifest=%s]",
- name, container, uri, bytes, contentType, lastModified, Arrays.toString(hash), objectManifest);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/ObjectInfoImpl.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/ObjectInfoImpl.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/ObjectInfoImpl.java
deleted file mode 100644
index c9f391a..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/ObjectInfoImpl.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.domain.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Date;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.swift.domain.ObjectInfo;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ComparisonChain;
-import com.google.common.collect.Ordering;
-
-/**
- * Class ObjectInfoImpl
- */
-public class ObjectInfoImpl implements ObjectInfo {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromObjectInfoImpl(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String name;
- protected String container;
- protected URI uri;
- protected byte[] hash;
- protected Long bytes;
- protected String contentType;
- protected Date lastModified;
-
- /**
- * @see ObjectInfoImpl#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see ObjectInfoImpl#getContainer()
- */
- public T container(String container) {
- this.container = container;
- return self();
- }
-
- /**
- * @see ObjectInfoImpl#getUri()
- */
- public T uri(URI uri) {
- this.uri = uri;
- return self();
- }
-
- /**
- * @see ObjectInfoImpl#getHash()
- */
- public T hash(byte[] hash) {
- this.hash = hash;
- return self();
- }
-
- /**
- * @see ObjectInfoImpl#getBytes()
- */
- public T bytes(Long bytes) {
- this.bytes = bytes;
- return self();
- }
-
- /**
- * @see ObjectInfoImpl#getContentType()
- */
- public T contentType(String contentType) {
- this.contentType = contentType;
- return self();
- }
-
- /**
- * @see ObjectInfoImpl#getLastModified()
- */
- public T lastModified(Date lastModified) {
- this.lastModified = lastModified;
- return self();
- }
-
- public ObjectInfoImpl build() {
- return new ObjectInfoImpl(name, container, uri, hash, bytes, contentType, lastModified);
- }
-
- public T fromObjectInfoImpl(ObjectInfoImpl in) {
- return this
- .name(in.getName())
- .container(in.getContainer())
- .uri(in.getUri())
- .hash(in.getHash())
- .bytes(in.getBytes())
- .contentType(in.getContentType())
- .lastModified(in.getLastModified());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String name;
- private final String container;
- private final URI uri;
- private final byte[] hash;
- private final Long bytes;
- @Named("content_type")
- private final String contentType;
- @Named("last_modified")
- private final Date lastModified;
-
- @ConstructorProperties({
- "name", "container", "uri", "hash", "bytes", "content_type", "last_modified"
- })
- protected ObjectInfoImpl(String name, @Nullable String container, @Nullable URI uri, @Nullable byte[] hash, @Nullable Long bytes,
- @Nullable String contentType, @Nullable Date lastModified) {
- this.name = checkNotNull(name, "name");
- this.container = container;
- this.uri = uri;
- this.hash = hash;
- this.bytes = bytes;
- this.contentType = contentType;
- this.lastModified = lastModified;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return this.name;
- }
-
- /**
- * {@inheritDoc}
- */
- @Nullable
- @Override
- public String getContainer() {
- return this.container;
- }
-
- /**
- * {@inheritDoc}
- */
- @Nullable
- @Override
- public URI getUri() {
- return this.uri;
- }
-
- /**
- * {@inheritDoc}
- */
- @Nullable
- @Override
- public byte[] getHash() {
- return this.hash;
- }
-
- /**
- * {@inheritDoc}
- */
- @Nullable
- @Override
- public Long getBytes() {
- return this.bytes;
- }
-
- /**
- * {@inheritDoc}
- */
- @Nullable
- @Override
- public String getContentType() {
- return this.contentType;
- }
-
- /**
- * {@inheritDoc}
- */
- @Nullable
- @Override
- public Date getLastModified() {
- return this.lastModified;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(name, container);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ObjectInfoImpl that = ObjectInfoImpl.class.cast(obj);
- return Objects.equal(this.name, that.name)
- && Objects.equal(this.container, that.container);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("name", name).add("container", container).add("uri", uri).add("hash", Arrays.toString(hash))
- .add("bytes", bytes).add("contentType", contentType).add("lastModified", lastModified);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- @Override
- public int compareTo(ObjectInfo other) {
- return ComparisonChain.start().compare(name, other.getName()).compare(container, other.getContainer(), Ordering.natural().nullsLast()).result();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/SwiftObjectImpl.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/SwiftObjectImpl.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/SwiftObjectImpl.java
deleted file mode 100644
index 2319a41..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/SwiftObjectImpl.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.domain.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpUtils;
-import org.jclouds.http.internal.PayloadEnclosingImpl;
-import org.jclouds.io.Payload;
-import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
-import org.jclouds.openstack.swift.domain.SwiftObject;
-
-import com.google.common.collect.LinkedHashMultimap;
-import com.google.common.collect.Multimap;
-
-/**
- * Default Implementation of {@link SwiftObject}.
- */
-public class SwiftObjectImpl extends PayloadEnclosingImpl implements SwiftObject, Comparable<SwiftObject> {
-
- private final DelegatingMutableObjectInfoWithMetadata info;
- private Multimap<String, String> allHeaders = LinkedHashMultimap.create();
-
- @Inject
- public SwiftObjectImpl(MutableObjectInfoWithMetadata info) {
- super();
- this.info = new DelegatingMutableObjectInfoWithMetadata(info);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public MutableObjectInfoWithMetadata getInfo() {
- return info;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Multimap<String, String> getAllHeaders() {
- return allHeaders;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setAllHeaders(Multimap<String, String> allHeaders) {
- this.allHeaders = checkNotNull(allHeaders, "allHeaders");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int compareTo(SwiftObject o) {
- if (getInfo().getName() == null)
- return -1;
- return (this == o) ? 0 : getInfo().getName().compareTo(o.getInfo().getName());
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((info == null) ? 0 : info.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- SwiftObjectImpl other = (SwiftObjectImpl) obj;
- if (info == null) {
- if (other.info != null)
- return false;
- } else if (!info.equals(other.info))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[info=" + info + "]";
- }
-
- @Override
- public void setPayload(Payload data) {
- HttpUtils.copy(data.getContentMetadata(), info);
- data.setContentMetadata(info);
- super.setPayload(data);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyApi.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyApi.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyApi.java
deleted file mode 100644
index 6c71dfe..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyApi.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.extensions;
-
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.swift.Storage;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.RequestFilters;
-
-/**
- * Only purpose is to override the auth filter with one that works in keystone
- */
-@RequestFilters(AuthenticateRequest.class)
-@Endpoint(Storage.class)
-public interface KeystoneTemporaryUrlKeyApi extends TemporaryUrlKeyApi {
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyApi.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyApi.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyApi.java
deleted file mode 100644
index 0a96960..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyApi.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.extensions;
-
-import static org.jclouds.openstack.swift.reference.SwiftHeaders.ACCOUNT_TEMPORARY_URL_KEY;
-
-import java.io.Closeable;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-
-import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.openstack.swift.Storage;
-import org.jclouds.openstack.swift.functions.ParseTemporaryUrlKeyFromHeaders;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-
-@RequestFilters(AuthenticateRequest.class)
-@Endpoint(Storage.class)
-public interface TemporaryUrlKeyApi extends Closeable {
-
- /**
- * Retrieve the key used to generate Temporary object access URLs
- *
- * @return shared secret key or null
- */
- @Named("GetAccountMetadata")
- @HEAD
- @Path("/")
- @Consumes
- @ResponseParser(ParseTemporaryUrlKeyFromHeaders.class)
- String getTemporaryUrlKey();
-
- /**
- * To create a Temporary URL you must first set a key as account metadata.
- * <p/>
- * Once the key is set, you should not change it while you still want others to be
- * able to access your temporary URL. If you change it, the TempURL becomes invalid
- * (within 60 seconds, which is the cache time for a key) and others will not be allowed
- * to access it.
- */
- @Named("UpdateAccountMetadata")
- @POST
- @Path("/")
- void setTemporaryUrlKey(@HeaderParam(ACCOUNT_TEMPORARY_URL_KEY) String key);
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ObjectName.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ObjectName.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ObjectName.java
deleted file mode 100644
index 409b1a0..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ObjectName.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.functions;
-
-import org.jclouds.openstack.swift.domain.SwiftObject;
-
-import com.google.common.base.Function;
-
-public class ObjectName implements Function<Object, String> {
-
- public String apply(Object from) {
- return ((SwiftObject) from).getInfo().getName();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java
deleted file mode 100644
index 68cad90..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.swift.domain.AccountMetadata;
-import org.jclouds.openstack.swift.reference.SwiftHeaders;
-
-import com.google.common.base.Function;
-
-/**
- * This parses {@link AccountMetadata} from HTTP headers.
- */
-public class ParseAccountMetadataResponseFromHeaders implements Function<HttpResponse, AccountMetadata> {
-
- /**
- * parses the http response headers to create a new {@link AccountMetadata} object.
- */
- public AccountMetadata apply(final HttpResponse from) {
- String bytesString = checkNotNull(from.getFirstHeaderOrNull(SwiftHeaders.ACCOUNT_BYTES_USED),
- SwiftHeaders.ACCOUNT_BYTES_USED);
- String containersCountString = checkNotNull(from.getFirstHeaderOrNull(SwiftHeaders.ACCOUNT_CONTAINER_COUNT),
- SwiftHeaders.ACCOUNT_CONTAINER_COUNT);
- return AccountMetadata.builder().containerCount(Long.parseLong(containersCountString))
- .bytes(Long.parseLong(bytesString)).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerMetadataFromHeaders.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerMetadataFromHeaders.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerMetadataFromHeaders.java
deleted file mode 100644
index 27adb02..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerMetadataFromHeaders.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.functions;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.swift.domain.ContainerMetadata;
-import org.jclouds.openstack.swift.reference.SwiftHeaders;
-import org.jclouds.rest.InvocationContext;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.collect.Maps;
-
-/**
- * This parses @{link {@link org.jclouds.openstack.swift.domain.ContainerMetadata} from
- * HTTP headers.
- */
-public class ParseContainerMetadataFromHeaders implements Function<HttpResponse, ContainerMetadata>,
- InvocationContext<ParseContainerMetadataFromHeaders> {
- private GeneratedHttpRequest request;
-
- public ContainerMetadata apply(HttpResponse from) {
- return ContainerMetadata.builder().name(request.getInvocation().getArgs().get(0).toString())
- .readACL(from.getFirstHeaderOrNull(SwiftHeaders.CONTAINER_READ))
- .bytes(Long.parseLong(from.getFirstHeaderOrNull(SwiftHeaders.CONTAINER_BYTES_USED)))
- .count(Long.parseLong(from.getFirstHeaderOrNull(SwiftHeaders.CONTAINER_OBJECT_COUNT)))
- .metadata(extractUserMetadata(from)).build();
- }
-
-
- @VisibleForTesting
- Map<String, String> extractUserMetadata(HttpResponse from) {
- Map<String, String> metadata = Maps.newHashMap();
- for (Entry<String, String> header : from.getHeaders().entries()) {
- if (header.getKey() != null && header.getKey().startsWith(SwiftHeaders.CONTAINER_METADATA_PREFIX))
- metadata.put((header.getKey().substring(SwiftHeaders.CONTAINER_METADATA_PREFIX.length())).toLowerCase(),
- header.getValue());
- }
- return metadata;
- }
-
- @Override
- public ParseContainerMetadataFromHeaders setContext(HttpRequest request) {
- checkArgument(request instanceof GeneratedHttpRequest, "note this handler requires a GeneratedHttpRequest");
- this.request = (GeneratedHttpRequest) request;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectFromHeadersAndHttpContent.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectFromHeadersAndHttpContent.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectFromHeadersAndHttpContent.java
deleted file mode 100644
index 03062e7..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectFromHeadersAndHttpContent.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.functions;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
-import org.jclouds.openstack.swift.domain.SwiftObject;
-import org.jclouds.rest.InvocationContext;
-
-import com.google.common.base.Function;
-
-/**
- * Parses response headers and creates a new SwiftObject from them and the HTTP content.
- *
- * @see ParseMetadataFromHeaders
- */
-public class ParseObjectFromHeadersAndHttpContent implements Function<HttpResponse, SwiftObject>,
- InvocationContext<ParseObjectFromHeadersAndHttpContent> {
-
- private final ParseObjectInfoFromHeaders infoParser;
- private final SwiftObject.Factory objectProvider;
-
- @Inject
- public ParseObjectFromHeadersAndHttpContent(ParseObjectInfoFromHeaders infoParser,
- SwiftObject.Factory objectProvider) {
- this.infoParser = infoParser;
- this.objectProvider = objectProvider;
- }
-
- public SwiftObject apply(HttpResponse from) {
- MutableObjectInfoWithMetadata metadata = infoParser.apply(from);
- if (metadata.getHash() != null)
- from.getPayload().getContentMetadata().setContentMD5(metadata.getHash());
- SwiftObject object = objectProvider.create(metadata);
- object.getAllHeaders().putAll(from.getHeaders());
- object.setPayload(from.getPayload());
- return object;
- }
-
- @Override
- public ParseObjectFromHeadersAndHttpContent setContext(HttpRequest request) {
- infoParser.setContext(request);
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeaders.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeaders.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeaders.java
deleted file mode 100644
index c282903..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeaders.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.functions;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static org.jclouds.http.HttpUtils.attemptToParseSizeAndRangeFromHeaders;
-
-import javax.inject.Inject;
-
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.functions.ParseSystemAndUserMetadataFromHeaders;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.swift.blobstore.functions.ResourceToObjectInfo;
-import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
-import org.jclouds.openstack.swift.utils.ETagUtils;
-import org.jclouds.rest.InvocationContext;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-import com.google.common.base.Function;
-import com.google.common.net.HttpHeaders;
-
-/**
- * This parses @{link {@link MutableObjectInfoWithMetadata} from HTTP headers.
- */
-public class ParseObjectInfoFromHeaders implements Function<HttpResponse, MutableObjectInfoWithMetadata>,
- InvocationContext<ParseObjectInfoFromHeaders> {
- private final ParseSystemAndUserMetadataFromHeaders blobMetadataParser;
- private final ResourceToObjectInfo blobToObjectInfo;
- private String container;
-
- @Inject
- public ParseObjectInfoFromHeaders(ParseSystemAndUserMetadataFromHeaders blobMetadataParser,
- ResourceToObjectInfo blobToObjectInfo) {
- this.blobMetadataParser = blobMetadataParser;
- this.blobToObjectInfo = blobToObjectInfo;
- }
-
- /**
- * parses the http response headers to create a new {@link MutableObjectInfoWithMetadata} object.
- */
- public MutableObjectInfoWithMetadata apply(HttpResponse from) {
- BlobMetadata base = blobMetadataParser.apply(from);
- MutableObjectInfoWithMetadata to = blobToObjectInfo.apply(base);
- to.setBytes(attemptToParseSizeAndRangeFromHeaders(from));
- to.setContainer(container);
- to.setUri(base.getUri());
- String eTagHeader = from.getFirstHeaderOrNull(HttpHeaders.ETAG);
- if (eTagHeader != null) {
- to.setHash(ETagUtils.convertHexETagToByteArray(eTagHeader));
- }
- to.setObjectManifest(from.getFirstHeaderOrNull("X-Object-Manifest"));
-
- return to;
- }
-
- @Override
- public ParseObjectInfoFromHeaders setContext(HttpRequest request) {
- blobMetadataParser.setContext(request);
- checkArgument(request instanceof GeneratedHttpRequest, "note this handler requires a GeneratedHttpRequest");
- return setContainer(GeneratedHttpRequest.class.cast(request).getInvocation().getArgs().get(0).toString());
- }
-
- private ParseObjectInfoFromHeaders setContainer(String container) {
- this.container = container;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java
deleted file mode 100644
index 485408a..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.functions;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.http.Uris.uriBuilder;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.SortedSet;
-
-import javax.inject.Inject;
-
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.internal.PageSetImpl;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-import org.jclouds.openstack.swift.domain.ObjectInfo;
-import org.jclouds.openstack.swift.domain.internal.ObjectInfoImpl;
-import org.jclouds.openstack.swift.options.ListContainerOptions;
-import org.jclouds.rest.InvocationContext;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.util.Strings2;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-import com.google.gson.reflect.TypeToken;
-import com.google.inject.TypeLiteral;
-
-/**
- * This parses {@link ObjectInfo} from a gson string.
- */
-public class ParseObjectInfoListFromJsonResponse extends ParseJson<PageSet<ObjectInfo>> implements
- InvocationContext<ParseObjectInfoListFromJsonResponse> {
-
- private List<Object> args;
- private String container;
- private GeneratedHttpRequest request;
- private ListContainerOptions options;
-
- @Inject
- public ParseObjectInfoListFromJsonResponse(Json json) {
- super(json, new TypeLiteral<PageSet<ObjectInfo>>() {
- });
- }
-
- public PageSet<ObjectInfo> apply(InputStream stream) {
- checkState(args != null, "request should be initialized at this point");
- Type listType = new TypeToken<SortedSet<ObjectInfoImpl>>() {
- }.getType();
-
- try {
- SortedSet<ObjectInfoImpl> list = apply(stream, listType);
- SortedSet<ObjectInfo> returnVal = Sets.newTreeSet(Iterables.transform(list,
- new Function<ObjectInfoImpl, ObjectInfo>() {
- public ObjectInfo apply(ObjectInfoImpl from) {
- // appendPath decodes the argument and we should pass an encoded string
- return from.toBuilder().container(container)
- .uri(uriBuilder(request.getEndpoint()).clearQuery().appendPath(
- Strings2.urlEncode(from.getName())).build())
- .build();
- }
- }));
- boolean truncated = options.getMaxResults() == returnVal.size();
- String marker = null;
- if (truncated && !returnVal.isEmpty()) {
- marker = returnVal.last().getName();
- }
- return new PageSetImpl<ObjectInfo>(returnVal, marker);
- } catch (IOException e) {
- throw new RuntimeException("problem reading response from request: " + request, e);
- }
- }
-
- @Override
- public ParseObjectInfoListFromJsonResponse setContext(HttpRequest request) {
- checkArgument(request instanceof GeneratedHttpRequest, "note this handler requires a GeneratedHttpRequest");
- this.request = GeneratedHttpRequest.class.cast(request);
- this.args = this.request.getInvocation().getArgs();
- checkArgument(args.get(0) instanceof String, "arg[0] must be a container name");
- this.container = args.get(0).toString();
- checkArgument(args.get(1) instanceof ListContainerOptions[], "arg[1] must be an array of ListContainerOptions");
- ListContainerOptions[] optionsList = (ListContainerOptions[]) args.get(1);
- this.options = optionsList.length > 0 ? optionsList[0] : ListContainerOptions.NONE;
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseTemporaryUrlKeyFromHeaders.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseTemporaryUrlKeyFromHeaders.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseTemporaryUrlKeyFromHeaders.java
deleted file mode 100644
index 41da429..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseTemporaryUrlKeyFromHeaders.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.functions;
-
-import static org.jclouds.openstack.swift.reference.SwiftHeaders.ACCOUNT_TEMPORARY_URL_KEY;
-
-import org.jclouds.http.HttpResponse;
-
-import com.google.common.base.Function;
-
-public class ParseTemporaryUrlKeyFromHeaders implements Function<HttpResponse, String> {
-
- @Override
- public String apply(HttpResponse httpResponse) {
- return httpResponse.getFirstHeaderOrNull(ACCOUNT_TEMPORARY_URL_KEY);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponse.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponse.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponse.java
deleted file mode 100644
index 96efdc1..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponse.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.handlers;
-
-import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-
-import org.jclouds.blobstore.ContainerNotFoundException;
-import org.jclouds.blobstore.KeyNotFoundException;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.swift.CopyObjectException;
-import org.jclouds.openstack.swift.reference.SwiftHeaders;
-import org.jclouds.rest.AuthorizationException;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- */
-public class ParseSwiftErrorFromHttpResponse implements HttpErrorHandler {
- @Resource
- protected Logger logger = Logger.NULL;
- public static final String PREFIX = "^/v[0-9][^/]*/[^/]+/";
- public static final Pattern CONTAINER_PATH = Pattern.compile(PREFIX + "([^/]+)$");
- public static final Pattern CONTAINER_KEY_PATH = Pattern.compile(PREFIX + "([^/]+)/(.*)");
-
- public void handleError(HttpCommand command, HttpResponse response) {
- // it is important to always read fully and close streams
- byte[] data = closeClientButKeepContentStream(response);
- String message = data != null ? new String(data) : null;
-
- Exception exception = message != null ? new HttpResponseException(command, response, message)
- : new HttpResponseException(command, response);
- message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
- response.getStatusLine());
- switch (response.getStatusCode()) {
- case 401:
- exception = new AuthorizationException(exception.getMessage(), exception);
- break;
- case 404:
- String sourcePath = command.getCurrentRequest().getFirstHeaderOrNull(SwiftHeaders.OBJECT_COPY_FROM);
- Exception oldException = exception;
-
- if (sourcePath != null) {
- String path = command.getCurrentRequest().getEndpoint().getPath();
- int startOfDestinationPath = path.lastIndexOf("/", path.lastIndexOf("/") - 1);
- String destinationPath = path.substring(startOfDestinationPath);
-
- exception = new CopyObjectException(sourcePath, destinationPath, message);
- exception.initCause(oldException);
- }
- else if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
- String path = command.getCurrentRequest().getEndpoint().getPath();
- Matcher matcher = CONTAINER_PATH.matcher(path);
-
- if (matcher.find()) {
- exception = new ContainerNotFoundException(matcher.group(1), message);
- exception.initCause(oldException);
- } else {
- matcher = CONTAINER_KEY_PATH.matcher(path);
- if (matcher.find()) {
- exception = new KeyNotFoundException(matcher.group(1), matcher.group(2), message);
- exception.initCause(oldException);
- }
- }
- }
- break;
- }
- command.setException(exception);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/options/CreateContainerOptions.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/options/CreateContainerOptions.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/options/CreateContainerOptions.java
deleted file mode 100644
index cfe611b..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/options/CreateContainerOptions.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.options;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.jclouds.http.options.BaseHttpRequestOptions;
-import org.jclouds.openstack.swift.reference.SwiftHeaders;
-
-/**
- * Contains options supported in the REST API for the Create Container operation.
- *
- * This specifically enables the Swift ACL for public reads using the 'X-Container-Read'
- * header. This should be refactored into the Swift API.
- */
-public class CreateContainerOptions extends BaseHttpRequestOptions {
- public static final CreateContainerOptions NONE = new CreateContainerOptions();
-
- /**
- * A name-value pair to associate with the container as metadata.
- */
- public CreateContainerOptions withMetadata(Map<String, String> metadata) {
- for (Entry<String, String> entry : metadata.entrySet()) {
- if (entry.getKey().startsWith(SwiftHeaders.CONTAINER_METADATA_PREFIX)) {
- this.headers.put(entry.getKey(), entry.getValue());
- } else {
- this.headers.put(SwiftHeaders.CONTAINER_METADATA_PREFIX + entry.getKey(),
- entry.getValue());
- }
- }
- return this;
- }
-
-
- /**
- * Indicates whether a container may be accessed publicly
- */
- public CreateContainerOptions withPublicAccess() {
- this.headers.put(SwiftHeaders.CONTAINER_READ, ".r:*,.rlistings");
- return this;
- }
-
- public static class Builder {
-
- public static CreateContainerOptions withPublicAccess() {
- CreateContainerOptions options = new CreateContainerOptions();
- return options.withPublicAccess();
- }
-
- public static CreateContainerOptions withMetadata(Map<String, String> metadata) {
- CreateContainerOptions options = new CreateContainerOptions();
- return options.withMetadata(metadata);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/options/ListContainerOptions.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/options/ListContainerOptions.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/options/ListContainerOptions.java
deleted file mode 100644
index 8f0e36c..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/options/ListContainerOptions.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Contains options supported in the REST API for the GET container operation. <h2>
- */
-public class ListContainerOptions extends BaseHttpRequestOptions {
- public static final ListContainerOptions NONE = new ListContainerOptions();
-
- /**
- * Indicates where to begin listing the account's containers. The list will only include
- * containers whose names occur lexicographically after the marker. This is convenient for
- * pagination: To get the next page of results use the last container name of the current page as
- * the marker.
- */
- public ListContainerOptions afterMarker(String marker) {
- queryParameters.put("marker", checkNotNull(marker, "marker"));
- return this;
- }
-
- public String getMarker() {
- return getFirstQueryOrNull("marker");
- }
-
- /**
- * The maximum number of containers that will be included in the response body. The server might
- * return fewer than this many containers, but will not return more.
- */
- public ListContainerOptions maxResults(int limit) {
- checkState(limit >= 0, "limit must be >= 0");
- checkState(limit <= 10000, "limit must be <= 10000");
- queryParameters.put("limit", Integer.toString(limit));
- return this;
- }
-
- public int getMaxResults() {
- String val = getFirstQueryOrNull("limit");
- return val != null ? Integer.parseInt(val) : 10000;
- }
-
- /**
- * For a string value X, causes the results to be limited to Object names beginning with the
- * substring X.
- *
- */
- public ListContainerOptions withPrefix(String prefix) {
- queryParameters.put("prefix", checkNotNull(prefix, "prefix"));
- return this;
- }
-
- public String getPrefix() {
- return getFirstQueryOrNull("prefix");
- }
-
- /**
- * For a string value X, return the Object names nested in the pseudo path.
- * <p/>
- * Users will be able to simulate a hierarchical structure in Cloud Files by following a few
- * guidelines. Object names must contain the forward slash character / as a path element
- * separator and also create directory marker Objects, then they will be able to traverse this
- * nested structure with the new path query parameter.
- * <p/>
- * To take advantage of this feature, the directory marker Objects must also be created to
- * represent the appropriate directories. The following additional Objects need to be created. A
- * good convention would be to create these as zero or one byte files with a Content-Type of
- * application/directory
- */
- public ListContainerOptions underPath(String path) {
- queryParameters.put("path", checkNotNull(path, "path"));
- return this;
- }
-
- public String getPath() {
- return getFirstQueryOrNull("path");
- }
-
- public static class Builder {
-
- /**
- * @see ListContainerOptions#afterMarker(String)
- */
- public static ListContainerOptions afterMarker(String marker) {
- ListContainerOptions options = new ListContainerOptions();
- return options.afterMarker(marker);
- }
-
- /**
- * @see ListContainerOptions#limit(int)
- */
- public static ListContainerOptions maxResults(int limit) {
- ListContainerOptions options = new ListContainerOptions();
- return options.maxResults(limit);
- }
-
- /**
- * @see ListContainerOptions#withPrefix(String)
- */
- public static ListContainerOptions withPrefix(String prefix) {
- ListContainerOptions options = new ListContainerOptions();
- return options.withPrefix(prefix);
- }
-
- /**
- * @see ListContainerOptions#withPath(String)
- */
- public static ListContainerOptions underPath(String path) {
- ListContainerOptions options = new ListContainerOptions();
- return options.underPath(path);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftConstants.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftConstants.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftConstants.java
deleted file mode 100644
index 6e5b535..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftConstants.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.reference;
-
-
-/**
- * Configuration properties and constants used in Cloud Files connections.
- */
-public final class SwiftConstants {
- /**
- * For an integer value N, limits the number of results to at most N values.
- */
- public static final String LIMIT = "limit";
- /**
- * Given a string value X, return Object names greater in value than the specified marker.
- */
- public static final String MARKER = "marker";
- /**
- * For a string value X, causes the results to be limited to Object names beginning with the
- * substring X.
- */
- public static final String PREFIX = "prefix";
- /**
- * For a string value X, return the Object names nested in the pseudo path.
- */
- public static final String PATH = "path";
-
- private SwiftConstants() {
- throw new AssertionError("intentionally unimplemented");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftHeaders.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftHeaders.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftHeaders.java
deleted file mode 100644
index b2d143c..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftHeaders.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.reference;
-
-public class SwiftHeaders {
-
- public static final String ACCOUNT_TEMPORARY_URL_KEY = "X-Account-Meta-Temp-Url-Key";
- public static final String ACCOUNT_BYTES_USED = "X-Account-Bytes-Used";
- public static final String ACCOUNT_CONTAINER_COUNT = "X-Account-Container-Count";
-
- public static final String CONTAINER_BYTES_USED = "X-Container-Bytes-Used";
- public static final String CONTAINER_OBJECT_COUNT = "X-Container-Object-Count";
- public static final String CONTAINER_METADATA_PREFIX = "X-Container-Meta-";
- public static final String CONTAINER_DELETE_METADATA_PREFIX = "X-Remove-Container-Meta-";
-
- public static final String USER_METADATA_PREFIX = "X-Object-Meta-";
- public static final String OBJECT_COPY_FROM = "X-Copy-From";
-
- public static final String CONTAINER_READ = "X-Container-Read";
- public static final String CONTAINER_WRITE = "X-Container-Write";
-
- protected SwiftHeaders() {
- throw new AssertionError("intentionally unimplemented");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/suppliers/ReturnOrFetchTemporaryUrlKey.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/suppliers/ReturnOrFetchTemporaryUrlKey.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/suppliers/ReturnOrFetchTemporaryUrlKey.java
deleted file mode 100644
index a96f343..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/suppliers/ReturnOrFetchTemporaryUrlKey.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.suppliers;
-
-import com.google.common.base.Supplier;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.jclouds.openstack.swift.extensions.TemporaryUrlKeyApi;
-
-import java.util.UUID;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-@Singleton
-public class ReturnOrFetchTemporaryUrlKey implements Supplier<String> {
-
- private TemporaryUrlKeyApi client;
-
- @Inject
- public ReturnOrFetchTemporaryUrlKey(TemporaryUrlKeyApi client) {
- this.client = checkNotNull(client, "client");
- }
-
- @Override
- public String get() {
- String key = client.getTemporaryUrlKey();
- if (key == null) {
- client.setTemporaryUrlKey(UUID.randomUUID().toString());
- return client.getTemporaryUrlKey();
- }
- return key;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/592a4e7c/apis/swift/src/main/java/org/jclouds/openstack/swift/utils/ETagUtils.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/utils/ETagUtils.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/utils/ETagUtils.java
deleted file mode 100644
index 93e0530..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/utils/ETagUtils.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.swift.utils;
-
-import java.util.regex.Pattern;
-
-import com.google.common.annotations.VisibleForTesting;
-
-import static com.google.common.io.BaseEncoding.base16;
-
-public class ETagUtils {
- private static final Pattern QUOTED_STRING = Pattern.compile("^\"(.*)\"$");
-
- /**
- * <p>Converts the ETag of an OpenStack object to a byte array.</p>
- *
- * <p>Not applicable to all ETags, only those of OpenStack objects. According
- * to the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11">HTTP spec</a>
- * an eTag can be any string, but the
- * <a href="http://docs.openstack.org/trunk/openstack-object-storage/admin/content/additional-notes-on-large-objects.html">OpenStack Object Storage Administration Guide</a>
- * says that the ETag of an OpenStack object will be an MD5 sum (and MD5 sums
- * are conventionally represented as hex strings). This method only accepts
- * hex strings as input, not arbitrary strings.</p>
- */
- public static byte[] convertHexETagToByteArray(String hexETag) {
- hexETag = unquote(hexETag);
- return base16().lowerCase().decode(hexETag);
- }
-
- @VisibleForTesting
- static String unquote(String eTag) {
- return QUOTED_STRING.matcher(eTag).replaceAll("$1");
- }
-}