protected ITokenGenerator getTokenGenerator ( ) throws ServletException { if ( tokenGenerator == null ) { String tokenGeneratorClassName = getConfig ( ) . getManagementApiAuthTokenGenerator ( ) ; if ( tokenGeneratorClassName == null ) throw new ServletException ( "No token generator class specified." ) ; //$NON-NLS-1$ try { Class < ? > c = Class . forName ( tokenGeneratorClassName ) ; tokenGenerator = ( ITokenGenerator ) c . newInstance ( ) ; } catch ( Exception e ) { throw new ServletException ( "Error creating token generator." ) ; //$NON-NLS-1$ } } return tokenGenerator ; }
Gets an instance of the configured token generator .