Building a Generic RESThub stack

70 views
Skip to first unread message

Maxired

unread,
Nov 10, 2011, 8:10:40 AM11/10/11
to resthub-dev, res...@maxired.fr
Hi all,

I am currenlty working on a project whose primery goal is to provide
"Backend as a Service".
I am posting there because this projec is built over Resthub Java. I
am using the last Release, resthub 1.1.2.5

The first step is to create a Generic Stack whose goal is to create/
get/update/delete any object, without any specific code linked to the
object :
If we want to be able to deal with a new kind of entity, we just need
to create the new entity Class.

It is important to mention that I am using a SQL database, mainly
because I didn't want to deal with any database configuration or
drivers settings, ...

I got currently a working prototype which is working with any simple
object, ie only composed by basic Type or serializable object.
To do so, all the entity that we deal with have to extend a Root
entity composed by an Id and a HashMap. It is in this HashMap that all
other object attribut are saved.

Here is an extract of the getter corresponding to the HashMap


for(Field field : this.getClass().getDeclaredFields()){
try{
if(field.getName().indexOf("_")!=0 ){
//field of the Root Object begin
with "_"
_parameter.put(field.getName(),
field.get(this));
}
}catch(java.lang.IllegalAccessException e){
_parameter.put(field.getName(), null);
}
}

For completeness, I should also say that I'm aiming to work with
Dynamic Class reloading. I got also this feature working in the same
condition. In order to retrieve object - saved in the database - whose
model is not up to date (some fields deleted by example), I am once
again playing with the HashMap : When we ask for the object, we don't
give the object but the HashMap. This is working fine in JSON which is
the output that I'm aiming in a first time. (If you want some more
information about his, please ask me)

The next step would be to be able to save relation between object.
To do so, I'm thinking to override the service method (Currently I am
using only the Resthub Generic service layer), but I think this might
be usefull that I got your advice before going further.
I'm a afraid that I need to basically do yet another ORM.
In my service layer, I would need to check all the field of my object,
if one of this field extends my Root object, deal with it (save,
retrieved, ...) , and do so until all fields are processed.
I would also need to do this for Collections, Array, and I'm pretty
sure for some more thing that I'm not yet thinking about.
What do you think ? Is there any simple project which could help me
there ?

Should I rather wait for the next version of RESThub ? Would Spring-
data help me to do so ?

Best regards,

Maxired

Seb

unread,
Dec 7, 2011, 12:20:40 PM12/7/11
to resth...@googlegroups.com, res...@maxired.fr
As discussed today, based on your work it could be possible to create a RESThub module that will be able to :
 - Register domain model objects written in a dynamic language, like Groovy
 - Do CRUD operation based on a RESThub 2 Controller - Repository stack, based on Spring Data
 - Store these data in a document oriented database like MongoDB

You should talk with Julien who is currently working on Spring Data MongoDB integration.


maxired

unread,
Dec 8, 2011, 3:55:52 AM12/8/11
to resth...@googlegroups.com, res...@maxired.fr
Hi folks,

This seems good to me.
For information, my plans also include to link all this with RESThub Identity Manager. 
The goal is that operation on objects to be user restricted.

I will inform you of any futur advancement.

Maxired
Reply all
Reply to author
Forward
0 new messages