Technology Details
The framework consists of the following technologies:
Java Ant technology for build scripts development
Apache Axis as the SOAP engine
Document-literal style web services methodology (uses message-style interfaces rather than technology-specific interfaces)
Ant-Related Build Files and Folder Details
The Ant-related build scripts and configuration files are located in the Ant folder. The following table describes the relevant files.
File |
Description |
Ant/build.bat |
DOS batch file to run the Ant script. |
Ant/build.xml |
Main Ant framework script. |
Ant/xmls/buildProps.xml |
Generic build-level properties such as the output build location, src directory, etc. |
Ant/xmls/projectProps.xml |
Project-specific properties such as project name, version, and list of various web services. |
Ant/etc/{service}.properties |
Properties files for every web service specified for the project. |
The build framework comprises various folders, as shown in the following table.
Folder |
Description |
Lib/*.jar |
Third-party libraries required as part of the build. |
Src/doc-lit-artifacts |
Instead of using Axis tools, we've created specific artifacts with token replacements to substitute service-specific values to build the appropriate stubs. This folder contains doc-literalspecific artifacts. We've used Axis tools to analyze the artifacts generated. They had to be modified to gain better performance and/or to do what we wanted; hence, we've used the token-replacement method, but this is Axis-generated/compliant code. |
Src/services-artifacts |
Instead of using Axis tools, we've created specific artifacts with token replacements to substitute service-specific values. This folder contains web servicespecific artifacts. |
Src/common |
Code common for all business modules can be placed here. |
Src/{service} |
All business module code is set up underneath this folder. |
Src/{service}/business |
Folder containing the actual business module. |
Src/{service}/clients |
Folder containing all client code to use the business module. |
The following table describes some of the framework-specific files.
File |
Description |
services-artifacts/server-config.wsdd |
Axis configuration file providing information about services deployed with the web services engine. |
services-artifacts/web.xml |
Java web.xml file with appropriate configuration to register the Axis web service engine. |
Doc-lit-artifacts/Service.java |
Server stub artifact to make a business module into a web service. During the doc-lit-service task, the tokens are replaced with service-specific values. |
Doc-lit-artifacts/Client.java |
Client stub artifact to make the client interact transparently with the remote web service. During the doc-lit-service task, the tokens are replaced with service-specific values. |
Doc-lit-artifacts/SampleTest.java |
A simple test client that hooks up to the client stub, which in turn invokes the web service. |
Src/add/business/com/meshsoftware/Add.java |
Sample business module for reference. |
The following table describes some utility information files that get zipped along with the actual code during the war/ear build.
File |
Description |
Etc/CONTRIBUTORS |
Acknowledge contributors in this file. |
Etc/LICENSE |
License-specific information for the business module. |
Etc/TODO |
To do in future revisions. |
Etc/INSTALL |
Installation instructions go here. |
Etc/README |
README file for your project. The build number, build date, and version number are automatically inserted here during the build process. |
Ant Build Targets
Various targets are categorized, as shown in the following table.
Target Categories |
Category Description |
Actual Targets |
---|---|---|
Iterative tasks |
Can iterate through all the business modules. |
services clients |
Core web services tasks |
Does the actual framework tasks to create web services from the business module. Should not be used directly. |
doc-lit-service doc-lit-client |
Utility tasks |
Convenient tasks to build the war/ear file and deploy it. |
dist war deploy |
Generic build tasks |
Build-related tasks to create and delete folders and other build-related activities such as tracking the build number. |
prepare clean init targets |
Let's look at each target in detail.
Target |
Target Dependency |
Optional Ant Task Definition |
Description |
services |
prepare |
ant-contrib-0.2.jar for the foreach task |
Iterates through the business modules and invokes the task to create web service components |
The services target iterates through all the business modules/web services specified in the project.doc-lit-services property setting in the xmls/projectProps.xml file. This property is a comma-separated list value. For example:
<property name="project.doc-lit-services" value="add,subtract,divide,multiply" />
This target calls the doc-lit-service target that does the real work of exposing the business module as a web service. It sets the service variable to the business module name. The target also copies all the common code to the appropriate build folder for compilation.
Target |
Target Dependency |
Optional Ant Task Definition |
Description |
clients |
prepare |
ant-contrib-0.2.jar for the foreach task |
Iterates through the business modules and invokes the task to create web service client components |
The clients task is identical to the services task described earlier. It iterates through all the business modules and invokes the doc-lit-client target.
Target |
Target Dependency |
Description |
doc-lit-service |
prepare |
Packages an XML interface business module into a document-lit style web service |
In its current form, the doc-lit-service target should not be called directly. The services target will invoke this target for every web service it finds. The sequence of tasks performed by this target is as follows:
Copy business module to dist for compilation.
Copy pre-generated artifacts.
Update token with values for the given service.
Compile all the code.
Copy pre-generated WAR config files.
The artifact token substitution was preferred to the Axis tools java2wsdl and wsdl2java. These tools didn't work correctly for doc-literal style services. In addition, a detailed and careful analysis determined that the final stub files for both the client side and the server side are very trivial, and the token-substitution mechanism works very well without any loss of functionality. The token-substitution mechanism is nothing but hand-coding the artifacts up front. Tokens are inserted for the dynamic sections specific to each business module. At build time, we replace these tokens with the actual values for each business module, thereby making a stub specific to that business module.
Target |
Target Dependency |
Description |
doc-lit-client |
prepare |
Builds clients for a document-style web service |
In its current form, this target should not be called directly. The clients target will invoke this target for every web service it finds. The sequence of tasks performed by this target is as follows:
Copy clients of business module to dist for compilation.
Copy pre-generated artifacts.
Update token with values for the given service.
Compile all the code.
Target |
Target Dependency |
Description |
dist |
services, clients |
Creates the complete distribution structure |
The dist target sets up the complete war/ear file structure. The services and clients targets generate the appropriate files under the build folder. This target copies all the third-party jar files to the webapps.lib folder to complete the structure. This target also copies all the artifact files (README, INSTALL, LICENSE, etc.) to complete the software bundle.
Target |
Target Dependency |
Description |
war |
dist |
Builds the war file |
The war target packages the structure set up by the dist target into a war file. This target could be further enhanced to implement all enterprise-specific policies to build an appropriate war/ear file.
Target |
Target Dependency |
Description |
deploy |
none |
Copies the packaged war/ear file to a specific location |
The simple, convenient deploy target copies the final war/ear file to a local webapps folder to run under a local Tomcat instance.
Target |
Target Dependency |
Description |
prepare |
init |
Sets up files and folders for the build |
The prepare target creates the folders specified by the following properties, if they don't already exist:
build.dir
webapps.dir
webapps.WEB-INF
webapps.lib
webapps.classes
The output build structure is very similar to a war/ear structure specified through the Java specifications.
NOTE
Output generated by the build is under the build folder only!
Target |
Target Dependency |
Description |
clean |
none |
Deletes all output generated during the build |
Deleting the build folder is sufficient to delete all the output generated during the build.
Target |
Target Dependency |
Description |
init |
none |
Updates build runtime information |
The init target is appropriate to make all initial configurations to the build at runtime. The following list shows the activities currently implemented:
Gets the current time and appends that time as the build's time in the build.properties file
Increments (by 1) build.number from the build.properties file
Creates a log directory
Starts two Ant recorders to record all the activities being performed during the build; one of the recorders gives detailed debugging logs
Prints project information onscreen for reference
Target |
Target Dependency |
Description |
targets |
none |
Project help |
The targets target prints the project help, listing all the available targets.