use of io.fabric8.api.FabricService in project fabric8 by jboss-fuse.
the class FabricManager method containers.
@Override
public List<Map<String, Object>> containers(List<String> fields, List<String> profileFields) {
List<Map<String, Object>> answer = new ArrayList<Map<String, Object>>();
for (Container c : fabricService.getContainers()) {
Map<String, Object> map = BeanUtils.convertContainerToMap(fabricService, c, fields);
List<Map<String, Object>> profiles = new ArrayList<Map<String, Object>>();
for (Profile p : c.getProfiles()) {
profiles.add(BeanUtils.convertProfileToMap(fabricService, p, profileFields));
}
map.put("profiles", profiles);
answer.add(map);
}
return answer;
}
use of io.fabric8.api.FabricService 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.FabricService 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.api.FabricService in project fabric8 by jboss-fuse.
the class FabricManager method currentContainerConfigurationFiles.
/**
* Returns a map of all the current configuration files in the profiles of
* the current container with the file name as the key and the profile ID as
* the value
*/
@Override
public Map<String, String> currentContainerConfigurationFiles() {
String containerName = getCurrentContainerName();
FabricServiceImpl service = fabricService;
Container container = service.getContainer(containerName);
if (container != null) {
Profile[] profiles = container.getProfiles();
return Profiles.getConfigurationFileNameMap(profiles);
}
return new HashMap<String, String>();
}
use of io.fabric8.api.FabricService in project fabric8 by jboss-fuse.
the class MQManager method getActiveOrRequiredBrokerProfileMap.
private List<Profile> getActiveOrRequiredBrokerProfileMap(Version version, FabricRequirements requirements) {
IllegalArgumentAssertion.assertNotNull(fabricService, "fabricService");
List<Profile> answer = new ArrayList<Profile>();
if (version != null) {
ProfileService profileService = fabricService.adapt(ProfileService.class);
List<Profile> profiles = version.getProfiles();
for (Profile profile : profiles) {
String versionId = profile.getVersion();
String profileId = profile.getId();
if (!IGNORED_PROFILES.contains(profileId)) {
Profile overlay = profileService.getOverlayProfile(profile);
Map<String, Map<String, String>> configurations = overlay.getConfigurations();
Set<Map.Entry<String, Map<String, String>>> entries = configurations.entrySet();
for (Map.Entry<String, Map<String, String>> entry : entries) {
String key = entry.getKey();
if (isBrokerConfigPid(key)) {
answer.add(overlay);
}
}
}
}
}
return answer;
}
Aggregations