Last change
on this file since 189 was
189,
checked in by sherbold, 13 years ago
|
+ added command deleteObject
|
-
Property svn:mime-type set to
text/plain
|
File size:
921 bytes
|
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.data.GlobalDataContainer;
|
---|
7 | import de.ugoe.cs.util.console.Command;
|
---|
8 | import 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 | */
|
---|
18 | public class CMDdeleteObject implements Command {
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public void help() {
|
---|
22 | Console.println("Usage: deleteObject <objectname>");
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public void run(List<Object> parameters) {
|
---|
27 | String objectName;
|
---|
28 | try {
|
---|
29 | objectName = (String) parameters.get(0);
|
---|
30 | } catch (Exception e) {
|
---|
31 | throw new InvalidParameterException();
|
---|
32 | }
|
---|
33 | boolean deleted = GlobalDataContainer.getInstance().removeData(objectName);
|
---|
34 | if( !deleted ) {
|
---|
35 | Console.println("Object not found in storage!");
|
---|
36 | }
|
---|
37 | }
|
---|
38 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.