source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDdeleteObject.java @ 304

Last change on this file since 304 was 240, checked in by sherbold, 13 years ago
  • Property svn:mime-type set to text/plain
File size: 1.1 KB
Line 
1package de.ugoe.cs.eventbench.commands;
2
3import java.security.InvalidParameterException;
4import java.util.List;
5
6import de.ugoe.cs.eventbench.CommandHelpers;
7import de.ugoe.cs.eventbench.data.GlobalDataContainer;
8import de.ugoe.cs.util.console.Command;
9import de.ugoe.cs.util.console.Console;
10
11/**
12 * <p>
13 * Command to delete object from {@link GlobalDataContainer}.
14 * </p>
15 *
16 * @author Steffen Herbold
17 * @version 1.0
18 */
19public class CMDdeleteObject implements Command {
20
21        /*
22         * (non-Javadoc)
23         *
24         * @see de.ugoe.cs.util.console.Command#help()
25         */
26        @Override
27        public void help() {
28                Console.println("Usage: deleteObject <objectname>");
29        }
30
31        /*
32         * (non-Javadoc)
33         *
34         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
35         */
36        @Override
37        public void run(List<Object> parameters) {
38                String objectName;
39                try {
40                        objectName = (String) parameters.get(0);
41                } catch (Exception e) {
42                        throw new InvalidParameterException();
43                }
44                boolean deleted = GlobalDataContainer.getInstance().removeData(
45                                objectName);
46                if (!deleted) {
47                        CommandHelpers.objectNotFoundMessage(objectName);
48                }
49        }
50}
Note: See TracBrowser for help on using the repository browser.