Search in sources :

Example 1 with AbstractMoveFileAction

use of org.smartdata.hdfs.action.move.AbstractMoveFileAction in project SSM by Intel-bigdata.

the class CmdletManager method updateStorageIfNeeded.

// Todo: remove this implementation
private void updateStorageIfNeeded(ActionInfo info) throws ActionException {
    SmartAction action = ActionRegistry.createAction(info.getActionName());
    if (action instanceof AbstractMoveFileAction) {
        String policy = ((AbstractMoveFileAction) action).getStoragePolicy();
        Map<String, String> args = info.getArgs();
        if (policy == null) {
            policy = args.get(AbstractMoveFileAction.STORAGE_POLICY);
        }
        String path = args.get(AbstractMoveFileAction.FILE_PATH);
        try {
            String result = info.getResult();
            result = result == null ? "" : result;
            if (!result.contains("UpdateStoragePolicy=false")) {
                metaStore.updateFileStoragePolicy(path, policy);
            }
        } catch (MetaStoreException e) {
            LOG.error("Failed to update storage policy {} for file {}", policy, path, e);
        }
    }
}
Also used : AbstractMoveFileAction(org.smartdata.hdfs.action.move.AbstractMoveFileAction) MetaStoreException(org.smartdata.metastore.MetaStoreException) SmartAction(org.smartdata.action.SmartAction)

Aggregations

SmartAction (org.smartdata.action.SmartAction)1 AbstractMoveFileAction (org.smartdata.hdfs.action.move.AbstractMoveFileAction)1 MetaStoreException (org.smartdata.metastore.MetaStoreException)1