aboutsummaryrefslogtreecommitdiffstats
path: root/tools/control/src/org/xenoserver/cmdline/ParseDomainDestroy.java
blob: d556275ecb37474d86879c412a48c2dd6a886c2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.xenoserver.cmdline;

import java.util.LinkedList;

import org.xenoserver.control.CommandDomainDestroy;
import org.xenoserver.control.CommandFailedException;
import org.xenoserver.control.Defaults;

public class ParseDomainDestroy extends CommandParser {
    public void parse(Defaults d, LinkedList args)
        throws ParseFailedException, CommandFailedException {
        int domain_id = getIntParameter(args, 'n', d.domainNumber);
        boolean force = getFlagParameter(args, 'f');

        if (domain_id == 0) {
            throw new ParseFailedException("Expected -n<domain_id>");
        }

        String output = new CommandDomainDestroy(d, domain_id, force).execute();
        if (output != null) {
            System.out.println(output);
        }
    }

    public String getName() {
        return "destroy";
    }

    public String getUsage() {
        return "[-n<domain_id>] [-f]";
    }

    public String getHelpText() {
        return "Destroy the specified domain.  -f forcibly destroys it.";
    }
}