avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/xdoclet ManifestWriter.java ManifestSubTask.java PhoenixXDoclet.java
Date Wed, 02 Oct 2002 19:39:08 GMT
hammant     2002/10/02 12:39:08

  Modified:    src/java/org/apache/avalon/phoenix/tools/xdoclet
                        ManifestSubTask.java PhoenixXDoclet.java
  Added:       src/java/org/apache/avalon/phoenix/tools/xdoclet
                        ManifestWriter.java
  Log:
  updated for manifest creation.
  
  Revision  Changes    Path
  1.13      +3 -1      jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/xdoclet/ManifestSubTask.java
  
  Index: ManifestSubTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/xdoclet/ManifestSubTask.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ManifestSubTask.java	2 Oct 2002 04:33:13 -0000	1.12
  +++ ManifestSubTask.java	2 Oct 2002 19:39:07 -0000	1.13
  @@ -7,6 +7,8 @@
    */
   package org.apache.avalon.phoenix.tools.xdoclet;
   
  +import java.io.File;
  +
   /**
    * Generates Manifest file for Blocks
    *
  
  
  
  1.12      +92 -4     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PhoenixXDoclet.java	2 Oct 2002 04:33:13 -0000	1.11
  +++ PhoenixXDoclet.java	2 Oct 2002 19:39:07 -0000	1.12
  @@ -14,7 +14,9 @@
   import org.apache.tools.ant.Project;
   
   import java.io.File;
  +import java.io.IOException;
   import java.lang.reflect.Method;
  +import java.lang.reflect.InvocationTargetException;
   
   /**
    * This task used to invoke XDoclet.  It has bee deprecated for another taskdef called
  @@ -27,6 +29,7 @@
    * @author <a href="mailto:vinay_chandran@users.sourceforge.net">Vinay Chandrasekharan</a>
    * @author Paul Hammant
    * @version $Revision$ $Date$
  + * @deprecated
    */
   public class PhoenixXDoclet extends Task
   {
  @@ -35,8 +38,11 @@
       private ManifestSubTask m_manifestSubTask;
       private Class m_metaGenerateQDoxClass;
       private Object m_metaGenerateQDoxTask;
  +    private File m_destDir;
  +
       private static boolean WARNING_SENT;
   
  +
       /**
        * Construct a PhoenixXDoclet.
        */
  @@ -52,7 +58,7 @@
           }
           catch (Exception e)
           {
  -            throw new BuildException("Some problem Instanting the MetaGenerate TaskDef."
  +            throw new BuildException("Some problem Instantiating the MetaGenerate TaskDef."
                   + " You will need phoenix-metagenerate.jar and qdox-1.0.jar in the classpath");
           }
       }
  @@ -110,6 +116,18 @@
               addFileSet.invoke(m_metaGenerateQDoxTask, new Object[] {set});
   
           }
  +        catch (InvocationTargetException ite)
  +        {
  +            if (ite.getTargetException() instanceof BuildException)
  +            {
  +                throw (BuildException) ite.getTargetException();
  +            }
  +            else
  +            {
  +                throw new BuildException("Exception during delegation:",ite);
  +            }
  +
  +        }
           catch (Exception e)
           {
               e.printStackTrace();
  @@ -124,12 +142,24 @@
        */
       public void setDestDir(File dir)
       {
  +        m_destDir = dir;
           try
           {
               Method setDir = m_metaGenerateQDoxClass.getMethod("setDest", new Class[] {File.class});
               setDir.invoke(m_metaGenerateQDoxTask, new Object[] {dir});
   
           }
  +        catch (InvocationTargetException ite)
  +        {
  +            if (ite.getTargetException() instanceof BuildException)
  +            {
  +                throw (BuildException) ite.getTargetException();
  +            }
  +            else
  +            {
  +                throw new BuildException("Exception during delegation:",ite);
  +            }
  +        }
           catch (Exception e)
           {
               e.printStackTrace();
  @@ -188,7 +218,20 @@
        */
       public void execute() throws BuildException
       {
  -        String manifest = m_manifestSubTask.getManifestFile();
  +        String manifest = null;
  +        if (m_manifestSubTask != null)
  +        {
  +            manifest = m_manifestSubTask.getManifestFile();
  +            ManifestWriter manifestWriter = new ManifestWriter();
  +            try
  +            {
  +                manifestWriter.write(m_destDir, manifest);
  +            }
  +            catch (IOException e)
  +            {
  +                throw new BuildException("Unable to write Manifest File: " + e.getMessage());
  +            }
  +        }
   
           // TODO create fake manifest.
           // an empty one will do.
  @@ -200,6 +243,17 @@
               execute.invoke(m_metaGenerateQDoxTask, new Object[] {});
   
           }
  +        catch (InvocationTargetException ite)
  +        {
  +            if (ite.getTargetException() instanceof BuildException)
  +            {
  +                throw (BuildException) ite.getTargetException();
  +            }
  +            else
  +            {
  +                throw new BuildException("Exception during delegation:",ite);
  +            }
  +        }
           catch (Exception e)
           {
               e.printStackTrace();
  @@ -217,9 +271,21 @@
           super.setTaskName(s);
           try
           {
  -            Method setTaskName = m_metaGenerateQDoxClass.getMethod("setTaskName", new Class[]
{String.class});
  +            Method setTaskName = m_metaGenerateQDoxClass.getMethod("setTaskName",
  +                    new Class[] {String.class});
               setTaskName.invoke(m_metaGenerateQDoxTask, new Object[] {s});
           }
  +        catch (InvocationTargetException ite)
  +        {
  +            if (ite.getTargetException() instanceof BuildException)
  +            {
  +                throw (BuildException) ite.getTargetException();
  +            }
  +            else
  +            {
  +                throw new BuildException("Exception during delegation:",ite);
  +            }
  +        }
           catch (Exception e)
           {
               e.printStackTrace();
  @@ -240,6 +306,17 @@
               init.invoke(m_metaGenerateQDoxTask, new Object[] {});
   
           }
  +        catch (InvocationTargetException ite)
  +        {
  +            if (ite.getTargetException() instanceof BuildException)
  +            {
  +                throw (BuildException) ite.getTargetException();
  +            }
  +            else
  +            {
  +                throw new BuildException("Exception during delegation:",ite);
  +            }
  +        }
           catch (Exception e)
           {
               e.printStackTrace();
  @@ -262,6 +339,17 @@
                       new Class[] {Project.class});
               setProject.invoke(m_metaGenerateQDoxTask, new Object[] {project});
   
  +        }
  +        catch (InvocationTargetException ite)
  +        {
  +            if (ite.getTargetException() instanceof BuildException)
  +            {
  +                throw (BuildException) ite.getTargetException();
  +            }
  +            else
  +            {
  +                throw new BuildException("Exception during delegation:",ite);
  +            }
           }
           catch (Exception e)
           {
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/xdoclet/ManifestWriter.java
  
  Index: ManifestWriter.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.io.IOException;
  import java.io.FileWriter;
  
  public class ManifestWriter
  {
      private static final String[] LINES = new String[]{
          "Manifest-Version: 1.0",
          "Created-By: Apache Avalon Project (Automatically via PhoenixXDoclet)",
          ""};
  
      /**
       * Construct
       * @param destDir The desitnatin dir
       * @param fileName The File to create
       * @throws IOException If a problem writing output
       */
      public void write(File destDir, String fileName) throws IOException
      {
          File file= new File(destDir, fileName);
          FileWriter output = new FileWriter(file);
          for (int i = 0; i < LINES.length; i++)
          {
              output.write(LINES[i] + "\n");
          }
          output.close();
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message