Package io.fabric8.api

Examples of io.fabric8.api.SshConfiguration


        }
        ContainersNode containersNode = fabric.getContainersNode();
        if (containersNode != null) {
          List<Container> selectedContainers = getSelectedContainers();
          if (!selectedContainers.isEmpty()) {
            Container container = selectedContainers.get(0);
            ContainerNode containerNode = containersNode
                .getContainerNode(container.getId());
            if (containerNode != null) {
              Selections.setSingleSelection(
                  fabric.getRefreshableUI(), containerNode);
            }
          }
View Full Code Here


    IStructuredSelection selection = getSelection();
    if (selection != null) {
      boolean changed = false;
      Iterator iterator = selection.iterator();
      while (iterator.hasNext()) {
        Container container = ContainerNode
            .toContainer(iterator.next());
        if (container != null) {
          containers.add(container);
        }
      }
View Full Code Here

          public boolean apply(Container container) {
            return container != null && container.isRoot();
          }
        }));
    if (rootContainers.size() == 1 && fabric != null) {
      Container rootContainer = rootContainers.get(0);
      ContainersNode containersNode = fabric.getContainersNode();
      if (containersNode != null) {
        return containersNode.getContainerNode(rootContainer.getId());
      }
    }
    return null;
  }
View Full Code Here

    }
    return null;
  }

  public boolean matches(ProfileNode profile) {
    Container ag = getContainer();
    Profile[] profiles = ag.getProfiles();
    for (Profile prof : profiles) {
      if (Objects.equal(prof.getId(), profile.getId())) {
        if (Objects.equal(ag.getVersionId(), profile.getVersion())) {
          return true;
        }
      }
    }
    return false;
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

    public static void assertMaximumContainerCountNotExceeded(FabricRequirements requirements, Map<String, CountingMap> hostToProfileCounts) {
        for (Map.Entry<String, CountingMap> entry : hostToProfileCounts.entrySet()) {
            String hostName = entry.getKey();
            CountingMap counts = entry.getValue();
            int total = counts.total();
            SshConfiguration sshConfiguration = requirements.getSshConfiguration();
            assertNotNull("Should have a sshConfiguration!", sshConfiguration);
            SshHostConfiguration hostConfiguration = sshConfiguration.getHost(hostName);
            assertNotNull("Should have a hosts configuration for host " + hostName, hostConfiguration);
            Integer maximumContainerCount = hostConfiguration.getMaximumContainerCount();
            if (maximumContainerCount != null) {
                assertTrue("Host " + hostName + " has a maximum container count of " + maximumContainerCount + " but was " + total, total <= maximumContainerCount);
            }
View Full Code Here

        /**
         * Configures the builder from the requirements and chosen host configuration
         */
        public void configure(SshHostConfiguration sshHostConfig, FabricRequirements requirements, ProfileRequirements profileRequirements) {
            SshConfiguration sshHosts = requirements.getSshConfiguration();
            host = sshHostConfig.getHostName();
            if (Strings.isNullOrBlank(host)) {
                throw new IllegalArgumentException("Missing host property in the ssh configuration: " + sshHostConfig);
            }
            String preferredAddress = getPreferredAddress();
            if (Strings.isNullOrBlank(preferredAddress)) {
                preferredAddress = sshHostConfig.getPreferredAddress();
                if (Strings.isNullOrBlank(preferredAddress)) {
                    preferredAddress = host;
                }
                preferredAddress(preferredAddress);
            }
            path = sshHostConfig.getPath();
            if (Strings.isNullOrBlank(path)) {
                if (sshHosts != null) {
                    path = sshHosts.getDefaultPath();
                }
                if (Strings.isNullOrBlank(path)) {
                    path = DEFAULT_PATH;
                }
            }
            Integer portValue = sshHostConfig.getPort();
            if (portValue == null) {
                if (sshHosts != null) {
                    portValue = sshHosts.getDefaultPort();
                }
            }
            port = portValue != null ? portValue : DEFAULT_SSH_PORT;

            username = sshHostConfig.getUsername();
            if (Strings.isNullOrBlank(username)) {
                if (sshHosts != null) {
                    username = sshHosts.getDefaultUsername();
                }
                if (Strings.isNullOrBlank(username)) {
                    username = DEFAULT_USERNAME;
                }
            }

            password = sshHostConfig.getPassword();
            if (Strings.isNullOrBlank(password)) {
                if (sshHosts != null) {
                    password = sshHosts.getDefaultPassword();
                }
            }

            if (sshHosts != null) {
                fallbackRepositories = sshHosts.getFallbackRepositories();
            }

            passPhrase = sshHostConfig.getPassPhrase();
            if (Strings.isNullOrBlank(passPhrase)) {
                if (sshHosts != null) {
                    passPhrase = sshHosts.getDefaultPassPhrase();
                }
            }

            privateKeyFile = sshHostConfig.getPrivateKeyFile();
            if (Strings.isNullOrBlank(privateKeyFile)) {
                if (sshHosts != null) {
                    privateKeyFile = sshHosts.getDefaultPrivateKeyFile();
                }
                if (Strings.isNullOrBlank(privateKeyFile)) {
                    privateKeyFile = DEFAULT_PRIVATE_KEY_FILE;
                }
            }
View Full Code Here

TOP

Related Classes of io.fabric8.api.SshConfiguration

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.