org.davesag.tasktracker.client
Class ClientApp

java.lang.Object
  |
  +--org.pronoic.cos.client.AbstractClientApp
        |
        +--org.davesag.tasktracker.client.ClientApp
All Implemented Interfaces:
ClientAppInterface, CosStartable
Direct Known Subclasses:
GuiFramesTest

public class ClientApp
extends AbstractClientApp
implements CosStartable

This is a client aplication for entering and maintaining tasks. It is very simple and does not do any username/password authentication etc.

It is currently unfinished. Only task creation and listing is written so far.

Version:
0.1 pre-release 30 Mar 2002
See Also:
TaskTrackerEntry

Field Summary
static String BUDDY_LIST_NAME
          Constant list name for the list of users buddy names
static String CATEGORY_LIST_NAME
          Constant list name for the global list of categories
 Color mBackgroundColour
          the background colour for panels in this application
 PropertyChangeSupport mBuddyListPCS
          property change support for list of user's buddies
 PropertyChangeSupport mCategoriesPCS
          property change support for list of categories
 Vector mCategoryCache
          The local cache for the list of categories
 String mCaution
          a caution message that fires a property change event if changed, allowing listeners to display cautions accordingly.
 PropertyChangeSupport mCautioner
          property change support for cautioner
 Font mDisplayFont
          the diaplay font for panels in this application
 Color mDisplayTextColour
          the display text colour for panels in this application
 Vector mProjectCache
          The local cache for the list of projects
 PropertyChangeSupport mProjectsPCS
          property change support for list of projects
 Vector mTasksImWorkingOnCache
          The local cache of tasks user is working on.
 PropertyChangeSupport mTasksImWorkingOnPCS
          property change support for list of tasks user is working on
 Vector mTasksIReportedCache
          The local cache of tasks user reported.
 PropertyChangeSupport mTasksIReportedPCS
          property change support for list of tasks user reported
 Color mTitleColour
          the title colour for panels in this application
 String mUser
          the name of the logged in user.
 Vector mUserBuddiesCache
          The local cache of user's buddies.
static String PROJECT_LIST_NAME
          Constant list name for the global list of projects
static String TASKS_I_REPORTED
          Constant list name for the list of tasks user reported
static String TASKS_IM_WORKING_ON
          Constant list name for the list of tasks user is working on
 
Fields inherited from class org.pronoic.cos.client.AbstractClientApp
mCosConnector
 
Constructor Summary
ClientApp()
          Constructor that sets up the Look and Feel.
 
Method Summary
 void authenticateUser(String username, char[] password)
          authenticates the user given a username and password.
 String[] getKnownCategories()
          gets an array of categories known to the system.
 String[] getKnownCategories(Transaction tran)
          gets an array of categories known to the system under a transaction.
 String[] getKnownProjects()
          functionally equivalent to getKnownProjects below only without the use of a transaction.
 String[] getKnownProjects(Transaction tran)
          gets an array of project names known to the system under cover of a transaction.
 Vector getTasksImWorkingOn()
          gets the vector of TaskTrackerEntries the user is working on.
 Vector getTasksIReported()
          gets the vector of TaskTrackerEntries the user reported.
 String[] getUserBuddies()
          gets the users buddy list as an array of strings.
 String[] getUserBuddies(Transaction tran)
          gets the users buddy list as an array of strings under a transaction.
 String getUsername()
          gets the name of the currently logged in user.
 boolean login(String username, char[] password)
          Login will attempt to authenticate the user based on the values supplied.
static void main(String[] args)
          Let's see what this baby can do.
 boolean newTask(TaskTrackerEntry task)
          newTask adds a TaskTrackerEntry report to the Cos.
 void resetUser(String username)
          When an authenticated user first logs in we should load up the following list objects for them Their Buddy List.
 void setCategories(Vector c)
          set the Categories list and fires a property change event.
 void setCaution(String c)
          set the caution and fires a property change event.
 void setProjects(Vector p)
          set the Projects list and fires a property change event.
 void setTasksImWorkingOn(Vector b)
          set the TasksImWorkingOn List list and fires a property change event.
 void setTasksIReported(Vector b)
          set the TasksIReported List list and fires a property change event.
 void setUserBuddies(Vector b)
          set the UserBuddy List list and fires a property change event.
 void startup(SpaceConnectable connector, Transaction tran)
           
 boolean updateTask(TaskTrackerEntry oldTask, TaskTrackerEntry newTask)
          updateTask replaces the old task with the newly edited task, and reports that change to the COS.
 
