Package org.apache.beehive.netui.xdoclet

Source Code of org.apache.beehive.netui.xdoclet.NetuiSubTask

package org.apache.beehive.netui.xdoclet;

import org.apache.beehive.netui.compiler.processor.PageFlowAnnotationProcessor;
import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration;
import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.DeclarationImpl;
import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.env.AnnotationProcessorEnvironmentImpl;
import xdoclet.DocletContext;
import xdoclet.SubTask;
import xdoclet.XDocletException;
import xjavadoc.SourceClass;
import xjavadoc.XJavaDoc;

import java.util.Collection;
import java.util.Iterator;


/**
* XJavaDoc subtask to run through a set of page flows in a webapp and generate Struts XML config files for them.
*
* @ant.element          display-name="Netui" name="netui" parent="org.apache.beehive.netui.xdoclet.NetuiDocletTask"
*/
public class NetuiSubTask extends SubTask
{
    private SourceClass _currentSourceClass;
   
    /**
     * Main entry point for xjavadoc tasks. Here we iterate through all the classes found by
     * xjavadoc and process the ones that we recognize as pageflows.
     *
     * @throws XDocletException
     */
    public void execute() throws XDocletException
    {
    /*
        if ( DocletContext.getInstance().isVerbose() )
            System.out.println( CompilerUtil.genMessage( "compiler.info.gen.location",
                    new String[] {getDestDir().getPath()} ) );
    */
        Collection classes = getXJavaDoc().getSourceClasses();
       
        /*
        // issue a warning if xjavadoc didn't find any classes at all
        if ( classes.size() == 0 )
        {
            System.out.println( CompilerUtil.genMessage( "no.classes.found" ) );
            return;
        }
       
        _pageflowCount = 0;
        */
       
        Iterator iter = classes.iterator();
        while ( iter.hasNext() )
        {
            SourceClass sourceClass = ( SourceClass ) iter.next();
            AnnotationProcessorEnvironment env = AnnotationProcessorEnvironmentImpl.get( getContext(), this, sourceClass );
            AnnotationTypeDeclaration[] decls = DeclarationImpl.getAllAnnotations();    // TODO: filter appropriately
           
            PageFlowAnnotationProcessor pfap = new PageFlowAnnotationProcessor( decls, env );
           
            try
            {
                _currentSourceClass = sourceClass;
                pfap.process();
            }
            finally
            {
                _currentSourceClass = null;
            }
        }
    }

    public static NetuiSubTask get()
    {
        SubTask subtask = DocletContext.getInstance().getActiveSubTask();
        assert subtask instanceof NetuiSubTask : subtask.getClass().getName();
        return ( NetuiSubTask ) subtask;
    }

    public XJavaDoc getXJavaDoc()
    {
        return super.getXJavaDoc();
    }

    public SourceClass getCurrentSourceClass()
    {
        return _currentSourceClass;
    }
}
TOP

Related Classes of org.apache.beehive.netui.xdoclet.NetuiSubTask

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.