use of org.smartdata.model.NormalFileState in project SSM by Intel-bigdata.
the class MetaStore method getFileState.
/**
* Get FileState of the given path.
*
* @param path
* @return
* @throws MetaStoreException
*/
public FileState getFileState(String path) throws MetaStoreException {
FileState fileState;
try {
fileState = fileStateDao.getByPath(path);
// Fetch info from corresponding table to regenerate a specific file state
switch(fileState.getFileType()) {
case NORMAL:
fileState = new NormalFileState(path);
break;
case COMPACT:
fileState = smallFileDao.getFileStateByPath(path);
break;
case COMPRESSION:
CompressionFileState compressionFileState = getCompressionInfo(path);
if (compressionFileState != null) {
compressionFileState.setFileStage(fileState.getFileStage());
fileState = compressionFileState;
}
break;
case S3:
fileState = new S3FileState(path);
break;
default:
}
} catch (EmptyResultDataAccessException e1) {
fileState = new NormalFileState(path);
} catch (Exception e2) {
throw new MetaStoreException(e2);
}
return fileState;
}
Aggregations