class FileSystemTimelineReaderImpl extends AbstractService implements TimelineReader {

  @Override
  public TimelineEntity getEntity(TimelineReaderContext context,
      TimelineDataToRetrieve dataToRetrieve) throws IOException {
    String flowRunPath = getFlowRunPath(context.getUserId(),
        context.getClusterId(), context.getFlowName(), context.getFlowRunId(),
        context.getAppId());
    File dir = new File(new File(rootPath, ENTITIES_DIR),
        context.getClusterId() + File.separator + flowRunPath + File.separator +
        context.getAppId() + File.separator + context.getEntityType());
    File entityFile = new File(
        dir, context.getEntityId() + TIMELINE_SERVICE_STORAGE_EXTENSION);
    try (BufferedReader reader =
             new BufferedReader(new InputStreamReader(
                 new FileInputStream(entityFile), Charset.forName("UTF-8")))) {
      TimelineEntity entity = readEntityFromFile(reader);
      return createEntityToBeReturned(
          entity, dataToRetrieve.getFieldsToRetrieve());
    } catch (FileNotFoundException e) {
      LOG.info("Cannot find entity {id:" + context.getEntityId() + " , type:" +
          context.getEntityType() + "}. Will send HTTP 404 in response.");
      return null;
    }
  }

  public  FileSystemTimelineReaderImpl();

}