Holger's
Java API

com.antelmann.timeregister
Class RemotePunchDBClient

java.lang.Object
  extended by com.antelmann.timeregister.RemotePunchDBClient
All Implemented Interfaces:
PunchDB

public class RemotePunchDBClient
extends Object
implements PunchDB

wraps a RemotePunchDB by delegating all requests to it. This way, a client application can transparently work with a PunchDB.

Author:
Holger Antelmann

Constructor Summary
RemotePunchDBClient(RemotePunchDB remoteDB)
           
 
Method Summary
 void addPunchListener(PunchListener listener)
          registers a listener for calls of punch(PunchData)
 void close()
          empty implementation
 PunchData getFirstPunch(User user)
          if user is null, the first punch of all is returned.
 PunchData getLastPunch(User user)
          if user is null, the last punch of all is returned.
 PunchDataAnalyzer getPunchData(User user, Date from, Date until, String location, String activity)
          retrieves the relevant set of Punchdata objects in a PunchDataAnalyzer
 PunchListener[] getPunchListeners()
           
static RemotePunchDB getRemoteObject(String server)
           
 Map<Object,TimeUser> getUsers()
          returns an unmodifiable view of the users, mapping the id to a TimeUser
 void punch(PunchData entry)
          performs consistency check before adding the entry.
 void removeListener(PunchListener listener)
           
 void updatePassword(User user)
          updates the permanent storage with the password that is now present in the user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotePunchDBClient

public RemotePunchDBClient(RemotePunchDB remoteDB)
Method Detail

close

public void close()
empty implementation


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 entry)
           throws DatabaseException,
                  FormatException
Description copied from interface: PunchDB
performs consistency check before adding the entry. This is the method that should be generally used for adding data to a database. If the database was in a consistent state before this entry was added, the database will be constistent for the user in the entry after calling this method that stores the entry into the database.

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:
PunchDB.addPunchListener(PunchListener), PunchDataAnalyzer.verifyPunch(PunchDB, PunchData)

getPunchData

public PunchDataAnalyzer getPunchData(User user,
                                      Date from,
                                      Date until,
                                      String location,
                                      String activity)
                               throws DatabaseException
Description copied from interface: PunchDB
retrieves the relevant set of Punchdata objects in a PunchDataAnalyzer

Specified by:
getPunchData in interface PunchDB
Parameters:
user - limits retrieval by employee; if null, this limit does not apply
from - limits retrieval by begin date; if null, this limit does not apply
until - limits retrieval by end date; if null, this limit does not apply
Returns:
a set of PunchData objects
Throws:
DatabaseException
See Also:
PunchData

getLastPunch

public PunchData getLastPunch(User user)
                       throws DatabaseException
Description copied from interface: PunchDB
if user is null, the last punch of all is returned. If no punch data is available, null is returned.

Specified by:
getLastPunch in interface PunchDB
Throws:
DatabaseException

getFirstPunch

public PunchData getFirstPunch(User user)
                        throws DatabaseException
Description copied from interface: PunchDB
if user is null, the first punch of all is returned. If no punch data is available, null is returned.

Specified by:
getFirstPunch in interface PunchDB
Throws:
DatabaseException

getUsers

public Map<Object,TimeUser> getUsers()
                              throws DatabaseException
Description copied from interface: PunchDB
returns an unmodifiable view of the users, mapping the id to a TimeUser

Specified by:
getUsers in interface PunchDB
Throws:
DatabaseException

updatePassword

public void updatePassword(User user)
                    throws DatabaseException,
                           IllegalArgumentException
Description copied from interface: PunchDB
updates the permanent storage with the password that is now present in the user

Specified by:
updatePassword in interface PunchDB
Throws:
DatabaseException
IllegalArgumentException
See Also:
UserImpl.setPassword(char[]), UserImpl.getPasswordHash()

getRemoteObject

public static RemotePunchDB getRemoteObject(String server)
                                     throws NotBoundException,
                                            RemoteException,
                                            AccessException,
                                            MalformedURLException
Throws:
NotBoundException
RemoteException
AccessException
MalformedURLException


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