On Tue, 2011-02-08 at 19:06 +0000, Sharma, Ashish wrote:
> I am trying to use GMime library in my Java code. Has anybody tried
> this already.
Not that I've heard of.
> If no, can somebody please guide me what are the requirements and
> interfaces that I can use for writing JNI for GMime.
Binding a new library is a somewhat bigger job than just extending
coverage to a new method (say) of one of the libraries we already have
coverage for.
Examples
--------
If you haven't used java-gnome before to do user interface work, then
I'd suggest having a look at
http://java-gnome.sourceforge.net/4.0/doc/examples/START.html
That'll give you a feel for the APIs in the various libraries we provide
coverage for.
Background material
-------------------
Then you might want to have a read of the java-gnome design documents;
see
http://java-gnome.sourceforge.net/4.0/doc/design/START.html
Though somewhat dated, the essence of the architecture paper there is
still quite accurate.
http://java-gnome.sourceforge.net/4.0/doc/design/5a-Architecture.html
I did a series of presentations some years ago about java-gnome; there
are a few illustrations there that might be useful:
http://www.operationaldynamics.com/reference/talks/PastPresentFuture/img69.html
through to
http://www.operationaldynamics.com/reference/talks/PastPresentFuture/img79.html
So that's how java-gnome works. To add org.gnome.mime to the Java
bindings you'll need to find a source of information. In about a year or
so we should be able to take advantage of GObject Introspection, but at
present java-gnome works off the same data as pygtk does, which is the
".defs" data. See src/defs/ in the tree.
And then I'd have a look around at how other small libraries are
covered. Our bindings of librsvg, Enchant, and libunque are probably
good examples. That's:
src/bindings/org/gnome/rsvg/Handle.java
src/bindings/org/freedesktop/enchant/Enchant.java
src/bindings/org/gnome/unique/Applicaiton.java
in the tree.
Adding coverage for a new library
---------------------------------
So at this point you should have a fairly good idea what's involved. If
you can locate some already existing .defs data then it'll be easier. We
can quickly emit public stubs for the library, and then you can set
about exposing those classes and methods which you want to use.
Come and chat with us in #java-gnome or on the java-gnome-hackers
mailing list and we can discuss it further.
I look forward to seeing support for GMime in java-gnome!
AfC
Sydney
|