Index: com/xpn/xwiki/XWiki.java =================================================================== --- com/xpn/xwiki/XWiki.java (revision 580) +++ com/xpn/xwiki/XWiki.java (working copy) @@ -68,6 +68,7 @@ import com.xpn.xwiki.user.api.XWikiGroupService; import com.xpn.xwiki.user.api.XWikiRightService; import com.xpn.xwiki.user.api.XWikiUser; +import com.xpn.xwiki.user.impl.LDAP.LDAPAuthServiceImpl; import com.xpn.xwiki.user.impl.exo.ExoAuthServiceImpl; import com.xpn.xwiki.user.impl.exo.ExoGroupServiceImpl; import com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl; @@ -2472,37 +2503,92 @@ this.groupService = groupService; } + // added some log statements to make debugging easier - LBlaze 2005.06.02 public XWikiAuthService getAuthService() { if (authService==null) { - String authClass; - if (isExo()) - authClass = Param("xwiki.authentication.authclass","com.xpn.xwiki.user.impl.exo.ExoAuthServiceImpl"); - else if (isLDAP()) - authClass = Param("xwiki.authentication.authclass","com.xpn.xwiki.user.impl.LDAP.LDAPAuthServiceImpl"); + + log.info("Initializing AuthService..."); + + String authClass = Param("xwiki.authentication.authclass"); + if( authClass != null ) + { + if( log.isDebugEnabled() ) log.debug("Using custom AuthClass "+authClass+"."); + } else - authClass = Param("xwiki.authentication.authclass","com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl"); + { + + if (isExo()) + authClass = "com.xpn.xwiki.user.impl.exo.ExoAuthServiceImpl"; + else if (isLDAP()) + authClass = "com.xpn.xwiki.user.impl.LDAP.LDAPAuthServiceImpl"; + else + authClass = "com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl"; + + if( log.isDebugEnabled() ) log.debug("Using default AuthClass "+authClass+"."); + + } try { + authService = (XWikiAuthService) Class.forName(authClass).newInstance(); + + log.debug("Initialized AuthService using Relfection."); + } catch (Exception e) { - e.printStackTrace(); + + log.warn("Failed to initialize AuthService "+authClass+" using Reflection, trying default implementations using 'new'.",e); + + // e.printStackTrace(); - not needed? -LBlaze + + // LDAP support wasn't here before, I assume it should be? -LBlaze + if (isExo()) authService = new ExoAuthServiceImpl(); + else if(isLDAP()) + authService = new LDAPAuthServiceImpl(); else authService = new XWikiAuthServiceImpl(); + + if( log.isDebugEnabled() ) log.debug("Initialized AuthService "+authService.getClass().getName()+" using 'new'."); + } } return authService; } + // added some log statements to make debugging easier - LBlaze 2005.06.02 public XWikiRightService getRightService() { if (rightService==null) { - String rightsClass = Param("xwiki.authentication.rightsclass","com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl"); + + log.info("Initializing RightService..."); + + String rightsClass = Param("xwiki.authentication.rightsclass"); + if( rightsClass != null ) + { + if( log.isDebugEnabled() ) log.debug("Using custom RightsClass "+rightsClass+"."); + } + else + { + rightsClass = "com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl"; + if( log.isDebugEnabled() ) log.debug("Using default RightsClass "+rightsClass+"."); + } + + try { + rightService = (XWikiRightService) Class.forName(rightsClass).newInstance(); + log.debug("Initialized RightService using Reflection."); + } catch (Exception e) { - e.printStackTrace(); + + log.warn("Failed to initialize RightService "+rightsClass+" using Reflection, trying default implementation using 'new'.",e); + + //e.printStackTrace(); - not needed? -LBlaze + rightService = new XWikiRightServiceImpl(); + + if( log.isDebugEnabled() ) log.debug("Initialized RightService "+authService.getClass().getName()+" using 'new'."); + } } return rightService;