OSDN Git Service

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