jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1566604 - in /jackrabbit/trunk/jackrabbit-webapp: pom.xml src/main/java/org/apache/jackrabbit/j2ee/Installer.java src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java src/main/webapp/bootstrap/missing.jsp
Date Mon, 10 Feb 2014 13:00:57 GMT
Author: jukka
Date: Mon Feb 10 13:00:57 2014
New Revision: 1566604

URL: http://svn.apache.org/r1566604
Log:
JCR-3598: Oak in Jackrabbit deployment packages

Upgrade to Oak 0.15.
Make it possible to use Oak repositories in webapp/standalone.

Modified:
    jackrabbit/trunk/jackrabbit-webapp/pom.xml
    jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/Installer.java
    jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java
    jackrabbit/trunk/jackrabbit-webapp/src/main/webapp/bootstrap/missing.jsp

Modified: jackrabbit/trunk/jackrabbit-webapp/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webapp/pom.xml?rev=1566604&r1=1566603&r2=1566604&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webapp/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-webapp/pom.xml Mon Feb 10 13:00:57 2014
@@ -35,7 +35,7 @@
   <description>Web application that hosts and serves a Jackrabbit content repository</description>
 
   <properties>
-    <oak.version>0.8</oak.version>
+    <oak.version>0.15</oak.version>
     <tomcat.version>7.0.40</tomcat.version>
   </properties>
 