Methods inherited from class org.pronoic.cos.client.AbstractClientApp
connect, disconnect, getApplicationName, getCosConnector, initialiseLookAndFeel, isConnected, isCosApplicationRunning, quit, setApplicationName, setConfigInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TASKS_IM_WORKING_ON

public static final String TASKS_IM_WORKING_ON
Constant list name for the list of tasks user is working on

TASKS_I_REPORTED

public static final String TASKS_I_REPORTED
Constant list name for the list of tasks user reported

BUDDY_LIST_NAME

public static final String BUDDY_LIST_NAME
Constant list name for the list of users buddy names

CATEGORY_LIST_NAME

public static final String CATEGORY_LIST_NAME
Constant list name for the global list of categories

PROJECT_LIST_NAME

public static final String PROJECT_LIST_NAME
Constant list name for the global list of projects

mTasksImWorkingOnCache

public Vector mTasksImWorkingOnCache
The local cache of tasks user is working on. Empty not null if no user logged in.

mTasksIReportedCache

public Vector mTasksIReportedCache
The local cache of tasks user reported. Empty not null if no user logged in.

mUserBuddiesCache

public Vector mUserBuddiesCache
The local cache of user's buddies. Empty not null if no user logged in.

mTasksImWorkingOnPCS

public PropertyChangeSupport mTasksImWorkingOnPCS
property change support for list of tasks user is working on

mTasksIReportedPCS

public PropertyChangeSupport mTasksIReportedPCS
property change support for list of tasks user reported

mBuddyListPCS

public PropertyChangeSupport mBuddyListPCS
property change support for list of user's buddies

mCategoryCache

public Vector mCategoryCache
The local cache for the list of categories

mProjectCache

public Vector mProjectCache
The local cache for the list of projects

mCategoriesPCS

public PropertyChangeSupport mCategoriesPCS
property change support for list of categories

mProjectsPCS

public PropertyChangeSupport mProjectsPCS
property change support for list of projects

mBackgroundColour

public final Color mBackgroundColour
the background colour for panels in this application

mDisplayTextColour

public final Color mDisplayTextColour
the display text colour for panels in this application

mTitleColour

public final Color mTitleColour
the title colour for panels in this application

mDisplayFont

public final Font mDisplayFont
the diaplay font for panels in this application

mUser

public String mUser
the name of the logged in user. Null is no user is logged in.

mCaution

public String mCaution
a caution message that fires a property change event if changed, allowing listeners to display cautions accordingly.

mCautioner

public PropertyChangeSupport mCautioner
property change support for cautioner
Constructor Detail

ClientApp

public ClientApp()
Constructor that sets up the Look and Feel.
Method Detail

login

public boolean login(String username,
                     char[] password)
Login will attempt to authenticate the user based on the values supplied.
Parameters:
username - The username of the person you wish to log in.
password - The user's password.
Returns:
true if the login was successful, false if not.

newTask

public boolean newTask(TaskTrackerEntry task)
newTask adds a TaskTrackerEntry report to the Cos.
    This involves the following train of logic
  1. create a transaction to wrap the entire creation of the task.
  2. then create the task.
  3. then examine the project name that came with this task.
    • does it exist in our global list of projects? does the global list of projects exist? if it doesn't we had best make on and add it to the system. someone has to be first after all.
    • if the supplied project doesn't exist in the current system add it to the global project list
  4. then examine the category that came with this task.
    • does it exist in our global list of tasks? does the global list of tasks exist? if it doesn't we had best make on and add it to the system. someone has to be first after all.
    • if the supplied category doesn't exist in the current system add it to the global category list
  5. then we examine the user assigned to the task. do we know them? do we even have a buddy list? if we don't then create it
  6. if the user is not already in your buddy list then add it.
  7. then get that users list of tasks they are working on and add this task.
  8. once again if the list doesn't exsist you must create it. this way when the user first logs in they can have a task assigned to them already
  9. then once again for the list of tasks you the user are working on.
  10. commit the transaction if everything went smoothly. abort if not.
Parameters:
task - The TaskTrackerEntry to add to the Cos.
Returns:
true if the task was entered, false if not.
See Also:
NewTaskFrame

updateTask

