示例#1
0
  private void initParams(List params) throws ClassNotFoundException {

    NamedParameter param;
    for (Iterator iterator = params.iterator(); iterator.hasNext(); ) {
      String s = (String) iterator.next();

      for (StringTokenizer tokenizer = new StringTokenizer(s, ";"); tokenizer.hasMoreTokens(); ) {
        String name = tokenizer.nextToken();
        String type = tokenizer.nextToken();
        if (name.equalsIgnoreCase("return")) {
          returnType = NamedParameter.createQName(type);
        } else if (name.equalsIgnoreCase("returnClass")) {
          returnClass = ClassHelper.loadClass(type, getClass());
        } else {
          String mode = tokenizer.nextToken();
          QName paramName = (QName) converter.convert(QName.class, name);
          QName qtype = null;
          if (type.startsWith("qname{")) {
            qtype = (QName) converter.convert(QName.class, name);
          } else {
            qtype = NamedParameter.createQName(type);
          }
          param = new NamedParameter(paramName, qtype, mode);
          addNamedParameter(param);
        }
      }
    }
  }
示例#2
0
  public static Object lookupObject(Context context, String reference) throws NamingException {
    Object ref = context.lookup(reference);
    if (ref instanceof Reference) {
      String className = ((Reference) ref).getClassName();
      try {

        ref = ClassHelper.loadClass(className, JmsTestUtils.class).newInstance();
      } catch (Exception e) {
        throw new NamingException(
            "Failed to instanciate class: " + className + ". Exception was: " + e.toString());
      }
    }
    return ref;
  }
示例#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 = ClassHelper.loadClass(serviceDescriptor.getMessageAdapter(), getClass());
    } catch (ClassNotFoundException e) {
      throw new InitialisationException(
          new Message(
              Messages.FAILED_LOAD_X, "Message Adapter: " + serviceDescriptor.getMessageAdapter()),
          e);
    }
  }
示例#4
0
  /** application entry point */
  public static void main(String[] args) {
    Server server = new Server();
    List opts = Arrays.asList(args);
    String config = null;

    if (opts.size() > 0) {
      config = getOption("-config", opts);
      if (config != null) {
        server.setConfigurationResources(config);
      }
    } else {
      URL configUrl = ClassHelper.getResource("mule-jbi.xml", org.mule.MuleServer.class);
      if (configUrl != null) {
        config = configUrl.toExternalForm();
        server.setConfigurationResources(config);
      }
    }

    if (config == null) {
      Message message = new Message(Messages.CONFIG_NOT_FOUND_USAGE);
      logger.fatal(message.toString());
      System.exit(0);
    }

    String builder = getOption("-builder", opts);
    if (builder != null) {
      try {
        configBuilder =
            (JbiContainerBuilder) ClassHelper.loadClass(builder, Server.class).newInstance();
      } catch (Exception e) {
        logger.fatal(new Message(Messages.FAILED_LOAD_X, "Builder: " + builder), e);
      }
    } else {
      // use this by default
      // try {
      configBuilder = new MuleXmlJbiContainerBuilder();
      //            } catch (ConfigurationException e) {
      //                logger.fatal(e.getMessage(), e);
      //                System.exit(0);
      //            }
    }

    server.start(false);
  }