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

Last change on this file since 233 was 190, checked in by sherbold, 13 years ago
  • code documentation and formatting
  • 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.data.GlobalDataContainer;
7import de.ugoe.cs.util.console.Command;
8import de.ugoe.cs.util.console.Console;
9
10/**
11 * <p>
12 * Command to delete object from {@link GlobalDataContainer}.
13 * </p>
14 *
15 * @author Steffen Herbold
16 * @version 1.0
17 */
18public class CMDdeleteObject implements Command {
19
20        /*
21         * (non-Javadoc)
22         *
23         * @see de.ugoe.cs.util.console.Command#help()
24         */
25        @Override
26        public void help() {
27                Console.println("Usage: deleteObject <objectname>");
28        }
29
30        /*
31         * (non-Javadoc)
32         *
33         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
34         */
35        @Override
36        public void run(List<Object> parameters) {
37                String objectName;
38                try {
39                        objectName = (String) parameters.get(0);
40                } catch (Exception e) {
41                        throw new InvalidParameterException();
42                }
43                boolean deleted = GlobalDataContainer.getInstance().removeData(
44                                objectName);
45                if (!deleted) {
46                        Console.println("Object not found in storage!");
47                }
48        }
49}
Note: See TracBrowser for help on using the repository browser.