Embedding Gallery into Java Application

reuvenlevitt
reuvenlevitt's picture

Joined: 2005-05-26
Posts: 22
Posted: Wed, 2005-06-22 14:28

I was wondering if anyone has tried to embed gallery2 into a java application, and what their findings where?

Any info would be greatly appreciated.

Thanks,
Reuven.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-06-22 15:16

AFAIK there was no such attempt. But it surely sounds interesting because there's no obvious solution :)

G2 is written in PHP, and it's output is HTML and images.
We have an entry point, a embedding API, which is also in PHP.

But if there was an XMLRPC interface to or in parallel to our GalleryEmbed API, you could interact with G2 from an arbitrary application.

The idea would be to let G2 generate the HTML with its own templating engine and embed that HTML in your java (server) application.
Alternatively, you could do the whole templating yourself, but this is far, far more involving and no existing G2 integration works this way.

Perhaps you already know Gallery Remote (GR), a java applet / application which communicates with G2 with the GR Protocol.
There is also an early implementation of a G2 XMLRPC protocol, which implements only a few G2 API calls, but once it is done, it should encompass the whole G2 API.

If you have other ideas...it'd be very interesting to hear them.

 
reuvenlevitt
reuvenlevitt's picture

Joined: 2005-05-26
Posts: 22
Posted: Thu, 2005-06-23 10:38

Hey valiant,

Where would I find the XMLRPC interface code?

XMLRPC or any other for of RPC/Web service is a good option, as clearly Java cannot call PHP directly.

The simplest solution is to wrap the current GalleryEmbed calls with simple URL calls with parameter passing (or XMLRPC) , and then use the current embed code, from java to just forward the requests through a struts forward action to the PHP code. And have the embedUri be embed.do rather than *.php.

This should probably do the trick. As for security you would need to make sure the url/XMLRPC is only callable from the internal IP address.

When using the embed interface every call to the server will be slower, as all the data would have one more hop (java).

Do the embed calls return HTML with the template already applied to it?

Otherwise you would have to manage the layouts yourself on the java side of things, but that is rather simple using either SiteMesh, or Tiles.

I may give it a shot.

Reuven

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-06-23 11:11

the XMLRPC/G2 stuff isn't public, i haven't seen it. one of our devs worked on it as a student thesis or something like that and now in the summer of code (google), another student will make it ready for prime time.

and yes, the GallerEmbed API / interface returns html (templates already applied).
managing layouts on the java side would involve a lot, really. i'd stick to customize the g2 layouts and just take the html and put it into your java templates where you can add headers/footers etc.

because the xmlrpc stuff isn't ready yet, this will have to wait i guess.