org.apache.commons.scaffold.sql
Class AccessBase

java.lang.Object
  extended by org.apache.commons.scaffold.sql.AccessBase

Deprecated. Use StorageBean instead.

public class AccessBase
extends Object

Common data access methods.

Version:
$Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
Author:
Ted Husted, OK State DEQ

Field Summary
static String KEYS_INC
          Deprecated. [:TODO: Javadoc]
static String KEYS_NEXT
          Deprecated. [:TODO: Javadoc]
 
Constructor Summary
AccessBase()
          Deprecated.  
 
Method Summary
static Integer createKey(String keyName)
          Deprecated. Returns next sequential key for given set of keys.
static int delete(Object target, Integer key, String command)
          Deprecated. Mark entry for deletion.
static void executeUpdate(String command)
          Deprecated. Lookup command and execute "update" query to create a table, seed it with data, et cetera.
static Collection findByProperty(Object target, String property, String value)
          Deprecated. Select entries from data storage by indexed property..
static Collection findCollection(Object target, String command)
          Deprecated. Retrieve a collection of beans from data stoarge.
static Collection findCollection(Object target, String command, int parameter)
          Deprecated. Retrieve a collection of beans from data stoarge.
static Collection findCollection(Object target, String command, Object parameter)
          Deprecated. Retrieve a collection of beans from data stoarge.
static Collection findCollection(Object target, String command, Object[] parameters)
          Deprecated. Retrieve a collection of beans from data stoarge.
static Collection findCollectionLike(Object target, String command, String parameter)
          Deprecated. Retrieve a collection of beans from data stoarge.
static boolean findElement(Object target, Object key, String command)
          Deprecated. Retrieve entry from data storage.
static String getCommand(String key)
          Deprecated. Retrieve command from commands Properties for key.
static void init(Properties _commands)
          Deprecated. Set the Properties file to be used for SQL commands.
static int restore(Object target, Integer key, String command)
          Deprecated. Unmark entry for deletion.
static int store(boolean isInsert, String insert, String update, Object[] parameters)
          Deprecated. Commit record to storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYS_NEXT

public static String KEYS_NEXT
Deprecated. 
[:TODO: Javadoc]


KEYS_INC

public static String KEYS_INC
Deprecated. 
[:TODO: Javadoc]

Constructor Detail

AccessBase

public AccessBase()
Deprecated. 
Method Detail

getCommand

public static final String getCommand(String key)
                               throws PropertiesException
Deprecated. 
Retrieve command from commands Properties for key.

Throws:
PropertiesException

init

public static final void init(Properties _commands)
Deprecated. 
Set the Properties file to be used for SQL commands. This can be called by main or in a servlet.init method at startup. If called more than once, the new commands are added to the existing store. If keys clash,the last one wins.


executeUpdate

public static final void executeUpdate(String command)
                                throws ResourceException
Deprecated. 
Lookup command and execute "update" query to create a table, seed it with data, et cetera.

Parameters:
command - Name of command to execute
Throws:
Resource - exception if data access error occurs
ResourceException

createKey

public static final Integer createKey(String keyName)
                               throws ResourceException
Deprecated. 
Returns next sequential key for given set of keys. Expects KEYS_NET nd KEYS_INC commands to be defined.

Parameters:
keyName - The name of the key set to use to generate the key
Returns:
A String representing the allocated key
Throws:
ResourceException - if data access error occurs

findElement

public static boolean findElement(Object target,
                                  Object key,
                                  String command)
                           throws ResourceException
Deprecated. 
Retrieve entry from data storage.

NOTE that the key and command parameters to this utility should have been swapped for consistency with other methods in this package. But since this class is deprecated, a fix has not been made.

Parameters:
key - The primary key of the entry
target - Bean to hold copy of entry being retrieved
command - The name of the data access command collection
Returns:
Collection with record or empty collection
Throws:
ResourceException - if SQL error occurs

