Package com.sequenceiq.cloudbreak.service.stack.connector

Examples of com.sequenceiq.cloudbreak.service.stack.connector.CloudPlatformConnector


                    }

                    LOGGER.info("Publishing {} event [StackId: '{}']", ReactorConfig.PROVISION_COMPLETE_EVENT, stack.getId());
                    reactor.notify(ReactorConfig.PROVISION_COMPLETE_EVENT, Event.wrap(new ProvisionComplete(cloudPlatform, stack.getId(), resourceSet)));
                } else {
                    CloudPlatformConnector cloudPlatformConnector = cloudPlatformConnectors.get(cloudPlatform);
                    cloudPlatformConnector.buildStack(stack, userDataBuilder.build(cloudPlatform, stack.getHash(), userDataParams), setupProperties);
                }
            } else {
                LOGGER.info("CloudFormation stack creation was requested for a stack, that is not in REQUESTED status anymore. [stackId: '{}', status: '{}']",
                        stack.getId(), stack.getStatus());
            }
View Full Code Here


        Stack stack = stackRepository.findOneWithLists(stackId);
        MDCBuilder.buildMdcContext(stack);
        if (StatusRequest.STOPPED.equals(statusRequest)) {
            boolean stopped = true;
            if (cloudPlatform.isWithTemplate()) {
                CloudPlatformConnector connector = cloudPlatformConnectors.get(cloudPlatform);
                stopped = connector.stopAll(stack);
            } else {
                try {
                    ResourceBuilderInit resourceBuilderInit = resourceBuilderInits.get(cloudPlatform);
                    final StartStopContextObject sSCO = resourceBuilderInit.startStopInit(stack);

                    for (ResourceBuilder resourceBuilder : networkResourceBuilders.get(cloudPlatform)) {
                        for (Resource resource : stack.getResourcesByType(resourceBuilder.resourceType())) {
                            resourceBuilder.stop(sSCO, resource);
                        }
                    }
                    List<Future<Boolean>> futures = new ArrayList<>();
                    for (final ResourceBuilder resourceBuilder : instanceResourceBuilders.get(cloudPlatform)) {
                        List<Resource> resourceByType = stack.getResourcesByType(resourceBuilder.resourceType());
                        for (final Resource resource : resourceByType) {
                            Future<Boolean> submit = resourceBuilderExecutor.submit(new Callable<Boolean>() {
                                @Override
                                public Boolean call() throws Exception {
                                    return resourceBuilder.stop(sSCO, resource);
                                }
                            });
                            futures.add(submit);
                        }
                    }
                    for (Future<Boolean> future : futures) {
                        if (!future.get()) {
                            stopped = false;
                        }
                    }
                } catch (Exception ex) {
                    stopped = false;
                }
            }
            if (stopped) {
                LOGGER.info("Update stack state to: {}", Status.STOPPED);
                stackUpdater.updateStackStatus(stackId, Status.STOPPED);
                cloudbreakEventService.fireCloudbreakEvent(stackId, BillingStatus.BILLING_STOPPED.name(), "Stack stopped.");
            } else {
                LOGGER.info("Update stack state to: {}", Status.STOP_FAILED);
                stackUpdater.updateStackStatus(stackId, Status.STOP_FAILED);
            }
        } else {
            boolean started = true;
            if (cloudPlatform.isWithTemplate()) {
                CloudPlatformConnector connector = cloudPlatformConnectors.get(cloudPlatform);
                started = connector.startAll(stack);
            } else {
                try {
                    ResourceBuilderInit resourceBuilderInit = resourceBuilderInits.get(cloudPlatform);
                    final StartStopContextObject sSCO = resourceBuilderInit.startStopInit(stack);
View Full Code Here

TOP

Related Classes of com.sequenceiq.cloudbreak.service.stack.connector.CloudPlatformConnector

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.