vnsHost = "localhost"; // default for local deployment
vnsPort = ""; // intialize
try {
vnsPort = String.valueOf(vns.getPort());
} catch (Exception e) {
throw new ResourceConfigurationException(e);
}
} else {
// try to retrieve VNS location (host and port) from the service descriptor. If not found,
// try to find the settings in the following order:
// 1) check CPE descriptor settings (in <deploymentParameters>)
// 2) check System property (set via -D on the command line)
// 3) use defaults ( VNS_HOST=localhost and VNS_PORT=9000)
if (vnsHost == null) {
vnsHost = getVNSSettingFor("VNS_HOST", aCasProcessorConfig, "localhost");
}
if (vnsPort == null) {
vnsPort = getVNSSettingFor("VNS_PORT", aCasProcessorConfig, "9000");
}
}
// Get the max timeout the CPE will wait for response from the Cas Processor
long timeout = aCasProcessorConfig.getTimeout();
String[] keysToDrop = aCasProcessorConfig.getKeysToDrop();
if (keysToDrop != null) {
tap.setKeys2Drop(keysToDrop);
}
// Configure the proxy with VNS settings and timeout
tap.setVNSHost(vnsHost);
tap.setVNSPort(vnsPort);
tap.setTimeout((int) timeout);
String timerClass = "";
try {
timerClass = cpeFactory.getCPEConfig().getTimerImpl();
} catch (Exception e) {
// ignore. Use defa1ult
}
if (timerClass != null) {
try {
tap.setTimer(CPMUtils.getTimer(cpeFactory.getCPEConfig().getCpeTimer().get()));
} catch (Exception e) {
e.printStackTrace();
throw new ResourceConfigurationException(e);
}
}
return tap;
}