descriptorRegistry.updateApplicationDescriptor(serviceName, hostName, descriptor);
} else {
if (serviceName==null || hostName==null){
throw new InsufficientDataException("Service name or Host name cannot be null");
}
GatewayResource gateway = jpa.getGateway();
String applicationName = descriptor.getType().getApplicationName().getStringValue();
applicationName = createAppName(serviceName, hostName, applicationName);
if (!isApplicationDescriptorExists(serviceName,hostName,descriptor.getType().getApplicationName().getStringValue())){
throw new DescriptorDoesNotExistsException(applicationName);
}
ApplicationDescriptorResource serviceDescriptorResource = gateway.getApplicationDescriptorResource(applicationName);
serviceDescriptorResource.setContent(descriptor.toXML());
serviceDescriptorResource.save();
}
}