Package io.fabric8.tooling.archetype.generator

Examples of io.fabric8.tooling.archetype.generator.ArchetypeHelper


          FirewallManagerFactoryImpl firewallManagerFactory = new FirewallManagerFactoryImpl();
          firewallManagerFactory.activateComponent();
          Ec2FirewallSupport ec2fw = new Ec2FirewallSupport();
          ec2fw.activateComponent();
            firewallManagerFactory.bindFirewallSupport(ec2fw);
            NovaFirewallSupport novafw = new NovaFirewallSupport();
            novafw.activateComponent();
            firewallManagerFactory.bindFirewallSupport(novafw);
           
          // create and activate provider
          JcloudsContainerProvider provider = new JcloudsContainerProvider();
          provider.activateComponent();
View Full Code Here


    if( parentElement instanceof IConnectionWrapper ) {
      IConnectionWrapper w = (IConnectionWrapper)parentElement;
      Root r = w.getRoot();
      if( r != null ) {
        if (r.containsDomain("org.apache.servicemix")) {
          ServiceMixFacade facade = new JmxTemplateServiceMixFacade(new JmxPluginJmxTemplate(r.getConnection()));
          ServiceMixNode smx = new ServiceMixNode(r, facade);
          return new Object[]{smx};
        }
      }
    } else if (parentElement instanceof NodeSupport) {
View Full Code Here

public class ServiceMixNodeProvider implements NodeProvider {

  @Override
  public void provide(final Root root) {
    if (root.containsDomain("org.apache.servicemix")) {
      ServiceMixFacade facade = new JmxTemplateServiceMixFacade(new JmxPluginJmxTemplate(root.getConnection()));
      ServiceMixNode camel = new ServiceMixNode(root, facade);
      root.addChild(camel);
    }
  }
View Full Code Here

    if( parentElement instanceof IConnectionWrapper ) {
      IConnectionWrapper w = (IConnectionWrapper)parentElement;
      Root r = w.getRoot();
      if( r != null ) {
        if (r.containsDomain("org.apache.servicemix")) {
          ServiceMixFacade facade = new JmxTemplateServiceMixFacade(new JmxPluginJmxTemplate(r.getConnection()));
          ServiceMixNode smx = new ServiceMixNode(r, facade);
          return new Object[]{smx};
        }
      }
    } else if (parentElement instanceof NodeSupport) {
View Full Code Here

public class ServiceMixNodeProvider implements NodeProvider {

  @Override
  public void provide(final Root root) {
    if (root.containsDomain("org.apache.servicemix")) {
      ServiceMixFacade facade = new JmxTemplateServiceMixFacade(new JmxPluginJmxTemplate(root.getConnection()));
      ServiceMixNode camel = new ServiceMixNode(root, facade);
      root.addChild(camel);
    }
  }
View Full Code Here

        name = isNullOrBlank(name) ? null : name;
        description = isNullOrBlank(description) ? null : description;

        File childDir = new File(target, directory);

        ArchetypeHelper helper = new ArchetypeHelper(archetypeFile, childDir, groupId, artifactId, version, name, description);
        helper.setPackageName(packageName);

        Map<String, String> properties = helper.parseProperties();

        // if we have fabric8.profile as a property then lets configured it now, as its mandatory
        // and use artifactId as its default suggested value
        String profile = null;
        if (properties.containsKey("fabric8-profile")) {
            profile = properties.remove("fabric8-profile");
            String defaultProfile = isNullOrBlank(profile) ? artifactId : profile;
            String p = ShellUtils.readLine(session, String.format("Define value for property 'fabric8.profile' (%s): ", defaultProfile), false);
            profile = isNullOrBlank(p) ? defaultProfile : p;
        }

        // show additional properties and ask to use them as-is
        boolean mustChoose = false;
        if (!properties.isEmpty()) {

            // check if we must choose if there is an empty value or a value that has a ${ } token so we dont have a default value
            for (String value : properties.values()) {
                if (isNullOrBlank(value) || value.contains("$")) {
                    mustChoose = true;
                    break;
                }
            }

            if (!mustChoose) {
                System.out.println("----- Additional properties -----");
                for (String key : properties.keySet()) {
                    System.out.println(String.format("Using property '%s' (%s): ", key, properties.get(key)));
                }
            }

            boolean choosing = true;
            while (mustChoose || choosing) {

                String confirm = null;
                if (!mustChoose) {
                    confirm = ShellUtils.readLine(session, "Confirm additional properties configuration: (Y): ", false);
                    confirm = isNullOrBlank(confirm) ? "Y" : confirm;
                }

                if (mustChoose || !"Y".equalsIgnoreCase(confirm)) {
                    // ask for replacement properties suggesting the defaults
                    if (!properties.isEmpty()) {
                        System.out.println("----- Configure additional properties -----");
                        for (String key : properties.keySet()) {
                            String value = properties.get(key);
                            // if the value is empty or a token, then do not show any default value
                            if (isNullOrBlank(value) || value.contains("$")) {
                                value = "";
                            }
                            String p = ShellUtils.readLine(session, String.format("Define value for property '%s' (%s): ", key, value), false);
                            p = isNullOrBlank(p) ? value : p;
                            properties.put(key, p);
                        }
                    }
                    mustChoose = false;
                } else {
                    choosing = false;
                }
            }
        }

        // remover to include the profile back into properties
        if (profile != null) {
            properties.put("fabric8-profile", profile);
        }

        if (!properties.isEmpty()) {
            // set override properties
            helper.setOverrideProperties(properties);
        }

        String confirm = ShellUtils.readLine(session, "Create project: (Y): ", false);
        confirm = confirm == null || confirm.trim().equals("") ? "Y" : confirm;

        if ("Y".equalsIgnoreCase(confirm)) {
            System.out.println("----------------------------------------------------------------------------");
            System.out.println(String.format("Creating project in directory: %s", childDir.getCanonicalPath()));
            helper.execute();
            System.out.println("Project created successfully");
            System.out.println("");
        } else {
            System.out.println("----------------------------------------------------------------------------");
            System.out.println("Creating project aborted!");
View Full Code Here

    @Override
    public Result execute(UIExecutionContext uiExecutionContext) throws Exception {
        Kubernetes kubernetes = getKubernetes();
        PodListSchema pods = kubernetes.getPods();
        KubernetesHelper.removeEmptyPods(pods);
        TablePrinter table = podsAsTable(pods);
        return tableResults(table);
    }
View Full Code Here

        TablePrinter table = podsAsTable(pods);
        return tableResults(table);
    }

    protected TablePrinter podsAsTable(PodListSchema pods) {
        TablePrinter table = new TablePrinter();
        table.columns("id", "image(s)", "host", "labels", "status");
        List<PodSchema> items = pods.getItems();
        if (items == null) {
            items = Collections.EMPTY_LIST;
        }
        Filter<PodSchema> filter = KubernetesHelper.createPodFilter(filterText.getValue());
        for (PodSchema item : items) {
            if (filter.matches(item)) {
                String id = item.getId();
                CurrentState currentState = item.getCurrentState();
                String status = "";
                String host = "";
                if (currentState != null) {
                    status = currentState.getStatus();
                    host = currentState.getHost();
                }
                Map<String, String> labelMap = item.getLabels();
                String labels = KubernetesHelper.toLabelsString(labelMap);
                DesiredState desiredState = item.getDesiredState();
                if (desiredState != null) {
                    Manifest manifest = desiredState.getManifest();
                    if (manifest != null) {
                        List<ManifestContainer> containers = manifest.getContainers();
                        for (ManifestContainer container : containers) {
                            String image = container.getImage();
                            table.row(id, image, host, labels, status);

                            id = "";
                            host = "";
                            status = "";
                            labels = "";
View Full Code Here

        printReplicationControllers(replicationControllers, System.out);
        return null;
    }

    private void printReplicationControllers(ReplicationControllerListSchema replicationControllers, PrintStream out) {
        TablePrinter table = new TablePrinter();
        table.columns("id", "labels", "replicas", "replica selector");
        List<ReplicationControllerSchema> items = replicationControllers.getItems();
        if (items == null) {
            items = Collections.EMPTY_LIST;
        }
        Filter<ReplicationControllerSchema> filter = KubernetesHelper.createReplicationControllerFilter(filterText.getValue());
        for (ReplicationControllerSchema item : items) {
            if (filter.matches(item)) {
                String id = item.getId();
                String labels = KubernetesHelper.toLabelsString(item.getLabels());
                Integer replicas = null;
                ControllerDesiredState desiredState = item.getDesiredState();
                ControllerCurrentState currentState = item.getCurrentState();
                String selector = null;
                if (desiredState != null) {
                    selector = KubernetesHelper.toLabelsString(desiredState.getReplicaSelector());
                }
                if (currentState != null) {
                    replicas = currentState.getReplicas();
                }
                table.row(id, labels, toPositiveNonZeroText(replicas), selector);
            }
        }
        table.print();
    }
View Full Code Here

        printServices(services, System.out);
        return null;
    }

    private void printServices(ServiceListSchema services, PrintStream out) {
        TablePrinter table = new TablePrinter();
        table.columns("id", "labels", "selector", "port");
        List<ServiceSchema> items = services.getItems();
        if (items == null) {
            items = Collections.EMPTY_LIST;
        }
        Filter<ServiceSchema> filter = KubernetesHelper.createServiceFilter(filterText.getValue());
        for (ServiceSchema item : items) {
            if (filter.matches(item)) {
                String labels = KubernetesHelper.toLabelsString(item.getLabels());
                String selector = KubernetesHelper.toLabelsString(item.getSelector());
                table.row(item.getId(), labels, selector, KubernetesHelper.toPositiveNonZeroText(item.getPort()));
            }
        }
        table.print();
    }
View Full Code Here

TOP

Related Classes of io.fabric8.tooling.archetype.generator.ArchetypeHelper

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.