Package io.fabric8.process.manager

Examples of io.fabric8.process.manager.ProcessController


        // such as the operating system PATH or FABRIC8_JAVA8_HOME when not using docker containers
        JolokiaAgentHelper.substituteEnvironmentVariableExpressions(environmentVariables, System.getenv(), null, null, true);
    }

    protected static ProcessConfig getProcessConfig(Installation installation) {
        ProcessController controller = installation.getController();
        return controller.getConfig();
    }
View Full Code Here


        String id = requirements.getId();

        Installation installation = findProcessInstallation(id);
        // for now lets remove it just in case! :)
        if (installation != null) {
            ProcessController controller = installation.getController();
            try {
                controller.stop();
            } catch (Exception e) {
                LOG.warn("Ignored exception while trying to stop process " + installation + " " + e);
            }
            controller.uninstall();
            controller = null;
        }
    }
View Full Code Here

        // TODO we should support different kinds of controller based on the kind of installation
        // we could maybe discover a descriptor file to describe how to control the process?
        // or generate this file on installation time?

        File installDir = findInstallDir(rootDir);
        ProcessController controller = createController(id, config, rootDir, installDir);
        // TODO need to read the URL from somewhere...
        Installation installation = new Installation(url, id, installDir, controller, config);
        installations.put(id, installation);
        return installation;
    }
View Full Code Here

    private void updateConfig(String pid, Installation installation, Map<String, String> env) throws ConfigurationException {

        try {

            final ProcessController controller = installation.getController();
            final boolean running = (controller.status() == 0);

            // stop if running, since config may not be changed while process is running
            if (running) {
                controller.stop();
            }

            // refresh environment variables in process config
            installation.getEnvironment().putAll(env);

            // re-configure the install using new environment variables
            controller.configure();

            // restart if it was running before
            if (running) {
                controller.start();
            }

        } catch (Exception e) {
            String msg = "Error updating process " + pid + ": " + e.getMessage();
            LOG.error(msg, e);
View Full Code Here

          try {
            // TODO replace with better JmxTemplate reusing the
            // Connection!!!
            JMXConnector connector = null; // TODO: find out how to improve -->  connectionWrapper.getConnector();
            if (connector == null) {
              connector = new LocalJMXConnector(connection);
            }
            Object answer = callback.doWithJmxConnector(connector);
            answerHolder[0] = answer;
          } catch (Exception e) {
            Activator.getLogger().warning("Failed to connect to JMX: " + e, e);
View Full Code Here

          try {
            // TODO replace with better JmxTemplate reusing the
            // Connection!!!
            JMXConnector connector = null; //TODO: find out how to improve -->  connectionWrapper.getConnector();
            if (connector == null) {
              connector = new LocalJMXConnector(connection);
            }
            Object answer = callback.doWithJmxConnector(connector);
            answerHolder[0] = answer;
          } catch (Exception e) {
            throw new RuntimeException(e);
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);
            }
          });

          // on failure we don't add the cloud image to the navigator
          Throwable failure = metadata.getFailure();
          if (failure != null) {
            return new Status(Status.ERROR, FabricPlugin.PLUGIN_ID, "Failed to create Fabric: " + fabricName, failure);
          }

          // now extract the public IP from the meta data
          final StringBuilder urisBuilder = new StringBuilder();
          for(String address:metadata.getPublicAddresses()) {
            urisBuilder.append(address).append(",");
          }

          final CreateJCloudsContainerOptions.Builder arguments = args;
          Viewers.async(new Runnable() {
View Full Code Here

          args = args.computeService(computeClient);

          FabricPlugin.getLogger().debug("Creating Jclouds provider type: " + providerName);

            // we need to set the fabric user , pw and role in that way, otherwise the user is not created
          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) {
View Full Code Here

            NovaFirewallSupport novafw = new NovaFirewallSupport();
            novafw.activateComponent();
            firewallManagerFactory.bindFirewallSupport(novafw);
           
          // create and activate provider
          JcloudsContainerProvider provider = new JcloudsContainerProvider();
          provider.activateComponent();
            provider.bindFirewallManagerFactory(firewallManagerFactory);

            // get and set the provider name
          String providerName = args.getProviderName();
          args = args.contextName(providerName);

          // create and set the compute service
          ComputeService computeClient = CloudDetails.createComputeService(getSelectedCloud());
          args = args.computeService(computeClient);

          FabricPlugin.getLogger().debug("Creating Jclouds provider type: " + providerName);

            // we need to set the fabric user , pw and role in that way, otherwise the user is not created
          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

          FabricPlugin.getLogger().debug("Create cloud fabric: " + fabricName + " container: " + agentName);

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

TOP

Related Classes of io.fabric8.process.manager.ProcessController

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.