Package io.fabric8.api

Examples of io.fabric8.api.CreateContainerOptions


    public String containerCreateOptionsType(String id) {
        CreateContainerMetadata<?> metadata = getContainerMetaData(id);
        if (metadata == null) {
            return null;
        }
        CreateContainerOptions options = metadata.getCreateOptions();
        if (options == null) {
            return null;
        } else {
            return options.getClass().getName();
        }
    }
View Full Code Here


    public void changeCreateOptionsField(String containerId, String field, Object value) {
        CreateContainerMetadata<? extends CreateContainerOptions> metadata = getContainerMetaData(containerId);
        if (metadata == null) {
            return;
        }
        CreateContainerOptions options = metadata.getCreateOptions();
        if (options == null) {
            return;
        }

        ObjectMapper mapper = getObjectMapper();
        JsonNode optionsJson = mapper.convertValue(options, JsonNode.class);
        JsonNode valueJson = mapper.convertValue(value, JsonNode.class);
        ((ObjectNode) optionsJson).put(field, valueJson);

        Object builder = null;

        try {
            builder = options.getClass().getMethod("builder").invoke(null);
        } catch (Exception e) {
            LOG.warn("Failed to get builder when setting " + field + " on container " + containerId, e);
            throw new RuntimeException("Failed to get builder when setting " + field + " on container " + containerId, e);
        }

        builder = mapper.convertValue(optionsJson, builder.getClass());

        CreateContainerOptions newOptions = null;
        try {
            newOptions = (CreateContainerOptions) builder.getClass().getMethod("build").invoke(builder);
        } catch (Exception e) {
            LOG.warn("Failed to build CreatecontainerOptions when setting " + field + " on container " + containerId, e);
            throw new RuntimeException("Failed to build CreatecontainerOptions when setting " + field + " on container " + containerId, e);
View Full Code Here

        }
        return null;
    }

    private Container createChild(String name) throws URISyntaxException {
        CreateContainerOptions options = CreateChildContainerOptions.builder()
                .name(name)
                .parent(fabricService.getCurrentContainer().getId()).build();
        CreateContainerMetadata[] metadatas = fabricService.createContainers(options);
        Container container = metadatas[0].getContainer();
        return container;
View Full Code Here

          CreateJCloudsContainerOptions opts = args.withUser(args.getUser(), args.getPassword(), "admin").build();

          FabricPlugin.getLogger().debug("Compute Service: " + opts.getComputeService());

          // finally create the image
          final CreateJCloudsContainerMetadata metadata = provider.create(opts, new CreationStateListener() {
            @Override
            public void onStateChange(String message) {
              monitor.subTask(message);
            }
          });
View Full Code Here

          }
        }
      });
      return (T) answerHolder[0];
    } catch (Exception e) {
      throw new FabricException(e);
    }

  }
View Full Code Here

    int bounds = 100;
    int column = 0;
    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getProfile();
        }
        return null;
      }
    };
    column = addColumnFunction(250, column, function, "Profile");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getCount();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Count");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getMinimumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Minumum");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getMaximumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Maximum");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return toHealth(status);
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Status",
        new HealthLabelProvider(function));
    function = new Function1() {
      @Override
      public Double apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getHealth(status.getCount());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Health",
        new PercentFunctionLabelProvider(function));
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getDependentProfiles();
        }
        return null;
      }
    };
    column = addColumnFunction(250, column, function, "Dependencies");
View Full Code Here

    int bounds = 100;
    int column = 0;
    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getProfile();
        }
        return null;
      }
    };
    column = addColumnFunction(250, column, function, "Profile");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getCount();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Count");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getMinimumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Minumum");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getMaximumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Maximum");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return toHealth(status);
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Status",
        new HealthLabelProvider(function));
    function = new Function1() {
      @Override
      public Double apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getHealth(status.getCount());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Health",
        new PercentFunctionLabelProvider(function));
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getDependentProfiles();
        }
        return null;
      }
    };
    column = addColumnFunction(250, column, function, "Dependencies");
View Full Code Here

  protected Set<String> getSelectedVersionNames() {
    Set<String> answer = new HashSet<String>();
    List<Container> containers = getSelectedContainers();
    for (Container container : containers) {
      Version version = container.getVersion();
      if (version != null) {
        String name = version.getId();
        if (name != null) {
          answer.add(name);
        }
      }
    }
View Full Code Here

  protected Set<String> getSelectedVersionNames() {
    Set<String> answer = new HashSet<String>();
    List<Container> containers = getSelectedContainers();
    for (Container container : containers) {
      Version version = container.getVersion();
      if (version != null) {
        String name = version.getId();
        if (name != null) {
          answer.add(name);
        }
      }
    }
View Full Code Here

  /* (non-Javadoc)
   * @see java.lang.Comparable#compareTo(java.lang.Object)
   */
  @Override
  public int compareTo(Version o) {
    return new VersionSequence(getId()).compareTo(new VersionSequence(o.getId()));
  }
View Full Code Here

TOP

Related Classes of io.fabric8.api.CreateContainerOptions

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.