ProgramixGenericLib v5.0.1

com.programix.da2
Interface GenericDA

All Known Subinterfaces:
DecoratorDA

public interface GenericDA

Used to implementation the very useful "Data Access Layer" abstraction.

This interface is extended to provide a useful collection of methods. Each method should perform a 'unit of work'. Most methods should declare that they might throw DAException to indicate an underlying problem (such as an IOException, SQLException, etc. Application-specific exceptions can be thrown in addition to DAException and there are many pre-defined subclasses of DAException (and developers can create additional subclasses as desired).

DAFactory has many create methods to automate the task of instantiating and initializing an instance.

NOTE: all implementations must have a public zero-argument constructor.

Author:
Paul Hyde

Method Summary
 void init(ValueMap config)
          Called once just after construction to allow the implementation to setup everything required to run.
 void shutdown()
          This should be called when the DA is no longer needed to clean up any potential resources being used behind the scenes.
 

Method Detail

init

void init(ValueMap config)
          throws DAException
Called once just after construction to allow the implementation to setup everything required to run. This method is called before any other methods on this interface. If this method returns without throwing an exception, access to the other methods is opened up.

Parameters:
config - all the settings needed to complete initialization
Throws:
DAException - if initialization could not complete, possibly chained to an underlying cause.

shutdown

void shutdown()
This should be called when the DA is no longer needed to clean up any potential resources being used behind the scenes. Some implementations may have nothing to do when shutdown, but other implementations might have important de-allocation duties to perform.

No other methods should be called after this method. Calling other methods after calling this method results in undefined behavior (many times, a ShutdownDAException will be thrown when attempting to invoke those other methods, but there is no requirement that all methods do this).

Calling shutdown() more than one time must be allowed and shutdown() must not complain. Also note that shutdown() never throws any exceptions—it just makes its best effort of close down everything. Implementations must assure that this remains true.


ProgramixGenericLib v5.0.1

Copyright © 2001-2009 Programix Incorporated. All rights reserved. ProgramixGenericLib is free and is OSI Certified Open Source Software under the BSD license.