Package org.apache.hadoop.chukwa.util

Examples of org.apache.hadoop.chukwa.util.DatabaseWriter


    /*
     * find by timestamp
     */
    public static HadoopRpc find(String timestamp) {
  String cluster = getCluster();
  DatabaseWriter dbw = new DatabaseWriter(cluster);

  if (timestamp != null) {
      // get simple value
            try {
    String query = getSingleQuery(HadoopRpcHome.table,"timestamp",timestamp);
        ResultSet rs = dbw.query(query);
        if (rs.next()) {
        HadoopRpc obj = createHadoopRpc(rs);
        return obj;
    }
      } catch (Exception e) {
View Full Code Here


    /*
     * find by key
     */
    public static HadoopRpc find(String timestamp, String host) {
  String cluster = getCluster();
  DatabaseWriter dbw = new DatabaseWriter(cluster);

  if (timestamp != null) {
      // get simple value
            try {
    Map<String, String> criteriaMap = new HashMap<String,String>();
    criteriaMap.put("timestamp",convertLongToDateString(Long.parseLong(timestamp)));
    criteriaMap.put("host",host);

    String query = getCriteriaQuery(HadoopRpcHome.table,criteriaMap);
        ResultSet rs = dbw.query(query);
        if (rs.next()) {
        HadoopRpc obj = createHadoopRpc(rs);
        return obj;
    }
      } catch (Exception e) {
View Full Code Here

    /*
     * find within the start time and end time
     */
    public static Collection<HadoopRpc> findBetween(String starttime, String endtime) {
  String cluster = getCluster();
  DatabaseWriter dbw = new DatabaseWriter(cluster);

  Collection<HadoopRpc> collection = new Vector<HadoopRpc>();

  try {
      String query = getTimeBetweenQuery(HadoopRpcHome.table,starttime,endtime);     
      ResultSet rs = dbw.query(query);
      while (rs.next()) {
    HadoopRpc obj = createHadoopRpc(rs);
    collection.add(obj);
      }
  } catch (Exception e) {
View Full Code Here

    /*
     * find by timestamp
     */
    public static DfsThroughput find(String timestamp) {
  String cluster = getCluster();
  DatabaseWriter dbw = new DatabaseWriter(cluster);

  if (timestamp != null) {
      // get simple value
            try {
    String query = getSingleQuery(DfsThroughputHome.table,"timestamp",timestamp);
        ResultSet rs = dbw.query(query);
        if (rs.next()) {
        DfsThroughput obj = createDfsThroughput(rs);
        return obj;
    }
      } catch (Exception e) {
View Full Code Here

    /*
     * find by key
     */
    public static DfsThroughput find(String timestamp, String host) {
  String cluster = getCluster();
  DatabaseWriter dbw = new DatabaseWriter(cluster);

  if (timestamp != null) {
      // get simple value
            try {
    Map<String, String> criteriaMap = new HashMap<String,String>();
    criteriaMap.put("timestamp",convertLongToDateString(Long.parseLong(timestamp)));
    criteriaMap.put("host",host);

    String query = getCriteriaQuery(DfsThroughputHome.table,criteriaMap);
        ResultSet rs = dbw.query(query);
        if (rs.next()) {
        DfsThroughput obj = createDfsThroughput(rs);
        return obj;
    }
      } catch (Exception e) {
View Full Code Here

    /*
     * find within the start time and end time
     */
    public static Collection<DfsThroughput> findBetween(String starttime, String endtime) {
  String cluster = getCluster();
  DatabaseWriter dbw = new DatabaseWriter(cluster);

  Collection<DfsThroughput> collection = new Vector<DfsThroughput>();

  try {
      String query = getTimeBetweenQuery(DfsThroughputHome.table,starttime,endtime);     
      ResultSet rs = dbw.query(query);
      while (rs.next()) {
    DfsThroughput obj = createDfsThroughput(rs);
    collection.add(obj);
      }
  } catch (Exception e) {
View Full Code Here

    log.info("Aggregator started.");
    String cluster = System.getProperty("CLUSTER");
    if (cluster == null) {
      cluster = "unknown";
    }
    db = new DatabaseWriter(cluster);
    String queries = Aggregator.getContents(new File(System
        .getenv("CHUKWA_CONF_DIR")
        + File.separator + "aggregator.sql"));
    String[] query = queries.split("\n");
    while(startTime<=endTime) {
View Full Code Here

    /*
     * find by timestamp
     */
    public static SystemMetrics find(String timestamp) {
  String cluster = getCluster();
  DatabaseWriter dbw = new DatabaseWriter(cluster);

  if (timestamp != null) {
      // get simple value
            try {
    String query = getSingleQuery(SystemMetricsHome.table,"timestamp",timestamp);
        ResultSet rs = dbw.query(query);
        if (rs.next()) {
        SystemMetrics obj = createSystemMetrics(rs);
        return obj;
    }
      } catch (Exception e) {
View Full Code Here

    /*
     * find by key
     */
    public static SystemMetrics find(String timestamp, String host) {
  String cluster = getCluster();
  DatabaseWriter dbw = new DatabaseWriter(cluster);

  if (timestamp != null) {
      // get simple value
            try {
    Map<String, String> criteriaMap = new HashMap<String,String>();
    criteriaMap.put("timestamp",convertLongToDateString(Long.parseLong(timestamp)));
    criteriaMap.put("host",host);

    String query = getCriteriaQuery(SystemMetricsHome.table,criteriaMap);
        ResultSet rs = dbw.query(query);
        if (rs.next()) {
        SystemMetrics obj = createSystemMetrics(rs);
        return obj;
    }
      } catch (Exception e) {
View Full Code Here

    /*
     * find within the start time and end time
     */
    public static Collection<SystemMetrics> findBetween(String starttime, String endtime) {
  String cluster = getCluster();
  DatabaseWriter dbw = new DatabaseWriter(cluster);

  Collection<SystemMetrics> collection = new Vector<SystemMetrics>();

  try {
      String query = getTimeBetweenQuery(SystemMetricsHome.table,starttime,endtime);     
      ResultSet rs = dbw.query(query);
      while (rs.next()) {
    SystemMetrics obj = createSystemMetrics(rs);
    collection.add(obj);
      }
  } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.hadoop.chukwa.util.DatabaseWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.