The Interface and the ProxyInterface are used if you set ojbUseProxy in 
your Properties. This is used for a dynamic proxy mapping. Anyway, I would 
like to apply another patch, which defines the same Class structure as the 
default OM Model of Torque. This means that there is a BaseObject and an 
Object. And the Object is not touched, if it is already there.



At 12:22 27.09.2002 -0500, you wrote:
>I've applied most of your patches. A few things:
>
>- The Inteface.vm/ProxyInterface.vm looked good, but I didn't add them
>because I didn't see how they were going to get executed.
>
>- The ojb.xxx/objXXx thing makes sense now; I put in the torque.xxx->xxx
>mechanism without even realizing that xxx.yyy was invalid in Velocity.
>Though let's stick with just torque.ojbXxx properties for now (they
>should be automatically stripped of the torque. in front of them).
>
>- You had removed a #set($database = $dataModel.database) from the top
>of the file, but $database was later used a few lines down. Was this
>intentional? I replaced the $database with $dataModel.database, but if
>this isn't right, just let me know.
>
>I generated the OJB stuff for a torque project of mine and it looks
>okay, but I haven't actually run it through OJB. If you could do so and
>verify everything is good, let me know.
>
>Thanks,
>Stephen
>
> > -----Original Message-----
> > From: Markus M. May [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, September 27, 2002 6:06 AM
> > To: Turbine Torque Developers List
> > Subject: RE: [patch] ojb templates
> >
> > I have again edited the repository as well as the model template
>files. Now
> > it supports also the dynamic proxy pattern from ojb.
> >
> >
>
>
>--
>To unsubscribe, 
>e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>

---+++--------------------+++---------------------+++---
Markus M. May
[EMAIL PROTECTED]

Provide you with better J2EE support

Please use my public key at:
http://www.may-consult.com/mmay_mayconsult_com.key
---+++--------------------+++---------------------+++---
#set ($interface = "")
#if ($table.Interface)
    #set ($interface = ", $table.Interface")
#end

#set ($db = $table.Database)
#if ($db.Package)
    #set ($package = $db.Package)
#else
    #set ($package = $targetPackage)
#end
package $package;


/** 
#if ($addTimeStamp)
 * The skeleton for this interface was autogenerated by Torque on:
 *
 * [$now]
 *
#end
 * You should add additional methods to this interface to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 */
public interface ${table.JavaName}ProxyInterface
    extends ${basePrefix}${table.JavaName}ProxyInterface
{
}
#set ($db = $table.Database)
#if ($db.Package)
    #set ($package = $db.Package)
#else
    #set ($package = $targetPackage)
#end
package ${package};

#if ($table.BaseClass)
    #set ($extendsBaseClass = "extends $table.BaseClass" )
#else
    #set ($extendsBaseClass = "" )
#end

#if ($table.Interface)
    #set ($interface = "Serializable, ${basePrefix}${table.JavaName}Interface, 
$table.Interface" )
#else
    #set ($interface = "Serializable, ${basePrefix}${table.JavaName}Interface" )
#end

import java.io.Serializable;
import java.util.Date;


/** 
#if ($addTimeStamp)
 * This class was autogenerated by Torque on:
 *
 * [$now]
 *
#end
 * You should not use this class directly.  It should not even be
 * extended all references should be to $table.JavaName
 */
public class ${basePrefix}${table.JavaName} $extendsBaseClass
        implements $interface
{

    #foreach ($col in $table.Columns)
      #set ( $cjtype = $col.JavaPrimitive )
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $defaultValue = "null" )
      #if ( $cjtype == "boolean")
        #set ( $defaultValue = "false" )
      #elseif ($cjtype == "int")
        #set ( $defaultValue = "0" )
      #end
    private $cjtype $clo = $defaultValue;
    #end

    #foreach ($col in $table.Columns)
        #set ( $cfc=$col.JavaName )
        #set ( $cfc=$cfc.replaceFirst(".", $cfc.substring(0,1).toUpperCase()) )
        #set ( $clo=$col.Name.toLowerCase() )
        #set ( $cjtype = $col.JavaPrimitive )

    /**
     * Get the $cfc
     * @return $cjtype
     */
    public $cjtype get${cfc}()
    {
        return $clo;
    }

    /**
     * Set the value of $cfc
     */
    public void set${cfc}($cjtype v )
    {
        this.$clo = v;
    }

    #end
}
#set ($db = $table.Database)
#if ($db.Package)
    #set ($package = $db.Package)
