org.apache.felix.utils.properties.Properties.remove()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中org.apache.felix.utils.properties.Properties.remove()方法的一些代码示例,展示了Properties.remove()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Properties.remove()方法的具体详情如下:
包路径:org.apache.felix.utils.properties.Properties
类名称:Properties
方法名:remove

Properties.remove介绍

暂无

代码示例

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

@Override
public Object remove(Object key) {
  return storage.remove(key);
}

代码示例来源:origin: apache/felix

@Override
public Object remove(Object key) {
  return storage.remove(key);
}

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

@Override
public Object remove(Object key) {
  return storage.remove(key);
}

代码示例来源:origin: org.fusesource.fabric/fabric-jaas

/**
 * Delete a User.
 *
 * @param username
 */
public void deleteUser(String username) {
  users.remove(username);
  try {
    users.save();
  } catch (Exception ex) {
    LOGGER.error("Cannot remove users file,", ex);
  }
}

代码示例来源:origin: org.apache.karaf.system/org.apache.karaf.system.core

public void setFrameworkDebug(boolean debug) {
  try {
    Properties properties = loadProps();
    if (debug) {
      properties.put("felix.log.level", "4");
      properties.put("osgi.debug", "etc/equinox-debug.properties");
    } else {
      properties.remove("felix.log.level");
      properties.remove("osgi.debug");
    }
    // TODO populate the equinox-debug.properties file with the one provided in shell/dev module
    properties.save();
  } catch (IOException e) {
    throw new RuntimeException("Error setting framework debugging: " + e.getMessage(), e);
  }
}

代码示例来源:origin: apache/karaf

public void setFrameworkDebug(boolean debug) {
  try {
    Properties properties = loadProps();
    if (debug) {
      properties.put("felix.log.level", "4");
      properties.put("osgi.debug", "etc/equinox-debug.properties");
    } else {
      properties.remove("felix.log.level");
      properties.remove("osgi.debug");
    }
    // TODO populate the equinox-debug.properties file with the one provided in shell/dev module
    properties.save();
  } catch (IOException e) {
    throw new RuntimeException("Error setting framework debugging: " + e.getMessage(), e);
  }
}

代码示例来源:origin: apache/karaf

private static void loadIncludes(String propertyName, boolean mandatory, URL configPropURL, Properties configProps)
    throws Exception {
  String includes = configProps.get(propertyName);
  if (includes != null) {
    StringTokenizer st = new StringTokenizer(includes, "\" ", true);
    if (st.countTokens() > 0) {
      String location;
      do {
        location = nextLocation(st);
        if (location != null) {
          URL url = new URL(configPropURL, location);
          Properties props = loadPropertiesFile(url, mandatory);
          configProps.putAll(props);
        }
      }
      while (location != null);
    }
  }
  configProps.remove(propertyName);
}

代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.config

p.remove(key);

代码示例来源:origin: org.apache.karaf.jaas/org.apache.karaf.jaas.modules

@Override
public void deleteUser(String username) {
  // delete all its groups first, for garbage collection of the groups
  for (GroupPrincipal gp : listGroups(username)) {
    deleteGroup(username, gp.getName());
  }
  users.remove(username);
  try {
    users.save();
  } catch (Exception ex) {
    LOGGER.error("Cannot remove users file,", ex);
  }
}

代码示例来源:origin: apache/karaf

@Override
public void deleteUser(String username) {
  // delete all its groups first, for garbage collection of the groups
  for (GroupPrincipal gp : listGroups(username)) {
    deleteGroup(username, gp.getName());
  }
  users.remove(username);
  try {
    users.save();
  } catch (Exception ex) {
    LOGGER.error("Cannot remove users file,", ex);
  }
}

代码示例来源:origin: apache/karaf

@Override
public void deleteUser(String username) {
  // delete all its groups first, for garbage collection of the groups
  for (GroupPrincipal gp : listGroups(username)) {
    deleteGroup(username, gp.getName());
  }
  users.remove(username);
  try {
    users.save();
  } catch (Exception ex) {
    LOGGER.error("Cannot remove users file,", ex);
  }
}

代码示例来源:origin: org.apache.karaf.jaas/org.apache.karaf.jaas.modules

@Override
public void deleteUser(String username) {
  // delete all its groups first, for garbage collection of the groups
  for (GroupPrincipal gp : listGroups(username)) {
    deleteGroup(username, gp.getName());
  }
  users.remove(username);
  try {
    users.save();
  } catch (Exception ex) {
    LOGGER.error("Cannot remove users file,", ex);
  }
}

代码示例来源: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: jboss-fuse/fabric8

if (childMap.remove(Profile.DELETED) != null) {
  ctrl.props.clear();
    ctrl.props.remove(p.getKey());
  } else {
    ctrl.props.put(p.getKey(), p.getValue());

代码示例来源:origin: apache/karaf

users.remove(user);
user = user.replace("\\", "\\\\");

代码示例来源:origin: jboss-fuse/fabric8

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: org.apache.karaf.jaas/org.apache.karaf.jaas.modules

users.remove(user);
user = user.replace("\\", "\\\\");

代码示例来源: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;
}

代码示例来源: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;
}

相关文章