Package ef.impl.command.mkdir

Source Code of ef.impl.command.mkdir.MkDirCommand

package ef.impl.command.mkdir;

import ef.api.*;
import ef.impl.command.AbstractCommand;
import ef.impl.response.MapResponse;

import java.util.Arrays;

/**
* User: sduchenko
* Date: 23.04.13
* Time: 14:47
*/
public class MkDirCommand extends AbstractCommand<MkDirRequest> {

    public MkDirCommand(VolumeManager volumeManager) {
        super(volumeManager);
    }

    @Override
    public MkDirRequest buildRequest(SourceRequestReader requestReader) {
        MkDirRequest request = new MkDirRequest();
        request.target = requestReader.getRequiredString("target");
        request.name = requestReader.getRequiredString("name");
        return request;
    }

    @Override
    public Response execute(MkDirRequest request) {
        Volume volume = volumeManager.getRequiredVolume(request.target);
        FileEntry entry = volume.mkDir(request.target, request.name);
        MapResponse response = new MapResponse();
        response.put("added", Arrays.asList(entry));
        return response;
    }
}
TOP

Related Classes of ef.impl.command.mkdir.MkDirCommand

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.