cancel
Showing results for 
Search instead for 
Did you mean: 

Extending Share with Java (not Javascript)

pjaromin
Champ on-the-rise
Champ on-the-rise
I've been working to extend Alfresco Share to go along with changes I've made to Explorer. I've been working to integrate an existing GWT-based app into share and have been very frustrated trying to find any docs on available services and practices for re-implementing the GWT RPC interfaces.

For explorer this was easy, but all of the documentation I can find on Share points to JavaScript, which I cannot use in this case and whose names under JavaScript don't help much in locating their Java counterpart. While I've managed to hunt down the Java equivalents so far,I've found it incredibly time-consuming, tedious, and frustrating.

Is there any decent guide out there on extending Share through Java code?

Thanks!

-Patrick
4 REPLIES 4

ddraper
World-Class Innovator
World-Class Innovator
In answer to your question, I suspect not.

However, could you clarify what you mean by: "whose names under JavaScript don't help much in locating their Java counterpart" … I'm not sure what you're looking for here or what counterpart to the JavaScript files that you're expecting to find.

Regards,
Dave

pjaromin
Champ on-the-rise
Champ on-the-rise
Thanks for the response.

I'm fairly new to Alfresco, but am now (after 3 books, a course, and a month of hands-on) ratherr comfortable/confident with the basic Java APIs under explorer. However share's still much of a mystery to me and far harder to find good developer info on (besides just basic javascript web scripts).

To your question, in reading doc I was seeing references to Javascript objects like 'companyhome', which I've since worked out is the CompanyHomeNodeLocator service. At the time I was envisioning this was a Java service running under share…but clearly it's not. I think my biggest issue is my lack of understanding how Share actually works remotely with Alfresco and the fact that much of the code appears to be in the springframework surf deps that I haven't yet downloaded and combed through.

So what I'm doing now is using the spring webscript ConnectorService to call built-in and custom web scripts in the backend repo. This appears to work and as far as I can see is at least one way if not the best/recommended way to implement your own surf-application calls back to a remote Alfresco repo.

Does this make sense? Is there a better way or some doc somewhere else that might help?

Thanks!

-Patrick

ddraper
World-Class Innovator
World-Class Innovator
The key thing about Share is that it is virtually entirely stateless. Ultimately all of the data and actions are handled by the Explorer application which Share accesses via a REST API. Whereas the Explorer client was built using JSF, Share is built using a custom Alfresco JavaScript library that extends YUI and is served up by WebScripts rendered by Spring Surf.  WebScripts use either Java or JavaScript as controllers (in an MVC pattern) and for Share they are almost exclusively JavaScript controllers. The JavaScript objects you refer to will be (in server side code) objects made available in the server-side Rhino engine that ultimately may be backed by Java classes but are typically treated as JavaScript objects, or (in client side code) JavaScript objects constructed from JSON responses to REST API calls.

There are plenty options for extending and customizing Share but (unfortunately for you) not via Java… your best path to success would be to gain an understanding of the WebScript framework and try to make your customizations via WebScript extensions or Surf extension modules. It is also possible to extend Surf to provide custom renderers (so theoretically you could create a GWT renderer) but unfortunately you're likely to find considerably less information on doing this (i.e. none) than you are on customizing Share via WebScript/JavaScript.  Whatever approach you take you'll still be calling using the REST API provided by the Alfresco repository as you are at the moment.

It's possible that other community members might have experimented in this area and might be able to provide more information,

Regards,
Dave

pjaromin
Champ on-the-rise
Champ on-the-rise
Thank you so much for taking the time to provide some helpful answers.

Looks like I"ll need to spend some time reading up on and digging into surf, but for now what I've got should do the trick and sounds like a reasonable way to proceed.

Ultimately I do wish to re-write the GWT app using JSON instead of GWT-RPC, which should make it far cleaner of an integration. However that's simply not an option right now.

Thanks again!

-Patrick