Holger's
Java API

com.antelmann.timeregister
Class AbstractPunchDB

java.lang.Object
  extended by com.antelmann.timeregister.AbstractPunchDB
All Implemented Interfaces:
PunchDB
Direct Known Subclasses:
FilePunchDB, PunchDataAnalyzer, PunchDBClient, SQLPunchDB

public abstract class AbstractPunchDB
extends Object
implements PunchDB

implmenents the verification and the listening capabilities and leaves the rest to the subclass

Author:
Holger Antelmann

Field Summary
protected  ArrayList<PunchListener> listeners
           
 
Constructor Summary
AbstractPunchDB()
           
 
Method Summary
 void addPunchListener(PunchListener listener)
          registers a listener for calls of punch(PunchData)
 PunchListener[] getPunchListeners()
           
 void punch(PunchData pd)
          first verifies the PunchData, then stores it, and finally calls the listeners.
 void removeListener(PunchListener listener)
           
protected abstract  void store(PunchData pd)
          used by the final punch(PunchData) method to delegate the database storing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.antelmann.timeregister.PunchDB
getFirstPunch, getLastPunch, getPunchData, getUsers, updatePassword
 

Field Detail

listeners

protected ArrayList<PunchListener> listeners
Constructor Detail

AbstractPunchDB

public AbstractPunchDB()
Method Detail

addPunchListener

public void addPunchListener(PunchListener listener)
Description copied from interface: PunchDB
registers a listener for calls of punch(PunchData)

Specified by:
addPunchListener in interface PunchDB
See Also:
PunchDB.punch(PunchData)

removeListener

public void removeListener(PunchListener listener)

getPunchListeners

public PunchListener[] getPunchListeners()

punch

public void punch(PunchData pd)
           throws DatabaseException,
                  FormatException
first verifies the PunchData, then stores it, and finally calls the listeners. Normally, this method should not be overridden! If you do, you may either call this super method, or handle verification, storing and listener notification yourself.

Specified by:
punch in interface PunchDB
Throws:
FormatException - if the employee is already checked in/out, or if there is a punch that occured thereafter, or if the first punch for the user is a checkout.
DatabaseException
See Also:
PunchDataAnalyzer.verifyPunch(PunchDB, PunchData), store(PunchData), addPunchListener(PunchListener)

store

protected abstract void store(PunchData pd)
                       throws DatabaseException
used by the final punch(PunchData) method to delegate the database storing. (Note that a PunchAdminDB makes this method public)

Throws:
DatabaseException
See Also:
PunchDB.punch(PunchData)


(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads