Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jboss.remoting.samples.chat.client;

Title: Chat4

Description:

Copyright: Copyright (c) 2003

Company:

Author(s):
not attributable
Version:
1.0
import java.util.*;
public class ChatReceiverHandler implements InvokerCallbackHandler
  private TalkFrame talkFrame;
  {
     = tf;
  }
  
  public void handleCallback(Callback callbackthrows HandleCallbackException
  {
     if (!(callback.getParameter() instanceof RemoteInvocation))
        throw new HandleCallbackException("invalid request format: expecting RemoteInvocation");
        
     RemoteInvocation request = (RemoteInvocationcallback.getParameter();
     String methodName = request.getMethodName();
     Object[] args = request.getParameters();
     if (methodName.equals("send"))
         send(args);
     
     else if (methodName.equals("sendMultiple"))
        sendMultiple(args);
     
     else if (methodName.equals("setKey"))
        setKey(args);
     
     else if (methodName.equals("shuttingDown"))
        shuttingDown(args);
     else
        throw new HandleCallbackException("unrecognized method name: " + methodName);
  }
  
  protected void send(Object[] args)
  {
     ChatMessage mesg = (ChatMessageargs[0];
     .appendMessage(mesg);
  }
  protected void sendMultiple(Object[] args)
  {
     ArrayList messages = (ArrayListargs[0];
     .appendMessages(messages);
  }
  
  protected void setKey(Object[] args)
  {
     String key = (Stringargs[0];
  }
  
  protected void shuttingDown(Object[] args)
  {
  }
New to GrepCode? Check out our FAQ X