public static void execute(FileSystem hdfs, String baseUrl, String baseName, String tmpSuffix)
    {
        String baseRealUrl = baseUrl;

        if (baseRealUrl.endsWith("/") == false)
        {
            baseRealUrl = baseRealUrl + "/";
        }

        String targetPattern = baseRealUrl + baseName + "[0-9]*" + tmpSuffix + "*";
        Path targetPathPattern = new Path(targetPattern);

        FileStatus[] targetTmpFiles = null;

        try
        {
            targetTmpFiles = hdfs.globStatus(targetPathPattern);
        }
        catch (IOException ioex)
        {
            logger.warn("Failed to search preprocess target files. Skip preprocess.", ioex);
            return;
        }

        if (targetTmpFiles.length == 0)
        {
            String logFormat = "Preprocess target files not exist. Path={0}";
            String logMessage = MessageFormat.format(logFormat, targetPattern);
            logger.info(logMessage);
            return;
        }

        if (logger.isInfoEnabled() == true)
        {
            printTargetPathList(targetTmpFiles);
        }

        for (FileStatus targetTmpFile : targetTmpFiles)
        {
            renameTmpFile(hdfs, targetTmpFile.getPath().toString(), tmpSuffix);
        }

    }
public static void execute ( FileSystem hdfs , String baseUrl , String baseName , String tmpSuffix ) { String baseRealUrl = baseUrl ; if ( baseRealUrl . endsWith ( "/" ) == false ) { baseRealUrl = baseRealUrl + "/" ; } String targetPattern = baseRealUrl + baseName + "[0-9]*" + tmpSuffix + "*" ; Path targetPathPattern = new Path ( targetPattern ) ; FileStatus [ ] targetTmpFiles = null ; try { targetTmpFiles = hdfs . globStatus ( targetPathPattern ) ; } catch ( IOException ioex ) { logger . warn ( "Failed to search preprocess target files. Skip preprocess." , ioex ) ; return ; } if ( targetTmpFiles . length == 0 ) { String logFormat = "Preprocess target files not exist. Path={0}" ; String logMessage = MessageFormat . format ( logFormat , targetPattern ) ; logger . info ( logMessage ) ; return ; } if ( logger . isInfoEnabled ( ) == true ) { printTargetPathList ( targetTmpFiles ) ; } for ( FileStatus targetTmpFile : targetTmpFiles ) { renameTmpFile ( hdfs , targetTmpFile . getPath ( ) . toString ( ) , tmpSuffix ) ; } }
HDFSSink起動時の前処理を行う。<br>
末尾に一時ファイル名称パターンを持ち、かつリネーム先にファイルが存在しない場合リネームを行う。

@param hdfs ファイルシステム
@param baseUrl ベースURL
@param baseName ベース名称
@param tmpSuffix 一時ファイル名称パターン