Пример #1
0
  // //@Override
  public ServiceDescriptor lookupServiceDescriptor(String type, String name, Properties overrides)
      throws ServiceException {
    try {
      // Get all services which match the interface.
      ServiceReference[] services;
      if (context != null) {
        services = context.getServiceReferences(TransportServiceDescriptor.class.getName(), null);
      } else {
        throw new InitialisationException(
            Message.createStaticMessage("BundleContext has not been set for Manager."), this);
      }

      // Match the service by name.
      String servicePid;
      for (int i = 0; i < services.length; ++i) {
        servicePid = (String) services[i].getProperty(Constants.SERVICE_PID);
        if (servicePid != null && servicePid.endsWith(name)) {
          return (ServiceDescriptor) context.getService(services[i]);
        }
      }
      return null;
    } catch (Exception e) {
      throw new ServiceException(
          Message.createStaticMessage("Exception while looking up the service descriptor."), e);
    }
  }
Пример #2
0
  public Object onCall(UMOEventContext context) throws Exception {
    String contents = context.getTransformedMessageAsString();
    String msg =
        StringMessageUtils.getBoilerPlate(
            "Message Received in component: "
                + context.getComponentDescriptor().getName()
                + ". Content is: "
                + StringMessageUtils.truncate(contents, 100, true),
            '*',
            80);

    logger.info(msg);

    if (eventCallback != null) {
      eventCallback.eventReceived(context, this);
    }

    Object replyMessage;
    if (returnMessage != null) {
      replyMessage = returnMessage;
    } else {
      replyMessage =
          contents
              + " Received"
              + (appendComponentName ? " " + context.getComponentDescriptor().getName() : "");
    }

    MuleManager.getInstance()
        .fireNotification(
            new FunctionalTestNotification(
                context, replyMessage, FunctionalTestNotification.EVENT_RECEIVED));

    if (throwException) {
      throw new MuleException(Message.createStaticMessage("Functional Test Component Exception"));
    }

    return replyMessage;
  }
Пример #3
0
 public MuleException(String message) {
   this(Message.createStaticMessage(message));
 }
Пример #4
0
 public MuleException(String message, Throwable cause) {
   this(Message.createStaticMessage(message), cause);
 }
Пример #5
0
 /**
  * @param message
  * @param cause
  */
 public FatalException(String message, Throwable cause) {
   super(Message.createStaticMessage(message), cause);
 }