finishCreatingInstance(id, description, factory);
}
private void finishCreatingInstance(String id, ConnectorDescription description,
ConnectorInstanceFactory factory) {
Connector serviceInstance = factory.createNewInstance(id.toString());
if (serviceInstance == null) {
throw new IllegalStateException("Factory cannot create a new service for instance id " + id.toString());
}
serviceInstance = factory.applyAttributes(serviceInstance, description.getAttributes());
if (!description.getAttributes().containsKey(Constants.SKIP_SET_DOMAIN_TYPE)) {
serviceInstance.setDomainId(description.getDomainType());
serviceInstance.setConnectorId(description.getConnectorType());
}
instances.put(id, serviceInstance);
doRegisterServiceInstance(id, description, serviceInstance);
}