Package eu.planets_project.ifr.core.security.api.services

Examples of eu.planets_project.ifr.core.security.api.services.UserManager$UserNotFoundException


   * @return A UserManager, as discovered via JNDI.
   */
  public static UserManager getPlanetsUserManager() {
    try{
      Context jndiContext = new javax.naming.InitialContext();
      UserManager um = (UserManager) PortableRemoteObject.narrow(
          jndiContext.lookup("planets-project.eu/UserManager/remote"), UserManager.class);
      return um;
    }catch (NamingException e) {
      log.severe("Failure during lookup of the UserManager PortableRemoteObject: "+e.toString());
      return null;
View Full Code Here


        return request.getRemoteUser();
    }

    public User getLoggedInUser() {

        UserManager um = getPlanetsUserManager();
        if(um == null) {
            return null;
        }

        FacesContext context = FacesContext.getCurrentInstance();
        HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();

        String userId = request.getRemoteUser();

        eu.planets_project.ifr.core.security.api.model.User planetsUser = null;
        try {
            planetsUser = um.getUserByUsername(userId);
        } catch(UserNotFoundException e){
            return null;
        }

        User user = new User();
View Full Code Here

     * @return
     */
    public static UserManager getPlanetsUserManager(){
        try{
            Context jndiContext = new javax.naming.InitialContext();
            UserManager um = (UserManager) PortableRemoteObject.narrow(jndiContext.lookup("planets-project.eu/UserManager/remote"), UserManager.class);
            return um;
        }catch (NamingException e) {
            PlatoLogger.getLogger(PlanetsUserManager.class).error(e.getMessage(),e);
            return null;
        }
View Full Code Here

     * @return
     */
    public static UserManager getUserManager(){
        try{
            Context jndiContext = getInitialContext();
            UserManager um = (UserManager) PortableRemoteObject.narrow(
                    jndiContext.lookup("planets-project.eu/UserManager/remote"), UserManager.class);
            return um;
        }catch (NamingException e) {
            log.error("Failure in getting PortableRemoteObject: "+e.toString());
            return null;
View Full Code Here

    /**
     * Look up a User, by username:
     */
    public static User getUser(String username) {
       
        UserManager um = UserBean.getUserManager();
        if( um == null ) {
            log.error("Could not get the User Manager!");
            return null ;
        }
        User u = null;
        try {
            u = um.getUserByUsername(username);
        } catch( UserNotFoundException e ){
            log.error("Exception while attempting to load the User details for '"+username+"': "+e);
            if( log.isDebugEnabled() ) e.printStackTrace();
        }
       
View Full Code Here

        if( query == null) return null;
        // look for matching users:
        String qs = (String) query;
        log.debug("Looking for users that match " + qs );
        // Get all users:
        UserManager um = UserBean.getUserManager();
        // Filter this into a list of matching users:
        ArrayList<User> matches = new ArrayList<User>();
        for( User u : um.getUsers() ) {
            if( u.getUsername().startsWith(qs) ||
                u.getFirstName().startsWith(qs) ||
                u.getLastName().startsWith(qs) ) {
                  matches.add(u);
            }
View Full Code Here

TOP

Related Classes of eu.planets_project.ifr.core.security.api.services.UserManager$UserNotFoundException

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.