You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/10/01 20:52:12 UTC

svn commit: r1628808 - in /manifoldcf/trunk: ./ framework/ framework/example-multiprocess-common/ framework/example-singleprocess-common/ framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/

Author: kwright
Date: Wed Oct  1 18:52:12 2014
New Revision: 1628808

URL: http://svn.apache.org/r1628808
Log:
Fix for CONNECTORS-345.

Added:
    manifoldcf/trunk/framework/example-multiprocess-common/jetty.xml   (with props)
    manifoldcf/trunk/framework/example-singleprocess-common/jetty.xml   (with props)
Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/framework/build.xml
    manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
    manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1628808&r1=1628807&r2=1628808&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Wed Oct  1 18:52:12 2014
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 2.0-dev =====================
 
+CONNECTORS-345: Provide a jetty configuration XML file that can
+be used to alter the jetty configuration.
+(Shinichiro Abe, Karl Wright)
+
 CONNECTORS-1050: Upgrade to Jetty 9.
 (Shinichiro Abe)
 

Modified: manifoldcf/trunk/framework/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/build.xml?rev=1628808&r1=1628807&r2=1628808&view=diff
==============================================================================
--- manifoldcf/trunk/framework/build.xml (original)
+++ manifoldcf/trunk/framework/build.xml Wed Oct  1 18:52:12 2014
@@ -1392,6 +1392,7 @@
                 <include name="logging.ini"/>
                 <include name="*.sh"/>
                 <include name="*.bat"/>
+                <include name="*.xml"/>
             </fileset>
             <fileset dir="example-multiprocess-file-common">
                 <include name="*.sh"/>
@@ -1419,6 +1420,7 @@
                 <include name="logging.ini"/>
                 <include name="*.sh"/>
                 <include name="*.bat"/>
+                <include name="*.xml"/>
             </fileset>
             <fileset dir="example-multiprocess-file-common">
                 <include name="*.sh"/>
@@ -1448,6 +1450,7 @@
                 <include name="logging.ini"/>
                 <include name="*.sh"/>
                 <include name="*.bat"/>
+                <include name="*.xml"/>
             </fileset>
             <fileset dir="example-multiprocess-zk-common">
                 <include name="*.sh"/>
@@ -1479,6 +1482,7 @@
                 <include name="logging.ini"/>
                 <include name="*.sh"/>
                 <include name="*.bat"/>
+                <include name="*.xml"/>
             </fileset>
             <fileset dir="example-multiprocess-zk-common">
                 <include name="*.sh"/>
@@ -1526,6 +1530,7 @@
                 <include name="logging.ini"/>
                 <include name="*.sh"/>
                 <include name="*.bat"/>
+                <include name="*.xml"/>
             </fileset>
             <fileset dir="example-singleprocess">
                 <include name="properties.xml"/>
@@ -1558,6 +1563,7 @@
                 <include name="logging.ini"/>
                 <include name="*.sh"/>
                 <include name="*.bat"/>
+                <include name="*.xml"/>
             </fileset>
             <fileset dir="example-singleprocess-proprietary">
                 <include name="properties.xml"/>

Added: manifoldcf/trunk/framework/example-multiprocess-common/jetty.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/example-multiprocess-common/jetty.xml?rev=1628808&view=auto
==============================================================================
--- manifoldcf/trunk/framework/example-multiprocess-common/jetty.xml (added)
+++ manifoldcf/trunk/framework/example-multiprocess-common/jetty.xml Wed Oct  1 18:52:12 2014
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+
+<!--
+ 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.
+-->
+
+<Configure id="server" class="org.eclipse.jetty.server.Server">
+  <Set name="connectors">
+    <Array type="org.eclipse.jetty.server.Connector">
+      <Item>
+        <New class="org.eclipse.jetty.server.ServerConnector">
+          <Arg><Ref refid="server"/></Arg>
+          <Set name="port">8345</Set>
+        </New>
+      </Item>
+    </Array>
+  </Set>
+</Configure>

Propchange: manifoldcf/trunk/framework/example-multiprocess-common/jetty.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: manifoldcf/trunk/framework/example-singleprocess-common/jetty.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/example-singleprocess-common/jetty.xml?rev=1628808&view=auto
==============================================================================
--- manifoldcf/trunk/framework/example-singleprocess-common/jetty.xml (added)
+++ manifoldcf/trunk/framework/example-singleprocess-common/jetty.xml Wed Oct  1 18:52:12 2014
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+
+<!--
+ 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.
+-->
+
+<Configure id="server" class="org.eclipse.jetty.server.Server">
+  <Set name="connectors">
+    <Array type="org.eclipse.jetty.server.Connector">
+      <Item>
+        <New class="org.eclipse.jetty.server.ServerConnector">
+          <Arg><Ref refid="server"/></Arg>
+          <Set name="port">8345</Set>
+        </New>
+      </Item>
+    </Array>
+  </Set>
+</Configure>

Propchange: manifoldcf/trunk/framework/example-singleprocess-common/jetty.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java?rev=1628808&r1=1628807&r2=1628808&view=diff
==============================================================================
--- manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java (original)
+++ manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java Wed Oct  1 18:52:12 2014
@@ -49,7 +49,7 @@ public class ManifoldCFCombinedJettyRunn
   public static final String _rcsid = "@(#)$Id$";
 
   public static final String combinedWarPathProperty = "org.apache.manifoldcf.combinedwarpath";