Modified: jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/Installer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/Installer.java?rev=1566604&r1=1566603&r2=1566604&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/Installer.java
(original)
+++ jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/Installer.java
Mon Feb 10 13:00:57 2014
@@ -125,16 +125,26 @@ public class Installer {
     public int installRepository(HttpServletRequest req)
             throws ServletException, IOException {
         String repHome = req.getParameter("repository_home");
+        String repType = req.getParameter("repository_type");
         String repXml = req.getParameter("repository_xml");
         String mode = req.getParameter("mode");
+
         if (repHome == null || mode == null) {
             return C_INVALID_INPUT;
         }
-        if (repXml == null || repXml.length() == 0) {
-            repXml = repHome + "/repository.xml";
-        }
         File home = new File(repHome);
-        File config = new File(repXml);
+
+        File config;
+        if ("oak".equals(repType)) {
+            config = null;
+            repXml = null;
+        } else if (repXml == null || repXml.length() == 0) {
+            config = new File(home, "repository.xml");
+            repXml = config.getPath();
+        } else {
+            config = new File(repXml);
+        }
+
         if ("new".equals(mode)) {
             // Test internal folder repository existence and not home because home is already
created
             // by org.apache.jackrabbit.server.remoting.davex.JcrRemotingServlet
@@ -142,25 +152,28 @@ public class Installer {
                 log.error("Trying to install new repository home '{}' but it already contain
a repository", repHome);
                 return C_HOME_EXISTS;
             }
-            if (config.exists()) {
+            if (config != null && config.exists()) {
                 log.error("Trying to install new repository config '{}' but already exists",
repXml);
                 return C_CONFIG_EXISTS;
             }
             log.info("Creating new repository home '{}'", repHome);
             home.mkdirs();
-            // install repository xml
-            try {
-                installRepositoryConfig(config);
-            } catch (IOException e) {
-                log.error("Error while installing new repository config '{}': {}", repXml,
e.toString());
-                return C_BOOTSTRAP_EXISTS;
+
+            if (config != null) {
+                // install repository xml for Jackrabbit Classic
+                try {
+                    installRepositoryConfig(config);
+                } catch (IOException e) {
+                    log.error("Error while installing new repository config '{}': {}", repXml,
e.toString());
+                    return C_BOOTSTRAP_EXISTS;
+                }
             }
         } else {
             if (!home.exists()) {
-                log.error("Trying to use exisintg repository home '{}' but does not exists",
repHome);
+                log.error("Trying to use existing repository home '{}' but does not exists",
repHome);
                 return C_HOME_MISSING;
             }
-            if (!config.exists()) {
+            if (config != null && !config.exists()) {
                 log.error("Trying to use existing repository config '{}' but does not exists",
repXml);
                 return C_CONFIG_MISSING;
             }
@@ -210,7 +223,9 @@ public class Installer {
         Properties props = new Properties();
         props.load(in);
         props.setProperty("repository.home", repHome);
-        props.setProperty("repository.config", repXml);
+        if (repXml != null) {
+            props.setProperty("repository.config", repXml);
+        }
         in.close();
         if (!dest.getParentFile().exists()) {
             dest.getParentFile().mkdirs();

Modified: jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java?rev=1566604&r1=1566603&r2=1566604&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java
Mon Feb 10 13:00:57 2014
@@ -20,6 +20,10 @@ import org.apache.jackrabbit.api.Jackrab
 import org.apache.jackrabbit.commons.repository.RepositoryFactory;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.apache.jackrabbit.oak.jcr.Jcr;
+import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
+import org.apache.jackrabbit.oak.plugins.segment.SegmentStore;
+import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
 import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
 import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
 import org.apache.jackrabbit.servlet.AbstractRepositoryServlet;
@@ -168,6 +172,11 @@ public class RepositoryStartupServlet ex
     static String bootstrapOverride = null;
 
     /**
+     * the TarMK segment store
+     */
+    private SegmentStore store;
+
+    /**
      * the registered repository
      */
     private Repository repository;
@@ -370,8 +379,7 @@ public class RepositoryStartupServlet ex
         config.init(bootstrapProps);
         config.validate();
         if (!config.isValid()
-                || config.getRepositoryHome() == null
-                || config.getRepositoryConfig() == null) {
+                || config.getRepositoryHome() == null) {
             if (bstrp == null) {
                 log.error("Repository startup configuration is not valid.");
             } else {
@@ -402,25 +410,35 @@ public class RepositoryStartupServlet ex
                     "Repository configuration failure: " + config.getRepositoryHome(), e);
         }
         String repConfig = config.getRepositoryConfig();
-        InputStream in = getServletContext().getResourceAsStream(repConfig);
-        if (in == null) {
-            try {
-                in = new FileInputStream(new File(repConfig));
-            } catch (FileNotFoundException e) {
-                // fallback to old config
+        if (repConfig != null) { // Jackrabbit Classic
+            InputStream in = getServletContext().getResourceAsStream(repConfig);
+            if (in == null) {
                 try {
-                    in = new FileInputStream(new File(repHome, repConfig));
-                } catch (FileNotFoundException e1) {
-                    throw new ServletExceptionWithCause(
-                            "Repository configuration not found: " + repConfig, e);
+                    in = new FileInputStream(new File(repConfig));
+                } catch (FileNotFoundException e) {
+                    // fallback to old config
+                    try {
+                        in = new FileInputStream(new File(repHome, repConfig));
+                    } catch (FileNotFoundException e1) {
+                        throw new ServletExceptionWithCause(
+                                "Repository configuration not found: " + repConfig, e);
+                    }
                 }
             }
-        }
 
-        try {
-            repository = createRepository(new InputSource(in), repHome);
-        } catch (RepositoryException e) {
-            throw new ServletExceptionWithCause("Error while creating repository", e);
+            try {
+                repository = createRepository(new InputSource(in), repHome);
+            } catch (RepositoryException e) {
+                throw new ServletExceptionWithCause("Error while creating repository", e);
+            }
+        } else { // Jackrabbit Oak
+            try {
+                String model = System.getProperty("sun.arch.data.model", "32");
+                store = new FileStore(repHome, 256*1024*1024, "64".equals(model));
+                repository = new Jcr(new SegmentNodeStore(store)).createRepository();
+            } catch (IOException e) {
+                throw new ServletExceptionWithCause("Error while creating repository", e);
+            }
         }
     }
 
@@ -431,7 +449,10 @@ public class RepositoryStartupServlet ex
      * <code>nulled</code>.
      */
     private void shutdownRepository() {
-        if (repository instanceof JackrabbitRepository) {
+        if (store != null) {
+            store.close();
+            store = null;
+        } else if (repository instanceof JackrabbitRepository) {
             ((JackrabbitRepository) repository).shutdown();
         }
         repository = null;

Modified: jackrabbit/trunk/jackrabbit-webapp/src/main/webapp/bootstrap/missing.jsp
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webapp/src/main/webapp/bootstrap/missing.jsp?rev=1566604&r1=1566603&r2=1566604&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webapp/src/main/webapp/bootstrap/missing.jsp (original)
+++ jackrabbit/trunk/jackrabbit-webapp/src/main/webapp/bootstrap/missing.jsp Mon Feb 10 13:00:57
2014
@@ -40,6 +40,15 @@ request.setAttribute("title", "Content R
       <input size="40" type="text" name="repository_home" value="jackrabbit">
     </label>
   </p>
+  <p>
+    Repository type:
+    <label>
+      <input type="radio" name="repository_type" value="classic" checked> Classic
+    </label>
+    <label>
+      <input type="radio" name="repository_type" value="oak"> Oak
+    </label>
+  </p>
   <p><input type="submit" value="Create Content Repository"></p>
 </form>
 



Mime
View raw message