Package io.fabric8.api

Examples of io.fabric8.api.Version


  @Override
  public void update(ViewerCell cell) {
    Object element = cell.getElement();
    ContainerViewBean bean = ContainerViewBean.toContainerViewBean(element);
    if (bean != null) {
      Container container = bean.container();
      boolean managed = container.isManaged();
      String image = "yellow-dot.png";
      String status = bean.getStatus();
      Fabric8JMXPlugin.getLogger().debug(
          "Container: " + container.getId() + " alive: "
              + container.isAlive() + " managed: "
              + container.isManaged() + " pending: "
              + container.isProvisioningPending() + " complete: "
              + container.isProvisioningComplete() + " status: "
              + container.getProvisionStatus());
      if (!bean.isAlive()) {
        image = "gray-dot.png";
      }
      if (container.isProvisioningPending()) {
        // image = "pending.gif";
        image = "yellow-dot.png";
        managed = true;
      } else if (status != null) {
        String lowerStatus = status.toLowerCase();
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

        } else {
            IllegalStateAssertion.assertTrue(profileService.hasVersion(parentVersion), "Cannot find parent version: " + parentVersion);
            sourceId = parentVersion;
        }
       
        Version targetVersion;
        if (sourceId != null) {
            Map<String, String> attributes = description != null ? Collections.singletonMap(Version.DESCRIPTION, description) : null;
            targetVersion = profileService.createVersionFrom(sourceId, versionId, attributes);
            System.out.println("Created version: " + versionId + " as copy of: " + sourceId);
        } else {
            VersionBuilder builder = VersionBuilder.Factory.create(versionId);
            if (description != null) {
                builder.addAttribute(Version.DESCRIPTION, description);
            }
            targetVersion = profileService.createVersion(builder.getVersion());
            System.out.println("Create version: " + versionId);
        }
       
        if (defaultVersion == Boolean.TRUE) {
            fabricService.setDefaultVersionId(targetVersion.getId());
        }

        return null;
    }
View Full Code Here

            Map<String, String> configOverlay = new HashMap<>();
            Map<String, String> ports = null;
            Map<String, String> dockerProviderConfig = new HashMap<>();

            List<Profile> profileOverlays = new ArrayList<>();
            Version version = null;
            if (profileIds != null && versionId != null) {
                ProfileService profileService = service.adapt(ProfileService.class);
                version = profileService.getVersion(versionId);
                if (version != null) {
                    for (String profileId : profileIds) {
                        Profile profile = version.getRequiredProfile(profileId);
                        if (profile != null) {
                            Profile overlay = profileService.getOverlayProfile(profile);
                            profileOverlays.add(overlay);
                            Map<String, String> dockerConfig = overlay.getConfiguration(DockerConstants.DOCKER_PROVIDER_PID);
                            if (dockerConfig != null) {
                                configOverlay.putAll(dockerConfig);
                            }
                            if (ports == null || ports.size() == 0) {
                                ports = overlay.getConfiguration(Constants.PORTS_PID);
                            }
                        }
                    }
                    if (version.hasProfile(DockerConstants.DOCKER_PROVIDER_PROFILE_ID)) {
                        Profile profile = version.getRequiredProfile(DockerConstants.DOCKER_PROVIDER_PROFILE_ID);
                        if (profile != null) {
                            Profile overlay = profileService.getOverlayProfile(profile);
                            Map<String, String> dockerConfig = overlay.getConfiguration(DockerConstants.DOCKER_PROVIDER_PID);
                            if (dockerConfig != null) {
                                dockerProviderConfig.putAll(dockerConfig);
                            }
                        }
                    }
                }
            }
            if (ports == null || ports.size() == 0) {
                // lets find the defaults from the docker profile
                if (version == null) {
                    version = service.getRequiredDefaultVersion();
                }
                Profile dockerProfile = version.getRequiredProfile("docker");
                ports = dockerProfile.getConfiguration(Constants.PORTS_PID);
                if (ports == null || ports.size() == 0) {
                    LOG.warn("Could not a docker ports configuration for: " + Constants.PORTS_PID);
                    ports = new HashMap<String, String>();
                }
View Full Code Here

    @Override
    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            Version version = getFabricService().getRequiredDefaultVersion();
            Container container = getFabricService().getCurrentContainer();
            try{
                container =  getFabricService().getContainer(getContainer(CommandSessionHolder.getSession(), containerArgumentIndex));
            } catch (Exception ex) {
                // Ignore and use current container.
            }

            Profile[] containerProfiles = container.getProfiles();
            List<String> containerProfileNames = new LinkedList<String>();
            if (containerProfiles != null) {
                for (Profile p : containerProfiles) {
                    containerProfileNames.add(p.getId());
                }
            }

            List<Profile> profiles = version.getProfiles();
            List<String> allProfileNames = new LinkedList<String>();
            if (containerProfiles != null) {
                for (Profile p : profiles) {
                    allProfileNames.add(p.getId());
                }
View Full Code Here

        }
    }

    private void registerServlet(Container container, ServletEvent servletEvent) {
        String id = container.getId();
        Version version = container.getVersion();
        String versionId = version != null ? version.getId() : null;
        String url = "${zk:" + id + "/http}" + servletEvent.getAlias();
        String bundleName = servletEvent.getBundle().getSymbolicName();
        String bundleVersion = servletEvent.getBundle().getVersion().toString();

        String name = servletEvent.getBundle().getSymbolicName();
View Full Code Here

        String bundleName = webEvent.getBundle().getSymbolicName();
        String bundleVersion = webEvent.getBundle().getVersion().toString();
        setJolokiaUrl(container, url, bundleName);

        Version version = container.getVersion();
        String versionId = version != null ? version.getId() : null;

        String json = "{\"id\":" + jsonEncodeString(id) +
                ",\"services\":[" + jsonEncodeString(url) + "]" +
                ",\"version\":" + JsonHelper.jsonEncodeString(versionId) +
                ",\"bundleName\":" + jsonEncodeString(bundleName) +
View Full Code Here

        Set<String> profiles = options.getProfiles();
        String versionId = options.getVersion();
        Map<String, String> openshiftConfigOverlay = new HashMap<String, String>();
        if (profiles != null && versionId != null) {
            ProfileService profileService = fabricService.get().adapt(ProfileService.class);
            Version version = profileService.getVersion(versionId);
            if (version != null) {
                for (String profileId : profiles) {
                    Profile profile = version.getRequiredProfile(profileId);
                    if (profile != null) {
                        Profile overlay = profileService.getOverlayProfile(profile);
                        Map<String, String> openshiftConfig = overlay.getConfiguration(OpenShiftConstants.OPENSHIFT_PID);
                        if (openshiftConfig != null)  {
                            openshiftConfigOverlay.putAll(openshiftConfig);
View Full Code Here

TOP

Related Classes of io.fabric8.api.Version

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.