findCollection

public static final Collection findCollection(Object target,
                                              String command)
                                       throws ResourceException
Deprecated. 
Retrieve a collection of beans from data stoarge.

Parameters:
target - Object to use as factory when populating
command - Name of the data access command collection
Returns:
Collection with entry or empty collection
Throws:
throws - PropertiesException, ResourceException if data access error occurs
ResourceException

findCollection

public static final Collection findCollection(Object target,
                                              String command,
                                              Object[] parameters)
                                       throws ResourceException
Deprecated. 
Retrieve a collection of beans from data stoarge.

Parameters:
target - Object to use as factory when populating
command - Name of the data access command collection
parameters - An array of parameters to be used with command
Returns:
Collection with entry or empty collection
Throws:
throws - PropertiesException, ResourceException if data access error occurs
ResourceException

findCollection

public static final Collection findCollection(Object target,
                                              String command,
                                              Object parameter)
                                       throws ResourceException
Deprecated. 
Retrieve a collection of beans from data stoarge.

Parameters:
target - Object to use as factory when populating
command - Name of the data access command collection
parameter - A String parameter to be used with command
Returns:
Collection with entry or empty collection
Throws:
throws - PropertiesException, ResourceException if data access error occurs
ResourceException

findCollection

public static final Collection findCollection(Object target,
                                              String command,
                                              int parameter)
                                       throws ResourceException
Deprecated. 
Retrieve a collection of beans from data stoarge.

Parameters:
target - Object to use as factory when populating
command - Name of the data access command collection
parameter - An int parameter to be used with command
Returns:
Collection with entry or empty collection
Throws:
throws - PropertiesException, ResourceException if data access error occurs
ResourceException

findCollectionLike

public static final Collection findCollectionLike(Object target,
                                                  String command,
                                                  String parameter)
                                           throws ResourceException
Deprecated. 
Retrieve a collection of beans from data stoarge.

Parameters:
target - Object to use as factory when populating
command - Name of the data access command collection
parameter - A String parameter to be used with command
Returns:
Collection with entry or empty collection
Throws:
throws - PropertiesException, ResourceException if data access error occurs
ResourceException

findByProperty

public static final Collection findByProperty(Object target,
                                              String property,
                                              String value)
                                       throws ParameterException,
                                              PopulateException,
                                              ResourceException
Deprecated. 
Select entries from data storage by indexed property..

Parameters:
value - Term to match
property - Field to search
target - Object to use as factory when populating collection
Returns:
Collection with record or empty Collection
Throws:
Throws - ParameterException if value is not a search term for property
Throws - PopulateExecption if result cannot be set to target
throws - PropertiesException, ResourceException is SQL, IO, or other data access error occurs.
ParameterException
PopulateException
ResourceException

store

public static final int store(boolean isInsert,
                              String insert,
                              String update,
                              Object[] parameters)
                       throws ResourceException
Deprecated. 
Commit record to storage. If create is true, entry is created. Otherwise, an existing entry is updated.

Parameters:
insert - True to insert, false to update.
Returns:
0 if fails
Throws:
ResourceException - if SQL error occurs

delete

public static final int delete(Object target,
                               Integer key,
                               String command)
                        throws ResourceException
Deprecated. 
Mark entry for deletion. Returns copy of entry before update in target parameter.

Parameters:
target - Bean to hold copy of record being marked
article - Primary key of record to mark
Returns:
0 if fails
Throws:
ResourceException - if SQL or other data-access error occurs
runtime - Null Pointer Exception if either parameter is null

restore

public static final int restore(Object target,
                                Integer key,
                                String command)
                         throws ResourceException
Deprecated. 
Unmark entry for deletion. Returns copy of restored entry in target parameter.

Parameters:
target - Bean to hold copy of record being unmarked
article - Primary key of record to unmark
Returns:
0 if fails
Throws:
ResourceException - if data access error occurs


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.