code: public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
        throws ResourceException
     {
        if (LOG.isDebugEnabled())
        {
           LOG.debug("createManagedConnection(" + subject + "," + cxRequestInfo + ")");
        }
        if (!(cxRequestInfo instanceof SessionRequestInfo))
        {
           throw new ResourceException("The connection request info must be an instance of type SessionRequestInfo");
        }
        ExoContainer container = getContainer();
        if (LOG.isDebugEnabled())
        {
           LOG.debug("createManagedConnection: container = " + container.getContext().getName());
        }
        RepositoryService rs = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
        if (rs == null)
        {
           throw new ResourceException("No RepositoryService could be found in the container "
              + container.getContext().getName());
        }
        ManageableRepository mRepository = getRepository(rs);
        SessionRequestInfo sri = (SessionRequestInfo)cxRequestInfo;
        String workspaceName = sri.getWorkspace();
        if (LOG.isDebugEnabled())
        {
           LOG.debug("createManagedConnection: workspace = " + (workspaceName == null ? "'default'" : workspaceName));
        }
        Credentials credentials = getCredentials(subject, sri);
        SessionImpl session = null;
        try
        {
           session = (SessionImpl)mRepository.login(credentials, workspaceName);
        }
        catch (Exception e)
        {
           throw new ResourceException("Could not login to the workspace " + 
              (workspaceName == null ? "'default'" : workspaceName), e);
        }
        return new ManagedSessionImpl(session);
     }
docs: {@inheritDoc}