Apache Main | Avalon Main | Up |
Using Doclet Tags to Generate .xinfo filesIntroductionEach block requires a corresponding .xinfo file that is read by the container at startup. As the developer, you have the option of using custom java doc tags to generate the .xinfo file. This has a number of advantages over generating the file by hand:
Using this feature requires that you markup the source code with the appropriate tags and then have the build script include the MetaGenerateTask task. Both these steps are described below. The TagsThe following tags are defined: phoenix:block
Example: /** * Ftp server starting point. Avalon framework will load this * from the jar file. This is also the starting point of remote * admin. * * @phoenix:block * @phoenix:service name="org.apache.avalon.ftpserver.interfaces.FtpServerInterface" * */ phoenix:service
Example: see above phoenix:mx
Example: /** * @phoenix:block * @phoenix:mx name="org.apache.avalon.apps.demos.helloworldserver.HelloWorldServerMBean" */ phoenix:dependency
Example: /* * @phoenix:dependency name="org.apache.avalon.cornerstone.services.sockets.SocketManager" * @phoenix:dependency name="org.apache.avalon.cornerstone.services.connection.ConnectionManager" * @phoenix:dependency name="org.apache.avalon.ftpserver.usermanager.UserManagerInterface" * @phoenix:dependency name="org.apache.avalon.ftpserver.ip.IpRestrictorInterface" */ public void service(ServiceManager serviceManager) throws ServiceException { Build InstructionsTo have xinfo files generated as part as your ant build script, include the MetaGenerateTask like this: <!-- Make .xinfo, .mxinfo and manifest automatically for blocks --> <target name="metagenerate"> <taskdef name="generatemeta" classname="org.apache.avalon.phoenix.tools.metagenerate.MetaGenerateTask"> <classpath refid="project.class.path" /> </taskdef> <generatemeta dest="${build.metagenerate}"> <fileset dir="${java.dir}"> <include name="**/*.java"/> </fileset> </generatemeta> </target> Where build.metagenerate is where the .xinfo files should be placed, and java.dir is the location of the source files. Typically the build.metagenerate directory is an intermediate build directory. Output from this task are then copied to a release image directory and jar'ed as a subsequent step. The qdox jar and phoenix-client.jar need to be in the project.class.path. |