import com.indexdata.pz2utils4jsf.config.Configuration;\r
import com.indexdata.pz2utils4jsf.config.ConfigurationReader;\r
import com.indexdata.pz2utils4jsf.errors.ConfigurationException;\r
+import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandReadOnly;\r
import com.indexdata.pz2utils4jsf.utils.Utils;\r
\r
@Named @SessionScoped \r
private Pazpar2ClientConfiguration cfg = null;\r
public static final String MODULENAME = "pz2client";\r
public static Map<String,String> DEFAULTS = new HashMap<String,String>();\r
+ Configuration config = null;\r
\r
static { \r
DEFAULTS.put("PROXY_MODE","1");\r
public void configure(ConfigurationReader configReader) throws ConfigurationException { \r
logger.info(Utils.objectId(this) + " is configuring using the provided " + Utils.objectId(configReader));\r
try {\r
- Configuration config = configReader.getConfiguration(this);\r
+ config = configReader.getConfiguration(this);\r
cfg = new Pazpar2ClientConfiguration(new ConfigurationGetter(config));\r
} catch (ProxyErrorException pe) {\r
logger.error("Could not configure Pazpar2 client: " + pe.getMessage());\r
}\r
\r
@Override\r
- public void setSearchCommand(Pazpar2Command command) {\r
+ public void setSearchCommand(CommandReadOnly command) {\r
ClientCommand clientCommand = new ClientCommand(command.getName(), command.getEncodedQueryString());\r
client.setSearchCommand(clientCommand); \r
}\r
\r
@Override\r
- public CommandResponse executeCommand(Pazpar2Command command, ByteArrayOutputStream baos) \r
+ public CommandResponse executeCommand(CommandReadOnly command, ByteArrayOutputStream baos) \r
throws Pazpar2ErrorException, IOException {\r
ClientCommand clientCommand = new ClientCommand(command.getName(), command.getEncodedQueryString());\r
Pazpar2HttpResponse pz2HttpResponse = client.executeCommand(clientCommand, baos);\r
doc.add(nl+ MODULENAME + " was configured to access Pazpar2 at : " + cfg.PAZPAR2_URL); \r
return new ArrayList<String>();\r
}\r
+ \r
+ public Configuration getConfiguration () {\r
+ return config;\r
+ }\r
\r
}\r