Examples of MessageCallback


Examples of com.mcbans.firestar.mcbans.callBacks.MessageCallback

        if (!Util.isValidIP(target)){
            throw new CommandException(ChatColor.RED + _("invalidIP"));
        }

        // Start
        BanIpRequest request = new BanIpRequest(plugin, new MessageCallback(plugin, sender), target, reason, senderName, senderUUID);
        Thread triggerThread = new Thread(request);
        triggerThread.start();
    }
View Full Code Here

Examples of net.sf.clairv.p2p.MessageCallback

        KeywordQueryMessage newKqm = new KeywordQueryMessage(kqm
            .getKeywords(), kqm.getCurrentKeywordIndex() + 1, currentBloomFilter);

        network.send(
            kqm.getKeywords()[kqm.getCurrentKeywordIndex() + 1],
            newKqm, new MessageCallback() {

              public void onResponse(ResponseMessage response) {

                if (response instanceof KeywordQueryRespMessage) {
                  ScoreDocList receivedSdList = ((KeywordQueryRespMessage) response)
View Full Code Here

Examples of org.apache.james.mailbox.MessageManager.MessageCallback

    protected void processMessageRanges(final ImapSession session, final MessageManager mailbox, final List<MessageRange> ranges, final FetchData fetch, final boolean useUids, final MailboxSession mailboxSession, final Responder responder) throws MailboxException {
        final FetchResponseBuilder builder = new FetchResponseBuilder(new EnvelopeBuilder(session.getLog()));
        FetchGroup resultToFetch = getFetchGroup(fetch);

        for (int i = 0; i < ranges.size(); i++) {
            mailbox.getMessages(ranges.get(i), resultToFetch, mailboxSession, new MessageCallback() {

                public void onMessages(Iterator<MessageResult> it) throws MailboxException {
                    while (it.hasNext()) {
                        final MessageResult result = it.next();
                        try {
View Full Code Here

Examples of org.buildndeploy.client.js.ClientChannel.MessageCallback

 
 
  public ChatController(final ChatPanel chatPanel) {
   
    // Handle Chat messages from the server
    getChannel().addMessageHandler(new MessageCallback() {
     
      @Override
      public void onMessage(String s, MessageType t) {
        switch(t) {
        case ChatMessage:
View Full Code Here

Examples of org.jboss.errai.bus.client.MessageCallback

                            }

                        } else if (MessageCallback.class.isAssignableFrom(loadClass)) {
                            final Class<? extends MessageCallback> clazz = loadClass.asSubclass(MessageCallback.class);
                            if (clazz.isAnnotationPresent(Service.class)) {
                                MessageCallback svc = Guice.createInjector(new AbstractModule() {
                                    @Override
                                    protected void configure() {
                                        bind(MessageCallback.class).to(clazz);
                                        bind(MessageBus.class).toInstance(bus);
View Full Code Here

Examples of org.jboss.errai.bus.client.api.MessageCallback

        for (int i = 0; i < multipler; i++) {
          MessageBuildSendable sendable = MessageBuilder.createMessage()
                  .toSubject("StressTestService")
                  .withValue(messageValue)
                  .done()
                  .repliesTo(new MessageCallback() {
                    @Override
                    public void callback(Message message) {
                      stats.registerReceivedMessage(message);
                      statsPanel.updateStatsLabels(stats);
                    }
View Full Code Here

Examples of org.jboss.errai.bus.client.api.MessageCallback

  public void execute(final BootstrapContext context) {
    final ServerMessageBus bus = context.getBus();
    final boolean authenticationConfigured =
        context.getConfig().getResource(AuthenticationAdapter.class) != null;

    bus.subscribe(ErraiService.AUTHORIZATION_SVC_SUBJECT, new MessageCallback() {
      public void callback(Message message) {
        switch (SecurityCommands.valueOf(message.getCommandType())) {
          case AuthenticationScheme:
            if (authenticationConfigured) {

              /**
               * Respond with what credentials the authentication system requires.
               */
              //todo: we only support login/password for now

              createConversation(message)
                  .subjectProvided()
                  .command(SecurityCommands.AuthenticationScheme)
                  .with(SecurityParts.CredentialsRequired, "Name,Password")
                  .with(MessageParts.ReplyTo, ErraiService.AUTHORIZATION_SVC_SUBJECT)
                  .noErrorHandling().sendNowWith(bus);
            }
            else {
              createConversation(message)
                  .subjectProvided()
                  .command(SecurityCommands.AuthenticationNotRequired)
                  .noErrorHandling().sendNowWith(bus);
            }

            break;

          case AuthRequest:
            /**
             * Receive a challenge.
             */

            if (authenticationConfigured) {
              try {
                context.getConfig().getResource(AuthenticationAdapter.class)
                    .challenge(message);
              }
              catch (AuthenticationFailedException a) {
              }
            }
            break;

          case EndSession:
            if (authenticationConfigured) {
              context.getConfig().getResource(AuthenticationAdapter.class)
                  .endSession(message);
            }

            // reply in any case
            createConversation(message)
                .toSubject("LoginClient")
                .command(SecurityCommands.EndSession)
                .noErrorHandling()
                .sendNowWith(bus);

            break;
        }
      }
    });

    /**
     * The standard ServerEchoService.
     */
    bus.subscribe(ErraiService.SERVER_ECHO_SERVICE, new MessageCallback() {
      public void callback(Message c) {
        MessageBuilder.createConversation(c)
            .subjectProvided().noErrorHandling()
            .sendNowWith(bus);
      }
    });

    bus.subscribe(ErraiService.AUTHORIZATION_SERVICE, new MessageCallback() {
      public void callback(Message message) {
        AuthSubject subject = message.getResource(QueueSession.class, "Session")
            .getAttribute(AuthSubject.class, ErraiService.SESSION_AUTH_DATA);

        Message reply = MessageBuilder.createConversation(message).getMessage();
View Full Code Here

Examples of org.jboss.errai.bus.client.api.MessageCallback

          final String replyTo = message.getSubject() + "." + message.getCommandType() +
            ":RespondTo:" + (id = uniqueNumber());

          if (remoteCallback != null) {
            bus.subscribe(replyTo,
              new MessageCallback() {
                @SuppressWarnings({"unchecked"})
                public void callback(Message message) {
                  bus.unsubscribeAll(replyTo);
                  remoteCallback.callback(message.get(responseType, "MethodReply"));
                }
              }
            );
            message.set(MessageParts.ReplyTo, replyTo);
          }
        }
       
        if (message.getErrorCallback() != null) {
          final String errorTo = message.getSubject() + "." + message.getCommandType() +
            ":Errors:" + ((id == null) ? uniqueNumber() : id);
         
            bus.subscribe(errorTo,
              new MessageCallback() {
                @SuppressWarnings({"unchecked"})
                public void callback(Message m) {
                  bus.unsubscribeAll(errorTo);
                  message.getErrorCallback().error(message, m.get(Throwable.class, MessageParts.Throwable));
                }
View Full Code Here

Examples of org.jboss.errai.bus.client.api.MessageCallback

  // deferr notification of LoginClient in case
  // a workspace wants to override the authentication or authorization scheme
  private boolean deferredNotification;

  public SecurityService() {
    ErraiBus.get().subscribe(SUBJECT, new MessageCallback() {
      public void callback(Message msg) {

        switch (SecurityCommands.valueOf(msg.getCommandType())) {
          case AuthenticationScheme:
            if (authHandler == null) {
              //               msg.toSubject("LoginClient").sendNowWith(ErraiBus.get());
              return;
            }

            String credentialsRequired = msg.get(String.class, CredentialsRequired);
            String[] credentialNames = credentialsRequired.split(",");
            Credential[] credentials = new Credential[credentialNames.length];

            for (int i = 0; i < credentialNames.length; i++) {
              switch (CredentialTypes.valueOf(credentialNames[i])) {
                case Name:
                  credentials[i] = new NameCredential();
                  break;
                case Password:
                  credentials[i] = new PasswordCredential();
                  break;

                default:
                  //todo: throw a massive error here.
              }
            }

            // callback on externally provided login form
            // asking for the required credentials specified on the server side.
            authHandler.doLogin(credentials);

            // Create an authentication request and send the credentials
            Message challenge = createMessage()
                .toSubject("AuthenticationService")
                .command(SecurityCommands.AuthRequest)
                .with(MessageParts.ReplyTo, SUBJECT)
                .getMessage();

            for (int i = 0; i < credentialNames.length; i++) {
              switch (CredentialTypes.valueOf(credentialNames[i])) {
                case Name:
                  challenge.set(CredentialTypes.Name, credentials[i].getValue());
                  break;
                case Password:
                  challenge.set(CredentialTypes.Password, credentials[i].getValue());
                  break;
              }
            }

            challenge.sendNowWith(ErraiBus.get());

            break;
          case AuthenticationNotRequired:
            notifyLoginClient(msg);
            break;

          case FailedAuth:
            notifyLoginClient(msg);
            break;
          case SuccessfulAuth:
            if (authenticationContext != null && authenticationContext.isValid()) return;
            authenticationContext = createAuthContext(msg);
            notifyLoginClient(msg);

            break;
        }
      }
    });


    // listener for the authorization assignment
    ErraiBus.get().subscribe("AuthorizationListener",
        new MessageCallback() {
          public void callback(Message message) {

            authenticationContext = createAuthContext(message);

            if (!deferredNotification) {
View Full Code Here

Examples of org.jboss.errai.bus.client.api.MessageCallback

  void sendMessage() {
    MessageBuilder.createMessage()
        .toSubject("HelloWorldService")
        .withValue("Hello, There!")
        .done()
        .repliesTo(new MessageCallback() {
          public void callback(Message message) {
            System.out.println("Got a Response!");
            responseLabel.setText("Message from Server: " + message.get(String.class, MessageParts.Value));
          }
        })
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.