Re: [Helma-dev] Announcing Rabbit

View: New views
4 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: [Helma-dev] Announcing Rabbit

by tobias.schaefer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

RE: [Helma-dev] Announcing Rabbit

hi maksim

> I've quickly tried out the instructions on your blog entry and
> successfully got the example app created with the "number,file,text"
> form but still not quite sure what allthe functionality of Rabbit is. I
> guess I'l start going through your code, but if you get a chance to
> quikly wwrite up some instructions or quick demo of hwo to use it that
> would be great.

ok, for a start, here's a short summary of features:

1.) registering prototypes

the method registerPrototype() takes two arguments, the name of the prototype as string and its type properties as vanilla object:

registerPrototype("Item", {
   _parent: "root",
   text: TEXT,
   file: FILE,
   number: NUMBER
});

the above call, as executed in the example, creates the prototype directory Item and a corresponding table T_ITEM in the hsqldb. (db.properties are generated as well.)

it also adds the type.properties file with the following mappings (which could be written in some more meaningful order):

text = ITEM_TEXT
_id = ITEM_ID
rabbit = mountpoint(PropertyMgr)
_db = test
number = ITEM_NUMBER
_parent = root
file = ITEM_FILE
rabbit_xml = ITEM_RABBIT_XML
_table = T_ITEM

finally, it also adds the necessary database columns to the T_ITEM table by transforming the constants TEXT, FILE and NUMBER into valid sql types and executing the resulting sql statement.

2.) resetting protoypes

to start from scratch, resetPrototypes() drops one or more database tables, depending on the amount of arguments. if no argument is given all database tables created via registerPrototype() will be dropped. of course, this will not remove any prototype directories, since they could contain user-generated files not under rabbit's control.

3.) actions for creating and editing

HopObjects can be created via a form accessible from a special URL, e.g.

http://localhost:8080/appname/+Item

displays the form to create a new Item object. after submit, the newly created object will be added to a collection of the parent object as given in the URL path. (in this case it is the default _children collection of Root)

other (hypothetical) URLs follow this scheme, e.g. you also can display the create form via the URL of a previously created Item object:

http://localhost:8080/appname/3/+Item

but be aware that you still have to take care about your object mapping; if Item objects cannot contain other Item objects in a given collection, the addition will fail.

4.) form elements reflect property types

the visual appearance of each form element depends on the type as set in the registerPrototype() call. it is determined by the constants TEXT, FILE, NUMBER. (there's also support for DATE but i am not yet happy with it.)

5.) database columns reflect property types

the types of database columns, too, are set to sql attributes equivalent to the property types (e.g. DATE becomes "timestamp", TEXT "varchar").

6.) special actions for uploaded content

binary content can be stored completely in one object field, no need to map the property to an extra File object or create a relational T_FILE table.

however, this needed special URL treatment. thus, properties containing files, images and the like can be accessed via a special URL:

http://localhost:8080/appname/5/.file

it's always a period followed by the property's name.

to avoid annoyances with file naming restrictions and provide better portability i decided to put binary content inside the database and not as extra files. i currently base64-encode the binary data and save this in a longvarchar column because i was not able to convince helma to convert a byte[] array for writing it into a binary column...

7.) snippet rendering

rabbit registers a global method called render() which makes use of an extended syntax for rendering only parts of a skin. i described the basics of this method already in the wiki [1].

inside this little snippet rendering engine there's also a (i think) very cool solution to the render/renderAsString dualism. but i have to stop now and will write about this and some more details a little bit later.

ciao,
tobi

--
[1] http://dev.helma.org/Wiki/JS-based+implementation+of+snippets+%28aka+subskins%29/


_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

Re: [Helma-dev] Announcing Rabbit

by Hannes Wallnoefer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobi,

this rabbit thing is very cool. It's definitely a direction in which
Helma needs to grow, and I hope you will continue working on it. I
will be supportive for making this an official part of Helma once it
gets mature enough.

I also think that your way of starting this as an API (instead of a
fully knitted app/module) is the right one, although my understanding
is still very limited, and I didn't have much time to think about it.

One idea about the DB creation/handling stuff: The sqlShell code is
pretty much a mess, but there might be some parts in there that could
be useful for rabbit. Stuff like low level JDBC interaction... Maybe
pulling it out of sqlShell and adding it to the rabbit API could
increase the usefulness of that code.

