Last change
on this file since 348 was
240,
checked in by sherbold, 13 years ago
|
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.1 KB
|
Line | |
---|
1 | package de.ugoe.cs.eventbench.commands;
|
---|
2 |
|
---|
3 | import java.security.InvalidParameterException;
|
---|
4 | import java.util.List;
|
---|
5 |
|
---|
6 | import de.ugoe.cs.eventbench.CommandHelpers;
|
---|
7 | import de.ugoe.cs.eventbench.data.GlobalDataContainer;
|
---|
8 | import de.ugoe.cs.util.console.Command;
|
---|
9 | import 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 | */
|
---|
19 | public 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.