You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2001/03/03 07:50:22 UTC

cvs commit: jakarta-turbine/src/java/org/apache/turbine/torque TorqueSQLTask.java

jmcnally    01/03/02 22:50:22

  Modified:    conf/torque torque.xml
               src/java/org/apache/turbine/torque TorqueSQLTask.java
  Log:
  need the project to be defined in order to get the name of the
  output file correct.  Not sure what heppened here, but I needed it to
  get things working.
  
  Revision  Changes    Path
  1.18      +1 -0      jakarta-turbine/conf/torque/torque.xml
  
  Index: torque.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/conf/torque/torque.xml,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- torque.xml	2001/03/02 23:33:41	1.17
  +++ torque.xml	2001/03/03 06:50:22	1.18
  @@ -89,6 +89,7 @@
           value="${torque.home}/${schemaDirectory}/${project}-schema.xml"/>
       <torque-sql
         contextProperties="${torque.props}"
  +      projectName="${project}"
         controlTemplate="${SQLControlTemplate}"
         outputDirectory="${outputDirectory}"
         templatePath="${templatePath}"
  
  
  
  1.3       +31 -1     jakarta-turbine/src/java/org/apache/turbine/torque/TorqueSQLTask.java
  
  Index: TorqueSQLTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/torque/TorqueSQLTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TorqueSQLTask.java	2001/02/28 16:17:40	1.2
  +++ TorqueSQLTask.java	2001/03/03 06:50:22	1.3
  @@ -71,7 +71,7 @@
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:jmcnally@collab.net>John McNally</a>
  - * @version $Id: TorqueSQLTask.java,v 1.2 2001/02/28 16:17:40 jvanzyl Exp $
  + * @version $Id: TorqueSQLTask.java,v 1.3 2001/03/03 06:50:22 jmcnally Exp $
    */
   public class TorqueSQLTask extends TexenTask
   {
  @@ -93,6 +93,11 @@
        * soon.
        */
       private String targetDatabase;
  +
  +    /**
  +     * The project name
  +     */
  +    private String projectName;
       
       /**
        * Get the xml schema describing the application
  @@ -117,6 +122,26 @@
       }
   
       /**
  +     * Get the project name.
  +     *
  +     * @return String .
  +     */
  +    public String getProjectName()
  +    {
  +        return projectName;
  +    }
  +
  +    /**
  +     * Set the project name
  +     *
  +     * @param String
  +     */
  +    public void setProjectName(String v)
  +    {
  +        projectName = v;
  +    }
  +
  +    /**
        * Get the current target package.
        *
        * @return String target database(s)
  @@ -159,6 +184,11 @@
            * Place our model in the context.
            */
           context.put("appData", app);
  +
  +        /*
  +         * Place our project name in the context.
  +         */
  +        context.put("project", projectName);
           
           /*
            * Place the target database in the context.
  
  
  

Re: cvs commit: jakarta-turbine/src/java/org/apache/turbine/torque TorqueSQLTask.java

Posted by Jason van Zyl <jv...@periapt.com>.
I removed the getProjectName because the project name
is fed into the context via the torque.props file and
is available in the context as $project.

contextProperties=${torque.props}

Tells texen to take all the values in torque.props and
feed them into the context so they are available for use
in the templates.

I wanted to use the contextProperties=X mechanism to
make the tasks easily extendable. You just have to
add a property to the props file and it will be
available in the context. Trying to make it so that
you don't have to change the code in the tasks
themselves.

jvz.

On 3 Mar 2001 jmcnally@apache.org wrote:

> jmcnally    01/03/02 22:50:22
> 
>   Modified:    conf/torque torque.xml
>                src/java/org/apache/turbine/torque TorqueSQLTask.java
>   Log:
>   need the project to be defined in order to get the name of the
>   output file correct.  Not sure what heppened here, but I needed it to
>   get things working.
>   
>   Revision  Changes    Path
>   1.18      +1 -0      jakarta-turbine/conf/torque/torque.xml
>   
>   Index: torque.xml
>   ===================================================================
>   RCS file: /home/cvs/jakarta-turbine/conf/torque/torque.xml,v
>   retrieving revision 1.17
>   retrieving revision 1.18
>   diff -u -r1.17 -r1.18
>   --- torque.xml	2001/03/02 23:33:41	1.17
>   +++ torque.xml	2001/03/03 06:50:22	1.18
>   @@ -89,6 +89,7 @@
>            value="${torque.home}/${schemaDirectory}/${project}-schema.xml"/>
>        <torque-sql
>          contextProperties="${torque.props}"
>   +      projectName="${project}"
>          controlTemplate="${SQLControlTemplate}"
>          outputDirectory="${outputDirectory}"
>          templatePath="${templatePath}"
>   
>   
>   
>   1.3       +31 -1     jakarta-turbine/src/java/org/apache/turbine/torque/TorqueSQLTask.java
>   
>   Index: TorqueSQLTask.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/torque/TorqueSQLTask.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- TorqueSQLTask.java	2001/02/28 16:17:40	1.2
>   +++ TorqueSQLTask.java	2001/03/03 06:50:22	1.3
>   @@ -71,7 +71,7 @@
>     *
>     * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
>     * @author <a href="mailto:jmcnally@collab.net>John McNally</a>
>   - * @version $Id: TorqueSQLTask.java,v 1.2 2001/02/28 16:17:40 jvanzyl Exp $
>   + * @version $Id: TorqueSQLTask.java,v 1.3 2001/03/03 06:50:22 jmcnally Exp $
>     */
>    public class TorqueSQLTask extends TexenTask
>    {
>   @@ -93,6 +93,11 @@
>         * soon.
>         */
>        private String targetDatabase;
>   +
>   +    /**
>   +     * The project name
>   +     */
>   +    private String projectName;
>        
>        /**
>         * Get the xml schema describing the application
>   @@ -117,6 +122,26 @@
>        }
>    
>        /**
>   +     * Get the project name.
>   +     *
>   +     * @return String .
>   +     */
>   +    public String getProjectName()
>   +    {
>   +        return projectName;
>   +    }
>   +
>   +    /**
>   +     * Set the project name
>   +     *
>   +     * @param String
>   +     */
>   +    public void setProjectName(String v)
>   +    {
>   +        projectName = v;
>   +    }
>   +
>   +    /**
>         * Get the current target package.
>         *
>         * @return String target database(s)
>   @@ -159,6 +184,11 @@
>             * Place our model in the context.
>             */
>            context.put("appData", app);
>   +
>   +        /*
>   +         * Place our project name in the context.
>   +         */
>   +        context.put("project", projectName);
>            
>            /*
>             * Place the target database in the context.
>   
>   
>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
> 
>