Пример #1
0
 /**
  * Gets a <code>UMOMessageAdapter</code> for the endpoint for the given message (data)
  *
  * @param message the data with which to initialise the <code>UMOMessageAdapter</code>
  * @return the <code>UMOMessageAdapter</code> for the endpoint
  * @throws org.mule.umo.MessagingException if the message parameter is not supported
  * @see org.mule.umo.provider.UMOMessageAdapter
  */
 public UMOMessageAdapter getMessageAdapter(Object message) throws MessagingException {
   try {
     return serviceDescriptor.createMessageAdapter(message);
   } catch (ConnectorServiceException e) {
     throw new MessagingException(
         new Message(Messages.FAILED_TO_CREATE_X, "Message Adapter"), message, e);
   }
 }
Пример #2
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);
    }
  }
Пример #3
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()));
  }