} catch (Exception e) {
throw new SwitchYardException(e);
}
requires.addAll(requiresImpl);
ServiceHandler handler = activator.activateService(service.getQName(), component);
Activation activation = new Activation(activator, component.getQName(), null, handler);
ServiceInterface serviceIntf = getComponentServiceInterface(service);
ServiceMetadata metadata = ServiceMetadataBuilder.create()
.security(getDomain().getServiceSecurity(service.getSecurity()))
.requiredPolicies(requires)
.registrant(impl)
.build();
Service svc = getDomain().registerService(service.getQName(), serviceIntf, handler, metadata);
activation.addService(svc);
activation.addReferences(references);
// register any service promotions
for (CompositeServiceModel compositeService : getConfig().getComposite().getServices()) {
ComponentServiceModel componentService = compositeService.getComponentService();
if (componentService != null && componentService.equals(service)) {
// avoid duplicates
if (!service.getQName().equals(compositeService.getQName())) {
validateServiceRegistration(compositeService.getQName());
Service promotedService = getDomain().registerService(
compositeService.getQName(), serviceIntf, handler, metadata);
activation.addPromotion(promotedService);
}
}
}
_components.add(activation);
handler.start();
} else {
// we don't have a distinct call for activateReference right now,
// so this catches cases where an implementation has one or more
// references, but no services. (this is pretty crappy)