Refactors commands and injection
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / state / Pazpar2State.java
index 0ac555e..b5b1d3e 100644 (file)
@@ -28,21 +28,23 @@ import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommands;
 public class Pazpar2State {\r
 \r
   String key = null;\r
-  Map<String,Pazpar2Command> commands = new HashMap<String,Pazpar2Command>();;\r
+  Map<String,Pazpar2Command> commands = new HashMap<String,Pazpar2Command>();  \r
 \r
-  public Pazpar2State (StateManager stateManager) {\r
-    commands.put(Pazpar2Commands.INIT,     new InitCommand(stateManager));\r
-    commands.put(Pazpar2Commands.PING,     new PingCommand(stateManager));\r
-    commands.put(Pazpar2Commands.SETTINGS, new SettingsCommand(stateManager));\r
-    commands.put(Pazpar2Commands.SEARCH,   new SearchCommand(stateManager));\r
-    commands.put(Pazpar2Commands.STAT,     new StatCommand(stateManager));\r
-    commands.put(Pazpar2Commands.SHOW,     new ShowCommand(stateManager));\r
-    commands.put(Pazpar2Commands.RECORD,   new RecordCommand(stateManager));\r
-    commands.put(Pazpar2Commands.TERMLIST, new TermlistCommand(stateManager));\r
-    commands.put(Pazpar2Commands.BYTARGET, new BytargetCommand(stateManager));  \r
+  public Pazpar2State () {\r
+    \r
+    commands.put(Pazpar2Commands.INIT,     new InitCommand());\r
+    commands.put(Pazpar2Commands.PING,     new PingCommand());\r
+    commands.put(Pazpar2Commands.SETTINGS, new SettingsCommand());\r
+    commands.put(Pazpar2Commands.SEARCH,   new SearchCommand());\r
+    commands.put(Pazpar2Commands.STAT,     new StatCommand());\r
+    commands.put(Pazpar2Commands.SHOW,     new ShowCommand());\r
+    commands.put(Pazpar2Commands.RECORD,   new RecordCommand());\r
+    commands.put(Pazpar2Commands.TERMLIST, new TermlistCommand());\r
+    commands.put(Pazpar2Commands.BYTARGET, new BytargetCommand());  \r
 \r
-    commands.put(ServiceProxyCommands.AUTH, new AuthCommand(stateManager));\r
-    commands.put(ServiceProxyCommands.CATEGORIES, new CategoriesCommand(stateManager));\r
+    commands.put(ServiceProxyCommands.AUTH, new AuthCommand());\r
+    commands.put(ServiceProxyCommands.CATEGORIES, new CategoriesCommand());\r
+    \r
     // key = "#1";\r
   }\r
     \r
@@ -58,7 +60,7 @@ public class Pazpar2State {
       this.commands.put(commandName, previousState.commands.get(commandName).copy());\r
     }\r
     this.commands.put(newCommand.getCommandName(),newCommand);\r
-    this.key = getKey();           \r
+    this.key = getKey();    \r
   }\r
     \r
   /**\r