You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ja...@apache.org on 2008/12/09 20:34:55 UTC

svn commit: r724845 - /incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/content/ContentManager.java

Author: jalkanen
Date: Tue Dec  9 11:34:55 2008
New Revision: 724845

URL: http://svn.apache.org/viewvc?rev=724845&view=rev
Log:
Added support for Jackrabbit.

Modified:
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/content/ContentManager.java

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/content/ContentManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/content/ContentManager.java?rev=724845&r1=724844&r2=724845&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/content/ContentManager.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/content/ContentManager.java Tue Dec  9 11:34:55 2008
@@ -47,7 +47,20 @@
 import com.ecyrd.jspwiki.util.WikiBackgroundThread;
 
 /**
- *  Provides access to the content repository.
+ *  Provides access to the content repository.  Unlike previously, in JSPWiki
+ *  3.0 all content is managed by this single repository, and we use the MIME
+ *  type of the content to determine what kind of content it actually is.
+ *  <p>
+ *  The underlying content is stored in a JCR Repository object.  JSPWiki
+ *  will first try to locate a Repository object using JNDI, under the
+ *  "java:comp/env/jcr/repository" name.  If this fails, it will try to see
+ *  if there is a property called "jspwiki.repository" defined in jspwiki.properties.
+ *  Current allowed values are "priha" for the <a href="http://www.priha.org/">Priha content repository</a>,
+ *  and "jackrabbit" for <a href="http://jackrabbit.apache.org">Apache Jackrabbit</a>.
+ *  <p>
+ *  If there is no property defined, defaults to "priha".
+ *  
+ *  @since 3.0
  */
 public class ContentManager
 {
@@ -129,8 +142,6 @@
     public ContentManager( WikiEngine engine )
         throws WikiException
     {
-        String classname;
-
         m_engine = engine;
 
         m_expiryTime = TextUtil.parseIntParameter( engine.getWikiProperties().getProperty( PROP_LOCKEXPIRY ), 60 );
@@ -169,6 +180,27 @@
                     throw new WikiException( "Unable to initialize Priha as the main repository",e1);
                 }
             }
+            else if( "jackrabbit".equals(repositoryName) )
+            {
+                try
+                {
+                    Class<Repository> jackrabbitRepo = (Class<Repository>) Class.forName( "org.apache.jackrabbit.TransientRepository" );
+                    m_repository = jackrabbitRepo.newInstance();
+                }
+                catch( ClassNotFoundException e1 )
+                {
+                    throw new WikiException("Jackrabbit libraries not found in the classpath",e1);
+                }
+                catch( InstantiationException e1 )
+                {
+                    throw new WikiException("Jackrabbit could not be initialized",e1);
+                }
+                catch( IllegalAccessException e1 )
+                {
+                    throw new WikiException("You do not have permission to access Jackrabbit",e1);
+                }
+                
+            }
             else
             {
                 throw new WikiException("Unable to initialize repository for repositorytype "+repositoryName);