com.zphinx.spine.data
Class AbstractDataProxy

java.lang.Object
  extended by com.zphinx.spine.data.AbstractDataProxy
Direct Known Subclasses:
DataBaseProxy, EJBProxy, FileProxy, HibernateProxy, LdapProxy

public abstract class AbstractDataProxy
extends Object

A skeleton class used to select a suitable data persistence object to use to process the request.Presently it provides definitions for 6 types of persistence systems i.e:

based data storage or data mapping software.

Version:
1.0

Copyright ©Zphinx Software Solutions

Author:
David Ladapo (davidl@zphinx.com)

Field Summary
static int DATA_DATABASE
          The constant representing a database persistence system
static int DATA_EJB
          The constant representing a EJB based persistence system
static int DATA_HIBERNATE
          The constant representing an Hibernate driven persistence system
static int DATA_JAVASPACE
          The constant representing a JavaSpace/Jini persistence system
static int DATA_LDAP
          The constant representing an LDAP persistence system
static int DATA_PROPERTIES_FILE
          The constant representing a properties persistence system
 
Constructor Summary
AbstractDataProxy()
           
 
Method Summary
abstract  void close(DataAccessObject dao)
          Close and dispose of all opened resources
protected  Object createDataAccessImpl(String className, DAOInput daoCons)
          Create an object which implements a DataAccessObject suitable for performing our data operations
 Object execute(DataAccessObject dao, DataTransferObject obj)
          Execute a process in the data storage object and return a suitable result object
 DataAccessObject getDataAccessObject()
          Gets the currently active DataAccessObject associated with this proxy
static AbstractDataProxy getInstance(int i)
          The method which returns a handle to the relevant subclass
protected  int getStoreType()
          Gets the type of persistence system in use by this system.
 boolean init(Object obj1, String className, DAOInput daoCons)
          Initializes all the objects needed by this Abstract Factory, opens the necessary resource and throws an exception when it cannot find a persistence object
protected abstract  DataAccessObject open(Object obj, String s, DAOInput daoCons)
          Open the datastore and fetch the correct type of persistence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_PROPERTIES_FILE

public static final int DATA_PROPERTIES_FILE
The constant representing a properties persistence system

See Also:
Constant Field Values

DATA_DATABASE

public static final int DATA_DATABASE
The constant representing a database persistence system

See Also:
Constant Field Values

DATA_EJB

public static final int DATA_EJB
The constant representing a EJB based persistence system

See Also:
Constant Field Values

DATA_JAVASPACE

public static final int DATA_JAVASPACE
The constant representing a JavaSpace/Jini persistence system

See Also:
Constant Field Values

DATA_LDAP

public static final int DATA_LDAP
The constant representing an LDAP persistence system

See Also:
Constant Field Values

DATA_HIBERNATE

public static final int DATA_HIBERNATE
The constant representing an Hibernate driven persistence system

See Also:
Constant Field Values
Constructor Detail

AbstractDataProxy

public AbstractDataProxy()
Method Detail

init

public final boolean init(Object obj1,
                          String className,
                          DAOInput daoCons)
                   throws SpineApplicationException
Initializes all the objects needed by this Abstract Factory, opens the necessary resource and throws an exception when it cannot find a persistence object

Parameters:
obj1 - A Suitable Object
className - A String representing the type of DAO to create.
daoCons - The DaoConstructor passed to this object
Throws:
SpineApplicationException

open

protected abstract DataAccessObject open(Object obj,
                                         String s,
                                         DAOInput daoCons)
                                  throws SpineApplicationException
Open the datastore and fetch the correct type of persistence

Parameters:
obj - Arbitary object to pass to this method
s - A String representing the type of DAO to create.
daoCons - The DaoConstructor passed to this object
Returns:
A suitable DataAccessObject object if the operation succeeds
Throws:
Throws - a SpineApplicationException if unable to load a the appropriate DataAbstract Object
SpineApplicationException

execute

public final Object execute(DataAccessObject dao,
                            DataTransferObject obj)
Execute a process in the data storage object and return a suitable result object

Parameters:
dao - The DataAccessObject associated with this proxy
obj - The object to be parsed by the DAO
Returns:
A Object containing the output of this data process
Throws:
SpineApplicationException

getStoreType

protected int getStoreType()
Gets the type of persistence system in use by this system. Presently properties and database.BMP EJB implementation under development

Returns:
int The concatenation of all the generated errors

getInstance

public static final AbstractDataProxy getInstance(int i)
The method which returns a handle to the relevant subclass

Parameters:
i - An int which represents the type of proxy we wish to create
Returns:
AbstractDataProxy the object which implements this interface

close

public abstract void close(DataAccessObject dao)
                    throws SpineApplicationException
Close and dispose of all opened resources

Parameters:
dao - The DataAccessObject associated with this proxy
Throws:
SpineApplicationException

getDataAccessObject

public DataAccessObject getDataAccessObject()
Gets the currently active DataAccessObject associated with this proxy

Returns:
The currently active DataAccessObject associated with this proxy

createDataAccessImpl

protected Object createDataAccessImpl(String className,
                                      DAOInput daoCons)
Create an object which implements a DataAccessObject suitable for performing our data operations

Parameters:
className - A string representing the type of DataAccessObject we wish to create
daoCons - The DaoConstructor object used by the DAO to instantiate it's type
Returns:
The object which represents the Data Access Object we wish to create