You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2013/07/02 18:28:54 UTC

[7/8] JCLOUDS-156: Cleanup Abiquo provider

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Enterprise.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Enterprise.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Enterprise.java
index b570815..ac2400a 100644
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Enterprise.java
+++ b/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Enterprise.java
@@ -16,8 +16,6 @@
  */
 package org.jclouds.abiquo.domain.enterprise;
 
-import static com.google.common.collect.Iterables.filter;
-
 import java.util.List;
 
 import org.jclouds.abiquo.AbiquoApi;
@@ -30,10 +28,7 @@ import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate;
 import org.jclouds.abiquo.domain.exception.AbiquoException;
 import org.jclouds.abiquo.domain.infrastructure.Datacenter;
 import org.jclouds.abiquo.domain.infrastructure.Machine;
-import org.jclouds.abiquo.domain.network.ExternalIp;
 import org.jclouds.abiquo.domain.network.ExternalNetwork;
-import org.jclouds.abiquo.domain.network.Network;
-import org.jclouds.abiquo.domain.network.UnmanagedIp;
 import org.jclouds.abiquo.domain.network.UnmanagedNetwork;
 import org.jclouds.abiquo.strategy.enterprise.ListVirtualMachineTemplates;
 import org.jclouds.http.HttpResponse;
@@ -142,40 +137,6 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
    }
 
    /**
-    * Retrieve a filtered list of virtual datacenters by this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/EnterpriseResource#EnterpriseResource-RetrievealistofvitualdatacentersbyanEnterprise"
-    *      > http://community.abiquo.com/display/ABI20/EnterpriseResource#
-    *      EnterpriseResource-
-    *      RetrievealistofvitualdatacentersbyanEnterprise</a>
-    * @return Filtered list of virtual datacenters in this enterprise.
-    */
-   public List<VirtualDatacenter> listVirtualDatacenters(final Predicate<VirtualDatacenter> filter) {
-      return ImmutableList.copyOf(filter(listVirtualDatacenters(), filter));
-   }
-
-   /**
-    * Retrieve a the first virtual datacenter matching the filter within the
-    * list of virtual datacenters by this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/EnterpriseResource#EnterpriseResource-RetrievealistofvitualdatacentersbyanEnterprise"
-    *      > http://community.abiquo.com/display/ABI20/EnterpriseResource#
-    *      EnterpriseResource-
-    *      RetrievealistofvitualdatacentersbyanEnterprise</a>
-    * @return First virtual datacenter matching the filter or <code>null</code>
-    *         if the is none.
-    */
-   public VirtualDatacenter findVirtualDatacenter(final Predicate<VirtualDatacenter> filter) {
-      return Iterables.getFirst(filter(listVirtualDatacenters(), filter), null);
-   }
-
-   /**
     * Retrieve the list of template definition lists of the enterprise.
     * 
     * @see API: <a href=
@@ -191,41 +152,6 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
    }
 
    /**
-    * Retrieve a filtered list of template definition lists from this
-    * enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/TemplateDefinitionListResource#TemplateDefinitionListResource-Retrievealltemplatedefinitionlists"
-    *      > http://community.abiquo.com/display/ABI20/
-    *      TemplateDefinitionListResource#
-    *      TemplateDefinitionListResource-Retrievealltemplatedefinitionlists</a>
-    * @return Filtered list of template definition lists of the enterprise.
-    */
-   public List<TemplateDefinitionList> listTemplateDefinitionLists(final Predicate<TemplateDefinitionList> filter) {
-      return ImmutableList.copyOf(filter(listTemplateDefinitionLists(), filter));
-   }
-
-   /**
-    * Retrieve the first template definition list matching the filter within the
-    * list.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/TemplateDefinitionListResource#TemplateDefinitionListResource-Retrievealltemplatedefinitionlists"
-    *      > http://community.abiquo.com/display/ABI20/
-    *      TemplateDefinitionListResource#
-    *      TemplateDefinitionListResource-Retrievealltemplatedefinitionlists</a>
-    * @return First template definition list matching the filter or
-    *         <code>null</code> if the is none.
-    */
-   public TemplateDefinitionList findTemplateDefinitionList(final Predicate<TemplateDefinitionList> filter) {
-      return Iterables.getFirst(filter(listTemplateDefinitionLists(), filter), null);
-   }
-
-   /**
     * Retrieve a single template definition list.
     * 
     * @param id
@@ -259,38 +185,6 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
    }
 
    /**
-    * Retrieve a filtered list of datacenter limits by enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/DatacenterLimitsResource#DatacenterLimitsResource-Retrievelimitsbyenterprise"
-    *      > http://community.abiquo.com/display/ABI20/DatacenterLimitsResource#
-    *      DatacenterLimitsResource-Retrievelimitsbyenterprise</a>
-    * @return Filtered list of datacenter limits by enterprise.
-    */
-   public List<Limits> listLimits(final Predicate<Limits> filter) {
-      return ImmutableList.copyOf(filter(listLimits(), filter));
-   }
-
-   /**
-    * Retrieve the first datacenter limits matching the filter within the list
-    * of datacenter limits by enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/DatacenterLimitsResource#DatacenterLimitsResource-Retrievelimitsbyenterprise"
-    *      > http://community.abiquo.com/display/ABI20/DatacenterLimitsResource#
-    *      DatacenterLimitsResource-Retrievelimitsbyenterprise</a>
-    * @return First datacenter limits matching the filter or <code>null</code>
-    *         if there is none.
-    */
-   public Limits findLimits(final Predicate<Limits> filter) {
-      return Iterables.getFirst(filter(listLimits(), filter), null);
-   }
-
-   /**
     * Retrieve the defined properties of the given enterprise.
     * 
     * @see API: <a href=
@@ -321,40 +215,6 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
    }
 
    /**
-    * Retrieve a filtered list of users of this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/UserResource#UserResource-Retrievealistofusers"
-    *      >
-    *      http://community.abiquo.com/display/ABI20/UserResource#UserResource-
-    *      Retrievealistofusers </a>
-    * @return Filtered list of users of this enterprise.
-    */
-   public List<User> listUsers(final Predicate<User> filter) {
-      return ImmutableList.copyOf(filter(listUsers(), filter));
-   }
-
-   /**
-    * Retrieve the first user matching the filter within the list of users of
-    * this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/UserResource#UserResource-Retrievealistofusers"
-    *      >
-    *      http://community.abiquo.com/display/ABI20/UserResource#UserResource-
-    *      Retrievealistofusers </a>
-    * @return First user matching the filter or <code>null</code> if there is
-    *         none.
-    */
-   public User findUser(final Predicate<User> filter) {
-      return Iterables.getFirst(filter(listUsers(), filter), null);
-   }
-
-   /**
     * Retrieve a single user.
     * 
     * @param id
@@ -381,46 +241,12 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
       return wrap(context, Role.class, dto.getCollection());
    }
 
-   /**
-    * Retrieve a filtered list of roles defined by this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @return Filtered list of roles by this enterprise.
-    */
-   public List<Role> listRoles(final Predicate<Role> filter) {
-      return ImmutableList.copyOf(filter(listRoles(), filter));
-   }
-
-   /**
-    * Retrieve the first role matching the filter within the list of roles
-    * defined by this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @return First role matching the filter or <code>null</code> if there is
-    *         none.
-    */
-   public Role findRole(final Predicate<Role> filter) {
-      return Iterables.getFirst(filter(listRoles(), filter), null);
-   }
-
    public List<VirtualMachineTemplate> listTemplatesInRepository(final Datacenter datacenter) {
       VirtualMachineTemplatesDto dto = context.getApi().getVirtualMachineTemplateApi()
             .listVirtualMachineTemplates(target.getId(), datacenter.getId());
       return wrap(context, VirtualMachineTemplate.class, dto.getCollection());
    }
 
-   public List<VirtualMachineTemplate> listTemplatesInRepository(final Datacenter datacenter,
-         final Predicate<VirtualMachineTemplate> filter) {
-      return ImmutableList.copyOf(filter(listTemplatesInRepository(datacenter), filter));
-   }
-
-   public VirtualMachineTemplate findTemplateInRepository(final Datacenter datacenter,
-         final Predicate<VirtualMachineTemplate> filter) {
-      return Iterables.getFirst(filter(listTemplatesInRepository(datacenter), filter), null);
-   }
-
    public VirtualMachineTemplate getTemplateInRepository(final Datacenter datacenter, final Integer id) {
       VirtualMachineTemplateDto template = context.getApi().getVirtualMachineTemplateApi()
             .getVirtualMachineTemplate(target.getId(), datacenter.getId(), id);
@@ -432,29 +258,11 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
       return ImmutableList.copyOf(strategy.execute(this));
    }
 
