@Override public List<UserPrincipal> listUsers() { List<UserPrincipal> result = new ArrayList<>(); for (Object user : users.keySet()) { String userName = (String) user; if (userName.startsWith(GROUP_PREFIX)) continue; UserPrincipal userPrincipal = new UserPrincipal(userName); result.add(userPrincipal); } return result; }
@Override public List<UserPrincipal> listUsers() { List<UserPrincipal> result = new ArrayList<>(); for (Object user : users.keySet()) { String userName = (String) user; if (userName.startsWith(GROUP_PREFIX)) continue; UserPrincipal userPrincipal = new UserPrincipal(userName); result.add(userPrincipal); } return result; }
@Override public List<UserPrincipal> listUsers() { List<UserPrincipal> result = new ArrayList<>(); for (Object user : users.keySet()) { String userName = (String) user; if (userName.startsWith(GROUP_PREFIX)) continue; UserPrincipal userPrincipal = new UserPrincipal(userName); result.add(userPrincipal); } return result; }
/** * List Users * * @return */ public List<UserPrincipal> listUsers() { List<UserPrincipal> result = new ArrayList<UserPrincipal>(); for (String userNames : (Set<String>) users.keySet()) { UserPrincipal userPrincipal = new UserPrincipal(userNames); result.add(userPrincipal); } return result; }
@Override public List<UserPrincipal> listUsers() { List<UserPrincipal> result = new ArrayList<>(); for (Object user : users.keySet()) { String userName = (String) user; if (userName.startsWith(GROUP_PREFIX)) continue; UserPrincipal userPrincipal = new UserPrincipal(userName); result.add(userPrincipal); } return result; }
public Map<GroupPrincipal, String> listGroups() { Map<GroupPrincipal, String> result = new HashMap<>(); for (String name : users.keySet()) { if (name.startsWith(GROUP_PREFIX)) { result.put(new GroupPrincipal(name.substring(GROUP_PREFIX.length())), users.get(name)); } } return result; }
public Map<GroupPrincipal, String> listGroups() { Map<GroupPrincipal, String> result = new HashMap<>(); for (String name : users.keySet()) { if (name.startsWith(GROUP_PREFIX)) { result.put(new GroupPrincipal(name.substring(GROUP_PREFIX.length())), users.get(name)); } } return result; }
public Map<GroupPrincipal, String> listGroups() { Map<GroupPrincipal, String> result = new HashMap<>(); for (String name : users.keySet()) { if (name.startsWith(GROUP_PREFIX)) { result.put(new GroupPrincipal(name.substring(GROUP_PREFIX.length())), users.get(name)); } } return result; }
public Map<GroupPrincipal, String> listGroups() { Map<GroupPrincipal, String> result = new HashMap<>(); for (String name : users.keySet()) { if (name.startsWith(GROUP_PREFIX)) { result.put(new GroupPrincipal(name.substring(GROUP_PREFIX.length())), users.get(name)); } } return result; }
private static void trimValues(Properties configProps) { for (String key : configProps.keySet()) { configProps.put(key, configProps.get(key).trim()); } }
public List<BundleInfo> readBundlesFromStartupProperties(File startupPropsFile) { Properties startupProps = PropertiesLoader.loadPropertiesOrFail(startupPropsFile); List<BundleInfo> bundeList = new ArrayList<>(); for (String key : startupProps.keySet()) { try { BundleInfo bi = new BundleInfo(); bi.uri = new URI(key); String startlevelSt = startupProps.getProperty(key).trim(); bi.startLevel = new Integer(startlevelSt); bundeList.add(bi); } catch (Exception e) { throw new RuntimeException("Error loading startup bundle list from " + startupPropsFile + " at " + key, e); } } return bundeList; }
private void ensureTyped() { if (!storage.typed) { storage.typed = true; Set<String> keys = new HashSet<String>(storage.keySet()); for (String key : keys) { storage.put(key, storage.getComments(key), Arrays.asList(convertToString(storage.get(key)).split("\n"))); } } }
private void ensureTyped() { if (!storage.typed) { storage.typed = true; Set<String> keys = new HashSet<String>(storage.keySet()); for (String key : keys) { storage.put(key, storage.getComments(key), Arrays.asList(convertToString(storage.get(key)).split("\n"))); } } }
private void ensureTyped() { if (!storage.typed) { storage.typed = true; Set<String> keys = new HashSet<String>(storage.keySet()); for (String key : keys) { storage.put(key, storage.getComments(key), Arrays.asList(convertToString(storage.get(key)).split("\n"))); } } }
private void loadPropertiesFrom(Dictionary<String, Object> dictionary, String from) { InputStream is = null; Properties properties = new Properties(); try { is = new FileInputStream(from); properties.load(is); for (String key : properties.keySet()) { dictionary.put(key, properties.get(key)); } } catch (Exception e) { // Ignore } finally { if (is != null) { try { is.close(); } catch (Exception e) { // Ignore } } } }
private void loadPropertiesFrom(Dictionary<String, Object> dictionary, String from) { InputStream is = null; Properties properties = new Properties(); try { is = new FileInputStream(from); properties.load(is); for (String key : properties.keySet()) { dictionary.put(key, properties.get(key)); } } catch (Exception e) { // Ignore } finally { if (is != null) { try { is.close(); } catch (Exception e) { // Ignore } } } }
public static void setProperties(CuratorFramework curator, String path, Properties properties) throws Exception { try { org.apache.felix.utils.properties.Properties p = new org.apache.felix.utils.properties.Properties(); if(curator.checkExists().forPath(path) == null){ create(curator, path); } String org = getStringData(curator, path); if (org != null) { p.load(new StringReader(org)); } List<String> keys = new ArrayList<String>(); for (String key : properties.stringPropertyNames()) { p.put(key, properties.getProperty(key)); keys.add(key); } List<String> deleted = new ArrayList<String>(p.keySet()); deleted.removeAll(keys); for (String key : deleted) { p.remove(key); } StringWriter writer = new StringWriter(); p.save(writer); setData(curator, path, writer.toString()); } catch (IOException e) { // ignore } }
public boolean update(Properties properties) { boolean modified = false; // Remove "removed" properties from the cfg file for (String key : new ArrayList<String>(this.keySet())) { if (!properties.containsKey(key)) { this.remove(key); modified = true; } } // Update existing keys for (String key : properties.keySet()) { String v = this.get(key); List<String> comments = properties.getComments(key); List<String> value = properties.getRaw(key); if (v == null) { this.put(key, comments, value); modified = true; } else if (!v.equals(properties.get(key))) { if (comments.isEmpty()) { comments = this.getComments(key); } this.put(key, comments, value); modified = true; } } return modified; }
public boolean update(Properties properties) { boolean modified = false; // Remove "removed" properties from the cfg file for (String key : new ArrayList<String>(this.keySet())) { if (!properties.containsKey(key)) { this.remove(key); modified = true; } } // Update existing keys for (String key : properties.keySet()) { String v = this.get(key); List<String> comments = properties.getComments(key); List<String> value = properties.getRaw(key); if (v == null) { this.put(key, comments, value); modified = true; } else if (!v.equals(properties.get(key))) { if (comments.isEmpty()) { comments = this.getComments(key); } this.put(key, comments, value); modified = true; } } return modified; }
public boolean update(Properties properties) { boolean modified = false; // Remove "removed" properties from the cfg file for (String key : new ArrayList<String>(this.keySet())) { if (!properties.containsKey(key)) { this.remove(key); modified = true; } } // Update existing keys for (String key : properties.keySet()) { String v = this.get(key); List<String> comments = properties.getComments(key); List<String> value = properties.getRaw(key); if (v == null) { this.put(key, comments, value); modified = true; } else if (!v.equals(properties.get(key))) { if (comments.isEmpty()) { comments = this.getComments(key); } this.put(key, comments, value); modified = true; } } return modified; }