本文整理了Java中org.apache.felix.utils.properties.Properties.keySet()
方法的一些代码示例,展示了Properties.keySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Properties.keySet()
方法的具体详情如下:
包路径:org.apache.felix.utils.properties.Properties
类名称:Properties
方法名:keySet
暂无
代码示例来源:origin: apache/karaf
@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;
}
代码示例来源:origin: apache/karaf
@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;
}
代码示例来源:origin: org.apache.karaf.jaas/org.apache.karaf.jaas.modules
@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;
}
代码示例来源:origin: org.fusesource.fabric/fabric-jaas
/**
* 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;
}
代码示例来源:origin: org.apache.karaf.jaas/org.apache.karaf.jaas.modules
@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;
}
代码示例来源:origin: org.apache.karaf.jaas/org.apache.karaf.jaas.modules
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;
}
代码示例来源:origin: apache/karaf
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;
}
代码示例来源:origin: apache/karaf
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;
}
代码示例来源:origin: org.apache.karaf.jaas/org.apache.karaf.jaas.modules
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;
}
代码示例来源:origin: apache/karaf
private static void trimValues(Properties configProps) {
for (String key : configProps.keySet()) {
configProps.put(key, configProps.get(key).trim());
}
}
代码示例来源:origin: apache/karaf
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;
}
代码示例来源:origin: org.apache.felix/org.apache.felix.utils
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")));
}
}
}
代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall
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")));
}
}
}
代码示例来源:origin: apache/felix
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")));
}
}
}
代码示例来源:origin: io.fabric8/fabric-zookeeper
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
}
}
}
}
代码示例来源:origin: jboss-fuse/fabric8
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
}
}
}
}
代码示例来源:origin: io.fabric8/fabric-zookeeper
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
}
}
代码示例来源:origin: apache/felix
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;
}
代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall
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;
}
代码示例来源:origin: org.apache.felix/org.apache.felix.utils
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;
}
内容来源于网络,如有侵权,请联系作者删除!