public void remove(Key key) throws AgentStorageException {

    String keys = getKeys();
    int len = keys.length();

    // delete the resource from the resources list
    keys = StringUtil.replace(keys, key.getEntry(), "");

    if (len == keys.length()) {
      log.debug("Remove failed, key not found: " + key);
      return;
    }

    this.storage.setValue(this.keylistName, keys);

    // delete the resource properties from the agent DB
    Set<String> propertiesKeys = storage.getPropertiesKeys(key.getStoragePrefix());
    for (String propertiesKey : propertiesKeys) {
      this.storage.setValue(
          propertiesKey, null); // Sending null as Value parameter removes the property key
    }

    this.storage.flush();
    log.debug("Removed from storage: " + key);
  }
  public void put(Key key, ConfigResponse cr) throws AgentStorageException {

    // store config in agent storage
    copy(NO_PREFIX, cr, key.storagePrefix, this.storage);

    // if this key doesn't yet exist in out master list, add it
    String keys = getKeys();

    String entry = key.getEntry();
    log.debug("Searching for '" + entry + "' " + "within '" + keys + "'");

    if (keys.indexOf(entry) == -1) {
      keys += entry;
      this.storage.setValue(this.keylistName, keys);
    }
    // Flush writes to agent storage
    this.storage.flush();

    if (log.isDebugEnabled()) {
      log.debug("Successfully stored config into storage: " + key + "-->" + cr);
    }
  }