Package io.fabric8.api

Examples of io.fabric8.api.ProfileService


        try {
            if (curator.get() == null) {
                throw new IllegalStateException("Zookeeper service not available");
            }
            // Wipe all config entries that are related to the container for all versions.
            ProfileService profileService = fabricService.adapt(ProfileService.class);
            for (String version : profileService.getVersions()) {
                deleteSafe(curator.get(), ZkPath.CONFIG_VERSIONS_CONTAINER.getPath(version, containerId));
            }
            deleteSafe(curator.get(), ZkPath.CONFIG_CONTAINER.getPath(containerId));
            deleteSafe(curator.get(), ZkPath.CONTAINER.getPath(containerId));
            deleteSafe(curator.get(), ZkPath.CONTAINER_ALIVE.getPath(containerId));
View Full Code Here


    public void downloadProfile(Profile profile) throws Exception {
        if (listener != null) {
            listener.beforeDownloadProfile(profile);
        }

        ProfileService profileService = fabricService.adapt(ProfileService.class);
        if (!profile.isOverlay()) {
            profile = profileService.getOverlayProfile(profile);
        }

        DownloadManager downloadManager = DownloadManagers.createDownloadManager(fabricService, executorService);
        downloadManager.setDownloadFilesFromProfile(isDownloadFilesFromProfile());
View Full Code Here

        for (String bundle : bundleList) {
            if (bundle != null) {
                if (bundle.contains("$")) {
                    // use similar logic as io.fabric8.agent.utils.AgentUtils.getProfileArtifacts method
                    // as we need to substitute version placeholders
                    ProfileService profileService = fabricService.adapt(ProfileService.class);
                    Profile overlay = profileService.getOverlayProfile(profile);
                    bundle = VersionPropertyPointerResolver.replaceVersions(fabricService, overlay.getConfigurations(), bundle);
                }
                bundles.add(bundle);
            }
        }
View Full Code Here

    private List<Profile> getActiveOrRequiredBrokerProfileMap(Version version, FabricRequirements requirements) {
        IllegalArgumentAssertion.assertNotNull(fabricService, "fabricService");
        List<Profile> answer = new ArrayList<Profile>();
        if (version != null) {
            ProfileService profileService = fabricService.adapt(ProfileService.class);
            List<Profile> profiles = version.getProfiles();
            for (Profile profile : profiles) {
                // ignore if we don't have any requirements or instances as it could be profiles such
                // as the out of the box mq-default / mq-amq etc
              String versionId = profile.getVersion();
              String profileId = profile.getId();
                if (requirements.hasMinimumInstances(profileId) || fabricService.getAssociatedContainers(versionId, profileId).length > 0) {
                    Profile overlay = profileService.getOverlayProfile(profile);
                    Map<String, Map<String, String>> configurations = overlay.getConfigurations();
                    Set<Map.Entry<String, Map<String, String>>> entries = configurations.entrySet();
                    for (Map.Entry<String, Map<String, String>> entry : entries) {
                        String key = entry.getKey();
                        if (isBrokerConfigPid(key)) {
View Full Code Here

    }

    @Override
    protected Object doExecute() throws Exception {
        List<Version> versions;
        ProfileService profileService = fabricService.adapt(ProfileService.class);
        if (versionId != null && !versionId.isEmpty()) {
            Version version = profileService.getRequiredVersion(versionId);
            versions = Collections.singletonList(version);
        } else if (allVersions) {
            versions = new ArrayList<>();
            for (String versionId : profileService.getVersions()) {
                versions.add(profileService.getRequiredVersion(versionId));
            }
        } else {
            versions = Collections.singletonList(fabricService.getRequiredDefaultVersion());
        }
        username = username != null && !username.isEmpty() ? username : ShellUtils.retrieveFabricUser(session);
View Full Code Here

                if (findContainer(containers, n) == null) {
                    throw new IllegalStateException("Container " + n + " does not exists");
                }
            }
        }
        ProfileService profileService = fabricService.adapt(ProfileService.class);
        for (String p : Arrays.asList("hadoop-" + name,
                                      "hadoop-" + name + "-namenode",
                                      "hadoop-" + name + "-secondary-namenode",
                                      "hadoop-" + name + "-datanode",
                                      "hadoop-" + name + "-job-tracker",
                                      "hadoop-" + name + "-task-tracker",
                                      "insight-hdfs-" + name)) {
            Profile profile = null;
            try {
                profile = fabricService.getRequiredDefaultVersion().getProfile(p);
            } catch (Throwable t) {
                // Ignore
            }
            if (profile != null) {
              String versionId = profile.getVersion();
                String profileId = profile.getId();
                if (force) {
                    profileService.deleteProfile(fabricService, versionId, profileId, force);
                } else {
          throw new IllegalStateException("Profile " + profileId + " already exists. Use --force to recreate the profiles.");
                }
            }
        }

        Version version = fabricService.getRequiredDefaultVersion();
        Profile hadoop = version.getRequiredProfile("hadoop");
        Map<String, Map<String, String>> configs;

        String versionId = version.getId();
        ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name);
        builder.addParent(hadoop.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("fs.default.name", "hdfs://${zk:" + nameNode + "/ip}:9000");
        configs.get("io.fabric8.hadoop").put("dfs.http.address", "hdfs://${zk:" + nameNode + "/ip}:9002");
        Profile cluster = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-namenode");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("nameNode", "true");
        Profile nameNodeProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-secondary-namenode");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("secondaryNameNode", "true");
        Profile secondaryNameNodeProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-datanode");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("dataNode", "true");
        Profile dataNodeProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-job-tracker");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("jobTracker", "true");
        Profile jobTrackerProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-task-tracker");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("taskTracker", "true");
        Profile taskTrackerProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "insight-hdfs-" + name);
        builder.addParent(version.getRequiredProfile("insight-hdfs").getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.insight.elasticsearch-default", new HashMap<String, String>());
        configs.get("io.fabric8.insight.elasticsearch-default").put("gateway.hdfs.uri", "hdfs://${zk:" + nameNode + "/ip}:9000");
        Profile insightProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        // Name node
        Container nameNodeContainer = findContainer(containers, nameNode);
        if (nameNodeContainer == null && createChildren) {
            nameNodeContainer = createChild(nameNode);
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());
View Full Code Here

        return fabricService;
    }

    @Override
    protected Object doExecute() throws Exception {
        ProfileService profileService = fabricService.adapt(ProfileService.class);
        Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion();
        List<Profile> profiles = version.getProfiles();
        profiles = sortProfiles(profiles);
        printProfiles(profileService, profiles, System.out);
        return null;
    }
View Full Code Here

    @Override
    protected Object doExecute() throws Exception {
        // do not validate the name in case a profile was created somehow with invalid name

        ProfileService profileService = fabricService.adapt(ProfileService.class);
        Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion();
        boolean deleted = false;
        for (Profile profile : version.getProfiles()) {
            String versionId = profile.getVersion();
            String profileId = profile.getId();
            if (name.equals(profileId)) {
                profileService.deleteProfile(fabricService, versionId, profileId, force);
                deleted = true;
            }
        }

        if (!deleted) {
View Full Code Here

    }

    @Override
    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        ProfileService profileService = fabricService.adapt(ProfileService.class);
        List<String> versions = profileService.getVersions();
        for (String version : versions) {
            delegate.getStrings().add(version);
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

TOP

Related Classes of io.fabric8.api.ProfileService

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.