You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2006/01/26 06:40:05 UTC

svn commit: r372455 [10/11] - in /incubator/solr/trunk: ./ src/ src/apps/ src/apps/SolarTest/ src/apps/SolarTest/src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/solr/ src/java/org/apache/solr/analysis/ src/java/org/apache/solr/cor...

Added: incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReciprocalFloatFunction.java
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReciprocalFloatFunction.java?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReciprocalFloatFunction.java (added)
+++ incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReciprocalFloatFunction.java Wed Jan 25 21:37:29 2006
@@ -0,0 +1,101 @@
+/**
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.lucene.search.function;
+
+import org.apache.lucene.index.IndexReader;
+
+import java.io.IOException;
+
+/**
+ * <code>ReciprocalFloatFunction</code> implements a reciprocal function f(x) = a/(mx+b), based on
+ * the float value of a field as exported by {@link org.apache.lucene.search.function.ValueSource}.
+ * <br>
+ *
+ * When a and b are equal, and x>=0, this function has a maximum value of 1 that drops as x increases.
+ * Increasing the value of a and b together results in a movement of the entire function to a flatter part of the curve.
+ * <br>These properties make this an idea function for boosting more recent documents.
+ * <br>Example:<code>ReciprocalFloatFunction(new ReverseOrdFieldSource("my_date"),1,1000,1000)</code>
+ *
+ * @see FunctionQuery
+ *
+ *
+ * @author yonik
+ * @version $Id: ReciprocalFloatFunction.java,v 1.2 2005/11/22 05:23:21 yonik Exp $
+ */
+public class ReciprocalFloatFunction extends ValueSource {
+  protected final ValueSource source;
+  protected final float m;
+  protected final float a;
+  protected final float b;
+
+  /**
+   *  f(source) = a/(m*float(source)+b)
+   */
+  public ReciprocalFloatFunction(ValueSource source, float m, float a, float b) {
+    this.source=source;
+    this.m=m;
+    this.a=a;
+    this.b=b;
+  }
+
+  public DocValues getValues(IndexReader reader) throws IOException {
+    final DocValues vals = source.getValues(reader);
+    return new DocValues() {
+      public float floatVal(int doc) {
+        return a/(m*vals.floatVal(doc) + b);
+      }
+      public int intVal(int doc) {
+        return (int)floatVal(doc);
+      }
+      public long longVal(int doc) {
+        return (long)floatVal(doc);
+      }
+      public double doubleVal(int doc) {
+        return (double)floatVal(doc);
+      }
+      public String strVal(int doc) {
+        return Float.toString(floatVal(doc));
+      }
+      public String toString(int doc) {
+        return Float.toString(a) + "/("
+                + m + "*float(" + vals.toString(doc) + ')'
+                + '+' + b + ')';
+      }
+    };
+  }
+
+  public String description() {
+    return Float.toString(a) + "/("
+           + m + "*float(" + source.description() + ")"
+           + "+" + b + ')';
+  }
+
+  public int hashCode() {
+    int h = Float.floatToIntBits(a) + Float.floatToIntBits(m);
+    h ^= (h << 13) | (h >>> 20);
+    return h + (Float.floatToIntBits(b)) + source.hashCode();
+  }
+
+  public boolean equals(Object o) {
+    if (ReciprocalFloatFunction.class != o.getClass()) return false;
+    ReciprocalFloatFunction other = (ReciprocalFloatFunction)o;
+    return this.m == other.m
+            && this.a == other.a
+            && this.b == other.b
+            && this.source.equals(other.source);
+  }
+}

Propchange: incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReciprocalFloatFunction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReverseOrdFieldSource.java
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReverseOrdFieldSource.java?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReverseOrdFieldSource.java (added)
+++ incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReverseOrdFieldSource.java Wed Jan 25 21:37:29 2006
@@ -0,0 +1,99 @@
+/**
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.lucene.search.function;
+
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.search.function.DocValues;
+import org.apache.lucene.search.function.ValueSource;
+import org.apache.lucene.search.FieldCache;
+
+import java.io.IOException;
+
+/**
+ * Obtains the ordinal of the field value from the default Lucene {@link org.apache.lucene.search.FieldCache} using getStringIndex()
+ * and reverses the order.
+ * <br>
+ * The native lucene index order is used to assign an ordinal value for each field value.
+ * <br>Field values (terms) are lexicographically ordered by unicode value, and numbered starting at 1.
+ * <br>
+ * Example of reverse ordinal (rord):<br>
+ *  If there were only three field values: "apple","banana","pear"
+ * <br>then rord("apple")=3, rord("banana")=2, ord("pear")=1
+ * <p>
+ *  WARNING: ord() depends on the position in an index and can thus change when other documents are inserted or deleted,
+ *  or if a MultiSearcher is used.
+ * @author yonik
+ * @version $Id: ReverseOrdFieldSource.java,v 1.2 2005/11/22 05:23:21 yonik Exp $
+ */
+
+public class ReverseOrdFieldSource extends ValueSource {
+  public String field;
+
+  public ReverseOrdFieldSource(String field) {
+    this.field = field;
+  }
+
+  public String description() {
+    return "rord("+field+')';
+  }
+
+  public DocValues getValues(IndexReader reader) throws IOException {
+    final FieldCache.StringIndex sindex = FieldCache.DEFAULT.getStringIndex(reader, field);
+
+    final int arr[] = sindex.order;
+    final int end = sindex.lookup.length;
+
+    return new DocValues() {
+      public float floatVal(int doc) {
+        return (float)(end - arr[doc]);
+      }
+
+      public int intVal(int doc) {
+        return (int)(end - arr[doc]);
+      }
+
+      public long longVal(int doc) {
+        return (long)(end - arr[doc]);
+      }
+
+      public double doubleVal(int doc) {
+        return (double)(end - arr[doc]);
+      }
+
+      public String strVal(int doc) {
+        // the string value of the ordinal, not the string itself
+        return Integer.toString((end - arr[doc]));
+      }
+
+      public String toString(int doc) {
+        return description() + '=' + strVal(doc);
+      }
+    };
+  }
+
+  public boolean equals(Object o) {
+    if (o.getClass() !=  ReverseOrdFieldSource.class) return false;
+    ReverseOrdFieldSource other = (ReverseOrdFieldSource)o;
+    return this.field.equals(field);
+  }
+
+  private static final int hcode = ReverseOrdFieldSource.class.hashCode();
+  public int hashCode() {
+    return hcode + field.hashCode();
+  };
+
+}

Propchange: incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ReverseOrdFieldSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ValueSource.java
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ValueSource.java?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ValueSource.java (added)
+++ incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ValueSource.java Wed Jan 25 21:37:29 2006
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.lucene.search.function;
+
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.search.function.DocValues;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * Instantiates {@link org.apache.lucene.search.function.DocValues} for a particular reader.
+ * <br>
+ * Often used when creating a {@link FunctionQuery}.
+ *
+ * @author yonik
+ * @version $Id: ValueSource.java,v 1.2 2005/11/30 19:31:01 yonik Exp $
+ */
+public abstract class ValueSource implements Serializable {
+
+  public abstract DocValues getValues(IndexReader reader) throws IOException;
+
+  public abstract boolean equals(Object o);
+
+  public abstract int hashCode();
+
+  /** description of field, used in explain() */
+  public abstract String description();
+
+  public String toString() {
+    return getClass().getName() + ":" + description();
+  }
+
+}

