OverviewThis section gives a quick overview of how to go from a blocks source code, to a managed object accessible in a management interface. It does not cover every aspect, nor is it strictly 'correct'. In DevelopmentFor a block to be manageable, the developer inserts a series of XDoclet tags in the class file. Right now these are: At the class level: /** * 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:mx-topic name="ftpServer" * @phoenix:service name="org.apache.avalon.ftpserver... */ public class FtpServerImpl extends AbstractLogEnabled ... where @phoenix:mx-topic marks the block as eligible for management. For each attribute: /** * @phoenix:mx-attribute * @phoenix:mx-description Returns the top published directory * @phoenix:mx-isWriteable false */ public String getDefaultRoot() { ... and finally for each operation: /** * @phoenix:mx-operation * @phoenix:mx-description Returns port that the server listens on */ public String getServerPort(Integer instance) { ... When this is compiled the PhoenixDoclet task extracts this and inserts it into an mxinfo file. If a method doesn't have a @pheonix:mx-attribute tag it is not exposed for management. Here's what the entry generated from the tags above looks like: <?xml version="1.0"?> <!DOCTYPE mxinfo PUBLIC "-//PHOENIX/Mx Info DTD Version 1.0//EN" "http://jakarta.apache.org/phoenix/mxinfo_1_0.dtd"> <mxinfo> <topic name="ftpServer" > <!-- attributes --> <attribute name="defaultRoot" description="Returns the top published directory" isWriteable="no" type="java.lang.String" /> <!-- operations --> <operation name="getServerPort" description="Returns port that the server listens on" type="java.lang.String" > <param name="instance" description="no description" type="java.lang.Integer" /> </operation> </topic> </mxinfo> Alternatively, you could write the mxinfo file directly (particularly in cases where you can't/don't want to modify the source code). The DTD is available [TODO]here. At StartupAt startup, Phoenix registers each block to a local SystemManager context. This context determines where the block fits into the management hierarchy. [TODO - code snippet on the register line] The system manager uses the mxinfo file in conjunction with introspection to generate a ModelMBeanInfo object for each topic. A RequiredModelMBean is then created and exposed for management. While RunningIn the default configuration, management is provided through MX4J. The administrator can perform various tasks such as deploying, starting and stopping applications and changing the configuration of various blocks. The server is accessed on port 8082 of the server. eg. http://localhost:8082. TODO: Include screenshot? |