All Downloads are FREE. Search and download functionalities are using the official Maven repository.

vagrant.impl.cli.parser.AllStatusParser Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
package vagrant.impl.cli.parser;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;

import vagrant.api.domain.Machine;

public class AllStatusParser implements CliParser> {
    private File path;
    public AllStatusParser(File path) {
        this.path = path;
    }


    @Override
    public Collection parse(String out) {
        Collection> parsed = new CvsParser().parse(out);
        Collection ret = new ArrayList();
        MachineStateParser stateParser = new MachineStateParser();
        for (Map m : parsed) {
            String name = m.get("machine");
            String state = m.get("state");
            if (name == null || state == null) continue; // skip metadata, ui
            Machine machine = new Machine();
            machine.setId(path.getName() + "/" + name);
            machine.setName(name);
            machine.setStatus(stateParser.parse(state));
            machine.setPath(path);
            ret.add(machine);
        }
        return ret;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy