Fenix Framework Plugins

37 views
Skip to first unread message

Paulo Abrantes

unread,
Jan 27, 2010, 5:58:30 PM1/27/10
to Fénix Framework
Hello everyone,

I just committed some code that will change a few things, so I'm
reporting those changes to the list.

1. Fenix Framework is now building in 2 steps allowing the framework
itself to have a DML file and generate domain entities. This probably
only interests people that are actually developing in the trunk code..

2. Fenix Framework now allows multiple application roots, instead of a
single one. The "Main" root is still defined in the Config how it was
though. But PersistentRoot interface changed, it's no longer a
singleton and now contains 3 static methods:

public static <T extends DomainObject> T getRoot()
public static void addRoot(String key, AbstractDomainObject
domainObject)
public static <T extends DomainObject> T getRoot(String key)

The 1st one returns the object defined as the root class in the
Config. The 2nd method allows you to register a new root in the
application using a key (each key must identify uniquely an root
object). The last method retrieves the Root object with the given key.

3. FenixFramework now offers an interface called FenixFrameworkPlugin,
as the name indicates we can now have plugins for the framework :-)

The interface is pretty simple:

public List<URL> getDomainModel();

public void initialize();

The 1st method has to return the list of DomainModel files that the
plugin contributes (it may be empty, in case plugin contains no domain
model). The 2nd method is called in the initialization of the
FenixFramework, in order to do stuff as create another Root Class
(using the new features of 2.) that will be the root of the plugin.
Config class now contains an array of implementations of
FenixFrameworkPlugin that will be used by the application.

I already have a plugin that integrates lucene(http://
lucene.apache.org/java/docs/) with fenix-framework allowing anyone to
transparently index domain objects and persist it's indexes to the
database (the indexes are itself domain entities). It's not yet
committed but probably tomorrow I'll commit it and I'll let everyone
know from where they can do it's checkout to see a code example of a
ff plugin.


******* IMPORTANT *******: Since the representation of the
PersistentRoot changed the table FF$PERSISTENT_ROOT will also have to
change. I've added the SQL modifications necessary into the
RepositoryBootstrap class so the database upgrade should be
transparent in the application start up. And nobody should have
problems at all. (please notice that I used should...)

Just to make sure, right now, the FF$PERSISTENT_ROOT in your databases
should be

mysql> select * FROM FF$PERSISTENT_ROOT;
+-----+--------------+
| OID | ROOT |
+-----+--------------+
| 1 | 382252089345 |
+-----+--------------+
1 row in set (0.00 sec)


And after starting up the new Fenix Framework

mysql> select * FROM FF$PERSISTENT_ROOT\G
*************************** 1. row ***************************
OID: 1
ROOT: 382252089345
ID_INTERNAL: 1
OID_NEXT: NULL
OID_PREVIOUS: NULL
ROOT_KEY: pt.ist.fenixframework.root
OID_ROOT_OBJECT: 382252089345

1 rows in set (0.00 sec)

Even though the field ROOT is no longer used (it was copied to
OID_ROOT_OBJECT) I didn't drop it just in case
something goes wrong.

Any questions, problems or comments are always welcomed.
Best regards to everyone,

Paulo Abrantes

Stephane Le Dorze

unread,
Jan 28, 2010, 11:31:42 AM1/28/10
to fenix-f...@googlegroups.com
Will lucene index only string like values?
We (at mimesis) use binary encoded formats.
I wonder if your system is customisable on:
- The member to index.
- A method to extract a/some string from the member value.
Keep up the good work!
Stephane


--
You received this message because you are subscribed to the Google Groups "Fénix Framework" group.
To post to this group, send email to fenix-f...@googlegroups.com.
To unsubscribe from this group, send email to fenix-framewo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fenix-framework?hl=en.


Paulo Abrantes

unread,
Jan 28, 2010, 12:33:52 PM1/28/10
to Fénix Framework
Hello Stephane,

First of all if anyone is interested in seeing the source code you can
now do the anonymous
checkout at https://fenix-ashes.ist.utl.pt/open/trunk/lucene-fenixframework-plugin/
:-)

The actual integration code with lucene can be found in
pt.ist.fenixframework.plugins.luceneIndexing package
and it's basically an adaptation of the existing code for the
RAMDirectory that lucene provides.

Now to the questions!

On Jan 28, 4:31 pm, Stephane Le Dorze <stephane.ledo...@gmail.com>
wrote:


> Will lucene index only string like values?
> We (at mimesis) use binary encoded formats.

Currently yes. I'm not a lucene expert, but I think lucene actually
only indexes text.
But I'll look a bit more into it. Even though, I presume that you can
still represent
such formats in text for indexing purposes no? Although this probably
means lots
of work on your side.

> I wonder if your system is customisable on:
> - The member to index.

If by member you mean an object from your domain, hence generated by
the dml compiler, or a slot (or several)
from domain objects, yes it is.

Right now the plugin offers two interfaces
pt.ist.fenixframework.plugins.luceneIndexing.domain.interfaces.Indexable
and
pt.ist.fenixframework.plugins.luceneIndexing.domain.interfaces.Searchable

Both interfaces are expected to be implemented by domain objects.

The 1st one indicates that a given object knows how to generate it's
index. Basically it has to implement a method that
returns an object that is a Map < IndexableField , Value >.
This values can be retrieved from the current object, for example a
slot 'name' in it, or from slots of other objects that relate
with it.

Those objects that contribute to an index that is not theirs, should
implement Searchable, which contains a Set of objects
which use it to create the indexes.

Here's an example just to make things more clear:

Imagine you have an object that represents a conversation thread, each
thread contains N messages and each message
belong to a single conversation thread (1 - * relation then).

If we want to index the threads it has to implement the interface
Indexable.
To create the index we use the title which is a slot from conversation
thread object and we use the text from each comment object
connected to the thread.
This means that the comment object contributes to the index of the
conversation thread. Because of that the message object
should implement the Searchable interface, that way, if the text of
that message is changed, the index of the thread will be
updated.

> - A method to extract a/some string from the member value.

You mean extracting the strings to generate the indexing?
This is currently done by the developer.

Imagine the conversation thread example before, the code to sat that
you wanted to index the title would be something like this:

@Override
public IndexDocument getDocumentToIndex() {
IndexDocument document = new IndexDocument(this);
document.indexField(ConversationThreadIndexableFields.TITLE,
getTitle());
return document;
}

Maybe later we can find a way for the plugin to contribute with
keywords to the DML so we could,
for example, give start having an INDEXABLE keyword in DML making the
code generator generate this methods for us
automatically.

Hope I managed to answer your questions.

Paulo

> Keep up the good work!
> Stephane
>

> On Wed, Jan 27, 2010 at 11:58 PM, Paulo Abrantes <pabran...@pabrantes.net>wrote:
>
> [snip]

Reply all
Reply to author
Forward
0 new messages