Last change
on this file since 388 was
362,
checked in by sherbold, 13 years ago
|
- fixed help of command stopFileListener
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.3 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 | import de.ugoe.cs.util.console.FileOutputListener;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * <p>
|
---|
14 | * Command to stop a {@link FileOutputListener}.
|
---|
15 | * </p>
|
---|
16 | * @author Steffen Herbold
|
---|
17 | * @version 1.0
|
---|
18 | */
|
---|
19 | public class CMDstopFileListener implements Command {
|
---|
20 |
|
---|
21 | @Override
|
---|
22 | public void run(List<Object> parameters) {
|
---|
23 | String filename;
|
---|
24 | try {
|
---|
25 | filename = (String) parameters.get(0);
|
---|
26 | } catch (Exception e) {
|
---|
27 | throw new InvalidParameterException();
|
---|
28 | }
|
---|
29 |
|
---|
30 | Object dataObject = GlobalDataContainer.getInstance().getData(filename);
|
---|
31 | if( dataObject==null ) {
|
---|
32 | CommandHelpers.objectNotFoundMessage(filename);
|
---|
33 | return;
|
---|
34 | }
|
---|
35 | if( !(dataObject instanceof FileOutputListener) ) {
|
---|
36 | CommandHelpers.objectNotType(filename, "FileOutputListener");
|
---|
37 | return;
|
---|
38 | }
|
---|
39 |
|
---|
40 | FileOutputListener listener = (FileOutputListener) dataObject;
|
---|
41 | listener.stop();
|
---|
42 | GlobalDataContainer.getInstance().removeData(filename);
|
---|
43 | }
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public void help() {
|
---|
47 | Console.println("Command: stopFileListener <filename>");
|
---|
48 |
|
---|
49 | }
|
---|
50 |
|
---|
51 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.