Search in sources :

Example 1 with S3FileStateProto

use of org.smartdata.protocol.ClientServerProto.S3FileStateProto in project SSM by Intel-bigdata.

the class ProtoBufferHelper method convert.

public static FileState convert(FileStateProto proto) {
    FileState fileState = null;
    String path = proto.getPath();
    FileState.FileType type = FileState.FileType.fromValue(proto.getType());
    FileState.FileStage stage = FileState.FileStage.fromValue(proto.getStage());
    // FileState.FileStage stage = FileState.FileStage.fromValue(proto.getStage());
    if (type == null) {
        return new NormalFileState(path);
    }
    switch(type) {
        case NORMAL:
            fileState = new NormalFileState(path);
            break;
        case COMPACT:
            CompactFileStateProto compactProto = proto.getCompactFileState();
            fileState = new CompactFileState(path, convert(compactProto));
            break;
        case COMPRESSION:
            CompressionFileStateProto compressionProto = proto.getCompressionFileState();
            // convert to CompressionFileState
            fileState = convert(path, stage, compressionProto);
            break;
        case S3:
            S3FileStateProto s3Proto = proto.getS3FileState();
            // fileState = convert(path, type, stage, s3Proto);
            break;
        default:
    }
    return fileState;
}
Also used : CompressionFileStateProto(org.smartdata.protocol.ClientServerProto.CompressionFileStateProto) NormalFileState(org.smartdata.model.NormalFileState) CompactFileState(org.smartdata.model.CompactFileState) FileState(org.smartdata.model.FileState) CompressionFileState(org.smartdata.model.CompressionFileState) NormalFileState(org.smartdata.model.NormalFileState) CompactFileStateProto(org.smartdata.protocol.ClientServerProto.CompactFileStateProto) S3FileStateProto(org.smartdata.protocol.ClientServerProto.S3FileStateProto) CompactFileState(org.smartdata.model.CompactFileState)

Aggregations

CompactFileState (org.smartdata.model.CompactFileState)1 CompressionFileState (org.smartdata.model.CompressionFileState)1 FileState (org.smartdata.model.FileState)1 NormalFileState (org.smartdata.model.NormalFileState)1 CompactFileStateProto (org.smartdata.protocol.ClientServerProto.CompactFileStateProto)1 CompressionFileStateProto (org.smartdata.protocol.ClientServerProto.CompressionFileStateProto)1 S3FileStateProto (org.smartdata.protocol.ClientServerProto.S3FileStateProto)1