Users guide
Architecture
Demo applications
Plugins
Porting Guide
Development Roles
Introduction
Administrator
Deployer
Assembler
Block Developer
Project Info
License
Mailing lists
IRC
Source repositories
Issue tracking
Blog entries
Team
|
|||||
|
|
|||||
Users guideArchitecture Development RolesIntroduction Project InfoLicense |
Management Metadata
IntroductionThis section gives a quick overview of how to go from a component's source code, to a managed object accessible in a management interface. It discusses the role of actors at three different points in the life cycle of the application: during development, at start-up, and while running. In DevelopmentFor a block to be manageable, it must provide a MetaClass descriptor. This is done by inserting a series of Doclet tags into the source file and running the maven-loom plugin over the source code. An example of how to use these tags follows. First, at the class level, the block or component must be tagged as manageable with an @mx.component tag: /** * Ftp server starting point. This is also the remote * admin's starting point. * * @mx.component * @dna.component * @dna.service type="FTPServer" */ public class FtpServerImpl extends AbstractLogEnabled ... Then, for each attribute that should be exposed add an @mx.attribute tag to its getter or setter method: /** * Fetch the default root value * * @mx.attribute description="The default root" */ public String getDefaultRoot() ... and finally for each operation add an mx.operation tag: /** * Fetch the port a specific server listens to * * @mx.operation description="Returns port that the server listens on." * @mx.parameter name="instance" description="Number of the server instance" */ public String getServerPort( Integer instance ) ... When this is compiled the maven-loom plugin extracts the metadata and inserts it into the compiled class file using MetaClass. Only methods tagged with management metadata will be exposed. At StartupAt startup, Loom registers each block to a local SystemManager context. This context determines where the block fits into the management hierarchy.
The following code snippet shows the code snippet that registers the Embeddor component with the 'component' management context. A similar process is followed for registering the blocks in the application. // get the management context final SystemManager componentManager = systemManager.getSubContext( null, "component" ); // register the component componentManager.register( ManagementRegistration.EMBEDDOR.getName(), this, ManagementRegistration.EMBEDDOR.getInterfaces() ); 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. By default, the server is accessed on port 8082 of the server. eg. http://localhost:8082. Note that you must turn on the listeners in kernel.xml. They are for security reasons disabled by default. |
||||
|
Copyright 2003-2006 - The Codehaus. All rights reserved unless otherwise noted.
Powered by Atlassian Confluence
|
|||||