Get rid of the Impls.

Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/commit/65ef0b1d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/65ef0b1d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/65ef0b1d

Branch: refs/heads/jclouds-101
Commit: 65ef0b1d7a3e20ce91c12f77d24d20e372a41b48
Parents: 1ceccd5
Author: Andrew Bayer <[email protected]>
Authored: Fri Jun 7 15:03:30 2013 -0700
Committer: Andrew Bayer <[email protected]>
Committed: Fri Jun 7 15:03:30 2013 -0700

----------------------------------------------------------------------
 .../jclouds/compute/domain/SecurityGroup.java   |  40 +++++-
 .../compute/domain/SecurityGroupRule.java       |  81 ++++++++++--
 .../domain/internal/SecurityGroupImpl.java      |  68 ----------
 .../domain/internal/SecurityGroupRuleImpl.java  | 130 -------------------
 4 files changed, 106 insertions(+), 213 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/65ef0b1d/compute/src/main/java/org/jclouds/compute/domain/SecurityGroup.java
----------------------------------------------------------------------
diff --git 
a/compute/src/main/java/org/jclouds/compute/domain/SecurityGroup.java 
b/compute/src/main/java/org/jclouds/compute/domain/SecurityGroup.java
index b5434af..ca698c7 100644
--- a/compute/src/main/java/org/jclouds/compute/domain/SecurityGroup.java
+++ b/compute/src/main/java/org/jclouds/compute/domain/SecurityGroup.java
@@ -16,25 +16,55 @@
  */
 package org.jclouds.compute.domain;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
 import java.util.Set;
 
-import org.jclouds.compute.domain.internal.SecurityGroupImpl;
+import org.jclouds.compute.domain.ComputeType;
+import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.compute.domain.SecurityGroupRule;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.ResourceMetadata;
 import org.jclouds.javax.annotation.Nullable;
 
-import com.google.inject.ImplementedBy;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Predicate;
+import com.google.common.collect.ComparisonChain;
+import com.google.common.collect.ImmutableSet;
 
 /**
  * Describes a security group containing a set of @{link SecurityGroupRule}s
  * 
  * @author Andrew Bayer
  */
