Re: [Registry-dev] Registry as a library inside other products

2007-12-17 Thread Chathura C. Ekanayake
I changed the registry code as discussed in this thread. Details of the changes are sent in the mail "Refactoring of registry constructors". Thanks, Chathura Sanjaya Karunasena wrote: Since no one reply to my mail on this regard, I created a JIRA. https://wso2.org/jira/browse/REGISTRY-23 :

Re: [Registry-dev] Registry as a library inside other products

2007-12-13 Thread Sanjaya Karunasena
> >> * The SecureRegistry doesn't completely encapsulate the Registry > >> > >> Right now the user has to construct a Registry and pass it to the > >> SecureRegistry. The problem here is, there is insecure access to the > >> same registry since the use build that externally. If we aggregate the > >

Re: [Registry-dev] Registry as a library inside other products

2007-12-13 Thread Paul Fremantle
Sorry not to reply earlier. Comments inline. * There is a "init" method which does lot of datasource related work. +1 I thought we had consensus to get rid of these and just use constructors. JDBCRegistry(DataSource dataSource) +1 If what user has is a DB URI... he will, new JDBCRegi

Re: [Registry-dev] Registry as a library inside other products

2007-12-13 Thread Sanjaya Karunasena
Since no one reply to my mail on this regard, I created a JIRA. https://wso2.org/jira/browse/REGISTRY-23 :-) /Sanjaya On Wednesday 05 December 2007, Sanjaya Karunasena wrote: > I went through the code in SVN last night. Here are few problems I have > noticed. > > * There is a "init" method whic

Re: [Registry-dev] Registry as a library inside other products

2007-12-05 Thread Sanjaya Karunasena
Well I think this conflicts (or is it complement?) with Paul's idea of giving a very descriptive class names for developers (user) where they would know exactly what they are going to get from the class name. If we use a factory the user doesn't know what the real implementation which got instan

Re: [Registry-dev] Registry as a library inside other products

2007-12-05 Thread Sanjaya Karunasena
On Wednesday 05 December 2007, Chathura C. Ekanayake wrote: > Paul Fremantle wrote: > > Sanjaya has also persuaded me (on IM) that we should add another > > constructor > > > > new JDBCRegistry(DataSource dataSource) > > > > I'm not sure if there is an equivalent that uses a Connection as well. >

Re: [Registry-dev] Registry as a library inside other products

2007-12-05 Thread Sanjaya Karunasena
I went through the code in SVN last night. Here are few problems I have noticed. * There is a "init" method which does lot of datasource related work. First of all having a init method in a OO code doesn't make sense. YES, IOC containers use this since they can't handle any thing else while do

Re: [Registry-dev] Registry as a library inside other products

2007-12-05 Thread Sanjiva Weerawarana
I hate factories; see: http://discuss.joelonsoftware.com/default.asp?joel.3.219431.12 OTOH, I can see the value of being able to switch the underlying impl based on config. So .. begrudging +1. However, this does not change the need to fix up the current constructors correctly. So I suggest

Re: [Registry-dev] Registry as a library inside other products

2007-12-04 Thread Paul Fremantle
Glen Could you commit a starting point for the factory. I think I'd find it easier to look at some code and play around. Thanks Paul Glen Daniels wrote: Hi folks! Sorry for the somewhat late response. +1 to the APIs below, I totally agree that "falling back" to a different implementation

Re: [Registry-dev] Registry as a library inside other products

2007-12-04 Thread Chathura C. Ekanayake
Paul Fremantle wrote: Sanjaya has also persuaded me (on IM) that we should add another constructor new JDBCRegistry(DataSource dataSource) I'm not sure if there is an equivalent that uses a Connection as well. I think Sanjaya is proposing to have a DataSource implementation that can wrap a

Re: [Registry-dev] Registry as a library inside other products

2007-12-04 Thread Paul Fremantle
Sanjaya has also persuaded me (on IM) that we should add another constructor new JDBCRegistry(DataSource dataSource) I'm not sure if there is an equivalent that uses a Connection as well. Paul Sanjiva Weerawarana wrote: +1. Paul Fremantle wrote: I understand that we are using HSQLDB to pr

Re: [Registry-dev] Registry as a library inside other products

