cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco repository access from EJB

vbhansaly
Champ in-the-making
Champ in-the-making
Hi,
In one of our projects, we will using Alfresco ECM.
Applications business logic will be in EJB, which will be deployed in a separate EAR.
Please suggest mechanisms (and some sample for reference) using which EJB application could be integrated with Alfresco.
JCR API seems to be the best choice, but I am unable to access the repository from EJB.

Regards,
Varun Bhansaly
11 REPLIES 11

mrogers
Star Contributor
Star Contributor
Several options.

You build your EJBs to access alfresco via one of the remote interfaces.  RMI and Web Service will work but Web Scripts are the recomended way of remotely accessing the repository. 

You may also be able to create Stateless Session Bean Facades that expose Alfresco via EJB but access the Java API locally and this would remove some of the overhead of a remote call.    Again you may be able to find a tool to generate your EJBs to expose the service APIs.     The Service APIs are all built to be exposed over SOAP so will easily work over a more capable protocol such as JRMP.

vbhansaly
Champ in-the-making
Champ in-the-making
Hi,
Thanks for the prompt response.
It would really help if you could provide some samples or examples.

Web services are one of the options, but again I would like to use JCR APIs from my EJB's business logic.

Can you suggest some ways of using JCR APIs from EJB's business logic.
Also, for the time being, my EJB application and Alfresco would be in the same application server JVM.

Regards,
Varun Bhansaly

sisao
Champ in-the-making
Champ in-the-making
Hi,

the alfresco SDK package can immediately show you all the options you'll have to evaluate to best fit your use case.
Web-scripts may be the best way to integrate alfresco with an EJB application within the context of a shared servlet container, but in my personal experience WS sessions can be very efficiently manipulated in order to reduce the overhead of the remote calls.

Regards.

vbhansaly
Champ in-the-making
Champ in-the-making
SDK Custom* cannot be used as we are not customizing Alfresco.
SDK FirstWebServiceClient works fine in Eclipse IDE.
SDK FirstJCRClient which uses AlfrescoEmbedded.
This works fine in Eclipse IDE, the question now arises is how would I access AlfrescoEmbedded in J2EE enviornment.

More specifically, i am looking for something like in my EJB code >>

public void HelloBean implements Hello {
    public String sayHello() {
        try {
            Repository repository = GetAccessToAlfrescoRepository();
            Then do some work, like add document, download document, delete document, check-in/ check-out document etc.
        } catch (Exception e) {
           e.printStackTrace();
        }
    }
}

Moreover, in future, we might deploy our application and Alfresco in separate JVMs.

sisao
Champ in-the-making
Champ in-the-making
You can try out the web-services approach.

vbhansaly
Champ in-the-making
Champ in-the-making
Web services seem to be expensive way.
Is there any lesser expensive mechanism ? Just as the pseudo code I had posted earlier.

sisao
Champ in-the-making
Champ in-the-making
what do you mean with "expansive"?
The pseudo code you've provided implicitly use calls to a middleware…check the wiki for all the APIs that let you retrieve contents from and provide contents to the alfresco repository…they all introduce a minum system overhead imo.
You can go the web-scripts way for a light solution. Or just use the web-service if you decide you can afford the price  Smiley Very Happy
I use web-services to interact with alfresco with high performances.
Furthermore, JCR does not fit best your case tbh….even though you can achieve the result with all the options really.

Regards.

vbhansaly
Champ in-the-making
Champ in-the-making
Hi,
Thanks so much for your replies.
"Expensive" could be defined as -
1. Webservices come with the overhead of remote calls. - I have kept this option open, the only disadvantage with this could be like porting the application to another ECM.
Further, if the ECM is JCR compliant, and if I am using JCR for repository access then, I could easily port the application with minimal changes.

Regards,
Varun

juanjohdez
Champ in-the-making
Champ in-the-making
Hello,

Varun have you resolved the access to Alfresco transactional operations from EJB.

I need to access to the Alfresco API from an EJB, could somebody guide me or put any example code to do this?

Thank you very much!

Greetings,

Juanjo