Monday, July 6, 2009

Firebird /Java Plugin Milestone One

Posted by Adriano in Firebird Development:

"I'm pleased to announce availability [1] of the first test version of
FB/Java plugin.

FB/Java is a plugin for FB external engines feature, to be presented in
v3.0, that allows execution of Java code at the server side. The plugin
allows classes/resources in the file system or stored in the database.
File system classes/resources are global and the code run with all
permissions. Database classes/resources are per-database and code runs
accordingly with per-engine configured security policy.

The plugin has been made with the assumption that anything could be done
using existing FB infrastructure. You don't need to setup FTP server or
shared directory in the server to update your code or edit security police.

Installation/update of database JARs works from client command line
utility or from SQLJ package procedures. Actually, the same Java class
that run in the client is the one that runs in the server. You can put
JARs in the database using a Java URL, so lookup of them is not
restricted to client or server.

Security handling is configured in a central database, with a single
PERMISSION table. Permissions are granted to users that executes the
Java code. This way to configure permissions is not adequate for every
(or most) cases, and roles are not supported at the moment. I suppose
and desire we can have a better design in the future, before a final

It's welcome any attempt to bypass the security system. But please,
report it. :-)

This version also lacks some notification mechanism for when the code
are going to be unloaded. You may note the problem in the example, right
after disconnect all attachments from the database the log file remains
locked, as it wasn't been garbaged collected. And no kind of "hot
redeployment" support had been implemented or tested. However, I have
ideas of how these problems can be solved in very good ways, based on
existing models. For unloading (or any other type of notification),
JPA-like listeners. For maintain state after redeployments, serializable

In the file plugins\java-engine\examples\fbjava\README, you found
instructions for a "quick start" with it. In
plugins\java-engine\examples\tests there are functional tests for many
of its feature (i.e., how type mappings works, etc).

The plugin is based on Jaybird 2.2 (HEAD). I've put it in a maven
repository at [2], with its version defined as 2.2-jrt-SNAPSHOT.

The server includes my v3.0 changes, supporting packages, DDL triggers,
over clause and some internal changes. It may have others instabilities.

If you have a JAVA_HOME environment variable defined, it should just
works without any other configuration. The quick start assumes you had
defined FIREBIRD, ISC_USER and ISC_PASSWORD. In [1], I've zipped plugin
and engine together, but plugin installation consists in just unpacking
it in FB directory.

Documentation has room for improvements, and is at [3]. I've done it
with FB docbook tools.

Source code is in [4].

Happy testing and thanks.

(included in [1])

1 comment:

martha said...

I recently came accross your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.