-@ImplementedBy(SecurityGroupImpl.class)
-public interface SecurityGroup extends ComputeMetadata {
+public class SecurityGroup extends ComputeMetadataImpl {
+
+   private final Set<SecurityGroupRule> rules;
+
+   public SecurityGroupImpl(String providerId, String name, String id, 
@Nullable Location location, URI uri,
+                            Map<String, String> userMetadata, Set<String> tags,
+                            Iterable<SecurityGroupRule> rules) { 
+      super(ComputeType.SECURITYGROUP, providerId, name, id, location, uri, 
userMetadata, tags);
+      this.rules = ImmutableSet.copyOf(checkNotNull(rules, "rules"));
+   }
 
    /**
     * 
     * @return The set of @{link SecurityGroupRule}s for this security group
     */
-   Set<SecurityGroupRule> getRules();
+   public Set<SecurityGroupRule> getRules() {
+      return rules;
+   }
+
+
+   @Override
+   protected ToStringHelper string() {
+      ToStringHelper helper = computeToStringPrefix();
+      if (rules.size() > 0)
+         helper.add("rules", rules);
+      return addComputeToStringSuffix(helper);
+   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/65ef0b1d/compute/src/main/java/org/jclouds/compute/domain/SecurityGroupRule.java
----------------------------------------------------------------------
diff --git 
a/compute/src/main/java/org/jclouds/compute/domain/SecurityGroupRule.java 
b/compute/src/main/java/org/jclouds/compute/domain/SecurityGroupRule.java
index af6f5d3..2e1c968 100644
--- a/compute/src/main/java/org/jclouds/compute/domain/SecurityGroupRule.java
+++ b/compute/src/main/java/org/jclouds/compute/domain/SecurityGroupRule.java
@@ -16,56 +16,117 @@
  */
 package org.jclouds.compute.domain;
 
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.util.Set;
 
-import org.jclouds.compute.domain.internal.SecurityGroupRuleImpl;
+import org.jclouds.compute.domain.IpProtocol;
+import org.jclouds.compute.domain.SecurityGroupRule;
 import org.jclouds.javax.annotation.Nullable;
 
-import com.google.inject.ImplementedBy;
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableSet;
 
 /**
  * The port range, IP ranges, protocol and instance groups for a rule in a 
@{link SecurityGroup}.
  * 
  * @author Andrew Bayer
  */
-@ImplementedBy(SecurityGroupRuleImpl.class)
-public interface SecurityGroupRule {
+public class SecurityGroupRule {
+
+   @Nullable
+   private final String id;
+   private final IpProtocol protocol;
+   private final int startPort;
+   private final int endPort;
+   private final Set<String> ipRanges;
+   private final Set<String> groupIds;
+   
+   public SecurityGroupRule(@Nullable String id, IpProtocol protocol, int 
startPort, int endPort,
+                                Iterable<String> ipRanges, Iterable<String> 
groupIds) {
+      this.id = id;
+      this.protocol = checkNotNull(protocol, "protocol");
+      this.startPort = startPort;
+      this.endPort = endPort;
+      this.ipRanges = ImmutableSet.copyOf(checkNotNull(ipRanges, "ipRanges"));
+      this.groupIds = ImmutableSet.copyOf(checkNotNull(groupIds, "groupIds"));
+   }
 
    /**
     * @return Unique identifier.
     *
     */
    @Nullable
-   String getId();
+   public String getId() {
+      return id;
+   }
 
    /**
     * @return The IP protocol for the rule.
     */
-   IpProtocol getProtocol();
+   public IpProtocol getProtocol() {
+      return protocol;
+   }
 
    /**
     *
     * @return the start port.
     */
-   int getStartPort();
+   public int getStartPort() {
+      return startPort;
+   }
 
    /**
     *
     * @return the end port.
     */
-   int getEndPort();
+   public int getEndPort() {
+      return endPort;
+   }
 
    /**
     * 
     * @return The set of IP ranges for this rule.
     */
-   Set<String> getIpRanges();
+   public Set<String> getIpRanges() {
+      return ipRanges;
+   }
 
    /**
     * 
     * @return The set of instance group IDs for this rule.
     */
-   Set<String> getGroupIds();
+   public Set<String> getGroupIds() {
+      return groupIds;
+   }
+
+   @Override
+   public boolean equals(Object o) {
+      if (this == o)
+         return true;
+      if (o == null || getClass() != o.getClass())
+         return false;
+      SecurityGroupRule that = SecurityGroupRule.class.cast(o);
+      return equal(this.id, that.id) && equal(this.getProtocol(), 
that.getProtocol()) && equal(this.startPort, that.startPort)
+         && equal(this.endPort, that.endPort) && equal(this.getIpRanges(), 
that.getIpRanges())
+         && equal(this.getGroupIds(), that.getGroupIds());
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(id, protocol, startPort, endPort, ipRanges, 
groupIds);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
 
+   protected ToStringHelper string() {
+      return Objects.toStringHelper("").omitNullValues().add("id", 
id).add("protocol", getProtocol()).add("startPort", startPort)
+         .add("endPort", endPort).add("ipRanges", 
getIpRanges()).add("groupIds", getGroupIds());
+   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/65ef0b1d/compute/src/main/java/org/jclouds/compute/domain/internal/SecurityGroupImpl.java
----------------------------------------------------------------------
diff --git 
a/compute/src/main/java/org/jclouds/compute/domain/internal/SecurityGroupImpl.java
 
b/compute/src/main/java/org/jclouds/compute/domain/internal/SecurityGroupImpl.java
deleted file mode 100644
index 108c14b..0000000
--- 
a/compute/src/main/java/org/jclouds/compute/domain/internal/SecurityGroupImpl.java
+++ /dev/null
@@ -1,68 +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.domain.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Set;
-
-import org.jclouds.compute.domain.ComputeType;
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.compute.domain.SecurityGroupRule;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.ResourceMetadata;
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ComparisonChain;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * @author Andrew Bayer
- */
-public class SecurityGroupImpl extends ComputeMetadataImpl implements 
SecurityGroup {
-
-   private final Set<SecurityGroupRule> rules;
-
-   public SecurityGroupImpl(String providerId, String name, String id, 
@Nullable Location location, URI uri,
-                            Map<String, String> userMetadata, Set<String> tags,
-                            Iterable<SecurityGroupRule> rules) { 
-      super(ComputeType.SECURITYGROUP, providerId, name, id, location, uri, 
userMetadata, tags);
-      this.rules = ImmutableSet.copyOf(checkNotNull(rules, "rules"));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public Set<SecurityGroupRule> getRules() {
-      return rules;
-   }
-
-
-   @Override
-   protected ToStringHelper string() {
-      ToStringHelper helper = computeToStringPrefix();
-      if (rules.size() > 0)
-         helper.add("rules", rules);
-      return addComputeToStringSuffix(helper);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/65ef0b1d/compute/src/main/java/org/jclouds/compute/domain/internal/SecurityGroupRuleImpl.java
----------------------------------------------------------------------
diff --git 
a/compute/src/main/java/org/jclouds/compute/domain/internal/SecurityGroupRuleImpl.java
 
b/compute/src/main/java/org/jclouds/compute/domain/internal/SecurityGroupRuleImpl.java
deleted file mode 100644
index 0448318..0000000
--- 
a/compute/src/main/java/org/jclouds/compute/domain/internal/SecurityGroupRuleImpl.java
+++ /dev/null
@@ -1,130 +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.domain.internal;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import org.jclouds.compute.domain.IpProtocol;
-import org.jclouds.compute.domain.SecurityGroupRule;
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * @author Adrian Cole
- */
-public class SecurityGroupRuleImpl implements SecurityGroupRule {
-
-   @Nullable
-   private final String id;
-   private final IpProtocol protocol;
-   private final int startPort;
-   private final int endPort;
-   private final Set<String> ipRanges;
-   private final Set<String> groupIds;
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o)
-         return true;
-      if (o == null || getClass() != o.getClass())
-         return false;
-      SecurityGroupRuleImpl that = SecurityGroupRuleImpl.class.cast(o);
-      return equal(this.id, that.id) && equal(this.getProtocol(), 
that.getProtocol()) && equal(this.startPort, that.startPort)
-         && equal(this.endPort, that.endPort) && equal(this.getIpRanges(), 
that.getIpRanges())
-         && equal(this.getGroupIds(), that.getGroupIds());
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(id, protocol, startPort, endPort, ipRanges, 
groupIds);
-   }
-
-   @Override
-   public String toString() {
-      return string().toString();
-   }
-
-   protected ToStringHelper string() {
-      return Objects.toStringHelper("").omitNullValues().add("id", 
id).add("protocol", getProtocol()).add("startPort", startPort)
-         .add("endPort", endPort).add("ipRanges", 
getIpRanges()).add("groupIds", getGroupIds());
-   }
-
-   public SecurityGroupRuleImpl(@Nullable String id, IpProtocol protocol, int 
startPort, int endPort,
-                                Iterable<String> ipRanges, Iterable<String> 
groupIds) {
-      this.id = id;
-      this.protocol = checkNotNull(protocol, "protocol");
-      this.startPort = startPort;
-      this.endPort = endPort;
-      this.ipRanges = ImmutableSet.copyOf(checkNotNull(ipRanges, "ipRanges"));
-      this.groupIds = ImmutableSet.copyOf(checkNotNull(groupIds, "groupIds"));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public String getId() {
-      return id;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public IpProtocol getProtocol() {
-      return protocol;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public int getStartPort() {
-      return startPort;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public int getEndPort() {
-      return endPort;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public Set<String> getIpRanges() {
-      return ipRanges;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public Set<String> getGroupIds() {
-      return groupIds;
-   }
-
-}

Reply via email to