public static DatasetPath analyze(String fullPath){
  assert _layoutsInfo != null;
  assert _filePattherns != null;
  DatasetPath datasetPath=new DatasetPath();
  datasetPath.fullPath=fullPath;
  Pattern headerPattern=Pattern.compile("hdfs://.*:\\d{4}(/.*)");
  Matcher headerMatcher=headerPattern.matcher(fullPath);
  if (headerMatcher.matches()) {
    fullPath=headerMatcher.group(1);
  }
  if (fullPath.startsWith("/tmp/")) {
    return null;
  }
  for (  String filePattern : _filePattherns) {
    Pattern p=Pattern.compile(filePattern);
    Matcher m=p.matcher(fullPath);
    if (m.matches()) {
      fullPath=m.group(1);
    }
  }
  for (  Layout layoutRecord : _layoutsInfo) {
    Pattern p=Pattern.compile(layoutRecord.regex);
    Matcher m=p.matcher(fullPath);
    if (m.matches()) {
      datasetPath.abstractPath=m.group(layoutRecord.leadingPathIndex);
      datasetPath.layoutId=layoutRecord.layoutId;
      datasetPath.partitionStart=m.group(layoutRecord.partitionIndex);
      datasetPath.partitionEnd=m.group(layoutRecord.partitionIndex);
      datasetPath.partitionType=layoutRecord.partitionPatternGroup;
      break;
    }
  }
  Pattern tcpHeaderPattern=Pattern.compile("tcp://.*:\\d{5}/(.*)");
  Matcher tcpheaderMatcher=tcpHeaderPattern.matcher(fullPath);
  if (tcpheaderMatcher.matches()) {
    datasetPath.abstractPath=tcpheaderMatcher.group(1);
  }
  if (datasetPath.abstractPath == null) {
    datasetPath.abstractPath=fullPath;
  }
  return datasetPath;
}

public static DatasetPath analyze ( String fullPath ) { assert _layoutsInfo != null ; assert _filePattherns != null ; DatasetPath datasetPath = new DatasetPath ( ) ; datasetPath . fullPath = fullPath ; Pattern headerPattern = Pattern . compile ( "hdfs://.*:\\d{4}(/.*)" ) ; Matcher headerMatcher = headerPattern . matcher ( fullPath ) ; if ( headerMatcher . matches ( ) ) { fullPath = headerMatcher . group ( 1 ) ; } if ( fullPath . startsWith ( "/tmp/" ) ) { return null ; } for ( String filePattern : _filePattherns ) { Pattern p = Pattern . compile ( filePattern ) ; Matcher m = p . matcher ( fullPath ) ; if ( m . matches ( ) ) { fullPath = m . group ( 1 ) ; } } for ( Layout layoutRecord : _layoutsInfo ) { Pattern p = Pattern . compile ( layoutRecord . regex ) ; Matcher m = p . matcher ( fullPath ) ; if ( m . matches ( ) ) { datasetPath . abstractPath = m . group ( layoutRecord . leadingPathIndex ) ; datasetPath . layoutId = layoutRecord . layoutId ; datasetPath . partitionStart = m . group ( layoutRecord . partitionIndex ) ; datasetPath . partitionEnd = m . group ( layoutRecord . partitionIndex ) ; datasetPath . partitionType = layoutRecord . partitionPatternGroup ; break ; } } Pattern tcpHeaderPattern = Pattern . compile ( "tcp://.*:\\d{5}/(.*)" ) ; Matcher tcpheaderMatcher = tcpHeaderPattern . matcher ( fullPath ) ; if ( tcpheaderMatcher . matches ( ) ) { datasetPath . abstractPath = tcpheaderMatcher . group ( 1 ) ; } if ( datasetPath . abstractPath == null ) { datasetPath . abstractPath = fullPath ; } return datasetPath ; }
analyze the path and extract the abstract level info from path .
