org.yawlfoundation.yawl.resourcing.datastore.orgdata
Class DataSource

java.lang.Object
  extended by org.yawlfoundation.yawl.resourcing.datastore.orgdata.DataSource
Direct Known Subclasses:
EmptyDataSource, HibernateImpl, jdbcImpl, LDAPSource

public abstract class DataSource
extends Object

This abstract class is to be extended by all data source implementations to provide organisational data to the resourcing classes in a uniform and expected manner.

Author:
Michael Adams v0.1, 03/08/2007

Field Summary
protected  String _name
           
 
Constructor Summary
DataSource()
           
 
Method Summary
abstract  boolean authenticate(String userid, String password)
          Allows a user/password pair to be passed to an external data source for validation.
abstract  boolean delete(Object obj)
          deletes a persisted object
abstract  int execUpdate(String query)
          Executes an low-level update command
 String getName()
           
protected  String getNextID(String prefix)
          A default unique ID generator.
abstract  void importObj(Object obj)
          imports (persists) a new object into the datastore.
abstract  String insert(Object obj)
          inserts (persists) a new object record into the datastore
abstract  ResourceDataSet loadResources()
          Loads the entire contents of the org datastores into the relevant Participant, Role, Capability, Position and OrgGroup objects
 void setName(String name)
           
abstract  void update(Object obj)
          updates a persisted object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_name

protected String _name
Constructor Detail

DataSource

public DataSource()
Method Detail

setName

public void setName(String name)

getName

public String getName()

getNextID

protected String getNextID(String prefix)
A default unique ID generator. Must be called from each table's 'insert' method to create a new primary key for the row to be inserted. May be overridden by implementations that use a different unique key format (or ignored in favour of some other method that returns a unique ID).

Parameters:
prefix - some (optional) characters to place at the start of the id
Returns:
a unique String identifier

loadResources

public abstract ResourceDataSet loadResources()
Loads the entire contents of the org datastores into the relevant Participant, Role, Capability, Position and OrgGroup objects

Returns:
a fully populated ResourceSet

update

public abstract void update(Object obj)
updates a persisted object

Parameters:
obj - the object to update

delete

public abstract boolean delete(Object obj)
deletes a persisted object

Parameters:
obj - the object to delete

insert

public abstract String insert(Object obj)
inserts (persists) a new object record into the datastore

Parameters:
obj - the object to insert
Returns:
a newly created unique identifier (primary key) for the inserted object

importObj

public abstract void importObj(Object obj)
imports (persists) a new object into the datastore. The difference between this method and 'insert' is that insert generates a new object id - this method does not (it assumes the object already has a valid id).

Parameters:
obj - the object to insert

execUpdate

public abstract int execUpdate(String query)
Executes an low-level update command

Parameters:
query - the query to execute
Returns:
the number of rows affected

authenticate

public abstract boolean authenticate(String userid,
                                     String password)
                              throws YAuthenticationException
Allows a user/password pair to be passed to an external data source for validation.

Parameters:
userid - the userid
password - the plain-text password
Returns:
the outcome of the authentication
Throws:
YAuthenticationException


Copyright © 2004-2012 The YAWL Foundation.