Package io.fabric8.api

Examples of io.fabric8.api.Version


                throw new IllegalArgumentException("A container with name " + name + " already exists.");
            }

            // get the profiles for the given version
            ProfileService profileService = fabricService.adapt(ProfileService.class);
            Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion();
            List<Profile> profiles = version.getProfiles();

            // validate profiles exists before creating a new container
            Set<String> names = getProfileNames();
            for (String profile : names) {
                Profile prof = getProfile(profiles, profile, version);
                if (prof == null) {
                    throw new IllegalArgumentException("Profile " + profile + " with version " + version.getId() + " does not exist.");
                }
                if (prof.isAbstract()) {
                    throw new IllegalArgumentException("Profile " + profile + " with version " + version.getId() + " is abstract and can not be associated to containers.");
                }
            }
        }

        if (!isEnsembleServer && fabricService.getZookeeperUrl() == null) {
View Full Code Here


    @Override
    public void stop(TaskContext context) {
        ProfileService profileService = fabricService.get().adapt(ProfileService.class);
        Container current = fabricService.get().getCurrentContainer();
        Version version = current.getVersion();
        String profileId = context.getConfiguration().get(TEMPLATE_PROFILE_PROPERTY_NAME) + "-" + name;
        if (version.hasProfile(profileId)) {
          String versionId = version.getId();
          profileService.deleteProfile(fabricService.get(), versionId, profileId, true);
        }
    }
View Full Code Here

    private void manageProfile(TaskContext context) {
        ProfileService profileService = fabricService.get().adapt(ProfileService.class);
        Container current = fabricService.get().getCurrentContainer();
        ProfileData profileData = createProfileData(context);
        String profileId = context.getConfiguration().get(TEMPLATE_PROFILE_PROPERTY_NAME) + "-" + name;
        Version version = current.getVersion();
      String versionId = version.getId();

      // [TODO] Revisit lock in ProfileTemplateWorker
        try {
            if (lock.acquire(60, TimeUnit.SECONDS)) {
                if (profileData.isEmpty()) {
                    if (version.hasProfile(profileId)) {
                        profileService.deleteProfile(fabricService.get(), versionId, profileId, true);
                    }
                    return;
                }
               
                Profile managedProfile;
                if (version.hasProfile(profileId)) {
                    Profile profile = profileService.getRequiredProfile(versionId, profileId);
                    ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile);
                    builder.setFileConfigurations(profileData.getFiles());
                    managedProfile = profileService.updateProfile(builder.getProfile());
                } else {
View Full Code Here

        if (workItems.isEmpty()) {
            return profileData;
        }

        Container current = fabricService.get().getCurrentContainer();
        Version version = current.getVersion();
        String templateProfileName = String.valueOf(context.getConfiguration().get(TEMPLATE_PROFILE_PROPERTY_NAME));
        Profile templateProfile = version.getRequiredProfile(templateProfileName);
        Set<String> allFiles = templateProfile.getFileConfigurations().keySet();
        Iterable<String> mvelFiles = Iterables.filter(allFiles, MvelPredicate.INSTANCE);
        Iterable<String> plainFiles = Iterables.filter(allFiles, Predicates.not(MvelPredicate.INSTANCE));

View Full Code Here

        return deployProject(requirements);
    }

    @Override
    public DeployResults deployProject(ProjectRequirements requirements) throws Exception {
        Version version = getOrCreateVersion(requirements);

        // validate that all the parent profiles exists
        for (String parent : requirements.getParentProfiles()) {
            if (!version.hasProfile(parent)) {
                throw new IllegalArgumentException("Parent profile " + parent + " does not exists in version " + version.getId());
            }
        }

        Profile profile = getOrCreateProfile(version, requirements);
        boolean isAbstract = requirements.isAbstractProfile();
View Full Code Here

        } catch (IllegalArgumentException e) {
            // we do not want exception in the server log, so print the error message to the console
            System.out.println(e.getMessage());
            return null;
        }
        Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion();
        for (Profile profile : version.getProfiles()) {
            if (profileId.equals(profile.getId())) {
                displayProfile(profile);
            }
        }
        return null;
View Full Code Here

    }

    private Version getOrCreateVersion(ProjectRequirements requirements) {
        ProfileService profileService = fabricService.get().adapt(ProfileService.class);
        String versionId = getVersionId(requirements);
        Version version = findVersion(fabricService.get(), versionId);
        if (version == null) {
            String baseId = requirements.getBaseVersion();
            baseId = getVersionOrDefaultVersion(fabricService.get(), baseId);
            Version baseVersion = findVersion(fabricService.get(), baseId);
            if (baseVersion != null) {
                version = profileService.createVersionFrom(baseVersion.getId(), versionId, null);
            } else {
                version = VersionBuilder.Factory.create(versionId).getVersion();
                version = profileService.createVersion(version);
            }
        }
View Full Code Here

            // may be nice to discover from JMX one day
            String apiDocPath = "/api-docs";
            String wsdlPath = "?wsdl";
            String wadlPath = "?_wadl";

            Version version = container.getVersion();
            String versionId = version != null ? version.getId() : null;

            String json = "{\"id\":" + JsonHelper.jsonEncodeString(id)
                    + ", \"container\":" + JsonHelper.jsonEncodeString(id)
                    + ", \"version\":" + JsonHelper.jsonEncodeString(versionId)
                    + ", \"services\":[" + JsonHelper.jsonEncodeString(url) + "]" +
View Full Code Here

        this.fabricService = fabricService;
    }

    @Override
    protected Object doExecute() throws Exception {
        Version version = profileService.getRequiredVersion(versionId);
       
        StringBuilder sb = new StringBuilder();
        for (Container container : fabricService.getContainers()) {
            if (version.equals(container.getVersion())) {
                if (sb.length() > 0) {
                    sb.append(", ");
                }
                sb.append(container.getId());
            }
View Full Code Here

    }

  @Override
  protected Object doExecute() throws Exception {
        ProfileService profileService = fabricService.adapt(ProfileService.class);
    Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion();
    Profile profile = version.getProfile(profileName);
        if (profile != null) {
            Profiles.refreshProfile(fabricService, profile);
        } else {
            System.out.println("Profile " + profileName + " not found.");
        }
View Full Code Here

TOP

Related Classes of io.fabric8.api.Version

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.