#else
    #set ($package = $targetPackage)
#end
package ${package};

import java.io.Serializable;
import java.util.Date;

/** 
#if ($addTimeStamp)
 * This interface was autogenerated by Torque on:
 *
 * [$now]
 *
#end
 * You should not use this proxy interface directly.  It should 
 * not even be extended all references should be to 
 * ${table.JavaName}ProxyInterface
 */
public interface ${basePrefix}${table.JavaName}ProxyInterface extends Serializable
{

    #foreach ($col in $table.PrimaryKey)
        #set ( $cfc=$col.JavaName )
        #set ( $cfc=$cfc.replaceFirst(".", $cfc.substring(0,1).toUpperCase()) )
        #set ( $clo=$col.Name.toLowerCase() )
        #set ( $cjtype = $col.JavaPrimitive )

    /**
     * Get the $cfc
     * @return $cjtype
     */
    public $cjtype get${cfc}();

    #end
}
#set ($interface = "")
#if ($table.Interface)
    #set ($interface = ", $table.Interface")
#end

#set ($db = $table.Database)
#if ($db.Package)
    #set ($package = $db.Package)
#else
    #set ($package = $targetPackage)
#end
package $package;

#if ($table.isAbstract())
    #set ($abstract = "abstract")
#end

/** 
#if ($addTimeStamp)
 * The skeleton for this interface was autogenerated by Torque on:
 *
 * [$now]
 *
#end
 * You should add additional methods to this interface to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 */
public interface ${table.JavaName}Interface
    extends ${basePrefix}${table.JavaName}Interface
{
}
Index: Control.vm
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/ojb/model/Control.vm,v
retrieving revision 1.1
diff -u -r1.1 Control.vm
--- Control.vm  11 Apr 2002 17:10:40 -0000      1.1
+++ Control.vm  27 Sep 2002 18:29:33 -0000
@@ -1,4 +1,4 @@
-#set ( $basepath = $generator.OutputPath)
+#set ( $basePath = ${generator.OutputPath} )
 
 #foreach ($dataModel in $dataModels)
   #foreach ($database in $dataModel.Databases)
@@ -15,10 +15,42 @@
     #foreach ($tbl in $database.Tables)
       $tbl.Name
       #set ( $firstcap=$tbl.JavaName )
+      
       #set ( $fname = "${firstcap}.java" )
       #set ( $path = "${strings.getPackageAsPath($package)}$fname" )
-      $generator.parse("ojb/model/Object.vm",$path,"table",$tbl)
+
+      #if (!$files.file($basePath,$path).exists())
+            $generator.parse("ojb/model/Object.vm",$path,"table",$tbl)
+      #end
+
+      #set ( $fname = "${basePrefix}${firstcap}.java" )
+      #set ( $path = "${strings.getPackageAsPath($package)}$fname" )
+      $generator.parse("ojb/model/BaseObject.vm",$path,"table",$tbl)
+
+      #set ( $fname = "${firstcap}Interface.java" )
+      #set ( $path = "${strings.getPackageAsPath($package)}$fname" )
+      #if (!$files.file($basePath,$path).exists())
+       $generator.parse("ojb/model/Interface.vm",$path,"table",$tbl)
+      #end     
+      
+      #set ( $fname = "${basePrefix}${firstcap}Interface.java" )
+      #set ( $path = "${strings.getPackageAsPath($package)}$fname" )     
+      $generator.parse("ojb/model/BaseInterface.vm",$path,"table",$tbl)
+      
+      #if ( $ojbUseProxy == true )
+            
+       #set ( $fname = "${firstcap}ProxyInterface.java" )
+               #set ( $path = "${strings.getPackageAsPath($package)}$fname" )
+       #if (!$files.file($basePath,$path).exists())
+         $generator.parse("ojb/model/ProxyInterface.vm",$path,"table",$tbl)
+       #end
+
+       #set ( $fname = "${basePrefix}${firstcap}ProxyInterface.java" )
+               #set ( $path = "${strings.getPackageAsPath($package)}$fname" )
+       $generator.parse("ojb/model/BaseProxyInterface.vm",$path,"table",$tbl)
+      
+      #end     
     #end
   #end
 
