Package ef.impl.command.tree

Source Code of ef.impl.command.tree.TreeCommand

package ef.impl.command.tree;

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

import java.util.List;

/**
* User: sduchenko
* Date: 23.04.13
* Time: 14:23
*/
public class TreeCommand extends AbstractCommand<TreeRequest> {

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

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

    @Override
    public Response execute(TreeRequest request) {
        Volume volume = volumeManager.getRequiredVolume(request.target);
        List<FileEntry> list = volume.tree (request.target);
        MapResponse response = new MapResponse();
        response.put("tree", list);
        return response;
    }
}
TOP

Related Classes of ef.impl.command.tree.TreeCommand

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.