Example #1
0
 static {
   try {
     consumableClasses.add(
         ClassUtils.loadClass("javax.xml.stream.XMLStreamReader", DefaultMuleMessage.class));
   } catch (ClassNotFoundException e) {
   }
 }
Example #2
0
 protected Class loadClass(String name) {
   String c = name.replace("/", ".");
   try {
     return ClassUtils.loadClass(c, classLoader);
   } catch (ClassNotFoundException e) {
     if (logger.isWarnEnabled()) {
       logger.warn(String.format("%s : %s", c, e.toString()));
     }
     return null;
   }
 }
Example #3
0
  /*
   * (non-Javadoc)
   *
   * @see org.mule.providers.AbstractConnector#create()
   */
  public void doInitialise() throws InitialisationException {
    super.doInitialise();
    if (queueEvents) {
      if (queueProfile == null) {
        queueProfile = MuleManager.getConfiguration().getQueueProfile();
      }
    }

    try {
      adapterClass = ClassUtils.loadClass(serviceDescriptor.getMessageAdapter(), getClass());
    } catch (ClassNotFoundException e) {
      throw new InitialisationException(
          new Message(
              Messages.FAILED_LOAD_X, "Message Adapter: " + serviceDescriptor.getMessageAdapter()),
          e);
    }
  }
Example #4
0
 public static Class getErrorClass(int code) {
   String key = String.valueOf(code);
   Object clazz = reverseErrorCodes.get(key);
   if (clazz == null) {
     return null;
   } else if (clazz instanceof Class) {
     return (Class) clazz;
   } else {
     try {
       clazz = ClassUtils.loadClass(clazz.toString(), ExceptionHelper.class);
     } catch (ClassNotFoundException e) {
       logger.error(e.getMessage(), e);
       return null;
     }
     reverseErrorCodes.put(key, clazz);
     return (Class) clazz;
   }
 }
Example #5
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()));
  }