Package io.fabric8.api

Examples of io.fabric8.api.Profile


    }

    @Override
    public List<Map<String, Object>> containersForProfile(String versionId, String profileId, List<String> fields) {
        Version version = profileService.getVersion(versionId);
        Profile profile = version != null ? version.getRequiredProfile(profileId) : null;
        List<Map<String, Object>> answer = new ArrayList<Map<String, Object>>();
        if (profile != null) {
            for (Container c : fabricService.getContainers()) {
                for (Profile p : c.getProfiles()) {
                    if (p.equals(profile)) {
View Full Code Here


        List<Profile> profiles = new ArrayList<Profile>();
        if (names == null) {
            return new Profile[0];
        }
        for (String name : names) {
            Profile profile = null;
            for (Profile p : allProfiles) {
                if (name.equals(p.getId())) {
                    profile = p;
                    break;
                }
View Full Code Here

        return (answer != null) ? answer.toString() : null;
    }

    @Override
    public Map<String, Object> getProfileFeatures(String versionId, String profileId) {
        Profile profile = profileService.getVersion(versionId).getRequiredProfile(profileId);
        Profile effectiveProfile = Profiles.getEffectiveProfile(fabricService, profileService.getOverlayProfile(profile));

        Map<String, Boolean> isParentFeature = new HashMap<String, Boolean>();

        for (String feature : profile.getFeatures()) {
            isParentFeature.put(feature, Boolean.FALSE);
        }

        for (String feature : effectiveProfile.getFeatures()) {
            if (isParentFeature.get(feature) == null) {
                isParentFeature.put(feature, Boolean.TRUE);
            }
        }

        Map<String, Object> rc = new HashMap<String, Object>();

        List<Map<String, Object>> featureDefs = new ArrayList<Map<String, Object>>();

        for (Map.Entry<String, Boolean> featureEntry : isParentFeature.entrySet()) {
            Map<String, Object> featureDef = new HashMap<String, Object>();
            featureDef.put("id", featureEntry.getKey());
            featureDef.put("isParentFeature", featureEntry.getValue());
            featureDefs.add(featureDef);
        }

        rc.put("featureDefinitions", featureDefs);

        List<Map<String, Object>> repositoryDefs = new ArrayList<Map<String, Object>>();
        for (String repo : effectiveProfile.getRepositories()) {
            Map<String, Object> repoDef = new HashMap<String, Object>();

            repoDef.put("id", repo);
            Closeable closeable = null;
            try {
View Full Code Here

    }

    Map<String, Object> doGetProfile(String versionId, String profileId, List<String> fields, boolean mandatory) {
        Version version = profileService.getVersion(versionId);

        Profile profile;
        if (mandatory) {
            profile = version.getRequiredProfile(profileId);
        } else {
            profile = version.getProfile(profileId);
        }
        if (profile == null) {
            return null;
        }

        Map<String, Object> answer = BeanUtils.convertProfileToMap(fabricService, profile, fields);
        String iconURLField = "iconURL";
        if (fields.contains(iconURLField) && !profile.isOverlay()) {
            // TODO this could move to Profile.getIconURL() but that would require
            // introducing profileService into ProfileImpl and the ProfileBuilder stuff
            String restApi = restApiUrl();
            if (restApi != null && restApi.length() > 0) {
                // turn REST into relative URI so it works with docker containers etc (avoids local ports etc)
View Full Code Here

       
        // [FABRIC-1172] Jolokia exec operations fail on WildFly
        Assume.assumeFalse(getRuntimeType() == RuntimeType.WILDFLY);
       
        ProfileBuilder pbA11 = ProfileBuilder.Factory.create("1.1", "prfA");
        Profile prfA = pbA11.addConfiguration("pidA", Collections.singletonMap("keyA", "valA")).getProfile();
        VersionBuilder vb11 = VersionBuilder.Factory.create("1.1").addProfile(prfA);
        VersionState v11 = getProxy().createVersion(new VersionState(vb11.getVersion()));
        try {
            Assert.assertEquals("1.1", v11.getId());
            Assert.assertTrue(v11.getAttributes().isEmpty());
View Full Code Here

        String iconProfileId = profileId;
        if (isNullOrEmpty(relativeIcon)) {
            List<String> parentIds = profile.getParentIds();
            if (parentIds != null && !parentIds.isEmpty()) {
                for (String parentId : parentIds) {
                    Profile parentProfile = version.getRequiredProfile(parentId);
                    relativeIcon = parentProfile.getIconRelativePath();
                    if (isNullOrEmpty(relativeIcon)) {
                        String answer = getIconURL(version, versionId, parentProfile, parentId, restApi);
                        if (!isNullOrEmpty(answer)) {
                            return answer;
                        }
View Full Code Here

    }

    @Override
    public List<String> getConfigurationFileNames(String versionId, String profileId) {
        Version version = profileService.getVersion(versionId);
        Profile profile = version.getProfile(profileId);
        if (profile != null) {
            ArrayList<String> fileNames = new ArrayList<>(profile.getConfigurationFileNames());
            return Collections.unmodifiableList(fileNames);
        } else {
            return Collections.emptyList();
        }
    }
View Full Code Here

    public Map<String, Object> getConfigurationFiles(String versionId, List<String> profileIds, String filename) {
        Pattern pattern = Pattern.compile(filename);
        Map<String, Object> answer = new TreeMap<String, Object>();
        Version version = profileService.getVersion(versionId);
        for (String profileId : profileIds) {
            Profile profile = version.getRequiredProfile(profileId);
            if (profile != null) {
                Map<String, String> files = new TreeMap<String, String>();
                Map<String, byte[]> configs = profile.getFileConfigurations();

                for (Map.Entry<String, byte[]> configEntry : configs.entrySet()) {
                    if (pattern.matcher(configEntry.getKey()).matches()) {
                        files.put(configEntry.getKey(), Base64.encodeBase64String(configEntry.getValue()));
                    }
View Full Code Here

        return answer;
    }

    @Override
    public void deleteConfigurationFile(String versionId, String profileId, String fileName) {
        Profile profile = profileService.getRequiredProfile(versionId, profileId);
        ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile);
        builder.deleteFileConfiguration(fileName);
        profileService.updateProfile(builder.getProfile());
    }
View Full Code Here

        profileService.updateProfile(builder.getProfile());
    }

    @Override
    public void setConfigurationFile(String versionId, String profileId, String fileName, String data) {
        Profile profile = profileService.getRequiredProfile(versionId, profileId);
        ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile);
        builder.addFileConfiguration(fileName, Base64.decodeBase64(data));
        profileService.updateProfile(builder.getProfile());
    }
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.