WorkerResource workerResource = jpa.getWorker();
String hostName = descriptor.getType().getHostName();
if (isHostDescriptorExists(hostName)){
throw new DescriptorAlreadyExistsException(hostName);
}
HostDescriptorResource hostDescriptorResource = gateway.createHostDescriptorResource(hostName);
hostDescriptorResource.setUserName(workerResource.getUser());
hostDescriptorResource.setContent(descriptor.toXML());
hostDescriptorResource.save();
}
}