source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDload.java @ 244

Last change on this file since 244 was 241, checked in by sherbold, 13 years ago
  • some changes to command parameter orders
  • removed command printRandomSesssion
  • renamed command loadSessionsFromClickstream do loadWebSequences
  • Property svn:mime-type set to text/plain
File size: 1.3 KB
Line 
1package de.ugoe.cs.eventbench.commands;
2
3import java.io.FileInputStream;
4import java.io.IOException;
5import java.io.ObjectInputStream;
6import java.security.InvalidParameterException;
7import java.util.List;
8
9import de.ugoe.cs.eventbench.data.GlobalDataContainer;
10import de.ugoe.cs.util.console.Command;
11import de.ugoe.cs.util.console.Console;
12
13/**
14 * <p>
15 * Command that loads a previously serialized {@link GlobalDataContainer}.
16 * </p>
17 *
18 * @author Steffen Herbold
19 * @version 1.0
20 */
21public class CMDload implements Command {
22
23        /*
24         * (non-Javadoc)
25         *
26         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
27         */
28        @Override
29        public void run(List<Object> parameters) {
30                String filename;
31                try {
32                        filename = (String) parameters.get(0);
33                } catch (Exception e) {
34                        throw new InvalidParameterException();
35                }
36
37                FileInputStream fis = null;
38                ObjectInputStream in = null;
39                try {
40                        fis = new FileInputStream(filename);
41                        in = new ObjectInputStream(fis);
42                        in.readObject();
43                        in.close();
44                } catch (IOException ex) {
45                        Console.logException(ex);
46                } catch (ClassNotFoundException ex) {
47                        Console.logException(ex);
48                }
49        }
50
51        /*
52         * (non-Javadoc)
53         *
54         * @see de.ugoe.cs.util.console.Command#help()
55         */
56        @Override
57        public void help() {
58                Console.println("Usage: load <filename>");
59        }
60
61}
Note: See TracBrowser for help on using the repository browser.