2006/10/3, tobias.schaefer@... <tobias.schaefer@...>:
>
>  the above call, as executed in the example, creates the prototype directory
> Item and a corresponding table T_ITEM in the hsqldb. (db.properties are
> generated as well.)
>

There seems to be a problem with the hsqldb: database content seems to
gone after restarts. When i look at the hsql.db directory, the data
seems to be there, but the URL /1/ renders an Object not found page.
Maybe it has to do with the database not being closed or opened
properly.

hannes
_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

Parent Message unknown Re: [Helma-dev] Announcing Rabbit

by tobias.schaefer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi hannes

> this rabbit thing is very cool. It's definitely a direction in which
> Helma needs to grow, and I hope you will continue working on it. I
> will be supportive for making this an official part of Helma once it
> gets mature enough.  

that's nice! i am glad you like it.

> I also think that your way of starting this as an API (instead of a
> fully knitted app/module) is the right one, although my understanding
> is still very limited, and I didn't have much time to think about it.

yeah, apologies for not providing the full insight; but i am working on it.
(time is *such* an issue...)

> One idea about the DB creation/handling stuff: The sqlShell code is
> pretty much a mess, but there might be some parts in there that could
> be useful for rabbit. Stuff like low level JDBC interaction... Maybe
> pulling it out of sqlShell and adding it to the rabbit API could
> increase the usefulness of that code.    

you're right. it was a little bit ignorant to code everything from scratch again. i will take some more closer looks at sqlShell. there's also a lot of things to be re-used from inspector, i (re)discovered right after my announcement.

> There seems to be a problem with the hsqldb: database content seems
> to gone after restarts. When i look at the hsql.db directory, the
> data seems to be there, but the URL /1/ renders an Object not found
> page.  
> Maybe it has to do with the database not being closed or opened
> properly.

i think you could be right; after i made a switch from using getDBConnection to the java.sql methods i did not think about closing the database connection ever. of course i checked my test app if the database entries persisted a helma restart but i better will dive into the code again to be sure.

ciao,
tobi

_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

Re: [Helma-dev] Announcing Rabbit

by tobias.schaefer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

RE: [Helma-user] [Helma-dev] Announcing Rabbit

hannes

i took another look at the rabbit code and i think it's not a database
issue.

it's rather the missing initialisation of rabbit causing the loss of
the HopObject's main- and edit_action.

this initialisation currently is only done in the example script. after
a restart calling one of these two actions of a previously created Item
object will result in a 404.

because i want to keep clean both the application namespace as well as
the rabbit api from any default initialisation this must be done in the
application rabbit is residing in; e.g. simply by adding the following
line to the global context:

 var rabbit = new Rabbit();

this should do the trick with defining the HopObject actions as well as
the definitions of the global methods i already described.

hth,
tobi


-----Original Message-----
From:   helma-user-bounces@... on behalf of Hannes Wallnoefer
Sent:   Wed 04-Oct-06 12:29
To:     Helma User Mailing List
Cc:    
Subject:        Re: [Helma-user] [Helma-dev] Announcing Rabbit

Hi Tobi,

this rabbit thing is very cool. It's definitely a direction in which
Helma needs to grow, and I hope you will continue working on it. I
will be supportive for making this an official part of Helma once it
gets mature enough.

I also think that your way of starting this as an API (instead of a
fully knitted app/module) is the right one, although my understanding
is still very limited, and I didn't have much time to think about it.

One idea about the DB creation/handling stuff: The sqlShell code is
pretty much a mess, but there might be some parts in there that could
be useful for rabbit. Stuff like low level JDBC interaction... Maybe
pulling it out of sqlShell and adding it to the rabbit API could
increase the usefulness of that code.

2006/10/3, tobias.schaefer@... <tobias.schaefer@...>:
>
>  the above call, as executed in the example, creates the prototype directory
> Item and a corresponding table T_ITEM in the hsqldb. (db.properties are
> generated as well.)
>

There seems to be a problem with the hsqldb: database content seems to
gone after restarts. When i look at the hsql.db directory, the data
seems to be there, but the URL /1/ renders an Object not found page.
Maybe it has to do with the database not being closed or opened
properly.

hannes
_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user



_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user
LightInTheBox - Buy quality products at wholesale price