lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1377705 [2/2] - in /lucene/dev/branches/branch_4x: ./ dev-tools/ dev-tools/idea/.idea/libraries/ lucene/ lucene/analysis/ lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ lucene/analysis/common/src/resources/META-INF/servic...
Date Mon, 27 Aug 2012 14:59:04 GMT
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/hash/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/hash/package.html?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/hash/package.html (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/hash/package.html Mon Aug 27 14:58:55 2012
@@ -1,25 +1,25 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<!--
- 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.
--->
-<html>
-<head>
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-<body>
-Hashing functions load-able via SPI service
-</body>
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ 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.
+-->
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body>
+Hashing functions load-able via SPI service
+</body>
 </html>
\ No newline at end of file

Modified: lucene/dev/branches/branch_4x/lucene/core/src/resources/META-INF/services/org.apache.lucene.util.hash.HashFunction
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/resources/META-INF/services/org.apache.lucene.util.hash.HashFunction?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/resources/META-INF/services/org.apache.lucene.util.hash.HashFunction (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/resources/META-INF/services/org.apache.lucene.util.hash.HashFunction Mon Aug 27 14:58:55 2012
@@ -1,16 +1,16 @@
-#  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.
-
-org.apache.lucene.util.hash.MurmurHash2
+#  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.
+
+org.apache.lucene.util.hash.MurmurHash2

Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java Mon Aug 27 14:58:55 2012
@@ -1,77 +1,77 @@
-package org.apache.lucene.codecs.bloom;
-
-/**
- * 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.
- */
-
-import java.io.IOException;
-
-import org.apache.lucene.codecs.FieldsConsumer;
-import org.apache.lucene.codecs.FieldsProducer;
-import org.apache.lucene.codecs.PostingsFormat;
-import org.apache.lucene.codecs.bloom.BloomFilteringPostingsFormat;
-import org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat;
-import org.apache.lucene.index.FieldInfo;
-import org.apache.lucene.index.SegmentReadState;
-import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.util.FuzzySet;
-import org.apache.lucene.util.hash.MurmurHash2;
-
-/**
- * A class used for testing {@link BloomFilteringPostingsFormat} with a concrete
- * delegate (Lucene40). Creates a Bloom filter on ALL fields and with tiny
- * amounts of memory reserved for the filter. DO NOT USE IN A PRODUCTION
- * APPLICATION This is not a realistic application of Bloom Filters as they
- * ordinarily are larger and operate on only primary key type fields.
- */
-public class TestBloomFilteredLucene40Postings extends PostingsFormat {
-  
-  private BloomFilteringPostingsFormat delegate;
-  
-  // Special class used to avoid OOM exceptions where Junit tests create many
-  // fields.
-  static class LowMemoryBloomFactory extends BloomFilterFactory {
-    @Override
-    public FuzzySet getSetForField(SegmentWriteState state,FieldInfo info) {
-      return FuzzySet.createSetBasedOnMaxMemory(1024, new MurmurHash2());
-    }
-    
-    @Override
-    public boolean isSaturated(FuzzySet bloomFilter, FieldInfo fieldInfo) {
-      // For test purposes always maintain the BloomFilter - even past the point
-      // of usefulness when all bits are set
-      return false;
-    }
-  }
-  
-  public TestBloomFilteredLucene40Postings() {
-    super("TestBloomFilteredLucene40Postings");
-    delegate = new BloomFilteringPostingsFormat(new Lucene40PostingsFormat(),
-        new LowMemoryBloomFactory());
-  }
-  
-  @Override
-  public FieldsConsumer fieldsConsumer(SegmentWriteState state)
-      throws IOException {
-    return delegate.fieldsConsumer(state);
-  }
-  
-  @Override
-  public FieldsProducer fieldsProducer(SegmentReadState state)
-      throws IOException {
-    return delegate.fieldsProducer(state);
-  }
-}
+package org.apache.lucene.codecs.bloom;
+
+/**
+ * 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.
+ */
+
+import java.io.IOException;
+
+import org.apache.lucene.codecs.FieldsConsumer;
+import org.apache.lucene.codecs.FieldsProducer;
+import org.apache.lucene.codecs.PostingsFormat;
+import org.apache.lucene.codecs.bloom.BloomFilteringPostingsFormat;
+import org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat;
+import org.apache.lucene.index.FieldInfo;
+import org.apache.lucene.index.SegmentReadState;
+import org.apache.lucene.index.SegmentWriteState;
+import org.apache.lucene.util.FuzzySet;
+import org.apache.lucene.util.hash.MurmurHash2;
+
+/**
+ * A class used for testing {@link BloomFilteringPostingsFormat} with a concrete
+ * delegate (Lucene40). Creates a Bloom filter on ALL fields and with tiny
+ * amounts of memory reserved for the filter. DO NOT USE IN A PRODUCTION
+ * APPLICATION This is not a realistic application of Bloom Filters as they
+ * ordinarily are larger and operate on only primary key type fields.
+ */
+public class TestBloomFilteredLucene40Postings extends PostingsFormat {
+  
+  private BloomFilteringPostingsFormat delegate;
+  
+  // Special class used to avoid OOM exceptions where Junit tests create many
+  // fields.
+  static class LowMemoryBloomFactory extends BloomFilterFactory {
+    @Override
+    public FuzzySet getSetForField(SegmentWriteState state,FieldInfo info) {
+      return FuzzySet.createSetBasedOnMaxMemory(1024, new MurmurHash2());
+    }
+    
+    @Override
+    public boolean isSaturated(FuzzySet bloomFilter, FieldInfo fieldInfo) {
+      // For test purposes always maintain the BloomFilter - even past the point
+      // of usefulness when all bits are set
+      return false;
+    }
+  }
+  
+  public TestBloomFilteredLucene40Postings() {
+    super("TestBloomFilteredLucene40Postings");
+    delegate = new BloomFilteringPostingsFormat(new Lucene40PostingsFormat(),
+        new LowMemoryBloomFactory());
+  }
+  
+  @Override
+  public FieldsConsumer fieldsConsumer(SegmentWriteState state)
+      throws IOException {
+    return delegate.fieldsConsumer(state);
+  }
+  
+  @Override
+  public FieldsProducer fieldsProducer(SegmentReadState state)
+      throws IOException {
+    return delegate.fieldsProducer(state);
+  }
+}

Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/package.html?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/package.html (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/package.html Mon Aug 27 14:58:55 2012
@@ -1,25 +1,25 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<!--
- 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.
--->
-<html>
-<head>
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-<body>
-Support for generating test indexes using the BloomFilteringPostingsFormat
-</body>
-</html>
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ 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.
+-->
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body>
+Support for generating test indexes using the BloomFilteringPostingsFormat
+</body>
+</html>

Modified: lucene/dev/branches/branch_4x/lucene/tools/src/java/lucene-solr.antlib.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/tools/src/java/lucene-solr.antlib.xml?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/tools/src/java/lucene-solr.antlib.xml (original)
+++ lucene/dev/branches/branch_4x/lucene/tools/src/java/lucene-solr.antlib.xml Mon Aug 27 14:58:55 2012
@@ -21,4 +21,7 @@
     <taskdef 
         name="forbidden-apis" 
         classname="org.apache.lucene.validation.ForbiddenApisCheckTask" />
+    <taskdef
+        name="svn-eol-style"
+        classname="org.apache.lucene.validation.SVNEolCheckTask" />
 </antlib> 

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/CircularList.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/CircularList.java?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/CircularList.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/CircularList.java Mon Aug 27 14:58:55 2012
@@ -1,154 +1,154 @@
-/*
- * 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.solr.logging;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * FIFO Circular List.
- * 
- * Once the size is reached, it will overwrite previous entries
- * 
- */
-public class CircularList<T> implements Iterable<T>
-{
-  private T[] data;
-  private int head=0;
-  private int tail=0;
-  private int size=0;
-
-  @SuppressWarnings("unchecked")
-  public CircularList(int size) {
-    data = (T[])new Object[size];
-  }
-
-  @SuppressWarnings("unchecked")
-  public synchronized void resize(int newsize) {
-    if(newsize==this.size) return;
-    
-    T[] vals = (T[])new Object[newsize];
-    int i = 0;
-    if(newsize>size) {
-      for(i=0; i<size; i++) {
-        vals[i] = data[convert(i)];
-      }
-    }
-    else {
-      int off=size-newsize;
-      for(i=0; i<newsize; i++) {
-        vals[i] = data[convert(i+off)];
-      }
-    }
-    data = vals;
-    head = 0;
-    tail = i;
-  }
-
-  private int convert(int index) {
-    return (index + head) % data.length;
-  }
-
-  public boolean isEmpty() {
-    return head == tail; // or size == 0
-  }
-
-  public int size() {
-    return size;
-  }
-  
-  public int getBufferSize() {
-    return data.length;
-  }
-
-  private void checkIndex(int index) {
-    if (index >= size || index < 0)
-      throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
-  }
-
-  public T get(int index) {
-    checkIndex(index);
-    return data[convert(index)];
-  }
-
-  public synchronized void add(T o) {
-    data[tail] = o;
-    tail = (tail+1)%data.length;
-    if( size == data.length ) {
-      head = (head+1)%data.length;
-    }
-    size++;
-    if( size > data.length ) {
-      size = data.length;
-    }
-  }
-
-  public synchronized void clear() {
-    for( int i=0; i<data.length; i++ ) {
-      data[i] = null;  // for GC
-    }
-    head = tail = size = 0;
-  }
-
-  public List<T> toList()
-  {
-    ArrayList<T> list = new ArrayList<T>( size );
-    for( int i=0; i<size; i++ ) {
-      list.add( data[convert(i)] );
-    }
-    return list;
-  }
-
-  @Override
-  public String toString()
-  {
-    StringBuilder str = new StringBuilder();
-    str.append( "[" );
-    for( int i=0; i<size; i++ ) {
-      if( i > 0 ) {
-        str.append( "," );
-      }
-      str.append( data[convert(i)] );
-    }
-    str.append( "]" );
-    return str.toString();
-  }
-
-  @Override
-  public Iterator<T> iterator() {
-    return new Iterator<T>() {
-      int idx = 0;
-
-      @Override
-      public boolean hasNext() {
-        return idx<size;
-      }
-
-      @Override
-      public T next() {
-        return get( idx++ );
-      }
-
-      @Override
-      public void remove() {
-        throw new UnsupportedOperationException();
-      }
-    };
-  }
-}
+/*
+ * 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.solr.logging;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * FIFO Circular List.
+ * 
+ * Once the size is reached, it will overwrite previous entries
+ * 
+ */
+public class CircularList<T> implements Iterable<T>
+{
+  private T[] data;
+  private int head=0;
+  private int tail=0;
+  private int size=0;
+
+  @SuppressWarnings("unchecked")
+  public CircularList(int size) {
+    data = (T[])new Object[size];
+  }
+
+  @SuppressWarnings("unchecked")
+  public synchronized void resize(int newsize) {
+    if(newsize==this.size) return;
+    
+    T[] vals = (T[])new Object[newsize];
+    int i = 0;
+    if(newsize>size) {
+      for(i=0; i<size; i++) {
+        vals[i] = data[convert(i)];
+      }
+    }
+    else {
+      int off=size-newsize;
+      for(i=0; i<newsize; i++) {
+        vals[i] = data[convert(i+off)];
+      }
+    }
+    data = vals;
+    head = 0;
+    tail = i;
+  }
+
+  private int convert(int index) {
+    return (index + head) % data.length;
+  }
+
+  public boolean isEmpty() {
+    return head == tail; // or size == 0
+  }
+
+  public int size() {
+    return size;
+  }
+  
+  public int getBufferSize() {
+    return data.length;
+  }
+
+  private void checkIndex(int index) {
+    if (index >= size || index < 0)
+      throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
+  }
+
+  public T get(int index) {
+    checkIndex(index);
+    return data[convert(index)];
+  }
+
+  public synchronized void add(T o) {
+    data[tail] = o;
+    tail = (tail+1)%data.length;
+    if( size == data.length ) {
+      head = (head+1)%data.length;
+    }
+    size++;
+    if( size > data.length ) {
+      size = data.length;
+    }
+  }
+
+  public synchronized void clear() {
+    for( int i=0; i<data.length; i++ ) {
+      data[i] = null;  // for GC
+    }
+    head = tail = size = 0;
+  }
+
+  public List<T> toList()
+  {
+    ArrayList<T> list = new ArrayList<T>( size );
+    for( int i=0; i<size; i++ ) {
+      list.add( data[convert(i)] );
+    }
+    return list;
+  }
+
+  @Override
+  public String toString()
+  {
+    StringBuilder str = new StringBuilder();
+    str.append( "[" );
+    for( int i=0; i<size; i++ ) {
+      if( i > 0 ) {
+        str.append( "," );
+      }
+      str.append( data[convert(i)] );
+    }
+    str.append( "]" );
+    return str.toString();
+  }
+
+  @Override
+  public Iterator<T> iterator() {
+    return new Iterator<T>() {
+      int idx = 0;
+
+      @Override
+      public boolean hasNext() {
+        return idx<size;
+      }
+
+      @Override
+      public T next() {
+        return get( idx++ );
+      }
+
+      @Override
+      public void remove() {
+        throw new UnsupportedOperationException();
+      }
+    };
+  }
+}

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/LogWatcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/LogWatcher.java?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/LogWatcher.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/LogWatcher.java Mon Aug 27 14:58:55 2012
@@ -1,107 +1,107 @@
-/*
- * 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.solr.logging;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.core.CoreContainer;
-
-/**
- * A Class to monitor Logging events and hold N events in memory
- * 
- * This is abstract so we can support both JUL and Log4j (and other logging platforms)
- */
-public abstract class LogWatcher<E> {
-  
-  protected CircularList<E> history;
-  protected long last = -1;
-  
-  /**
-   * @return The implementation name
-   */
-  public abstract String getName();
-  
-  /**
-   * @return The valid level names for this framework
-   */
-  public abstract List<String> getAllLevels();
-  
-  /**
-   * Sets the log level within this framework
-   */
-  public abstract void setLogLevel(String category, String level);
-  
-  /**
-   * @return all registered loggers
-   */
-  public abstract Collection<LoggerInfo> getAllLoggers();
-  
-  public abstract void setThreshold(String level);
-  public abstract String getThreshold();
-
-  public void add(E event, long timstamp) {
-    history.add(event);
-    last = timstamp;
-  }
-  
-  public long getLastEvent() {
-    return last;
-  }
-  
-  public int getHistorySize() {
-    return (history==null) ? -1 : history.getBufferSize();
-  }
-  
-  public SolrDocumentList getHistory(long since, AtomicBoolean found) {
-    if(history==null) {
-      return null;
-    }
-    
-    SolrDocumentList docs = new SolrDocumentList();
-    Iterator<E> iter = history.iterator();
-    while(iter.hasNext()) {
-      E e = iter.next();
-      long ts = getTimestamp(e);
-      if(ts == since) {
-        if(found!=null) {
-          found.set(true);
-        }
-      }
-      if(ts>since) {
-        docs.add(toSolrDocument(e));
-      }
-    }
-    docs.setNumFound(docs.size()); // make it not look too funny
-    return docs;
-  }
-  
-  public abstract long getTimestamp(E event);
-  public abstract SolrDocument toSolrDocument(E event);
-  
-  public abstract void registerListener(ListenerConfig cfg, CoreContainer container);
-
-  public void reset() {
-    history.clear();
-    last = -1;
-  }
+/*
+ * 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.solr.logging;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.core.CoreContainer;
+
+/**
+ * A Class to monitor Logging events and hold N events in memory
+ * 
+ * This is abstract so we can support both JUL and Log4j (and other logging platforms)
+ */
+public abstract class LogWatcher<E> {
+  
+  protected CircularList<E> history;
+  protected long last = -1;
+  
+  /**
+   * @return The implementation name
+   */
+  public abstract String getName();
+  
+  /**
+   * @return The valid level names for this framework
+   */
+  public abstract List<String> getAllLevels();
+  
+  /**
+   * Sets the log level within this framework
+   */
+  public abstract void setLogLevel(String category, String level);
+  
+  /**
+   * @return all registered loggers
+   */
+  public abstract Collection<LoggerInfo> getAllLoggers();
+  
+  public abstract void setThreshold(String level);
+  public abstract String getThreshold();
+
+  public void add(E event, long timstamp) {
+    history.add(event);
+    last = timstamp;
+  }
+  
+  public long getLastEvent() {
+    return last;
+  }
+  
+  public int getHistorySize() {
+    return (history==null) ? -1 : history.getBufferSize();
+  }
+  
+  public SolrDocumentList getHistory(long since, AtomicBoolean found) {
+    if(history==null) {
+      return null;
+    }
+    
+    SolrDocumentList docs = new SolrDocumentList();
+    Iterator<E> iter = history.iterator();
+    while(iter.hasNext()) {
+      E e = iter.next();
+      long ts = getTimestamp(e);
+      if(ts == since) {
+        if(found!=null) {
+          found.set(true);
+        }
+      }
+      if(ts>since) {
+        docs.add(toSolrDocument(e));
+      }
+    }
+    docs.setNumFound(docs.size()); // make it not look too funny
+    return docs;
+  }
+  
+  public abstract long getTimestamp(E event);
+  public abstract SolrDocument toSolrDocument(E event);
+  
+  public abstract void registerListener(ListenerConfig cfg, CoreContainer container);
+
+  public void reset() {
+    history.clear();
+    last = -1;
+  }
 }
\ No newline at end of file

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/LoggerInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/LoggerInfo.java?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/LoggerInfo.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/LoggerInfo.java Mon Aug 27 14:58:55 2012
@@ -1,68 +1,68 @@
-/*
- * 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.solr.logging;
-
-import org.apache.solr.common.util.SimpleOrderedMap;
-
-/**
- * Wrapper class for Logger implementaions
- */
-public abstract class LoggerInfo implements Comparable<LoggerInfo> {
-  public static final String ROOT_NAME = "root";
-
-  protected final String name;
-  protected String level;
-
-  public LoggerInfo(String name) {
-    this.name = name;
-  }
-
-  public String getLevel() {
-    return level;
-  }
-
-  public String getName() {
-    return name;
-  }
-  
-  public abstract boolean isSet();
-
-  public SimpleOrderedMap<?> getInfo() {
-    SimpleOrderedMap<Object> info = new SimpleOrderedMap<Object>();
-    info.add("name", getName());
-    info.add("level", getLevel());
-    info.add("set", isSet());
-    return info;
-  }
-
-  @Override
-  public int compareTo(LoggerInfo other) {
-    if (this.equals(other))
-      return 0;
-
-    String tN = this.getName();
-    String oN = other.getName();
-
-    if(ROOT_NAME.equals(tN))
-      return -1;
-    if(ROOT_NAME.equals(oN))
-      return 1;
-
-    return tN.compareTo(oN);
-  }
+/*
+ * 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.solr.logging;
+
+import org.apache.solr.common.util.SimpleOrderedMap;
+
+/**
+ * Wrapper class for Logger implementaions
+ */
+public abstract class LoggerInfo implements Comparable<LoggerInfo> {
+  public static final String ROOT_NAME = "root";
+
+  protected final String name;
+  protected String level;
+
+  public LoggerInfo(String name) {
+    this.name = name;
+  }
+
+  public String getLevel() {
+    return level;
+  }
+
+  public String getName() {
+    return name;
+  }
+  
+  public abstract boolean isSet();
+
+  public SimpleOrderedMap<?> getInfo() {
+    SimpleOrderedMap<Object> info = new SimpleOrderedMap<Object>();
+    info.add("name", getName());
+    info.add("level", getLevel());
+    info.add("set", isSet());
+    return info;
+  }
+
+  @Override
+  public int compareTo(LoggerInfo other) {
+    if (this.equals(other))
+      return 0;
+
+    String tN = this.getName();
+    String oN = other.getName();
+
+    if(ROOT_NAME.equals(tN))
+      return -1;
+    if(ROOT_NAME.equals(oN))
+      return 1;
+
+    return tN.compareTo(oN);
+  }
 }
\ No newline at end of file

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/JulInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/JulInfo.java?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/JulInfo.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/JulInfo.java Mon Aug 27 14:58:55 2012
@@ -1,70 +1,70 @@
-/*
- * 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.solr.logging.jul;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.solr.logging.LoggerInfo;
-
-public class JulInfo extends LoggerInfo {
-  private static final Level[] LEVELS = {
-      null, // aka unset
-      Level.FINEST,
-      Level.FINE,
-      Level.CONFIG,
-      Level.INFO,
-      Level.WARNING,
-      Level.SEVERE,
-      Level.OFF
-      // Level.ALL -- ignore. It is useless.
-  };
-
-  final Logger logger;
-
-  public JulInfo(String name, Logger logger) {
-    super(name);
-    this.logger = logger;
-  }
-
-  @Override
-  public String getLevel() {
-    if(logger==null) {
-      return null;
-    }
-    Level level = logger.getLevel();
-    if (level != null) {
-      return level.getName();
-    }
-    for (Level l : LEVELS) {
-      if (l == null) {
-        // avoid NPE
-        continue;
-      }
-      if (logger.isLoggable(l)) {
-        // return first level loggable
-        return l.getName();
-      }
-    }
-    return Level.OFF.getName();
-  }
-  
-  @Override
-  public boolean isSet() {
-    return (logger!=null && logger.getLevel()!=null);
-  }
+/*
+ * 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.solr.logging.jul;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.solr.logging.LoggerInfo;
+
+public class JulInfo extends LoggerInfo {
+  private static final Level[] LEVELS = {
+      null, // aka unset
+      Level.FINEST,
+      Level.FINE,
+      Level.CONFIG,
+      Level.INFO,
+      Level.WARNING,
+      Level.SEVERE,
+      Level.OFF
+      // Level.ALL -- ignore. It is useless.
+  };
+
+  final Logger logger;
+
+  public JulInfo(String name, Logger logger) {
+    super(name);
+    this.logger = logger;
+  }
+
+  @Override
+  public String getLevel() {
+    if(logger==null) {
+      return null;
+    }
+    Level level = logger.getLevel();
+    if (level != null) {
+      return level.getName();
+    }
+    for (Level l : LEVELS) {
+      if (l == null) {
+        // avoid NPE
+        continue;
+      }
+      if (logger.isLoggable(l)) {
+        // return first level loggable
+        return l.getName();
+      }
+    }
+    return Level.OFF.getName();
+  }
+  
+  @Override
+  public boolean isSet() {
+    return (logger!=null && logger.getLevel()!=null);
+  }
 }
\ No newline at end of file

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/JulWatcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/JulWatcher.java?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/JulWatcher.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/JulWatcher.java Mon Aug 27 14:58:55 2012
@@ -1,169 +1,169 @@
-/*
- * 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.solr.logging.jul;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.logging.CircularList;
-import org.apache.solr.logging.ListenerConfig;
-import org.apache.solr.logging.LoggerInfo;
-import org.apache.solr.logging.LogWatcher;
-
-import com.google.common.base.Throwables;
-
-public class JulWatcher extends LogWatcher<LogRecord> {
-
-  final String name;
-  RecordHandler handler = null;
-  
-  public JulWatcher(String name) {
-    this.name = name;
-  }
-  
-  @Override
-  public String getName() {
-    return "JUL ("+name+")";
-  }
-
-
-  @Override
-  public List<String> getAllLevels() {
-    return Arrays.asList(
-      Level.FINEST.getName(),
-      Level.FINER.getName(),
-      Level.FINE.getName(),
-      Level.CONFIG.getName(),
-      Level.INFO.getName(),
-      Level.WARNING.getName(),
-      Level.SEVERE.getName(),
-      Level.OFF.getName() );
-  }
-
-  @Override
-  public void setLogLevel(String category, String level) {
-    if(LoggerInfo.ROOT_NAME.equals(category)) {
-      category = "";
-    }
-    
-    Logger log = LogManager.getLogManager().getLogger(category);
-    if(level==null||"unset".equals(level)||"null".equals(level)) {
-      if(log!=null) {
-        log.setLevel(null);
-      }
-    }
-    else {
-      if(log==null) {
-        log = Logger.getLogger(category); // create it
-      }
-      log.setLevel(Level.parse(level));
-    }
-  }
-
-  @Override
-  public Collection<LoggerInfo> getAllLoggers() {
-    LogManager manager = LogManager.getLogManager();
-
-    Logger root = manager.getLogger("");
-    Map<String,LoggerInfo> map = new HashMap<String,LoggerInfo>();
-    Enumeration<String> names = manager.getLoggerNames();
-    while (names.hasMoreElements()) {
-      String name = names.nextElement();
-      Logger logger = Logger.getLogger(name);
-      if( logger == root) {
-        continue;
-      }
-      map.put(name, new JulInfo(name, logger));
-
-      while (true) {
-        int dot = name.lastIndexOf(".");
-        if (dot < 0)
-          break;
-        name = name.substring(0, dot);
-        if(!map.containsKey(name)) {
-          map.put(name, new JulInfo(name, null));
-        }
-      }
-    }
-    map.put(LoggerInfo.ROOT_NAME, new JulInfo(LoggerInfo.ROOT_NAME, root));
-    return map.values();
-  }
-
-  @Override
-  public void setThreshold(String level) {
-    if(handler==null) {
-      throw new IllegalStateException("Must have an handler");
-    }
-    handler.setLevel( Level.parse(level) );
-  }
-
-  @Override
-  public String getThreshold() {
-    if(handler==null) {
-      throw new IllegalStateException("Must have an handler");
-    }
-    return handler.getLevel().toString();
-  }
-
-  @Override
-  public void registerListener(ListenerConfig cfg, CoreContainer container) {
-    if(history!=null) {
-      throw new IllegalStateException("History already registered");
-    }
-    history = new CircularList<LogRecord>(cfg.size);
-    handler = new RecordHandler(this);
-    if(cfg.threshold != null) {
-      handler.setLevel(Level.parse(cfg.threshold));
-    }
-    else {
-      handler.setLevel(Level.WARNING);
-    }
-    
-    Logger log = LogManager.getLogManager().getLogger("");
-    log.addHandler(handler);
-  }
-
-  @Override
-  public long getTimestamp(LogRecord event) {
-    return event.getMillis();
-  }
-
-  @Override
-  public SolrDocument toSolrDocument(LogRecord event) {
-    SolrDocument doc = new SolrDocument();
-    doc.setField("time", new Date(event.getMillis()));
-    doc.setField("level", event.getLevel().toString());
-    doc.setField("logger", event.getLoggerName());
-    doc.setField("message", event.getMessage().toString());
-    Throwable t = event.getThrown();
-    if(t!=null) {
-      doc.setField("trace", Throwables.getStackTraceAsString(t));
-    }
-    return doc;
-  }
+/*
+ * 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.solr.logging.jul;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.logging.CircularList;
+import org.apache.solr.logging.ListenerConfig;
+import org.apache.solr.logging.LoggerInfo;
+import org.apache.solr.logging.LogWatcher;
+
+import com.google.common.base.Throwables;
+
+public class JulWatcher extends LogWatcher<LogRecord> {
+
+  final String name;
+  RecordHandler handler = null;
+  
+  public JulWatcher(String name) {
+    this.name = name;
+  }
+  
+  @Override
+  public String getName() {
+    return "JUL ("+name+")";
+  }
+
+
+  @Override
+  public List<String> getAllLevels() {
+    return Arrays.asList(
+      Level.FINEST.getName(),
+      Level.FINER.getName(),
+      Level.FINE.getName(),
+      Level.CONFIG.getName(),
+      Level.INFO.getName(),
+      Level.WARNING.getName(),
+      Level.SEVERE.getName(),
+      Level.OFF.getName() );
+  }
+
+  @Override
+  public void setLogLevel(String category, String level) {
+    if(LoggerInfo.ROOT_NAME.equals(category)) {
+      category = "";
+    }
+    
+    Logger log = LogManager.getLogManager().getLogger(category);
+    if(level==null||"unset".equals(level)||"null".equals(level)) {
+      if(log!=null) {
+        log.setLevel(null);
+      }
+    }
+    else {
+      if(log==null) {
+        log = Logger.getLogger(category); // create it
+      }
+      log.setLevel(Level.parse(level));
+    }
+  }
+
+  @Override
+  public Collection<LoggerInfo> getAllLoggers() {
+    LogManager manager = LogManager.getLogManager();
+
+    Logger root = manager.getLogger("");
+    Map<String,LoggerInfo> map = new HashMap<String,LoggerInfo>();
+    Enumeration<String> names = manager.getLoggerNames();
+    while (names.hasMoreElements()) {
+      String name = names.nextElement();
+      Logger logger = Logger.getLogger(name);
+      if( logger == root) {
+        continue;
+      }
+      map.put(name, new JulInfo(name, logger));
+
+      while (true) {
+        int dot = name.lastIndexOf(".");
+        if (dot < 0)
+          break;
+        name = name.substring(0, dot);
+        if(!map.containsKey(name)) {
+          map.put(name, new JulInfo(name, null));
+        }
+      }
+    }
+    map.put(LoggerInfo.ROOT_NAME, new JulInfo(LoggerInfo.ROOT_NAME, root));
+    return map.values();
+  }
+
+  @Override
+  public void setThreshold(String level) {
+    if(handler==null) {
+      throw new IllegalStateException("Must have an handler");
+    }
+    handler.setLevel( Level.parse(level) );
+  }
+
+  @Override
+  public String getThreshold() {
+    if(handler==null) {
+      throw new IllegalStateException("Must have an handler");
+    }
+    return handler.getLevel().toString();
+  }
+
+  @Override
+  public void registerListener(ListenerConfig cfg, CoreContainer container) {
+    if(history!=null) {
+      throw new IllegalStateException("History already registered");
+    }
+    history = new CircularList<LogRecord>(cfg.size);
+    handler = new RecordHandler(this);
+    if(cfg.threshold != null) {
+      handler.setLevel(Level.parse(cfg.threshold));
+    }
+    else {
+      handler.setLevel(Level.WARNING);
+    }
+    
+    Logger log = LogManager.getLogManager().getLogger("");
+    log.addHandler(handler);
+  }
+
+  @Override
+  public long getTimestamp(LogRecord event) {
+    return event.getMillis();
+  }
+
+  @Override
+  public SolrDocument toSolrDocument(LogRecord event) {
+    SolrDocument doc = new SolrDocument();
+    doc.setField("time", new Date(event.getMillis()));
+    doc.setField("level", event.getLevel().toString());
+    doc.setField("logger", event.getLoggerName());
+    doc.setField("message", event.getMessage().toString());
+    Throwable t = event.getThrown();
+    if(t!=null) {
+      doc.setField("trace", Throwables.getStackTraceAsString(t));
+    }
+    return doc;
+  }
 }
\ No newline at end of file

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/RecordHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/RecordHandler.java?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/RecordHandler.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/logging/jul/RecordHandler.java Mon Aug 27 14:58:55 2012
@@ -1,47 +1,47 @@
-/*
- * 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.solr.logging.jul;
-
-
-import java.util.logging.LogRecord;
-
-import org.apache.solr.logging.LogWatcher;
-
-public final class RecordHandler extends java.util.logging.Handler {
-  final LogWatcher<LogRecord> framework;
-  
-  public RecordHandler(LogWatcher<LogRecord> framework) {
-    this.framework = framework;
-  }
-  
-  @Override
-  public void close() throws SecurityException {
-    //history.reset();
-  }
-  
-  @Override
-  public void flush() {
-    // nothing
-  }
-  
-  @Override
-  public void publish(LogRecord r) {
-    if(isLoggable(r)) {
-      framework.add(r, r.getMillis());
-    }
-  }
+/*
+ * 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.solr.logging.jul;
+
+
+import java.util.logging.LogRecord;
+
+import org.apache.solr.logging.LogWatcher;
+
+public final class RecordHandler extends java.util.logging.Handler {
+  final LogWatcher<LogRecord> framework;
+  
+  public RecordHandler(LogWatcher<LogRecord> framework) {
+    this.framework = framework;
+  }
+  
+  @Override
+  public void close() throws SecurityException {
+    //history.reset();
+  }
+  
+  @Override
+  public void flush() {
+    // nothing
+  }
+  
+  @Override
+  public void publish(LogRecord r) {
+    if(isLoggable(r)) {
+      framework.add(r, r.getMillis());
+    }
+  }
 }
\ No newline at end of file

Modified: lucene/dev/branches/branch_4x/solr/example/cloud-scripts/zkcli.bat
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/example/cloud-scripts/zkcli.bat?rev=1377705&r1=1377704&r2=1377705&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/example/cloud-scripts/zkcli.bat (original)
+++ lucene/dev/branches/branch_4x/solr/example/cloud-scripts/zkcli.bat Mon Aug 27 14:58:55 2012
@@ -1,12 +1,12 @@
-REM You can override pass the following parameters to this script:
-REM 
-
-set JVM=java
-
-REM  Find location of this script
-
-set SDIR=%~dp0
-if "%SDIR:~-1%"=="\" set SDIR=%SDIR:~0,-1%
-
-     
-"%JVM%" -classpath "%SDIR%\..\solr-webapp\webapp\WEB-INF\lib\*" org.apache.solr.cloud.ZkCLI %*
+REM You can override pass the following parameters to this script:
+REM 
+
+set JVM=java
+
+REM  Find location of this script
+
+set SDIR=%~dp0
+if "%SDIR:~-1%"=="\" set SDIR=%SDIR:~0,-1%
+
+     
+"%JVM%" -classpath "%SDIR%\..\solr-webapp\webapp\WEB-INF\lib\*" org.apache.solr.cloud.ZkCLI %*



Mime
View raw message