On 11/13/01 11:38 AM, "John McNally" <[EMAIL PROTECTED]> wrote:
> "Weaver, Scott" wrote:
>>
>> Got a question ;)
>>
>> Why does the doBuild() method in all of the Torque-generated peers have the
>> database map hard coded?
>>
>> dbMap = TurbineDB.getDatabaseMap("jstore");
>>
>> The reason I bring this up is because I had changed a couple of things
>> around when I was building my app where this caused me problems. I had a
>> project name of "store", but I wanted the database to be called "jstore."
>> So, after running the first ant to create the project in the webapp
>> directory, I went into build.properties and changed both the
>> Turbine-schema.xml and store-schema.xml from <database name="store"> to
>> <database name="jstore">. I also changed the idTableDatabase from
>> "idTableDatabase = store" to "idTableDatabase = jstore" then ran "ant init"
>> which created these entries in my turbine.properties
>>
>> database.store.driver=org.gjt.mm.mysql.Driver
>> database.store.url=jdbc:mysql://127.0.0.1/jstore
>> database.store.username=-----
>> database.store.password=-----
>>
>> services.PoolBrokerService.defaultPool = store
>> services.MapBrokerService.defaultMap = store
>
> The way it should work is if you use <database name="jstore"> the
> properties should be named jstore as well, e.g. database.jstore.driver.
> The actual name of the database that would go in the url, does not need
> to be related to any hardcoded strings in the om/peer/map classes. I
> thought the tdk made a simplifying assumption that the actual db name
> and the name referenced in turbine code would be the same. But it seems
> from your example the tdk assumes a the name used in TR.props is the
> project name, while the om/peer/map objects use the name specified in
> the xml schema. This needs to be fixed, as it obviously will not work
> for multiple databases.
Right, I have not tested the multiple database use with the generated OM
files yet. For tambora I only need multiple database creation because we
don't use the peers in tambora yet. But we'll get this stuff added to the
testbed and make sure it works.
> btw, (mostly to jason) does a project name have
> any purpose, if torque assumes it should operate on all xml files in the
> schema directory?
The project name was necessary at one point because there were ${project}
references in the templates. The SQL generation and OM generation have no
references to ${project} anymore. I believe the only templates that make
reference to ${project} are the dumping templates which I will fix as I'm
working on the testbed.
The direction I'm going in is close to how scarab uses Torque. I would like
to have a standard torque-build.xml file that has all the standard targets
and within that use a set of "torque" prefixed values so that they don't
collide with other commonly defined properties like "project", or
"database". This standard torque-build.xml file and the standard properties
will be the normal way to use torque. People can make their own ant build
files if they want but I think the way scarab uses it makes sense. But I
would like to be able to use a JAR file. Somehow extract the standard build
file from the JAR or something, I don't know yet.
There are still some "project" references in the build file and I would like
to get rid of those too.
> john mcnally
>
>
>>
>> But all the map classes had the line:
>>
>> dbMap = TurbineDB.getDatabaseMap("jstore");
>>
>> in the doBuild() method which was causing all off my peers to fail with a
>> "connection is null!" exception.
>>
>> After changing all references to "store" to "jstore" in the above lines in
>> turbine.properties everything worked fine.
>>
>> My point is, why not grab the value for the default map from
>> turbine.properties like this:
>>
>> dbMap =
>> TurbineDB.getDatabaseMap(TurbineResources.getString("services.MapBrokerServi
>> ce.defaultMap"));
>>
>> Would this not make things a little more flexible and less prone to error
>> (IMOHO hard-coding is not the best approach)? Am I think correctly here or
>> is my logic totally off base.
>>
>> Regards,
>> Scott
>>
>> --
>> To unsubscribe, e-mail:
>> <mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
>> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
jvz.
Jason van Zyl
http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>