Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to jclouds, Inc. (jclouds) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. jclouds 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.cloudsigma.domain;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 

Author(s):
Adrian Cole
 
 public class Server extends Item {
 
    public static class Builder extends Item.Builder {
       protected int cpu;
       protected Integer smp;
       protected int mem;
       protected boolean persistent;
       protected Map<String, ? extends Devicedevices = ImmutableMap.of();
       protected Set<StringbootDeviceIds = ImmutableSet.of();
       protected List<NICnics = ImmutableList.of();
       protected VNC vnc;
       // TODO cloudsigma specific
       protected String description;
 
       public Builder cpu(int cpu) {
          this. = cpu;
          return this;
       }
 
       public Builder smp(Integer smp) {
          this. = smp;
          return this;
       }
 
       public Builder mem(int mem) {
          this. = mem;
          return this;
       }
 
       public Builder persistent(boolean persistent) {
          this. = persistent;
          return this;
       }
 
       public Builder devices(Map<String, ? extends Devicedevices) {
          this. = ImmutableMap.copyOf(checkNotNull(devices"devices"));
          return this;
       }
 
       public Builder bootDeviceIds(Iterable<StringbootDeviceIds) {
          this. = ImmutableSet.copyOf(checkNotNull(bootDeviceIds"bootDeviceIds"));
          return this;
       }
 
       public Builder nics(Iterable<NICnics) {
          this. = ImmutableList.copyOf(checkNotNull(nics"nics"));
          return this;
       }
 
       public Builder vnc(VNC vnc) {
          this. = vnc;
          return this;
       }
 
       public Builder description(String description) {
          this. = description;
          return this;
       }

      
 
       @Override
      public Builder uuid(String uuid) {
         return Builder.class.cast(super.uuid(uuid));
      }

      
      @Override
      public Builder name(String name) {
         return Builder.class.cast(super.name(name));
      }

      
      @Override
      public Builder use(Iterable<Stringuse) {
         return Builder.class.cast(super.use(use));
      }
      public Server build() {
         return new Server();
      }
      public static Builder fromServer(Server in) {
         return new Builder().uuid(in.getUuid()).name(in.getName()).cpu(in.getCpu()).mem(in.getMem())
               .persistent(in.isPersistent()).description(in.getDescription()).devices(in.getDevices())
               .bootDeviceIds(in.getBootDeviceIds()).use(in.getUse()).nics(in.getNics()).vnc(in.getVnc());
      }
   }
   protected final int cpu;
   protected final Integer smp;
   protected final int mem;
   protected final boolean persistent;
   protected final Map<StringDevicedevices;
   protected final Set<StringbootDeviceIds;
   protected final List<NICnics;
   protected final VNC vnc;
   private final String description;
   public Server(@Nullable String uuidString nameint cpu, @Nullable Integer smpint memboolean persistent,
         Map<String, ? extends DevicedevicesIterable<StringbootDeviceIdsIterable<Stringuse,
         Iterable<NICnicsVNC vncString description) {
      super(uuidnameuse);
      this. = cpu;
      this. = smp;
      this. = mem;
      this. = persistent;
      this. = ImmutableMap.copyOf(checkNotNull(devices"devices"));
      this. = ImmutableSet.copyOf(checkNotNull(bootDeviceIds"bootDeviceIds"));
      this. = ImmutableList.copyOf(checkNotNull(nics"nics"));
      this. = checkNotNull(vnc"vnc");
      this. = description;
   }

   

Returns:
CPU quota in core MHz.
   public int getCpu() {
      return ;
   }

   

Returns:
number of virtual processors or null if calculated based on cpu.
   public Integer getSmp() {
      return ;
   }

   

Returns:
virtual memory size in MB.
   public int getMem() {
      return ;
   }

   

Returns:
'true' means that server will revert to a 'stopped' status on server stop or shutdown, rather than being destroyed automatically.
   public boolean isPersistent() {
      return ;
   }

   

Returns:
devices present, mapped by id
   public Map<StringDevicegetDevices() {
      return ;
   }

   

Returns:
ids of the devices to boot, e.g. ide:0:0 or ide:1:0
See also:
Device.getId()
   public Set<StringgetBootDeviceIds() {
      return ;
   }
   public List<NICgetNics() {
      return ;
   }
   public VNC getVnc() {
      return ;
   }
   // TODO undocumented
   public String getDescription() {
      return ;
   }
   public int hashCode() {
      final int prime = 31;
      int result = super.hashCode();
      result = prime * result + (( == null) ? 0 : .hashCode());
      result = prime * result + ;
      result = prime * result + (( == null) ? 0 : .hashCode());
      result = prime * result + (( == null) ? 0 : .hashCode());
      result = prime * result + ;
      result = prime * result + (( == null) ? 0 : .hashCode());
      result = prime * result + ( ? 1231 : 1237);
      result = prime * result + (( == null) ? 0 : .hashCode());
      result = prime * result + (( == null) ? 0 : .hashCode());
      return result;
   }
   public boolean equals(Object obj) {
      if (this == obj)
         return true;
      if (!super.equals(obj))
         return false;
      if (getClass() != obj.getClass())
         return false;
      Server other = (Serverobj;
      if ( == null) {
         if (other.bootDeviceIds != null)
            return false;
      } else if (!.equals(other.bootDeviceIds))
         return false;
      if ( != other.cpu)
         return false;
      if ( == null) {
         if (other.description != null)
            return false;
      } else if (!.equals(other.description))
         return false;
      if ( == null) {
         if (other.devices != null)
            return false;
      } else if (!.equals(other.devices))
         return false;
      if ( != other.mem)
         return false;
      if ( == null) {
         if (other.nics != null)
            return false;
      } else if (!.equals(other.nics))
         return false;
      if ( != other.persistent)
         return false;
      if ( == null) {
         if (other.smp != null)
            return false;
      } else if (!.equals(other.smp))
         return false;
      if ( == null) {
         if (other.vnc != null)
            return false;
      } else if (!.equals(other.vnc))
         return false;
      return true;
   }
   public String toString() {
      return "[uuid=" +  + ", name=" +  + ", use=" +  + ", cpu=" +  + ", smp=" +  + ", mem=" + 
            + ", persistent=" +  + ", devices=" +  + ", bootDeviceIds=" +  + ", nics="
            +  + ", vnc=" +  + ", description=" +  + "]";
   }
New to GrepCode? Check out our FAQ X