Rev | Line | |
---|
[189] | 1 | package de.ugoe.cs.eventbench.commands;
|
---|
| 2 |
|
---|
| 3 | import java.security.InvalidParameterException;
|
---|
| 4 | import java.util.List;
|
---|
| 5 |
|
---|
[240] | 6 | import de.ugoe.cs.eventbench.CommandHelpers;
|
---|
[189] | 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>
|
---|
[190] | 13 | * Command to delete object from {@link GlobalDataContainer}.
|
---|
[189] | 14 | * </p>
|
---|
| 15 | *
|
---|
| 16 | * @author Steffen Herbold
|
---|
| 17 | * @version 1.0
|
---|
| 18 | */
|
---|
| 19 | public class CMDdeleteObject implements Command {
|
---|
| 20 |
|
---|
[190] | 21 | /*
|
---|
| 22 | * (non-Javadoc)
|
---|
| 23 | *
|
---|
| 24 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
| 25 | */
|
---|
[189] | 26 | @Override
|
---|
| 27 | public void help() {
|
---|
| 28 | Console.println("Usage: deleteObject <objectname>");
|
---|
| 29 | }
|
---|
| 30 |
|
---|
[190] | 31 | /*
|
---|
| 32 | * (non-Javadoc)
|
---|
| 33 | *
|
---|
| 34 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
| 35 | */
|
---|
[189] | 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 | }
|
---|
[190] | 44 | boolean deleted = GlobalDataContainer.getInstance().removeData(
|
---|
| 45 | objectName);
|
---|
| 46 | if (!deleted) {
|
---|
[240] | 47 | CommandHelpers.objectNotFoundMessage(objectName);
|
---|
[189] | 48 | }
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.