You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Alessandro Colantoni <al...@gmail.com> on 2005/04/13 13:40:45 UTC

Mandragora: a new project based on Ojb

Hi !
my name's Alessandro Colantoni.

It's almost a couple of years I'm using Ojb.
I developed a small framework called Mandragora. I would like someone help 
me to put it in apache as a new project, if it is evaluated useful. 

Mandragora would be a framework that helps implementing Business Delegate 
and DAO patterns.

In my controller class I want to use methods of an an Interface BD (Business 
delegate) to manipulate my beans without worry about their implementation 
technology, about implementation logic (my business logic) and so on. 
I have just to fix on my control logic. I don't want to Know if I'm in a 
managed environment or not, if I'm using session bean, if they are stateful 
or not or other...
'Cause the control logic I need is very similar all around my application 
(and more, this similarity is visible through almost all applications) I 
want these methods be very general, and I want to switch form an 
implementation to an other just changing a a properties file. 
So through my application i want to use just my interface BD, retrieved by a 
ServiceLocator class which I have just to pass to the name of the 
implementation mapped in an properties file ( or nothing to use the default 
implementation) 
Of course I can use different implementations in different application 
areas. 


BD implementation class communicate with media store through a DAO in the 
same way controller communicate with BD layer.
I don't want worry if my DAO is implemented with OJB or Hibernate , or other 
(the only implementation I developed is based on Ojb persistence broker :-)) 

More I can say that I don't worry if my media store is an an RDBMS or other.

In this way I just fix on logic control, of particular aspects of my 
business logic.
It will be right, that each time we need to do a manipulation of beans that 
we can't do with any combination of methods BD interface, we will do an 
effort to write a general method to add to implementation class and so to 
the interface. 
Analogous for the DAO layer, we can write alway more methods that execute 
more different queries.

In this way we can way following the pattern controller--> BD--> DAO having 
to write alway less logic business, 'cause the number of the existing 
methods grows up. 

The mechanism, based on factory pattern , to retrieve implementation classes 
based on file properties has been copied form Ojb mechanism.

AS said , at the moment I just wrote an implementation for DAO interface 
based on Ojb, and a standard interface for DB interface, that is not 
suitable for managed environments. 

The method I dispose in my BD interface are the following:.

public Object findByPrimaryKey(Class realClass,String[] fieldName, Object[] 
pkValues)
public Object findByPrimaryKey(Class realClass, Object pkValue) 
public Collection findCollectionByTemplate(Object templateVO) 
public Object findObjectByTemplate(Object templateVO)
public Object insert(Object insertVO)
public Object insert(Object insertVO,boolean commit)
public Object update(Object updateVO)
public Object update(Object updateVO,boolean commit)
public void delete(Object deleteVO);
public void delete(Object deleteVO,boolean commit);
public void retrieveReference(Object pInstance, String pAttributeName) 
public void retrieveAllReferences(Object pInstance);
public Object updateCollectionReference(Object storeVO, String 
pAttributeName, boolean commit);
public Object updateCollectionReference(Object storeVO, String 
pAttributeName); 
public Collection findOrderedCollectionByTemplate(Object templateVO, String 
orderingField, boolean asc);
public Object updateCollectionReferences(Object storeVO, boolean commit)
public Object updateCollectionReferences(Object storeVO) 
public Collection findCollectionByNullFields(Class clazz, String[] 
nullFields)
public Collection findCollectionByLogicCondition(Class clazz,LogicCondition 
logicCondition) 

For example If in a controller class I need to get an object of a class Bean 
whose unique key value is "key" 
I just write:

ServiceLocator.getInstance().getManagerBD("BDFactoryDefaultClass"," 
StandardBDDefaultClass"). findByPrimaryKey (Bean.class,"key"");


At the moment are just few methods, but I hope the structure is good, so I 
can write always more. 
I just wrote some more that just do complex manipulation without storing, 
that I'm sure will use in next projects to.


I hope this could be interesting.

Thanks for attention.

Re: Mandragora: a new project based on Ojb

Posted by Alessandro Colantoni <al...@gmail.com>.
maybe you are rigtht. 
I tough it was easier.
 I send you a gif of the Uml class diagram for Dao.
For Bd the it's the same. At the end I didn't use Mandaragora ClassHelper.
 I send you the DAO implemented with Ojb.
 An example of use of findCollectionByLogicCondition is 
 SerciceLocator..........findCollectionByLogicCondition(InteActiRolVO.class, 
new LogicSqlCondition("codinte","=",intervencionVO.getCodigo(),"AND",new 
LogicSqlCondition("codactipadre","isNull","AND",new 
LogicSqlCondition("codrolpadre","isNull")))) 
  I'm currently using mandragora in a project and I'm saving a lot of time.
 But of course there are a lot of things to do.
 Now you can't do complex report query, the mechanism of LogicCondition has 
to improve, I'would like to write a base bean to manage it's state and so 
on.
 I' would like see always more methods in dao and bd interfaces every time I 
download it form CVS, but now, as I'm working alone, every time I don't find 
a method I need I have to do the effort to write it in a generic way alone. 
I'd need someone to discuss the implementations. 
 I'll took a look at sourceforge.net <http://sourceforge.net/> to see if it 
is more easy to put it there.


