manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1391101 - in /manifoldcf/trunk: ./ framework/ framework/example-singleprocess-common/ framework/example-singleprocess-proprietary/ framework/example-singleprocess/ framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/
Date Thu, 27 Sep 2012 17:08:57 GMT
Author: kwright
Date: Thu Sep 27 17:08:57 2012
New Revision: 1391101

URL: http://svn.apache.org/viewvc?rev=1391101&view=rev
Log:
Fix for CONNECTORS-544.

Added:
    manifoldcf/trunk/framework/example-singleprocess-common/setclasspath.bat
      - copied unchanged from r1390641, manifoldcf/trunk/framework/example-multiprocess-common/setclasspath.bat
    manifoldcf/trunk/framework/example-singleprocess-common/start-combined.bat   (with props)
    manifoldcf/trunk/framework/example-singleprocess-common/start-combined.sh   (with props)
    manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
  (with props)
Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/framework/build.xml
    manifoldcf/trunk/framework/example-singleprocess-proprietary/properties.xml
    manifoldcf/trunk/framework/example-singleprocess/properties.xml

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1391101&r1=1391100&r2=1391101&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Thu Sep 27 17:08:57 2012
@@ -8,6 +8,11 @@ CONNECTORS-535: Move readme files into S
 
 ======================= Release 1.0 =====================
 
+CONNECTORS-544: Add missing materials to combined service war.
+Also include a way of easily invoking it from the single-process example
+directory.
+(Karl Wright)
+
 CONNECTORS-540: Multi-process proprietary webapps run not properly
 running the start-webapps.sh.
 (Shinichiro Abe)

Modified: manifoldcf/trunk/framework/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/build.xml?rev=1391101&r1=1391100&r2=1391101&view=diff
==============================================================================
--- manifoldcf/trunk/framework/build.xml (original)
+++ manifoldcf/trunk/framework/build.xml Thu Sep 27 17:08:57 2012
@@ -556,7 +556,7 @@
         <jar destfile="build/webapp/crawler-ui-proprietary/WEB-INF/lib/mcf-crawler-ui.jar"
basedir="build/crawler-ui/classes"/>
     </target>
 
-    <target name="webapp-combined-service" depends="compile-combined-service,jar-core,jar-ui-core,jar-agents,jar-pull-agent">
+    <target name="webapp-combined-service" depends="compile-combined-service,jar-core,jar-ui-core,jar-agents,jar-pull-agent,jar-api-servlet,jar-authority-servlet">
         <mkdir dir="build/webapp/combined-service/WEB-INF/lib"/>
         <copy todir="build/webapp/combined-service/WEB-INF/lib">
             <fileset dir="../lib">
@@ -587,6 +587,8 @@
                 <include name="mcf-agents.jar"/>
                 <include name="mcf-pull-agent.jar"/>
                 <include name="mcf-ui-core.jar"/>
+                <include name="mcf-api-servlet.jar"/>
+                <include name="mcf-authority-servlet.jar"/>
             </fileset>
         </copy>
         <mkdir dir="build/webapp/combined-service/WEB-INF/jsp"/>
@@ -601,7 +603,7 @@
         <jar destfile="build/webapp/combined-service/WEB-INF/lib/mcf-combined-service.jar"
basedir="build/combined-service/classes"/>
     </target>
   
-      <target name="webapp-combined-service-proprietary" depends="compile-combined-service,jar-core,jar-ui-core,jar-agents,jar-pull-agent">
+      <target name="webapp-combined-service-proprietary" depends="compile-combined-service,jar-core,jar-ui-core,jar-agents,jar-pull-agent,jar-api-servlet,jar-authority-servlet">
         <mkdir dir="build/webapp/combined-service-proprietary/WEB-INF/lib"/>
         <copy todir="build/webapp/combined-service-proprietary/WEB-INF/lib">
             <fileset dir="../lib">
@@ -639,6 +641,8 @@
                 <include name="mcf-agents.jar"/>
                 <include name="mcf-pull-agent.jar"/>
                 <include name="mcf-ui-core.jar"/>
+                <include name="mcf-api-servlet.jar"/>
+                <include name="mcf-authority-servlet.jar"/>
             </fileset>
         </copy>
         <mkdir dir="build/webapp/combined-service-proprietary/WEB-INF/jsp"/>

