Registry registry = null;
try {
registry = RegistryHolder.getInstance().getRegistry(tenantId);
} catch (RegistryException e) {
log.error("Error in getting registry for the tenant :" + tenantId ,e);
throw new BMConfigurationException("Error in getting registry for the tenant :"+tenantId ,e);
}
try {
brokerResource = registry.newResource();
Map<String, String> propertyMap = brokerConfiguration.getProperties();
brokerResource.addProperty("name", brokerConfiguration.getName());
brokerResource.addProperty("type", brokerConfiguration.getType());
for (Map.Entry<String, String> entry : propertyMap.entrySet()) {
brokerResource.addProperty(entry.getKey(), entry.getValue());
}
} catch (RegistryException e) {
if (log.isErrorEnabled()) {
log.error("Failed to create new resource in registry", e);
}
throw new BMConfigurationException("Failed to create new resource in registry", e);
}
try {
registry.put(pathToBroker, brokerResource);
} catch (RegistryException e) {
if (log.isErrorEnabled()) {
log.error("Failed to saveConfigurationToRegistry new resource in registry", e);
}
throw new BMConfigurationException("Failed to saveConfigurationToRegistry new resource in registry", e);
}
}