ServiceLocator locator = ServiceLocator.getInstance(); adminsessionhome = (IUserAdminSessionLocalHome) locator.getLocalHome(IUserAdminSessionLocalHome.COMP_NAME); adminsession = adminsessionhome.create();  raadminsessionhome = (IRaAdminSessionLocalHome) locator.getLocalHome(IRaAdminSessionLocalHome.COMP_NAME); raadminsession = raadminsessionhome.create();   certificatesessionhome = (ICertificateStoreSessionLocalHome) locator.getLocalHome(ICertificateStoreSessionLocalHome.COMP_NAME); certificatesession = certificatesessionhome.create();  IAuthorizationSessionLocalHome authorizationsessionhome = (IAuthorizationSessionLocalHome) locator.getLocalHome(IAuthorizationSessionLocalHome.COMP_NAME); authorizationsession = authorizationsessionhome.create();  this.profiles = new EndEntityProfileDataHandler(administrator,raadminsession,authorizationsession,informationmemory);  IHardTokenSessionLocalHome hardtokensessionhome = (IHardTokenSessionLocalHome) locator.getLocalHome(IHardTokenSessionLocalHome.COMP_NAME); hardtokensession = hardtokensessionhome.create();  IKeyRecoverySessionLocalHome keyrecoverysessionhome = (IKeyRecoverySessionLocalHome) locator.getLocalHome(IKeyRecoverySessionLocalHome.COMP_NAME); keyrecoverysession = keyrecoverysessionhome.create();  initialized =true; } else { log.debug("=initialize(): already initialized"); } log.debug("<initialize()");
if(!initialized){ if(request.getAttribute( "javax.servlet.request.X509Certificate" ) != null) administrator = new Admin(((X509Certificate[]) request.getAttribute( "javax.servlet.request.X509Certificate" ))[0]); else administrator = new Admin(Admin.TYPE_PUBLIC_WEB_USER, request.getRemoteAddr());  this.informationmemory = ejbcawebbean.getInformationMemory();  ServiceLocator locator = ServiceLocator.getInstance(); adminsessionhome = (IUserAdminSessionLocalHome) locator.getLocalHome(IUserAdminSessionLocalHome.COMP_NAME); adminsession = adminsessionhome.create();  raadminsessionhome = (IRaAdminSessionLocalHome) locator.getLocalHome(IRaAdminSessionLocalHome.COMP_NAME); raadminsession = raadminsessionhome.create();   certificatesessionhome = (ICertificateStoreSessionLocalHome) locator.getLocalHome(ICertificateStoreSessionLocalHome.COMP_NAME); certificatesession = certificatesessionhome.create();  IAuthorizationSessionLocalHome authorizationsessionhome = (IAuthorizationSessionLocalHome) locator.getLocalHome(IAuthorizationSessionLocalHome.COMP_NAME); authorizationsession = authorizationsessionhome.create();  this.profiles = new EndEntityProfileDataHandler(administrator,raadminsession,authorizationsession,informationmemory);  IHardTokenSessionLocalHome hardtokensessionhome = (IHardTokenSessionLocalHome) locator.getLocalHome(IHardTokenSessionLocalHome.COMP_NAME); hardtokensession = hardtokensessionhome.create();  IKeyRecoverySessionLocalHome keyrecoverysessionhome = (IKeyRecoverySessionLocalHome) locator.getLocalHome(IKeyRecoverySessionLocalHome.COMP_NAME); keyrecoverysession = keyrecoverysessionhome.create();  initialized =true; } else { log.debug("=initialize(): already initialized"); } log.debug("<initialize()");
    public void initialize(HttpServletRequest request, EjbcaWebBean ejbcawebbean) throws  Exception{      log.debug(">initialize()");      if(!initialized){        if(request.getAttribute( "javax.servlet.request.X509Certificate" ) != null)          administrator = new Admin(((X509Certificate[]) request.getAttribute( "javax.servlet.request.X509Certificate" ))[0]);        else          administrator = new Admin(Admin.TYPE_PUBLIC_WEB_USER, request.getRemoteAddr());        // Get the UserAdminSession instance.        this.informationmemory = ejbcawebbean.getInformationMemory();                ServiceLocator locator = ServiceLocator.getInstance();        adminsessionhome = (IUserAdminSessionLocalHome) locator.getLocalHome(IUserAdminSessionLocalHome.COMP_NAME);        adminsession = adminsessionhome.create();        raadminsessionhome = (IRaAdminSessionLocalHome) locator.getLocalHome(IRaAdminSessionLocalHome.COMP_NAME);        raadminsession = raadminsessionhome.create();                certificatesessionhome = (ICertificateStoreSessionLocalHome) locator.getLocalHome(ICertificateStoreSessionLocalHome.COMP_NAME);        certificatesession = certificatesessionhome.create();        IAuthorizationSessionLocalHome authorizationsessionhome = (IAuthorizationSessionLocalHome) locator.getLocalHome(IAuthorizationSessionLocalHome.COMP_NAME);        authorizationsession = authorizationsessionhome.create();        this.profiles = new EndEntityProfileDataHandler(administrator,raadminsession,authorizationsession,informationmemory);                IHardTokenSessionLocalHome hardtokensessionhome = (IHardTokenSessionLocalHome) locator.getLocalHome(IHardTokenSessionLocalHome.COMP_NAME);        hardtokensession = hardtokensessionhome.create();        IKeyRecoverySessionLocalHome keyrecoverysessionhome = (IKeyRecoverySessionLocalHome) locator.getLocalHome(IKeyRecoverySessionLocalHome.COMP_NAME);        keyrecoverysession = keyrecoverysessionhome.create();        initialized =true;      } else {          log.debug("=initialize(): already initialized");      }      log.debug("<initialize()");    }