Propchange: incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/ValueSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/function.zip
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/function.zip?rev=372455&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/function.zip
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/solr/trunk/src/lucene_extras/org/apache/lucene/search/function/function.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/solr/trunk/src/scripts/abc
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/abc?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/abc (added)
+++ incubator/solr/trunk/src/scripts/abc Wed Jan 25 21:37:29 2006
@@ -0,0 +1,132 @@
+#!/bin/bash
+#
+# $Id: abc.template,v 1.5 2005/06/09 15:33:13 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/abc.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to make an Atomic Backup after Commit of
+# a SOLAR Lucene collection.
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+
+logMessage sending commit to Solar server at port 5051
+rs=`curl http://localhost:5051/update -s -d "<commit/>"`
+if [[ $? != 0 ]]
+then
+  logMessage failed to connect to SOLAR server at port 5051
+  logMessage commit failed
+  logExit failed 1
+fi
+
+# check status of commit request
+rc=`echo $rs|cut -f2 -d'"'`
+if [[ $? != 0 ]]
+then
+  logMessage commit request to SOLAR at port 5051 failed:
+  logMessage $rs
+  logExit failed 2
+fi
+
+# successful commit creates a snapshot file synchronously
+lastsnap=`ls -drt1 snapshot.* 2> /dev/null | tail -1 `
+
+if [[ $lastsnap == "" ]]
+then
+  logMessage commit did not create snapshot at port 5051; backup failed:
+  logExit failed 3
+fi
+
+name=backup.${lastsnap##snapshot.}
+temp=temp-${name}
+
+if [[ -d ${name} ]]
+then
+    logMessage backup directory ${name} already exists
+    logExit aborted 1
+fi
+
+if [[ -d ${temp} ]]
+then
+    logMessage backingup of ${name} in progress
+    logExit aborted 1
+fi
+logMessage making backup ${name}
+
+# clean up after INT/TERM
+trap 'echo cleaning up, please wait ...;/bin/rm -rf ${name} ${temp};logExit aborted 13' INT TERM
+
+# make a backup using hard links into temporary location
+# then move it into place atomically
+cp -lr ${lastsnap} ${temp}
+mv ${temp} ${name}
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/abc
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/abc
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/abo
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/abo?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/abo (added)
+++ incubator/solr/trunk/src/scripts/abo Wed Jan 25 21:37:29 2006
@@ -0,0 +1,132 @@
+#!/bin/bash
+#
+# $Id: abo.template,v 1.5 2005/06/09 15:33:13 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/abo.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to make an Atomic Backup after Optimize of
+# a SOLAR Lucene collection.
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+
+logMessage sending optimize to Solar server at port 5051
+rs=`curl http://localhost:5051/update -s -d "<optimize/>"`
+if [[ $? != 0 ]]
+then
+  logMessage failed to connect to SOLAR server at port 5051
+  logMessage optimize failed
+  logExit failed 1
+fi
+
+# check status of optimize request
+rc=`echo $rs|cut -f2 -d'"'`
+if [[ $? != 0 ]]
+then
+  logMessage optimize request to SOLAR at port 5051 failed:
+  logMessage $rs
+  logExit failed 2
+fi
+
+# successful optimize creates a snapshot file synchronously
+lastsnap=`ls -drt1 snapshot.* | tail -1 `
+
+if [[ $lastsnap == "" ]]
+then
+  logMessage commit did not create snapshot at port 5051; backup failed:
+  logExit failed 3
+fi
+
+name=backup.${lastsnap##snapshot.}
+temp=temp-${name}
+
+if [[ -d ${name} ]]
+then
+    logMessage backup directory ${name} already exists
+    logExit aborted 1
+fi
+
+if [[ -d ${temp} ]]
+then
+    logMessage backingup of ${name} in progress
+    logExit aborted 1
+fi
+logMessage making backup ${name}
+
+# clean up after INT/TERM
+trap 'echo cleaning up, please wait ...;/bin/rm -rf ${name} ${temp};logExit aborted 13' INT TERM
+
+# make a backup using hard links into temporary location
+# then move it into place atomically
+cp -lr ${lastsnap} ${temp}
+mv ${temp} ${name}
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/abo
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/abo
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/backup
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/backup?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/backup (added)
+++ incubator/solr/trunk/src/scripts/backup Wed Jan 25 21:37:29 2006
@@ -0,0 +1,105 @@
+#!/bin/bash
+#
+# $Id: backup.template,v 1.4 2005/06/09 15:33:13 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/backup.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to make a backup of a SOLAR Lucene collection.
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+name=backup.`date +"%Y%m%d%H%M%S"`
+temp=temp-${name}
+
+if [[ -d ${name} ]]
+then
+    logMessage backup directory ${name} already exists
+    logExit aborted 1
+fi
+
+if [[ -d ${temp} ]]
+then
+    logMessage backingup of ${name} in progress
+    logExit aborted 1
+fi
+
+# clean up after INT/TERM
+trap 'echo cleaning up, please wait ...;/bin/rm -rf ${name} ${temp};logExit aborted 13' INT TERM
+
+logMessage making backup ${name}
+
+# make a backup using hard links into temporary location
+# then move it into place atomically
+cp -lr index ${temp}
+mv ${temp} ${name}
+
+logExit ended 0
+

Propchange: incubator/solr/trunk/src/scripts/backup
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/backup
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/commit
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/commit?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/commit (added)
+++ incubator/solr/trunk/src/scripts/commit Wed Jan 25 21:37:29 2006
@@ -0,0 +1,99 @@
+#!/bin/bash
+#
+# $Id: commit.template,v 1.4 2005/06/09 15:33:13 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/commit.template,v $
+# $Name: r20050725_standardized_server_enabled $
+
+#
+# Shell script to force a commit of all changes since last commit
+# for a SOLAR server
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+
+rs=`curl http://localhost:5051/update -s -d "<commit/>"`
+if [[ $? != 0 ]]
+then
+  logMessage failed to connect to SOLAR server at port 5051
+  logMessage commit failed
+  logExit failed 1
+fi
+
+# check status of commit request
+rc=`echo $rs|cut -f2 -d'"'`
+if [[ $? != 0 ]]
+then
+  logMessage commit request to SOLAR at port 5051 failed:
+  logMessage $rs
+  logExit failed 2
+fi
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/commit
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/commit
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/optimize
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/optimize?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/optimize (added)
+++ incubator/solr/trunk/src/scripts/optimize Wed Jan 25 21:37:29 2006
@@ -0,0 +1,99 @@
+#!/bin/bash
+#
+# $Id: optimize.template,v 1.3 2005/06/09 15:34:06 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/optimize.template,v $
+# $Name: r20050725_standardized_server_enabled $
+
+#
+# Shell script to force a optimized commit of all changes since last commit
+# for a SOLAR server
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+  fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+
+rs=`curl http://localhost:5051/update -s -d "<optimize/>"`
+if [[ $? != 0 ]]
+then
+  logMessage failed to connect to SOLAR server at port 5051
+  logMessage optimize failed
+  logExit failed 1
+fi
+
+# check status of optimize request
+rc=`echo $rs|cut -f2 -d'"'`
+if [[ $? != 0 ]]
+then
+  logMessage optimize request to SOLAR at port 5051 failed:
+  logMessage $rs
+  logExit failed 2
+fi
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/optimize
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/optimize
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/readercycle
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/readercycle?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/readercycle (added)
+++ incubator/solr/trunk/src/scripts/readercycle Wed Jan 25 21:37:29 2006
@@ -0,0 +1,99 @@
+#!/bin/bash
+#
+# $Id: readercycle.template,v 1.3 2005/06/09 15:34:06 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/readercycle.template,v $
+# $Name: r20050725_standardized_server_enabled $
+
+#
+# Shell script to force all old readers closed and a new reader to be opened
+# for a SOLAR server
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+
+rs=`curl http://localhost:5051/update -s -d "<commit/>"`
+if [[ $? != 0 ]]
+then
+  logMessage failed to connect to SOLAR server at port 5051
+  logMessage reader cycle failed
+  logExit failed 1
+fi
+
+# check status of commit request
+rc=`echo $rs|cut -f2 -d'"'`
+if [[ $? != 0 ]]
+then
+  logMessage reader cycle request to SOLAR at port 5051 failed:
+  logMessage $rs
+  logExit failed 2
+fi
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/readercycle
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/readercycle
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/rsyncd-disable
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/rsyncd-disable?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/rsyncd-disable (added)
+++ incubator/solr/trunk/src/scripts/rsyncd-disable Wed Jan 25 21:37:29 2006
@@ -0,0 +1,89 @@
+#!/bin/bash
+#
+# $Id: rsyncd-disable.template,v 1.1 2005/06/20 20:43:29 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/rsyncd-disable.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to disable rsyncd
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/rsyncd.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y/%m/%d %H:%M:%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage disabled by $oldwhoami
+logMessage command: $0 $originalargs
+name=rsyncd-enabled
+
+if [[ -f ${name} ]]
+then
+    rm -f ${name}
+else
+    logMessage rsyncd not currently enabled
+    logExit exited 1
+fi
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/rsyncd-disable
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/rsyncd-disable
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/rsyncd-enable
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/rsyncd-enable?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/rsyncd-enable (added)
+++ incubator/solr/trunk/src/scripts/rsyncd-enable Wed Jan 25 21:37:29 2006
@@ -0,0 +1,89 @@
+#!/bin/bash
+#
+# $Id: rsyncd-enable.template,v 1.1 2005/06/20 20:43:29 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/rsyncd-enable.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to enable rsyncd
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/rsyncd.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y/%m/%d %H:%M:%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage enabled by $oldwhoami
+logMessage command: $0 $originalargs
+name=rsyncd-enabled
+
+if [[ -f ${name} ]]
+then
+    logMessage rsyncd already currently enabled
+    logExit exited 1
+else
+    touch ${name}
+fi
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/rsyncd-enable
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/rsyncd-enable
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/rsyncd-start
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/rsyncd-start?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/rsyncd-start (added)
+++ incubator/solr/trunk/src/scripts/rsyncd-start Wed Jan 25 21:37:29 2006
@@ -0,0 +1,101 @@
+#!/bin/bash
+#
+# $Id: rsyncd-start.template,v 1.3 2005/06/20 20:43:55 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/rsyncd-start.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to start rsyncd on master SOLAR server
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+    oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+prog=${0##*/}
+log=logs/rsyncd.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+resin_port=5051
+rsyncd_port=`expr 10000 + ${resin_port}`
+
+cd ${0%/*}/../..
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+function timeStamp
+{
+    date +'%Y/%m/%d %H:%M:%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+        echo $@
+    fi
+}
+
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+
+if [[ ! -f rsyncd-enabled ]]
+then
+    logMessage rsyncd disabled
+    exit 1
+fi
+
+if \
+    rsync rsync://localhost:${rsyncd_port} >/dev/null 2>&1
+then
+    logMessage "rsyncd already running at port ${rsyncd_port}"
+    exit 1
+fi
+
+rsync --daemon --port=${rsyncd_port} --config=conf/rsyncd.conf
+
+# first make sure rsyncd is accepting connections
+i=1
+while \
+ ! rsync rsync://localhost:${rsyncd_port} >/dev/null 2>&1
+do
+    if (( i++ > 15 ))
+    then
+        logMessage "rsyncd not accepting connections, exiting" >&2
+        exit 2
+    fi
+    sleep 1
+done
+
+logMessage rsyncd started and accepting requests
\ No newline at end of file

Propchange: incubator/solr/trunk/src/scripts/rsyncd-start
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/rsyncd-start
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/rsyncd-stop
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/rsyncd-stop?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/rsyncd-stop (added)
+++ incubator/solr/trunk/src/scripts/rsyncd-stop Wed Jan 25 21:37:29 2006
@@ -0,0 +1,100 @@
+#!/bin/bash
+#
+# $Id: rsyncd-stop.template,v 1.3 2005/06/20 20:43:55 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/rsyncd-stop.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to stop rsyncd on master SOLAR server
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+    oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+prog=${0##*/}
+log=logs/rsyncd.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+cd ${0%/*}/../..
+SERVER_ROOT=$(pwd)
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+function timeStamp
+{
+    date +'%Y/%m/%d %H:%M:%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+        echo $@
+    fi
+}
+
+logMessage stopped by $oldwhoami
+logMessage command: $0 $originalargs
+
+# get PID from file
+pid=$(<$SERVER_ROOT/logs/rsyncd.pid)
+if [[ -z $pid ]]
+then
+    logMessage "unable to get rsyncd's PID"
+    exit 2
+fi
+
+kill $pid
+
+# wait until rsyncd dies or we time out
+dead=0
+timer=0
+timeout=300
+while (( ! dead && timer < timeout ))
+do
+    if ps -eo pid | grep -q $pid
+    then
+	kill $pid
+        (( timer++ ))
+        sleep 1
+    else
+        dead=1
+    fi
+done
+if ps -eo pid | grep -q $pid
+then
+    logMessage rsyncd failed to stop after $timeout seconds
+    exit 3
+fi

Propchange: incubator/solr/trunk/src/scripts/rsyncd-stop
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/rsyncd-stop
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/snapcleaner
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/snapcleaner?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/snapcleaner (added)
+++ incubator/solr/trunk/src/scripts/snapcleaner Wed Jan 25 21:37:29 2006
@@ -0,0 +1,137 @@
+#!/bin/bash
+#
+# $Id: snapcleaner.template,v 1.7 2005/06/09 15:34:06 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/snapcleaner.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to clean up snapshots of a SOLAR Lucene collection.
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+    oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog -d <days> | -n <num> [ -v ]
+       -d <days>    cleanup snapshots more than <days> days old
+       -n <num>     keep the most most recent <num> number of snapshots and
+                    cleanup up the remaining ones that are not being pulled
+       -v           increase verbosity
+"
+
+unset days num verbose
+
+# parse args
+originalargs="$@"
+while getopts d:n:v OPTION
+do
+    case $OPTION in
+    d)
+        days="$OPTARG"
+        ;;
+    n)
+        num="$OPTARG"
+        ;;
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+if [[ -z ${days} && -z ${num} ]]
+then
+    echo "$USAGE"
+    exit 1
+fi
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+function remove
+{
+    syncing=`ps -fwwwu app|grep rsync|grep -v grep|cut -f6 -d"/"|grep $1`
+    if [[ -n $syncing ]]
+    then
+	logMessage $1 not removed - rsync in progress
+    else
+	logMessage removing snapshot $1
+	/bin/rm -rf $1
+    fi
+}
+
+cd ${0%/*}/../..
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+start=`date +"%s"`
+
+# trap control-c
+trap 'echo "caught INT/TERM, exiting now but partial cleanup may have already occured";logExit aborted 13' INT TERM
+
+if [[ -n ${days} ]]
+then
+    logMessage cleaning up snapshots more than ${days} days old
+    for i in `find . -name "snapshot.*" -maxdepth 1 -mtime +${days} -print`
+    do
+        remove `basename $i`
+    done
+elif [[ -n ${num} ]]
+then
+    logMessage cleaning up all snapshots except for the most recent ${num} ones
+    unset snapshots count
+    snapshots=`ls -cd snapshot.* 2>/dev/null`
+    if [[ $? == 0 ]]
+    then
+        count=`echo $snapshots|wc -w`
+        startpos=`expr $num + 1`
+        if [[ $count -gt $num ]]
+        then
+            for i in `echo $snapshots|cut -f${startpos}- -d" "`
+            do
+	        remove $i
+	    done
+        fi
+    fi
+fi
+
+logExit ended 0
+
+

Propchange: incubator/solr/trunk/src/scripts/snapcleaner
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/snapcleaner
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/snapinstaller
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/snapinstaller?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/snapinstaller (added)
+++ incubator/solr/trunk/src/scripts/snapinstaller Wed Jan 25 21:37:29 2006
@@ -0,0 +1,171 @@
+#!/bin/bash
+#
+# $Id: snapinstaller.template,v 1.12 2005/06/09 17:19:34 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/snapinstaller.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to install a snapshot into place as the Lucene collection
+# for a SOLAR server
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+    oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog -m master -p port [ -v ]
+       -m master   hostname of master server where snapshot stats are posted
+       -p port     port number of master server where snapshot stats are posted
+       -v          increase verbosity
+"
+
+cd ${0%/*}/../..
+SERVER_ROOT=$(pwd)
+
+unset masterHost masterPort verbose
+
+# check for config file
+confFile=${SERVER_ROOT}/conf/distribution.conf
+if
+  [[ ! -f $confFile ]]
+then
+  echo "unable to find configuration file: $confFile" >&2
+  exit 1
+fi
+# source the config file
+. $confFile
+
+# parse args
+originalargs="$@"
+while getopts m:p:v OPTION
+do
+    case $OPTION in
+    m)
+        masterHost="$OPTARG"
+        ;;
+    p)
+        masterPort="$OPTARG"
+        ;;
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+MASTER_ROOT=/var/opt/resin3/${masterPort}
+
+if [[ -z ${masterHost} ]]
+then
+    echo "name of master server missing in $confFile or command line."
+    echo "$USAGE"
+    exit 1
+fi
+                                                                                
+if [[ -z ${masterPort} ]]
+then
+    echo "port number of master server missing in $confFile or command line."
+    echo "$USAGE"
+    exit 1
+fi
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+start=`date +"%s"`
+
+# get directory name of latest snapshot
+name=`ls -d snapshot.*|grep -v wip|sort -r|head -1`
+
+# clean up after INT/TERM
+trap 'echo "caught INT/TERM, exiting now but partial installation may have already occured";/bin/rm -rf index.tmp$$;logExit aborted 13' INT TERM
+
+# is there a snapshot
+if [[ "${name}" == "" ]]
+then
+    logMessage no shapshot available
+    logExit ended 0
+fi
+
+# has snapshot already been installed
+if [[ ${name} == `cat logs/snapshot.current 2>/dev/null` ]]
+then
+    logMessage latest snapshot ${name} already installed
+    logExit ended 0
+fi
+
+# make sure master has directory for hold slaves stats/state
+if
+    ! ssh -o StrictHostKeyChecking=no ${masterHost} mkdir -p ${MASTER_ROOT}/logs/clients
+then
+    logMessage failed to ssh to master ${masterHost}, snapshot status not updated on master
+fi
+
+# install using hard links into temporary directory
+# remove original index and then atomically copy new one into place
+logMessage installing snapshot ${name}
+cp -lr ${name}/ index.tmp$$
+/bin/rm -rf index
+mv -f index.tmp$$ index
+
+# update distribution stats
+echo ${name} > logs/snapshot.current
+
+# push stats/state to master
+if
+    ! scp -q -o StrictHostKeyChecking=no logs/snapshot.current ${masterHost}:${MASTER_ROOT}/logs/clients/snapshot.current.`uname -n`
+then
+    logMessage failed to ssh to master ${masterHost}, snapshot status not updated on master
+fi
+
+# notify SOLAR to open a new Searcher
+logMessage notifing SOLAR to open a new Searcher
+scripts/solar/commit
+if [[ $? != 0 ]]
+then
+  logMessage failed to connect to SOLAR server at port 5051
+  logMessage snapshot installed but SOLAR server has not open a new Searcher
+  logExit failed 1
+fi
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/snapinstaller
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/snapinstaller
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/snappuller
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/snappuller?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/snappuller (added)
+++ incubator/solr/trunk/src/scripts/snappuller Wed Jan 25 21:37:29 2006
@@ -0,0 +1,212 @@
+#!/bin/bash
+#
+# $Id: snappuller.template,v 1.13 2005/07/20 18:38:49 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/snappuller.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to copy snapshots of a SOLAR Lucene collection from the master
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+    oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog -m master -p port [-n snapshot] [ -svz ]
+       -m master   hostname of master server from where to pull index snapshot
+       -p port     port number of master server from where to pull index snapshot
+       -n snapshot pull a specific snapshot by name
+       -s          use the --size-only option with rsync
+       -v          increase verbosity (-vv show file transfer stats also)
+       -z          enable compression of data
+"
+
+unset masterHost masterPort name sizeonly stats verbose compress startStatus
+
+cd ${0%/*}/../..
+SERVER_ROOT=$(pwd)
+
+# check for config file
+confFile=${SERVER_ROOT}/conf/distribution.conf
+if
+  [[ ! -f $confFile ]]
+then
+  echo "unable to find configuration file: $confFile" >&2
+  exit 1
+fi
+# source the config file
+. $confFile
+
+# parse args
+originalargs="$@"
+while getopts m:p:n:svz OPTION
+do
+    case $OPTION in
+    m)
+        masterHost="$OPTARG"
+        ;;
+    p)
+        masterPort="$OPTARG"
+        ;;
+    n)
+        name="$OPTARG"
+        ;;
+    s)
+        sizeonly="--size-only"
+        ;;
+    v)
+        [[ -n $verbose ]] && stats="--stats" || verbose=v
+        ;;
+    z)
+        compress="z"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+MASTER_ROOT=/var/opt/resin3/${masterPort}
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+# push stats/state to master if necessary
+    if [[ -n ${startStatus} ]]
+    then
+      scp -q -o StrictHostKeyChecking=no logs/snappuller.status ${masterHost}:${MASTER_ROOT}/logs/clients/snapshot.status.`uname -n`
+    fi
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+if [[ -z ${masterHost} ]]
+then
+    echo "name of master server missing in $confFile or command line."
+    echo "$USAGE"
+    exit 1
+fi
+
+if [[ -z ${masterPort} ]]
+then
+    echo "port number of master server missing in $confFile or command line."
+    echo "$USAGE"
+    exit 1
+
+fi
+rsyncd_port=`expr 10000 + ${masterPort}`
+
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+start=`date +"%s"`
+
+if [[ ! -f ${prog}-enabled ]]
+then
+    logMessage snappuller disabled
+    exit 1
+fi
+
+# make sure we can ssh to master
+if
+    ! ssh -o StrictHostKeyChecking=no ${masterHost} id 1>/dev/null 2>&1
+then
+    logMessage failed to ssh to master ${masterHost}
+    exit 1
+fi
+
+# get directory name of latest snapshot if not specified on command line
+if [[ -z ${name} ]]
+then
+    name=`ssh -o StrictHostKeyChecking=no ${masterHost} "ls -d ${MASTER_ROOT}/snapshot.* 2>/dev/null"|tail -1`
+fi
+
+# clean up after INT/TERM
+trap 'echo cleaning up, please wait ...;/bin/rm -rf ${name} ${name}-wip;echo ${startStatus} aborted:$(timeStamp)>logs/snappuller.status;logExit aborted 13' INT TERM
+
+if [[ -d ${name} || -d ${name}-wip || "${name}" == "" ]]
+then
+    logMessage no new snapshot available on ${masterHost}:${masterPort}
+    logExit ended 0
+fi
+
+# take a snapshot of current index so that only modified files will be rsync-ed
+# put the snapshot in the 'work-in-progress" directory to prevent it from
+# being installed while the copying is still in progress
+cp -lr index ${name}-wip
+# force rsync of segments and .del files since we are doing size-only
+if [[ -n ${sizeonly} ]]
+then
+    rm -f ${name}-wip/segments
+    rm -f ${name}-wip/*.del
+fi
+
+logMessage pulling snapshot ${name}
+
+# make sure master has directory for hold slaves stats/state
+ssh -o StrictHostKeyChecking=no ${masterHost} mkdir -p ${MASTER_ROOT}/logs/clients
+
+# start new distribution stats
+rsyncStart=`date`
+startTimestamp=`date -d "$rsyncStart" +'%Y%m%d-%H%M%S'`
+rsyncStartSec=`date -d "$rsyncStart" +'%s'`
+startStatus="rsync of `basename ${name}` started:$startTimestamp"
+echo ${startStatus} > logs/snappuller.status
+# push stats/state to master
+scp -q -o StrictHostKeyChecking=no logs/snappuller.status ${masterHost}:${MASTER_ROOT}/logs/clients/snapshot.status.`uname -n`
+
+# rsync over files that have changed
+rsync -Wa${verbose}${compress} --delete ${sizeonly} \
+${stats} rsync://${masterHost}:${rsyncd_port}/solar/`basename ${name}`/ `basename ${name}-wip`
+
+rc=$?
+rsyncEnd=`date`
+endTimestamp=`date -d "$rsyncEnd" +'%Y%m%d-%H%M%S'`
+rsyncEndSec=`date -d "$rsyncEnd" +'%s'`
+elapsed=`expr $rsyncEndSec - $rsyncStartSec`
+if [[ $rc != 0 ]]
+then
+  logMessage rsync failed
+  /bin/rm -rf ${name}-wip
+  echo ${startStatus} failed:$endTimestamp > logs/snappuller.status
+  logExit failed 1
+fi
+
+# move into place atomically
+mv ${name}-wip ${name}
+
+# finish new distribution stats`
+echo ${startStatus} ended:$endTimestamp rsync-elapsed:${elapsed} > logs/snappuller.status
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/snappuller
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/snappuller
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/snappuller-disable
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/snappuller-disable?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/snappuller-disable (added)
+++ incubator/solr/trunk/src/scripts/snappuller-disable Wed Jan 25 21:37:29 2006
@@ -0,0 +1,89 @@
+#!/bin/bash
+#
+# $Id: snappuller-disable.template,v 1.4 2005/06/20 20:43:55 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/snappuller-disable.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to disable snappuller
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/snappuller.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage disabled by $oldwhoami
+logMessage command: $0 $originalargs
+name=snappuller-enabled
+
+if [[ -f ${name} ]]
+then
+    rm -f ${name}
+else
+    logMessage snappuller not currently enabled
+    logExit exited 1
+fi
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/snappuller-disable
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/snappuller-disable
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/snappuller-enable
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/snappuller-enable?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/snappuller-enable (added)
+++ incubator/solr/trunk/src/scripts/snappuller-enable Wed Jan 25 21:37:29 2006
@@ -0,0 +1,89 @@
+#!/bin/bash
+#
+# $Id: snappuller-enable.template,v 1.4 2005/06/20 20:43:56 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/snappuller-enable.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to enable snappuller
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+  oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/snappuller.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+unset verbose
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+start=`date +"%s"`
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+cd ${0%/*}/../..
+logMessage enabled by $oldwhoami
+logMessage command: $0 $originalargs
+name=snappuller-enabled
+
+if [[ -f ${name} ]]
+then
+    logMessage snappuller already currently enabled
+    logExit exited 1
+else
+    touch ${name}
+fi
+
+logExit ended 0

Propchange: incubator/solr/trunk/src/scripts/snappuller-enable
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/snappuller-enable
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/scripts/snapshooter
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/scripts/snapshooter?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/scripts/snapshooter (added)
+++ incubator/solr/trunk/src/scripts/snapshooter Wed Jan 25 21:37:29 2006
@@ -0,0 +1,124 @@
+#!/bin/bash
+#
+# $Id: snapshooter.template,v 1.9 2005/06/09 15:34:07 billa Exp $
+# $Source: /cvs/main/searching/solar-tools/snapshooter.template,v $
+# $Name: r20050725_standardized_server_enabled $
+#
+# Shell script to take a snapshot of a SOLAR Lucene collection.
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+# sudo to app user if necessary
+if [[ $(whoami) != app ]]
+then
+    sudo -u app $0 "$@"
+    exit $?
+fi
+
+oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')
+
+if [[ "${oldwhoami}" == "" ]]
+then
+    oldwhoami=`ps h -Hfp $(pgrep -g0 ${0##*/}) | tail -1|cut -f1 -d" "`
+fi
+
+# set up variables
+prog=${0##*/}
+log=logs/${prog}.log
+
+# define usage string
+USAGE="\
+usage: $prog [ -v ]
+       -v          increase verbosity
+"
+
+cd ${0%/*}/../..
+SERVER_ROOT=$(pwd)
+
+unset verbose
+
+# check for config file
+confFile=${SERVER_ROOT}/conf/distribution.conf
+if
+  [[ ! -f $confFile ]]
+then
+  echo "unable to find configuration file: $confFile" >&2
+  exit 1
+fi
+# source the config file
+. $confFile
+
+if [[ "${solar_role}" == "slave" ]]
+then
+  echo "$prog disabled on slave server" >&2
+  exit 1
+fi
+
+# parse args
+originalargs="$@"
+while getopts v OPTION
+do
+    case $OPTION in
+    v)
+        verbose="v"
+        ;;
+    *)
+        echo "$USAGE"
+        exit 1
+    esac
+done
+shift $(( OPTIND - 1 ))
+
+function timeStamp
+{
+    date +'%Y%m%d-%H%M%S'
+}
+
+function logMessage
+{
+    echo $(timeStamp) $@>>$log
+    if [[ -n ${verbose} ]]
+    then
+	echo $@
+    fi
+}
+
+function logExit
+{
+    end=`date +"%s"`
+    diff=`expr $end - $start`
+    echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log
+    exit $2
+}
+
+logMessage started by $oldwhoami
+logMessage command: $0 $originalargs
+start=`date +"%s"`
+
+name=snapshot.`date +"%Y%m%d%H%M%S"`
+temp=temp-${name}
+
+if [[ -d ${name} ]]
+then
+    logMessage snapshot directory ${name} already exists
+    logExit aborted 1
+fi
+
+if [[ -d ${temp} ]]
+then
+    logMessage snapshoting of ${name} in progress
+    logExit aborted 1
+fi
+
+# clean up after INT/TERM
+trap 'echo cleaning up, please wait ...;/bin/rm -rf ${name} ${temp};logExit aborted 13' INT TERM
+
+logMessage taking snapshot ${name}
+
+# take a snapshot using hard links into temporary location
+# then move it into place atomically
+cp -lr index ${temp}
+mv ${temp} ${name}
+
+logExit ended 0
+

Propchange: incubator/solr/trunk/src/scripts/snapshooter
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/solr/trunk/src/scripts/snapshooter
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/solr/trunk/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/WEB-INF/web.xml?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/webapp/WEB-INF/web.xml (added)
+++ incubator/solr/trunk/src/webapp/WEB-INF/web.xml Wed Jan 25 21:37:29 2006
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Tomcat fails if it can't find the DTD
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
+" "http://java.sun.com/dtd/web-app_2_3.dtd" [
+    <!ENTITY web.external.xml SYSTEM "../../../conf/solar/WEB-INF/web.external.xml">
+]>
+-->
+
+<web-app>
+  <!-- resin specific way to add to the webapps classpath -->
+  <classpath id="../../conf/solar/WEB-INF/classes" />
+  <classpath id="../../conf/solar/WEB-INF/lib" library-dir="true" />
+
+  <!-- Use the default JDK5 XML implementation...
+    Resin3 has some missing/incompatible xpath features.  -->
+  <system-property javax.xml.xpath.XPathFactory=
+             "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl"/>
+  <system-property javax.xml.parsers.DocumentBuilderFactory=
+             "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
+  <system-property javax.xml.parsers.SAXParserFactory=
+             "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"/>
+
+  <servlet>
+
+    <servlet-name>SolrServer</servlet-name>
+    <display-name>SOLR</display-name>
+    <description>SOLR Server</description>
+    <servlet-class>org.apache.solr.servlet.SolrServlet</servlet-class>
+    <load-on-startup>0</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>SolrServer</servlet-name>
+    <url-pattern>/select/*</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+    <servlet-name>SolrServer</servlet-name>
+    <url-pattern>/update/*</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
+    <servlet-name>solar-status</servlet-name>
+    <jsp-file>/admin/solar-status.jsp</jsp-file>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>solar-status</servlet-name>
+    <url-pattern>/admin/solar-status</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
+    <servlet-name>ping</servlet-name>
+    <jsp-file>/admin/ping.jsp</jsp-file>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>ping</servlet-name>
+    <url-pattern>/admin/ping</url-pattern>
+  </servlet-mapping>
+
+  <!--  doesn't seem to work with tomcat
+  &web.external.xml;
+  -->
+
+</web-app>

Propchange: incubator/solr/trunk/src/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/solr/trunk/src/webapp/resources/admin/action.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/action.jsp?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/action.jsp (added)
+++ incubator/solr/trunk/src/webapp/resources/admin/action.jsp Wed Jan 25 21:37:29 2006
@@ -0,0 +1,156 @@
+<%@ page import="org.apache.solr.core.SolrCore,
+                 org.apache.solr.schema.IndexSchema,
+                 java.io.File,
+                 java.net.InetAddress,
+                 java.net.UnknownHostException"%>
+<%@ page import="java.util.Date"%>
+<%@ page import="java.util.logging.Level"%>
+<%@ page import="java.util.logging.Logger"%>
+<%
+  SolrCore core = SolrCore.getSolrCore();
+  IndexSchema schema = core.getSchema();
+  String collectionName = schema!=null ? schema.getName():"unknown";
+
+  String action = request.getParameter("action");
+  String logging = request.getParameter("log");
+  String enableActionStatus = "";
+  boolean isValid = false;
+  boolean wasOk = true;
+
+  String rootdir = "/var/opt/resin3/"+request.getServerPort();
+  File pidFile = new File(rootdir + "/logs/resin.pid");
+  String startTime = "";
+
+  try {
+    startTime = (pidFile.lastModified() > 0)
+              ? new Date(pidFile.lastModified()).toString()
+                    : "No Resin Pid found (logs/resin.pid)";
+  } catch (Exception e) {
+    out.println("<ERROR>");
+    out.println("Couldn't open Solr pid file:" + e.toString());
+    out.println("</ERROR>");
+  }
+
+  File enableFile = new File(rootdir + "/logs/server-enabled");
+
+  if (action != null) {
+    // Validate fname
+    if ("Enable".compareTo(action) == 0) isValid = true;
+    if ("Disable".compareTo(action) == 0) isValid = true;
+  }
+  if (logging != null) {
+    action = "Set Log Level";
+    isValid = true;
+  }
+  if (isValid) {
+    if ("Enable".compareTo(action) == 0) {
+      try {
+        if (enableFile.createNewFile()) {
+          enableActionStatus += "Enable Succeeded";
+        } else {
+          enableActionStatus += "Already Enabled";
+        }
+      } catch(Exception e) {
+          enableActionStatus += "Enable Failed: " + e.toString();
+          wasOk = false;
+      }
+    }
+    if ("Disable".compareTo(action) == 0) {
+      try {
+        if (enableFile.delete()) {
+          enableActionStatus = "Disable Succeeded";
+        } else {
+          enableActionStatus = "Already Disabled";
+        }
+      } catch(Exception e) {
+          enableActionStatus += "Disable Failed: " + e.toString();
+          wasOk = false;
+      }
+    }
+    if (logging != null) {
+      try {
+        Logger log = SolrCore.log;
+        Logger parent = log.getParent();
+        while (parent != null) {
+          log = parent;
+          parent = log.getParent();
+        }
+        log.setLevel(Level.parse(logging));
+        enableActionStatus = "Set Log Level (" + logging + ") Succeeded";
+      } catch(Exception e) {
+          enableActionStatus += "Set Log Level (" + logging + ") Failed: "
+                                 + e.toString();
+          wasOk = false;
+      }
+    }
+  } else {
+    enableActionStatus = "Illegal Action";
+  }
+
+  String hostname="localhost";
+  try {
+    InetAddress addr = InetAddress.getLocalHost();
+    // Get IP Address
+    byte[] ipAddr = addr.getAddress();
+    // Get hostname
+    // hostname = addr.getHostName();
+    hostname = addr.getCanonicalHostName();
+  } catch (UnknownHostException e) {}
+%>
+<%
+  if (wasOk) {
+%>
+<meta http-equiv="refresh" content="4;url=index.jsp">
+<%
+  }
+%>
+<html>
+<head>
+    <link rel="stylesheet" type="text/css" href="/admin/solr-admin.css">
+    <link rel="icon" href="/favicon.ico" type="image/ico">
+    <link rel="shortcut icon" href="/favicon.ico" type="image/ico">
+</head>
+<body>
+<a href="/admin/"><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
+<h1>SOLR Action (<%= collectionName %>) - <%= action %></h1>
+<%= hostname %> : <%= request.getServerPort() %>
+<br clear="all">
+<table>
+  <tr>
+    <td>
+      <H3>Action:</H3>
+    </td>
+    <td>
+      <%= action %><br>
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <H4>Result:</H4>
+    </td>
+    <td>
+      <%= enableActionStatus %><br>
+    </td>
+  </tr>
+</table>
+<br>
+<table>
+  <tr>
+    <td>
+    </td>
+    <td>
+      Current Time: <%= new Date().toString() %>
+    </td>
+  </tr>
+  <tr>
+    <td>
+    </td>
+    <td>
+      Server Start At: <%= startTime %>
+    </td>
+  </tr>
+</table>
+<br><br>
+    <a href="/admin">Return to Admin Page</a>
+</body>
+</html>

Propchange: incubator/solr/trunk/src/webapp/resources/admin/action.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp (added)
+++ incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp Wed Jan 25 21:37:29 2006
@@ -0,0 +1,451 @@
+<%@ page import="org.apache.lucene.analysis.Analyzer,
+                 org.apache.lucene.analysis.Token,
+                 org.apache.lucene.analysis.TokenStream,
+                 org.apache.solr.analysis.TokenFilterFactory,
+                 org.apache.solr.analysis.TokenizerChain,
+                 org.apache.solr.analysis.TokenizerFactory,
+                 org.apache.solr.core.SolrConfig,
+                 org.apache.solr.core.SolrCore,
+                 org.apache.solr.schema.FieldType,
+                 org.apache.solr.schema.IndexSchema,org.apache.solr.schema.SchemaField
+                "%>
+<%@ page import="org.apache.solr.util.XML"%>
+<%@ page import="javax.servlet.jsp.JspWriter"%>
+<%@ page import="java.io.File"%>
+<%@ page import="java.io.IOException"%>
+<%@ page import="java.io.Reader"%>
+<%@ page import="java.io.StringReader"%>
+<%@ page import="java.net.InetAddress"%>
+<%@ page import="java.net.UnknownHostException"%>
+<%@ page import="java.util.*"%>
+<!-- $Id: analysis.jsp,v 1.2 2005/09/20 18:23:30 yonik Exp $ -->
+<!-- $Source: /cvs/main/searching/org.apache.solrolarServer/resources/admin/analysis.jsp,v $ -->
+<!-- $Name:  $ -->
+
+<%
+  SolrCore core = SolrCore.getSolrCore();
+  IndexSchema schema = core.getSchema();
+
+  String rootdir = "/var/opt/resin3/"+request.getServerPort();
+  File pidFile = new File(rootdir + "/logs/resin.pid");
+  File enableFile = new File(rootdir + "/logs/server-enabled");
+  boolean isEnabled = false;
+  String enabledStatus = "";
+  String enableActionStatus = "";
+  String makeEnabled = "";
+  String action = request.getParameter("action");
+  String startTime = "";
+
+  try {
+    startTime = (pidFile.lastModified() > 0)
+      ? new Date(pidFile.lastModified()).toString()
+      : "No Resin Pid found (logs/resin.pid)";
+  } catch (Exception e) {
+    out.println("<ERROR>");
+    out.println("Couldn't open Solr pid file:" + e.toString());
+    out.println("</ERROR>");
+  }
+
+
+  try {
+    isEnabled = (enableFile.lastModified() > 0);
+    enabledStatus = (isEnabled)
+      ? "Enabled"
+      : "Disabled";
+    makeEnabled = (isEnabled)
+      ? "Disable"
+      : "Enable";
+  } catch (Exception e) {
+    out.println("<ERROR>");
+    out.println("Couldn't check server-enabled file:" + e.toString());
+    out.println("</ERROR>");
+  }
+
+  String collectionName = schema!=null ? schema.getName():"unknown";
+  String hostname="localhost";
+  String defaultSearch= SolrConfig.config.get("admin/defaultQuery","");
+  try {
+    InetAddress addr = InetAddress.getLocalHost();
+    // Get IP Address
+    byte[] ipAddr = addr.getAddress();
+    // Get hostname
+    // hostname = addr.getHostName();
+    hostname = addr.getCanonicalHostName();
+  } catch (UnknownHostException e) {}
+%>
+
+<%
+  String name = request.getParameter("name");
+  if (name==null || name.length()==0) name="";
+  String val = request.getParameter("val");
+  if (val==null || val.length()==0) val="";
+  String qval = request.getParameter("qval");
+  if (qval==null || qval.length()==0) qval="";
+  String verboseS = request.getParameter("verbose");
+  boolean verbose = verboseS!=null && verboseS.equalsIgnoreCase("on");
+  String qverboseS = request.getParameter("qverbose");
+  boolean qverbose = qverboseS!=null && qverboseS.equalsIgnoreCase("on");
+  String highlightS = request.getParameter("highlight");
+  boolean highlight = highlightS!=null && highlightS.equalsIgnoreCase("on");
+%>
+
+
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="/admin/solr-admin.css">
+<link rel="icon" href="/favicon.ico" type="image/ico">
+<link rel="shortcut icon" href="/favicon.ico" type="image/ico">
+<title>SOLR Interface</title>
+</head>
+
+<body>
+<a href="/admin/"><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
+<h1>SOLR Interface (<%= collectionName %>) - <%= enabledStatus %></h1>
+<%= hostname %> : <%= request.getServerPort() %>
+<br clear="all">
+
+
+<h2>Field Analysis</h2>
+
+<form method="GET" action="/admin/analysis.jsp">
+<table>
+<tr>
+  <td>
+	<strong>Field name</strong>
+  </td>
+  <td>
+	<input name="name" type="text" value="<%= name %>">
+  </td>
+</tr>
+<tr>
+  <td>
+	<strong>Field value (Index)</strong>
+  <br/>
+  verbose output
+  <input name="verbose" type="checkbox"
+     <%= verbose ? "checked=\"true\"" : "" %> >
+    <br/>
+  highlight matches
+  <input name="highlight" type="checkbox"
+     <%= highlight ? "checked=\"true\"" : "" %> >
+  </td>
+  <td>
+	<textarea rows="3" cols="70" name="val"><%= val %></textarea>
+  </td>
+</tr>
+<tr>
+  <td>
+	<strong>Field value (Query)</strong>
+  <br/>
+  verbose output
+  <input name="qverbose" type="checkbox"
+     <%= qverbose ? "checked=\"true\"" : "" %> >
+  </td>
+  <td>
+	<textarea rows="1" cols="70" name="qval"><%= qval %></textarea>
+  </td>
+</tr>
+<tr>
+
+  <td>
+  </td>
+
+  <td>
+	<input type="submit" value="analyze">
+  </td>
+
+</tr>
+</table>
+</form>
+
+
+<%
+  SchemaField field=null;
+
+  if (name!="") {
+    try {
+      field = schema.getField(name);
+    } catch (Exception e) {
+      out.println("<strong>Unknown Field " + name + "</strong>");
+    }
+  }
+
+  if (field!=null) {
+    HashSet<Tok> matches = null;
+    if (qval!="" && highlight) {
+      Reader reader = new StringReader(qval);
+      Analyzer analyzer =  field.getType().getQueryAnalyzer();
+      TokenStream tstream = analyzer.tokenStream(field.getName(),reader);
+      List<Token> tokens = getTokens(tstream);
+      matches = new HashSet<Tok>();
+      for (Token t : tokens) { matches.add( new Tok(t,0)); }
+    }
+
+    if (val!="") {
+      out.println("<h3>Index Analyzer</h3>");
+      doAnalyzer(out, field, val, false, verbose,matches);
+    }
+    if (qval!="") {
+      out.println("<h3>Query Analyzer</h3>");
+      doAnalyzer(out, field, qval, true, qverbose,null);
+    }
+  }
+
+%>
+
+
+</body>
+</html>
+
+
+<%!
+  private static void doAnalyzer(JspWriter out, SchemaField field, String val, boolean queryAnalyser, boolean verbose, Set<Tok> match) throws Exception {
+    Reader reader = new StringReader(val);
+
+    FieldType ft = field.getType();
+     Analyzer analyzer = queryAnalyser ?
+             ft.getQueryAnalyzer() : ft.getAnalyzer();
+     if (analyzer instanceof TokenizerChain) {
+       TokenizerChain tchain = (TokenizerChain)analyzer;
+       TokenizerFactory tfac = tchain.getTokenizerFactory();
+       TokenFilterFactory[] filtfacs = tchain.getTokenFilterFactories();
+
+       TokenStream tstream = tfac.create(reader);
+       List<Token> tokens = getTokens(tstream);
+       tstream = tfac.create(reader);
+       if (verbose) {
+         writeHeader(out, tfac.getClass(), tfac.getArgs());
+       }
+
+       writeTokens(out, tokens, ft, verbose, match);
+
+       for (TokenFilterFactory filtfac : filtfacs) {
+         if (verbose) {
+           writeHeader(out, filtfac.getClass(), filtfac.getArgs());
+         }
+
+         final Iterator<Token> iter = tokens.iterator();
+         tstream = filtfac.create( new TokenStream() {
+           public Token next() throws IOException {
+             return iter.hasNext() ? iter.next() : null;
+           }
+          }
+         );
+         tokens = getTokens(tstream);
+
+         writeTokens(out, tokens, ft, verbose, match);
+       }
+
+     } else {
+       TokenStream tstream = analyzer.tokenStream(field.getName(),reader);
+       List<Token> tokens = getTokens(tstream);
+       if (verbose) {
+         writeHeader(out, analyzer.getClass(), new HashMap<String,String>());
+       }
+       writeTokens(out, tokens, ft, verbose, match);
+     }
+  }
+
+
+  static List<Token> getTokens(TokenStream tstream) throws IOException {
+    List<Token> tokens = new ArrayList<Token>();
+    while (true) {
+      Token t = tstream.next();
+      if (t==null) break;
+      tokens.add(t);
+    }
+    return tokens;
+  }
+
+
+  private static class Tok {
+    Token token;
+    int pos;
+    Tok(Token token, int pos) {
+      this.token=token;
+      this.pos=pos;
+    }
+
+    public boolean equals(Object o) {
+      return ((Tok)o).token.termText().equals(token.termText());
+    }
+    public int hashCode() {
+      return token.termText().hashCode();
+    }
+    public String toString() {
+      return token.termText();
+    }
+  }
+
+  private static interface ToStr {
+    public String toStr(Object o);
+  }
+
+  private static void printRow(JspWriter out, String header, List[] arrLst, ToStr converter, boolean multival, boolean verbose, Set<Tok> match) throws IOException {
+    // find the maximum number of terms for any position
+    int maxSz=1;
+    if (multival) {
+      for (List lst : arrLst) {
+        maxSz = Math.max(lst.size(), maxSz);
+      }
+    }
+
+
+    for (int idx=0; idx<maxSz; idx++) {
+      out.println("<tr>");
+      if (idx==0 && verbose) {
+        if (header != null) {
+          out.print("<th NOWRAP rowspan=\""+maxSz+"\">");
+          XML.escapeCharData(header,out);
+          out.println("</th>");
+        }
+      }
+
+      for (List<Tok> lst : arrLst) {
+        if (lst.size() <= idx) continue;
+        if (match!=null && match.contains(lst.get(idx))) {
+          out.print("<td name=\"highlight\"");
+        } else {
+          out.print("<td name=\"debugdata\"");
+        }
+
+        if (idx==0 && lst.size()==1 && maxSz > 1) {
+          out.print("rowspan=\""+maxSz+'"');
+        }
+
+        out.print('>');
+
+        XML.escapeCharData(converter.toStr(lst.get(idx)), out);
+        out.print("</td>");
+      }
+
+      out.println("</tr>");
+    }
+
+  }
+
+
+
+  static void writeHeader(JspWriter out, Class clazz, Map<String,String> args) throws IOException {
+    out.print("<h4>");
+    out.print(clazz.getName());
+    XML.escapeCharData("   "+args,out);
+    out.println("</h4>");
+  }
+
+
+
+  // readable, raw, pos, type, start/end
+  static void writeTokens(JspWriter out, List<Token> tokens, final FieldType ft, boolean verbose, Set<Tok> match) throws IOException {
+
+    // Use a map to tell what tokens are in what positions
+    // because some tokenizers/filters may do funky stuff with
+    // very large increments, or negative increments.
+    HashMap<Integer,List<Tok>> map = new HashMap<Integer,List<Tok>>();
+    boolean needRaw=false;
+    int pos=0;
+    for (Token t : tokens) {
+      if (!t.termText().equals(ft.indexedToReadable(t.termText()))) {
+        needRaw=true;
+      }
+
+      pos += t.getPositionIncrement();
+      List lst = map.get(pos);
+      if (lst==null) {
+        lst = new ArrayList(1);
+        map.put(pos,lst);
+      }
+      Tok tok = new Tok(t,pos);
+      lst.add(tok);
+    }
+
+    List<Tok>[] arr = (List<Tok>[])map.values().toArray(new ArrayList[map.size()]);
+
+    /***
+    // This generics version works fine with Resin, but fails with Tomcat 5.5
+    // with java.lang.AbstractMethodError
+    //    at java.util.Arrays.mergeSort(Arrays.java:1284)
+    //    at java.util.Arrays.sort(Arrays.java:1223) 
+    Arrays.sort(arr, new Comparator<List<Tok>>() {
+      public int compare(List<Tok> toks, List<Tok> toks1) {
+        return toks.get(0).pos - toks1.get(0).pos;
+      }
+    }
+    ***/
+    Arrays.sort(arr, new Comparator() {
+      public int compare(Object a, Object b) {
+        List<Tok> toks = (List<Tok>)a;
+        List<Tok> toks1 = (List<Tok>)b;
+        return toks.get(0).pos - toks1.get(0).pos;
+      }
+    }
+
+    );
+
+    out.println("<table width=\"auto\" name=\"table\" border=\"1\">");
+
+    if (verbose) {
+      printRow(out,"term position", arr, new ToStr() {
+        public String toStr(Object o) {
+          return Integer.toString(((Tok)o).pos);
+        }
+      }
+              ,false
+              ,verbose
+              ,null);
+    }
+
+
+    printRow(out,"term text", arr, new ToStr() {
+      public String toStr(Object o) {
+        return ft.indexedToReadable( ((Tok)o).token.termText() );
+      }
+    }
+            ,true
+            ,verbose
+            ,match
+   );
+
+    if (needRaw) {
+      printRow(out,"raw text", arr, new ToStr() {
+        public String toStr(Object o) {
+          // todo: output in hex or something?
+          // check if it's all ascii or not?
+          return ((Tok)o).token.termText();
+        }
+      }
+              ,true
+              ,verbose
+              ,match
+      );
+    }
+
+    if (verbose) {
+      printRow(out,"term type", arr, new ToStr() {
+        public String toStr(Object o) {
+          return  ((Tok)o).token.type();
+        }
+      }
+              ,true
+              ,verbose,
+              null
+      );
+    }
+
+    if (verbose) {
+      printRow(out,"source start,end", arr, new ToStr() {
+        public String toStr(Object o) {
+          Token t = ((Tok)o).token;
+          return Integer.toString(t.startOffset()) + ',' + t.endOffset() ;
+        }
+      }
+              ,true
+              ,verbose
+              ,null
+      );
+    }
+
+    out.println("</table>");
+  }
+
+%>

Propchange: incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/solr/trunk/src/webapp/resources/admin/distributiondump.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/distributiondump.jsp?rev=372455&view=auto
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/distributiondump.jsp (added)
+++ incubator/solr/trunk/src/webapp/resources/admin/distributiondump.jsp Wed Jan 25 21:37:29 2006
@@ -0,0 +1,141 @@
+<%@ page import="org.apache.solr.core.SolrCore,
+                 org.apache.solr.schema.IndexSchema,
+                 java.io.BufferedReader,
+                 java.io.File,
+                 java.io.FileReader,
+                 java.net.InetAddress,
+                 java.net.UnknownHostException,
+                 java.util.Date"%>
+<%
+  SolrCore core = SolrCore.getSolrCore();
+  Integer port = new Integer(request.getServerPort());
+  IndexSchema schema = core.getSchema();
+  String collectionName = schema!=null ? schema.getName():"unknown";
+
+  String rootdir = "/var/opt/resin3/"+port.toString();
+  File pidFile = new File(rootdir + "/logs/resin.pid");
+  String startTime = "";
+
+  try {
+    startTime = (pidFile.lastModified() > 0)
+              ? new Date(pidFile.lastModified()).toString()
+                    : "No Resin Pid found (logs/resin.pid)";
+  } catch (Exception e) {
+    out.println("<ERROR>");
+    out.println("Couldn't open Solr pid file:" + e.toString());
+    out.println("</ERROR>");
+  }
+
+  String hostname="localhost";
+  try {
+    InetAddress addr = InetAddress.getLocalHost();
+    // Get IP Address
+    byte[] ipAddr = addr.getAddress();
+    // Get hostname
+    // hostname = addr.getHostName();
+    hostname = addr.getCanonicalHostName();
+  } catch (UnknownHostException e) {}
+
+  File slaveinfo = new File(rootdir + "/logs/snappuller.status");
+
+  StringBuffer buffer = new StringBuffer();
+  String mode = "";
+
+  if (slaveinfo.canRead()) {
+    // Slave instance
+    mode = "Slave";
+    File slavevers = new File(rootdir + "/logs/snapshot.current");
+    BufferedReader inforeader = new BufferedReader(new FileReader(slaveinfo));
+    BufferedReader versreader = new BufferedReader(new FileReader(slavevers));
+    buffer.append("<tr>\n" +
+                    "<td>\n" +
+                      "Version:" +
+                    "</td>\n" +
+                    "<td>\n")
+          .append(    versreader.readLine())
+          .append(  "<td>\n" +
+                    "</td>\n" +
+                  "</tr>\n" +
+                  "<tr>\n" +
+                    "<td>\n" +
+                      "Status:" +
+                    "</td>\n" +
+                    "<td>\n")
+          .append(    inforeader.readLine())
+          .append(  "</td>\n" +
+                  "</tr>\n");
+  } else {
+    // Master instance
+    mode = "Master";
+    File masterdir = new File(rootdir + "/logs/clients");
+    File[] clients = masterdir.listFiles();
+    if (clients == null) {
+      buffer.append("<tr>\n" +
+                      "<td>\n" +
+                      "</td>\n" +
+                      "<td>\n" +
+                        "No distribution info present" +
+                      "</td>\n" +
+                    "</tr>\n");
+    } else {
+      int i = 0;
+      while (i < clients.length) {
+        BufferedReader reader = new BufferedReader(new FileReader(clients[i]));
+        buffer.append("<tr>\n" +
+                        "<td>\n" +
+                        "Client:" +
+                        "</td>\n" +
+                        "<td>\n")
+              .append(    clients[i].toString())
+              .append(  "</td>\n" +
+                      "</tr>\n" +
+                      "<tr>\n" +
+                        "<td>\n" +
+                        "</td>\n" +
+                        "<td>\n")
+              .append(    reader.readLine())
+              .append(  "</td>\n" +
+                      "</tr>\n" +
+                      "<tr>\n" +
+                      "</tr>\n");
+        i++;
+      }
+    }
+  }
+%>
+<html>
+<head>
+    <link rel="stylesheet" type="text/css" href="/admin/solr-admin.css">
+    <link rel="icon" href="/favicon.ico" type="image/ico">
+    <link rel="shortcut icon" href="/favicon.ico" type="image/ico">
+</head>
+<body>
+<a href="/admin/"><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
+<h1>SOLR Distribution Info (<%= collectionName %>)</h1>
+<%= hostname %> : <%= port.toString() %>
+<br clear="all">
+<table>
+  <tr>
+    <td>
+    </td>
+    <td>
+      Current Time: <%= new Date().toString() %>
+    </td>
+  </tr>
+  <tr>
+    <td>
+    </td>
+    <td>
+      Server Start At: <%= startTime %>
+    </td>
+  </tr>
+</table>
+<br>
+<h3><%= mode %> Status</h3>
+<table>
+<%= buffer %>
+</table>
+<br><br>
+    <a href="/admin">Return to Admin Page</a>
+</body>
+</html>

Propchange: incubator/solr/trunk/src/webapp/resources/admin/distributiondump.jsp
------------------------------------------------------------------------------
    svn:eol-style = native