本文整理了Java中io.fabric8.api.Version.getProfiles()
方法的一些代码示例,展示了Version.getProfiles()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.getProfiles()
方法的具体详情如下:
包路径:io.fabric8.api.Version
类名称:Version
方法名:getProfiles
[英]Get the list of available profiles [TODO] remove
[中]获取可用配置文件列表[TODO]删除
代码示例来源:origin: io.fabric8/fabric-api
public List<ProfileState> getProfileStates() {
List<ProfileState> result = new ArrayList<>();
for (Profile prf : delegate.getProfiles()) {
result.add(new ProfileState(prf));
}
return result;
}
代码示例来源:origin: jboss-fuse/fabric8
public List<ProfileState> getProfileStates() {
List<ProfileState> result = new ArrayList<>();
for (Profile prf : delegate.getProfiles()) {
result.add(new ProfileState(prf));
}
return result;
}
代码示例来源:origin: jboss-fuse/fabric8
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()]);
}
代码示例来源:origin: io.fabric8/fabric-rest
@GET
@Path("profiles")
public Map<String, String> profiles() {
if (version != null) {
List<String> profileIds = Profiles.profileIds(version.getProfiles());
return mapToLinks(profileIds, "profile/");
}
return Collections.EMPTY_MAP;
}
代码示例来源:origin: jboss-fuse/fabric8
@GET
@Path("profiles")
public Map<String, String> profiles() {
if (version != null) {
List<String> profileIds = Profiles.profileIds(version.getProfiles());
return mapToLinks(profileIds, "profile/");
}
return Collections.EMPTY_MAP;
}
代码示例来源:origin: io.fabric8/fabric-boot-commands
/**
* Gets all the existing profiles for the given names.
*
* @throws IllegalArgumentException if a profile with the given name does not exists
*/
public static Profile[] getExistingProfiles(FabricService fabricService, 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 + " does not exist.");
}
profiles.add(profile);
}
return profiles.toArray(new Profile[profiles.size()]);
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public List<Map<String, Object>> getProfiles(String versionId, List<String> fields) {
List<Map<String, Object>> answer = new ArrayList<Map<String, Object>>();
Version version = profileService.getVersion(versionId);
for (Profile p : version.getProfiles()) {
answer.add(doGetProfile(version, p.getId(), fields, true));
}
return answer;
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public List<String> getProfileIds(String version) {
return Ids.getIds(profileService.getVersion(version).getProfiles());
}
代码示例来源:origin: jboss-fuse/fabric8
public static Map<String, Object> convertVersionToMap(FabricService fabricService, Version version, List<String> fields) {
IllegalArgumentAssertion.assertNotNull(version, "version");
IllegalArgumentAssertion.assertNotNull(fields, "fields");
Map<String, Object> answer = new TreeMap<String, Object>();
for (String field : fields) {
if (field.equalsIgnoreCase("profiles") || field.equalsIgnoreCase("profileIds")) {
answer.put(field, Ids.getIds(version.getProfiles()));
} else if (field.equalsIgnoreCase("defaultVersion")) {
answer.put(field, fabricService.getRequiredDefaultVersion().equals(version));
} else if (field.equalsIgnoreCase("class") || field.equalsIgnoreCase("string")) {
// ignore...
} else {
addProperty(version, field, answer);
}
}
return answer;
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public VersionBuilder from(Version version) {
setAttributes(version.getAttributes());
addProfiles(version.getProfiles());
return this;
}
代码示例来源:origin: jboss-fuse/fabric8
public String call(Git git, GitContext context) throws Exception {
String versionId = version.getId();
GitHelpers.checkoutTag(git, GitHelpers.ROOT_TAG);
createOrCheckoutVersion(git, version.getId());
setVersionAttributes(git, context, versionId, attributes);
context.commitMessage("Create version: " + version);
Set<String> alreadyProcessedProfiles = new HashSet<String>();
for (Profile profile : version.getProfiles()) {
createOrUpdateProfile(context, null, profile,alreadyProcessedProfiles);
}
return versionId;
}
};
代码示例来源:origin: io.fabric8/fabric-commands
@Override
protected Object doExecute() throws Exception {
try {
FabricValidations.validateProfileName(profileId);
} catch (IllegalArgumentException e) {
// we do not want exception in the server log, so print the error message to the console
System.out.println(e.getMessage());
return null;
}
Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion();
for (Profile profile : version.getProfiles()) {
if (profileId.equals(profile.getId())) {
displayProfile(profile);
}
}
return null;
}
代码示例来源:origin: jboss-fuse/fabric8
public static List<String> fetchChildIds(FabricService fabricService, Profile self) {
List<String> ids = new ArrayList<String>();
ProfileService profileService = fabricService.adapt(ProfileService.class);
for (Profile p : profileService.getRequiredVersion(self.getVersion()).getProfiles()) {
for (String parentId : p.getParentIds()) {
if (parentId.equals(self.getId())) {
ids.add(p.getId());
break;
}
}
}
return ids;
}
代码示例来源:origin: io.fabric8/fabric-boot-commands
@Override
public int complete(String buffer, int cursor, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
try {
Version version = fabricService.getRequiredDefaultVersion();
List<Profile> profiles = version.getProfiles();
for (Profile profile : profiles) {
delegate.getStrings().add(profile.getId());
}
} catch (Exception ex) {
//Ignore Exceptions
}
return delegate.complete(buffer, cursor, candidates);
}
代码示例来源:origin: jboss-fuse/fabric8
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;
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public int complete(String buffer, int cursor, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
try {
Version version = fabricService.getRequiredDefaultVersion();
List<Profile> profiles = version.getProfiles();
for (Profile profile : profiles) {
delegate.getStrings().add(profile.getId());
}
} catch (Exception ex) {
//Ignore Exceptions
}
return delegate.complete(buffer, cursor, candidates);
}
代码示例来源:origin: io.fabric8/fabric-commands
@Override
protected Object doExecute() throws Exception {
// do not validate the name in case a profile was created somehow with invalid name
ProfileService profileService = fabricService.adapt(ProfileService.class);
Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion();
boolean deleted = false;
for (Profile profile : version.getProfiles()) {
String versionId = profile.getVersion();
String profileId = profile.getId();
if (name.equals(profileId)) {
profileService.deleteProfile(fabricService, versionId, profileId, force);
deleted = true;
}
}
if (!deleted) {
System.out.println("Profile " + name + " not found.");
}
return null;
}
代码示例来源:origin: io.fabric8/fabric-git
public String call(Git git, GitContext context) throws Exception {
String versionId = version.getId();
IllegalStateAssertion.assertNull(checkoutProfileBranch(git, context, versionId, null), "Version already exists: " + versionId);
GitHelpers.checkoutTag(git, GitHelpers.ROOT_TAG);
createOrCheckoutVersion(git, version.getId());
setVersionAttributes(git, context, versionId, version.getAttributes());
context.commitMessage("Create version: " + version);
for (Profile profile : version.getProfiles()) {
createOrUpdateProfile(context, null, profile, new HashSet<String>());
}
return versionId;
}
};
代码示例来源:origin: jboss-fuse/fabric8
public String call(Git git, GitContext context) throws Exception {
String versionId = version.getId();
IllegalStateAssertion.assertNull(checkoutProfileBranch(git, context, versionId, null), "Version already exists: " + versionId);
GitHelpers.checkoutTag(git, GitHelpers.ROOT_TAG);
createOrCheckoutVersion(git, version.getId());
setVersionAttributes(git, context, versionId, version.getAttributes());
context.commitMessage("Create version: " + version);
Set<String> alreadyProcessedProfiles = new HashSet<String>();
for (Profile profile : version.getProfiles()) {
createOrUpdateProfile(context, null, profile,alreadyProcessedProfiles);
}
return versionId;
}
};
代码示例来源:origin: io.fabric8/fabric-commands
@Override
protected Object doExecute() throws Exception {
ProfileService profileService = fabricService.adapt(ProfileService.class);
Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion();
List<Profile> profiles = version.getProfiles();
profiles = sortProfiles(profiles);
printProfiles(profileService, profiles, System.out);
return null;
}
内容来源于网络,如有侵权,请联系作者删除!