Package io.fabric8.api

Examples of io.fabric8.api.Profile


        return profile != null ? new ProfileState(profile) : null;
    }

    @Override
    public ProfileState updateProfile(ProfileState profileState) {
        Profile profile = getProfileManager().updateProfile(profileState.toProfile());
        return new ProfileState(profile);
    }
View Full Code Here


    @Override
    protected Object doExecute() throws Exception {
        MQBrokerConfigDTO dto = createDTO();

        Profile profile = MQManager.createOrUpdateProfile(dto, fabricService, runtimeProperties);
        String profileId = profile.getId();

        System.out.println("MQ profile " + profileId + " ready");

        // assign profile to existing containers
        if (assign != null) {
View Full Code Here

            checkRequirements(version, descriptors);
            // Create patch profile
            List<Profile> profiles = version.getProfiles();
            for (PatchDescriptor descriptor : descriptors) {
                String profileId = "patch-" + descriptor.getId();
                Profile profile = getPatchProfile(version, descriptor);
                for (Profile p : profiles) {
                    if (profileId.equals(p.getId())) {
                        profile = p;
                        break;
                    }
                }
                if (profile == null) {
                    String versionId = version.getId();
                    ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, profileId);
                    builder.setOverrides(descriptor.getBundles());
                    profile = profileService.createProfile(builder.getProfile());
                    Profile defaultProfile = version.getRequiredProfile("default");
                    List<String> parentIds = defaultProfile.getParentIds();
                    if (!parentIds.contains(profile.getId())) {
                        parentIds.add(profile.getId());
                        builder = ProfileBuilder.Factory.createFrom(defaultProfile);
                        builder.setParents(parentIds);
                        profileService.updateProfile(builder.getProfile());
View Full Code Here

                                      "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

    private void addProfile(Container container, Profile profile) {
        Version version = profileService.getRequiredVersion(profile.getVersion());
        List<Profile> profiles = new ArrayList<Profile>();
        for (String prfId : container.getProfileIds()) {
            Profile p = version.getRequiredProfile(prfId);
            if (!isAncestor(version, prfId, profile)) {
                profiles.add(p);
            }
        }
        profiles.add(profile);
View Full Code Here

    private boolean isAncestor(Version version, String parentId, Profile child) {
        if (child.getId().equals(parentId)) {
            return true;
        }
        for (String auxId : child.getParentIds()) {
            Profile p = version.getRequiredProfile(auxId);
            if (isAncestor(version, parentId, p)) {
                return true;
            }
        }
        return false;
View Full Code Here

        ProfileManager profileManager = ProfileManagerLocator.getProfileManager();
       
        // fabric:profile-create prfA
        ProfileBuilder pbA10 = ProfileBuilder.Factory.create("1.0", "prfA")
                .addConfiguration("pidA", Collections.singletonMap("keyA", "valA"));
        Profile prfA10 = profileManager.createProfile(pbA10.getProfile());
        Assert.assertEquals("1.0", prfA10.getVersion());
        Assert.assertEquals("prfA", prfA10.getId());
        Assert.assertEquals("valA", prfA10.getConfiguration("pidA").get("keyA"));
       
        // Verify access to original profile
        profileManager.getRequiredVersion("1.0").getRequiredProfile("prfA");
       
        // fabric:version-create --parent 1.0 1.1
        Version v11 = profileManager.createVersionFrom("1.0", "1.1", null);
        Profile prfA11a = v11.getRequiredProfile("prfA");
        Assert.assertEquals("1.1", prfA11a.getVersion());
        Assert.assertEquals("prfA", prfA11a.getId());
        Assert.assertEquals("valA", prfA11a.getConfiguration("pidA").get("keyA"));
       
        // Verify access to original profile
        profileManager.getRequiredVersion("1.0").getRequiredProfile("prfA");
        profileManager.getRequiredVersion("1.1").getRequiredProfile("prfA");
       
        ProfileBuilder pbA11 = ProfileBuilder.Factory.createFrom(prfA11a)
                .addConfiguration("pidA", Collections.singletonMap("keyB", "valB"));
        Profile prfA11b = profileManager.updateProfile(pbA11.getProfile());
        Assert.assertEquals("1.1", prfA11b.getVersion());
        Assert.assertEquals("prfA", prfA11b.getId());
        Assert.assertEquals("valB", prfA11b.getConfiguration("pidA").get("keyB"));
       
        Assert.assertNotEquals(prfA11a, prfA11b);
        // System.out.println(Profiles.getProfileDifference(prfA11a, prfA11b));
       
        // Verify access to original profile
View Full Code Here

            container.setProvisionException(null);
        }
    }

    protected String getJolokiaURL(Container container, CurrentState currentState, FabricService service, PodSchema item) {
        Profile overlayProfile = container.getOverlayProfile();
        String jolokiaPort = null;
        Map<String, String> ports = null;
        if (overlayProfile != null) {
            ports = overlayProfile.getConfiguration(Constants.PORTS_PID);
            jolokiaPort = ports.get(Constants.Ports.JOLOKIA);
        }
        String host = currentState.getHost();
        String podIP = currentState.getPodIP();
        String hostOrIp = podIP;
View Full Code Here

        downloader.setDownloadFilesFromProfile(false);
        if (verbose) {
            downloader.setListener(new ProgressIndicator());
        }
        if (profile != null) {
            Profile profileObject = null;
            if (ver.hasProfile(profile)) {
                profileObject = ver.getRequiredProfile(profile);
            }
            if (profileObject == null) {
                System.out.println("Source profile " + profile + " not found.");
View Full Code Here

            Assert.fail("IllegalStateException expected");
        } catch (IllegalStateException ex) {
            Assert.assertTrue(ex.getMessage(), ex.getMessage().contains("Profile already exists: prfA"));
        }
       
        Profile prfA = profileRegistry.getRequiredProfile(versionId, profileId);
        Assert.assertNotNull(prfA);
       
        // Delete the profile again
        profileRegistry.deleteProfile(versionId, profileId);
View Full Code Here

TOP

Related Classes of io.fabric8.api.Profile

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.