Added: manifoldcf/trunk/framework/example-singleprocess-common/start-combined.bat
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/example-singleprocess-common/start-combined.bat?rev=1391101&view=auto
==============================================================================
--- manifoldcf/trunk/framework/example-singleprocess-common/start-combined.bat (added)
+++ manifoldcf/trunk/framework/example-singleprocess-common/start-combined.bat Thu Sep 27
17:08:57 2012
@@ -0,0 +1,28 @@
+@echo off
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements.  See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License.  You may obtain a copy of the License at
+rem
+rem     http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+
+rem check that JAVA_HOME is set, and that the current directory is correct
+if not exist "%JAVA_HOME%\bin\java.exe" goto nojavahome
+
+set CLASSPATH=.
+for %%f in (lib/*) do call setclasspath.bat %%f
+rem invoke java with the jetty class
+"%JAVA_HOME%\bin\java" -cp "%CLASSPATH%" org.apache.manifoldcf.jettyrunner.ManifoldCFCombinedJettyRunner
+goto done
+:nojavahome
+echo Environment variable JAVA_HOME is not set properly.
+goto done
+:done

Propchange: manifoldcf/trunk/framework/example-singleprocess-common/start-combined.bat
------------------------------------------------------------------------------
    svn:eol-style = CRLF

Added: manifoldcf/trunk/framework/example-singleprocess-common/start-combined.sh
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/example-singleprocess-common/start-combined.sh?rev=1391101&view=auto
==============================================================================
--- manifoldcf/trunk/framework/example-singleprocess-common/start-combined.sh (added)
+++ manifoldcf/trunk/framework/example-singleprocess-common/start-combined.sh Thu Sep 27 17:08:57
2012
@@ -0,0 +1,42 @@
+#!/bin/bash -e
+
+# 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.
+
+if [[ $OSTYPE == "cygwin" ]] ; then
+    PATHSEP=";"
+else
+    PATHSEP=":"
+fi
+
+#Make sure environment variables are properly set
+if [ -e "$JAVA_HOME"/bin/java ] ; then
+
+    CLASSPATH=""
+    for filename in $(ls -1 ./lib) ; do
+        if [ -n "$CLASSPATH" ] ; then
+            CLASSPATH="$CLASSPATH""$PATHSEP"./lib/"$filename"
+        else
+            CLASSPATH=./lib/"$filename"
+        fi
+    done
+
+    "$JAVA_HOME"/bin/java -cp "$CLASSPATH" org.apache.manifoldcf.jettyrunner.ManifoldCFCombinedJettyRunner
+    exit $?
+        
+else
+    echo "Environment variable JAVA_HOME is not properly set." 1>&2
+    exit 1
+fi

Propchange: manifoldcf/trunk/framework/example-singleprocess-common/start-combined.sh
------------------------------------------------------------------------------
    svn:eol-style = LF

Propchange: manifoldcf/trunk/framework/example-singleprocess-common/start-combined.sh
------------------------------------------------------------------------------
    svn:executable = *

Modified: manifoldcf/trunk/framework/example-singleprocess-proprietary/properties.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/example-singleprocess-proprietary/properties.xml?rev=1391101&r1=1391100&r2=1391101&view=diff
==============================================================================
--- manifoldcf/trunk/framework/example-singleprocess-proprietary/properties.xml (original)
+++ manifoldcf/trunk/framework/example-singleprocess-proprietary/properties.xml Thu Sep 27
17:08:57 2012
@@ -23,6 +23,8 @@
   <property name="org.apache.manifoldcf.apiservicewarpath" value="../web/war/mcf-api-service.war"/>
   <property name="org.apache.manifoldcf.usejettyparentclassloader" value="true"/>
   <property name="org.apache.manifoldcf.jettyport" value="8345"/>
+  <!-- Point to the combined war in case we start the single-process example that way
-->
+  <property name="org.apache.manifoldcf.combinedwarpath" value="../web/war/mcf-combined-service.war"/>
   <!-- Select Derby as the database implementation, and specify where the database will
be stored -->
   <property name="org.apache.manifoldcf.databaseimplementationclass" value="org.apache.manifoldcf.core.database.DBInterfaceDerby"/>
   <property name="org.apache.manifoldcf.derbydatabasepath" value="."/>

Modified: manifoldcf/trunk/framework/example-singleprocess/properties.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/example-singleprocess/properties.xml?rev=1391101&r1=1391100&r2=1391101&view=diff
==============================================================================
--- manifoldcf/trunk/framework/example-singleprocess/properties.xml (original)
+++ manifoldcf/trunk/framework/example-singleprocess/properties.xml Thu Sep 27 17:08:57 2012
@@ -23,6 +23,8 @@
   <property name="org.apache.manifoldcf.apiservicewarpath" value="../web/war/mcf-api-service.war"/>
   <property name="org.apache.manifoldcf.usejettyparentclassloader" value="true"/>
   <property name="org.apache.manifoldcf.jettyport" value="8345"/>
+  <!-- Point to the combined war in case we start the single-process example that way
-->
+  <property name="org.apache.manifoldcf.combinedwarpath" value="../web/war/mcf-combined-service.war"/>
   <!-- Select Derby as the database implementation, and specify where the database will
be stored -->
   <property name="org.apache.manifoldcf.databaseimplementationclass" value="org.apache.manifoldcf.core.database.DBInterfaceDerby"/>
   <property name="org.apache.manifoldcf.derbydatabasepath" value="."/>

Added: 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=1391101&view=auto
==============================================================================
--- manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
(added)
+++ manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
Thu Sep 27 17:08:57 2012
@@ -0,0 +1,197 @@
+/**
+ * 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.
+ */
+
+package org.apache.manifoldcf.jettyrunner;
+
+import java.io.*;
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.crawler.system.*;
+import org.apache.manifoldcf.crawler.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.server.Connector;
+
+/**
+ * Run ManifoldCF with jetty.
+ * 
+ */
+public class ManifoldCFCombinedJettyRunner
+{
+
+  public static final String _rcsid = "@(#)$Id$";
+
+  public static final String combinedWarPathProperty = "org.apache.manifoldcf.combinedwarpath";
+  public static final String jettyPortProperty = "org.apache.manifoldcf.jettyport";
+  
+  protected Server server;
+  
+  public ManifoldCFCombinedJettyRunner( int port, String combinedWarPath )
+  {
+    server = new Server( port );    
+    server.setStopAtShutdown( true );
+    
+    // Initialize the servlets
+    ContextHandlerCollection contexts = new ContextHandlerCollection();
+    server.setHandler(contexts);
+    WebAppContext mcfCombined = new WebAppContext(combinedWarPath,"/mcf");
+    mcfCombined.setParentLoaderPriority(false);
+    contexts.addHandler(mcfCombined);
+  }
+
+  public void start()
+    throws ManifoldCFException
+  {
+    if(!server.isRunning() )
+    {
+      try
+      {
+        server.start();
+      }
+      catch (Exception e)
+      {
+        throw new ManifoldCFException("Couldn't start: "+e.getMessage(),e);
+      }
+    }
+  }
+
+  public void stop()
+    throws ManifoldCFException
+  {
+    if( server.isRunning() )
+    {
+      try
+      {
+        server.stop();
+      }
+      catch (Exception e)
+      {
+        throw new ManifoldCFException("Couldn't stop: "+e.getMessage(),e);
+      }
+      try
+      {
+        server.join();
+      }
+      catch (InterruptedException e)
+      {
+        throw new ManifoldCFException(e.getMessage(),e,ManifoldCFException.INTERRUPTED);
+      }
+    }
+  }
+
+  /**
+   * Returns the Local Port of the first Connector found for the jetty Server.
+   * @return the port number.
+   */
+  public int getLocalPort()
+    throws ManifoldCFException
+  {
+    Connector[] conns = server.getConnectors();
+    if (0 == conns.length) {
+      throw new ManifoldCFException("Jetty Server has no Connectors");
+    }
+    return conns[0].getLocalPort();
+  }
+
+  /**
+   * A main class that starts jetty+mcf
+   */
+  public static void main( String[] args )
+  {
+    if (args.length != 2 && args.length != 1 && args.length != 0)
+    {
+      System.err.println("Usage: ManifoldCFCombinedJettyRunner [<port> [<combined-war-path>]]");
+      System.exit(1);
+    }
+
+    
+    // Ready to begin in earnest...
+    if (System.getProperty(ManifoldCF.lcfConfigFileProperty) == null)
+    	System.setProperty(ManifoldCF.lcfConfigFileProperty,"./properties.xml");
+    try
+    {
+      ManifoldCF.initializeEnvironment();
+      IThreadContext tc = ThreadContextFactory.make();
+
+      // 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);
+        }
+      }
+      if (args.length == 2)
+      {
+        combinedWarPath = new File(args[1]);
+      }
+      else
+      {
+        if (combinedWarPath == null)
+          throw new ManifoldCFException("The property '"+combinedWarPathProperty+"' must
be set");
+      }
+      
+      System.err.println("Starting jetty...");
+      
+      // Create a jetty instance
+      ManifoldCFCombinedJettyRunner jetty = new ManifoldCFCombinedJettyRunner(jettyPort,combinedWarPath.toString());
+      // This will register a shutdown hook as well.
+      jetty.start();
+
+      System.err.println("Jetty started.");
+
+      // Go to sleep until interrupted.
+      while (true)
+      {
+        try
+        {
+          Thread.sleep(5000);
+          continue;
+        }
+        catch (InterruptedException e)
+        {
+          break;
+        }
+      }
+    }
+    catch (ManifoldCFException e)
+    {
+      if (Logging.root != null)
+        Logging.root.error("Exception: "+e.getMessage(),e);
+      e.printStackTrace(System.err);
+      System.exit(1);
+    }
+  }
+  
+}
+
+

Propchange: manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message