use of io.fabric8.api.ProfileService in project fabric8 by jboss-fuse.
the class FabricFeaturesServiceImpl method getAllProfilesOverlay.
/**
* Creates an aggregation of all available {@link Profile}s.
*/
private Profile getAllProfilesOverlay() {
Container container = fabricService.get().getCurrentContainer();
ProfileService profileService = fabricService.get().adapt(ProfileService.class);
Version version = container.getVersion();
Profile versionProfile = getVersionProfile(version);
return Profiles.getEffectiveProfile(fabricService.get(), profileService.getOverlayProfile(versionProfile));
}
use of io.fabric8.api.ProfileService in project fabric8 by jboss-fuse.
the class ProfileManagerImpl method deleteProfile.
@Override
public void deleteProfile(String versionId, String profileId, boolean force) {
Permit<ProfileService> permit = permitManager.get().aquirePermit(ProfileService.PERMIT, false);
try {
ProfileService service = permit.getInstance();
service.deleteProfile(versionId, profileId, force);
} finally {
permit.release();
}
}
use of io.fabric8.api.ProfileService in project fabric8 by jboss-fuse.
the class ProfileManagerImpl method deleteVersion.
@Override
public void deleteVersion(String versionId) {
Permit<ProfileService> permit = permitManager.get().aquirePermit(ProfileService.PERMIT, false);
try {
ProfileService service = permit.getInstance();
service.deleteVersion(versionId);
} finally {
permit.release();
}
}
use of io.fabric8.api.ProfileService in project fabric8 by jboss-fuse.
the class FabricManager method doGetProfile.
Map<String, Object> doGetProfile(Version version, String profileId, List<String> fields, boolean mandatory) {
Profile profile;
if (mandatory) {
profile = version.getRequiredProfile(profileId);
} else {
profile = version.getProfile(profileId);
}
if (profile == null) {
return null;
}
Map<String, Object> answer = BeanUtils.convertProfileToMap(fabricService, profile, fields);
String iconURLField = "iconURL";
if (fields.contains(iconURLField) && !profile.isOverlay()) {
// TODO this could move to Profile.getIconURL() but that would require
// introducing profileService into ProfileImpl and the ProfileBuilder stuff
String restApi = restApiUrl();
if (restApi != null && restApi.length() > 0) {
// turn REST into relative URI so it works with docker containers etc (avoids local ports etc)
try {
URL url = new URL(restApi);
restApi = url.getPath();
} catch (MalformedURLException e) {
// Ignore
}
String icon = getIconURL(version, version.getId(), profile, profileId, restApi);
answer.put(iconURLField, icon);
}
}
return answer;
}
use of io.fabric8.api.ProfileService 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