com.zphinx.spine.data.impl
Class FileProxy

java.lang.Object
  extended by com.zphinx.spine.data.AbstractDataProxy
      extended by com.zphinx.spine.data.impl.FileProxy

public class FileProxy
extends AbstractDataProxy

FileProxy serves as a proxy for DataAccessObjects which require a file or a properties file for data persistence.

It automatically retrieves the file at a known file path and loads it into an AbstractFileDAO either as a byte[] array or as a properties object which can then be used directly by the client programmer.

Version:
1.0

copyright ©Zphinx Software Solutions

Author:
David Ladapo

Field Summary
 
Fields inherited from class com.zphinx.spine.data.AbstractDataProxy
DATA_DATABASE, DATA_EJB, DATA_HIBERNATE, DATA_JAVASPACE, DATA_LDAP, DATA_PROPERTIES_FILE
 
Constructor Summary
FileProxy()
           
 
Method Summary
 void close(DataAccessObject dao)
          Close and dispose of all opened resources.
protected  DataAccessObject open(Object obj1, String className, DAOInput daoCons)
          Open the datastore and fetch the correct type of persistence.
 
Methods inherited from class com.zphinx.spine.data.AbstractDataProxy
createDataAccessImpl, execute, getDataAccessObject, getInstance, getStoreType, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileProxy

public FileProxy()
Method Detail

open

protected DataAccessObject open(Object obj1,
                                String className,
                                DAOInput daoCons)
Open the datastore and fetch the correct type of persistence.

This method will initialize the file referenced at the stated path, load the file and save it in object format either as a properties file or as a byte[] array in AbstractFileDAO.

This can latter be retrieved by the client programmer who simply makes a call to AbstractFileDAO.getFileBytes() or AbstractFileDAO.getProperties() to retrieve the constituents of the file.

The developer does not need to write the object to the file system but must ensure that if changes are made to the object form of the file, these changes must be represented in the object form which this proxy will persist automatically.

Specified by:
open in class AbstractDataProxy
Parameters:
obj1 - Arbitary object to pass to this method
className - 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
See Also:
AbstractDataProxy.open(java.lang.Object, java.lang.String, com.zphinx.spine.vo.DAOInput)

close

public void close(DataAccessObject dao)
Close and dispose of all opened resources.

Persists the contents of the file or properties file back to the file system. Any changes made to the object obtained from AbstractFileDAO.getProperties() or AbstractFileDAO.getFileBytes() will be automatically persisted by this method.

Specified by:
close in class AbstractDataProxy
Parameters:
dao - The DataAccessObject associated with this proxy
Throws:
SpineApplicationException
See Also:
AbstractDataProxy.close(com.zphinx.spine.data.DataAccessObject)