Package org.jdesktop.wonderland.common.messages

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


            return new PasswordAuthentication(username, password.toCharArray());
        }

        public void loggedIn() {
            // send the protocol selection message
            ProtocolSelectionMessage psm =
                    new ProtocolSelectionMessage(getProtocolName(),
                                                 getProtocolVersion());
            messageID = psm.getMessageID();
           
            try {
                getSession().send(MessagePacker.pack(psm,
                        SessionInternalConnectionType.SESSION_INTERNAL_CLIENT_ID));
            } catch (PackerException pe) {
View Full Code Here


        /**
         * Set a successful result for the login phase.  This will initiate the
         * protocol selection phase.
         */
        public synchronized void setLoginSuccess() {
           ProtocolSelectionMessage psm =
                   new ProtocolSelectionMessage(getProtocolName(),
                                                getProtocolVersion());
           ResponseListener rl = new OKErrorResponseListener() {
                @Override
                public void onSuccess(MessageID messageID) {
                    // move to the next phase
View Full Code Here

            if (!(m instanceof ProtocolSelectionMessage)) {
                sendError(m, "Only ProtcolSelectionMessage allowed");
                return;
            }
           
            ProtocolSelectionMessage psm = (ProtocolSelectionMessage) m;
            CommsManager cm = WonderlandContext.getCommsManager();

            // see if we have a protocol to match the request
            CommunicationsProtocol cp = cm.getProtocol(psm.getProtocolName());
            if (cp == null) {
                sendError(m, "Protocol " + psm.getProtocolName() + " not found");
                return;
            }
           
            // see if the versions match
            if (!cp.getVersion().isCompatible(psm.getProtocolVersion())) {
                sendError(m, "Client version incompatible with server " +
                             "version " + cp.getVersion());
            }
           
           
            ClientSession session = getSession();
            logger.info("Session " + session.getName() + " connected with " +
                        "protocol " + cp.getName());
           
            // all set -- set the wrapped session
            wrapped = cp.createSessionListener(session, psm.getProtocolVersion());
            if (wrapped instanceof ManagedObject) {
                wrapped = new ManagedClientSessionWrapper(wrapped);
            }

            // TODO: is this the right thing to do, or should we only
            // do this automatically for the Wonderland protocol?
            WonderlandClientID clientID = new WonderlandClientID(session);
            WonderlandContext.getUserManager().login(clientID);
           
            // record the client connection
            this.protocol = cp;
            recordConnect(cp, session);
           
            // send an OK message
            sendToSession(new OKMessage(psm.getMessageID()));
        } catch (PackerException eme) {
            sendError(eme.getMessageID(), null, eme);
        }
    }
View Full Code Here

TOP

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

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.