com.sas.util.login
Class LoginBeanCFBValidate

com.sas.util.login.LoginBeanCFBValidate
All Implemented Interfaces:
com.sas.util.login.LoginBeanValidateInterface

public class LoginBeanCFBValidate
implements com.sas.util.login.LoginBeanValidateInterface

The LoginBeanCFBValidate class is an implementation of the LoginBeanValidateInterface for com.sas.util.connection.ConnectionFactoryBean. It performs login credential validation for the com.sas.services.connection.ConnectionFactory represented by the bean. This class can be set as a validation handler for the LoginBean and the bean will then perform ConnectionFactory validation for the credentials entered in by the user.

The following example illustrates a typical use of the LoginBean in conjunction with this class.

 LoginBean loginBean = new LoginBean();
 loginBean.setTitle("Enter your username and password:");
 
 // Provide a default value for the username.
 loginBean.setUsername("James");
 
 // Allow 2 retry attempts before failing (default is 3).
 loginBean.setAttempts(2);
 
 // Instantiate the LoginBeanSwingUtil class using the constructor which sets the
 // login bean as the model.
 LoginBeanSwingUtil loginBeanSwingUtil = new LoginBeanSwingUtil(loginBean);
 
 // Set our LoginBeanSwingUtil instance as the action handler for the login bean.
 // Note that the LoginBeanSwingUtil class implements LoginBeanActionInterface as a convenience for
 // typical usage scenarios.
 loginBean.setActionHandler(loginBeanSwingUtil);
 
 // Instantiate this validation class, providing the login bean and connection factory in the constructor.
 // Note: The connectionFactory object is defined elsewhere. See the com.sas.util.connection.ConnectionFactoryBean
 // documentation for details on how to configure the ConnectionFactoryBean.
 LoginBeanCFBValidate CFBValidate = new LoginBeanCFBValidate(loginBean, connectionFactory);
 
 // Set this instance as the validation handler for the login bean.
 loginBean.setValidateHandler(CFBValidate);
 
 // Call the showDialog method to display a model Swing dialog with a visual representation
 // of the login bean.
 loginBeanSwingUtil.showDialog("LoginBean", null);
 


Field Summary
protected  ConnectionFactoryBean connectionFactoryBean
          The associated LoginBean instance.
protected  boolean debug
          A flag indicating whether debugging information should be displayed.
protected  com.sas.util.login.LoginBean loginBean
          The associated LoginBean instance.
 
Constructor Summary
LoginBeanCFBValidate()
          Default constructor.
LoginBeanCFBValidate(com.sas.util.login.LoginBean loginBean, ConnectionFactoryBean connectionFactoryBean)
          Constructor allowing for the specification of a LoginBean and ConnectionFactoryBean
 
Method Summary
 ConnectionFactoryBean getConnectionFactoryBean()
          Returns the ConnectionFactoryBean instance associated with this class.
 boolean getDebug()
          Returns the value for the debug property.
 com.sas.util.login.LoginBean getLoginBean()
          Returns the LoginBean instance associated with this class.
protected  void init()
          Initialization of member variables.
static void main(java.lang.String[] argv)
           
 void setConnectionFactoryBean(ConnectionFactoryBean bean)
          Sets the ConnectionFactoryBean associated with this util class.
 void setDebug(boolean value)
          Sets the debug property, which when enabled can assist in tracking down login validation problems.
 void setLoginBean(com.sas.util.login.LoginBean bean)
          Sets the LoginBean associated with this util class.
 boolean validate(java.lang.String username, java.lang.String password)
          Implementation of the LoginBeanValidateInterface.
 

Field Detail

loginBean

protected com.sas.util.login.LoginBean loginBean
The associated LoginBean instance.


connectionFactoryBean

protected ConnectionFactoryBean connectionFactoryBean
The associated LoginBean instance.


debug

protected boolean debug
A flag indicating whether debugging information should be displayed.

Constructor Detail

LoginBeanCFBValidate

public LoginBeanCFBValidate()
Default constructor.


LoginBeanCFBValidate

public LoginBeanCFBValidate(com.sas.util.login.LoginBean loginBean,
                            ConnectionFactoryBean connectionFactoryBean)
Constructor allowing for the specification of a LoginBean and ConnectionFactoryBean

Parameters:
loginBean - An instance of LoginBean associated with this class.
connectionFactoryBean - An instance of a ConnectionFactoryBean associated with this class.
Method Detail

init

protected void init()
Initialization of member variables.


setLoginBean

public void setLoginBean(com.sas.util.login.LoginBean bean)
Sets the LoginBean associated with this util class.

Parameters:
bean - An instance of LoginBean to associate with this class.
See Also:
getLoginBean()

getLoginBean

public com.sas.util.login.LoginBean getLoginBean()
Returns the LoginBean instance associated with this class.

Returns:
The instance of LoginBean.
See Also:
setLoginBean(LoginBean)

setConnectionFactoryBean

public void setConnectionFactoryBean(ConnectionFactoryBean bean)
Sets the ConnectionFactoryBean associated with this util class.

Parameters:
bean - An instance of ConnectionFactoryBean to associate with this class.
See Also:
getConnectionFactoryBean()

getConnectionFactoryBean

public ConnectionFactoryBean getConnectionFactoryBean()
Returns the ConnectionFactoryBean instance associated with this class.

Returns:
The instance of ConnectionFactoryBean.
See Also:
setConnectionFactoryBean(ConnectionFactoryBean)

setDebug

public void setDebug(boolean value)
Sets the debug property, which when enabled can assist in tracking down login validation problems.

Parameters:
value - The boolean value for whether or not debugging should be enabled.
See Also:
getDebug()

getDebug

public boolean getDebug()
Returns the value for the debug property.

Returns:
The boolean value for whether or not debugging is enabled.
See Also:
setDebug(boolean)

validate

public boolean validate(java.lang.String username,
                        java.lang.String password)
Implementation of the LoginBeanValidateInterface. The validate method performs the validation of the supplied credentials within the ConnectionFactoryBean.

If exceptions are thrown during validation within the ConnectionFactoryBean, they are caught and analyzed to in an attempt to notify the LoginBean of the type of failure encountered. This information can then be presented to the user in some manner to highlight the type of problem.

Specified by:
validate in interface com.sas.util.login.LoginBeanValidateInterface
Parameters:
username - The name of the user.
password - The password for the specified username.
Returns:
True if validation succeeded, otherwise false.

main

public static void main(java.lang.String[] argv)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.