jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r721186 - in /jackrabbit/trunk/jackrabbit-standalone: pom.xml src/main/java/org/apache/jackrabbit/standalone/Main.java src/main/resources/ src/main/resources/WEB-INF/ src/main/resources/WEB-INF/web.xml
Date Thu, 27 Nov 2008 14:31:43 GMT
Author: jukka
Date: Thu Nov 27 06:31:43 2008
New Revision: 721186

URL: http://svn.apache.org/viewvc?rev=721186&view=rev
Log:
JCR-1357: Create "quick start" developer bundles for model 1,2,3 deployment

Automatically start a Jackrabbit repository based on the command line options.

Better handling of server log files.

Plus minor cleanups.

Added:
    jackrabbit/trunk/jackrabbit-standalone/src/main/resources/
    jackrabbit/trunk/jackrabbit-standalone/src/main/resources/WEB-INF/
    jackrabbit/trunk/jackrabbit-standalone/src/main/resources/WEB-INF/web.xml   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-standalone/pom.xml
    jackrabbit/trunk/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java

Modified: jackrabbit/trunk/jackrabbit-standalone/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone/pom.xml?rev=721186&r1=721185&r2=721186&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-standalone/pom.xml Thu Nov 27 06:31:43 2008
@@ -62,6 +62,7 @@
               <excludes>
                 LICENSE*, NOTICE*, META-INF/LICENSE*, META-INF/NOTICE*,
                 license, license/**/*, test, test/**/*,
+                WEB-INF/web.xml, WEB-INF/log4j.*,
                 WEB-INF/lib, WEB-INF/lib/**/*,
                 WEB-INF/classes, WEB-INF/classes/**/*
               </excludes>

Modified: jackrabbit/trunk/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java?rev=721186&r1=721185&r2=721186&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java
(original)
+++ jackrabbit/trunk/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java
Thu Nov 27 06:31:43 2008
@@ -27,7 +27,9 @@
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.io.IOUtils;
-import org.apache.log4j.DailyRollingFileAppender;
+import org.apache.jackrabbit.servlet.jackrabbit.JackrabbitRepositoryServlet;
+import org.apache.log4j.FileAppender;
+import org.apache.log4j.Layout;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PatternLayout;
@@ -36,6 +38,7 @@
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.bio.SocketConnector;
 import org.mortbay.jetty.handler.RequestLogHandler;
