use of io.fabric8.kubernetes.model.annotation.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.kubernetes.model.annotation.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();
}
}
use of io.fabric8.kubernetes.model.annotation.Version in project fabric8 by jboss-fuse.
the class FabricManager method containersForProfile.
@Override
public List<Map<String, Object>> containersForProfile(String versionId, String profileId, List<String> fields, boolean checkParents) {
Version version = profileService.getVersion(versionId);
Profile profile = version != null ? version.getRequiredProfile(profileId) : null;
Set<Map<String, Object>> answer = new LinkedHashSet<Map<String, Object>>();
if (profile != null) {
for (Container c : fabricService.getContainers()) {
for (Profile p : c.getProfiles()) {
if (p.equals(profile)) {
answer.add(BeanUtils.convertContainerToMap(fabricService, c, fields));
} else if (checkParents) {
HashSet<Profile> profileIDs = new HashSet<>();
getAllParentProfiles(version, p, profileIDs);
for (Profile pprofile : profileIDs) {
if (pprofile.equals(profile)) {
answer.add(BeanUtils.convertContainerToMap(fabricService, c, fields));
break;
}
}
}
}
}
}
return new ArrayList<>(answer);
}
use of io.fabric8.kubernetes.model.annotation.Version in project fabric8 by jboss-fuse.
the class FabricManager method createVersion.
@Override
public Map<String, Object> createVersion() {
Version latestVersion = getLatestVersion();
VersionSequence sequence = new VersionSequence(latestVersion.getId());
return createVersion(sequence.next().getName());
}
use of io.fabric8.kubernetes.model.annotation.Version in project fabric8 by jboss-fuse.
the class MQManager method loadBrokerStatus.
@Override
public List<MQBrokerStatusDTO> loadBrokerStatus(String versionId) throws Exception {
FabricRequirements requirements = fabricService.getRequirements();
List<MQBrokerStatusDTO> answer = new ArrayList<MQBrokerStatusDTO>();
Version version = versionId == null ? fabricService.getDefaultVersion() : profileService.getVersion(versionId);
Container[] containers = fabricService.getContainers();
List<Profile> values = getActiveOrRequiredBrokerProfileMap(version, requirements);
for (Profile profile : values) {
List<MQBrokerConfigDTO> list = createConfigDTOs(mqService, profile);
for (MQBrokerConfigDTO configDTO : list) {
ProfileRequirements profileRequirements = requirements.findProfileRequirements(profile.getId());
int count = 0;
for (Container container : containers) {
if (Containers.containerHasProfile(container, profile)) {
MQBrokerStatusDTO status = createStatusDTO(profile, configDTO, profileRequirements, container);
count++;
answer.add(status);
}
}
// if there are no containers yet, lets create a record anyway
if (count == 0) {
MQBrokerStatusDTO status = createStatusDTO(profile, configDTO, profileRequirements, null);
answer.add(status);
}
}
}
addMasterSlaveStatus(answer);
return answer;
}
Aggregations