SecurityMasterRequestMessage secMasterRequest = SecurityMasterRequestMessage.fromFudgeMsg(new FudgeDeserializer(_fudgeContext), requestFudgeMsg);
MessageType messageType = secMasterRequest.getMessageType();
String secDes = secMasterRequest.getUniqueId() != null ? secMasterRequest.getUniqueId().getValue() : secMasterRequest.getSecKey().toString();
s_logger.debug("Received {} request for {} ", new Object[] {secMasterRequest.getMessageType(), secDes });
Security sec = null;
SecurityMasterResponseMessage responseMessage = new SecurityMasterResponseMessage();
switch (messageType) {
case GET_SECURITIES_BY_KEY:
Collection<? extends Security> securities = _securitySource.get(secMasterRequest.getSecKey());
responseMessage.setSecurities(Collections.unmodifiableCollection(securities));
break;
case GET_SECURITY_BY_KEY:
sec = _securitySource.getSingle(secMasterRequest.getSecKey());
responseMessage.setSecurity(sec);
break;
case GET_SECURITY_BY_IDENTITY:
sec = _securitySource.get(secMasterRequest.getUniqueId());
responseMessage.setSecurity(sec);
break;
default:
s_logger.warn("Unsupported SecurityMasterRequest {}", messageType);
throw new OpenGammaRuntimeException("Unsupported SecurityMasterRequest");
}