Hi, this is a great idea. 

> Is there a simple way to access domain xml from 
> AbstractRDBMSAdapter.java ? 

I haven't delved too deep but you may be able to configure the table names
as parameters to the store. The RDBMSAdapter interface has a setParameters()
method which its implementors and their extending classes implement. It
looks like any parameter specified to the definition of a store as a
name-value string pair is passed into the store implementations via a
hashtable. The values are converted from XML to name-value string pairs
automatically. You could specify the mapping of table names as parameters to
the store and then have the setParameters() method of one of the higher
level implementations, either the AbstractRDBMSAdapter or
AbstractRDBMSStore, pull these values out and set them in the appropriate
public data members. For example the AbstractRDBMSStore currently implements
a setParameters() method that looks for a the parameter called "adapter"
which is set to the name of the adapter class to use for the RDBMS store.
Also the StandardRDBMSAdapter class looks for a parameter called "compress"
with a value of either true or false eg.

        <parameter name="compress">true</parameter>


> > I am using CommonRDBMSAdapter against Oracle 9i so I am not 
> sure how many of the platform specific **RDBMSAdapter classes are 
> required but the strategy will be to apply changes to all required 
> classes similar to (2)

It may be safest to review any classes that reference the
"prepareStatement()" method of the java.sql.Connection class as this is used
to prepare a text SQL statement for submission to the server and these are
the statements that you'll need to make your substitutions in. This is the
reference list I came up with using WSAD:

org.apache.slide.store.impl.rdbms.CommonRDBMSAdapter
org.apache.slide.store.impl.rdbms.DB2RDBMSAdapter
org.apache.slide.store.impl.rdbms.MySql41RDBMSAdapter
org.apache.slide.store.impl.rdbms.MySqlRDBMSAdapter
org.apache.slide.store.impl.rdbms.OldJDBCAdapter
org.apache.slide.store.impl.rdbms.OracleRDBMSAdapter
org.apache.slide.store.impl.rdbms.PostgresRDBMSAdapter
org.apache.slide.store.impl.rdbms.RDBMSComparableResourcesPool
org.apache.slide.store.impl.rdbms.SQLServerRDBMSAdapter
org.apache.slide.store.impl.rdbms.StandardRDBMSAdapter

Warwick


> -----Original Message-----
> From: Var George [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, October 17, 2004 1:36 PM
> To: Slide Users Mailing List
> Subject: Re: Configuring SLIDE Table names to avoid name conflicts
> 
> 
> 
> Oliver
> 
>  
> 
> Thank you. Is there a simple way to access domain xml from 
> AbstractRDBMSAdapter.java ? 
> 
>  
> 
> I was considering to do the following
> 
>  
> 
> slide.properties:
> 
> ----------------------
> 
>  
> 
> # RDBMS Object Name for URI
> 
> # Default: URI (if missing or not set then URI is used)
> 
> org.apache.slide.store.impl.rdbms.rdbmsobjectname.URI=SLIDE_URI
> 
>  
> 
>  
> 
> AbstratRDBMSAdapter.java:
> 
> --------------------------------------------
> 
>  
> 
> private static String resolveRDBMSObjectName(String name)
> 
> {
> 
>    //rdbms object name is configured in slide.properties
> 
>    //as proertynames prefixed with   
> 
>    //  "org.apache.slide.store.impl.rdbms.rdbmsobjectname."
> 
>    //for example, property name for URI will be set as
> 
>    //  
> org.apache.slide.store.impl.rdbms.rdbmsobjectname.URI=SLIDE_URI   
> 
>    String propertyName =  
> "org.apache.slide.store.impl.rdbms.rdbmsobjectname."+ name;
> 
>  
> 
>    //return the original name if property is not set so that slide 
> 
>    //will stay backward compatible.
> 
>    return 
> org.apache.slide.util.Configuration.getDefault().getProperty(p
> ropertyName , name);
> 
> }
> 
>  
> 
> Code changes to support entries in slide.properties look very 
> simple. I can move it to domain.xml instead of 
> slide.properties, if that's more appropriate in line with 
> slide development standards. Could you guide me on how you 
> would like Domain.xml to be modified?
> 
>   -- xml fragment to be added to Domain.xml ?
> 
>   -- does it require any changes to any DTD/Schema files?
> 
>   -- does it require changes to Domain.java?
> 
>   -- any code fragment for simple access of these setting 
> from Domain xml
> 
>  
> 
> Thanks for your help. Look forward to your response.
> 
>  
> 
> regards
> 
> Var George
> 
> 
> Oliver Zeigermann <[EMAIL PROTECTED]> wrote: Sounds like a 
> good idea to me. What about configuring the table names in 
> Domain.xml?
> 
> Also having the old table names as default would be good for backward 
> compatibility.
> 
> Oliver
> 
> Var George schrieb:
> 
> > When I try to create slide tables on my existing 
> application schema, I 
> > have some name conflicts because slide tables are named without any 
> > namespace prefix (e.g. PERMISSIONS vs SLIDE_PERMISSIONS). I 
> would like 
> > to make slide table names configurable to solve this problem.
> > 
> > 
> > 
> > Here are the changes that I am considering
> > 
> > 
> > 
> > 1. AbstratRDBMSAdapter.java:
> > 
> > ---------------------------------------
> > 
> > Define constants for all table names and statically initialize them 
> > from a property file (slide.properties ?). if property 
> files doesn't 
> > exist or property is not configured then initialize them to use 
> > default names (this way these changes will be backward compatible)
> > 
> > 
> > 
> > e.g.
> > 
> > protected final String URI_TABLE = resolveRDBMSObjectName("URI");;
> > 
> > 
> > 
> > 
> > 
> > 2. StandardRDBMSAdapter.java
> > 
> > --------------------------------------------
> > 
> > Update this class to use the constants instead of hard coded table 
> > names
> > 
> > 
> > 
> > e.g.
> > 
> > connection.prepareStatement("select 1 from " + OBJECT_TABLE 
> + " o, " + 
> > URI_TABLE + " u " + where o.URI_ID=u.URI_ID and u.URI_STRING=?");
> > 
> > 
> > 
> > 3. CommonRDBMSAdapter.java
> > 
> > ----------------------------------------
> > 
> > Update this class to use the constants instead of hard coded table 
> > names, similar to (2)
> > 
> > 
> > 
> > 4. RDBMSComparableResourcesPool.java
> > 
> > ---------------------------------------------------------
> > 
> > Update this class to use the constants instead of hard coded table 
> > names, similar to (2)
> > 
> > 
> > 
> > I am using CommonRDBMSAdapter against Oracle 9i so I am not 
> sure how 
> > many of the platform specific **RDBMSAdapter classes are 
> required but 
> > the strategy will be to apply changes to all required 
> classes similar 
> > to (2)
> > 
> > 
> > 
> > Please let know you your thoughts on this approach. Also I 
> would like 
> > to know if slide team is interested to pull these changes 
> into slide 
> > as a standard enhancement. I will be glad to send my changes if you 
> > are interested.
> > 
> > 
> > 
> > regards
> > 
> > Var George
> > 
> > 
> > 
> > ---------------------------------
> > Do you Yahoo!?
> > Read only the mail you want - Yahoo! Mail SpamGuard.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
>               
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to