OSDN Git Service

de8e71c8a50a26cedb8328e3930cac51d41e1d9c
[stigmata/stigmata.git] / src / main / java / jp / sourceforge / stigmata / command / StigmataCommandFactory.java
1 package jp.sourceforge.stigmata.command;
2
3 /*
4  * $Id$
5  */
6
7 import java.util.HashMap;
8 import java.util.Map;
9
10 import jp.sourceforge.stigmata.StigmataCommand;
11
12 /**
13  * 
14  * @author Haruaki Tamada
15  */
16 public class StigmataCommandFactory{
17     private static final StigmataCommandFactory factory = new StigmataCommandFactory();
18     private Map<String, StigmataCommand> commands = new HashMap<String, StigmataCommand>();
19
20     private StigmataCommandFactory(){
21         commands.put("compare", new CompareCommand());
22         commands.put("export-config", new ExportConfigCommand());
23         commands.put("extract", new ExtractCommand());
24         commands.put("gui", new GuiCommand());
25         commands.put("install", new InstallCommand());
26         commands.put("license", new LicenseCommand());
27         commands.put("list-birthmarks", new ListBirthmarksCommand());
28         /* this command is not supported in Windows OS.
29          * Deletion/Renaming is failed because plugin file is locked by system.
30          * commands.put("uninstall", new UninstallCommand());
31          */
32         commands.put("version", new VersionCommand());
33     }
34
35     public void registerCommand(String commandString, StigmataCommand command){
36         commands.put(commandString, command);
37     }
38
39     public static StigmataCommandFactory getInstance(){
40         return factory;
41     }
42
43     public StigmataCommand getCommand(String command){
44         return commands.get(command);
45     }
46 }