Package org.jdesktop.wonderland.client.login

Examples of org.jdesktop.wonderland.client.login.ServerSessionManager


        LOGGER.info("[JmeClientMain] loadServer " + serverURL);

        logout();

        // get the login manager for the given server
        ServerSessionManager lm = LoginManager.getSessionManager(serverURL);

        // Register physics and phyiscs collision systems for this session
        WorldManager worldManager = ClientContextJME.getWorldManager();
        CollisionManager collisionManager = worldManager.getCollisionManager();
        CollisionSystem collisionSystem = collisionManager.loadCollisionSystem(
                JBulletDynamicCollisionSystem.class);
        JBulletDynamicCollisionSystem jBulletCollisionSystem =
                (JBulletDynamicCollisionSystem) collisionSystem;
        PhysicsManager physicsManager = worldManager.getPhysicsManager();
        JBulletPhysicsSystem jBulletPhysicsSystem =
                (JBulletPhysicsSystem) physicsManager.loadPhysicsSystem(
                JBulletPhysicsSystem.class, jBulletCollisionSystem);
        ClientContextJME.addCollisionSystem(
                lm, "Physics", jBulletCollisionSystem);
        ClientContextJME.addPhysicsSystem(lm, "Physics", jBulletPhysicsSystem);

        // Register default collision system for this session
        JMECollisionSystem jmeCollisionSystem =
                (JMECollisionSystem) collisionManager.loadCollisionSystem(
                JMECollisionSystem.class);
        ClientContextJME.addCollisionSystem(lm, "Default", jmeCollisionSystem);

        // set the initial position, which will bne sent with the initial
        // connection properties of the cell cache connection
        login.setInitialPosition(translation, look);

        // OWL issue #185: set this manager as primary before creating any
        // connectons (but after it is properly initialized)
        login.setPrimary(true);
       
        // create a new session
        try {
            curSession = lm.createSession(login);
        } catch (LoginFailureException lfe) {
            IOException ioe = new IOException("Error connecting to "
                    + serverURL);
            ioe.initCause(lfe);
            throw ioe;
        }

        // make sure we logged in successfully
        if (curSession == null) {
            LOGGER.log(Level.WARNING, "Unable to connect to session");
            return;
        }

        frame.connected(true);

        // Listen for session disconnected and remove session physics and
        // collision systems
        curSession.addSessionStatusListener(new SessionStatusListener() {

            public void sessionStatusChanged(
                    WonderlandSession session, Status status) {
                if (status == Status.DISCONNECTED) {
                    ServerSessionManager serverSessionManager =
                            session.getSessionManager();
                    ClientContextJME.removeAllPhysicsSystems(
                            serverSessionManager);
                    ClientContextJME.removeAllCollisionSystems(
                            serverSessionManager);

                    // update the UI for logout
                    boolean inLogout;
                    synchronized (JmeClientMain.this) {
                        inLogout = loggingOut;
                    }

                    if (!inLogout) {
                        // if we didn't initiate the logout through the
                        // logout() method, then this is an unexpected
                        // logout.  Clean up by calling the logout() method,
                        // then attempt to reconnect
                        // reconnect dialog
                        final ServerSessionManager mgr =
                                curSession.getSessionManager();

                        LOGGER.warning("[JmeClientMain] unexpected logout!");

                        logout();
View Full Code Here


        this.serverURL = serverURL;
        this.reload();

        // create the associated with this cache
        ServerSessionManager ssm = LoginManager.findSessionManager(serverURL);
        if (ssm == null) {
            logger.log(Level.WARNING, "Cannot find session for " + serverURL);
        } else {
            this.listener = new SessionListener(ssm);
        }
View Full Code Here

        registerRepository();
        logger.info("Registering repository succeeded");
    }

    private void registerRepository() {
        ServerSessionManager loginInfo = getSessionManager();
       
        WebdavClientPlugin plugin = new WebdavClientPlugin();
        plugin.initialize(loginInfo);
    }
View Full Code Here

            collisionGraph.setModelBound(new BoundingBox());
            collisionGraph.updateModelBound();

            // Fetch the JME Collision system using the server manager of the Cell
            // to which this renderer is attached.
            ServerSessionManager manager =
                    cell.getCellCache().getSession().getSessionManager();
            CollisionSystem collisionSystem =
                    ClientContextJME.getCollisionSystem(manager, "Default");

            // Create a new collision controller, and set on the avatar
View Full Code Here

    private void deployToServerBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deployToServerBActionPerformed

        String moduleName = targetModuleTF.getText();
        final ArrayList<DeployedModel> deploymentInfo = new ArrayList();
        WorldManager wm = ClientContextJME.getWorldManager();
        final ServerSessionManager targetServer =
                (ServerSessionManager) targetServerSelector.getSelectedItem();

        // Check we are not about to overwrite an existing module
        String url = targetServer.getServerURL();
        ModuleList moduleList = ModuleUtils.fetchModuleList(url);
        ModuleInfo[] modules = moduleList.getModuleInfos();
        if (modules != null) {
            boolean conflict = false;
            for (int i = 0; i < modules.length && !conflict; i++) {
                if (moduleName.equals(modules[i].getName())) {
                    conflict = true;
                }
            }

            if (conflict) {
                int ret = JOptionPane.showConfirmDialog(this,
                        BUNDLE.getString("Module_Conflict_Message"),
                        BUNDLE.getString("Module_Conflict"),
                        JOptionPane.YES_NO_OPTION);
                if (ret == JOptionPane.NO_OPTION) {
                    return;
                }
            }
        }

        final File moduleJar = createModuleJar(deploymentInfo, null);

        // Now deploy to server
        Thread t = new Thread() {
            private JDialog uploadingDialog;
            @Override
            public void run() {
                try {
                    try {
                        SwingUtilities.invokeAndWait(new Runnable() {

                            public void run() {
                                uploadingDialog = new JDialog(ImportSessionFrame.this);
                                    uploadingDialog.setLayout(new BorderLayout());
                                    uploadingDialog.add(loadingDialogPanel, BorderLayout.CENTER);
                                    uploadingDialog.pack();
                                    uploadingDialog.setSize(200, 100);
                                    uploadingDialog.setVisible(true);
                                    uploadingDialog.setAlwaysOnTop(true);
                            }
                        });
                    } catch (InterruptedException ex) {
                        Logger.getLogger(ImportSessionFrame.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (InvocationTargetException ex) {
                        Logger.getLogger(ImportSessionFrame.class.getName()).log(Level.SEVERE, null, ex);
                    }

                    ModuleUploader uploader = new ModuleUploader(new URL(targetServer.getServerURL()));

                    // if the authentication type is NONE, don't authenticate,
                    // since the upload will only accept modules from an
                    // administrator.
                    // XXX TODO: we should fix this so that upload writes to
                    // the content repository, so that non-admin users can
                    // upload art when authenication is turned on XXX
                    if (targetServer.getDetails().getAuthInfo().getType() !=
                            AuthenticationInfo.Type.NONE)
                    {
                        uploader.setAuthURL(targetServer.getCredentialManager().getAuthenticationURL());
                    }

                    uploader.upload(moduleJar);
                } catch (MalformedURLException ex) {
                    LOGGER.log(Level.SEVERE, "MalformedURL " + targetServer.getServerURL(), ex);
                    return;
                } catch (IOException e) {
                    LOGGER.log(Level.SEVERE, "IO Exception during upload", e);
                    return;
                } catch (Throwable t) {
View Full Code Here

        SecurityComponentServerState state = new SecurityComponentServerState();

        CellPermissions perms = new CellPermissions();

        // add the current user as an owner
        ServerSessionManager primarySM = LoginManager.getPrimary();
        if (primarySM != null) {
            WonderlandSession primarySession = primarySM.getPrimarySession();
            if (primarySession != null) {
                Principal owner = new Principal(
                        primarySession.getUserID().getUsername(),
                        Principal.Type.USER);
                perms.getOwners().add(owner);
View Full Code Here

        // create a fake mainframe
        JmeClientMain.setFrame(new FakeMainFrame());

        try {       
            ServerSessionManager mgr = LoginManager.getSessionManager(serverURL);
            session = mgr.createSession(new SessionCreator<CellClientSession>() {

                public CellClientSession createSession(ServerSessionManager sessionMgr,
                        WonderlandServerInfo serverInfo, ClassLoader loader) {
                    CellClientSession ccs = new CellClientSession(sessionMgr, serverInfo, loader) {
View Full Code Here

        // Fetch the transform of the view (avatar) Cell and its "look at"
        // direction.
        ViewManager vm = ViewManager.getViewManager();
        ViewCell viewCell = vm.getPrimaryViewCell();
        CellTransform viewTransform = viewCell.getWorldTransform();
        ServerSessionManager manager =
                viewCell.getCellCache().getSession().getSessionManager();

        // The Cell Transform to apply to the Cell
        CellTransform transform = null;

        // Look for the "bounds hint" provided by the Cell. There are three
        // possible cases:
        //
        // (1) There is a hint and the Cell wants us to do the optimal layout
        // so go ahead and do it.
        //
        // (2) There is no hint, so use the default bounds radius and do the
        // optimal layout
        //
        // (3) There is a hint that says do not do the optimal layout, so we
        // will just put the Cell right on top of the avatar.
        BoundingVolumeHint hint = state.getBoundingVolumeHint();

        logger.info("Using bounding volume hint " + hint.getBoundsHint() +
                ", do placement=" + hint.isDoSystemPlacement());
       
        if (hint != null && hint.isDoSystemPlacement() == true) {
            // Case (1): We have a bounds hint and we want to do the layout,
            // so we find the distance away from the avatar and also the height
            // above the ground.
            BoundingVolume boundsHint = hint.getBoundsHint();
            transform = CellPlacementUtils.getCellTransform(manager, boundsHint,
                    viewTransform);
        }
        else if (hint == null) {
            // Case (2): Do the optimal placement using the default radius.
            BoundingVolume boundsHint = new BoundingSphere(DEFAULT_RADIUS, Vector3f.ZERO);
            transform = CellPlacementUtils.getCellTransform(manager, boundsHint,
                    viewTransform);
        }
        else if (hint != null && hint.isDoSystemPlacement() == false) {
            // Case (3): The Cell will take care of its own placement, use
            // the origin of the avatar as the initial placement.
           
            // Issue 998: make sure this is actually the current location of
            // the avatar, and not the origin.  This guarantees that the
            // cell will be in the viewcache of the creator at least, so
            // that the cell object can be (for example) positioned manually
            // by the client.
            transform = viewTransform;
        }
       
        // We also need to convert the initial origin of the Cell (in world
        // coordinates to the coordinates of the parent Cell (if non-null)
        if (parentCellID != null) {
            Cell parent = viewCell.getCellCache().getCell(parentCellID);
            CellTransform worldTransform = new CellTransform(null, null);
            CellTransform parentTransform = parent.getWorldTransform();

            logger.info("Transform of the parent cell: translation=" +
                    parentTransform.getTranslation(null).toString() + ", rotation=" +
                    parentTransform.getRotation(null).toString());

            transform = ScenegraphUtils.computeChildTransform(parentTransform,
                                                              transform);
        }
       
        logger.info("Final adjusted origin " + transform.getTranslation(null).toString());
       
        // Create a position component that will set the initial origin
        PositionComponentServerState position = (PositionComponentServerState)
                state.getComponentServerState(PositionComponentServerState.class);
        if (position == null) {
            position = new PositionComponentServerState();
            state.addComponentServerState(position);
        }
        position.setTranslation(transform.getTranslation(null));
        position.setRotation(transform.getRotation(null));
        position.setScaling(transform.getScaling(null));

        // Always pass in the view transform to the Cell's server state
        state.addComponentServerState(new ViewComponentServerState(viewTransform));

        // Send the message to the server
        WonderlandSession session = manager.getPrimarySession();
        CellEditChannelConnection connection = (CellEditChannelConnection)
                session.getConnection(CellEditConnectionType.CLIENT_TYPE);
        CellCreateMessage msg = new CellCreateMessage(parentCellID, state);
//        connection.send(msg);
        ResponseMessage response = null;
View Full Code Here

        }

        // From the cell, find out what the associated wonderland session is
        // and fetch the server host name and port from that
        WonderlandSession session = cell.getCellCache().getSession();
        ServerSessionManager manager = session.getSessionManager();
        if (manager == null) {
            logger.warning("Unable to find manager for session " + session);
            return new URL(uri);
        }
        String serverHostAndPort = manager.getServerNameAndPort();

        // Annotate the URI with the host name and port from the session and
        // return as a URL
        assetURI.setServerHostAndPort(serverHostAndPort);
        return assetURI.toURL();
View Full Code Here

            return new URL(uri);
        }

        // Use the primary login session to determine the server host and port
        // name
        ServerSessionManager manager = LoginManager.getPrimary();
        if (manager == null) {
            logger.warning("No primary login session for " + uri);
            return new URL(uri);
        }
        String serverHostAndPort = manager.getServerNameAndPort();

        // Annotate the URI with the host name and port from the session and
        // return as a URL
        assetURI.setServerHostAndPort(serverHostAndPort);
        return assetURI.toURL();
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.client.login.ServerSessionManager

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.