public static List<String> fetchConfigurations(Profile self) { List<String> answer = new ArrayList<String>(); answer.addAll(self.getFileConfigurations().keySet()); return answer; }
public Map<String, Byte[]> getFileConfigurations() { Map<String, Byte[]> result = new LinkedHashMap<>(); for(Entry<String, byte[]> entry : delegate.getFileConfigurations().entrySet()) { result.put(entry.getKey(), fromPrimitiveArray(entry.getValue())); } return result; }
public Map<String, Byte[]> getFileConfigurations() { Map<String, Byte[]> result = new LinkedHashMap<>(); for(Entry<String, byte[]> entry : delegate.getFileConfigurations().entrySet()) { result.put(entry.getKey(), fromPrimitiveArray(entry.getValue())); } return result; }
@Override public String getConfigurationFile(String versionId, String profileId, String fileName) { return Base64.encodeBase64String(profileService.getVersion(versionId).getRequiredProfile(profileId).getFileConfigurations().get(fileName)); }
@Override public Map<String, Object> getConfigurationFiles(String versionId, List<String> profileIds, String filename) { Pattern pattern = Pattern.compile(filename); Map<String, Object> answer = new TreeMap<String, Object>(); Version version = profileService.getVersion(versionId); for (String profileId : profileIds) { Profile profile = version.getRequiredProfile(profileId); if (profile != null) { Map<String, String> files = new TreeMap<String, String>(); Map<String, byte[]> configs = profile.getFileConfigurations(); for (Map.Entry<String, byte[]> configEntry : configs.entrySet()) { if (pattern.matcher(configEntry.getKey()).matches()) { files.put(configEntry.getKey(), Base64.encodeBase64String(configEntry.getValue())); } } answer.put(profileId, files); } } return answer; }
protected Map<String, String> getProcessLayout(Profile profile, String layoutPath) { return ByteToStringValues.INSTANCE.apply(Maps.filterKeys(profile.getFileConfigurations(), new LayOutPredicate(layoutPath))); }
@Override public List<String> listWorkItemLocations() { List<String> items = Lists.newArrayList(); try { String version = dataStore.getContainerVersion(name); Version v = fabricService.getVersion(version); Profile p = v.getProfile(profile); for (String f : p.getFileConfigurations().keySet()) { if (f.startsWith(folderPath)) { items.add(f); } } } catch (Exception e) { LOGGER.debug("Error getting work items from profile repository. Returning empty.", e); } return items; }
/** * Get a long profile info string */ public static String getProfileInfo(Profile profile) { IllegalArgumentAssertion.assertNotNull(profile, "profile"); StringBuilder builder = new StringBuilder("Profile[ver=" + profile.getVersion() + ",id=" + profile.getId() + "]"); builder.append("\nAttributes"); Map<String, String> attributes = new TreeMap<>(profile.getAttributes()); for (Entry<String, String> entry : attributes.entrySet()) { builder.append("\n " + entry.getKey() + " = " + entry.getValue()); } builder.append("\nConfigurations"); for (String pid : new TreeSet<>(profile.getConfigurations().keySet())) { builder.append("\n " + pid); Map<String, String> config = new TreeMap<>(profile.getConfiguration(pid)); for (Entry<String, String> citem : config.entrySet()) { builder.append("\n " + citem.getKey() + " = " + citem.getValue()); } } builder.append("\nFiles"); for (String fileKey : new TreeSet<>(profile.getFileConfigurations().keySet())) { if (!fileKey.endsWith(Profile.PROPERTIES_SUFFIX)) { builder.append("\n " + fileKey); } } return builder.toString(); }
/** * Get a long profile info string */ public static String getProfileInfo(Profile profile) { IllegalArgumentAssertion.assertNotNull(profile, "profile"); StringBuilder builder = new StringBuilder("Profile[ver=" + profile.getVersion() + ",id=" + profile.getId() + "]"); builder.append("\nAttributes"); Map<String, String> attributes = new TreeMap<>(profile.getAttributes()); for (Entry<String, String> entry : attributes.entrySet()) { builder.append("\n " + entry.getKey() + " = " + entry.getValue()); } builder.append("\nConfigurations"); for (String pid : new TreeSet<>(profile.getConfigurations().keySet())) { builder.append("\n " + pid); Map<String, String> config = new TreeMap<>(profile.getConfiguration(pid)); for (Entry<String, String> citem : config.entrySet()) { builder.append("\n " + citem.getKey() + " = " + citem.getValue()); } } builder.append("\nFiles"); for (String fileKey : new TreeSet<>(profile.getFileConfigurations().keySet())) { if (!fileKey.endsWith(Profile.PROPERTIES_SUFFIX)) { builder.append("\n " + fileKey); } } return builder.toString(); }
protected void loadProfile(Profile profile, Set<Query> queries) { Map<String, byte[]> fileConfigurations = profile.getFileConfigurations(); byte[] bytes = fileConfigurations.get(GRAPH_JSON); if (bytes != null && bytes.length > 0) {
protected void loadProfile(Profile profile, Set<Query> queries) { Map<String, byte[]> fileConfigurations = profile.getFileConfigurations(); byte[] bytes = fileConfigurations.get(GRAPH_JSON); if (bytes != null && bytes.length > 0) {
@Override public ProfileBuilder from(Profile profile) { versionId = profile.getVersion(); profileId = profile.getId(); setFileConfigurations(profile.getFileConfigurations()); return this; }
SetView<String> rightOnlyPids = Sets.difference(rightProfile.getConfigurations().keySet(), leftProfile.getConfigurations().keySet()); SetView<String> commonPids = Sets.union(leftProfile.getConfigurations().keySet(), rightProfile.getConfigurations().keySet()); SetView<String> leftOnlyFiles = Sets.difference(leftProfile.getFileConfigurations().keySet(), rightProfile.getFileConfigurations().keySet()); SetView<String> rightOnlyFiles = Sets.difference(rightProfile.getFileConfigurations().keySet(), leftProfile.getFileConfigurations().keySet()); builder.append("\nAttributes"); builder.append("\n " + attributeDiff);
SetView<String> rightOnlyPids = Sets.difference(rightProfile.getConfigurations().keySet(), leftProfile.getConfigurations().keySet()); SetView<String> commonPids = Sets.union(leftProfile.getConfigurations().keySet(), rightProfile.getConfigurations().keySet()); SetView<String> leftOnlyFiles = Sets.difference(leftProfile.getFileConfigurations().keySet(), rightProfile.getFileConfigurations().keySet()); SetView<String> rightOnlyFiles = Sets.difference(rightProfile.getFileConfigurations().keySet(), leftProfile.getFileConfigurations().keySet()); builder.append("\nAttributes"); builder.append("\n " + attributeDiff);
String templateProfileName = String.valueOf(context.getConfiguration().get(TEMPLATE_PROFILE_PROPERTY_NAME)); Profile templateProfile = version.getProfile(templateProfileName); Set<String> allFiles = templateProfile.getFileConfigurations().keySet(); Iterable<String> mvelFiles = Iterables.filter(allFiles, MvelPredicate.INSTANCE); Iterable<String> plainFiles = Iterables.filter(allFiles, Predicates.not(MvelPredicate.INSTANCE)); CompiledTemplate template = templates.get(key); if (template == null) { template = TemplateCompiler.compileTemplate(new String(templateProfile.getFileConfigurations().get(mvelFile)), parserContext); templates.put(key, template); String content = new String(templateProfile.getFileConfigurations().get(file)); updateProfileData(file, content, profileData);
private void supplement(Profile profile, Map<String, SupplementControl> aggregate) throws Exception { Map<String, byte[]> configs = profile.getFileConfigurations(); for (String key : configs.keySet()) {
Map<String, byte[]> resources = profile.getFileConfigurations(); Map<String,String> agentConfiguration = profile.getConfiguration(Constants.AGENT_PID); List<String> agentProperties = new ArrayList<String>();
@Override public Map<String, String> getEnsembleConfiguration() throws Exception { String clusterId = getStringData(obtainValid(curator), ZkPath.CONFIG_ENSEMBLES.getPath()); String versionId = dataStore.get().getDefaultVersion(); String profileId = "fabric-ensemble-" + clusterId; String ensembleConfigName = "io.fabric8.zookeeper.server-" + clusterId + ".properties"; Profile ensembleProfile = profileRegistry.get().getRequiredProfile(versionId, profileId); Map<String, byte[]> fileconfigs = ensembleProfile.getFileConfigurations(); return DataStoreUtils.toMap(fileconfigs.get(ensembleConfigName)); }
Map<String, byte[]> fileConfigurations = profile.getFileConfigurations(); setFileConfigurations(context, versionId, profileId, fileConfigurations);
Map<String, byte[]> fileConfigurations = profile.getFileConfigurations(); setFileConfigurations(context, versionId, profileId, fileConfigurations);