Friday, August 17, 2012

How to run Airavata with New Sling Registry API

Step 1 (Apply Patch)


Apply one of following patches to Airavata if it is not already added. 

Patch-1: Only adds Sling Registry API and updates dependencies. 
Patch-2: Adds Sling Registry API, updates dependencies and modifies all references.

Note: To run Airavata with new API, Patch 2 should be applied.  

Step 2 (Download Sling Launchpad)


Download Sling launchpad 7.0 from here. Or you can get source from here and build it yourself.

Now you have 3 options.
  1. Use Sling Launchpad with its internal Jackrabbit repository.
           - To do this, you can simply skip Step 3 and 5.
  2. Use a new external Jackrabbit repository.
           - To do this, you need to run a separate Jackrabbit server. Then, a Jackrabbit repository directory will be created. You can use this folder for next step. Make sure to stop the Jackrabbit server.
  3. Use an existing external Jackrabbit repository.
           - If you already have a Jackrabbit repository directory, you can use it for next step. 

Step 3 (Configure External Repository)


Go to external Jackrabbit repository directory. Modify its repository.xml by replacing its Security configuration element by following.

<Security appName="Jackrabbit">
     <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security">
     </SecurityManager>
     <AccessManager class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultAccessManager">
     </AccessManager>
     <LoginModule class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultLoginModule">
          <param name="anonymousId" value="anonymous"/>
          <param name="adminId" value="admin"/>
     </LoginModule>
</Security>


Step 4 (Start Sling Server)


Start Sling Launch pad in port 8081.

java -jar org.apache.sling.launchpad-7-standalone.jar -p 8081

Step 5 (Configure Sling Server)


  1. Go to http://localhost:8081/system/console/configMgr 
    • Give admin:admin as username:password if asked.
  2. Go to row Apache Sling Embedded JCR Repository
  3. Click on org.apache.sling.jcr.jackrabbit.server.SlingServerRepository.########
  4. Configure Configuration File, Repository Home and Repository Name as follows.
    • Configuration File: Jackrabbit Repository.xml path 
      • Eg. /home/.../jackrabbit/repository.xml
    • Repository Home: Jackrabbit home path
      • Eg. /home/.../jackrabbit/
    • Embedded JCR Repository Name: 'jackrabbit'
  5. Restart Launchpad

Step 6 (Start Airavata)


Now you can start Airavata server & XBaya, and continue.

Saturday, July 7, 2012

Problem in Implementing getWorkflow() Method

I have completed some main methods of Airavata Registry API so far. Now I'm facing a problem with getWorkflow(...) and getWorkflows(...) methods.

The signatures of the methods are as follows.
public Node getWorkflow(QName templateID, String userName)
public Map<QName, Node> getWorkflows(String userName)
As these show, above methods return JCR Node objects. Since current implementation uses JCR API, it knows what JCR node is. But in the new API, jackrabbit is accessed through Sling. So, this new API does not know anything about JCR Nodes. So returning JCR Nodes is not possible. That's the problem I'm facing. 

To avoid this problem there are 2 options.

Option 1:

Change method signatures to return something else. I checked some places where these methods are called. What I saw was it only get properties of returned Nodes. So, in my opinion, a Map would be a good option to replace Node. But certainly this will lead to a lot of work in a lot of places. But IMHO, this is exactly what should be done if we think about long term use.

Option 2:

Create a JCR Node an return. Of course this should be a temporary solution. And creating Nodes is not an 100% possible because Node is an interface. Implementing its all methods is not possible. So only required methods can be implemented.    

That's the only problem I'm facing now and I'm waiting for an answer from Airavata's side. 

Plugging an external Jackrabbit repository to Apache Sling Launchpad : Complete

After number of trials I could plug an external Jackrabbit repository to Apache Sling Launchpad. Here are the steps I followed.

Step 1:

Go to external Jackrabbit repository directory. Modify its repository.xml by replacing its configuration element by following.

<Security appName="Jackrabbit">
     <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security">
     </SecurityManager>
     <AccessManager class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultAccessManager">
     </AccessManager>
     <LoginModule class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultLoginModule">
          <param name="anonymousId" value="anonymous"/>
          <param name="adminId" value="admin"/>
     </LoginModule>
</Security>


Step 2: 


Follow steps in this post.

That's all. Everything works smoothly.

