1 Reply Latest reply on Sep 10, 2014 10:31 AM by rhauch

    Accessing modeshape deployed in JBoss from a standalone Application

    deepak_a

      Hi,

       

      I am using Modeshape 3.8.0.Final, Infinispan 5.2.7.Final running in JBoss.

       

      I have deployed my artifacts to modeshape in JBoss using modeshape-jcr.rest API.

       

      I can see my artifacts under

       

       

      http://localhost:8080/modeshape-webdav/artifacts/default/current/

       

      A JNDI for modeshape has been set up in standalone.xml

      jndi-name is: "java:jboss/datasources/ModeshapeDS", Oracle is used for Persistence.

       

       

      I am now trying to access the JCR from a standalone Java APP. I sit possible to access the JCR from the modeshape's JNDI?

      Can some one point me to an example?

      I plan to do basic operations like adding a new node, deleting existing node from the standalone APP

       

      regards,
      Deepak.

        • 1. Re: Accessing modeshape deployed in JBoss from a standalone Application
          rhauch

          A JNDI for modeshape has been set up in standalone.xml

          jndi-name is: "java:jboss/datasources/ModeshapeDS", Oracle is used for Persistence.

          Just remember that our convention is that

          • the "java:jboss/datasources/ModeshapeDS" data source is there so that JDBC clients can use JCR-SQL2 to query a specific repository via ModeShape's JDBC driver and a driver URL something like "jdbc:jcr:jndi:jcr?repositoryName=artifacts". See https://docs.jboss.org/author/display/MODE/Using+Repositories+with+JDBC+in+EAP.
          • other data sources (e.g., "java:jboss/datasources/ModeshapeJDBCStoreDS" or your own naming convention) point to a DB (e.g., Oracle, PostgreSQL, etc.) so that a repository's Infinispan JDBC cache store (and/or binary stores) can store the repository content (or binary values) in the relational database. Each Infinispan JDBC cache store and binary store will each need their own data source.

           

          I am now trying to access the JCR from a standalone Java APP. I sit possible to access the JCR from the modeshape's JNDI?

          Can some one point me to an example?

          I plan to do basic operations like adding a new node, deleting existing node from the standalone APP

           

          Yes, each repository by default is registered in JNDI, so your application can look it up directly and just use it (or use resource injection). Since you're running in JBoss, have a look at our quickstart examples: https://github.com/ModeShape/quickstart

           

          We have other examples at https://github.com/ModeShape/modeshape-examples for non-JBoss usage, including embedding ModeShape in Java SE apps or when deploying to non-JBoss app servers like Tomcat.