public static List<Container> containersForProfile(Container[] containers, String profileId) { List<Container> answer = new ArrayList<Container>(); if (profileId != null) { for (Container c : containers) { if (containerHasProfile(c, profileId)) { answer.add(c); } } } return answer; }
public static List<Container> containersForProfile(Container[] containers, String profileId) { List<Container> answer = new ArrayList<Container>(); if (profileId != null) { for (Container c : containers) { if (containerHasProfile(c, profileId)) { answer.add(c); } } } return answer; }
/** * Returns true if the given container has the given profile */ public static boolean containerHasProfile(Container container, Profile profile) { return containerHasProfile(container, profile.getId()); }
public static List<Container> containersForProfile(Container[] containers, String profileId, String versionId) { List<Container> answer = new ArrayList<Container>(); if (profileId != null) { for (Container c : containers) { String currentId = c.getVersionId(); if (currentId != null && currentId.equals(versionId) && containerHasProfile(c, profileId)) { answer.add(c); } } } return answer; }
/** * Returns true if the given container has the given profile */ public static boolean containerHasProfile(Container container, Profile profile) { return containerHasProfile(container, profile.getId()); }
public static List<Container> containersForProfile(Container[] containers, String profileId, String versionId) { List<Container> answer = new ArrayList<Container>(); if (profileId != null) { for (Container c : containers) { String currentId = c.getVersionId(); if (currentId != null && currentId.equals(versionId) && containerHasProfile(c, profileId)) { answer.add(c); } } } return answer; }
@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; }