Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.ou.kmi.buddyspace.core
Class BSAuthorizationBean  view BSAuthorizationBean download BSAuthorizationBean.java

java.lang.Object
  extended byedu.ou.kmi.buddyspace.core.BSAuthorizationBean
All Implemented Interfaces:
org.jabber.jabberbeans.PacketListener

public class BSAuthorizationBean
extends java.lang.Object
implements org.jabber.jabberbeans.PacketListener

BSAuthorizationBean provides athentication handling. It relies on BSInfoQueryBean, which must be set after each reconnection.


Field Summary
private  java.util.Vector authListeners
           
private  org.jabber.jabberbeans.IQBean iqBean
           
private  java.lang.String name
           
private  java.lang.String password
           
private  java.lang.String resource
           
private  BSAuthState state
           
private  java.lang.String user
           
 
Constructor Summary
(package private) BSAuthorizationBean()
          Constructor
(package private) BSAuthorizationBean(org.jabber.jabberbeans.IQBean iqBean)
          Constructor, which sets existing and connected IQBean.
 
Method Summary
 void addAuthListener(BSAuthListener listener)
          Adds BSAuthListener to listeners notified when authentication state changes.
protected  void authorize(java.lang.String user, java.lang.String password, java.lang.String resource)
          Invokes authentication of given user.
private  void authorized()
          Invoked when authentication succeeded.
protected  org.jabber.jabberbeans.IQBean getIQBean()
          Returns currently used IQBean.
private  void handleError(org.jabber.jabberbeans.InfoQuery iq)
          Handles InfoQuery packet, if it does contain an error.
private  void handleResult(org.jabber.jabberbeans.InfoQuery iq)
          Handles InfoQuery packet, if it does contain a result.
private  void handleSet(org.jabber.jabberbeans.InfoQuery iq)
          Handles InfoQuery packet, if it IQ-set.
private  void notifyAuthListeners(BSAuthEvent ae)
          Notifies authentication listeners when authentication state changes.
protected  void prepareToDestroy()
          Frees all object bindings to allow object destroy
 void receivedPacket(PacketEvent pe)
          Invoked when a IQ packet is received.
 void removeAllAuthListeners()
          Removes all listeners notified when authentication state changes.
 void removeAuthListener(BSAuthListener listener)
          Removes BSAuthListener to listeners notified when authentication state changes.
 void sendFailed(PacketEvent pe)
          Invoked when a IQ packet send failes.
private  void sendPassword(IQAuth extension)
          Sends user information including password.
protected  void sendPassword(java.lang.String user, java.lang.String password, java.lang.String resource)
          Sends user information including password.
 void sentPacket(PacketEvent pe)
          Invoked when a IQ packet is sent.
protected  void setIQBean(org.jabber.jabberbeans.IQBean iqBean)
          Sets existing and connected IQBean.
private  void setState(JID jid, int state, java.lang.String id)
          Sets current state in authentication process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jabber.jabberbeans.PacketListener
receivedPacket, sentPacket
 

Field Detail

iqBean

private org.jabber.jabberbeans.IQBean iqBean

state

private BSAuthState state

user

private java.lang.String user

password

private java.lang.String password

resource

private java.lang.String resource

name

private final java.lang.String name
See Also:
Constant Field Values

authListeners

private java.util.Vector authListeners
Constructor Detail

BSAuthorizationBean

BSAuthorizationBean()
Constructor


BSAuthorizationBean

BSAuthorizationBean(org.jabber.jabberbeans.IQBean iqBean)
Constructor, which sets existing and connected IQBean. Then this is registered as listener for IQ packets.

Method Detail

setIQBean

protected void setIQBean(org.jabber.jabberbeans.IQBean iqBean)
Sets existing and connected IQBean. Then this is registered as listener for IQ packets.


getIQBean

protected org.jabber.jabberbeans.IQBean getIQBean()
Returns currently used IQBean.


prepareToDestroy

protected void prepareToDestroy()
Frees all object bindings to allow object destroy


setState

private void setState(JID jid,
                      int state,
                      java.lang.String id)
Sets current state in authentication process.


authorize

protected void authorize(java.lang.String user,
                         java.lang.String password,
                         java.lang.String resource)
Invokes authentication of given user.


sendPassword

private void sendPassword(IQAuth extension)
Sends user information including password. This is done during the second phase of authentication process.


sendPassword

protected void sendPassword(java.lang.String user,
                            java.lang.String password,
                            java.lang.String resource)
Sends user information including password. This way the first phase when asking for required data is omitted and data is sent directly.


receivedPacket

public void receivedPacket(PacketEvent pe)
Invoked when a IQ packet is received.


sendFailed

public void sendFailed(PacketEvent pe)
Invoked when a IQ packet send failes.


sentPacket

public void sentPacket(PacketEvent pe)
Invoked when a IQ packet is sent.


handleError

private void handleError(org.jabber.jabberbeans.InfoQuery iq)
Handles InfoQuery packet, if it does contain an error. Before this is called it checks if that is response on the sent IQ authentication packet.


handleResult

private void handleResult(org.jabber.jabberbeans.InfoQuery iq)
Handles InfoQuery packet, if it does contain a result. Before this is called it checks if that is response on the sent IQ authentication packet.


handleSet

private void handleSet(org.jabber.jabberbeans.InfoQuery iq)
Handles InfoQuery packet, if it IQ-set. Before this is called it checks if that is response on the sent IQ authentication packet.


authorized

private void authorized()
Invoked when authentication succeeded.


addAuthListener

public void addAuthListener(BSAuthListener listener)
Adds BSAuthListener to listeners notified when authentication state changes.


removeAuthListener

public void removeAuthListener(BSAuthListener listener)
Removes BSAuthListener to listeners notified when authentication state changes.


removeAllAuthListeners

public void removeAllAuthListeners()
Removes all listeners notified when authentication state changes. This can be used before to free dependencies and allow dispose of all objects.


notifyAuthListeners

private void notifyAuthListeners(BSAuthEvent ae)
Notifies authentication listeners when authentication state changes.