|| !(externalService.getBindings().get(0) instanceof SystemBinding)) {
return;
}
SystemBinding binding = (SystemBinding)externalService.getBindings().get(0);
if (binding.getTargetName() != null) {
SystemExternalServiceContextFactory contextFactory = new SystemExternalServiceContextFactory(externalService
.getName(), new InterCompositeReferenceFactory(binding.getTargetName()));
externalService.setContextFactory(contextFactory);
} else if (externalService.getConfiguredService().getPort().getServiceContract().getInterface() != null) {
// autowire
Class<Object> claz = externalService.getConfiguredService().getPort().getServiceContract().getInterface();
if (claz == null) {
BuilderException e = new BuilderConfigException("Interface type not specified");
e.setIdentifier(externalService.getName());
e.addContextName(externalService.getName());
throw e;
}
SystemExternalServiceContextFactory config = new SystemExternalServiceContextFactory(externalService
.getName(), new AutowireObjectFactory<Object>(claz));
externalService.setContextFactory(config);
}
}