Last change
on this file since 527 was
434,
checked in by sherbold, 12 years ago
|
- renamed packages to fit QUEST project structure
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.3 KB
|
Line | |
---|
1 | package de.ugoe.cs.quest.ui.commands;
|
---|
2 |
|
---|
3 | import java.security.InvalidParameterException;
|
---|
4 | import java.util.List;
|
---|
5 |
|
---|
6 | import de.ugoe.cs.quest.CommandHelpers;
|
---|
7 | import de.ugoe.cs.quest.ui.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.