stephenh 2002/09/27 10:17:28
Modified: src/templates/ojb/repository Control.vm MainRepository.vm
Repository.vm
Log:
OJB patches by Markus M. May <[EMAIL PROTECTED]>:
I have made a couple of changes to the Control.vm and the
MainRepository.vm, these changes will now include all required fields.
Therefor you have to rename some properties, because names like
database.name seems not to work.
I have again edited the repository as well as the model template files. Now
it supports also the dynamic proxy pattern from ojb.
please find attached once again a patch for the ojb repository. I fixed the
stuff concerning the properties, but also I fixed a bug, when overgiving
datamodels instead of datamodel to the Mainrepository.vm.
Revision Changes Path
1.4 +14 -7 jakarta-turbine-torque/src/templates/ojb/repository/Control.vm
Index: Control.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/templates/ojb/repository/Control.vm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Control.vm 16 Apr 2002 07:51:18 -0000 1.3
+++ Control.vm 27 Sep 2002 17:17:28 -0000 1.4
@@ -1,12 +1,19 @@
+#set ( $mrname = "ojb/repository/MainRepository.vm" )
+#set ( $rname = "ojb/repository/Repository.vm" )
#set ( $basepath = $generator.OutputPath)
-$generator.parse("ojb/repository/MainRepository.vm","repository.xml","dataModels",$dataModels)
+#foreach ($dataModel in $dataModels)
+ #if($velocityCount==1)
+
$generator.parse("ojb/repository/MainRepository.vm","repository.xml","dataModel",$dataModel)
+ #end
+#end
#foreach ($dataModel in $dataModels)
- #set ( $outFile = "repository_${dataModel.shortName}.xml" )
- #set ( $modelCount = $velocityCount )
-
- File to be created: $outFile
- $generator.parse("ojb/repository/Repository.vm",$outFile,"dataModel",$dataModel)
-
+ #if ($project)
+ #set ( $outFile = "repository__${dataModel.shortName}.xml" )
+ #set ( $modelCount = $velocityCount )
+
+ File to be created: $outFile
+ $generator.parse($rname,$outFile,"dataModel",$dataModel)
+ #end
#end
1.4 +8 -11
jakarta-turbine-torque/src/templates/ojb/repository/MainRepository.vm
Index: MainRepository.vm
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/templates/ojb/repository/MainRepository.vm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MainRepository.vm 3 Jul 2002 01:08:44 -0000 1.3
+++ MainRepository.vm 27 Sep 2002 17:17:28 -0000 1.4
@@ -1,5 +1,3 @@
-#set ( $database = $dataModel.database )
-
<?xml version="1.0" encoding="UTF-8"?>
<!-- defining entities for include-files -->
@@ -15,20 +13,19 @@
the Connection specified here will be used. -->
<jdbc-connection-descriptor id="default"
- platform="${ojb.platform}"
+ platform="$ojbPlatform"
jdbc-level="${jdbcLevel}"
- #if (${ojb.useJNDI} == "true")
- jndi-datasource-name="${ojb.JNDISource}"
+ #if ($ojbUseJNDI)
+ jndi-datasource-name="$ojbJNDISource"
#else
- driver="${databaseDriver}"
+ driver="$databaseDriver"
protocol="jdbc"
- subprotocol="${database}"
- dbalias="${databaseName}"
+ subprotocol="$dataModel.database"
+ dbalias="$databaseName"
#end
- username="${databaseUser}"
- password="$!{databasePassword}"
+ username="$databaseUser"
+ password="$!databasePassword"
>
-
<!-- include mappings here -->
#foreach ($dataModel in $dataModels)
1.5 +7 -2
jakarta-turbine-torque/src/templates/ojb/repository/Repository.vm
Index: Repository.vm
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/templates/ojb/repository/Repository.vm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Repository.vm 3 Jul 2002 01:08:44 -0000 1.4
+++ Repository.vm 27 Sep 2002 17:17:28 -0000 1.5
@@ -19,7 +19,10 @@
==============================================================
$!table.getDescription()
-->
- <class-descriptor proxy="dynamic"
+ <class-descriptor
+ #if ($ojbUseProxy)
+ proxy="dynamic"
+ #end
class="${package}.${table.JavaName}"
table="$table.Name"
>
@@ -84,7 +87,9 @@
#end
#if ($col.isAutoIncrement()) ${space}autoincrement="true"
#end
-#if ($size != "") ${space}length="${size}"
+#if ($size != "" || $size != "0")
+ ${space}length="${size}"
+ #set ($size = "0")
#end
#if ($precision != "") ${space}precision="${precision}"
#end
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>