-   public List<VirtualMachineTemplate> listTemplates(final Predicate<VirtualMachineTemplate> filter) {
-      ListVirtualMachineTemplates strategy = context.utils().injector().getInstance(ListVirtualMachineTemplates.class);
-      return ImmutableList.copyOf(strategy.execute(this, filter));
-   }
-
-   public VirtualMachineTemplate findTemplate(final Predicate<VirtualMachineTemplate> filter) {
-      ListVirtualMachineTemplates strategy = context.utils().injector().getInstance(ListVirtualMachineTemplates.class);
-      return Iterables.getFirst(strategy.execute(this, filter), null);
-   }
-
    public List<Datacenter> listAllowedDatacenters() {
       DatacentersDto datacenters = context.getApi().getEnterpriseApi().listAllowedDatacenters(target.getId());
       return wrap(context, Datacenter.class, datacenters.getCollection());
    }
 
-   public List<Datacenter> listAllowedDatacenters(final Predicate<Datacenter> filter) {
-      return ImmutableList.copyOf(filter(listAllowedDatacenters(), filter));
-   }
-
-   public Datacenter findAllowedDatacenter(final Predicate<Datacenter> filter) {
-      return Iterables.getFirst(filter(listAllowedDatacenters(), filter), null);
-   }
-
    /**
     * @see API: <a href=
     *      "http://community.abiquo.com/display/ABI20/Enterprise+Resource#EnterpriseResource-Getthelistofexternalnetworks"
@@ -472,15 +280,6 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
       return wrap(context, ExternalNetwork.class, parser.apply(response).getCollection());
    }
 
-   public List<ExternalNetwork> listExternalNetworks(final Datacenter datacenter,
-         final Predicate<Network<ExternalIp>> filter) {
-      return ImmutableList.copyOf(filter(listExternalNetworks(datacenter), filter));
-   }
-
-   public ExternalNetwork findExternalNetwork(final Datacenter datacenter, final Predicate<Network<ExternalIp>> filter) {
-      return Iterables.getFirst(filter(listExternalNetworks(datacenter), filter), null);
-   }
-
    public List<UnmanagedNetwork> listUnmanagedNetworks(final Datacenter datacenter) {
       DatacenterLimitsDto limitForDatacenter = getLimits(datacenter);
 
@@ -494,16 +293,6 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
       return wrap(context, UnmanagedNetwork.class, parser.apply(response).getCollection());
    }
 
-   public List<UnmanagedNetwork> listUnmanagedNetworks(final Datacenter datacenter,
-         final Predicate<Network<UnmanagedIp>> filter) {
-      return ImmutableList.copyOf(filter(listUnmanagedNetworks(datacenter), filter));
-   }
-
-   public UnmanagedNetwork findUnmanagedNetwork(final Datacenter datacenter,
-         final Predicate<Network<UnmanagedIp>> filter) {
-      return Iterables.getFirst(filter(listUnmanagedNetworks(datacenter), filter), null);
-   }
-
    /**
     * Retrieve the list of virtual appliances by this enterprise.
     * 
@@ -520,40 +309,6 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
    }
 
    /**
-    * Retrieve a filtered list of virtual appliances by this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/EnterpriseResource#EnterpriseResource-RetrievethelistofvirtualappliancesbyanEnterprise"
-    *      > http://community.abiquo.com/display/ABI20/EnterpriseResource#
-    *      EnterpriseResource-
-    *      RetrievethelistofvirtualappliancesbyanEnterprise</a>
-    * @return Filtered list of virtual appliances by this enterprise.
-    */
-   public List<VirtualAppliance> listVirtualAppliances(final Predicate<VirtualAppliance> filter) {
-      return ImmutableList.copyOf(filter(listVirtualAppliances(), filter));
-   }
-
-   /**
-    * Retrieve the first virtual appliance matching the filter within the list
-    * of virtual appliances in this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/EnterpriseResource#EnterpriseResource-RetrievethelistofvirtualappliancesbyanEnterprise"
-    *      > http://community.abiquo.com/display/ABI20/EnterpriseResource#
-    *      EnterpriseResource-
-    *      RetrievethelistofvirtualappliancesbyanEnterprise</a>
-    * @return First virtual machine matching the filter or <code>null</code> if
-    *         the is none.
-    */
-   public VirtualAppliance findVirtualAppliance(final Predicate<VirtualAppliance> filter) {
-      return Iterables.getFirst(filter(listVirtualAppliances(), filter), null);
-   }
-
-   /**
     * Retrieve the list of virtual machines by this enterprise.
     * 
     * @see API: <a href=
@@ -567,51 +322,11 @@ public class Enterprise extends DomainWithLimitsWrapper<EnterpriseDto> {
       return wrap(context, VirtualMachine.class, machines.getCollection());
    }
 
-   /**
-    * Retrieve a filtered list of virtual machines by this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/EnterpriseResource#EnterpriseResource-RetrievealistofvirtualmachinesbyanEnterprise"
-    *      > http://community.abiquo.com/display/ABI20/EnterpriseResource#
-    *      EnterpriseResource- RetrievealistofvirtualmachinesbyanEnterprise</a>
-    * @return Filtered list of virtual machines by this enterprise.
-    */
-   public List<VirtualMachine> listVirtualMachines(final Predicate<VirtualMachine> filter) {
-      return ImmutableList.copyOf(filter(listVirtualMachines(), filter));
-   }
-
-   /**
-    * Retrieve the first virtual machine matching the filter within the list of
-    * virtual machines in this enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/EnterpriseResource#EnterpriseResource-RetrievealistofvirtualmachinesbyanEnterprise"
-    *      > http://community.abiquo.com/display/ABI20/EnterpriseResource#
-    *      EnterpriseResource- RetrievealistofvirtualmachinesbyanEnterprise</a>
-    * @return First virtual machine matching the filter or <code>null</code> if
-    *         the is none.
-    */
-   public VirtualMachine findVirtualMachine(final Predicate<VirtualMachine> filter) {
-      return Iterables.getFirst(filter(listVirtualMachines(), filter), null);
-   }
-
    public List<Machine> listReservedMachines() {
       MachinesDto machines = context.getApi().getEnterpriseApi().listReservedMachines(target);
       return wrap(context, Machine.class, machines.getCollection());
    }
 
-   public List<VirtualMachine> listReservedMachines(final Predicate<VirtualMachine> filter) {
-      return ImmutableList.copyOf(filter(listVirtualMachines(), filter));
-   }
-
-   public VirtualMachine findReservedMachine(final Predicate<VirtualMachine> filter) {
-      return Iterables.getFirst(filter(listVirtualMachines(), filter), null);
-   }
-
    // Actions
 
    /**

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Role.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Role.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Role.java
index f8c2cf7..ba9b279 100644
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Role.java
+++ b/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/Role.java
@@ -17,7 +17,6 @@
 package org.jclouds.abiquo.domain.enterprise;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
 
 import java.util.List;
 
@@ -25,15 +24,11 @@ import org.jclouds.abiquo.AbiquoApi;
 import org.jclouds.abiquo.domain.DomainWrapper;
 import org.jclouds.abiquo.domain.config.Privilege;
 import org.jclouds.abiquo.reference.ValidationErrors;
-
 import org.jclouds.rest.ApiContext;
 
 import com.abiquo.model.rest.RESTLink;
 import com.abiquo.server.core.enterprise.PrivilegesDto;
 import com.abiquo.server.core.enterprise.RoleDto;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
 
 /**
  * Adds high level functionality to {@link RoleDto}.
@@ -137,14 +132,6 @@ public class Role extends DomainWrapper<RoleDto> {
       return wrap(context, Privilege.class, dto.getCollection());
    }
 
-   public List<Privilege> listPrivileges(final Predicate<Privilege> filter) {
-      return ImmutableList.copyOf(filter(listPrivileges(), filter));
-   }
-
-   public Privilege findPrivileges(final Predicate<Privilege> filter) {
-      return Iterables.getFirst(filter(listPrivileges(), filter), null);
-   }
-
    // Builder
 
    public static Builder builder(final ApiContext<AbiquoApi> context) {

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/User.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/User.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/User.java
index 43490e3..4519f5c 100644
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/User.java
+++ b/abiquo/src/main/java/org/jclouds/abiquo/domain/enterprise/User.java
@@ -17,7 +17,6 @@
 package org.jclouds.abiquo.domain.enterprise;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
 
 import java.util.List;
 import java.util.StringTokenizer;
@@ -36,9 +35,7 @@ import com.abiquo.server.core.cloud.VirtualMachinesWithNodeExtendedDto;
 import com.abiquo.server.core.enterprise.RoleDto;
 import com.abiquo.server.core.enterprise.UserDto;
 import com.google.common.base.Joiner;
-import com.google.common.base.Predicate;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 
 /**
@@ -128,14 +125,6 @@ public class User extends DomainWrapper<UserDto> {
       return ImmutableList.copyOf(listVirtualDatacenters.execute(ids));
    }
 
-   public List<VirtualDatacenter> listPermittedVirtualDatacenters(final Predicate<VirtualDatacenter> filter) {
-      return ImmutableList.copyOf(filter(listPermittedVirtualDatacenters(), filter));
-   }
-
-   public VirtualDatacenter findPermittedVirtualDatacenter(final Predicate<VirtualDatacenter> filter) {
-      return Iterables.getFirst(filter(listPermittedVirtualDatacenters(), filter), null);
-   }
-
    /**
     * Give access to all virtualdatacenters in the enterprise (requires update).
     */
