Examples of Message


Examples of com.google.sitebricks.i18n.Message

  private void bindMessages(Localization localization) {
    Class<?> iface = localization.clazz;
    Map<String, MessageDescriptor> messages = Maps.newHashMap();

    for (Method method : iface.getMethods()) {
      Message message = method.getAnnotation(Message.class);

      check(null != message,
          "Found an i18n interface method missing @Message annotation: ", iface, method);

      if (null != message) {
        check(!Strings.empty(message.message()),
            "Empty @Message annotation is not allowed ", iface, method);
      }

      String template = localization.messageBundle.get(method.getName());
      check(null != template,
          "Provided resource bundle does not contain a localization for message: ", iface, method);
      check(String.class.equals(method.getReturnType()),
          "All i18n interface methods MUST return String: ", iface, method);

      int argumentCount = method.getParameterTypes().length;
      Map<String, Type> arguments = Maps.newLinkedHashMap();

      for (int i = 0; i < argumentCount; i++) {
        Annotation[] annotations = method.getParameterAnnotations()[i];

        check(annotations.length == 1,
            "Only @Named annotations are allowed on i18n method arguments: ", iface, method);
        if (annotations.length == 0) {
          continue;
        }

        check(Named.class.isInstance(annotations[0]),
            "Named annotation is missing from i18n interface method argument: ", iface, method);

        // Bind each argument to a template parameter a la Dynamic Finders.
        arguments.put(((Named) annotations[0]).value(), method.getParameterTypes()[i]);
      }

      // No point in throwing an NPE ourselves, but we want to keep processing errors so continue
      if (null == template || null == message) {
        continue;
      }

      // Compile arg names against message template to ensure it works.
      List<Token> tokens = null;
      try {
        MvelEvaluatorCompiler compiler = new MvelEvaluatorCompiler(arguments);

        // Compile both the default message as well as the provided localized one.
        Parsing.tokenize(message.message(), compiler);
        tokens = Parsing.tokenize(template, compiler);
      } catch (ExpressionCompileException e) {
        check(false, "Compile error in i18n message template: \n  " + e.getError().getError() +
            " in expression " + e.getError().getExpression() +"\n\n  ...in: ", iface, method);
      }
View Full Code Here

Examples of com.google.sitebricks.mail.imap.Message

    msgFuture.addListener(new Runnable() {
      @Override
      public void run() {
        try {
          Message message = msgFuture.get();
          //            System.out.println(ToStringBuilder.reflectionToString(message));
          for (Message.BodyPart bodyPart : message.getBodyParts()) {
            //              System.out.println(ToStringBuilder.reflectionToString(bodyPart));
          }

          System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>");
          System.out.println(message.getImapUid());
          System.out.println(message.getHeaders().get("Message-ID"));
          System.out.println(message.getHeaders());
          System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>\n\n\n");

//                System.out.println("Gmail flags set: " +
//                    client.addFlags(allMail, message.getImapUid(),
//                        ImmutableSet.of(Flag.SEEN)).get());

//                System.out
//                    .println("Matched UID: " + (message.getImapUid() == messageStatuses.get()
//                        .iterator()
//                        .next()
//                        .getImapUid()));
//                System.out.println("Fetched: " + message);
          dumpBodyParts(message.getBodyParts(), "");

          countDownLatch.countDown();
        } catch (InterruptedException e) {
          e.printStackTrace();
        } catch (ExecutionException e) {
View Full Code Here

Examples of com.google.transconsole.common.messages.Message

    }

    Expression getResult() {
      if (!invalid) {
        try {
          Message message = tcMessageBuilder.createMessage();
          ExtractedMessage emsg =
              new ExtractedMessage(msg, msg.getSchema(), msg.getName(), message, parameters);
          outsideMessageVisitor.addMessages(emsg);
          return emsg;
        } catch (InvalidMessageException imx) {
View Full Code Here

Examples of com.group5.jfs.Message

          }
          else
          {
            System.out.println("Error, wtf");
          }
          Message sendMessage = new Message(Main.Username,"",intent,data);
          try
          {
            //try sending the message
            new messageThread(sendMessage).start();
          } catch (Exception e)
View Full Code Here

Examples of com.gwtplatform.carstore.client.application.widget.message.Message

        this.hasHandlers = hasHandlers;
    }

    @Override
    public void onFailure(Throwable caught) {
        Message message = new Message(translateCauses(caught), MessageStyle.ERROR);
        DisplayMessageEvent.fire(hasHandlers, message);
    }
View Full Code Here

Examples of com.hazelcast.core.Message

    @Override
    public void dispatchEvent(Object event, Object listener) {
        TopicEvent topicEvent = (TopicEvent) event;
        Object msgObject = nodeEngine.toObject(topicEvent.data);
        Message message = new Message(topicEvent.name, msgObject, topicEvent.publishTime, topicEvent.publishingMember);
        incrementReceivedMessages(topicEvent.name);
        MessageListener messageListener = (MessageListener) listener;
        messageListener.onMessage(message);
    }
View Full Code Here

Examples of com.impetus.labs.korus.core.message.Message

    String bookName = requestMessage.get("bookName");
    String authorName = requestMessage.get("author");
    // Rest of the Business Logic
    String bookRating = rateBook(bookName, authorName);

    Message msg = new Message();
    msg.put("response", bookRating);
    KorusRuntime.sendToErlang("127.0.0.1", "callback", msg);
     

  }
View Full Code Here

Examples of com.infiniteautomation.rq.Message

    super(address);
  }

  @Override
  protected Message createRequestMessage(NodeAddress address) {
    return new Message(address,'r',new MessageData(new char[]{'?'}));
  }
View Full Code Here

Examples of com.jms.client.entity.Message

     * @param id the id
     * @throws Exception
     */
    public void destroy(long id) throws Exception {
        Collections.sort(messages);
        int foundIndex = Collections.binarySearch(messages, new Message(id));
        Validate.isTrue((foundIndex >= 0), "Entity not found");

        messages.remove(foundIndex);
    }
View Full Code Here

Examples of com.k42b3.neodym.Message

        {
          Document doc = sendRequest();
          Element rootElement = (Element) doc.getDocumentElement();

          // get message
          Message msg = Message.parseMessage(rootElement);

          if(msg.hasSuccess())
          {
            JOptionPane.showMessageDialog(null, msg.getText(), "Response", JOptionPane.INFORMATION_MESSAGE);
          }
          else
          {
            throw new Exception(msg.getText());
          }
        }
        catch(Exception ex)
        {
          JOptionPane.showMessageDialog(null, ex.getMessage(), "Response", JOptionPane.ERROR_MESSAGE);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.