001package com.astrolabsoftware.FinkBrowser.WebService;
002
003import com.Lomikel.Utils.DateTimeManagement;
004import com.Lomikel.WebService.HBaseColumnsProcessor;
005
006// Java
007import java.util.Map;
008
009// Log4J
010import org.apache.logging.log4j.Logger;
011import org.apache.logging.log4j.LogManager;
012
013/** <code>FinkHBaseColumnsProcessor</code>  extracts X-axes from rows for graphs
014  * @opt attributes
015  * @opt operations
016  * @opt types
017  * @opt visibility
018  * @author <a href="mailto:Julius.Hrivnac@cern.ch">J.Hrivnac</a> */
019public class FinkHBaseColumnsProcessor extends HBaseColumnsProcessor {
020  
021  /** Give the value of the X-axes (=Julian date) corresponding to one table row.
022    * @param entry One row of the table.
023    * @return      The derived value of x-axes. */
024  @Override
025  public String getTimestamp(Map<String, String> entry) {
026    String date = getDate(entry);
027    return Long.toString(DateTimeManagement.string2time(date, "yyyy MM dd HH:mm:ss.SSS"));
028    }
029  
030  /** Give the date (from Julian date) corresponding to one table row.
031    * @param entry One row of the table.
032    * @return      The date (may not correspond to the row timestamp). */
033  @Override
034  public String getDate(Map<String, String> entry) {
035    String days = entry.get("i:jd");
036    return DateTimeManagement.julianDate2String(Double.valueOf(days), "yyyy MM dd HH:mm:ss.SSS");
037    }
038
039  @Override
040  public String ra() {
041    return "i:ra";
042    }
043    
044  @Override
045  public String dec() {
046    return "i:dec";
047    }
048
049  /** Logging . */
050  private static Logger log = LogManager.getLogger(FinkHBaseColumnsProcessor.class);
051
052  }