Article Discussion
Catch Jackrabbit and the Java Content Repository API
Summary: Relational and object databases lack many data management features required by modern applications, such as versioning, rich data references, inheritence, or fine-grained security. Content repositories extend databases with such additional capabilities. The Java Content Repository API (JSR 170) defines a standard to access content repositories from Java code, and promises to greatly simplify Java database programming. This article reviews the Java Content Repository API and its open-source implementation, Apache Jackrabbit, from a developer's perspective.
5 posts.
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: February 25, 2008 1:46 AM by Yamini
    Admin
     
    Posts: 15 / Nickname: admin / Registered: January 17, 2002 3:57 PM
    Catch Jackrabbit and the Java Content Repository API
    June 5, 2005 8:00 PM      
    The Java Content Repository API (JCR) promises to greatly simplify Java database programming. Content repositories extend databases with versioning, rich references, workspaces, extensible information models, and other features. This article reviews the JCR API and its open-source implementation, Apache Jackrabbit, from a developer's perspective.

    http://www.artima.com/lejava/articles/contentrepository.html

    Content repositories promise to greatly simplify database programming. Do you think databases will evolve into content respositories with time? What do you think of the JCR API?
    • Ben
       
      Posts: 1 / Nickname: benm / Registered: June 11, 2005 6:06 AM
      Re: Catch Jackrabbit and the Java Content Repository API
      June 11, 2005 10:28 AM      
      Thanks for the interesting article. I'd heard about JSR-170 and Jackrabbit but hadn't had time to check it out. Looks like it could be very powerful. I've particularly thought that there is a great need for versioned data in more cases than not.

      I also appreciate your keeping the article short, however, there are a couple things it seems you left out. In the introduction you say "the devil is in the details", but you never explain that statement. Is that just general pragmatism/cynicism or did you find any gotchas?

      You also use the Jackrabbit API, but don't explain where our data is going. Does Jackrabbit just write to the file system by default? Is this configured in the "repository.xml" file you mentioned. Well, I suppose I can find the answers to these questions myself on the Jackrabbit site, but it would have been good to at least mention how that works.

      For that matter, you mention that you can use Hibernate or JDBC with Jackrabbit, but then say that JSR-170 is almost the exact opposite of ORMs... but if your repository content is being put into a RDB, wouldn't you still need some sort of relational mapping?

      Thanks again.
    • nafise
       
      Posts: 1 / Nickname: nafise / Registered: July 14, 2005 0:08 AM
      Re: Catch Jackrabbit and the Java Content Repository API
      July 14, 2005 5:02 AM      
      Hi
      by refrence to the below paragraph of your article :

      "The Jackrabbit code base contains not only the JCR API reference implementation, but also a fully functional repository as well as several contributed libraries for tasks, such as accessing a remote repository via RMI. There is even a JDBC persistence manager to allow plugging in a relational database as a persistent store, and an object-relational mapping tool that allows Hibernate applications to use the repository.
      "
      but as I knew jackrabbit does not support JDBC persistence manager till now !!!!!!!!!!!! it only support filesystem
      • Dalia
         
        Posts: 1 / Nickname: cricri / Registered: December 20, 2005 1:39 AM
        Having problem running the blogging application, please HELP!
        January 4, 2006 4:38 AM      
        Hello,

        I have problems running the example in your article: I cannot add a new blog entry. And, I cannot understand the generated messages...

        Whenever I do: java -jar rabbitblog.jar -add "Jack Rabbit" "Carrotology " "This is a blog entry about carrots.", as described in the readme file, I get the following errors:

        Exception in thread "main" java.lang.RuntimeException: A RepositoryException occ
        ured
        at com.artima.examples.jackrabbit.RepoTest.addBlogEntry(Unknown Source)
        at com.artima.examples.jackrabbit.RepoTest.main(Unknown Source)
        Caused by: org.apache.jackrabbit.core.config.ConfigurationException: Failed to c
        reate configuration directory for workspace default.
        at org.apache.jackrabbit.core.config.RepositoryConfig.createWorkspaceCon
        fig(Repos itoryConfig.java:300)
        at org.apache.jackrabbit.core.config.RepositoryConfig.init(RepositoryCon
        fig.java: 219)
        at org.apache.jackrabbit.core.config.RepositoryConfig.create(RepositoryC
        onfig.jav a:98)
        at org.apache.jackrabbit.core.config.RepositoryConfig.create(RepositoryC
        onfig.jav a:72)
        at org.apache.jackrabbit.core.jndi.BindableRepository.init(BindableRepos
        itory.jav a:114)
        at org.apache.jackrabbit.core.jndi.BindableRepository.create(BindableRep
        ository.j ava:104)
        at org.apache.jackrabbit.core.jndi.RegistryHelper.registerRepository(Reg
        istryHelp er.java:57)
        at com.artima.examples.jackrabbit.RepoTest.bindRepository(Unknown Source
        )
        at com.artima.examples.jackrabbit.RepoTest.getRepository(Unknown Source)

        ... 2 more

        It is urgent. Thank you sincerely in advance.
        CC
    • Stefano
       
      Posts: 1 / Nickname: campa / Registered: January 19, 2006 7:04 AM
      Re: Catch Jackrabbit and the Java Content Repository API
      January 19, 2006 0:13 PM      
      Hi guys,

      I'm studing the JSR 170, to evluate it for a project.
      Also, I have read the Frank Sommers interesting article about the JackRabbit implementation.

      I don't know very well XMLdatabases, such as exists or others. I'd like to know if JCR have some advantages vs. XMLdatabases, in other words why choose JCR in place of exists for example?

      I see that JCR support versioning, Access Control and different backend ways, but there are more radical differences between they ?

      Bye
      Stefano
    • Yamini
       
      Posts: 1 / Nickname: yamini1 / Registered: February 24, 2008 6:40 PM
      Re: Catch Jackrabbit and the Java Content Repository API
      February 25, 2008 1:46 AM      
      Hi,
      My objective is to standardize the access (read/write or both) to data content in data sources like a database (MySQL) and any other content repository that is not JSR 170 compliant like Open CMS, live link or share point. By standardizing access I mean that the client program will no longer call the respository specific API like LAPI or JDBC but rather call JCR API methods to achieve common functions like, login, logout, read and write.

      I want to clear my concepts by writing a kind of sample connector for MY SQL database which can be accessed by JCR API rather than JDBC. I understand that in order to do I need to write a wrapper around JDBC API which will perform the desired operations using JDBC (as My SQL understand JDBC) but for a developer the entry point will be JCR API.

      I have confusion while writing this wrapper. I have taken an example of exportsystemview() of JCR API.

      The client code to access this method in CRX using JCR API is

      /*
      public class ExportXMLFromCRX {
      public static void main(String[] args) {
      String propertyName = "";
      Repository repository = null;
      Session repSession = null;
      FileInputStream fileInputStream = null;
      FileOutputStream fileOutputStream = null;
      try
      {
      ClientRepositoryFactory factory = new ClientRepositoryFactory();
      // This is mandatory for rmi access to the CRX
      System.setProperty("java.rmi.server.useCodebaseOnly", "true");
      repository = factory.getRepository("//localhost:1234/crx");
      if(repository != null)
      {
      userCredentials = new SimpleCredentials(userID,password);
      repSession = repository.login(new SimpleCredentials(“admin”, “admin”.toCharArray(), “crx.default”);
      if(repSession != null)
      {
      File outputFile = new File("C:/test1.xml");
      FileOutputStream out = new FileOutputStream(outputFile);
      repSession.exportSystemView("/MyRootNode", out, false, false);
      }//end if(repSession != null)
      }// end if(repository != null)
      } //end try
      catch (Exception Exc)
      {
      System.out.println(Exc.getMessage());
      }//end catch
      finally
      {
      repSession.save(); //save to update nodes created in the CRX Session
      repSession.logout(); //duly log-out of the CRX session
      }//end try
      }// end finally
      }
      }
      */

      What I want is to have a different implementation of the same method which will fetch data from database in an XML format & returns the XML the way the above method does

      How should I write a wrapper class for my custom method which fetches record from DB and build an XML but exposed as JCR method? If I am able to do so then the above client code can be used as it is for my MYSQL wrapper code as well. The difference will be that it will no longer fetch data from CRX and build XML but will build an XML based on my database records.

      Please suggest what are the steps I need to perform to achieve this?