Many IT shops prescribe
separate Development, QA, Test, Stage,
and Production environments. Each version
of the application works its way through
a testing gauntlet from the developer
environment to the ultimate production
release.
Suppose
our application refers to a database
data source called “default”.
Its data source key is “default”.
The application will use this key
at runtime to find a data source configuration in the application configuration file (IdeaBlade.ibconfig).
The
data source configuration is very
simple for the development environment.
The development deployment puts
all tiers on the PC. The “default” development
configuration’s connection
string points to a database on
the PC.
The
QA environment, on the other hand,
has a 3 tier deployment with separate
machines for client, business object
server, and database. This requires
many changes to the “default” configuration
including a different connection
string that points to the QA database.
We really need a separate “default” configuration
for QA.
In
fact, we need five “default” configurations
in the application configuration
file.
The symbolic data source, “default”,
doesn’t change as we cross
environments. The business objects
associated with the “default” data
source should be indifferent to
configuration differences. The
executing environment, on the other
hand, has to know which of the “default” configuration
to use.
DevForce
provides data source key extensions to
help distinguish the five “default” data
source configurations. By convention,
the data source configuration name
is the data source key name followed
optionally by a data source key
extension (with an underscore “_” separating
the two).
In
our example, the configurations
could be named “Default_Development”, “Default_QA”,
etc. When the application launches,
it determines its runtime environment
and then tells the PersistenceManager to connect to its data source(s) using the
extension to find the appropriate
data source configuration information.
If we execute in development, we
initialize the PM with “Development” and
it adds the “_Development” suffix
to “default”.
If
the PersistenceManager (and, later, the PersistenceServer) cannot find a data source configuration named “Default_Development”,
it will look for one named “default” before
giving up.
|