KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > security > LogonControllerFactory


1 package com.sslexplorer.security;
2
3
4 public class LogonControllerFactory {
5
6     
7     static Class JavaDoc logonControllerClass = DefaultLogonController.class;
8     static LogonController logonController = null;
9     static private boolean locked = false;
10     
11     public static LogonController getInstance() {
12         
13         if(logonController!=null)
14             return logonController;
15         
16         // Use the default logon controller if no other has been registered
17
try {
18             logonController = (LogonController) logonControllerClass.newInstance();
19             logonController.init();
20         } catch (Exception JavaDoc e) {
21             logonController = new DefaultLogonController();
22         }
23         
24         return logonController;
25     }
26     
27     public static void setLogonControllerClass(Class JavaDoc logonControllerClass, boolean lock) {
28
29         // TODO: locked state is not implemented.
30
LogonControllerFactory.logonControllerClass = logonControllerClass;
31         logonController = null;
32         locked = lock;
33     }
34 }
35
Popular Tags