Package io.fabric8.api

Examples of io.fabric8.api.DataStore


        }
        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

                LOGGER.info("OpenShiftDeployAgent is the master");
            } else {
                LOGGER.info("OpenShiftDeployAgent is not the master");
            }
            try {
                DataStore dataStore = null;
                if (fabricService != null) {
                    dataStore = fabricService.get().adapt(DataStore.class);
                } else {
                    LOGGER.warn("No fabricService yet!");
                }
                if (group.isMaster()) {
                    ControllerNode state = createState();
                    group.update(state);
                }
                if (dataStore != null) {
                    if (group.isMaster()) {
                        dataStore.trackConfiguration(runnable);
                        onConfigurationChanged();
                    } else {
                        dataStore.untrackConfiguration(runnable);
                    }
                }
            } catch (IllegalStateException e) {
                // Ignore
            }
View Full Code Here

                checkProcessesStatus();
            }
        };
        keepAliveTimer.schedule(timerTask, monitorPollTime, monitorPollTime);

        DataStore dataStore = fabricService.get().adapt(DataStore.class);
        dataStore.trackConfiguration(configurationChangeHandler);
    }
View Full Code Here

    @Deactivate
    void deactivate() {
        if (zkMasterCache != null) {
            zkMasterCache = null;
        }
        DataStore dataStore = fabricService.get().adapt(DataStore.class);
        dataStore.untrackConfiguration(configurationChangeHandler);
        if (keepAliveTimer != null) {
            keepAliveTimer.cancel();
            keepAliveTimer = null;
        }
        deactivateComponent();
View Full Code Here

        group = null;
    }

    @Override
    public void groupEvent(Group<AutoScalerNode> group, GroupEvent event) {
        DataStore dataStore = fabricService.get().adapt(DataStore.class);
        switch (event) {
            case CONNECTED:
            case CHANGED:
                if (isValid()) {
                    AutoScalerNode state = createState();
                    try {
                        if (group.isMaster()) {
                            enableMasterZkCache(curator.get());
                            LOGGER.info("AutoScaleController is the master");
                            group.update(state);
                            dataStore.trackConfiguration(runnable);
                            enableTimer();
                            onConfigurationChanged();
                        } else {
                            LOGGER.info("AutoScaleController is not the master");
                            group.update(state);
                            disableTimer();
                            dataStore.untrackConfiguration(runnable);
                            disableMasterZkCache();
                        }
                    } catch (IllegalStateException e) {
                        // Ignore
                    }
                } else {
                    LOGGER.info("Not valid with master: " + group.isMaster()
                            + " fabric: " + fabricService.get()
                            + " curator: " + curator.get());
                }
                break;
            case DISCONNECTED:
                dataStore.untrackConfiguration(runnable);
        }
    }
View Full Code Here

        if (options.getManualIp() != null && !options.getManualIp().isEmpty()) {
            jvmOptsBuilder.append(" -D" + ZkDefs.MANUAL_IP + "=" + options.getManualIp());
        }

        DataStore dataStore = fabricService.get().adapt(DataStore.class);
        ProfileService profileService = fabricService.get().adapt(ProfileService.class);

        for (Map.Entry<String, String> dataStoreEntries : options.getDataStoreProperties().entrySet()) {
            String key = dataStoreEntries.getKey();
            String value = dataStoreEntries.getValue();
            jvmOptsBuilder.append(" -D" + Constants.DATASTORE_PID + "." + key + "=" + value);
        }

        Profile profile = parent.getVersion().getRequiredProfile("default");
        Profile effectiveProfile = Profiles.getEffectiveProfile(fabricService.get(), profileService.getOverlayProfile(profile));
        String featuresUrls = collectionAsString(effectiveProfile.getRepositories());
        Set<String> features = new LinkedHashSet<String>();

        features.add("fabric-core");
        //features.addAll(defaultProfile.getFeatures());
        String containerName = options.getName();

        PortService portService = fabricService.get().getPortService();
        Set<Integer> usedPorts = portService.findUsedPortByHost(parent);

        CreateChildContainerMetadata metadata = new CreateChildContainerMetadata();

        metadata.setCreateOptions(options);
        metadata.setContainerName(containerName);
        int minimumPort = parent.getMinimumPort();
        int maximumPort = parent.getMaximumPort();

        dataStore.setContainerAttribute(containerName, DataStore.ContainerAttribute.PortMin, String.valueOf(minimumPort));
        dataStore.setContainerAttribute(containerName, DataStore.ContainerAttribute.PortMax, String.valueOf(maximumPort));
        inheritAddresses(fabricService.get(), parent.getId(), containerName, options);

        //We are creating a container instance, just for the needs of port registration.
        Container child = new ContainerImpl(parent, containerName, fabricService.get()) {
            @Override
View Full Code Here

TOP

Related Classes of io.fabric8.api.DataStore

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.