if (object instanceof EntryPoint) {
EntryPoint ep = (EntryPoint) object;
if (ep.getBindings().size() < 1 || !(ep.getBindings().get(0) instanceof FooBinding)) {
return;
}
EntryPointContextFactory contextFactory = new FooEntryPointContextFactory(ep.getName(), messageFactory);
ConfiguredService configuredService = ep.getConfiguredService();
Service service = configuredService.getPort();
SourceWireFactory wireFactory = wireFactoryService.createSourceFactory(ep.getConfiguredReference()).get(0);
contextFactory.addSourceWireFactory(service.getName(), wireFactory);
ep.setContextFactory(contextFactory);
} else if (object instanceof ExternalService) {
ExternalService es = (ExternalService) object;
if (es.getBindings().size() < 1 || !(es.getBindings().get(0) instanceof FooBinding)) {
return;
}
FooExternalServiceContextFactory contextFactory = new FooExternalServiceContextFactory(es.getName(),
new FooClientFactory());
ConfiguredService configuredService = es.getConfiguredService();
Service service = configuredService.getPort();
TargetWireFactory wireFactory = wireFactoryService.createTargetFactory(configuredService);
contextFactory.addTargetWireFactory(service.getName(), wireFactory);
es.setContextFactory(contextFactory);
}
}