@Override
  public ServiceHandler activateService(QName serviceName, ComponentModel config) {

    if (LOG.isDebugEnabled()) {
      LOG.debug("Activate service: " + serviceName + " config=" + config);
    }

    BPELExchangeHandler handler =
        BPELExchangeHandlerFactory.instance().newBPELExchangeHandler(getServiceDomain());
    BPELComponentImplementationModel bciModel =
        (BPELComponentImplementationModel) config.getImplementation();
    ComponentServiceModel service = null;
    for (ComponentServiceModel csm : config.getServices()) {
      if (csm.getQName().equals(serviceName)) {
        service = csm;
        break;
      }
    }

    if (service.getInterface() == null) {
      throw new SwitchYardException("Interface not defined for component with BPEL implementation");
    }

    // take care of references
    for (ComponentReferenceModel crm : config.getReferences()) {
      _locator.addServiceDomain(crm.getQName(), getServiceDomain());
      _locator.initialiseReference(crm);
    }

    handler.init(serviceName, bciModel, service.getInterface().getInterface(), _engine, _config);

    _handlers.put(serviceName, handler);

    return handler;
  }
Beispiel #2
0
 private ComponentService getPromotedService(
     Application application, CompositeServiceModel compositeService) {
   ComponentServiceModel componentServiceModel = compositeService.getComponentService();
   if (componentServiceModel == null) {
     return null;
   }
   return application.getComponentService(componentServiceModel.getQName());
 }