User: rinkrank
  Date: 02/04/11 13:53:01

  Modified:    core/src/xdoclet/loader BootstrapClassLoader.java
                        Bootstrapper.java ModuleFinder.java
                        XDocletModule.java XDocletXmlParser.java
  Log:
  POC dynamic module loading
  
  Revision  Changes    Path
  1.3       +4 -3      xdoclet/core/src/xdoclet/loader/BootstrapClassLoader.java
  
  Index: BootstrapClassLoader.java
  ===================================================================
  RCS file: 
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/BootstrapClassLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- BootstrapClassLoader.java 9 Apr 2002 00:07:16 -0000       1.2
  +++ BootstrapClassLoader.java 11 Apr 2002 20:53:00 -0000      1.3
  @@ -25,7 +25,7 @@
        /**
         * @todo-javadoc   Describe the field
         */
  -     private static String _myJarFileName;
  +     private static String _myJarFileName = getXDocletJar().getAbsolutePath();
        /**
         * @todo-javadoc   Describe the field
         */
  @@ -39,7 +39,7 @@
         * @todo-javadoc   Describe the field
         */
        private HashMap    _classes = new HashMap();
  -     static
  +     public static File getXDocletJar()
        {
                String myJarFileName = 
BootstrapClassLoader.class.getProtectionDomain().getCodeSource().getLocation().getFile();
   
  @@ -50,8 +50,9 @@
                if( !myRealJarFile.exists() )
                {
                        System.err.println( "You have to put xdoclet.jar under " + 
myJarFile.getParentFile().getAbsolutePath() );
  +                     return null;
                }
  -             _myJarFileName = myRealJarFile.getAbsolutePath();
  +             return myRealJarFile;
        }
   
        /**
  
  
  
  1.3       +16 -16    xdoclet/core/src/xdoclet/loader/Bootstrapper.java
  
  Index: Bootstrapper.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/Bootstrapper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- Bootstrapper.java 9 Apr 2002 00:07:16 -0000       1.2
  +++ Bootstrapper.java 11 Apr 2002 20:53:00 -0000      1.3
  @@ -90,22 +90,22 @@
                                }
   
                                // register tag handlers
  -                             List tagHandlerDefinitions = 
module.getTagHandlerDefinitions();
  -                             Iterator k = tagHandlerDefinitions.iterator();
  -
  -                             while( k.hasNext() )
  -                             {
  -                                     TagHandlerDefinition thd = ( 
TagHandlerDefinition ) k.next();
  -
  -                                     try
  -                                     {
  -                                             
TemplateEngine.getEngineInstance().setTagHandlerFor( thd.namespace, 
thd.getTagHandler() );
  -                                     }
  -                                     catch( TemplateException e )
  -                                     {
  -                                             throw new BuildException( "Couldn't 
register " + thd.getTagHandler().getClass().getName() + " to namespace " + 
thd.namespace + ":" + e.getMessage(), e );
  -                                     }
  -                             }
  +                             /*
  +                              * List tagHandlerDefinitions = 
module.getTagHandlerDefinitions();
  +                              * Iterator k = tagHandlerDefinitions.iterator();
  +                              * while( k.hasNext() )
  +                              * {
  +                              * TagHandlerDefinition thd = ( TagHandlerDefinition ) 
k.next();
  +                              * try
  +                              * {
  +                              * 
TemplateEngine.getEngineInstance().setTagHandlerFor( thd.namespace, 
thd.getTagHandler() );
  +                              * }
  +                              * catch( TemplateException e )
  +                              * {
  +                              * throw new BuildException( "Couldn't register " + 
thd.getTagHandler().getClass().getName() + " to namespace " + thd.namespace + ":" + 
e.getMessage(), e );
  +                              * }
  +                              * }
  +                              */
                        }
   
                        try
  
  
  
  1.3       +3 -3      xdoclet/core/src/xdoclet/loader/ModuleFinder.java
  
  Index: ModuleFinder.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/ModuleFinder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- ModuleFinder.java 7 Apr 2002 21:12:33 -0000       1.2
  +++ ModuleFinder.java 11 Apr 2002 20:53:00 -0000      1.3
  @@ -23,9 +23,9 @@
    *
    * @author    <a href="mailto:[EMAIL PROTECTED]";>Aslak Helles�y</a>
    * @created   7. april 2002
  - * @version   $Revision: 1.2 $
  + * @version   $Revision: 1.3 $
    */
  -class ModuleFinder
  +public class ModuleFinder
   {
   
        public List findModules()
  @@ -34,7 +34,7 @@
                XDocletXmlParser parser = new XDocletXmlParser();
   
                // find out where our own jar is.
  -             File myJar = GenerationManager.getXdocletJar();
  +             File myJar = BootstrapClassLoader.getXDocletJar();
   
                // find all the other jar files in same dir.
                File[] siblings = myJar.getParentFile().listFiles();
  
  
  
  1.3       +21 -7     xdoclet/core/src/xdoclet/loader/XDocletModule.java
  
  Index: XDocletModule.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/XDocletModule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- XDocletModule.java        7 Apr 2002 21:12:33 -0000       1.2
  +++ XDocletModule.java        11 Apr 2002 20:53:00 -0000      1.3
  @@ -6,27 +6,31 @@
   
   import java.util.List;
   import java.util.ArrayList;
  +import xdoclet.template.TemplateEngine;
  +import xdoclet.template.TemplateTagHandler;
  +import xdoclet.template.TemplateException;
   
   /**
    * This is an object view of the data in xdoclet.xml
    *
    * @author    <a href="mailto:[EMAIL PROTECTED]";>Aslak Helles�y</a>
    * @created   7. april 2002
  - * @version   $Revision: 1.2 $
  + * @version   $Revision: 1.3 $
    */
   class XDocletModule
   {
  -     private ArrayList  _tagHandlers = new ArrayList();
  +//   private ArrayList  _tagHandlers = new ArrayList();
        private ArrayList  _subTasks = new ArrayList();
   
        public XDocletModule()
        {
        }
   
  -     public List getTagHandlerDefinitions()
  -     {
  -             return _tagHandlers;
  -     }
  +//   public List getTagHandlerDefinitions()
  +//   {
  +//           return _tagHandlers;
  +//   }
  +
        public List getSubTaskDefinitions()
        {
                return _subTasks;
  @@ -34,7 +38,17 @@
   
        public void addTagHandler( String namespace, String clazz )
        {
  -             _tagHandlers.add( new TagHandlerDefinition( namespace, clazz ) );
  +             try
  +             {
  +                     System.out.println("********************** addTagHandler("+ 
namespace +"," + clazz + ")");
  +                     TemplateTagHandler handler = ( TemplateTagHandler ) 
Class.forName( clazz ).newInstance();
  +
  +                     TemplateEngine.getEngineInstance().setTagHandlerFor( 
namespace, handler );
  +             }
  +             catch( Throwable t )
  +             {
  +                     System.err.println( "Couldn't register tag handler " + clazz + 
":" + t.getMessage() );
  +             }
        }
   
        public void addSubTask( String name, String implementationClass, String 
parentTaskClass )
  
  
  
  1.3       +4 -2      xdoclet/core/src/xdoclet/loader/XDocletXmlParser.java
  
  Index: XDocletXmlParser.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/XDocletXmlParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- XDocletXmlParser.java     7 Apr 2002 21:12:33 -0000       1.2
  +++ XDocletXmlParser.java     11 Apr 2002 20:53:00 -0000      1.3
  @@ -18,7 +18,7 @@
    *
    * @author    <a href="mailto:[EMAIL PROTECTED]";>Aslak Helles�y</a>
    * @created   7. april 2002
  - * @version   $Revision: 1.2 $
  + * @version   $Revision: 1.3 $
    */
   class XDocletXmlParser extends DefaultHandler
   {
  @@ -74,6 +74,7 @@
   
        public void startElement( String namespaceURI, String localName, String qName, 
Attributes attributes )
        {
  +
                if( qName.equals( "taghandler" ) )
                {
                        _module.addTagHandler(
  @@ -81,7 +82,8 @@
                                attributes.getValue( "class" )
                                 );
                }
  -             else if( qName.equals( "subtask" ) )
  +             else
  +                     if( qName.equals( "subtask" ) )
                {
                        _module.addSubTask(
                                attributes.getValue( "name" ),
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to