[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] Nitro + Og 0.19.0: Og reloaded part2!

George Moschovitis

6/17/2005 12:49:00 PM

Hello everyone,

new versions of Nitro and Og were just released.

Downloads: http://rubyforge.org/proj...
Mailing list: http://rubyforge.org/mailman/listinfo/nit...
Homepage: http://nitro.rub...

Og reloaded part 2: Another superb release introducing a balanced
mix of innovative new features, common but useful stuff and bug
fixes.

Some notable changes:

* Og polymorphic relations. A groundbreaking feature made possible by
Og's unique design and Ruby's power. Let's use an example to explain
the concept:

class Comment
...
belongs_to Object # polymorphic marker
end

class User
...
has_many Comment
end

class Article
...
has_many Comment
end

u = User.new
u.comments << User::Comment('Hello')

a = Article.new
a.comments << Article::Comment('Wow!')

User::Comment and Article::Comment where automatically created by Og
and are serialized in different tables (also automatically created by
Og). This is the next step in DRY!

* Og now supports inheritance using the well known Single
Table Inheritance pattern. Thanks to Og's advanced design the pattern
is fully encapsulated:

class Document
...
schema_inheritance
end

class Article < Document
..
end

class Photo < Document
..
end

Document.all # => includes Articles and Photos
Article.all # => only Articles

User.documents # => Articles and Photos
User.documents(:type => Photo) # => only photos.

Btw, this feature is orthogonal to the polymorphic relations feature
just described, giving the developer great flexibility.

* Added SUPERB support for auto reloading, the new system can detect
source changes everywhere! Based on original code by Michael Neumann.

* Introduced the concept of Flash, a temporal store where objects that
should be kept alive for the next request are saved.

* Recoded the Blog example to use the Elements system for shading
instead of XSLT. The new code runs easier under Windows (so the
no_xsl_blog example is now removed). Here comes an example:

<Page>
<Box>
Please login as an author by entering the blog password.
<br />
The password is: <b>#{Blog.password}</b>.
</Box>

<Error>#@error</Error>
...
</Page>

The <Page> tag is supported by the Page Ruby class to do the
programmatic rendering of templates or logic code:

class Page
def render
...
end
end

This system can be used to create a library of useful components to
abstract common tasks.

* The updated Blog example demonstrates how easy it is to
write webservices using Nitro and the experimental Service feature. The
code is so short, so lets paste it here:

module BloggerApi
SBlog = Struct.new(:url, :blogid, :blogName)

def blogger__getUsersBlogs(appkey, username, password)
Blog.all.collect { |b| SBlog.new('http://www.gmos..., b.oid,
b.title) }
end
end

module MetaWeblogApi
def metaWeblog__newPost(blogid, username, password, content, publish)
entry = BlogEntry.new(content['title'], content['description'])
entry.blog = Blog[blogid]
entry.save
entry.oid
end
end

module MovableTypeApi
SCategory = Struct.new(:categoryId, :categoryName)

def mt__getCategoryList(blogid, username, password)
blog = Blog[blogid]
blog.categories.collect { |c| SCategory.new(c.oid, c.title) }
end

def mt__setPostCategories(postid, username, password, categories)
cid = categories.first['categoryId']
BlogEntry.update(postid, "category_oid=#{cid}")
true
end
end

class ApiController < Nitro::XmlRpcService
include BloggerApi
include MovableTypeApi
include MetaWeblogApi
end

That's all!

* Integrated an SQLite3 patch by Ghislain Mary.

* Integrated PostgreSQL binary data patch by Michael Neumann.

* Fixed all reported bugs.


Nitro is an efficient, yet simple engine for developing professional
Web Applications using the Ruby language. Nitro aims to provide a
robust infrastructure for scalable web applications that can be
distributed over a server cluster. However, Nitro can also power simple
web applications for deployment on intranets or even personal
computers. Nitro integrates the powerful Og Object-Relational mapping
library.

Nitro is a multiparadigm application framework and will integrate ideas
from Rails, Wee, PHP, JSP and .NET

Nitro integrates the Og (ObjectGraph) object-relational mapping
library. Og provides transparent serialization of object graphs to an
RDBMS backend. Unlike other similar libraries Og maps standard Ruby
objects to SQL tables and not vice versa. Og provides a meta language
to describe the relations between objects, a flexible and intuitive API
for querying the database, raw access to the SQL language if needed
(for example to fine tune the automatically generated SQL tables, or
for custom queries), suports deserialization to Ruby objects or tuples,
automatically generates join tables for many_to_many relations and
provides a collection of usefull Mixins to synthesize common Entities.

Og is a combination of the best features of Active Record and the
former O-R mapping library included in Nitro (NDB). Adapters for
PostgreSQL, MySQL, SQLite and Oracle are included along with an
experimental In-Memory/Filesystem adapter.

I hope this software will be useful for you, and I would love to
receive your suggestions, ideas and bug reports.

have fun,
George Moschovitis

4 Answers

Ara.T.Howard

6/17/2005 2:34:00 PM

0

George Moschovitis

6/17/2005 2:58:00 PM

0

> > experimental In-Memory/Filesystem adapter.
> have you played with using sqlite's in memory tables to leverage it's features
> for this?

Hello,

this is a pure ruby Og store implementation. A KirbyBase store will be
available soon as well (when I find time to finish it, or if someone
sends me a patch ;-))

I don't know anything about SQLite3's memory tables is this a different
table type like the Hash tables or InnoDB tables in Mysql? (btw 0.19.0
adds support for mysql table types).

regards,
George.

Ara.T.Howard

6/17/2005 3:45:00 PM

0

George Moschovitis

6/18/2005 6:38:00 AM

0

Hmm, this is an interesting idea, and really trivial to add, so you
will see it in the next release.

regards,
George.