You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Var George <va...@yahoo.com> on 2004/10/17 19:16:41 UTC
Configuring SLIDE Table names to avoid name conflicts
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.
Re: Configuring SLIDE Table names to avoid name conflicts
Posted by Var George <va...@yahoo.com>.
Unico
Any advice on this?
regards
Var George
Oliver Zeigermann <ol...@gmail.com> wrote:
I have no idea about RDBMSComparableResourcesPool. I guess Unico has
done all the work at it,
Unico?
Oliver
On Tue, 19 Oct 2004 20:05:49 -0700 (PDT), Var George
wrote:
> Oliver
>
> I am done with all the changes and the only item remaining is RDBMSComparableResourcesPool.java. do you have any advice on how to proceed with this file? this is the only class that has SQL outside Adapter classes. how is this classes used anyways?
>
> regards
> Varughese George
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
---------------------------------
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
Re: Configuring SLIDE Table names to avoid name conflicts
Posted by Oliver Zeigermann <ol...@gmail.com>.
I have no idea about RDBMSComparableResourcesPool. I guess Unico has
done all the work at it,
Unico?
Oliver
On Tue, 19 Oct 2004 20:05:49 -0700 (PDT), Var George
<va...@yahoo.com> wrote:
> Oliver
>
> I am done with all the changes and the only item remaining is RDBMSComparableResourcesPool.java. do you have any advice on how to proceed with this file? this is the only class that has SQL outside Adapter classes. how is this classes used anyways?
>
> regards
> Varughese George
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: Configuring SLIDE Table names to avoid name conflicts
Posted by Var George <va...@yahoo.com>.
Oliver
I am done with all the changes and the only item remaining is RDBMSComparableResourcesPool.java. do you have any advice on how to proceed with this file? this is the only class that has SQL outside Adapter classes. how is this classes used anyways?
regards
Varughese George
Var George <va...@yahoo.com> wrote:
Oliver
There are couple of references to slide tables in RDBMSComparableResourcesPool.java
( method - compileJoins() ) however i couldn't access AbstractRDBMSAdapter from this class. AbstractRDBMSStore.java has a protected member adapter but this is of type RDBMSAdapter. Any idea how to change RDBMSComparableResourcesPool.java ?
regards
Var George
Oliver Zeigermann wrote:
Why modifying AbstractRDBMSStore in the first place?
Oliver
Var George schrieb:
> Thank you Oliver (and Warwick). I completed this using slide.properties and I am now switching the implementation to base it on Domain.xml.
>
>
>
> There are few issues in using Domain.xml.
>
>
>
> Once I use domain XML I can no longer statically initialize the table names because initialization should be done inside the public void setParameters(Hashtable parameters) method of AbstractRDBMSAdapter and AdbtractRDBMSStore, and it will increase the total number of lines of code.
> To implement changes in RDBMSComparableResourcesPool.java, I need to modify AdbtractRDBMSStore (same change as in AbstractRDBMSAdapter). I cannot single source the following code in AdbtractRDBMSStore.java because AbstractRDBMSAdapter has access to only the interface Service, not the AdbtractRDBMSStore class. Even though it�s a small fragment of code duplicating it in 2 classes doesn�t look clean.
>
> Moving these parameters to Domain xml will require some duplication of code as explained in (2). If you prefer the parameters in Domin.xml then I will make the remaining changes and will send you the code. Otherwise I can send you the changes based on parameters in slide.properties.. Please let me know your preference.
>
>
>
> regards
>
> Var George
>
>
>
> -------------------------------------------------------------------------------
>
> This code need to be duplicated in the following classes
>
> -- AdbtractRDBMSStore.java
>
> -- AbstractRDBMSAdapter.java
>
>
>
> New Instance variables:
>
> --------------------------
>
>
>
> //setParameters(Hashtable parameters) will be called before SQL
>
> //so all the _TABLE variables will be initialized appropriately.
>
> protected String URI_TABLE;
>
> protected String OBJECT_TABLE;
>
> protected String BINDING_TABLE;
>
> protected String PARENT_BINDING_TABLE;
>
> protected String LINKS_TABLE;
>
> protected String LOCKS_TABLE;
>
> protected String BRANCH_TABLE;
>
> protected String LABEL_TABLE;
>
> protected String VERSION_TABLE;
>
> protected String VERSION_HISTORY_TABLE;
>
> protected String VERSION_PREDS_TABLE;
>
> protected String VERSION_LABELS_TABLE;
>
> protected String VERSION_CONTENT_TABLE;
>
> protected String PROPERTIES_TABLE;
>
> protected String PERMISSIONS_TABLE;
>
>
>
> existing method - public void setParameters(Hashtable parameters):
>
> ------------------------------------------------------------
>
> //call resolveRDBMSObjectNames(parameters) to init _TABLE variables;
>
> resolveRDBMSObjectNames(parameters);
>
>
>
> new method -
>
> ---------------
>
>
>
> /**
>
> * Resolve rdbms objects names
>
> *
>
> * Default rbdms objects names may be overridden by setting store specific
>
> * parameters in Domain xml file as (e.g. for URI)
>
> *
SLIDE_URI
>
> *
>
> * @param parameters Hashtable of parameters set in domain xml file
>
> * @return void
>
> */
>
> private void resolveRDBMSObjectNames(Hashtable parameters)
>
> {
>
>
>
> URI_TABLE = getResolvedRDBMSObjectName(parameters, "URI");
>
> OBJECT_TABLE = getResolvedRDBMSObjectName(parameters, "OBJECT");
>
> BINDING_TABLE = getResolvedRDBMSObjectName(parameters, "BINDING");
>
> PARENT_BINDING_TABLE = getResolvedRDBMSObjectName(parameters, "PARENT_BINDING");
>
> LINKS_TABLE = getResolvedRDBMSObjectName(parameters, "LINKS");
>
> LOCKS_TABLE = getResolvedRDBMSObjectName(parameters, "LOCKS");
>
> BRANCH_TABLE = getResolvedRDBMSObjectName(parameters, "BRANCH");
>
> LABEL_TABLE = getResolvedRDBMSObjectName(parameters, "LABEL");
>
> VERSION_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION");
>
> VERSION_HISTORY_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_HISTORY");
>
> VERSION_PREDS_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_PREDS");
>
> VERSION_LABELS_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_LABELS");
>
> VERSION_CONTENT_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_CONTENT");
>
> PROPERTIES_TABLE = getResolvedRDBMSObjectName(parameters, "PROPERTIES");
>
> PERMISSIONS_TABLE = getResolvedRDBMSObjectName(parameters, "PERMISSIONS");
>
> }
>
>
>
> /**
>
> * Resolve RDBMS Object name that corresponds to default a object name
>
> *
>
> * @param parameters Hashtable of parameters set in domain xml file
>
> * @param defaultName Default object name (e.g. URI)
>
> * @return Return resolved rdbms object name.
>
> * if property is not set the return default name
>
> *
>
> */
>
> private String getResolvedRDBMSObjectName(Hashtable parameters, String defaultName)
>
> {
>
> String rbdmsObjectName = defaultName;
>
>
>
> String key = "rdbmsobjectname."+ defaultName;
>
> String value = (String)parameters.get(key);
>
>
>
> if (null != value){
>
> rbdmsObjectName = value;
>
> }
>
>
>
> return rbdmsObjectName;
>
> }
> -------------------------------------------------------------------------------------------------------------------
>
> Oliver Zeigermann wrote:No changes required at all. Just add a
> element to the store
> definition and it will be passed as a parameter to the store's
> setParameters method.
>
> Oliver
>
> Var George schrieb:
>
>
>>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(propertyName , 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 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: slide-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>>
>>
>>
>>---------------------------------
>>Do you Yahoo!?
>>Yahoo! Mail Address AutoComplete - You start. We finish.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: Configuring SLIDE Table names to avoid name conflicts
Posted by Var George <va...@yahoo.com>.
Oliver
There are couple of references to slide tables in RDBMSComparableResourcesPool.java
( method - compileJoins() ) however i couldn't access AbstractRDBMSAdapter from this class. AbstractRDBMSStore.java has a protected member adapter but this is of type RDBMSAdapter. Any idea how to change RDBMSComparableResourcesPool.java ?
regards
Var George
Oliver Zeigermann <ol...@zeigermann.de> wrote:
Why modifying AbstractRDBMSStore in the first place?
Oliver
Var George schrieb:
> Thank you Oliver (and Warwick). I completed this using slide.properties and I am now switching the implementation to base it on Domain.xml.
>
>
>
> There are few issues in using Domain.xml.
>
>
>
> Once I use domain XML I can no longer statically initialize the table names because initialization should be done inside the public void setParameters(Hashtable parameters) method of AbstractRDBMSAdapter and AdbtractRDBMSStore, and it will increase the total number of lines of code.
> To implement changes in RDBMSComparableResourcesPool.java, I need to modify AdbtractRDBMSStore (same change as in AbstractRDBMSAdapter). I cannot single source the following code in AdbtractRDBMSStore.java because AbstractRDBMSAdapter has access to only the interface Service, not the AdbtractRDBMSStore class. Even though it�s a small fragment of code duplicating it in 2 classes doesn�t look clean.
>
> Moving these parameters to Domain xml will require some duplication of code as explained in (2). If you prefer the parameters in Domin.xml then I will make the remaining changes and will send you the code. Otherwise I can send you the changes based on parameters in slide.properties.. Please let me know your preference.
>
>
>
> regards
>
> Var George
>
>
>
> -------------------------------------------------------------------------------
>
> This code need to be duplicated in the following classes
>
> -- AdbtractRDBMSStore.java
>
> -- AbstractRDBMSAdapter.java
>
>
>
> New Instance variables:
>
> --------------------------
>
>
>
> //setParameters(Hashtable parameters) will be called before SQL
>
> //so all the _TABLE variables will be initialized appropriately.
>
> protected String URI_TABLE;
>
> protected String OBJECT_TABLE;
>
> protected String BINDING_TABLE;
>
> protected String PARENT_BINDING_TABLE;
>
> protected String LINKS_TABLE;
>
> protected String LOCKS_TABLE;
>
> protected String BRANCH_TABLE;
>
> protected String LABEL_TABLE;
>
> protected String VERSION_TABLE;
>
> protected String VERSION_HISTORY_TABLE;
>
> protected String VERSION_PREDS_TABLE;
>
> protected String VERSION_LABELS_TABLE;
>
> protected String VERSION_CONTENT_TABLE;
>
> protected String PROPERTIES_TABLE;
>
> protected String PERMISSIONS_TABLE;
>
>
>
> existing method - public void setParameters(Hashtable parameters):
>
> ------------------------------------------------------------
>
> //call resolveRDBMSObjectNames(parameters) to init _TABLE variables;
>
> resolveRDBMSObjectNames(parameters);
>
>
>
> new method -
>
> ---------------
>
>
>
> /**
>
> * Resolve rdbms objects names
>
> *
>
> * Default rbdms objects names may be overridden by setting store specific
>
> * parameters in Domain xml file as (e.g. for URI)
>
> *
SLIDE_URI
>
> *
>
> * @param parameters Hashtable of parameters set in domain xml file
>
> * @return void
>
> */
>
> private void resolveRDBMSObjectNames(Hashtable parameters)
>
> {
>
>
>
> URI_TABLE = getResolvedRDBMSObjectName(parameters, "URI");
>
> OBJECT_TABLE = getResolvedRDBMSObjectName(parameters, "OBJECT");
>
> BINDING_TABLE = getResolvedRDBMSObjectName(parameters, "BINDING");
>
> PARENT_BINDING_TABLE = getResolvedRDBMSObjectName(parameters, "PARENT_BINDING");
>
> LINKS_TABLE = getResolvedRDBMSObjectName(parameters, "LINKS");
>
> LOCKS_TABLE = getResolvedRDBMSObjectName(parameters, "LOCKS");
>
> BRANCH_TABLE = getResolvedRDBMSObjectName(parameters, "BRANCH");
>
> LABEL_TABLE = getResolvedRDBMSObjectName(parameters, "LABEL");
>
> VERSION_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION");
>
> VERSION_HISTORY_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_HISTORY");
>
> VERSION_PREDS_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_PREDS");
>
> VERSION_LABELS_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_LABELS");
>
> VERSION_CONTENT_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_CONTENT");
>
> PROPERTIES_TABLE = getResolvedRDBMSObjectName(parameters, "PROPERTIES");
>
> PERMISSIONS_TABLE = getResolvedRDBMSObjectName(parameters, "PERMISSIONS");
>
> }
>
>
>
> /**
>
> * Resolve RDBMS Object name that corresponds to default a object name
>
> *
>
> * @param parameters Hashtable of parameters set in domain xml file
>
> * @param defaultName Default object name (e.g. URI)
>
> * @return Return resolved rdbms object name.
>
> * if property is not set the return default name
>
> *
>
> */
>
> private String getResolvedRDBMSObjectName(Hashtable parameters, String defaultName)
>
> {
>
> String rbdmsObjectName = defaultName;
>
>
>
> String key = "rdbmsobjectname."+ defaultName;
>
> String value = (String)parameters.get(key);
>
>
>
> if (null != value){
>
> rbdmsObjectName = value;
>
> }
>
>
>
> return rbdmsObjectName;
>
> }
> -------------------------------------------------------------------------------------------------------------------
>
> Oliver Zeigermann wrote:No changes required at all. Just add a
> element to the store
> definition and it will be passed as a parameter to the store's
> setParameters method.
>
> Oliver
>
> Var George schrieb:
>
>
>>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(propertyName , 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 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: slide-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>>
>>
>>
>>---------------------------------
>>Do you Yahoo!?
>>Yahoo! Mail Address AutoComplete - You start. We finish.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
Re: Configuring SLIDE Table names to avoid name conflicts
Posted by Oliver Zeigermann <ol...@zeigermann.de>.
Why modifying AbstractRDBMSStore in the first place?
Oliver
Var George schrieb:
> Thank you Oliver (and Warwick). I completed this using slide.properties and I am now switching the implementation to base it on Domain.xml.
>
>
>
> There are few issues in using Domain.xml.
>
>
>
> Once I use domain XML I can no longer statically initialize the table names because initialization should be done inside the public void setParameters(Hashtable parameters) method of AbstractRDBMSAdapter and AdbtractRDBMSStore, and it will increase the total number of lines of code.
> To implement changes in RDBMSComparableResourcesPool.java, I need to modify AdbtractRDBMSStore (same change as in AbstractRDBMSAdapter). I cannot single source the following code in AdbtractRDBMSStore.java because AbstractRDBMSAdapter has access to only the interface Service, not the AdbtractRDBMSStore class. Even though it’s a small fragment of code duplicating it in 2 classes doesn’t look clean.
>
> Moving these parameters to Domain xml will require some duplication of code as explained in (2). If you prefer the parameters in Domin.xml then I will make the remaining changes and will send you the code. Otherwise I can send you the changes based on parameters in slide.properties.. Please let me know your preference.
>
>
>
> regards
>
> Var George
>
>
>
> -------------------------------------------------------------------------------
>
> This code need to be duplicated in the following classes
>
> -- AdbtractRDBMSStore.java
>
> -- AbstractRDBMSAdapter.java
>
>
>
> New Instance variables:
>
> --------------------------
>
>
>
> //setParameters(Hashtable parameters) will be called before SQL
>
> //so all the _TABLE variables will be initialized appropriately.
>
> protected String URI_TABLE;
>
> protected String OBJECT_TABLE;
>
> protected String BINDING_TABLE;
>
> protected String PARENT_BINDING_TABLE;
>
> protected String LINKS_TABLE;
>
> protected String LOCKS_TABLE;
>
> protected String BRANCH_TABLE;
>
> protected String LABEL_TABLE;
>
> protected String VERSION_TABLE;
>
> protected String VERSION_HISTORY_TABLE;
>
> protected String VERSION_PREDS_TABLE;
>
> protected String VERSION_LABELS_TABLE;
>
> protected String VERSION_CONTENT_TABLE;
>
> protected String PROPERTIES_TABLE;
>
> protected String PERMISSIONS_TABLE;
>
>
>
> existing method - public void setParameters(Hashtable parameters):
>
> ------------------------------------------------------------
>
> //call resolveRDBMSObjectNames(parameters) to init _TABLE variables;
>
> resolveRDBMSObjectNames(parameters);
>
>
>
> new method -
>
> ---------------
>
>
>
> /**
>
> * Resolve rdbms objects names
>
> * <br/>
>
> * Default rbdms objects names may be overridden by setting store specific
>
> * parameters in Domain xml file as (e.g. for URI)
>
> * <parameter name="rdbmsobjectname.URI">SLIDE_URI</parameter>
>
> *
>
> * @param parameters Hashtable of parameters set in domain xml file
>
> * @return void
>
> */
>
> private void resolveRDBMSObjectNames(Hashtable parameters)
>
> {
>
>
>
> URI_TABLE = getResolvedRDBMSObjectName(parameters, "URI");
>
> OBJECT_TABLE = getResolvedRDBMSObjectName(parameters, "OBJECT");
>
> BINDING_TABLE = getResolvedRDBMSObjectName(parameters, "BINDING");
>
> PARENT_BINDING_TABLE = getResolvedRDBMSObjectName(parameters, "PARENT_BINDING");
>
> LINKS_TABLE = getResolvedRDBMSObjectName(parameters, "LINKS");
>
> LOCKS_TABLE = getResolvedRDBMSObjectName(parameters, "LOCKS");
>
> BRANCH_TABLE = getResolvedRDBMSObjectName(parameters, "BRANCH");
>
> LABEL_TABLE = getResolvedRDBMSObjectName(parameters, "LABEL");
>
> VERSION_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION");
>
> VERSION_HISTORY_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_HISTORY");
>
> VERSION_PREDS_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_PREDS");
>
> VERSION_LABELS_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_LABELS");
>
> VERSION_CONTENT_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_CONTENT");
>
> PROPERTIES_TABLE = getResolvedRDBMSObjectName(parameters, "PROPERTIES");
>
> PERMISSIONS_TABLE = getResolvedRDBMSObjectName(parameters, "PERMISSIONS");
>
> }
>
>
>
> /**
>
> * Resolve RDBMS Object name that corresponds to default a object name
>
> *
>
> * @param parameters Hashtable of parameters set in domain xml file
>
> * @param defaultName Default object name (e.g. URI)
>
> * @return Return resolved rdbms object name.
>
> * if property is not set the return default name
>
> *
>
> */
>
> private String getResolvedRDBMSObjectName(Hashtable parameters, String defaultName)
>
> {
>
> String rbdmsObjectName = defaultName;
>
>
>
> String key = "rdbmsobjectname."+ defaultName;
>
> String value = (String)parameters.get(key);
>
>
>
> if (null != value){
>
> rbdmsObjectName = value;
>
> }
>
>
>
> return rbdmsObjectName;
>
> }
> -------------------------------------------------------------------------------------------------------------------
>
> Oliver Zeigermann <ol...@zeigermann.de> wrote:No changes required at all. Just add a
> element to the store
> definition and it will be passed as a parameter to the store's
> setParameters method.
>
> Oliver
>
> Var George schrieb:
>
>
>>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(propertyName , 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 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: slide-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>>
>>
>>
>>---------------------------------
>>Do you Yahoo!?
>>Yahoo! Mail Address AutoComplete - You start. We finish.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: Configuring SLIDE Table names to avoid name conflicts
Posted by Var George <va...@yahoo.com>.
Thank you Oliver (and Warwick). I completed this using slide.properties and I am now switching the implementation to base it on Domain.xml.
There are few issues in using Domain.xml.
Once I use domain XML I can no longer statically initialize the table names because initialization should be done inside the public void setParameters(Hashtable parameters) method of AbstractRDBMSAdapter and AdbtractRDBMSStore, and it will increase the total number of lines of code.
To implement changes in RDBMSComparableResourcesPool.java, I need to modify AdbtractRDBMSStore (same change as in AbstractRDBMSAdapter). I cannot single source the following code in AdbtractRDBMSStore.java because AbstractRDBMSAdapter has access to only the interface Service, not the AdbtractRDBMSStore class. Even though it�s a small fragment of code duplicating it in 2 classes doesn�t look clean.
Moving these parameters to Domain xml will require some duplication of code as explained in (2). If you prefer the parameters in Domin.xml then I will make the remaining changes and will send you the code. Otherwise I can send you the changes based on parameters in slide.properties.. Please let me know your preference.
regards
Var George
-------------------------------------------------------------------------------
This code need to be duplicated in the following classes
-- AdbtractRDBMSStore.java
-- AbstractRDBMSAdapter.java
New Instance variables:
--------------------------
//setParameters(Hashtable parameters) will be called before SQL
//so all the _TABLE variables will be initialized appropriately.
protected String URI_TABLE;
protected String OBJECT_TABLE;
protected String BINDING_TABLE;
protected String PARENT_BINDING_TABLE;
protected String LINKS_TABLE;
protected String LOCKS_TABLE;
protected String BRANCH_TABLE;
protected String LABEL_TABLE;
protected String VERSION_TABLE;
protected String VERSION_HISTORY_TABLE;
protected String VERSION_PREDS_TABLE;
protected String VERSION_LABELS_TABLE;
protected String VERSION_CONTENT_TABLE;
protected String PROPERTIES_TABLE;
protected String PERMISSIONS_TABLE;
existing method - public void setParameters(Hashtable parameters):
------------------------------------------------------------
//call resolveRDBMSObjectNames(parameters) to init _TABLE variables;
resolveRDBMSObjectNames(parameters);
new method -
---------------
/**
* Resolve rdbms objects names
* <br/>
* Default rbdms objects names may be overridden by setting store specific
* parameters in Domain xml file as (e.g. for URI)
* <parameter name="rdbmsobjectname.URI">SLIDE_URI</parameter>
*
* @param parameters Hashtable of parameters set in domain xml file
* @return void
*/
private void resolveRDBMSObjectNames(Hashtable parameters)
{
URI_TABLE = getResolvedRDBMSObjectName(parameters, "URI");
OBJECT_TABLE = getResolvedRDBMSObjectName(parameters, "OBJECT");
BINDING_TABLE = getResolvedRDBMSObjectName(parameters, "BINDING");
PARENT_BINDING_TABLE = getResolvedRDBMSObjectName(parameters, "PARENT_BINDING");
LINKS_TABLE = getResolvedRDBMSObjectName(parameters, "LINKS");
LOCKS_TABLE = getResolvedRDBMSObjectName(parameters, "LOCKS");
BRANCH_TABLE = getResolvedRDBMSObjectName(parameters, "BRANCH");
LABEL_TABLE = getResolvedRDBMSObjectName(parameters, "LABEL");
VERSION_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION");
VERSION_HISTORY_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_HISTORY");
VERSION_PREDS_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_PREDS");
VERSION_LABELS_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_LABELS");
VERSION_CONTENT_TABLE = getResolvedRDBMSObjectName(parameters, "VERSION_CONTENT");
PROPERTIES_TABLE = getResolvedRDBMSObjectName(parameters, "PROPERTIES");
PERMISSIONS_TABLE = getResolvedRDBMSObjectName(parameters, "PERMISSIONS");
}
/**
* Resolve RDBMS Object name that corresponds to default a object name
*
* @param parameters Hashtable of parameters set in domain xml file
* @param defaultName Default object name (e.g. URI)
* @return Return resolved rdbms object name.
* if property is not set the return default name
*
*/
private String getResolvedRDBMSObjectName(Hashtable parameters, String defaultName)
{
String rbdmsObjectName = defaultName;
String key = "rdbmsobjectname."+ defaultName;
String value = (String)parameters.get(key);
if (null != value){
rbdmsObjectName = value;
}
return rbdmsObjectName;
}
-------------------------------------------------------------------------------------------------------------------
Oliver Zeigermann <ol...@zeigermann.de> wrote:No changes required at all. Just add a
element to the store
definition and it will be passed as a parameter to the store's
setParameters method.
Oliver
Var George schrieb:
> 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(propertyName , 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 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: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!
Re: Configuring SLIDE Table names to avoid name conflicts
Posted by Oliver Zeigermann <ol...@zeigermann.de>.
No changes required at all. Just add a <parameter> element to the store
definition and it will be passed as a parameter to the store's
setParameters method.
Oliver
Var George schrieb:
> 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(propertyName , 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 <ol...@zeigermann.de> 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: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: Configuring SLIDE Table names to avoid name conflicts
Posted by Var George <va...@yahoo.com>.
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(propertyName , 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 <ol...@zeigermann.de> 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: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
Re: Configuring SLIDE Table names to avoid name conflicts
Posted by Oliver Zeigermann <ol...@zeigermann.de>.
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: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org