*/
private DatabusRegistration findV2Registration(DatabusRequest request, String prefix) throws RequestProcessingException
{
String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
String registrationIdStr = category.substring(prefix.length());
RegistrationId regId = new RegistrationId(registrationIdStr);
Collection<DatabusRegistration> regs = _client.getAllRegistrations();
if (null != regs)
{
for (DatabusRegistration r : regs)
{
if (regId.equals(r.getRegistrationId()))
{
return r;
}
/**
* Important Note: There is an important implementation difference on which
* registrations are stored in the global registration data-structure maintained
* by the client (DatabusHttp[V3]ClientImpls) between V2 and V3.
*
* 1. In the case of V2, only top-level registrations are stored in the global
* data-structure (DatabusHttpClientImpl.regList 2. In the case of V3, all
* registrations are stored in the global data-structure.
*
* In the case of V3, this is needed so that all registrations can act on the
* relay external view change. This can be refactored in the future by moving the
* relay-external view change to registration impl ( reduce the complexity in
* ClientImpl ). The V2 implementation did not have this logic and was following a
* more intuitive structure of preserving the hierarchy. The below code handles
* the discrepancy for V2.
*/
if (r instanceof DatabusMultiPartitionRegistration)
{
Map<DbusPartitionInfo, DatabusRegistration> childRegs =
((DatabusMultiPartitionRegistration) r).getPartitionRegs();
for (Entry<DbusPartitionInfo, DatabusRegistration> e : childRegs.entrySet())
{
if (regId.equals(e.getValue().getRegistrationId()))
{
return e.getValue();
}
}
}