Package io.fabric8.api

Examples of io.fabric8.api.FabricService


    protected void noFabricService() {
        LOG.warn("No FabricService available!");
    }

    protected ProfileService getProfileService() {
        FabricService fabricService = getFabricService();
        ProfileService profileService = null;
        if (fabricService != null) {
            profileService = fabricService.adapt(ProfileService.class);
        }
        return profileService;
    }
View Full Code Here


        findMetadataForProfile(versionId, profileId, handler);
        return answer;
    }

    protected void findMetadataForProfile(String versionId, String profileId, MetadataHandler handler) throws Exception {
        FabricService service = fabricService.get();
        Objects.notNull(service, "FabricService");

        ProfileService profileService = service.adapt(ProfileService.class);
        Objects.notNull(profileService, "ProfileService");

        DownloadManager downloadManager = DownloadManagers.createDownloadManager(service, executorService);
        Objects.notNull(downloadManager, "DownloadManager");
View Full Code Here

    }

    @Override
    public Set<ContainerProxy> call() throws Exception {
        Set<ContainerProxy> containers = new HashSet<ContainerProxy>();
        FabricService fabricService = fabricServiceProxy.getService();
        CreateContainerMetadata[] allMetadata = fabricService.createContainers(options);
        if (allMetadata != null && allMetadata.length > 0) {
            for (CreateContainerMetadata metadata : allMetadata) {
                Container container = metadata.getContainer();
                containers.add(ContainerProxy.wrap(container, fabricServiceProxy));
                if (!metadata.isSuccess()) {
View Full Code Here

     */
    @Override
    public Set<ContainerProxy> build() {
        BundleContext bundleContext = ContainerBuilder.getBundleContext();
        if (getOptionsBuilder().getHost() == null || getOptionsBuilder().getHost().isEmpty()) {
            FabricService fabricService = ServiceLocator.awaitService(bundleContext, FabricService.class);
            getOptionsBuilder().zookeeperUrl(fabricService.getZookeeperUrl()).zookeeperPassword("admin").proxyUri(fabricService.getMavenRepoURI());

            String hostProperty = System.getProperty(SSH_HOSTS_PROPERTY);
            String userProperty = System.getProperty(SSH_USERS_PROPERTY);
            String passwordProperty = System.getProperty(SSH_PASSWORD_PROPERTY);
            String resolverProperty = System.getProperty(SSH_RESOLVER_PROPERTY, ZkDefs.DEFAULT_RESOLVER);
View Full Code Here

    private Set<ContainerProxy> buildInternal(Collection<B> buildersList) {
        Set<ContainerProxy> containers = new HashSet<ContainerProxy>();
        BundleContext bundleContext = getBundleContext();
        ServiceLocator.awaitService(getBundleContext(), FabricComplete.class);
        FabricService fabricService = fabricServiceServiceProxy.getService();
        CompletionService<Set<ContainerProxy>> completionService = new ExecutorCompletionService<Set<ContainerProxy>>(executorService);

        int tasks = 0;
        for (B builder : buildersList) {
            builder.profiles(profileNames);
            if (!builder.isEnsembleServer()) {
                builder.zookeeperUrl(fabricService.getZookeeperUrl());
                CreateContainerBasicOptions options = builder.build();
                ServiceLocator.awaitService(bundleContext, ContainerProvider.class, "(fabric.container.protocol="+ options.getProviderType()+")",CREATE_TIMEOUT, TimeUnit.MILLISECONDS);
                completionService.submit(new CreateContainerTask(fabricServiceServiceProxy, options));
                tasks++;
            }
View Full Code Here

     * Destroy the given containers
     */
    public static void destroy(Set<? extends Container> containers) {
        ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(getBundleContext(), FabricService.class);
        try {
            FabricService fabricService = fabricProxy.getService();
            for (Container aux : containers) {
                try {
                    //We want to use the latest metadata
                    Container container = fabricService.getContainer(aux.getId());
                    container.destroy(true);
                } catch (Exception ex) {
                    //noop
                }
            }
View Full Code Here

     * The container directory will not get deleted.
     */
    public static void stop(Set<? extends Container> containers) {
        ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(getBundleContext(), FabricService.class);
        try {
            FabricService fabricService = fabricProxy.getService();
            for (Container aux : containers) {
                try {
                    //We want to use the latest metadata
                    Container updated = fabricService.getContainer(aux.getId());
                    updated.stop(true);
                } catch (Exception ex) {
                    ex.printStackTrace(System.err);
                    //noop
                }
View Full Code Here

        LOGGER.debug("Configuration has changed; so checking the auto-scaling requirements");
        autoScale();
    }

    private void autoScale() {
        FabricService service = fabricService.get();
        FabricRequirements requirements = service.getRequirements();
        List<ProfileRequirements> profileRequirements = requirements.getProfileRequirements();
        if (profileRequirements != null && !profileRequirements.isEmpty()) {
            AutoScaleStatus status = new AutoScaleStatus();
            for (ProfileRequirements profileRequirement : profileRequirements) {
                autoScaleProfile(service, requirements, profileRequirement, status);
View Full Code Here

            }
        }
    }

    private ContainerAutoScaler createAutoScaler(FabricRequirements requirements, ProfileRequirements profileRequirements) {
        FabricService service = fabricService.getOptional();
        if (service != null) {
            return service.createContainerAutoScaler(requirements, profileRequirements);
        } else {
            LOGGER.warn("No FabricService available so cannot autoscale");
            return null;
        }
    }
View Full Code Here

            Thread.sleep(1000);
        }
    }

    public static Boolean profileAvailable(BundleContext bundleContext, String profile, String version, Long timeout) throws Exception {
        FabricService fabricService = ServiceLocator.awaitService(bundleContext, FabricService.class);
        ProfileRegistry profileRegistry = fabricService.adapt(ProfileRegistry.class);
        for (long t = 0; (!profileRegistry.hasProfile(version, profile&& t < timeout); t += 2000L) {
            Thread.sleep(2000L);
        }
        return profileRegistry.hasProfile(version, profile);
    }
View Full Code Here

TOP

Related Classes of io.fabric8.api.FabricService

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.