On 4/14/05, Mike Jackson <mj...@cdi-hq.com> wrote: 
> 
> Perhaps you should start it out on sourceforge. You can work on the code
> and on getting people interested in helping out. Once you have enough
> interested developers then you can worry about getting setup within
> incubator.
> 
> Personally this sounds interesting to me, so I'd like to see some code or
> flow diagrams or something. Text discussions always leave me a little in
> the dark.
> 
> --mikej
> -=-----
> mike jackson
> mjackson@cdi-hq.com
> 
> 
> > -----Original Message-----
> > From: Alessandro Colantoni [mailto:alessandro.colantoni@gmail.com]
> > Sent: Wednesday, April 13, 2005 7:56 AM
> > To: OJB Users List
> > Subject: Re: Mandragora: a new project based on Ojb
> >
> >
> > Tanks for your answer Antonio.
> > I just had a look at
> > http://jakarta.apache.org/site/newproject.html, an I
> > saw that " a product must have at least 3 active developers
> > who are already
> > involved with the codebase".
> > The problem is that I'm alone developing Mandragora. I would
> > like to put it
> > here because I caught the idea using Ojb, and studying it's
> > code (not very
> > well) I learned very good lessons.
> > I don't know how to get other two people to involve in the code.
> > They should be people with some time developing with Ojb,
> > because they could
> > grow-up the number of query, because the only implementation
> > of DAO at
> > moment is done with Ojb.
> > I don't see my post in the mail list, y your reply to
> > http://nagoya.apache.org/eyebrowse/SummarizeList?listName=ojb-
> user@db.apache.org
> Have I done something wrong subscribing?
> 
> On 4/13/05, Antonio Gallardo <ag...@agssa.net> wrote:
> >
> > Hi Aleesandro:
> >
> > The project sounds interesting. Some advises:
> >
> > The Apache incubator is the entry gateway for new projects:
> > http://incubator.apache.org/
> >
> > Please also read general notes about new projects
> > http://jakarta.apache.org/site/newproject.html
> >
> > Best Regards,
> >
> > Antonio Gallardo.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
>

RE: Mandragora: a new project based on Ojb

Posted by Mike Jackson <mj...@cdi-hq.com>.
Perhaps you should start it out on sourceforge.  You can work on the code
and on getting people interested in helping out.  Once you have enough
interested developers then you can worry about getting setup within
incubator.

Personally this sounds interesting to me, so I'd like to see some code or
flow diagrams or something.  Text discussions always leave me a little in
the dark.

--mikej
-=-----
mike jackson
mjackson@cdi-hq.com


> -----Original Message-----
> From: Alessandro Colantoni [mailto:alessandro.colantoni@gmail.com] 
> Sent: Wednesday, April 13, 2005 7:56 AM
> To: OJB Users List
> Subject: Re: Mandragora: a new project based on Ojb
> 
> 
> Tanks for your answer Antonio.
> I just had a look at 
> http://jakarta.apache.org/site/newproject.html, an I 
> saw that " a product must have at least 3 active developers 
> who are already 
> involved with the codebase".
> The problem is that I'm alone developing Mandragora. I would 
> like to put it 
> here because I caught the idea using Ojb, and studying it's 
> code (not very 
> well) I learned very good lessons.
> I don't know how to get other two people to involve in the code. 
> They should be people with some time developing with Ojb, 
> because they could 
> grow-up the number of query, because the only implementation 
> of DAO at 
> moment is done with Ojb.
>  I don't see my post in the mail list, y your reply to 
> http://nagoya.apache.org/eyebrowse/SummarizeList?listName=ojb-
user@db.apache.org
 Have I done something wrong subscribing?

 On 4/13/05, Antonio Gallardo <ag...@agssa.net> wrote: 
> 
> Hi Aleesandro:
> 
> The project sounds interesting. Some advises:
> 
> The Apache incubator is the entry gateway for new projects: 
> http://incubator.apache.org/
> 
> Please also read general notes about new projects 
> http://jakarta.apache.org/site/newproject.html
> 
> Best Regards,
> 
> Antonio Gallardo.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Mandragora: a new project based on Ojb

Posted by Alessandro Colantoni <al...@gmail.com>.
Tanks for your answer Antonio.
I just had a look at http://jakarta.apache.org/site/newproject.html, an I 
saw that " a product must have at least 3 active developers who are already 
involved with the codebase".
The problem is that I'm alone developing Mandragora. I would like to put it 
here because I caught the idea using Ojb, and studying it's code (not very 
well) I learned very good lessons.
I don't know how to get other two people to involve in the code. 
They should be people with some time developing with Ojb, because they could 
grow-up the number of query, because the only implementation of DAO at 
moment is done with Ojb.
 I don't see my post in the mail list, y your reply to
http://nagoya.apache.org/eyebrowse/SummarizeList?listName=ojb-user@db.apache.org
 Have I done something wrong subscribing?

 On 4/13/05, Antonio Gallardo <ag...@agssa.net> wrote: 
> 
> Hi Aleesandro:
> 
> The project sounds interesting. Some advises:
> 
> The Apache incubator is the entry gateway for new projects:
> http://incubator.apache.org/
> 
> Please also read general notes about new projects
> http://jakarta.apache.org/site/newproject.html
> 
> Best Regards,
> 
> Antonio Gallardo.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
>

Re: Mandragora: a new project based on Ojb

Posted by Antonio Gallardo <ag...@agssa.net>.
Hi Aleesandro:


The project sounds interesting. Some advises:

The Apache incubator is the entry gateway for new projects:
http://incubator.apache.org/

Please also read general notes about new projects
http://jakarta.apache.org/site/newproject.html

Best Regards,

Antonio Gallardo.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org