ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Developing for Jakarta Avalon
Pages: 1, 2, 3

The Configuration File

The configuration file, which must be Phoenix-compliant, contains information needed to configure the various system components. Phoenix uses the information in this file during the startup or the reconfigure stages.



A sample configuration file is shown below:

<config>
<thread-manager>
<thread-group>
<name>default</name>
<priority>5</priority> 
<is-daemon>false</is-daemon>
<max-threads>40</max-threads>
<min-threads>20</min-threads>
<min-spare-threads>20</min-spare-threads>
</thread-group>
</thread-manager>
<sockets>
<server-sockets>
<factory name="plain" 
class="org.apache.avalon.cornerstone.blocks.sockets.DefaultServerSocketFactory" />
</server-sockets>
<client-sockets>
<factory name="plain" 
class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketFactory" />
</client-sockets>
</sockets>
<!-- this section is specific to the the MyFxConversion Block -->
<fxconversion-server>
<port>4556</port>
</fxconversion-server>
</config>

The Environment File

The environment file is used to specify server-wide settings like the security policy or the logging settings. An example of such a file is shown below.

<environment>
<logs>
<category name="" target="default" priority="DEBUG" />
<category name="objectstorage" target="objectstorage-target" priority="DEBUG" />
<category name="eca-server" target="simple-server" priority="DEBUG" />
<log-target name="default" location="/logs/avalon-demo.log" />
<log-target name="objectstorage-target" location="/logs/objectstorage.log" />
<log-target name="simple-server" location="/logs/simple-server.log" />
</logs>
<policy>
<grant code-base="file:${app.home}${/}SAR-INF${/}lib${/}*">
<permission class="java.security.AllPermission" />
</grant>
</policy>
</environment>

Step 4: Packaging the System

A system must be packaged into a SAR (Service ARchive) before it can be deployed into the Phoenix environment. The content of the archive is shown below.

0 Fri Feb 08 11:09:14 GMT+11:00 2002 META-INF/
0 Fri Feb 08 11:09:14 GMT+11:00 2002 SAR-INF/
0 Fri Feb 08 11:09:14 GMT+11:00 2002 SAR-INF/classes/
0 Fri Feb 08 11:09:14 GMT+11:00 2002 SAR-INF/lib/
99071 Tue Jan 29 23:10:58 GMT+11:00 2002 SAR-INF/lib/cornerstone.jar
8383 Fri Feb 08 11:08:46 GMT+11:00 2002 SAR-INF/lib/fx-conversion-server.jar
1223 Wed Jan 30 16:41:36 GMT+11:00 2002 SAR-INF/config.xml
1527 Fri Feb 08 11:08:00 GMT+11:00 2002 SAR-INF/assembly.xml
842 Wed Jan 30 16:39:34 GMT+11:00 2002 SAR-INF/environment.xml
51 Fri Feb 08 11:09:14 GMT+11:00 2002 META-INF/MANIFEST.MF

The important entry is the fx-conversion-server.jar, which contains the MyFxCoversion block. All of the other blocks that MyFxConversion uses are found in the cornerstone.jar archive.

Step 5: Deploying the System

Finally, to deploy the system, copy the myfxconversion.sar file to the apps subdirectory. When Phoenix starts up, it will extract the archive into a subdirectory of the same name.

Conclusion

The Avalon development effort began in September 1999 and now represents a solid platform for developing server side service-oriented applications. The lower layers of Avalon, namely Framework and Excalibur, are finalized, very stable and have been used for developing core technologies such as Cocoon2 and James. The upper layer, in particular Phoenix, is still in alpha and will make a transition to beta in the near future, once the JMX issues are resolved. There is low to medium risk in adopting this technology for developing server-side components.

References

  • Jakarta Avalon Web Site
  • N Degrees of Separation: Multi-Dimension Separation of Concerns, Peri Tarr et al, IBM Watson Research Center.
  • Separating Concerns in Software Logistics, Danny Greefhorst, Software Engineering Research Centre
  • Aspect-Oriented Programming, Gregor Kiczales et al, Xerox Palo Alto Research Center

Jim Alateras is an independent consultant specializing in open source and emerging technologies.


Return to ONJava.com.