org.apache.commons.scaffold.sql
Class AccessBase

java.lang.Object
  extended byorg.apache.commons.scaffold.sql.AccessBase

Deprecated. Use StorageBean instead.

public class AccessBase
extends java.lang.Object

Common data access methods.

Version:
$Revision: 1.7 $ $Date: 2004/03/21 21:10:27 $

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


KEYS_INC

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

Constructor Detail

AccessBase

public AccessBase()
Deprecated. 
Method Detail

getCommand

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

Throws:
PropertiesException

init

public static final void init(java.util.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(java.lang.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 java.lang.Integer createKey(java.lang.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(java.lang.Object target,
                                  java.lang.Object key,
                                  java.lang.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 java.util.Collection findCollection(java.lang.Object target,
                                                        java.lang.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 java.util.Collection findCollection(java.lang.Object target,
                                                        java.lang.String command,
                                                        java.lang.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 java.util.Collection findCollection(java.lang.Object target,
                                                        java.lang.String command,
                                                        java.lang.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 java.util.Collection findCollection(java.lang.Object target,
                                                        java.lang.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 java.util.Collection findCollectionLike(java.lang.Object target,
                                                            java.lang.String command,
                                                            java.lang.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 java.util.Collection findByProperty(java.lang.Object target,
                                                        java.lang.String property,
                                                        java.lang.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,
                              java.lang.String insert,
                              java.lang.String update,
                              java.lang.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(java.lang.Object target,
                               java.lang.Integer key,
                               java.lang.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
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(java.lang.Object target,
                                java.lang.Integer key,
                                java.lang.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
Returns:
0 if fails
Throws:
ResourceException - if data access error occurs


Copyright © 2002-2005 The Apache Software Foundation. All Rights Reserved.