public boolean updateTask(TaskTrackerEntry oldTask,
                          TaskTrackerEntry newTask)
updateTask replaces the old task with the newly edited task, and reports that change to the COS.

Currently unimplemented.

there is a logical flow that needs specification here.

Parameters:
oldTask - the original task
newTask - the task you are replacing it with
Returns:
true if the update worked. false if not.

authenticateUser

public void authenticateUser(String username,
                             char[] password)
                      throws Exception
authenticates the user given a username and password. Right now it is fair to say this doesn't do anything. It will throw a general exception if there is no connection to the cos. some sort of proper AuthenticationException or whatever needs to be added.
Parameters:
username - The username of the person you wish to authenticate.
password - The password of the person you wish to authenticate as char[] not string.
See Also:
java.security

resetUser

public void resetUser(String username)
When an authenticated user first logs in we should load up the following list objects for them If any of these lists do not exist, then we should create that list for them on the spot. This whole action is wrappped in a transaction so that should any part of it fail, the whole lot will fail. Any exceptions here will cause the application to force quit for now. This should be changed to something a little less fatal perhaps, but right now any exceptions in here indicate that something pretty fundamental has broken.

Once the lists have been loaded we will use Notify events from the Cos to keep them updated.


setCaution

public void setCaution(String c)
set the caution and fires a property change event.
Parameters:
c - The words of caution.

setTasksImWorkingOn

public void setTasksImWorkingOn(Vector b)
set the TasksImWorkingOn List list and fires a property change event.
Parameters:
b - a filled out Vecotr of TaskTrackerEntries.

setTasksIReported

public void setTasksIReported(Vector b)
set the TasksIReported List list and fires a property change event.
Parameters:
b - a filled out Vecotr of TaskTrackerEntries.

setCategories

public void setCategories(Vector c)
set the Categories list and fires a property change event.
Parameters:
c - a Vector of category names.

setProjects

public void setProjects(Vector p)
set the Projects list and fires a property change event.
Parameters:
p - a Vector of project names.

setUserBuddies

public void setUserBuddies(Vector b)
set the UserBuddy List list and fires a property change event.
Parameters:
b - Vector of the user's buddy names.

main

public static void main(String[] args)
Let's see what this baby can do. The Main method just creates a new ClientApp, connects to the COS and opens a login panel. Then it just waits for events.
Parameters:
args - args[0] should be a URL of a suitable config file.

getUsername

public String getUsername()
gets the name of the currently logged in user.
Returns:
the nsme of the currently logged in user. null if no-one logged in.

getUserBuddies

public String[] getUserBuddies()
gets the users buddy list as an array of strings.
Returns:
String array of user buddy names.

getUserBuddies

public String[] getUserBuddies(Transaction tran)
gets the users buddy list as an array of strings under a transaction.
Parameters:
tran - the transaction covering the retrieval.
Returns:
String array of user buddy names.

getTasksImWorkingOn

public Vector getTasksImWorkingOn()
gets the vector of TaskTrackerEntries the user is working on.
Returns:
the vector of TaskTrackerEntries the user is working on, or null if there is no logged in user.

getTasksIReported

public Vector getTasksIReported()
gets the vector of TaskTrackerEntries the user reported.
Returns:
the vector of TaskTrackerEntries the user reported, or null if there is no logged in user.

getKnownCategories

public String[] getKnownCategories()
gets an array of categories known to the system.
Returns:
array of categories, or null if there are no categories, or we are not cos connected.

getKnownCategories

public String[] getKnownCategories(Transaction tran)
gets an array of categories known to the system under a transaction.
Parameters:
tran - the transacton under which to perform the retrieval.
Returns:
array of categories, or null if there are no categories, or we are not cos connected.

getKnownProjects

public String[] getKnownProjects()
functionally equivalent to getKnownProjects below only without the use of a transaction.
Returns:
array of projects, or null if there are no projects, or we are not cos connected.

getKnownProjects

public String[] getKnownProjects(Transaction tran)
gets an array of project names known to the system under cover of a transaction.
Parameters:
tran - the transaction covering retrieval of the project list.
Returns:
array of projects, or null if there are no projects, or we are not cos connected.

startup

public void startup(SpaceConnectable connector,
                    Transaction tran)
             throws GeneralCosException
Specified by:
startup in interface CosStartable


tasktracker API version 0.1 pre-release Copyright 2002 Dave Sag. Released under the BSD Licence.