Справочник Пользователя для Red Hat Web Application Framework 6.1

Скачать
Страница из 230
60
Chapter 8. WAF Application Development Tutorial
8.10. Integrating Your Package With CCM Tools
The WAF environment includes a set of tools for loading and configuring software such as our example
application. In order to integrate with those tools, your application needs to supply some information
in the right places.
The CCM package loader, part of the
ccm
command line tool, takes a package and loads its initial
configuration, schema, and data.
ccm
is documented in the Red Hat Web Application Framework
Installation Guide.
$ ccm load --interactive binder
This command will ultimately run a
Loader
, a class that loads a package’s schema and data. So that
the CCM tool can invoke the correct loader, a file of the form
${package-key}.load
is required
directly under your application’s
src/
directory.
<?xml version="1.0" encoding="utf-8"?>
<load>
<provides>
<table name="binders"/>
<table name="notes"/>
<initializer class="com.example.binder.Initializer"/>
</provides>
<scripts>
<schema directory="binder"/>
<data class="com.example.binder.Loader"/>
</scripts>
</load>
Example 8-12.
binder/src/binder.load
The table names in the

provides

block will be checked to ensure they exist when the package
tool prepares to load the binder package. The initializer classname dictates what initializer will be run
when the CCM runtime starts up. The schema directory given in the

scripts

block tells the base
Loader
implementation where to find the schema it will load. The optional data class allows you to
use a
Loader
implementation specific to your package.
8.11. Creating Upgrade Scripts
Upgrading to new versions of WAF applications may require you to also migrate your data. WAF
supports two complementary approaches to data migration: Java upgrade programs and SQL scripts.
Java upgrade programs have full access to the WAF and application APIs. These programs are typ-
ically used to do more complex migrations where executing business logic is required to correctly
migrate existing data.
SQL upgrade scripts rely on SQL and the embedded database procedural language (e.g., PL/SQL)
to migrate data. SQL scripts are typically used to change database schemas. They also may provide
superior performance in migrating large amounts of data.
The purpose of this section is to assist you in creating and hooking up your Java upgrade script
to take advantage of WAF APIs. The process for performing the actual application upgrade from
the installation/administration side using the
ccm upgrade
tool is covered in the WAF Installation
Guide.