//availableServiceBinding.getServiceDefinitions().add(serviceDefinition);
}
serviceBinding.setServiceDefinition((ServiceDefinitionImpl)serviceDefinition);
AvailableServiceBinding originalAvailableServiceBinding = serviceBinding.getAvailableServiceBinding();
String availableServiceBindingName = originalAvailableServiceBinding.getName();
logger.info("availableServiceBindingName:" + availableServiceBindingName);
logger.info("readAvailableServiceBindings:" + readAvailableServiceBindings.size() + ":" + readAvailableServiceBindings.containsKey(availableServiceBindingName));
AvailableServiceBinding availableServiceBinding = (AvailableServiceBinding)readAvailableServiceBindings.get(availableServiceBindingName);
logger.info("availableServiceBinding:" + availableServiceBinding);
if(availableServiceBinding == null)
{
availableServiceBinding = AvailableServiceBindingController.getController().getAvailableServiceBindingWithName(availableServiceBindingName, db, false);
logger.info("Read availableServiceBinding from database:" + availableServiceBindingName + "=" + availableServiceBinding);
readAvailableServiceBindings.put(availableServiceBindingName, availableServiceBinding);
logger.info("readAvailableServiceBindings:" + readAvailableServiceBindings.size() + ":" + readAvailableServiceBindings.containsKey(availableServiceBindingName));
}
if(availableServiceBinding == null)
{
logger.info("There was no availableServiceBinding registered under:" + availableServiceBindingName);
logger.info("originalAvailableServiceBinding:" + originalAvailableServiceBinding.getName() + ":" + originalAvailableServiceBinding.getIsInheritable());
db.create(originalAvailableServiceBinding);
availableServiceBinding = originalAvailableServiceBinding;
readAvailableServiceBindings.put(availableServiceBindingName, availableServiceBinding);
logger.info("Notifying:" + siteNodeTypeDefinition.getName() + " about the new availableServiceBinding " + availableServiceBinding.getName());
if(siteNodeTypeDefinition != null)
{
siteNodeTypeDefinition.getAvailableServiceBindings().add((AvailableServiceBindingImpl)availableServiceBinding);
serviceDefinition.getAvailableServiceBindings().add((AvailableServiceBindingImpl)availableServiceBinding);
availableServiceBinding.getSiteNodeTypeDefinitions().add((SiteNodeTypeDefinitionImpl)siteNodeTypeDefinition);
availableServiceBinding.getServiceDefinitions().add((ServiceDefinitionImpl)serviceDefinition);
}
}
else
{
if(siteNodeTypeDefinition != null && !siteNodeTypeDefinition.getAvailableServiceBindings().contains(availableServiceBinding))
{
siteNodeTypeDefinition.getAvailableServiceBindings().add((AvailableServiceBindingImpl)availableServiceBinding);
availableServiceBinding.getSiteNodeTypeDefinitions().add(siteNodeTypeDefinition);
}
}
serviceBinding.setAvailableServiceBinding((AvailableServiceBindingImpl)availableServiceBinding);