Пример #1
0
  protected synchronized void initFromServiceDescriptor() throws InitialisationException {
    try {
      serviceDescriptor =
          ConnectorFactory.getServiceDescriptor(getProtocol().toLowerCase(), serviceOverrides);

      if (serviceDescriptor.getDispatcherFactory() != null) {
        logger.info("Loading DispatcherFactory: " + serviceDescriptor.getDispatcherFactory());
        dispatcherFactory = serviceDescriptor.createDispatcherFactory();
      }

      defaultInboundTransformer = serviceDescriptor.createInboundTransformer();
      defaultOutboundTransformer = serviceDescriptor.createOutboundTransformer();
      defaultResponseTransformer = serviceDescriptor.createResponseTransformer();

      sessionHandler = serviceDescriptor.createSessionHandler();
      // set any manager default properties for the connector
      // these are set on the Manager with a protocol i.e.
      // jms.specification=1.1
      // This provides a really convenient way to set properties on object form unit
      // tests
      Map props = new HashMap();
      PropertiesHelper.getPropertiesWithPrefix(
          MuleManager.getInstance().getProperties(), getProtocol().toLowerCase(), props);
      if (props.size() > 0) {
        props = PropertiesHelper.removeNamspaces(props);
        org.mule.util.BeanUtils.populateWithoutFail(this, props, true);
      }
    } catch (Exception e) {
      throw new InitialisationException(e, this);
    }
  }
Пример #2
0
  public ConnectorServiceDescriptor findService(String service, ConnectorServiceDescriptor csd)
      throws ConnectorFactoryException {
    Map finders = new TreeMap();
    PropertiesUtils.getPropertiesWithPrefix(csd.getProperties(), "finder.class", finders);

    StringBuffer buf = new StringBuffer();
    for (Iterator iterator = finders.entrySet().iterator(); iterator.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iterator.next();
      try {
        ClassUtils.loadClass(entry.getValue().toString(), getClass());
        String protocol = getProtocolFromKey(entry.getKey().toString());
        return ConnectorFactory.getServiceDescriptor(protocol);
      } catch (ClassNotFoundException e1) {
        buf.append(entry.getValue().toString())
            .append("(")
            .append(entry.getKey().toString())
            .append(")")
            .append(", ");
      }
    }
    throw new ConnectorServiceException(
        new Message(Messages.COULD_NOT_FIND_SOAP_PROVIDER_X, buf.toString()));
  }