Package org.jdesktop.wonderland.common.messages

Examples of org.jdesktop.wonderland.common.messages.Message


                                Message message)
    {
        if (message instanceof CellMessage) {
            messageReceived(sender, clientID, (CellMessage) message);
        } else {
            Message error = new ErrorMessage(message.getMessageID(),
                    "Unexpected message type: " + message.getClass());

            sender.send(clientID, error);
        }
    }
View Full Code Here


        public ClientChannelListener joinedChannel(ClientChannel channel) {
            throw new UnsupportedOperationException("Not supported.");
        }

        public void receivedMessage(ByteBuffer message) {
            Message m = null;
           
            try {
                ReceivedMessage rm = MessagePacker.unpack(message);
                m = rm.getMessage();
          
                // check the response
                assert m instanceof ResponseMessage : "Received invalid response " + m;
                assert m.getMessageID().equals(messageID) : "Bad ID in response " + m;
            } catch (PackerException pe) {
                logger.log(Level.WARNING, "Error unpacking", pe);
                assert false : "Error unpacking message";
            }
           
View Full Code Here

            // up before we exit
            record = addClientRecord(client);
        }
       
        // send a request to the server to connect the given client type
        Message attachMessage = new AttachClientMessage(client.getConnectionType(),
                                                        properties);
       
        // Create a listener to handle the response.  We cannot do this
        // using just sendAndWait() because the response has to be
        // processed immediately, otherwise messages received immediately
View Full Code Here

    /**
     * Fire when a message is received over the session channel
     * @param data the message that was received
     */
    protected void fireSessionMessageReceived(ByteBuffer data) {
        Message message;
        short clientID;
       
        try {
            // read the message
            ReceivedMessage recv = MessagePacker.unpack(data, getClassLoader());
           
            // all set, just unpack the received message
            message = recv.getMessage();
            clientID = recv.getClientID();
        } catch (PackerException eme) {
            logger.log(Level.WARNING, "Error extracting message from server",
                       eme);

            // if possible, send an error reply to the client
            if (eme.getMessageID() != null) {
                message = new ErrorMessage(eme.getMessageID(),
                                           eme.getMessage(),
                                           eme.getCause());
                clientID = eme.getClientID();
            } else {
                return;
            }
        } catch (Exception ex) {
            // what to do?
            logger.log(Level.WARNING, "Error extracting message from server",
                       ex);
            return;
        }
       
        // handle it with the selected client
        ClientRecord record = getClientRecord(clientID);
        if (record == null) {
            throw new IllegalStateException("Message " + message +
                                            "to unknown client: " + clientID);
        }
       
        if (logger.isLoggable(Level.FINEST)) {
            logger.finest(getName() + " received session message for " +
                          "handler " + record.getClient().getConnectionType() +
                          "  message type "+ message.getClass().getName());
        }
       
        record.handleMessage(message);
    }
View Full Code Here

       
        return transform.getScaling(null);
    }
   
    public CellTransform getCellTransform(CellID cellID) {
        Message request = new CellTransformRequestMessage(cellID);

        try {
            ResponseMessage rm = sendAndWait(request);
            if (rm instanceof CellTransformResponseMessage) {
                return ((CellTransformResponseMessage) rm).getTransform();
View Full Code Here

        // set the alias
        pi.setInConeOfSilence(inCOS);

        // send a message to the connection
        Message m = new PresenceInfoChangedMessage(pi.getCellID(),
                                                   Change.CONE_OF_SILENCE,
                                                   inCOS);
        getPresenceSender().send(m);
    }
View Full Code Here

        if (pi == null) {
            logger.warning("No presence info for " + speakingID);
            return;
        }

        Message m = new PresenceInfoChangedMessage(pi.getCellID(),
                                                   Change.SPEAKING, speaking);
        getPresenceSender().send(m);
    }
View Full Code Here

        // managed object.  This id is guaranteed by Darkstar to be unique
        // across the whole Darkstar cluster.
        sessionID = sessionRef.getId();
        WonderlandIdentity userID =
               AppContext.getManager(ClientIdentityManager.class).getClientID();
        Message sim = new SessionInitializationMessage(sessionID, userID);
        sendToSession(SESSION_INTERNAL_CLIENT_ID, sim);
    }
View Full Code Here

     */
    public void receivedMessage(ByteBuffer data) {
        try {
            // extract the message and client id
            ReceivedMessage recv = MessagePacker.unpack(data);
            Message m = recv.getMessage();
            short clientID = recv.getClientID();
           
            // find the handler
            ClientConnectionHandler handler = getHandler(clientID);
            if (handler == null) {
                logger.fine("Session " + getSession().getName() +
                            " unknown handler ID: " + clientID);
                sendError(m.getMessageID(), clientID,
                          "Unknown handler ID: " + clientID);
                return;
            }
           
            if (logger.isLoggable(Level.FINEST)) {
                logger.finest("Session " + getSession().getName() +
                              " received message " + m +
                              " for client ID" + clientID +
                              " handled by " + handler.getConnectionType());
            }

            // determine if security is needed
            Resource resource = null;
            if (handler instanceof SecureClientConnectionHandler) {
                SecureClientConnectionHandler sec =
                        (SecureClientConnectionHandler) handler;
                resource = sec.checkMessage(getWonderlandClientID(), m);
            }

            // get the actions associated with this message
            Set<Action> actions = getActions(m.getClass());

            if (logger.isLoggable(Level.FINEST)) {
                logger.finest("Session " + getSession().getName() +
                              " security for message " + m +
                              " resource: " + resource +
View Full Code Here

        // add handler to our list
        handlers.put(Short.valueOf(clientID), ref);
       
        // send response message
        Message resp = new AttachedClientMessage(messageID, clientID);
        sendToSession(SESSION_INTERNAL_CLIENT_ID, resp);
       
        // add this session to the sender
        sender.addSession(session);
       
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.common.messages.Message

Copyright © 2018 www.massapicom. 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.