-  public static final String jettyPortProperty = "org.apache.manifoldcf.jettyport";
+  public static final String jettyConfigFileProperty = "org.apache.manifoldcf.jettyconfigfile";
   
   protected Server server;
   
@@ -157,18 +157,9 @@ public class ManifoldCFCombinedJettyRunn
 
       // Grab the parameters which locate the wars and describe how we work with Jetty
       File combinedWarPath = ManifoldCF.getFileProperty(combinedWarPathProperty);
-      int jettyPort = ManifoldCF.getIntProperty(jettyPortProperty,8347);
-      if (args.length > 0)
-      {
-        try
-        {
-          jettyPort = Integer.parseInt(args[0]);
-        }
-        catch (NumberFormatException e)
-        {
-          throw new ManifoldCFException("Illegal value for jetty port argument: "+e.getMessage(),e);
-        }
-      }
+      File jettyConfigFile = ManifoldCF.getFileProperty(jettyConfigFileProperty);
+      if (jettyConfigFile == null)
+        jettyConfigFile = new File("./jetty.xml");
       if (args.length == 2)
       {
         combinedWarPath = new File(args[1]);
@@ -182,7 +173,7 @@ public class ManifoldCFCombinedJettyRunn
       System.err.println("Starting jetty...");
       
       // Create a jetty instance
-      ManifoldCFCombinedJettyRunner jetty = new ManifoldCFCombinedJettyRunner(jettyPort,combinedWarPath.toString());
+      ManifoldCFCombinedJettyRunner jetty = new ManifoldCFCombinedJettyRunner(jettyConfigFile,combinedWarPath.toString());
       // This will register a shutdown hook as well.
       jetty.start();
 
@@ -202,7 +193,7 @@ public class ManifoldCFCombinedJettyRunn
         }
       }
     }
-    catch (ManifoldCFException e)
+    catch (Exception e)
     {
       if (Logging.root != null)
         Logging.root.error("Exception: "+e.getMessage(),e);

Modified: manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java?rev=1628808&r1=1628807&r2=1628808&view=diff
==============================================================================
--- manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java (original)
+++ manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java Wed Oct  1 18:52:12 2014
@@ -53,7 +53,7 @@ public class ManifoldCFJettyRunner
   public static final String authorityServiceWarPathProperty = "org.apache.manifoldcf.authorityservicewarpath";
   public static final String apiServiceWarPathProperty = "org.apache.manifoldcf.apiservicewarpath";
   public static final String useJettyParentClassLoaderProperty = "org.apache.manifoldcf.usejettyparentclassloader";
-  public static final String jettyPortProperty = "org.apache.manifoldcf.jettyport";
+  public static final String jettyConfigFileProperty = "org.apache.manifoldcf.jettyconfigfile";
   
   protected Server server;
   
@@ -169,7 +169,7 @@ public class ManifoldCFJettyRunner
   {
     if (args.length != 4 && args.length != 1 && args.length != 0)
     {
-      System.err.println("Usage: ManifoldCFJettyRunner [<port> [<crawler-war-path> <authority-service-war-path> <api-war-path>]]");
+      System.err.println("Usage: ManifoldCFJettyRunner [<jetty-config-file> [<crawler-war-path> <authority-service-war-path> <api-war-path>]]");
       System.exit(1);
     }
 
@@ -187,18 +187,9 @@ public class ManifoldCFJettyRunner
       File authorityserviceWarPath = ManifoldCF.getFileProperty(authorityServiceWarPathProperty);
       File apiWarPath = ManifoldCF.getFileProperty(apiServiceWarPathProperty);
       boolean useParentClassLoader = ManifoldCF.getBooleanProperty(useJettyParentClassLoaderProperty,true);
-      int jettyPort = ManifoldCF.getIntProperty(jettyPortProperty,8345);
-      if (args.length > 0)
-      {
-        try
-        {
-          jettyPort = Integer.parseInt(args[0]);
-        }
-        catch (NumberFormatException e)
-        {
-          throw new ManifoldCFException("Illegal value for jetty port argument: "+e.getMessage(),e);
-        }
-      }
+      File jettyConfigFile = ManifoldCF.getFileProperty(jettyConfigFileProperty);
+      if (jettyConfigFile == null)
+        jettyConfigFile = new File("./jetty.xml");
       if (args.length == 4)
       {
         crawlerWarPath = new File(args[1]);
@@ -233,7 +224,7 @@ public class ManifoldCFJettyRunner
       System.err.println("Starting jetty...");
       
       // Create a jetty instance
-      ManifoldCFJettyRunner jetty = new ManifoldCFJettyRunner(jettyPort,crawlerWarPath.toString(),authorityserviceWarPath.toString(),apiWarPath.toString(),useParentClassLoader);
+      ManifoldCFJettyRunner jetty = new ManifoldCFJettyRunner(jettyConfigFile,crawlerWarPath.toString(),authorityserviceWarPath.toString(),apiWarPath.toString(),useParentClassLoader);
       // This will register a shutdown hook as well.
       jetty.start();
 
@@ -262,7 +253,7 @@ public class ManifoldCFJettyRunner
         }
       }
     }
-    catch (ManifoldCFException e)
+    catch (Exception e)
     {
       if (Logging.root != null)
         Logging.root.error("Exception: "+e.getMessage(),e);