You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/07/30 14:17:22 UTC
cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/xdoclet MxInfoSubTask.java mxinfo.j PhoenixXDoclet.java
donaldp 2002/07/30 05:17:22
Modified: src/java/org/apache/avalon/phoenix/tools/xdoclet
PhoenixXDoclet.java
Added: src/java/org/apache/avalon/phoenix/tools/xdoclet
MxInfoSubTask.java mxinfo.j
Log:
Added in initial support for marking attributes/operations as managed via JMX/phoenix. XDoclet will then generate the mxinfo descriptors that describes each mbean.
Submitted by: Huw Roberts <Hu...@mmlive.com>
Revision Changes Path
1.7 +9 -3 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/xdoclet/PhoenixXDoclet.java
Index: PhoenixXDoclet.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/xdoclet/PhoenixXDoclet.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PhoenixXDoclet.java 26 Jul 2002 09:49:23 -0000 1.6
+++ PhoenixXDoclet.java 30 Jul 2002 12:17:21 -0000 1.7
@@ -11,7 +11,6 @@
import xdoclet.DocletTask;
/**
- *
* @author <a href="mailto:vinay_chandran@users.sourceforge.net">Vinay Chandrasekharan</a>
* @version $Revision$ $Date$
*/
@@ -19,7 +18,7 @@
extends DocletTask
{
private BlockInfoSubTask m_blockInfoSubTask;
-
+ private MxInfoSubTask m_mxinfoSubTask;
private ManifestSubTask m_manifestSubTask;
public BlockInfoSubTask createBlockinfo()
@@ -34,11 +33,18 @@
return m_manifestSubTask;
}
+ public MxInfoSubTask createMxInfo()
+ {
+ m_mxinfoSubTask = new MxInfoSubTask();
+ return m_mxinfoSubTask;
+ }
+
protected List getSubTasks()
{
final List subtasks = super.getSubTasks();
subtasks.add( m_blockInfoSubTask );
subtasks.add( m_manifestSubTask );
+ subtasks.add( m_mxinfoSubTask );
return subtasks;
}
}
1.1 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/xdoclet/MxInfoSubTask.java
Index: MxInfoSubTask.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.phoenix.tools.xdoclet;
import java.io.File;
import java.net.URL;
import xdoclet.TemplateSubTask;
import xdoclet.XDocletException;
import xjavadoc.XClass;
/**
* Generates MxBean info for Blocks and other classes
*
* @author <a href="mailto:huw@mmlive.com">Huw Roberts</a>
* @version $$
*/
public class MxInfoSubTask
extends TemplateSubTask
{
public static final String SUBTASK_NAME = "mxinfo";
private static final String GENERATED_FILE_NAME = "{0}.mxinfo";
private static final String DEFAULT_TEMPLATE_FILE =
"/org/apache/avalon/phoenix/tools/xdoclet/mxinfo.j";
private static String c_classPattern;
private String m_templatePath;
public MxInfoSubTask()
{
final URL resource = getClass().getResource( DEFAULT_TEMPLATE_FILE );
setTemplateURL( resource );
setDestinationFile( GENERATED_FILE_NAME );
setHavingClassTag( "phoenix:mx-topic" );
final TemplateSubTask.ExtentTypes extent = new TemplateSubTask.ExtentTypes();
extent.setValue( "hierarchy" );
setExtent( extent );
}
public void setTemplatePath( final String templatePath )
{
m_templatePath = templatePath;
setTemplateFile( new File( templatePath ) );
}
public static String getClassPattern()
{
return c_classPattern;
}
public String getSubTaskName()
{
return SUBTASK_NAME;
}
public void setPattern( final String classPattern )
{
c_classPattern = classPattern;
}
/**
* Called to validate configuration parameters.
*/
public void validateOptions()
throws XDocletException
{
super.validateOptions();
if( null == m_templatePath )
{
throw new XDocletException( "'templatePath' attribute is missing ." );
}
final URL template = getTemplateURL();
if( null == template )
{
throw new XDocletException( "'template' is missing." );
}
if( null == getClassPattern() || getClassPattern().trim().equals( "" ) )
{
throw new XDocletException( "'pattern' parameter missing or empty." );
}
if( -1 == getClassPattern().indexOf( "{0}" ) )
{
throw new XDocletException( "'pattern' parameter does not have a " +
"'{0}' in it. '{0}' is replaced by Block " +
"name of the class under processing." );
}
}
protected boolean matchesGenerationRules( final XClass clazz )
throws XDocletException
{
if( !super.matchesGenerationRules( clazz ) )
{
return false;
}
else
{
return true;
}
}
}
1.1 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/xdoclet/mxinfo.j
Index: mxinfo.j
===================================================================
<?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>
<XDtClass:ifHasClassTag tagName="phoenix:mx-topic" paramName="name">
<topic name="<XDtClass:classTagValue tagName="phoenix:mx-topic" paramName="name"/>" >
<!-- attributes -->
<XDtMethod:forAllMethods>
<XDtMethod:ifHasMethodTag tagName="phoenix:mx-attribute" >
<attribute
name="<XDtMethod:propertyName/>"
<XDtMethod:ifHasMethodTag tagName="phoenix:mx-description" >
description="<XDtMethod:methodTagValue tagName="phoenix:mx-description" />"
</XDtMethod:ifHasMethodTag>
<XDtMethod:ifDoesntHaveMethodTag tagName="phoenix:mx-description" >
description="<XDtMethod:methodComment no-comment-signs="true" />"
</XDtMethod:ifDoesntHaveMethodTag>
<XDtMethod:ifHasMethodTag tagName="phoenix:mx-isWriteable" >
isWriteable="<XDtMethod:methodTagValue tagName="phoenix:mx-isWriteable" />"
</XDtMethod:ifHasMethodTag>
type="<XDtMethod:methodType/>"
/>
</XDtMethod:ifHasMethodTag>
</XDtMethod:forAllMethods>
<!-- operations -->
<XDtMethod:forAllMethods>
<XDtMethod:ifHasMethodTag tagName="phoenix:mx-operation" >
<operation
name="<XDtMethod:methodName/>"
<XDtMethod:ifHasMethodTag tagName="phoenix:mx-description" >
description="<XDtMethod:methodTagValue tagName="phoenix:mx-description" />"
</XDtMethod:ifHasMethodTag>
<XDtMethod:ifDoesntHaveMethodTag tagName="phoenix:mx-description" >
description="<XDtMethod:methodComment no-comment-signs="true" />"
</XDtMethod:ifDoesntHaveMethodTag>
type="<XDtMethod:methodType/>"
>
<XDtParameter:forAllMethodParams>
<param
name="<XDtParameter:methodParamName/>"
description="<XDtParameter:methodParamDescription/>"
type="<XDtParameter:methodParamType/>"
/>
</XDtParameter:forAllMethodParams>
</operation>
</XDtMethod:ifHasMethodTag>
</XDtMethod:forAllMethods>
</topic>
</XDtClass:ifHasClassTag>
<XDtClass:ifHasClassTag tagName="phoenix:mx-proxy" paramName="class">
<proxy name="<XDtClass:classTagValue tagName="phoenix:mx-proxy" paramName="class"/>" />
</XDtClass:ifHasClassTag>
</mxinfo>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>