From: Niels Erik G. Nielsen Date: Sat, 19 Apr 2014 00:39:35 +0000 (-0400) Subject: Wiring of pazpar2 info command and response X-Git-Tag: v0.0.7~9 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=4a955f3133271ae793c1422d4a61327f7c149be9;p=mkjsf-moved-to-github.git Wiring of pazpar2 info command and response --- diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Commands.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Commands.java index b847e17..a5a346d 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Commands.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Commands.java @@ -45,6 +45,7 @@ public class Pazpar2Commands implements Serializable { public static final String RECORD = "record"; public static final String TERMLIST = "termlist"; public static final String BYTARGET = "bytarget"; + public static final String INFO = "info"; private ServiceProxyCommands sp = null; public Pazpar2Commands() { @@ -127,12 +128,20 @@ public class Pazpar2Commands implements Serializable { } /** + * + * @return info command from current state + */ + public InfoCommand getInfo () { + return (InfoCommand) (Pz2Service.get().getStateMgr().getCommand(INFO)); + } + + /** * Generically retrieves any command * * @param name name of command to retrieve * @return command of the given type */ - public Pazpar2Command getCommand(String name) { + public Pazpar2Command getCommand(String name) { return Pz2Service.get().getStateMgr().getCommand(name); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java index 90e7f8d..7790c6f 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java @@ -147,6 +147,10 @@ public class Responses implements Serializable { public ByTargetResponse getByTarget() { return ((ByTargetResponse) dataObjects.get("bytarget")); } + + public InfoResponse getInfo() { + return ((InfoResponse) dataObjects.get("info")); + } public ResponseDataObject getResponseObject (String name) { return dataObjects.get(name); diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/state/Pazpar2State.java b/src/main/java/com/indexdata/mkjsf/pazpar2/state/Pazpar2State.java index 50234e8..ffbfd8b 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/state/Pazpar2State.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/state/Pazpar2State.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; import com.indexdata.mkjsf.pazpar2.commands.BytargetCommand; +import com.indexdata.mkjsf.pazpar2.commands.InfoCommand; import com.indexdata.mkjsf.pazpar2.commands.InitCommand; import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command; import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Commands; @@ -41,6 +42,7 @@ public class Pazpar2State { commands.put(Pazpar2Commands.RECORD, new RecordCommand()); commands.put(Pazpar2Commands.TERMLIST, new TermlistCommand()); commands.put(Pazpar2Commands.BYTARGET, new BytargetCommand()); + commands.put(Pazpar2Commands.INFO, new InfoCommand()); commands.put(ServiceProxyCommands.AUTH, new AuthCommand()); commands.put(ServiceProxyCommands.CATEGORIES, new CategoriesCommand()); diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/state/StateManager.java b/src/main/java/com/indexdata/mkjsf/pazpar2/state/StateManager.java index 7616f1e..94141c1 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/state/StateManager.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/state/StateManager.java @@ -18,7 +18,8 @@ public class StateManager implements Serializable { Map states = new HashMap(); String currentKey = ""; - private static List allCommands = new ArrayList(Arrays.asList("init","ping","settings","search","stat","show","record","termlist","bytarget", + private static List allCommands = new ArrayList(Arrays.asList("init","ping","settings", + "search","stat","show","record","termlist","bytarget","info", /* SP extras */ "auth","categories")); Map pendingStateChanges = new HashMap(); private static Logger logger = Logger.getLogger(StateManager.class);