use of io.fabric8.api.Version in project fabric8 by jboss-fuse.
the class FabricManager method deleteVersion.
@Override
public void deleteVersion(String versionId) {
Container[] containers = fabricService.getContainers();
StringBuilder sb = new StringBuilder();
for (Container container : fabricService.getContainers()) {
if (versionId.equals(container.getVersionId())) {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(container.getId());
}
}
IllegalStateAssertion.assertTrue(sb.length() == 0, "Version " + versionId + " is still used by the following containers: " + sb.toString());
profileService.deleteVersion(versionId);
}
use of io.fabric8.api.Version in project fabric8 by jboss-fuse.
the class FabricManager method getOverlayProfileProperties.
@Override
public Map<String, String> getOverlayProfileProperties(String versionId, String profileId, String pid) {
Map<String, String> answer = null;
Version version = profileService.getVersion(versionId);
if (version != null) {
Profile profile = version.getRequiredProfile(profileId);
if (profile != null) {
Profile overlayProfile = profileService.getOverlayProfile(profile);
answer = overlayProfile.getConfiguration(pid);
}
}
return answer;
}
use of io.fabric8.api.Version in project fabric8 by jboss-fuse.
the class FabricManager method stringsToProfiles.
protected Profile[] stringsToProfiles(Version version, List<String> names) {
List<Profile> allProfiles = version.getProfiles();
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;
}
}
if (profile == null) {
throw new IllegalArgumentException("Profile " + name + " not found.");
}
profiles.add(profile);
}
return profiles.toArray(new Profile[profiles.size()]);
}
use of io.fabric8.api.Version in project fabric8 by jboss-fuse.
the class FabricManager method containersForVersion.
@Override
public List<Map<String, Object>> containersForVersion(String versionId, List<String> fields) {
Version version = profileService.getVersion(versionId);
List<Map<String, Object>> answer = new ArrayList<Map<String, Object>>();
if (version != null) {
for (Container c : fabricService.getContainers()) {
if (c.getVersion().equals(version)) {
answer.add(BeanUtils.convertContainerToMap(fabricService, c, fields));
}
}
}
return answer;
}
use of io.fabric8.api.Version in project fabric8 by jboss-fuse.
the class FabricManager method getConfigurationFileNames.
@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();
}
}
Aggregations