Package org.agorava.api.storage

Examples of org.agorava.api.storage.UserSessionRepository


        return ret;
    }

    @BeforeClass
    public static void initSessions() {
        UserSessionRepository r = GlobalRepository.getInstance().createNew(USER_REPO_ID);

        session1 = new OAuthSession.Builder().qualifier(FakeServiceLiteral.INSTANCE).repo(r).id(SESSION1_ID).build();
        r.add(session1);

        session2 = new OAuthSession.Builder().qualifier(FakeService2Literal.INSTANCE).repo(r).id(SESSION2_ID).build();
        r.add(session2);
        r.setCurrent(session2);
    }
View Full Code Here


        return null;
    }

    @Override
    public UserSessionRepository createNew() {
        UserSessionRepository res = new UserSessionRepositoryImpl();
        add(res);
        setCurrent(res);
        return res;
    }
View Full Code Here

    @Override
    public UserSessionRepository createNew(String id) {
        if (get(id) != null) {
            throw new AgoravaException("Unable to create new user repository : repository with id " + id + " already exists");
        } else {
            UserSessionRepository res = new UserSessionRepositoryImpl(id);
            add(res);
            setCurrent(res);
            return res;
        }
    }
View Full Code Here

        return Collections.unmodifiableCollection(userRepos);
    }

    @Override
    public UserSessionRepository setCurrent(String id) throws IllegalArgumentException {
        UserSessionRepository res = get(id);

        if (res == null) {
            throw new IllegalArgumentException("There's no OauthSessionRepository with id " + id);
        }
        return res;
View Full Code Here

        return false;
    }

    @Override
    public boolean remove(String id) {
        UserSessionRepository res = get(id);
        if (res != null)
            return remove(res);
        return false;
    }
View Full Code Here


    @Override
    public String getActionURL(FacesContext facesContext, String viewId) {
        String actionUrl = super.getActionURL(facesContext, viewId);
        UserSessionRepository repo = (UserSessionRepository) resolver.resolve("currentRepo");


        return new FacesUrlTransformer(actionUrl).appendParamIfNecessary("repoid",
                repo.getId()).getUrl();
    }
View Full Code Here


    @Override
    public String getRedirectURL(FacesContext context, String viewId, Map<String, List<String>> parameters, boolean
            includeViewParams) {
        UserSessionRepository repo = (UserSessionRepository) resolver.resolve("currentRepo");
        List<String> values = new ArrayList<String>();
        values.add(repo.getId());
        parameters.put("repoid", values);
        return super.getRedirectURL(context, viewId, parameters, includeViewParams);
    }
View Full Code Here

    }

    @Override
    public String getBookmarkableURL(FacesContext context, String viewId, Map<String, List<String>> parameters,
                                     boolean includeViewParams) {
        UserSessionRepository repo = (UserSessionRepository) resolver.resolve("currentRepo");
        List<String> values = new ArrayList<String>();
        values.add(repo.getId());
        parameters.put("repoid", values);
        return super.getBookmarkableURL(context, viewId, parameters, includeViewParams);
    }
View Full Code Here

        return request.getParameter(AgoravaConstants.SESSIONID_PARAM);
    }

    @PostConstruct
    protected void init() {
        UserSessionRepository r;
        OAuthSession s;

        s = globalRepository.getOauthSession(getSessionId());
        if (s != null) {
            currentSession = s;
View Full Code Here

    @Named("currentRepo")
    @RequestScoped
    public UserSessionRepository getCurrentRepository() {
        String id = getRepoId();
        if (id == null || globalRepository.get(id) == null) {
            UserSessionRepository repo = globalRepository.createNew();
            setCookie(repo.getId());
            return globalRepository.createNew();
        } else {
            return globalRepository.get(id);
        }
    }
View Full Code Here

TOP

Related Classes of org.agorava.api.storage.UserSessionRepository

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.