jSyncManager

org.jSyncManager.API.Protocol.Util
Class DLPUserInfo

java.lang.Object
  |
  +--org.jSyncManager.API.Protocol.Util.DLPUserInfo
All Implemented Interfaces:
java.io.Serializable

public class DLPUserInfo
extends java.lang.Object
implements java.io.Serializable

The DLP User Information class. This class holds the user information for the handheld.

Version:
$Revision: 1.5 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>
Last modified by: $Author: yaztromo $ on $Date: 2003/05/13 07:13:12 $.
See Also:
Serialized Form

Constructor Summary
DLPUserInfo(byte[] userBlock)
          Create a new DLP User Info object based on the data queried from the handheld.
DLPUserInfo(int uid, int vid, int hostID, java.lang.String userName)
          Construct a new DLP User Info object using the specified information.
 
Method Summary
static byte[] encryptPasswordV4(java.lang.String passwd)
          Method to encrypt a password String.
 byte[] getEncryptedPassword()
          Retreives the encrypted password for this user.
 int getLastHostID()
          Retreives the last sync host ID.
 java.util.Calendar getLastSuccessfulSyncDate()
          Retreives the last successful sync date.
 java.util.Calendar getLastSyncDate()
          Retreives the last sync date.
 int getUserID()
          Retreives the user ID for this user object.
 java.lang.String getUserName()
          Retreives the user name for this user object.
 int getViewerID()
          Retreives the viewer ID for this user object.
 byte[] object2Bytes()
          Convert this object to a byte array suitable for writing to the handheld.
 void setLastHostID(int i)
          Set the last sync host ID.
 void setLastSyncDate(java.util.Calendar date)
          Set the last sync date.
 void setUserID(int i)
          Set the user ID.
 void setUserName(java.lang.String s)
          Set the user name.
 void setViewerID(int i)
          Set the viewer ID.
 java.lang.String toString()
          Create a human-readable String representation of this object.
 boolean verifyPassword(java.lang.String passwd)
          This method is called to test to see if the supplied password matches the password stored within this DLPUserInfo object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DLPUserInfo

public DLPUserInfo(int uid,
                   int vid,
                   int hostID,
                   java.lang.String userName)
Construct a new DLP User Info object using the specified information.
Parameters:
uid - the user ID.
vid - the viewer ID.
hostID - the host PC ID.
userName - the user name to create.

DLPUserInfo

public DLPUserInfo(byte[] userBlock)
            throws DLPFunctionCallException
Create a new DLP User Info object based on the data queried from the handheld.
Parameters:
userBlock - the user info byte array to parse.
Throws:
DLPFunctionCallException - thrown if any parsing errors occur.
Method Detail

getEncryptedPassword

public byte[] getEncryptedPassword()
Retreives the encrypted password for this user.
Returns:
the encrypted password for this user, as a byte array.

getLastHostID

public int getLastHostID()
Retreives the last sync host ID.
Returns:
the last sync host ID.

getLastSuccessfulSyncDate

public java.util.Calendar getLastSuccessfulSyncDate()
Retreives the last successful sync date.
Returns:
the last successful sync date.

getLastSyncDate

public java.util.Calendar getLastSyncDate()
Retreives the last sync date.
Returns:
the last sync date.

getUserID

public int getUserID()
Retreives the user ID for this user object.
Returns:
the user ID for this user object.

getUserName

public java.lang.String getUserName()
Retreives the user name for this user object.
Returns:
the user name for this user object.

getViewerID

public int getViewerID()
Retreives the viewer ID for this user object.
Returns:
the viewer ID for this user object.

object2Bytes

public byte[] object2Bytes()
Convert this object to a byte array suitable for writing to the handheld.
Returns:
a byte array representing the data in this object.

setLastHostID

public void setLastHostID(int i)
Set the last sync host ID.
Parameters:
i - the last sync host ID.

setLastSyncDate

public void setLastSyncDate(java.util.Calendar date)
Set the last sync date.
Parameters:
date - the last sync date.

setUserID

public void setUserID(int i)
Set the user ID.
Parameters:
i - the user ID.

setUserName

public void setUserName(java.lang.String s)
                 throws DLPFunctionCallException
Set the user name.
Parameters:
s - the user name to set.
Throws:
DLPFunctionCallException - thrown if the user name is too long.

setViewerID

public void setViewerID(int i)
Set the viewer ID.
Parameters:
i - the viewer ID.

toString

public java.lang.String toString()
Create a human-readable String representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
a human-readable String representation of this object.

encryptPasswordV4

public static byte[] encryptPasswordV4(java.lang.String passwd)
                                throws EncryptionNotSupportedException
Method to encrypt a password String. This method will encrypt a password in the manner used by the PalmOS v4.
Parameters:
passwd - the plain-text password to encrypt.
Returns:
an array of bytes containing the encrypted password.

verifyPassword

public boolean verifyPassword(java.lang.String passwd)
                       throws EncryptionNotSupportedException
This method is called to test to see if the supplied password matches the password stored within this DLPUserInfo object. Note that at this time this method only uses PalmOS v4 password encryption.
Parameters:
passwd - the clear-text password to test against the encrypted password.
Returns:
true if the password is correct, false otherwise.

jSyncManager

Copyright (c) 1999 - 2003 Brad BARCLAY and others. All Rights Reserved.