http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/Blob.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/Blob.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/Blob.java deleted file mode 100644 index d916652..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/Blob.java +++ /dev/null @@ -1,89 +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.blobstore.representations; - -import com.google.common.base.Objects; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Map; - -public class Blob implements Serializable { - - private static final long serialVersionUID = 6035812193926955340L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Map<String, Collection<String>> allHeaders; - private BlobMetadata blobMetadata; - - public Builder allHeaders(final Map<String, Collection<String>> allHeaders) { - this.allHeaders = allHeaders; - return this; - } - - public Builder blobMetadata(final BlobMetadata blobMetadata) { - this.blobMetadata = blobMetadata; - return this; - } - - public Blob build() { - return new Blob(allHeaders, blobMetadata); - } - } - - private final Map<String, Collection<String>> allHeaders; - private final BlobMetadata blobMetadata; - - public Blob(Map<String, Collection<String>> allHeaders, BlobMetadata blobMetadata) { - this.allHeaders = allHeaders; - this.blobMetadata = blobMetadata; - } - - public Map<String, Collection<String>> getAllHeaders() { - return allHeaders; - } - - public BlobMetadata getBlobMetadata() { - return blobMetadata; - } - - public int hashCode() { - return Objects.hashCode(blobMetadata, allHeaders); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof Blob)) { - return false; - } - Blob that = (Blob) obj; - return Objects.equal(this.allHeaders, that.allHeaders) && - Objects.equal(this.blobMetadata, that.blobMetadata); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("blobMetadata", blobMetadata).add("allHeaders", allHeaders) - .toString(); - } -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/BlobMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/BlobMetadata.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/BlobMetadata.java deleted file mode 100644 index 6e22b8d..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/BlobMetadata.java +++ /dev/null @@ -1,228 +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.blobstore.representations; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableMap; - -import java.io.Serializable; -import java.net.URI; -import java.util.Date; -import java.util.Map; - -import static org.jclouds.representations.Representations.dateFormat; - -public class BlobMetadata implements Serializable { - - private static final long serialVersionUID = 1348620321325703530L; - - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String publicUri; - private ContentMetadata content; - private String type; - private String providerId; - private String name; - private String uri; - private Map<String, String> userMetadata = ImmutableMap.of(); - private String eTag; - private String creationDate; - private String lastModifiedDate; - - public Builder type(final String type) { - this.type = type; - return this; - } - - public Builder providerId(final String providerId) { - this.providerId = providerId; - return this; - } - - public Builder name(final String name) { - this.name = name; - return this; - } - - public Builder uri(final URI uri) { - if (uri != null) { - this.uri = uri.toString(); - } - return this; - } - - public Builder uri(final String uri) { - this.uri = uri; - return this; - } - - public Builder userMetadata(final Map<String, String> userMetadata) { - this.userMetadata = ImmutableMap.copyOf(userMetadata); - return this; - } - - public Builder eTag(final String eTag) { - this.eTag = eTag; - return this; - } - - public Builder creationDate(final Date creationDate) { - this.creationDate = dateFormat(creationDate); - return this; - } - - public Builder creationDate(final String creationDate) { - this.creationDate = creationDate; - return this; - } - - public Builder lastModifiedDate(final Date lastModifiedDate) { - this.lastModifiedDate = dateFormat(lastModifiedDate); - return this; - } - - public Builder lastModifiedDate(final String lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - return this; - } - - public Builder publicUri(final URI publicUri) { - if (publicUri != null) { - this.publicUri = publicUri.toString(); - } - return this; - } - - public Builder publicUri(final String publicUri) { - this.publicUri = publicUri; - return this; - } - - public Builder content(final ContentMetadata content) { - this.content = content; - return this; - } - - public BlobMetadata build() { - return new BlobMetadata(type, providerId, name, uri, userMetadata, eTag, creationDate, lastModifiedDate, - publicUri, content); - } - } - - private final String type; - private final String providerId; - private final String name; - private final String uri; - private final Map<String, String> userMetadata; - private final String eTag; - private final String creationDate; - private final String lastModifiedDate; - private final String publicUri; - private final ContentMetadata contentMetadata; - - public BlobMetadata(String type, String providerId, String name, String uri, Map<String, String> userMetadata, - String eTag, String creationDate, String lastModifiedDate, String publicUri, - ContentMetadata contentMetadata) { - this.type = type; - this.providerId = providerId; - this.name = name; - this.uri = uri; - this.userMetadata = userMetadata; - this.eTag = eTag; - this.creationDate = creationDate; - this.lastModifiedDate = lastModifiedDate; - this.publicUri = publicUri; - this.contentMetadata = contentMetadata; - } - - public String getPublicUri() { - return publicUri; - } - - public ContentMetadata getContentMetadata() { - return contentMetadata; - } - - - public String getType() { - return type; - } - - public String getProviderId() { - return providerId; - } - - public String getName() { - return name; - } - - public String getUri() { - return uri; - } - - public Map<String, String> getUserMetadata() { - return userMetadata; - } - - public String geteTag() { - return eTag; - } - - public String getCreationDate() { - return creationDate; - } - - public String getLastModifiedDate() { - return lastModifiedDate; - } - - public int hashCode() { - return Objects.hashCode(publicUri); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof BlobMetadata)) { - return false; - } - BlobMetadata that = (BlobMetadata) obj; - return Objects.equal(this.type, that.type) && - Objects.equal(this.providerId, that.providerId) && - Objects.equal(this.name, that.name) && - Objects.equal(this.uri, that.uri) && - Objects.equal(this.userMetadata, that.userMetadata) && - Objects.equal(this.eTag, that.eTag) && - Objects.equal(this.creationDate, that.creationDate) && - Objects.equal(this.lastModifiedDate, that.lastModifiedDate) && - Objects.equal(this.publicUri, that.publicUri) && - Objects.equal(this.contentMetadata, that.contentMetadata); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("type", type).add("providerId", providerId).add("name", name) - .add("userMetadata", userMetadata).add("eTag", eTag).add("creationDate", creationDate) - .add("lastModifiedDate", lastModifiedDate).add("publicUri", publicUri).add("contentMetadata", contentMetadata) - .toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/BlobStore.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/BlobStore.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/BlobStore.java deleted file mode 100644 index 566552a..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/BlobStore.java +++ /dev/null @@ -1,185 +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.blobstore.representations; - -import org.jclouds.representations.Location; - -import java.util.Set; - -public interface BlobStore { - - /** - * The get locations command returns all the valid locations for containers. A location has a - * scope, which is typically region or zone. A region is a general area, like eu-west, where a - * zone is similar to a datacenter. If a location has a parent, that implies it is within that - * location. For example a location can be a rack, whose parent is likely to be a zone. - */ - Set<Location> listAssignableLocations(); - - /** - * Lists all root-level resources available to the identity. - */ - Set<StorageMetadata> list(); - - /** - * Lists all resources in a container non-recursive. - * - * @param container - * what to list - * @return a list that may be incomplete, depending on whether PageSet#getNextMarker is set - */ - Set<StorageMetadata> list(String container); - - /** - * Lists all resources in a containers directory non-recursive. - * - * @param container what to list - * @param directory the directory to list - * @return a list that may be incomplete, depending on whether PageSet#getNextMarker is set - */ - Set<StorageMetadata> list(String container, String directory); - - /** - * Retrieves the metadata of a {@code Blob} at location {@code container/name} - * - * @param container - * container where this exists. - * @param name - * fully qualified name relative to the container. - * @return null if name isn't present or the blob you intended to receive. - * @throws org.jclouds.blobstore.ContainerNotFoundException - * if the container doesn't exist - */ - BlobMetadata blobMetadata(String container, String name); - - /** - * Retrieves a {@code Blob} representing the data at location {@code container/name} - * - * - * @param container - * container where this exists. - * @param name - * fully qualified name relative to the container. - * @return the blob you intended to receive or null, if it doesn't exist. - * @throws org.jclouds.blobstore.ContainerNotFoundException - * if the container doesn't exist - */ - Blob getBlob(String container, String name); - - - /** - * determines if a service-level container exists - */ - boolean containerExists(String container); - - /** - * Creates a namespace for your blobs - * <p/> - * - * A container is a namespace for your objects. Depending on the service, the scope can be - * global, identity, or sub-identity scoped. For example, in Amazon S3, containers are called - * buckets, and they must be uniquely named such that no-one else in the world conflicts. In - * other blobstores, the naming convention of the container is less strict. All blobstores allow - * you to list your containers and also the contents within them. These contents can either be - * blobs, folders, or virtual paths. - * - * @param location - * some blobstores allow you to specify a location, such as US-EAST, for where this - * container will exist. null will choose a default location - * @param container - * namespace. Typically constrained to lowercase alpha-numeric and hyphens. - * @return true if the container was created, false if it already existed. - */ - boolean createContainerInLocation(String location, String container); - - - /** - * This will delete the contents of a container at its root path without deleting the container - * - * @param container - * what to clear - */ - void clearContainer(String container); - - - /** - * This will delete everything inside a container recursively. - * - * @param container - * what to delete - */ - void deleteContainer(String container); - - /** - * Determines if a directory exists - * - * @param container - * container where the directory resides - * @param directory - * full path to the directory - */ - boolean directoryExists(String container, String directory); - - /** - * Creates a folder or a directory marker depending on the service - * - * @param container - * container to create the directory in - * @param directory - * full path to the directory - */ - void createDirectory(String container, String directory); - - /** - * Deletes a folder or a directory marker depending on the service - * - * @param container - * container to delete the directory from - * @param directory - * full path to the directory to delete - */ - void deleteDirectory(String containerName, String name); - - /** - * Determines if a blob exists - * - * @param container - * container where the blob resides - * @param directory - * full path to the blob - */ - boolean blobExists(String container, String name); - - - /** - * Deletes a {@code Blob} representing the data at location {@code container/name} - * - * @param container - * container where this exists. - * @param name - * fully qualified name relative to the container. - * @throws org.jclouds.blobstore.ContainerNotFoundException - * if the container doesn't exist - */ - void removeBlob(String container, String name); - - /** - * @return a count of all blobs in the container, excluding directory markers - */ - long countBlobs(String container); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/ContentMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/ContentMetadata.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/ContentMetadata.java deleted file mode 100644 index c6da5aa..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/ContentMetadata.java +++ /dev/null @@ -1,163 +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.blobstore.representations; - -import com.google.common.base.Objects; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Date; - -import static org.jclouds.representations.Representations.dateFormat; - - -public class ContentMetadata implements Serializable { - - private static final long serialVersionUID = 4047812866269918734L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Long length; - private String disposition; - private String encoding; - private String type; - private byte[] md5; - private String language; - private String expires; - - public Builder length(final Long length) { - this.length = length; - return this; - } - - public Builder disposition(final String disposition) { - this.disposition = disposition; - return this; - } - - public Builder encoding(final String encoding) { - this.encoding = encoding; - return this; - } - - public Builder type(final String type) { - this.type = type; - return this; - } - - public Builder md5(final byte[] md5) { - this.md5 = md5; - return this; - } - - public Builder language(final String language) { - this.language = language; - return this; - } - - public Builder expires(final String expires) { - this.expires = expires; - return this; - } - - public Builder expires(final Date expires) { - this.expires = dateFormat(expires); - return this; - } - - public ContentMetadata build() { - return new ContentMetadata(length, disposition, encoding, type, md5, language, expires); - } - } - - private final Long length; - private final String disposition; - private final String encoding; - private final String type; - private final byte[] md5; - private final String language; - private final String expires; - - public ContentMetadata(Long length, String disposition, String encoding, String type, byte[] md5, String language, String expires) { - this.length = length; - this.disposition = disposition; - this.encoding = encoding; - this.type = type; - this.md5 = md5; - this.language = language; - this.expires = expires; - } - - public Long getLength() { - return length; - } - - public String getDisposition() { - return disposition; - } - - public String getEncoding() { - return encoding; - } - - public String getType() { - return type; - } - - public byte[] getMd5() { - return md5; - } - - public String getLanguage() { - return language; - } - - public String getExpires() { - return expires; - } - - public int hashCode() { - return Objects.hashCode(length, disposition, encoding, type, md5, language, expires); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof ContentMetadata)) { - return false; - } - ContentMetadata that = (ContentMetadata) obj; - return Objects.equal(this.length, that.length) && - Objects.equal(this.disposition, that.disposition) && - Objects.equal(this.encoding, that.encoding) && - Objects.equal(this.type, that.type) && - Arrays.equals(this.md5, that.md5) && - Objects.equal(this.language, that.language) && - Objects.equal(this.expires, that.expires); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("length", language).add("disposition", disposition).add("encoding", encoding) - .add("type", type).add("md5", md5).add("language", language) - .add("expires", expires).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/StorageMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/StorageMetadata.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/StorageMetadata.java deleted file mode 100644 index e2cf49e..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/StorageMetadata.java +++ /dev/null @@ -1,191 +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.blobstore.representations; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableMap; - -import java.io.Serializable; -import java.net.URI; -import java.util.Date; -import java.util.Map; - -import static org.jclouds.representations.Representations.dateFormat; - -public class StorageMetadata implements Serializable { - - private static final long serialVersionUID = -162484731217251198L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String type; - private String providerId; - private String name; - private String uri; - private Map<String, String> userMetadata = ImmutableMap.of(); - private String eTag; - private String creationDate; - private String lastModifiedDate; - - public Builder type(final String type) { - this.type = type; - return this; - } - - public Builder providerId(final String providerId) { - this.providerId = providerId; - return this; - } - - public Builder name(final String name) { - this.name = name; - return this; - } - - public Builder uri(final URI uri) { - if (uri != null) { - this.uri = uri.toString(); - } - return this; - } - - public Builder uri(final String uri) { - this.uri = uri; - return this; - } - - public Builder userMetadata(final Map<String, String> userMetadata) { - this.userMetadata = ImmutableMap.copyOf(userMetadata); - return this; - } - - public Builder eTag(final String eTag) { - this.eTag = eTag; - return this; - } - - public Builder creationDate(final Date creationDate) { - this.creationDate = dateFormat(creationDate); - return this; - } - - public Builder creationDate(final String creationDate) { - this.creationDate = creationDate; - return this; - } - - public Builder lastModifiedDate(final Date lastModifiedDate) { - this.lastModifiedDate = dateFormat(lastModifiedDate); - return this; - } - - public Builder lastModifiedDate(final String lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - return this; - } - - public StorageMetadata build() { - return new StorageMetadata(type, providerId, name, uri, userMetadata, eTag, creationDate, lastModifiedDate); - } - - } - - private final String type; - private final String providerId; - private final String name; - private final String uri; - private final Map<String, String> userMetadata; - private final String eTag; - private final String creationDate; - private final String lastModifiedDate; - - public StorageMetadata(String type, String providerId, String name, String uri, Map<String, String> userMetadata, - String eTag, String creationDate, String lastModifiedDate) { - this.type = type; - this.providerId = providerId; - this.name = name; - this.uri = uri; - this.userMetadata = userMetadata; - this.eTag = eTag; - this.creationDate = creationDate; - this.lastModifiedDate = lastModifiedDate; - } - - public String getType() { - return type; - } - - public String getProviderId() { - return providerId; - } - - public String getName() { - return name; - } - - public String getUri() { - return uri; - } - - public Map<String, String> getUserMetadata() { - return userMetadata; - } - - public String geteTag() { - return eTag; - } - - public String getCreationDate() { - return creationDate; - } - - public String getLastModifiedDate() { - return lastModifiedDate; - } - - public int hashCode() { - return Objects.hashCode(uri); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof StorageMetadata)) { - return false; - } - StorageMetadata that = (StorageMetadata) obj; - return Objects.equal(this.type, that.type) && - Objects.equal(this.providerId, that.providerId) && - Objects.equal(this.name, that.name) && - Objects.equal(this.uri, that.uri) && - Objects.equal(this.userMetadata, that.userMetadata) && - Objects.equal(this.eTag, that.eTag) && - Objects.equal(this.creationDate, that.creationDate) && - Objects.equal(this.lastModifiedDate, that.lastModifiedDate); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("type", type).add("providerId", providerId).add("name", name) - .add("userMetadata", userMetadata).add("eTag", eTag).add("creationDate", creationDate) - .add("lastModifiedDate", lastModifiedDate).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/ComputeService.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/ComputeService.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/ComputeService.java deleted file mode 100644 index a04342a..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/ComputeService.java +++ /dev/null @@ -1,122 +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.compute.representations; - -import org.jclouds.representations.Location; - -import java.util.Set; - -public interface ComputeService { - /** - * The list hardware profiles command shows you the options including virtual cpu count, memory, - * and disks. cpu count is not a portable quantity across clouds, as they are measured - * differently. However, it is a good indicator of relative speed within a cloud. memory is - * measured in megabytes and disks in gigabytes. - * <p/> - * <h3>note</h3> - * <p/> - * This is a cached collection - */ - Set<Hardware> listHardwareProfiles(); - - /** - * Images define the operating system and metadata related to a node. In some clouds, Images are - * bound to a specific region, and their identifiers are different across these regions. For this - * reason, you should consider matching image requirements like operating system family with - * TemplateBuilder as opposed to choosing an image explicitly. - * <p/> - * <h3>note</h3> - * <p/> - * This is a cached collection - */ - Set<Image> listImages(); - - - /** - * all nodes available to the current user by id. If possible, the returned set will include - * {@link NodeMetadata} objects. - */ - Set<NodeMetadata> listNodes(); - - /** - * The list locations command returns all the valid locations for nodes. A location has a scope, - * which is typically region or zone. A region is a general area, like eu-west, where a zone is - * similar to a datacenter. If a location has a parent, that implies it is within that location. - * For example a location can be a rack, whose parent is likely to be a zone. - * <p/> - * <h3>note</h3> - * <p/> - * This is a cached collection - */ - Set<Location> listAssignableLocations(); - - /** - * Find an image by its id. - * <p/> - * <h3>note</h3> - * <p/> - * This is an uncached call to the backend service - */ - Image getImage(String id); - - /** - * Find a node by its id. - */ - NodeMetadata getNode(String id); - - - /** - * @see #runScriptOnNode(String, String) - */ - ExecResponse runScriptOnNode(String id, String runScript); - - - /** - * resume the node from suspended state, - * given its id. - * - * <h4>note</h4> - * - * affected nodes may not resume with the same IP address(es) - */ - void resumeNode(String id); - - /** - * suspend the node, given its id. This will result in suspended state. - * - * <h4>note</h4> - * - * affected nodes may not resume with the same IP address(es) - * - * @throws UnsupportedOperationException - * if the underlying provider doesn't support suspend/resume - */ - void suspendNode(String id); - - - /** - * destroy the node, given its id. If it is the only node in a tag set, the dependent resources - * will also be destroyed. - */ - void destroyNode(String id); - - - /** - * reboot the node, given its id. - */ - void rebootNode(String id); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/ExecResponse.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/ExecResponse.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/ExecResponse.java deleted file mode 100644 index 001486b..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/ExecResponse.java +++ /dev/null @@ -1,100 +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.compute.representations; - -import com.google.common.base.Objects; - -import java.io.Serializable; - -public class ExecResponse implements Serializable { - - private static final long serialVersionUID = -3552310550261335525L; - - private final java.lang.String output; - private final java.lang.String error; - private final int exitStatus; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private java.lang.String output; - private java.lang.String error; - private int exitStatus; - - public Builder output(final String output) { - this.output = output; - return this; - } - - public Builder error(final String error) { - this.error = error; - return this; - } - - public Builder exitStatus(final int exitStatus) { - this.exitStatus = exitStatus; - return this; - } - - public ExecResponse build() { - return new ExecResponse(output, error, exitStatus); - } - } - - public ExecResponse(String output, String error, int exitStatus) { - this.output = output; - this.error = error; - this.exitStatus = exitStatus; - } - - public String getOutput() { - return output; - } - - public String getError() { - return error; - } - - public int getExitStatus() { - return exitStatus; - } - - @Override - public int hashCode() { - return Objects.hashCode(output, error, exitStatus); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof ExecResponse)) { - return false; - } - ExecResponse that = (ExecResponse) obj; - return Objects.equal(this.output, that.output) && - Objects.equal(this.error, that.error) && - Objects.equal(this.exitStatus, that.exitStatus); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("out", output).add("error", error).add("exitStatus", exitStatus).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Hardware.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Hardware.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Hardware.java deleted file mode 100644 index 95bb5d4..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Hardware.java +++ /dev/null @@ -1,161 +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.compute.representations; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; - -import java.io.Serializable; -import java.util.List; -import java.util.Set; - -public class Hardware implements Serializable { - - private static final long serialVersionUID = -5052972144323758255L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String id; - private String name; - private Set<String> tags = ImmutableSet.of(); - private List<Processor> processors = ImmutableList.of(); - private int ram; - private List<Volume> volumes = ImmutableList.of(); - private String hypervisor; - - public Builder id(final String id) { - this.id = id; - return this; - } - - public Builder name(final String name) { - this.name = name; - return this; - } - - public Builder tags(final Set<String> tags) { - this.tags = ImmutableSet.copyOf(tags); - return this; - } - - public Builder processors(final List<Processor> processors) { - this.processors = ImmutableList.copyOf(processors); - return this; - } - - public Builder ram(final int ram) { - this.ram = ram; - return this; - } - - public Builder volumes(final List<Volume> volumes) { - this.volumes = ImmutableList.copyOf(volumes); - return this; - } - - public Builder hypervisor(final String hypervisor) { - this.hypervisor = hypervisor; - return this; - } - - public Hardware build() { - return new Hardware(id, name, tags, processors, ram, volumes, hypervisor); - } - } - - private final String id; - private final String name; - private final Set<String> tags; - private final List<Processor> processors; - private final int ram; - private final List<Volume> volumes; - private final String hypervisor; - - - public Hardware(String id, String name, Set<String> tags, List<Processor> processors, int ram, List<Volume> volumes, String hypervisor) { - this.id = id; - this.name = name; - this.tags = tags; - this.processors = processors; - this.ram = ram; - this.volumes = volumes; - this.hypervisor = hypervisor; - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - public Set<String> getTags() { - return tags; - } - - public List<Processor> getProcessors() { - return processors; - } - - public int getRam() { - return ram; - } - - public List<Volume> getVolumes() { - return volumes; - } - - public String getHypervisor() { - return hypervisor; - } - - - @Override - public int hashCode() { - return Objects.hashCode(id); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof Hardware)) { - return false; - } - Hardware that = (Hardware) obj; - return Objects.equal(this.id, that.id) && - Objects.equal(this.name, that.name) && - Objects.equal(this.tags, that.tags) && - Objects.equal(this.processors, that.processors) && - Objects.equal(this.ram, that.ram) && - Objects.equal(this.volumes, that.volumes) && - Objects.equal(this.hypervisor, that.hypervisor); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("id", id).add("name", name) - .add("processors", processors).add("ram", ram).add("volums", volumes).add("hypervisor", hypervisor) - .toString(); - } -} - http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Image.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Image.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Image.java deleted file mode 100644 index f421af1..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Image.java +++ /dev/null @@ -1,172 +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.compute.representations; - - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableSet; - -import java.io.Serializable; -import java.util.Set; - -public class Image implements Serializable { - - private static final long serialVersionUID = 1332541821219215234L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String id; - private String name; - private String status; - private String version; - private String description; - private OperatingSystem operatingSystem; - private LoginCredentials defaultCredentials; - private Set<String> tags = ImmutableSet.of(); - - public Builder id(final String id) { - this.id = id; - return this; - } - - public Builder name(final String name) { - this.name = name; - return this; - } - - public Builder status(final String status) { - this.status = status; - return this; - } - - public Builder tags(final Set<String> tags) { - this.tags = ImmutableSet.copyOf(tags); - return this; - } - - public Builder operatingSystem(final OperatingSystem operatingSystem) { - this.operatingSystem = operatingSystem; - return this; - } - - public Builder version(final String version) { - this.version = version; - return this; - } - - public Builder description(final String description) { - this.description = description; - return this; - } - - public Builder defaultCredentials(final LoginCredentials defaultCredentials) { - this.defaultCredentials = defaultCredentials; - return this; - } - - public Image build() { - return new Image(id, name, version, description, status, operatingSystem, defaultCredentials, tags); - } - - } - - private final String id; - private final String name; - private final String version; - private final String description; - private final String status; - private final OperatingSystem operatingSystem; - private final LoginCredentials defaultCredentials; - private final Set<String> tags; - - public Image(String id, String name, String version, String description, String status, OperatingSystem operatingSystem, LoginCredentials defaultCredentials, Set<String> tags) { - this.id = id; - this.name = name; - this.version = version; - this.description = description; - this.status = status; - this.operatingSystem = operatingSystem; - this.defaultCredentials = defaultCredentials; - this.tags = tags; - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - public String getStatus() { - return status; - } - - public Set<String> getTags() { - return tags; - } - - public OperatingSystem getOperatingSystem() { - return operatingSystem; - } - - public String getVersion() { - return version; - } - - public String getDescription() { - return description; - } - - public LoginCredentials getDefaultCredentials() { - return defaultCredentials; - } - - @Override - public int hashCode() { - return Objects.hashCode(id); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof Image)) { - return false; - } - Image that = (Image) obj; - return Objects.equal(this.id, that.id) && - Objects.equal(this.name, that.name) && - Objects.equal(this.version, that.version) && - Objects.equal(this.description, that.description) && - Objects.equal(this.status, that.status) && - Objects.equal(this.operatingSystem, that.operatingSystem) && - Objects.equal(this.defaultCredentials, that.defaultCredentials) && - Objects.equal(this.tags, that.tags); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("id", id).add("name", name).add("status", status) - .add("description", description) - .add("tags", tags).add("os", operatingSystem).add("version", version) - .add("defaultCredentials", defaultCredentials).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/LoginCredentials.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/LoginCredentials.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/LoginCredentials.java deleted file mode 100644 index b609966..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/LoginCredentials.java +++ /dev/null @@ -1,136 +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.compute.representations; - -import com.google.common.base.Objects; - -import java.io.Serializable; -import java.net.URI; - -public class LoginCredentials implements Serializable { - - private static final long serialVersionUID = -4665781183795990721L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String username; - private String password; - private String privateKey; - private String credentialUrl; - private boolean authenticateSudo; - - public Builder username(final String username) { - this.username = username; - return this; - } - - public Builder password(final String password) { - this.password = password; - return this; - } - - public Builder privateKey(final String privateKey) { - this.privateKey = privateKey; - return this; - } - - public Builder credentialUrl(final URI credentialUrl) { - if (credentialUrl != null) { - this.credentialUrl = credentialUrl.toString(); - } - return this; - } - - public Builder credentialUrl(final String credentialUrl) { - this.credentialUrl = credentialUrl; - return this; - } - - public Builder authenticateSudo(final boolean authenticateSudo) { - this.authenticateSudo = authenticateSudo; - return this; - } - - public LoginCredentials build() { - return new LoginCredentials(username, password, privateKey, credentialUrl, authenticateSudo); - } - - } - - private final String username; - private final String password; - private final String privateKey; - private final String credentialUrl; - private final boolean authenticateSudo; - - public LoginCredentials(String username, String password, String privateKey, String credentialUrl, boolean authenticateSudo) { - this.username = username; - this.password = password; - this.privateKey = privateKey; - this.credentialUrl = credentialUrl; - this.authenticateSudo = authenticateSudo; - } - - public String getUsername() { - return username; - } - - public String getPassword() { - return password; - } - - public String getCredentialUrl() { - return credentialUrl; - } - - public boolean isAuthenticatedSudo() { - return authenticateSudo; - } - - - @Override - public int hashCode() { - return Objects.hashCode(username, password, credentialUrl, authenticateSudo); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof LoginCredentials)) { - return false; - } - LoginCredentials that = (LoginCredentials) obj; - return Objects.equal(this.username, that.username) && - Objects.equal(this.password, that.password) && - Objects.equal(this.privateKey, that.privateKey) && - Objects.equal(this.credentialUrl, that.credentialUrl) && - Objects.equal(this.authenticateSudo, that.authenticateSudo); - } - - @Override - public String toString() { - return Objects.toStringHelper(this) - .add("username", username) - .add("hasPassword", password != null || credentialUrl != null) - .add("hasPrivateKey", privateKey != null) - .add("hasSudoPassword", authenticateSudo).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/NodeMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/NodeMetadata.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/NodeMetadata.java deleted file mode 100644 index b785636..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/NodeMetadata.java +++ /dev/null @@ -1,236 +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.compute.representations; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -import java.io.Serializable; -import java.util.Map; -import java.util.Set; - -public class NodeMetadata implements Serializable { - - private static final long serialVersionUID = 948372788993429243L; - - private static final int DEFAULT_SSH_PORT = 22; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String id; - private String name; - private String description; - private String status; - private String hostname; - private String imageId; - private String locationId; - private int loginPort = DEFAULT_SSH_PORT; - private String group; - private Set<String> tags = ImmutableSet.of(); - private Map<String, String> metadata = ImmutableMap.<String, String>of(); - private LoginCredentials defaultCredentials; - - public Builder id(String id) { - this.id = id; - return this; - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder description(String description) { - this.description = description; - return this; - } - - public Builder hostname(String hostname) { - this.hostname = hostname; - return this; - } - - public Builder status(final String status) { - this.status = status; - return this; - } - - - public Builder loginPort(int loginPort) { - this.loginPort = loginPort; - return this; - } - - public Builder locationId(String locationId) { - this.locationId = locationId; - return this; - } - - public Builder imageId(final String imageId) { - this.imageId = imageId; - return this; - } - - public Builder group(String group) { - this.group = group; - return this; - } - - public Builder tags(Iterable<String> tags) { - this.tags = ImmutableSet.copyOf(tags); - return this; - } - - public Builder metadata(Map<String, String> metadata) { - this.metadata = ImmutableMap.copyOf(metadata); - return this; - } - - public Builder defaultCredentials(final LoginCredentials defaultCredentials) { - this.defaultCredentials = defaultCredentials; - return this; - } - - public NodeMetadata build() { - return new NodeMetadata(id, name, description, status, hostname, locationId, imageId, loginPort, group, tags, - metadata, defaultCredentials); - } - } - - public NodeMetadata(String id, String name, String description, String status, String hostname, String locationId, - String imageId, int loginPort, String group, Set<String> tags, - Map<String, String> metadata, LoginCredentials defaultCredentials) { - this.id = id; - this.name = name; - this.description = description; - this.status = status; - this.hostname = hostname; - this.locationId = locationId; - this.imageId = imageId; - this.loginPort = loginPort; - this.group = group; - this.tags = tags; - this.metadata = metadata; - this.defaultCredentials = defaultCredentials; - } - - private final String id; - private final String name; - private final String description; - private final String status; - private final String hostname; - private final String locationId; - private final String imageId; - private final int loginPort; - private final String group; - private final Set<String> tags; - private final Map<String, String> metadata; - private final LoginCredentials defaultCredentials; - - public String getId() { - return id; - } - - public String getLocationId() { - return locationId; - } - - public String getImageId() { - return imageId; - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public String getGroup() { - return group; - } - - public String getHostname() { - return hostname; - } - - public String getStatus() { - return status; - } - - public int getLoginPort() { - return loginPort; - } - - public Set<String> getTags() { - Set<String> tagSet = Sets.newHashSet(); - for (String tag : tags) { - tagSet.add(tag); - } - return tagSet; - } - - public Map<String, String> getMetadata() { - return Maps.newLinkedHashMap(this.metadata); - } - - public LoginCredentials getDefaultCredentials() { - return defaultCredentials; - } - - @Override - public int hashCode() { - return Objects.hashCode(id); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof NodeMetadata)) { - return false; - } - NodeMetadata that = (NodeMetadata) obj; - return Objects.equal(this.id, that.id) && - Objects.equal(this.name, that.name) && - Objects.equal(this.description, that.description) && - Objects.equal(this.status, that.status) && - Objects.equal(this.hostname, that.hostname) && - Objects.equal(this.locationId, that.locationId) && - Objects.equal(this.imageId, that.imageId) && - Objects.equal(this.loginPort, that.loginPort) && - Objects.equal(this.group, that.group) && - Objects.equal(this.tags, that.tags) && - Objects.equal(this.metadata, that.metadata) && - Objects.equal(this.defaultCredentials, that.defaultCredentials); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("id", id).add("name", name).add("description", description).add("status", status) - .add("locationId", locationId).add("imageId", imageId).add("hostname", hostname) - .add("group", group).add("loginPort", loginPort).add("tags", tags).add("metadata", metadata) - .add("defaultCredentials", defaultCredentials).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/OperatingSystem.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/OperatingSystem.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/OperatingSystem.java deleted file mode 100644 index c36c11e..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/OperatingSystem.java +++ /dev/null @@ -1,141 +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.compute.representations; - -import com.google.common.base.Objects; - -import java.io.Serializable; - -public class OperatingSystem implements Serializable { - - private static final long serialVersionUID = 5789055455232061970L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String family; - private String name; - private String arch; - private String version; - private String description; - private boolean is64Bit; - - public Builder family(final String family) { - this.family = family; - return this; - } - - public Builder name(final String name) { - this.name = name; - return this; - } - - public Builder arch(final String arch) { - this.arch = arch; - return this; - } - - public Builder version(final String version) { - this.version = version; - return this; - } - - public Builder description(final String description) { - this.description = description; - return this; - } - - public Builder is64Bit(final boolean is64Bit) { - this.is64Bit = is64Bit; - return this; - } - - public OperatingSystem build() { - return new OperatingSystem(family, name, arch, version, description, is64Bit); - } - } - - private final String family; - private final String name; - private final String arch; - private final String version; - private final String description; - private final boolean is64Bit; - - - public OperatingSystem(String family, String name, String arch, String version, String description, boolean is64Bit) { - this.family = family; - this.name = name; - this.arch = arch; - this.version = version; - this.description = description; - this.is64Bit = is64Bit; - } - - public String getFamily() { - return family; - } - - public String getName() { - return name; - } - - public String getArch() { - return arch; - } - - public String getVersion() { - return version; - } - - public String getDescription() { - return description; - } - - public boolean isIs64Bit() { - return is64Bit; - } - - @Override - public int hashCode() { - return Objects.hashCode(family, version, arch, is64Bit); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof OperatingSystem)) { - return false; - } - OperatingSystem that = (OperatingSystem) obj; - return Objects.equal(this.family, that.family) && - Objects.equal(this.name, that.name) && - Objects.equal(this.arch, that.arch) && - Objects.equal(this.version, that.version) && - Objects.equal(this.description, that.description) && - this.is64Bit == that.is64Bit; - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("family", family).add("name", name).add("arch", arch) - .add("version", version).add("description", description).add("is64bit", is64Bit).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Processor.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Processor.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Processor.java deleted file mode 100644 index 67acb82..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Processor.java +++ /dev/null @@ -1,88 +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.compute.representations; - -import com.google.common.base.Objects; - -import java.io.Serializable; - -public class Processor implements Serializable { - - private static final long serialVersionUID = -2621055948006358603L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private double cores; - private double speed; - - public Builder cores(final double cores) { - this.cores = cores; - return this; - } - - public Builder speed(final double speed) { - this.speed = speed; - return this; - } - - public Processor build() { - return new Processor(cores, speed); - } - - } - - private final double cores; - private final double speed; - - public Processor(double cores, double speed) { - this.cores = cores; - this.speed = speed; - } - - public double getCores() { - return cores; - } - - public double getSpeed() { - return speed; - } - - @Override - public int hashCode() { - return Objects.hashCode(cores, speed); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof Processor)) { - return false; - } - Processor that = (Processor) obj; - return this.cores == that.cores && - this.speed == that.speed; - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("cores", cores).add("spped", speed).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Volume.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Volume.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Volume.java deleted file mode 100644 index ff6f1bc..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Volume.java +++ /dev/null @@ -1,142 +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.compute.representations; - -import com.google.common.base.Objects; - -import java.io.Serializable; - -public class Volume implements Serializable { - - private static final long serialVersionUID = -4171587668537155633L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String id; - private String type; - private Float size; - private String device; - private boolean durable; - private boolean bootDevice; - - public Builder id(final String id) { - this.id = id; - return this; - } - - public Builder type(final String type) { - this.type = type; - return this; - } - - public Builder size(final Float size) { - this.size = size; - return this; - } - - public Builder device(final String device) { - this.device = device; - return this; - } - - public Builder durable(final boolean durable) { - this.durable = durable; - return this; - } - - public Builder bootDevice(final boolean bootDevice) { - this.bootDevice = bootDevice; - return this; - } - - public Volume build() { - return new Volume(id, type, size, device, durable, bootDevice); - } - - } - - private final String id; - private final String type; - private final Float size; - private final String device; - private final boolean durable; - private final boolean bootDevice; - - public Volume(String id, String type, Float size, String device, boolean durable, boolean bootDevice) { - this.id = id; - this.type = type; - this.size = size; - this.device = device; - this.durable = durable; - this.bootDevice = bootDevice; - } - - public String getId() { - return id; - } - - public String getType() { - return type; - } - - public Float getSize() { - return size; - } - - public String getDevice() { - return device; - } - - public boolean isDurable() { - return durable; - } - - public boolean isBootDevice() { - return bootDevice; - } - - - @Override - public int hashCode() { - return Objects.hashCode(id); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof Volume)) { - return false; - } - Volume that = (Volume) obj; - return Objects.equal(this.id, that.id) && - Objects.equal(this.type, that.type) && - Objects.equal(this.size, that.size) && - Objects.equal(this.device, that.device) && - this.durable == that.durable && - this.bootDevice == that.bootDevice; - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("id", id).add("type", type).add("size", size) - .add("device", device).add("isDurable", durable).add("bootDevice", bootDevice).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/representations/ApiMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/representations/ApiMetadata.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/representations/ApiMetadata.java deleted file mode 100644 index 2c119c3..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/representations/ApiMetadata.java +++ /dev/null @@ -1,273 +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.representations; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; - -import java.io.Serializable; -import java.net.URI; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -public class ApiMetadata implements Serializable { - - private static final long serialVersionUID = 3475663463134958705L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String id; - private String name; - private String endpointName; - private String identityName; - private String credentialName; - private String version; - private String defaultEndpoint; - private String defaultIdentity; - private String defaultCredential; - private Map<String, String> defaultProperties = ImmutableMap.of(); - private Set<String> defaultModules = ImmutableSet.of(); - private String documentation; - private String context; - private Set<String> views = ImmutableSet.of(); - - public Builder id(final String id) { - this.id = id; - return this; - } - - public Builder name(final String name) { - this.name = name; - return this; - } - - public Builder endpointName(final String endpointName) { - this.endpointName = endpointName; - return this; - } - - public Builder identityName(final String identityName) { - this.identityName = identityName; - return this; - } - - public Builder credentialName(final String credentialName) { - this.credentialName = credentialName; - return this; - } - - public Builder version(final String version) { - this.version = version; - return this; - } - - public Builder defaultEndpoint(final String defaultEndpoint) { - this.defaultEndpoint = defaultEndpoint; - return this; - } - - public Builder defaultIdentity(final String defaultIdentity) { - this.defaultIdentity = defaultIdentity; - return this; - } - - public Builder defaultCredential(final String defaultCredential) { - this.defaultCredential = defaultCredential; - return this; - } - - public Builder defaultProperties(final Properties defaultProperties) { - if (defaultProperties != null) { - this.defaultProperties = Maps.fromProperties(defaultProperties); - } - return this; - } - - public Builder defaultProperties(final Map<String, String> defaultProperties) { - this.defaultProperties = defaultProperties; - return this; - } - - public Builder defaultModules(final Set<String> defaultModules) { - this.defaultModules = defaultModules; - return this; - } - - public Builder documentation(final URI documentation) { - if (documentation != null) { - this.documentation = documentation.toString(); - } - return this; - } - - public Builder documentation(final String documentation) { - this.documentation = documentation; - return this; - } - - public Builder context(final String context) { - this.context = context; - return this; - } - - public Builder views(final Set<String> views) { - this.views = ImmutableSet.copyOf(views); - return this; - } - - public ApiMetadata build() { - return new ApiMetadata(id, name, endpointName, identityName, credentialName, version, defaultEndpoint, - defaultIdentity, defaultCredential, defaultProperties, defaultModules, documentation, context, views); - } - } - - private final String id; - private final String name; - private final String endpointName; - private final String identityName; - private final String credentialName; - private final String version; - private final String defaultEndpoint; - private final String defaultIdentity; - private final String defaultCredential; - private final Map<String, String> defaultProperties; - private final Set<String> defaultModules; - private final String documentation; - private final String context; - private final Set<String> views; - - public ApiMetadata(String id, String name, String endpointName, String identityName, String credentialName, String version, - String defaultEndpoint, String defaultIdentity, String defaultCredential, - Map<String, String> defaultProperties, Set<String> defaultModules, String documentation, String context, - Set<String> views) { - - this.id = id; - this.name = name; - this.endpointName = endpointName; - this.identityName = identityName; - this.credentialName = credentialName; - this.version = version; - this.defaultEndpoint = defaultEndpoint; - this.defaultIdentity = defaultIdentity; - this.defaultCredential = defaultCredential; - this.defaultProperties = defaultProperties; - this.defaultModules = defaultModules; - this.documentation = documentation; - this.context = context; - this.views = views; - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - public String getEndpointName() { - return endpointName; - } - - public String getIdentityName() { - return identityName; - } - - public String getCredentialName() { - return credentialName; - } - - public String getVersion() { - return version; - } - - public String getDefaultEndpoint() { - return defaultEndpoint; - } - - public String getDefaultIdentity() { - return defaultIdentity; - } - - public String getDefaultCredential() { - return defaultCredential; - } - - public Map<String, String> getDefaultProperties() { - return defaultProperties; - } - - public Set<String> getDefaultModules() { - return defaultModules; - } - - public String getDocumentation() { - return documentation; - } - - public String getContext() { - return context; - } - - public Set<String> getViews() { - return views; - } - - @Override - public int hashCode() { - return Objects.hashCode(id); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof ApiMetadata)) { - return false; - } - ApiMetadata that = (ApiMetadata) obj; - return Objects.equal(this.id, that.id) && - Objects.equal(this.name, that.name) && - Objects.equal(this.endpointName, that.endpointName) && - Objects.equal(this.identityName, that.identityName) && - Objects.equal(this.credentialName, that.credentialName) && - Objects.equal(this.version, that.version) && - Objects.equal(this.defaultEndpoint, that.defaultEndpoint) && - Objects.equal(this.defaultIdentity, that.defaultIdentity) && - Objects.equal(this.defaultCredential, that.defaultCredential) && - Objects.equal(this.defaultProperties, that.defaultProperties) && - Objects.equal(this.defaultModules, that.defaultModules) && - Objects.equal(this.documentation, that.documentation) && - Objects.equal(this.context, that.context) && - Objects.equal(this.views, that.views); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("id", id).add("name", name).add("endpointName", endpointName) - .add("identityName", identityName).add("credentialName", credentialName).add("version", version) - .add("defaultEndpoint", defaultEndpoint).add("defaultIdentity", defaultIdentity) - .add("defaultCredential", defaultCredential).add("defaultProperties", defaultProperties).add("defaultModules", defaultModules) - .add("documentation", documentation).add("context", context).add("views", views).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/src/main/java/org/jclouds/representations/Context.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/src/main/java/org/jclouds/representations/Context.java b/jclouds-representations/representations-core/src/main/java/org/jclouds/representations/Context.java deleted file mode 100644 index f1b61e0..0000000 --- a/jclouds-representations/representations-core/src/main/java/org/jclouds/representations/Context.java +++ /dev/null @@ -1,101 +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.representations; - -import com.google.common.base.Objects; - -import java.io.Serializable; - -public class Context implements Serializable { - - private static final long serialVersionUID = -6490025246295140657L; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String name; - private String providerId; - private String identity; - - public Builder name(final String name) { - this.name = name; - return this; - } - - public Builder providerId(final String providerId) { - this.providerId = providerId; - return this; - } - - public Builder identity(final String identity) { - this.identity = identity; - return this; - } - - public Context build() { - return new Context(name, providerId, identity); - } - } - - private final String name; - private final String providerId; - private final String identity; - - - public Context(String name, String providerId, String identity) { - this.name = name; - this.providerId = providerId; - this.identity = identity; - } - - public String getName() { - return name; - } - - public String getProviderId() { - return providerId; - } - - public String getIdentity() { - return identity; - } - - @Override - public int hashCode() { - return Objects.hashCode(name); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof Context)) { - return false; - } - Context that = (Context) obj; - return Objects.equal(this.name, that.name) && - Objects.equal(this.providerId, that.providerId) && - Objects.equal(this.identity, that.identity); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("name", name).add("providerId", providerId).add("identity", identity).toString(); - } -}
