class NoSqlDbClient extends DB {

  private KVStore store;

  private int getPropertyInt(Properties properties, String key,
      int defaultValue) throws DBException {
    String p = properties.getProperty(key);
    int i = defaultValue;
    if (p != null) {
      try {
        i = Integer.parseInt(p);
      } catch (NumberFormatException e) {
        throw new DBException("Illegal number format in " + key + " property");
      }
    }
    return i;
  }

  @Override
  public void init() throws DBException {<FILL_FUNCTION_BODY>}

  @Override
  public void cleanup() throws DBException {
    store.close();
  }

  /**
   * Create a key object. We map "table" and (YCSB's) "key" to a major component
   * of the oracle.kv.Key, and "field" to a minor component.
   * 
   * @return An oracle.kv.Key object.
   */
  private static Key createKey(String table, String key, String field) {
    List<String> majorPath = new ArrayList<String>();
    majorPath.add(table);
    majorPath.add(key);
    if (field == null) {
      return Key.createKey(majorPath);
    }

    return Key.createKey(majorPath, field);
  }

  private static Key createKey(String table, String key) {
    return createKey(table, key, null);
  }

  private static String getFieldFromKey(Key key) {
    return key.getMinorPath().get(0);
  }

  @Override
  public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) {
    Key kvKey = createKey(table, key);
    SortedMap<Key, ValueVersion> kvResult;
    try {
      kvResult = store.multiGet(kvKey, null, null);
    } catch (FaultException e) {
      System.err.println(e);
      return Status.ERROR;
    }

    for (Map.Entry<Key, ValueVersion> entry : kvResult.entrySet()) {
      /* If fields is null, read all fields */
      String field = getFieldFromKey(entry.getKey());
      if (fields != null && !fields.contains(field)) {
        continue;
      }
      result.put(field,
          new ByteArrayByteIterator(entry.getValue().getValue().getValue()));
    }

    return Status.OK;
  }

  @Override
  public Status scan(String table, String startkey, int recordcount,
      Set<String> fields, Vector<HashMap<String, ByteIterator>> result) {
    System.err.println("Oracle NoSQL Database does not support Scan semantics");
    return Status.ERROR;
  }

  @Override
  public Status update(String table, String key, Map<String, ByteIterator> values) {
    for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
      Key kvKey = createKey(table, key, entry.getKey());
      Value kvValue = Value.createValue(entry.getValue().toArray());
      try {
        store.put(kvKey, kvValue);
      } catch (FaultException e) {
        System.err.println(e);
        return Status.ERROR;
      }
    }

    return Status.OK;
  }

  @Override
  public Status insert(String table, String key, Map<String, ByteIterator> values) {
    return update(table, key, values);
  }

  @Override
  public Status delete(String table, String key) {
    Key kvKey = createKey(table, key);
    try {
      store.multiDelete(kvKey, null, null);
    } catch (FaultException e) {
      System.err.println(e);
      return Status.ERROR;
    }

    return Status.OK;
  }

}

    Properties properties = getProperties();

    /* Mandatory properties */
    String storeName = properties.getProperty("storeName", "kvstore");
    String[] helperHosts =
        properties.getProperty("helperHost", "localhost:5000").split(",");

    KVStoreConfig config = new KVStoreConfig(storeName, helperHosts);

    /* Optional properties */
    String p;

    p = properties.getProperty("consistency");
    if (p != null) {
      if (p.equalsIgnoreCase("ABSOLUTE")) {
        config.setConsistency(Consistency.ABSOLUTE);
      } else if (p.equalsIgnoreCase("NONE_REQUIRED")) {
        config.setConsistency(Consistency.NONE_REQUIRED);
      } else {
        throw new DBException("Illegal value in consistency property");
      }
    }

    p = properties.getProperty("durability");
    if (p != null) {
      if (p.equalsIgnoreCase("COMMIT_NO_SYNC")) {
        config.setDurability(Durability.COMMIT_NO_SYNC);
      } else if (p.equalsIgnoreCase("COMMIT_SYNC")) {
        config.setDurability(Durability.COMMIT_SYNC);
      } else if (p.equalsIgnoreCase("COMMIT_WRITE_NO_SYNC")) {
        config.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
      } else {
        throw new DBException("Illegal value in durability property");
      }
    }

    int maxActiveRequests =
        getPropertyInt(properties, "requestLimit.maxActiveRequests",
            RequestLimitConfig.DEFAULT_MAX_ACTIVE_REQUESTS);
    int requestThresholdPercent =
        getPropertyInt(properties, "requestLimit.requestThresholdPercent",
            RequestLimitConfig.DEFAULT_REQUEST_THRESHOLD_PERCENT);
    int nodeLimitPercent =
        getPropertyInt(properties, "requestLimit.nodeLimitPercent",
            RequestLimitConfig.DEFAULT_NODE_LIMIT_PERCENT);
    RequestLimitConfig requestLimitConfig;
    /*
     * It is said that the constructor could throw NodeRequestLimitException in
     * Javadoc, the exception is not provided
     */
    // try {
    requestLimitConfig = new RequestLimitConfig(maxActiveRequests,
        requestThresholdPercent, nodeLimitPercent);
    // } catch (NodeRequestLimitException e) {
    // throw new DBException(e);
    // }
    config.setRequestLimit(requestLimitConfig);

    p = properties.getProperty("requestTimeout");
    if (p != null) {
      long timeout = 1;
      try {
        timeout = Long.parseLong(p);
      } catch (NumberFormatException e) {
        throw new DBException(
            "Illegal number format in requestTimeout property");
      }
      try {
        // TODO Support other TimeUnit
        config.setRequestTimeout(timeout, TimeUnit.SECONDS);
      } catch (IllegalArgumentException e) {
        throw new DBException(e);
      }
    }

    try {
      store = KVStoreFactory.getStore(config);
    } catch (FaultException e) {
      throw new DBException(e);
    }
  
<methods>public non-sealed void <init>() ,public void cleanup() throws site.ycsb.DBException,public abstract site.ycsb.Status delete(java.lang.String, java.lang.String) ,public java.util.Properties getProperties() ,public void init() throws site.ycsb.DBException,public abstract site.ycsb.Status insert(java.lang.String, java.lang.String, Map<java.lang.String,site.ycsb.ByteIterator>) ,public abstract site.ycsb.Status read(java.lang.String, java.lang.String, Set<java.lang.String>, Map<java.lang.String,site.ycsb.ByteIterator>) ,public abstract site.ycsb.Status scan(java.lang.String, java.lang.String, int, Set<java.lang.String>, Vector<HashMap<java.lang.String,site.ycsb.ByteIterator>>) ,public void setProperties(java.util.Properties) ,public abstract site.ycsb.Status update(java.lang.String, java.lang.String, Map<java.lang.String,site.ycsb.ByteIterator>) <variables>private java.util.Properties properties