Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.ComputeMetadata


    * {@inheritDoc}
    */
   @Override
   public int compareTo(ResourceMetadata<ComputeType> that) {
      if (that instanceof ComputeMetadata) {
         ComputeMetadata thatMetadata = ComputeMetadata.class.cast(that);
         return start()
                 .compare(this.getId(), thatMetadata.getId())
                 .compare(this.getType(), thatMetadata.getType())
                 .compare(this.getName(), that.getName(), natural().nullsLast())
                 .result();
      } else {
         return super.compareTo(that);
      }
View Full Code Here


    * {@inheritDoc}
    */
   @Override
   public int compareTo(ResourceMetadata<ComputeType> that) {
      if (that instanceof ComputeMetadata) {
         ComputeMetadata thatMetadata = ComputeMetadata.class.cast(that);
         return start()
                 .compare(this.getId(), thatMetadata.getId())
                 .compare(this.getType(), thatMetadata.getType())
                 .compare(this.getName(), that.getName(), natural().nullsLast())
                 .result();
      } else {
         return super.compareTo(that);
      }
View Full Code Here

    public static Location asLocation(Object element) {
        if (element instanceof Location ) {
            return (Location) element;
        }
        ComputeMetadata value = asComputeMetadata(element);
        if (value != null) {
            return value.getLocation();
        }
        return null;
    }
View Full Code Here

    int column = 0;

    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        ComputeMetadata value = JClouds.asComputeMetadata(element);
        if (value != null) {
          return value.getId();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Id");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ComputeMetadata value = JClouds.asComputeMetadata(element);
        if (value != null) {
          return value.getName();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Name");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return value.getStatus();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "State");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          Hardware hardware = value.getHardware();
          if (hardware != null) {
            return JClouds.text(hardware);
          }
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Hardware");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return value.getImageId();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Image");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          OperatingSystem operatingSystem = value.getOperatingSystem();
          if (operatingSystem != null) {
            return JClouds.text(operatingSystem);
          }
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "OS");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return value.getGroup();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Group");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return joinSpaces(value.getPublicAddresses());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Public IPs");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return joinSpaces(value.getPrivateAddresses());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Private IPs");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        Location value = JClouds.asLocation(element);
        if (value != null) {
          return value.getDescription();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Location");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ComputeMetadata value = JClouds.asComputeMetadata(element);
        if (value != null) {
          return value.getUri();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "URI");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ComputeMetadata value = JClouds.asComputeMetadata(element);
        if (value != null) {
          return joinSpaces(value.getTags());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Tags");
View Full Code Here

  public List<ComputeMetadata> getSelectedNodes() {
    List<Object> list = Selections.getSelectionList(getViewer());
    List<ComputeMetadata> answer = new ArrayList<ComputeMetadata>();
    for (Object object: list) {
      ComputeMetadata metadata = JClouds.asComputeMetadata(object);
      if (metadata != null) {
        answer.add(metadata);
      }
    }
    return answer;
View Full Code Here

  }
   */


  protected void selectionUpdated() {
    ComputeMetadata n = getSelectedNode();
    boolean selected = n != null;

    List<ComputeMetadata> selectedNodes = getSelectedNodes();
    if (!getNodes().isEmpty()) {
      Set<String> idSet = new HashSet<String>();
View Full Code Here

    // lets restore the selection
    if (selectedIds != null) {
      List<Object> selected = new ArrayList<Object>();
      WritableList nodes = getNodes();
      for (Object object : nodes) {
        ComputeMetadata md = JClouds.asComputeMetadata(object);
        if (md != null) {
          String id = md.getId();
          if (selectedIds.contains(id)) {
            selected.add(object);
          }
        }
      }
View Full Code Here

  }

  protected void openTerminal() {
    String id = getClass().getName();

    ComputeMetadata computeNode = getSelectedNode();
    NodeMetadata node;
    if (computeNode instanceof NodeMetadata) {
      node = (NodeMetadata) computeNode;
    } else return;
View Full Code Here

    * {@inheritDoc}
    */
   @Override
   public int compareTo(ResourceMetadata<ComputeType> that) {
      if (that instanceof ComputeMetadata) {
         ComputeMetadata thatMetadata = ComputeMetadata.class.cast(that);
         return start()
                 .compare(this.getId(), thatMetadata.getId())
                 .compare(this.getType(), thatMetadata.getType())
                 .compare(this.getName(), that.getName(), natural().nullsLast())
                 .result();
      } else {
         return super.compareTo(that);
      }
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.ComputeMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.