@Override public String toString() { return "Profile[ver=" + versionId + ",id=" + profileId + ",atts=" + getAttributes() + "]"; }
@Override public String getIconURL() { String result = null; Set<String> fileNames = getConfigurationFileNames(); for (String fileName : fileNames) { if (fileName.startsWith("icon.")) { String id = getId(); String version = getVersion(); result = version + "/fabric/profiles/" + id + ".profile/" + fileName; break; } } return result; }
@Override public List<String> getLibraries() { return getContainerConfigList(this, ConfigListType.LIBRARIES); }
@Override public List<String> getTags() { List<String> answer = getContainerConfigList(this, ConfigListType.TAGS); if (answer == null || answer.size() == 0) { // lets create the default list of tags answer = new ArrayList<>(); String id = getId(); String[] paths = id.split("-"); if (paths != null) { Set<String> tags = new HashSet<String>(); for (int i = 0, last = paths.length - 1; i < last; i++) { tags.add(paths[i]); } answer.addAll(tags); } } return answer; }
@Override public String getSummaryMarkdown() { byte[] data = getFileConfiguration("Summary.md"); if (data != null) { return new String(data); data = getFileConfiguration("ReadMe.md"); if (data != null) { String readMe = new String(data).trim(); text = text.trim(); if (skipSummaryLine(text) && first) { first = false; continue; while (skipSummaryLine(text)) { text = text.substring(1);
@Override public String getIconRelativePath() { Set<String> fileNames = getConfigurationFileNames(); for (String fileName : fileNames) { if (fileName.startsWith("icon.")) { return fileName; } } return null; }
@Override public String getProfileHash() { StringBuilder answer = new StringBuilder(); if (lastModified != null) { answer.append(lastModified); } // if the profile has embedded blueprint/spring-dm bundles within the profile, // then we need to use a CRC of their file content in the hash calculation for (String bundle : getBundles()) { if (bundle.startsWith("blueprint:profile:") || bundle.startsWith("spring:profile:")) { String name = bundle.startsWith("blueprint:profile:") ? bundle.substring(18) : bundle.substring(15); byte[] data = fileConfigurations.get(name); if (data != null) { InputStream is = new ByteArrayInputStream(data); try { long crc = ChecksumUtils.checksum(is); answer.append(crc); } catch (IOException e) { // ignore } } } } return answer.toString(); }
@Override public Profile getProfile() { validate(); return new ProfileImpl(versionId, profileId, getParents(), fileMapping, lastModified, isOverlay); } }
@Override public List<String> getOverrides() { return getContainerConfigList(this, ConfigListType.OVERRIDES); }
@Override public boolean isHidden() { return Boolean.parseBoolean(getAttributes().get(HIDDEN)); }
public List<String> getRepositories() { return getContainerConfigList(this, ConfigListType.REPOSITORIES); }
@Override public boolean isLocked() { return Boolean.parseBoolean(getAttributes().get(LOCKED)); }
public List<String> getFabs() { return getContainerConfigList(this, ConfigListType.FABS); }
@Override public boolean isAbstract() { return Boolean.parseBoolean(getAttributes().get(ABSTRACT)); }
public List<String> getFeatures() { return getContainerConfigList(this, ConfigListType.FEATURES); }
@Override public List<String> getEndorsedLibraries() { return getContainerConfigList(this, ConfigListType.ENDORSED); }
@Override public List<String> getExtensionLibraries() { return getContainerConfigList(this, ConfigListType.EXTENSION); }
@Override public List<String> getOptionals() { return getContainerConfigList(this, ConfigListType.OPTIONALS); }
public List<String> getBundles() { return getContainerConfigList(this, ConfigListType.BUNDLES); }