@@ -191,14 +180,6 @@ public class User extends DomainWrapper<UserDto> {
       return wrap(context, VirtualMachine.class, machines.getCollection());
    }
 
-   public List<VirtualMachine> listMachines(final Predicate<VirtualMachine> filter) {
-      return ImmutableList.copyOf(filter(listMachines(), filter));
-   }
-
-   public VirtualMachine findMachine(final Predicate<VirtualMachine> filter) {
-      return Iterables.getFirst(filter(listMachines(), filter), null);
-   }
-
    // Builder
 
    public static Builder builder(final ApiContext<AbiquoApi> context, final Enterprise enterprise, final Role role) {

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/exception/AbiquoException.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/exception/AbiquoException.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/exception/AbiquoException.java
index e6f7f13..bc7e0ce 100644
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/exception/AbiquoException.java
+++ b/abiquo/src/main/java/org/jclouds/abiquo/domain/exception/AbiquoException.java
@@ -19,7 +19,6 @@ package org.jclouds.abiquo.domain.exception;
 import static com.google.common.collect.Iterables.any;
 import static com.google.common.collect.Iterables.filter;
 import static com.google.common.collect.Iterables.find;
-import static org.jclouds.abiquo.predicates.ErrorPredicates.code;
 
 import java.util.List;
 
@@ -27,6 +26,7 @@ import javax.ws.rs.core.Response.Status;
 
 import com.abiquo.model.transport.error.ErrorDto;
 import com.abiquo.model.transport.error.ErrorsDto;
+import com.google.common.base.Predicate;
 import com.google.common.collect.ImmutableList;
 
 /**
@@ -111,4 +111,13 @@ public class AbiquoException extends RuntimeException {
    public String getMessage() {
       return errors.toString();
    }
+
+   private static Predicate<ErrorDto> code(final String code) {
+      return new Predicate<ErrorDto>() {
+         @Override
+         public boolean apply(ErrorDto input) {
+            return input.getCode().equals(code);
+         }
+      };
+   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/AbstractPhysicalMachine.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/AbstractPhysicalMachine.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/AbstractPhysicalMachine.java
deleted file mode 100644
index cf924f2..0000000
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/AbstractPhysicalMachine.java
+++ /dev/null
@@ -1,266 +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.abiquo.domain.infrastructure;
-
-import static com.google.common.collect.Iterables.find;
-
-import java.util.List;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.domain.DomainWrapper;
-import org.jclouds.abiquo.predicates.infrastructure.DatastorePredicates;
-import org.jclouds.abiquo.predicates.infrastructure.NetworkInterfacePredicates;
-import org.jclouds.rest.ApiContext;
-
-import com.abiquo.model.enumerator.HypervisorType;
-import com.abiquo.model.enumerator.MachineIpmiState;
-import com.abiquo.model.enumerator.MachineState;
-import com.abiquo.server.core.infrastructure.DatastoresDto;
-import com.abiquo.server.core.infrastructure.MachineDto;
-import com.abiquo.server.core.infrastructure.MachineIpmiStateDto;
-import com.abiquo.server.core.infrastructure.MachineStateDto;
-
-/**
- * Adds high level functionality to {@link MachineDto}. This class defines
- * common methods for unmanaged {@link Machine} and managed {@link Blade}
- * physical machines.
- * 
- * @author Ignasi Barrera
- * @author Francesc Montserrat
- * @see API: <a
- *      href="http://community.abiquo.com/display/ABI20/MachineResource">
- *      http://community.abiquo.com/display/ABI20/MachineResource</a>
- */
-public abstract class AbstractPhysicalMachine extends DomainWrapper<MachineDto> {
-   /** The default virtual ram used in MB. */
-   protected static final int DEFAULT_VRAM_USED = 1;
-
-   /** The default virtual cpu used in MB. */
-   protected static final int DEFAULT_VCPU_USED = 1;
-
-   /**
-    * Constructor to be used only by the builder.
-    */
-   protected AbstractPhysicalMachine(final ApiContext<AbiquoApi> context, final MachineDto target) {
-      super(context, target);
-   }
-
-   public void delete() {
-      context.getApi().getInfrastructureApi().deleteMachine(target);
-      target = null;
-   }
-
-   public void update() {
-      target = context.getApi().getInfrastructureApi().updateMachine(target);
-   }
-
-   public MachineState check() {
-      MachineStateDto dto = context.getApi().getInfrastructureApi().checkMachineState(target, true);
-      MachineState state = dto.getState();
-      target.setState(state);
-      return state;
-   }
-
-   public MachineIpmiState checkIpmi() {
-      MachineIpmiStateDto dto = context.getApi().getInfrastructureApi().checkMachineIpmiState(target);
-      return dto.getState();
-   }
-
-   // Children access
-
-   public List<Datastore> getDatastores() {
-      return wrap(context, Datastore.class, target.getDatastores().getCollection());
-   }
-
-   public Datastore findDatastore(final String name) {
-      return find(getDatastores(), DatastorePredicates.name(name), null);
-   }
-
-   public List<NetworkInterface> getNetworkInterfaces() {
-      return wrap(context, NetworkInterface.class, target.getNetworkInterfaces().getCollection());
-   }
-
-   public NetworkInterface findNetworkInterface(final String name) {
-      return find(getNetworkInterfaces(), NetworkInterfacePredicates.name(name), null);
-   }
-
-   // Delegate methods
-
-   public Integer getId() {
-      return target.getId();
-   }
-
-   public String getIp() {
-      return target.getIp();
-   }
-
-   public String getIpmiIp() {
-      return target.getIpmiIP();
-   }
-
-   public String getIpmiPassword() {
-      return target.getIpmiPassword();
-   }
-
-   public Integer getIpmiPort() {
-      return target.getIpmiPort();
-   }
-
-   public String getIpmiUser() {
-      return target.getIpmiUser();
-   }
-
-   public String getIpService() {
-      return target.getIpService();
-   }
-
-   public String getName() {
-      return target.getName();
-   }
-
-   public String getPassword() {
-      return target.getPassword();
-   }
-
-   public Integer getPort() {
-      return target.getPort();
-   }
-
-   public MachineState getState() {
-      return target.getState();
-   }
-
-   public HypervisorType getType() {
-      return target.getType();
-   }
-
-   public String getUser() {
-      return target.getUser();
-   }
-
-   public Integer getVirtualCpuCores() {
-      return target.getVirtualCpuCores();
-   }
-
-   public Integer getVirtualCpusUsed() {
-      return target.getVirtualCpusUsed();
-   }
-
-   public Integer getVirtualRamInMb() {
-      return target.getVirtualRamInMb();
-   }
-
-   public Integer getVirtualRamUsedInMb() {
-      return target.getVirtualRamUsedInMb();
-   }
-
-   public void setDatastores(final List<Datastore> datastores) {
-      DatastoresDto datastoresDto = new DatastoresDto();
-      datastoresDto.getCollection().addAll(DomainWrapper.unwrap(datastores));
-      target.setDatastores(datastoresDto);
-   }
-
-   public void setDescription(final String description) {
-      target.setDescription(description);
-   }
-
-   public void setIp(final String ip) {
-      target.setIp(ip);
-   }
-
-   public void setIpmiIp(final String ipmiIp) {
-      target.setIpmiIP(ipmiIp);
-   }
-
-   public void setIpmiPassword(final String ipmiPassword) {
-      target.setIpmiPassword(ipmiPassword);
-   }
-
-   public void setIpmiPort(final Integer ipmiPort) {
-      target.setIpmiPort(ipmiPort);
-   }
-
-   public void setIpmiUser(final String ipmiUser) {
-      target.setIpmiUser(ipmiUser);
-   }
-
-   public void setIpService(final String ipService) {
-      target.setIpService(ipService);
-   }
-
-   public void setName(final String name) {
-      target.setName(name);
-   }
-
-   public void setPassword(final String password) {
-      target.setPassword(password);
-   }
-
-   public void setPort(final Integer port) {
-      target.setPort(port);
-   }
-
-   public void setState(final MachineState state) {
-      target.setState(state);
-   }
-
-   public void setType(final HypervisorType type) {
-      target.setType(type);
-   }
-
-   public void setUser(final String user) {
-      target.setUser(user);
-   }
-
-   public void setVirtualCpuCores(final Integer virtualCpuCores) {
-      target.setVirtualCpuCores(virtualCpuCores);
-   }
-
-   public void setVirtualCpusUsed(final Integer virtualCpusUsed) {
-      target.setVirtualCpusUsed(virtualCpusUsed);
-   }
-
-   public void setVirtualRamInMb(final Integer virtualRamInMb) {
-      target.setVirtualRamInMb(virtualRamInMb);
-   }
-
-   public void setVirtualRamUsedInMb(final Integer virtualRamUsedInMb) {
-      target.setVirtualRamUsedInMb(virtualRamUsedInMb);
-   }
-
-   public String getDescription() {
-      return target.getDescription();
-   }
-
-   // Aux operations
-
-   public NetworkInterface findAvailableVirtualSwitch(final String virtualswitch) {
-      return find(getNetworkInterfaces(), NetworkInterfacePredicates.name(virtualswitch));
-   }
-
-   @Override
-   public String toString() {
-      return "Machine [id=" + getId() + ", ip=" + getIp() + ", ipmiIp=" + getIpmiIp() + ", ipmiPassword="
-            + getIpmiPassword() + ", ipmiPort=" + getIpmiPort() + ", ipmiUser=" + getIpmiUser() + ", ipService="
-            + getIpService() + ", name=" + getName() + ", password=" + getPassword() + ", port=" + getPort()
-            + ", state=" + getState() + ", type=" + getType() + ", user=" + getUser() + ", virtualCpuCores="
-            + getVirtualCpuCores() + ", virtualCpusUsed=" + getVirtualCpusUsed() + ", getVirtualRamInMb()="
-            + getVirtualRamInMb() + ", virtualRamUsedInMb=" + getVirtualRamUsedInMb() + ", description="
-            + getDescription() + "]";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Blade.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Blade.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Blade.java
deleted file mode 100644
index 89c3e21..0000000
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Blade.java
+++ /dev/null
@@ -1,167 +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.abiquo.domain.infrastructure;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.reference.ValidationErrors;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseXMLWithJAXB;
-import org.jclouds.rest.ApiContext;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.server.core.infrastructure.BladeLocatorLedDto;
-import com.abiquo.server.core.infrastructure.LogicServerDto;
-import com.abiquo.server.core.infrastructure.MachineDto;
-import com.abiquo.server.core.infrastructure.UcsRackDto;
-import com.google.inject.TypeLiteral;
-
-/**
- * Adds high level functionality to a {@link MachineDto} managed in a UCS rack.
- * This resource allows you to access blades in managed racks in the cloud
- * infrastructure.
- * 
- * @author Ignasi Barrera
- * @author Francesc Montserrat
- * @see API: <a
- *      href="http://community.abiquo.com/display/ABI20/MachineResource">
- *      http://community.abiquo.com/display/ABI20/MachineResource</a>
- */
-public class Blade extends AbstractPhysicalMachine {
-   /** The rack where the machine belongs. */
-   protected UcsRackDto rack;
-
-   /**
-    * Constructor to be used only by the builder.
-    */
-   protected Blade(final ApiContext<AbiquoApi> context, final MachineDto target) {
-      super(context, target);
-   }
-
-   // Parent access
-
-   /**
-    * Retrieve the UCS rack where the blade is.
-    * 
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/RackResource#RackResource-RetrieveaUCSRack"
-    *      >
-    *      http://community.abiquo.com/display/ABI20/RackResource#RackResource-
-    *      RetrieveaUCSRack</a>
-    */
-   public ManagedRack getRack() {
-      RESTLink link = checkNotNull(target.searchLink(ParentLinkName.RACK), ValidationErrors.MISSING_REQUIRED_LINK + " "
-            + ParentLinkName.RACK);
-
-      HttpResponse response = context.getApi().get(link);
-
-      ParseXMLWithJAXB<UcsRackDto> parser = new ParseXMLWithJAXB<UcsRackDto>(context.utils().xml(),
-            TypeLiteral.get(UcsRackDto.class));
-
-      return wrap(context, ManagedRack.class, parser.apply(response));
-   }
-
-   /**
-    * Retrieve the logic server associated with this machine in the Cisco UCS
-    * rack.
-    * 
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/MachineResource#MachineResource-RetrieveslogicserverassociatedwithamachineinaCiscoUCS"
-    *      > http://community.abiquo.com/display/ABI20/MachineResource#
-    *      MachineResource-
-    *      RetrieveslogicserverassociatedwithamachineinaCiscoUCS</a>
-    */
-   public LogicServer getLogicServer() {
-      LogicServerDto server = context.getApi().getInfrastructureApi().getLogicServer(target);
-
-      return wrap(context, LogicServer.class, server);
-   }
-
-   // Actions
-
-   /**
-    * Turn the blade associated to the provided logic server off. The blade must
-    * belong to a Logic Server. This action sets the state of a given machine to
-    * STOPPED. Also sends a stop request to Cisco UCS to shut down the machine.
-    * The given machine must be a Physical Machine inside a Cisco UCS.
-    * 
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/MachineResource#MachineResource-PoweroffanexistingmachineinCiscoUCS"
-    *      > http://community.abiquo.com/display/ABI20/MachineResource#
-    *      MachineResource- PoweroffanexistingmachineinCiscoUCS</a>
-    */
-   public void powerOff() {
-      context.getApi().getInfrastructureApi().powerOff(target);
-   }
-
-   /**
-    * Turn the blade associated to the provided logic server on. The machine
-    * must belong to an UCS Rack. The blade must belong to a Logic Server.
-    * 
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/MachineResource#MachineResource-PoweronanexistingmachineinCiscoUCS"
-    *      > http://community.abiquo.com/display/ABI20/MachineResource#
-    *      MachineResource- PoweronanexistingmachineinCiscoUCS</a>
-    */
-   public void powerOn() {
-      context.getApi().getInfrastructureApi().powerOn(target);
-   }
-
-   /**
-    * Turn blade led on. The machine must belong to an UCS Rack. The blade must
-    * belong to a Logic Server.
-    * 
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/MachineResource#MachineResource-LightoffthelocatorledofanexistingmachineinaCiscoUCS"
-    *      > http://community.abiquo.com/display/ABI20/MachineResource#
-    *      MachineResource-
-    *      LightoffthelocatorledofanexistingmachineinaCiscoUCS</a>
-    */
-   public void ledOn() {
-      context.getApi().getInfrastructureApi().ledOn(target);
-   }
-
-   /**
-    * Turn blade led off. The machine must belong to an UCS Rack. The blade must
-    * belong to a Logic Server.
-    * 
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/MachineResource-LightoffthelocatorledofanexistingmachineinaCiscoUCS"
-    *      > http://community.abiquo.com/display/ABI20/MachineResource-
-    *      LightoffthelocatorledofanexistingmachineinaCiscoUCS</a>
-    */
-   public void ledOff() {
-      context.getApi().getInfrastructureApi().ledOff(target);
-   }
-
-   /**
-    * Retrieve the led locator information as a {@link BladeLocatorLed}.
-    * 
-    * @return Blade locator led representation.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/MachineResource#MachineResource-Retrievethelocatorledoftheblade"
-    *      > http://community.abiquo.com/display/ABI20/MachineResource#
-    *      MachineResource- Retrievethelocatorledoftheblade</a>
-    */
-   public BladeLocatorLed getLocatorLed() {
-      BladeLocatorLedDto led = context.getApi().getInfrastructureApi().getLocatorLed(target);
-
-      return wrap(context, BladeLocatorLed.class, led);
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/BladeLocatorLed.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/BladeLocatorLed.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/BladeLocatorLed.java
deleted file mode 100644
index 6735df2..0000000
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/BladeLocatorLed.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.abiquo.domain.infrastructure;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.domain.DomainWrapper;
-
-import org.jclouds.rest.ApiContext;
-
-import com.abiquo.server.core.infrastructure.BladeLocatorLedDto;
-
-/**
- * Adds high level functionality to {@link BladeLocatorLedDto}.
- * 
- * @author Ignasi Barrera
- * @author Francesc Montserrat
- * @see API: <a href=
- *      "http://community.abiquo.com/display/ABI20/MachineResource#MachineResource-Retrievethelocatorledoftheblade"
- *      > http://community.abiquo.com/display/ABI20/MachineResource#
- *      MachineResource- Retrievethelocatorledoftheblade</a>
- */
-public class BladeLocatorLed extends DomainWrapper<BladeLocatorLedDto> {
-   /**
-    * Constructor to be used only by the builder.
-    */
-   protected BladeLocatorLed(final ApiContext<AbiquoApi> context, final BladeLocatorLedDto target) {
-      super(context, target);
-   }
-
-   // Delegate Methods
-
-   public String getAdminStatus() {
-      return target.getAdminStatus();
-   }
-
-   public String getBladeDn() {
-      return target.getBladeDn();
-   }
-
-   public String getColor() {
-      return target.getColor();
-   }
-
-   public String getDn() {
-      return target.getDn();
-   }
-
-   @Override
-   public String toString() {
-      return "BladeLocatorLed [Dn=" + getDn() + ", BladeDn=" + getBladeDn() + ", Color=" + getColor()
-            + ", AdminStatus=" + getAdminStatus() + "]";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Datacenter.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Datacenter.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Datacenter.java
index 1debb12..25f8664 100644
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Datacenter.java
+++ b/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Datacenter.java
@@ -16,9 +16,7 @@
  */
 package org.jclouds.abiquo.domain.infrastructure;
 
-import static com.google.common.collect.Iterables.filter;
 import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.getFirst;
 import static com.google.common.collect.Iterables.transform;
 
 import java.util.List;
@@ -35,7 +33,7 @@ import org.jclouds.abiquo.domain.network.Network;
 import org.jclouds.abiquo.domain.network.NetworkServiceType;
 import org.jclouds.abiquo.domain.network.PrivateNetwork;
 import org.jclouds.abiquo.domain.network.options.NetworkOptions;
-import org.jclouds.abiquo.predicates.network.NetworkServiceTypePredicates;
+import org.jclouds.abiquo.predicates.NetworkServiceTypePredicates;
 import org.jclouds.rest.ApiContext;
 
 import com.abiquo.model.enumerator.HypervisorType;
@@ -57,8 +55,6 @@ import com.abiquo.server.core.infrastructure.MachinesDto;
 import com.abiquo.server.core.infrastructure.RackDto;
 import com.abiquo.server.core.infrastructure.RacksDto;
 import com.abiquo.server.core.infrastructure.RemoteServicesDto;
-import com.abiquo.server.core.infrastructure.UcsRackDto;
-import com.abiquo.server.core.infrastructure.UcsRacksDto;
 import com.abiquo.server.core.infrastructure.network.NetworkServiceTypeDto;
 import com.abiquo.server.core.infrastructure.network.NetworkServiceTypesDto;
 import com.abiquo.server.core.infrastructure.network.VLANNetworkDto;
@@ -69,7 +65,6 @@ import com.abiquo.server.core.infrastructure.storage.StorageDevicesDto;
 import com.abiquo.server.core.infrastructure.storage.StorageDevicesMetadataDto;
 import com.abiquo.server.core.infrastructure.storage.TiersDto;
 import com.google.common.base.Function;
-import com.google.common.base.Predicate;
 import com.google.common.collect.ImmutableList;
 
 /**
@@ -183,38 +178,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve a filtered list of unmanaged racks in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/RackResource#RackResource-RetrievealistofRacks"
-    *      > http://community.abiquo.com/display/ABI20/RackResource#RackResource
-    *      - RetrievealistofRacks</a>
-    * @return Filtered list of unmanaged racks in this datacenter.
-    */
-   public List<Rack> listRacks(final Predicate<Rack> filter) {
-      return ImmutableList.copyOf(filter(listRacks(), filter));
-   }
-
-   /**
-    * Retrieve the first unmanaged rack matching the filter within the list of
-    * racks in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/RackResource#RackResource-RetrievealistofRacks"
-    *      > http://community.abiquo.com/display/ABI20/RackResource#RackResource
-    *      - RetrievealistofRacks</a>
-    * @return First unmanaged rack matching the filter or <code>null</code> if
-    *         the is none.
-    */
-   public Rack findRack(final Predicate<Rack> filter) {
-      return getFirst(filter(listRacks(), filter), null);
-   }
-
-   /**
     * Retrieve a single unmanaged rack.
     * 
     * @param id
@@ -233,70 +196,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve the list of managed racks in this datacenter.
-    * 
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/RackResource#RackResource-RetrievealistofUCSracks"
-    *      > http://community.abiquo.com/display/ABI20/RackResource#RackResource
-    *      - RetrievealistofUCSracks</a>
-    * @return List of managed racks in this datacenter.
-    */
-   public List<ManagedRack> listManagedRacks() {
-      UcsRacksDto racks = context.getApi().getInfrastructureApi().listManagedRacks(target);
-      return wrap(context, ManagedRack.class, racks.getCollection());
-   }
-
-   /**
-    * Retrieve a filtered list of managed racks in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/RackResource#RackResource-RetrievealistofUCSracks"
-    *      > http://community.abiquo.com/display/ABI20/RackResource#RackResource
-    *      - RetrievealistofUCSracks</a>
-    * @return Filtered list of managed racks in this datacenter.
-    */
-   public List<ManagedRack> listManagedRacks(final Predicate<ManagedRack> filter) {
-      return ImmutableList.copyOf(filter(listManagedRacks(), filter));
-   }
-
-   /**
-    * Retrieve the first managed rack matching the filter within the list of
-    * racks in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/RackResource#RackResource-RetrievealistofUCSracks"
-    *      > http://community.abiquo.com/display/ABI20/RackResource#RackResource
-    *      - RetrievealistofUCSracks</a>
-    * @return First managed rack matching the filter or <code>null</code> if
-    *         there is none.
-    */
-   public ManagedRack findManagedRack(final Predicate<ManagedRack> filter) {
-      return getFirst(filter(listManagedRacks(), filter), null);
-   }
-
-   /**
-    * Retrieve a single managed rack.
-    * 
-    * @param id
-    *           Unique ID of the rack in this datacenter.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/RackResource#RackResource-RetrieveaUCSRack"
-    *      >
-    *      http://community.abiquo.com/display/ABI20/RackResource#RackResource-
-    *      RetrieveaUCSRack</a>
-    * @return Unmanaged rack with the given id or <code>null</code> if it does
-    *         not exist.
-    */
-   public ManagedRack getManagedRack(final Integer id) {
-      UcsRackDto rack = context.getApi().getInfrastructureApi().getManagedRack(target, id);
-      return wrap(context, ManagedRack.class, rack);
-   }
-
-   /**
     * Retrieve the list of supported storage devices.
     * <p>
     * This method will get the list of the storage devices that are supported in
@@ -312,34 +211,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve the list of supported storage devices matching the filter.
-    * <p>
-    * This method will get the list of the storage devices that are supported in
-    * the datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @return List of supported storage devices. This list has only the default
-    *         information for the storage devices, such as the management and
-    *         iscsi ports, or the default credentials to access the device.
-    */
-   public List<StorageDeviceMetadata> listSupportedStorageDevices(final Predicate<StorageDeviceMetadata> filter) {
-      return ImmutableList.copyOf(filter(listSupportedStorageDevices(), filter));
-   }
-
-   /**
-    * Retrieve a single supported storage devices matching the filter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @return First supported storage device matching the filter or
-    *         <code>null</code> if there is none.
-    */
-   public StorageDeviceMetadata findSupportedStorageDevice(final Predicate<StorageDeviceMetadata> filter) {
-      return getFirst(filter(listSupportedStorageDevices(), filter), null);
-   }
-
-   /**
     * Retrieve the list of storage devices in this datacenter.
     * 
     * @see API: <a href=
@@ -354,38 +225,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve a filtered list of storage devices in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/StorageDeviceResource#StorageDeviceResource-Retrievethelistofstoragedevices"
-    *      > http://community.abiquo.com/display/ABI20/StorageDeviceResource#
-    *      StorageDeviceResource- Retrievethelistofstoragedevices</a>
-    * @return Filtered list of storage devices in this datacenter.
-    */
-   public List<StorageDevice> listStorageDevices(final Predicate<StorageDevice> filter) {
-      return ImmutableList.copyOf(filter(listStorageDevices(), filter));
-   }
-
-   /**
-    * Retrieve the first storage device matching the filter within the list of
-    * devices in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/StorageDeviceResource#StorageDeviceResource-Retrievethelistofstoragedevices"
-    *      > http://community.abiquo.com/display/ABI20/StorageDeviceResource#
-    *      StorageDeviceResource- Retrievethelistofstoragedevices</a>
-    * @return First storage device matching the filter or <code>null</code> if
-    *         there is none.
-    */
-   public StorageDevice findStorageDevice(final Predicate<StorageDevice> filter) {
-      return getFirst(filter(listStorageDevices(), filter), null);
-   }
-
-   /**
     * Retrieve a single storage device.
     * 
     * @param id
@@ -415,30 +254,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve a filtered list of network service types in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @return Filtered list of storage devices in this datacenter.
-    */
-   public List<NetworkServiceType> listNetworkServiceTypes(final Predicate<NetworkServiceType> filter) {
-      return ImmutableList.copyOf(filter(listNetworkServiceTypes(), filter));
-   }
-
-   /**
-    * Retrieve the first network service type matching the filter within the
-    * list of nsts in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @return First network service type matching the filter or
-    *         <code>null</code> if there is none.
-    */
-   public NetworkServiceType findNetworkServiceType(final Predicate<NetworkServiceType> filter) {
-      return getFirst(filter(listNetworkServiceTypes(), filter), null);
-   }
-
-   /**
     * Retrieve a single network service type.
     * 
     * @param id
@@ -476,38 +291,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
       return wrap(context, RemoteService.class, remoteServices.getCollection());
    }
 
-   /**
-    * Retrieve a filtered list of remote services of this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/RemoteServiceResource#RemoteServiceResource-RetrievealistofRemoteServices"
-    *      > http://community.abiquo.com/display/ABI20/RemoteServiceResource#
-    *      RemoteServiceResource- RetrievealistofRemoteServices</a>
-    * @return Filtered list of remote services in this datacenter.
-    */
-   public List<RemoteService> listRemoteServices(final Predicate<RemoteService> filter) {
-      return ImmutableList.copyOf(filter(listRemoteServices(), filter));
-   }
-
-   /**
-    * Retrieve the first remote service matching the filter within the list of
-    * remote services in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/RemoteServiceResource#RemoteServiceResource-RetrievealistofRemoteServices"
-    *      > http://community.abiquo.com/display/ABI20/RemoteServiceResource#
-    *      RemoteServiceResource- RetrievealistofRemoteServices</a>
-    * @return First remote service matching the filter or <code>null</code> if
-    *         there is none.
-    */
-   public RemoteService findRemoteService(final Predicate<RemoteService> filter) {
-      return getFirst(filter(listRemoteServices(), filter), null);
-   }
-
    private void createRemoteServices() {
       createRemoteService(RemoteServiceType.BPM_SERVICE);
       createRemoteService(RemoteServiceType.DHCP_SERVICE);
@@ -539,42 +322,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve a filtered list of datacenter limits by enterprises. The
-    * Datacenter Limits resource allows you to assign datacenters and allocated
-    * resources in them to be used by an enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/DatacenterResource#DatacenterResource-Retrievelimitsbydatacenter"
-    *      > http://community.abiquo.com/display/ABI20/DatacenterResource#
-    *      DatacenterResource- Retrievelimitsbydatacenter</a>
-    * @return Filtered list of datacenter limits by all enterprises.
-    */
-   public List<Limits> listLimits(final Predicate<Limits> filter) {
-      return ImmutableList.copyOf(filter(listLimits(), filter));
-   }
-
-   /**
-    * Retrieve the first datacenter limits matching the filter within the list
-    * of datacenter limits by enterprise. The Datacenter Limits resource allows
-    * you to assign datacenters and allocated resources in them to be used by an
-    * enterprise.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/DatacenterResource#DatacenterResource-Retrievelimitsbydatacenter"
-    *      > http://community.abiquo.com/display/ABI20/DatacenterResource#
-    *      DatacenterResource- Retrievelimitsbydatacenter</a>
-    * @return First datacenter limits matching the filter or <code>null</code>
-    *         if there is none.
-    */
-   public Limits findLimits(final Predicate<Limits> filter) {
-      return getFirst(filter(listLimits(), filter), null);
-   }
-
-   /**
     * Retrieve the list of tiers in ths datacenter.
     * 
     * @see API: <a href=
@@ -590,39 +337,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve a filtered list of tiers in this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/TierResource#TierResource-Retrievethelistoftiers"
-    *      >
-    *      http://community.abiquo.com/display/ABI20/TierResource#TierResource-
-    *      Retrievethelistoftiers </a>
-    * @return Filtered list of tiers in this datacenter.
-    */
-   public List<Tier> listTiers(final Predicate<Tier> filter) {
-      return ImmutableList.copyOf(filter(listTiers(), filter));
-   }
-
-   /**
-    * Retrieve the first tier matching the filter within the list of tiers in
-    * this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/StorageDeviceResource#StorageDeviceResource-Retrievethelistofstoragedevices"
-    *      > http://community.abiquo.com/display/ABI20/StorageDeviceResource#
-    *      StorageDeviceResource- Retrievethelistofstoragedevices</a>
-    * @return First tier matching the filter or <code>null</code> if there is
-    *         none.
-    */
-   public Tier findTier(final Predicate<Tier> filter) {
-      return getFirst(filter(listTiers(), filter), null);
-   }
-
-   /**
     * Retrieve the list of public, external and unmanaged networks in this
     * datacenter.
     * 
@@ -639,38 +353,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve a filtered list of public, external and unmanaged networks in
-    * this datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/PublicNetworkResource#PublicNetworkResource-Getthelistofpublicnetworks"
-    *      > http://community.abiquo.com/display/ABI20/PublicNetworkResource#
-    *      PublicNetworkResource- Getthelistofpublicnetworks</a>
-    */
-   public List<Network<?>> listNetworks(final Predicate<Network<?>> filter) {
-      return ImmutableList.copyOf(filter(listNetworks(), filter));
-   }
-
-   /**
-    * Retrieve the first network matching the filter within the list of
-    * networks.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/PublicNetworkResource#PublicNetworkResource-Getthelistofpublicnetworks"
-    *      > http://community.abiquo.com/display/ABI20/PublicNetworkResource#
-    *      PublicNetworkResource- Getthelistofpublicnetworks</a>
-    * @return Filtered list of public, external and unmanaged networks in this
-    *         datacenter.
-    */
-   public Network<?> findNetwork(final Predicate<Network<?>> filter) {
-      return getFirst(filter(listNetworks(), filter), null);
-   }
-
-   /**
     * Retrieve the list of networks of this datacenter matching the given type.
     * 
     * @param type
@@ -688,43 +370,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve a filtered list of networks of this datacenter matching the given
-    * type.
-    * 
-    * @param type
-    *           Network type filter.
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/PublicNetworkResource#PublicNetworkResource-Getthelistofpublicnetworks"
-    *      > http://community.abiquo.com/display/ABI20/PublicNetworkResource#
-    *      PublicNetworkResource- Getthelistofpublicnetworks</a>
-    * @return Filtered list of networks of this datacenter matching the given
-    *         type.
-    */
-   public List<Network<?>> listNetworks(final NetworkType type, final Predicate<Network<?>> filter) {
-      return ImmutableList.copyOf(filter(listNetworks(type), filter));
-   }
-
-   /**
-    * Retrieve the first network of the given type matching the filter.
-    * 
-    * @param type
-    *           Network type filter.
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/PublicNetworkResource#PublicNetworkResource-Getthelistofpublicnetworks"
-    *      > http://community.abiquo.com/display/ABI20/PublicNetworkResource#
-    *      PublicNetworkResource- Getthelistofpublicnetworks</a>
-    * @return First network of the given type matching the filter or
-    *         <code>null</code> if there is none.
-    */
-   public Network<?> findNetwork(final NetworkType type, final Predicate<Network<?>> filter) {
-      return getFirst(filter(listNetworks(type), filter), null);
-   }
-
-   /**
     * Retrieve a single public, external or unmanaged network from this
     * datacenter.
     * {@link org.jclouds.abiquo.domain.network.Network#toExternalNetwork},
@@ -781,42 +426,9 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
     */
    public List<HypervisorType> listAvailableHypervisors() {
       HypervisorTypesDto types = context.getApi().getInfrastructureApi().getHypervisorTypes(target);
-
       return getHypervisorTypes(types);
    }
 
-   /**
-    * Retrieve a filtered list of available hypervisor types in the datacenter.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/DatacenterResource#DatacenterResource-Retrieveavailablehypervisortypes"
-    *      http://community.abiquo.com/display/ABI20/DatacenterResource#
-    *      DatacenterResource- Retrieveavailablehypervisortypes</a>
-    * @return Filtered list of available hypervisor types in the datacenter.
-    */
-   public List<HypervisorType> listAvailableHypervisors(final Predicate<HypervisorType> filter) {
-      return ImmutableList.copyOf(filter(listAvailableHypervisors(), filter));
-   }
-
-   /**
-    * Retrieve the first hypervisor type matching the filter within the list of
-    * types.
-    * 
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/DatacenterResource#DatacenterResource-Retrieveavailablehypervisortypes"
-    *      > http://community.abiquo.com/display/ABI20/DatacenterResource#
-    *      DatacenterResource- Retrieveavailablehypervisortypes</a>
-    * @return First hypervisor type matching the filter or <code>null</code> if
-    *         there is none.
-    */
-   public HypervisorType findHypervisor(final Predicate<HypervisorType> filter) {
-      return getFirst(filter(listAvailableHypervisors(), filter), null);
-   }
-
    private List<HypervisorType> getHypervisorTypes(final HypervisorTypesDto dtos) {
       return ImmutableList.copyOf(transform(dtos.getCollection(), new Function<HypervisorTypeDto, HypervisorType>() {
          @Override
@@ -1082,48 +694,6 @@ public class Datacenter extends DomainWrapper<DatacenterDto> {
    }
 
    /**
-    * Retrieve a filtered list of virtual machine templates in the repository of
-    * this datacenter.
-    * 
-    * @param enterprise
-    *           Owner of the templates.
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/VirtualMachineTemplateResource#VirtualMachineTemplateResource-Retrieveallvirtualmachinetemplates"
-    *      > http://community.abiquo.com/display/ABI20/
-    *      VirtualMachineTemplateResource#
-    *      VirtualMachineTemplateResource-Retrieveallvirtualmachinetemplates</a>
-    * @return Filtered list of virtual machine templates in the repository of
-    *         this datacenter.
-    */
-   public List<VirtualMachineTemplate> listTemplatesInRepository(final Enterprise enterprise,
-         final Predicate<VirtualMachineTemplate> filter) {
-      return ImmutableList.copyOf(filter(listTemplatesInRepository(enterprise), filter));
-   }
-
-   /**
-    * Retrieve the first virtual machine template within the list of templates
-    * of this datacenter from the given enterprise.
-    * 
-    * @param enterprise
-    *           Owner of the templates.
-    * @param filter
-    *           Filter to be applied to the list.
-    * @see API: <a href=
-    *      "http://community.abiquo.com/display/ABI20/VirtualMachineTemplateResource#VirtualMachineTemplateResource-Retrieveallvirtualmachinetemplates"
-    *      > http://community.abiquo.com/display/ABI20/
-    *      VirtualMachineTemplateResource#
-    *      VirtualMachineTemplateResource-Retrieveallvirtualmachinetemplates</a>
-    * @return First virtual machine template matching the filter or
-    *         <code>null</code> if there is none.
-    */
-   public VirtualMachineTemplate findTemplateInRepository(final Enterprise enterprise,
-         final Predicate<VirtualMachineTemplate> filter) {
-      return getFirst(filter(listTemplatesInRepository(enterprise), filter), null);
-   }
-
-   /**
     * Retrieve a single virtual machine template in of this datacenter from the
     * given enterprise.
     * 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Fsm.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Fsm.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Fsm.java
deleted file mode 100644
index 4c63125..0000000
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Fsm.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.abiquo.domain.infrastructure;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.domain.DomainWrapper;
-
-import org.jclouds.rest.ApiContext;
-
-import com.abiquo.server.core.infrastructure.FsmDto;
-
-/**
- * Adds high level functionality to {@link FsmDto}.
- * 
- * @author Ignasi Barrera
- * @author Francesc Montserrat
- * @see API: <a href="http://community.abiquo.com/display/ABI20/Rack+Resource">
- *      http://community.abiquo.com/display/ABI20/Rack+Resource</a>
- */
-public class Fsm extends DomainWrapper<FsmDto> {
-   /**
-    * Constructor to be used only by the builder.
-    */
-   protected Fsm(final ApiContext<AbiquoApi> context, final FsmDto target) {
-      super(context, target);
-   }
-
-   // Delegate Methods
-
-   public String getDescription() {
-      return target.getDescription();
-   }
-
-   public String getDn() {
-      return target.getDn();
-   }
-
-   public String getError() {
-      return target.getError();
-   }
-
-   public String getProgress() {
-      return target.getProgress();
-   }
-
-   public String getStatus() {
-      return target.getStatus();
-   }
-
-   @Override
-   public String toString() {
-      return "Fsm [Dn=" + getDn() + ", Description=" + getDescription() + ", Error=" + getError() + ", Progress="
-            + getProgress() + ", Status=" + getStatus() + "]";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/LogicServer.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/LogicServer.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/LogicServer.java
deleted file mode 100644
index 78ce59a..0000000
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/LogicServer.java
+++ /dev/null
@@ -1,85 +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.abiquo.domain.infrastructure;
-
-import java.util.List;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.domain.DomainWrapper;
-
-import org.jclouds.rest.ApiContext;
-
-import com.abiquo.server.core.infrastructure.LogicServerDto;
-import com.abiquo.server.core.infrastructure.LogicServerPolicyDto;
-
-/**
- * Adds high level functionality to {@link LogicServerDto}.
- * 
- * @author Ignasi Barrera
- * @author Francesc Montserrat
- * @see API: <a href="http://community.abiquo.com/display/ABI20/Rack+Resource">
- *      http://community.abiquo.com/display/ABI20/Rack+Resource</a>
- */
-public class LogicServer extends DomainWrapper<LogicServerDto> {
-   /**
-    * Constructor to be used only by the builder.
-    */
-   protected LogicServer(final ApiContext<AbiquoApi> context, final LogicServerDto target) {
-      super(context, target);
-   }
-
-   // Delegate Methods
-
-   public String getName() {
-      return target.getName();
-   }
-
-   public void setType(final String value) {
-      target.setType(value);
-   }
-
-   public String getAssociated() {
-      return target.getAssociated();
-   }
-
-   public String getType() {
-      return target.getType();
-   }
-
-   public String getAssociatedTo() {
-      return target.getAssociatedTo();
-   }
-
-   public String getDescription() {
-      return target.getDescription();
-   }
-
-   public void setDescription(final String value) {
-      target.setDescription(value);
-   }
-
-   public List<LogicServerPolicyDto> getCollection() {
-      return target.getCollection();
-   }
-
-   @Override
-   public String toString() {
-      return "LogicServer [name=" + getName() + ", associated=" + getAssociated() + ", type=" + getType()
-            + ", associatedTo=" + getAssociatedTo() + ", description=" + getDescription() + "]";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/c5e108a8/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Machine.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Machine.java b/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Machine.java
index 3b7b0ad..dd851a8 100644
--- a/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Machine.java
+++ b/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/Machine.java
@@ -17,17 +17,14 @@
 package org.jclouds.abiquo.domain.infrastructure;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.find;
 
 import java.util.List;
 
 import org.jclouds.abiquo.AbiquoApi;
+import org.jclouds.abiquo.domain.DomainWrapper;
 import org.jclouds.abiquo.domain.cloud.VirtualMachine;
 import org.jclouds.abiquo.domain.enterprise.Enterprise;
 import org.jclouds.abiquo.domain.infrastructure.options.MachineOptions;
-import org.jclouds.abiquo.predicates.infrastructure.DatastorePredicates;
-import org.jclouds.abiquo.predicates.infrastructure.NetworkInterfacePredicates;
 import org.jclouds.abiquo.reference.ValidationErrors;
 import org.jclouds.abiquo.reference.rest.ParentLinkName;
 import org.jclouds.http.HttpResponse;
@@ -35,6 +32,7 @@ import org.jclouds.http.functions.ParseXMLWithJAXB;
 import org.jclouds.rest.ApiContext;
 
 import com.abiquo.model.enumerator.HypervisorType;
+import com.abiquo.model.enumerator.MachineIpmiState;
 import com.abiquo.model.enumerator.MachineState;
 import com.abiquo.model.rest.RESTLink;
 import com.abiquo.server.core.cloud.VirtualMachineWithNodeExtendedDto;
@@ -42,12 +40,10 @@ import com.abiquo.server.core.cloud.VirtualMachinesWithNodeExtendedDto;
 import com.abiquo.server.core.enterprise.EnterpriseDto;
 import com.abiquo.server.core.infrastructure.DatastoresDto;
 import com.abiquo.server.core.infrastructure.MachineDto;
+import com.abiquo.server.core.infrastructure.MachineIpmiStateDto;
 import com.abiquo.server.core.infrastructure.MachineStateDto;
 import com.abiquo.server.core.infrastructure.RackDto;
 import com.abiquo.server.core.infrastructure.network.NetworkInterfacesDto;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
 import com.google.inject.TypeLiteral;
 
 /**
@@ -60,7 +56,13 @@ import com.google.inject.TypeLiteral;
  *      href="http://community.abiquo.com/display/ABI20/MachineResource">
  *      http://community.abiquo.com/display/ABI20/MachineResource</a>
  */
-public class Machine extends AbstractPhysicalMachine {
+public class Machine extends DomainWrapper<MachineDto> {
+   /** The default virtual ram used in MB. */
+   protected static final int DEFAULT_VRAM_USED = 1;
+
+   /** The default virtual cpu used in MB. */
+   protected static final int DEFAULT_VCPU_USED = 1;
+
    /** The rack where the machine belongs. */
    protected Rack rack;
 
@@ -91,7 +93,15 @@ public class Machine extends AbstractPhysicalMachine {
       target = context.getApi().getInfrastructureApi().createMachine(rack.unwrap(), target);
    }
 
-   @Override
+   public void delete() {
+      context.getApi().getInfrastructureApi().deleteMachine(target);
+      target = null;
+   }
+
+   public void update() {
+      target = context.getApi().getInfrastructureApi().updateMachine(target);
+   }
+
    public MachineState check() {
       MachineStateDto dto = context.getApi().getInfrastructureApi().checkMachineState(target, true);
       MachineState state = dto.getState();
@@ -99,6 +109,11 @@ public class Machine extends AbstractPhysicalMachine {
       return state;
    }
 
+   public MachineIpmiState checkIpmi() {
+      MachineIpmiStateDto dto = context.getApi().getInfrastructureApi().checkMachineIpmiState(target);
+      return dto.getState();
+   }
+
    // Parent access
    /**
     * Retrieve the unmanaged rack where the machine is.
@@ -123,26 +138,14 @@ public class Machine extends AbstractPhysicalMachine {
 
    // Children access
 
-   @Override
    public List<Datastore> getDatastores() {
       return wrap(context, Datastore.class, target.getDatastores().getCollection());
    }
 
-   @Override
-   public Datastore findDatastore(final String name) {
-      return find(getDatastores(), DatastorePredicates.name(name), null);
-   }
-
-   @Override
    public List<NetworkInterface> getNetworkInterfaces() {
       return wrap(context, NetworkInterface.class, target.getNetworkInterfaces().getCollection());
    }
 
-   @Override
-   public NetworkInterface findNetworkInterface(final String name) {
-      return find(getNetworkInterfaces(), NetworkInterfacePredicates.name(name), null);
-   }
-
    /**
     * Gets the list of virtual machines in the physical machine.
     * 
@@ -160,30 +163,10 @@ public class Machine extends AbstractPhysicalMachine {
       return wrap(context, VirtualMachine.class, vms.getCollection());
    }
 
-   /**
-    * Gets the list of virtual machines in the physical machine matching the
-    * given filter.
-    * 
-    * @param filter
-    *           The filter to apply.
-    * @return The list of virtual machines in the physical machine matching the
-    *         given filter.
-    */
-   public List<VirtualMachine> listVirtualMachines(final Predicate<VirtualMachine> filter) {
-      return ImmutableList.copyOf(filter(listVirtualMachines(), filter));
-   }
-
-   /**
-    * Gets a single virtual machine in the physical machine matching the given
-    * filter.
-    * 
-    * @param filter
-    *           The filter to apply.
-    * @return The virtual machine or <code>null</code> if none matched the given
-    *         filter.
-    */
-   public VirtualMachine findVirtualMachine(final Predicate<VirtualMachine> filter) {
-      return Iterables.getFirst(filter(listVirtualMachines(), filter), null);
+   public VirtualMachine getVirtualMachine(final Integer virtualMachineId) {
+      VirtualMachineWithNodeExtendedDto vm = context.getApi().getInfrastructureApi()
+            .getVirtualMachine(target, virtualMachineId);
+      return wrap(context, VirtualMachine.class, vm);
    }
 
    /**
@@ -205,34 +188,6 @@ public class Machine extends AbstractPhysicalMachine {
    }
 
    /**
-    * Gets the list of virtual machines in the physical machine matching the
-    * given filter synchronizing virtual machines from remote hypervisor with
-    * abiquo's database.
-    * 
-    * @param filter
-    *           The filter to apply.
-    * @return The list of remote virtual machines in the physical machine
-    *         matching the given filter.
-    */
-   public List<VirtualMachine> listRemoteVirtualMachines(final Predicate<VirtualMachine> filter) {
-      return ImmutableList.copyOf(filter(listVirtualMachines(), filter));
-   }
-
-   /**
-    * Gets a single virtual machine in the physical machine matching the given
-    * filter synchronizing virtual machines from remote hypervisor with abiquo's
-    * database.
-    * 
-    * @param filter
-    *           The filter to apply.
-    * @return The virtual machine or <code>null</code> if none matched the given
-    *         filter.
-    */
-   public VirtualMachine findRemoteVirtualMachine(final Predicate<VirtualMachine> filter) {
-      return Iterables.getFirst(filter(listVirtualMachines(), filter), null);
-   }
-
-   /**
     * Reserve the machine for the given enterprise.
     * <p>
     * When a {@link Machine} is reserved for an {@link Enterprise}, only the
@@ -508,14 +463,165 @@ public class Machine extends AbstractPhysicalMachine {
 
    // Delegate methods
 
+   public Integer getId() {
+      return target.getId();
+   }
+
+   public String getIp() {
+      return target.getIp();
+   }
+
+   public String getIpmiIp() {
+      return target.getIpmiIP();
+   }
+
+   public String getIpmiPassword() {
+      return target.getIpmiPassword();
+   }
+
+   public Integer getIpmiPort() {
+      return target.getIpmiPort();
+   }
+
+   public String getIpmiUser() {
+      return target.getIpmiUser();
+   }
+
+   public String getIpService() {
+      return target.getIpService();
+   }
+
+   public String getName() {
+      return target.getName();
+   }
+
+   public String getPassword() {
+      return target.getPassword();
+   }
+
+   public Integer getPort() {
+      return target.getPort();
+   }
+
+   public MachineState getState() {
+      return target.getState();
+   }
+
+   public HypervisorType getType() {
+      return target.getType();
+   }
+
+   public String getUser() {
+      return target.getUser();
+   }
+
+   public Integer getVirtualCpuCores() {
+      return target.getVirtualCpuCores();
+   }
+
+   public Integer getVirtualCpusUsed() {
+      return target.getVirtualCpusUsed();
+   }
+
+   public Integer getVirtualRamInMb() {
+      return target.getVirtualRamInMb();
+   }
+
+   public Integer getVirtualRamUsedInMb() {
+      return target.getVirtualRamUsedInMb();
+   }
+
+   public void setDatastores(final List<Datastore> datastores) {
+      DatastoresDto datastoresDto = new DatastoresDto();
+      datastoresDto.getCollection().addAll(DomainWrapper.unwrap(datastores));
+      target.setDatastores(datastoresDto);
+   }
+
+   public void setDescription(final String description) {
+      target.setDescription(description);
+   }
+
+   public void setIp(final String ip) {
+      target.setIp(ip);
+   }
+
+   public void setIpmiIp(final String ipmiIp) {
+      target.setIpmiIP(ipmiIp);
+   }
+
+   public void setIpmiPassword(final String ipmiPassword) {
+      target.setIpmiPassword(ipmiPassword);
+   }
+
+   public void setIpmiPort(final Integer ipmiPort) {
+      target.setIpmiPort(ipmiPort);
+   }
+
+   public void setIpmiUser(final String ipmiUser) {
+      target.setIpmiUser(ipmiUser);
+   }
+
+   public void setIpService(final String ipService) {
+      target.setIpService(ipService);
+   }
+
+   public void setName(final String name) {
+      target.setName(name);
+   }
+
+   public void setPassword(final String password) {
+      target.setPassword(password);
+   }
+
+   public void setPort(final Integer port) {
+      target.setPort(port);
+   }
+
+   public void setState(final MachineState state) {
+      target.setState(state);
+   }
+
+   public void setType(final HypervisorType type) {
+      target.setType(type);
+   }
+
+   public void setUser(final String user) {
+      target.setUser(user);
+   }
+
+   public void setVirtualCpuCores(final Integer virtualCpuCores) {
+      target.setVirtualCpuCores(virtualCpuCores);
+   }
+
+   public void setVirtualCpusUsed(final Integer virtualCpusUsed) {
+      target.setVirtualCpusUsed(virtualCpusUsed);
+   }
+
+   public void setVirtualRamInMb(final Integer virtualRamInMb) {
+      target.setVirtualRamInMb(virtualRamInMb);
+   }
+
+   public void setVirtualRamUsedInMb(final Integer virtualRamUsedInMb) {
+      target.setVirtualRamUsedInMb(virtualRamUsedInMb);
+   }
+
+   public String getDescription() {
+      return target.getDescription();
+   }
+
    public void setRack(final Rack rack) {
       this.rack = rack;
    }
 
-   public VirtualMachine getVirtualMachine(final Integer virtualMachineId) {
-      VirtualMachineWithNodeExtendedDto vm = context.getApi().getInfrastructureApi()
-            .getVirtualMachine(target, virtualMachineId);
-      return wrap(context, VirtualMachine.class, vm);
+   @Override
+   public String toString() {
+      return "Machine [id=" + getId() + ", ip=" + getIp() + ", ipmiIp=" + getIpmiIp() + ", ipmiPassword="
+            + getIpmiPassword() + ", ipmiPort=" + getIpmiPort() + ", ipmiUser=" + getIpmiUser() + ", ipService="
+            + getIpService() + ", name=" + getName() + ", password=" + getPassword() + ", port=" + getPort()
+            + ", state=" + getState() + ", type=" + getType() + ", user=" + getUser() + ", virtualCpuCores="
+            + getVirtualCpuCores() + ", virtualCpusUsed=" + getVirtualCpusUsed() + ", getVirtualRamInMb()="
+            + getVirtualRamInMb() + ", virtualRamUsedInMb=" + getVirtualRamUsedInMb() + ", description="
+            + getDescription() + "]";
    }
 
 }