2007-12-04 Thread Glen Daniels
Hi folks! Sorry for the somewhat late response. +1 to the APIs below, I totally agree that "falling back" to a different implementation type is not really appropriate if you use a particular constructor. However... I think that a factory approach is probably better long run, in order to suppor

Re: [Registry-dev] Registry as a library inside other products

2007-12-04 Thread Sanjiva Weerawarana
+1. Paul Fremantle wrote: I understand that we are using HSQLDB to provide the in-memory DB, its just a bit odd that the class is called JDBCRegistry. From a beginners perspective, wouldn't it make more sense to have another class called InMemoryRegistry. Of course under the covers it can u

Re: [Registry-dev] Registry as a library inside other products

2007-12-04 Thread Sanjaya Karunasena
Hi Paul, The datasource I am refering here is the java.sql.Datasource interface. So what you get is a java.sql.Connection which you will be using internally like you do now. Also this helps you to overcome the problem of having to treat a registry which need to work with a JDBC datasource as

Re: [Registry-dev] Registry as a library inside other products

2007-12-04 Thread Paul Fremantle
Sanjaya We did already look at this design where there were two key interfaces: the Registry interface and behind this a DataStore interface. However, we realized that the underlying datastore had to implement almost ALL the logic that was in the Registry interface, so instead we refactored i

Re: [Registry-dev] Registry as a library inside other products

2007-12-03 Thread Sanjaya Karunasena
Hi Chathura, I see few OO problems here. First, InMemoryRegistry, JDBCRegistry doesn't sound polymorphic. It simply exposed implementation details. Do you have an abstract class Registry? What we have here is a Registry which can work with different Datasources. If a datasource is not availabl

Re: [Registry-dev] Registry as a library inside other products

2007-12-03 Thread Sanjaya Karunasena
I am in agreement with Paul. Doing magic in your code is bad. If it is a bad datasource throw an exception. Let the programmer to tell you what exactly he want. Give him a constructor to create a registry with an in-mem database. Makes the programming model simple, easy to understand. Thanks S

Re: [Registry-dev] Registry as a library inside other products

2007-12-03 Thread Paul Fremantle
Let's hear from Glen - he has a great sense of good APIs. Paul Chathura C. Ekanayake wrote: I like it too. Then the constructors imply what is happening inside. Shall I change the code according to this? Thanks, Chathura Paul Fremantle wrote: I understand that we are using HSQLDB to provide

Re: [Registry-dev] Registry as a library inside other products

2007-12-03 Thread Chathura C. Ekanayake
I like it too. Then the constructors imply what is happening inside. Shall I change the code according to this? Thanks, Chathura Paul Fremantle wrote: I understand that we are using HSQLDB to provide the in-memory DB, its just a bit odd that the class is called JDBCRegistry. From a beginners

Re: [Registry-dev] Registry as a library inside other products

2007-12-03 Thread Keith Chapman
Paul Fremantle wrote: > I understand that we are using HSQLDB to provide the in-memory DB, its > just a bit odd that the class is called JDBCRegistry. > > From a beginners perspective, wouldn't it make more sense to have > another class called InMemoryRegistry. Of course under the covers it can >

Re: [Registry-dev] Registry as a library inside other products

2007-12-03 Thread Paul Fremantle
I understand that we are using HSQLDB to provide the in-memory DB, its just a bit odd that the class is called JDBCRegistry. From a beginners perspective, wouldn't it make more sense to have another class called InMemoryRegistry. Of course under the covers it can use the JDBCRegistry with HSQL

Re: [Registry-dev] Registry as a library inside other products

2007-12-03 Thread Chathura C. Ekanayake
+1. So shall we remove "allowInMemoryDB" parameter from all constructors and only start the in-memory database if the default constructor is used. Then the constructors would look like: 1) JDBCRegistry() - Use in-memory DB. 2) JDBCRegistry(String datasourceName) - Use the given data source.

Re: [Registry-dev] Registry as a library inside other products

2007-12-03 Thread Paul Fremantle
I'm bothered about the "fallback" to an inmemory database. I don't think that makes sense as something to do automatically. Surely its better for a user to explicitly try to start the JDBCReg and if that fails catch the exception or null and then create an in-mem Reg? Paul Sanjiva Weerawaran