-#end
+#end
\ No newline at end of file
Index: Object.vm
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/ojb/model/Object.vm,v
retrieving revision 1.5
diff -u -r1.5 Object.vm
--- Object.vm   23 Sep 2002 09:12:48 -0000      1.5
+++ Object.vm   27 Sep 2002 18:29:33 -0000
@@ -1,69 +1,35 @@
+#set ($interface = "")
+#if ($table.Interface)
+    #set ($interface = ", $table.Interface")
+#end
+
 #set ($db = $table.Database)
 #if ($db.Package)
     #set ($package = $db.Package)
 #else
     #set ($package = $targetPackage)
 #end
-package ${package};
+package $package;
 
-#if ($table.BaseClass == "")
-    #set ($extendsBaseClass = "" )
-#else
-    #set ($extendsBaseClass = "extends $table.BaseClass" )
+#if ($table.isAbstract())
+    #set ($abstract = "abstract")
 #end
 
-#if ($table.Interface == "")
-    #set ($interface = "Serializable" )
-#else
-    #set ($interface = "Serializable, $table.Interface" )
-#end
-
-import java.io.Serializable;
-import java.util.Date;
+import org.apache.torque.om.Persistent;
 
-/**
- * $table.Name
+/** 
+#if ($addTimeStamp)
+ * The skeleton for this class was autogenerated by Torque on:
  *
  * [$now]
+ *
+#end
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
  */
-public class $table.JavaName $extendsBaseClass
-        implements $interface
+public $!abstract class $table.JavaName 
+    extends $basePrefix$table.JavaName
+    implements ${table.JavaName}Interface
 {
-
-    #foreach ($col in $table.Columns)
-      #set ( $cjtype = $col.JavaPrimitive )
-      #set ( $clo=$col.Name.toLowerCase() )
-      #set ( $defaultValue = "null" )
-      #if ( $cjtype == "boolean")
-        #set ( $defaultValue = "false" )
-      #elseif ($cjtype == "int")
-        #set ( $defaultValue = "0" )
-      #end
-    protected $cjtype $clo = $defaultValue;
-    #end
-
-    #foreach ($col in $table.Columns)
-        #set ( $cfc=$col.JavaName )
-        #set ( $cfc=$cfc.replaceFirst(".", $cfc.substring(0,1).toUpperCase()) )
-        #set ( $clo=$col.Name.toLowerCase() )
-        #set ( $cjtype = $col.JavaPrimitive )
-
-    /**
-     * Get the $cfc
-     * @return $cjtype
-     */
-    public $cjtype get${cfc}()
-    {
-        return $clo;
-    }
-
-    /**
-     * Set the value of $cfc
-     */
-    public void set${cfc}($cjtype v )
-    {
-        this.$clo = v;
-    }
-
-    #end
 }
#set ($db = $table.Database)
#if ($db.Package)
    #set ($package = $db.Package)
#else
    #set ($package = $targetPackage)
#end
package ${package};

import java.io.Serializable;
import java.util.Date;

/** 
#if ($addTimeStamp)
 * This interface was autogenerated by Torque on:
 *
 * [$now]
 *
#end
 * You should not use this interface directly.  It should not even be
 * extended all references should be to ${table.JavaName}Interface
 */
public interface ${basePrefix}${table.JavaName}Interface extends Serializable
{

    #foreach ($col in $table.Columns)
        #set ( $cfc=$col.JavaName )
        #set ( $cfc=$cfc.replaceFirst(".", $cfc.substring(0,1).toUpperCase()) )
        #set ( $clo=$col.Name.toLowerCase() )
        #set ( $cjtype = $col.JavaPrimitive )

     /**
      * Get the $cfc
      * @return $cjtype
      */
     public $cjtype get${cfc}();
 
     /**
      * Set the value of $cfc
      */
     public void set${cfc}($cjtype v );
 
     #end
}
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to