use of org.smartdata.model.CompressionFileState in project SSM by Intel-bigdata.
the class MetaStore method insertUpdateFileState.
public void insertUpdateFileState(FileState fileState) throws MetaStoreException {
try {
// Update corresponding tables according to the file state
fileStateDao.insertUpdate(fileState);
switch(fileState.getFileType()) {
case COMPACT:
CompactFileState compactFileState = (CompactFileState) fileState;
smallFileDao.insertUpdate(compactFileState);
break;
case COMPRESSION:
CompressionFileState compressionFileState = (CompressionFileState) fileState;
compressionFileDao.insertUpdate(compressionFileState);
break;
case S3:
break;
default:
}
} catch (Exception e) {
throw new MetaStoreException(e);
}
}
use of org.smartdata.model.CompressionFileState 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