Tuesday, June 26, 2012

Plugging an external Jackrabbit repository to Apache Sling Launchpad : Attempt 1

Apache Sling Launchpad has its own Jackrabbit repository embedded in it. But since Airavata has its own Jackrabbit repository, Sling Launchpad's embedded repository should be replaced by that of Airavata. According to a thread in Sling user mailinglist, I configured Launchpad.  


I did this twice with 2 versions of Sling Launchpad.

1) Sling Launchpad 6
2) Sling Launchpad 7


How to configure?

  1. Start Launchpad as mentioned in this tutorial
  2. Now go to http://localhost:8080/system/console/configMgr 
    • Give admin:admin as username:password if asked.
  3. Go to row Apache Sling Embedded JCR Repository
  4. Click on org.apache.sling.jcr.jackrabbit.server.SlingServerRepository.########
  5. Configure Configuration File, Repository Home and Repository Name as follows.
    • Configuration File: Jackrabbit Repository.xml path 
      • Eg. /home/.../jackrabbit/repository.xml
    • Repository Home: Jackrabbit home path
      • Eg. /home/.../jackrabbit/
    • Embedded JCR Repository Name: 'jackrabbit'
  6. Restart Launchpad

Thursday, June 21, 2012

Task 1 completed: June 3rd week

I could solve the issue in task 1 with the help of devs in airavata. The problem was airavata-gfac-schema-utils.jar was not in the project class path. So I manually added the jar and code worked fine then. 

I implemented some general methods like addNode(), getNode(), deleteNode() so I can use them in almost all other methods to be implemented in new registry. I wrote some test cases as well.

I'm still having the issue in task 2. I asked this from Sling user list and they asked me to have a look in error log in Sling/log folder. In had a look and I could see some exceptions saying, "Invalid Namespace Index: #######". I told this to Sling user list and a dev said he has never faced this issue. And he further said the problem occurs in jackrabbit repository and asked me to ask this in Jackrabbit user list.

Before asking from Jackrabbit user list, I dug into jackrabbit user list archive but I couldn't find a relevant topic.  So now I should ask them about this issue.

I created a Google Code Project for my implementations. Here is the link.

That's all for now. :)

Wednesday, June 13, 2012

Midweek Update : 3rd Week of June

Task 1:


According to my last post, I started task 1 and implemented 'getServiceDescription()' method using Sling. I used a java.net.HttpURLConnection connection to communicate with Sling launchpad and org.json.JSONObject to parse the received JSON string. Everything works fine up to that point and I'm able to get Service Description in XML format. 

But when creating ServiceDescription object, I got following exception. I talked about this with my gsoc mentors and had their opinion. And now I'm working on it.

Exception in thread "main" java.lang.ExceptionInInitializerError         at org.apache.airavata.schemas.gfac.ServiceDescriptionDocument$Factory.newInstance (ServiceDescriptionDocument.java:45) at org.apache.airavata.commons.gfac.type.ServiceDescription.<init>(ServiceDescription.java:34) at org.apache.airavata.commons.gfac.type.ServiceDescription.fromXML(ServiceDescription.java:47)

Task 2:


So far I was working with dummy repository data which were stored in embedded jackrabbit repository of Sling launchpad and now I'm trying to plug a separate jackrabbit server so I can work with real data created through xbaya. According to a thread in Sling-user mailing list archive, I configured an external repository but I keep getting http 503 error with the following message, when I try to access the repository.

HTTP ERROR 503Problem accessing /content. Reason: AuthenticationSupport service missing. Cannot authenticate request.
Powered by Jetty://

I asked this from Sling-user mailing list and waiting for an reply. That's all for now. :)

Friday, June 8, 2012

Tasks for 3rd Week of June


Here is my plan for the 3rd week of June. After discussing with mentors, I decided to have 3 tasks for the week as follows.

Task 1:
Implement a Sling based class with selected important methods to have the functionality of AiravataJCRRegistry class, and test implemented functionality with Sling Launchpad with its inbuilt jackrabbit repository. 

Task 2:
Plug a separate jackrabbit repository to Sling Launchpad and test implemented functionality in task 1.

Task 3:
Try to use Sling Launchpad with its inbuilt Jackrabbit repository for user management tasks such as adding and deleting users. Do the same thing with Sling Launchpad with a separate jackrabbit repository.