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.