+import org.mortbay.jetty.servlet.ServletHolder;
 import org.mortbay.jetty.webapp.WebAppContext;
 
 /**
@@ -54,8 +57,6 @@
 
     private final CommandLine command;
 
-    private final Logger serverLog = Logger.getRootLogger();
-
     private final RequestLogHandler accessLog = new RequestLogHandler();
 
     private final WebAppContext webapp = new WebAppContext();
@@ -115,19 +116,14 @@
 
             message("Writing log messages to " + log);
             prepareServerLog(log);
-            prepareAccessLog(log);
-
-            message("Preparing the server...");
-            server.setStopAtShutdown(true);
 
-            prepareWebapp(file, tmp);
+            message("Starting the server...");
+            prepareWebapp(file, repository, tmp);
             accessLog.setHandler(webapp);
+            prepareAccessLog(log);
             server.setHandler(accessLog);
-
             prepareConnector();
             server.addConnector(connector);
-
-            message("Starting the server...");
             prepareShutdown();
             server.start();
 
@@ -142,30 +138,53 @@
 
     private void prepareServerLog(File log)
             throws IOException {
-        serverLog.addAppender(new DailyRollingFileAppender(
-                new PatternLayout("%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m%n"),
-                new File(log, "server.log.yyyy-MM-dd").getPath(),
-                "yyyy-mm-dd"));
+        Layout layout =
+            new PatternLayout("%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m%n");
+
+        Logger jackrabbitLog = Logger.getRootLogger();
+        jackrabbitLog.addAppender(new FileAppender(
+                layout, new File(log, "jackrabbit.log").getPath()));
+
+        Logger jettyLog = Logger.getLogger("org.mortbay.log");
+        jettyLog.addAppender(new FileAppender(
+                layout, new File(log, "jetty.log").getPath()));
+        jettyLog.setAdditivity(false);
 
         if (command.hasOption("debug")) {
-            serverLog.setLevel(Level.DEBUG);
+            jackrabbitLog.setLevel(Level.DEBUG);
+            jettyLog.setLevel(Level.DEBUG);
         } else {
-            serverLog.setLevel(Level.WARN);
+            jackrabbitLog.setLevel(Level.INFO);
+            jettyLog.setLevel(Level.INFO);
         }
+
+        System.setProperty(
+                "derby.stream.error.file",
+                new File(log, "derby.log").getPath());
     }
 
     private void prepareAccessLog(File log) {
-        String path = new File(log, "access.log.yyyy-MM-dd").getPath();
-        NCSARequestLog ncsa = new NCSARequestLog(path);
+        NCSARequestLog ncsa = new NCSARequestLog(
+                new File(log, "access.log.yyyy_mm_dd").getPath());
         ncsa.setFilenameDateFormat("yyyy-MM-dd");
         accessLog.setRequestLog(ncsa);
     }
 
-    private void prepareWebapp(File file, File tmp) {
+    private void prepareWebapp(File file, File repository, File tmp) {
         webapp.setContextPath("/");
         webapp.setWar(file.getPath());
         webapp.setExtractWAR(false);
         webapp.setTempDirectory(tmp);
+
+        ServletHolder servlet =
+            new ServletHolder(JackrabbitRepositoryServlet.class);
+        servlet.setInitOrder(1);
+        servlet.setInitParameter("repository.home", repository.getPath());
+        String conf = command.getOptionValue("conf");
+        if (conf != null) {
+            servlet.setInitParameter("repository.config", conf);
+        }
+        webapp.addServlet(servlet, "/repository.properties");
     }
 
     private void prepareConnector() {

Added: jackrabbit/trunk/jackrabbit-standalone/src/main/resources/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone/src/main/resources/WEB-INF/web.xml?rev=721186&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone/src/main/resources/WEB-INF/web.xml (added)
+++ jackrabbit/trunk/jackrabbit-standalone/src/main/resources/WEB-INF/web.xml Thu Nov 27 06:31:43
2008
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
+<web-app>
+    <display-name>Apache Jackrabbit</display-name>
+
+    <!-- ====================================================================== -->
+    <!-- R E P O S I T O R Y   S E R V L E T                                    -->
+    <!-- ====================================================================== -->
+    <servlet>
+        <servlet-name>Repository</servlet-name>
+        <servlet-class>org.apache.jackrabbit.j2ee.RepositoryAccessServlet</servlet-class>
+
+        <init-param>
+          <param-name>repository.context.attribute.name</param-name>
+          <param-value>javax.jcr.Repository</param-value>
+        </init-param>
+
+        <load-on-startup>2</load-on-startup>
+    </servlet>
+
+    <!-- ====================================================================== -->
+    <!-- W E B D A V  S E R V L E T                                              -->
+    <!-- ====================================================================== -->
+    <servlet>
+        <servlet-name>Webdav</servlet-name>
+        <description>
+            The webdav servlet that connects HTTP request to the repository.
+        </description>
+        <servlet-class>org.apache.jackrabbit.j2ee.SimpleWebdavServlet</servlet-class>
+
+        <init-param>
+            <param-name>resource-path-prefix</param-name>
+            <param-value>/repository</param-value>
+            <description>
+                defines the prefix for spooling resources out of the repository.
+            </description>
+        </init-param>
+        <init-param>
+            <param-name>resource-config</param-name>
+            <param-value>/WEB-INF/config.xml</param-value>
+            <description>
+                Defines various dav-resource configuration parameters.
+            </description>
+        </init-param>
+        <load-on-startup>3</load-on-startup>
+    </servlet>
+
+    <!-- ====================================================================== -->
+    <!-- W E B D A V  S E R V E R  S E R V L E T                                  -->
+    <!-- ====================================================================== -->
+    <servlet>
+        <servlet-name>JCRWebdavServer</servlet-name>
+        <description>
+            The webdav servlet that connects HTTP request to the repository.
+        </description>
+        <servlet-class>org.apache.jackrabbit.j2ee.JCRWebdavServerServlet</servlet-class>
+        <init-param>
+            <param-name>resource-path-prefix</param-name>
+            <param-value>/server</param-value>
+            <description>
+                defines the prefix for spooling resources out of the repository.
+            </description>
+        </init-param>
+        <load-on-startup>5</load-on-startup>
+    </servlet>
+
+    <!-- ====================================================================== -->
+    <!-- R M I   B I N D I N G   S E R V L E T S                                -->
+    <!-- ====================================================================== -->
+    <servlet>
+      <servlet-name>RMI</servlet-name>
+      <servlet-class>org.apache.jackrabbit.servlet.remote.RMIRemoteBindingServlet</servlet-class>
+        <init-param>
+            <param-name>url</param-name>
+            <param-value>//localhost/jackrabbit.repository</param-value>
+        </init-param>
+    </servlet>
+
+    <!-- ====================================================================== -->
+    <!-- S E R V L E T   M A P P I N G                                          -->
+    <!-- ====================================================================== -->
+    <servlet-mapping>
+        <servlet-name>Webdav</servlet-name>
+        <url-pattern>/repository/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>JCRWebdavServer</servlet-name>
+        <url-pattern>/server/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>RMI</servlet-name>
+        <url-pattern>/rmi</url-pattern>
+    </servlet-mapping>
+
+    <!-- ====================================================================== -->
+    <!-- W E L C O M E   F I L E S                                              -->
+    <!-- ====================================================================== -->
+    <welcome-file-list>
+      <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+
+    <error-page>
+        <exception-type>org.apache.jackrabbit.j2ee.JcrApiNotFoundException</exception-type>
+        <location>/error/classpath.jsp</location>
+    </error-page>
+    <error-page>
+        <exception-type>javax.jcr.RepositoryException</exception-type>
+        <location>/error/repository.jsp</location>
+    </error-page>
+
+</web-app>

Propchange: jackrabbit/trunk/jackrabbit-standalone/src/main/resources/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message