You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/08/27 16:47:27 UTC
svn commit: r1377702 [2/2] - in /lucene/dev/trunk: ./
dev-tools/idea/.idea/libraries/ lucene/
lucene/analysis/common/src/java/org/apache/lucene/analysis/util/
lucene/analysis/common/src/resources/META-INF/services/
lucene/analysis/common/src/test/org/a...
Modified: lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/package-info.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/package-info.java?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/package-info.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/package-info.java Mon Aug 27 14:47:19 2012
@@ -1,24 +1,24 @@
-/*
- * 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.
- */
-
-/**
- * Bounding Box Spatial Strategy
- *
- * Index a shape extent using 4 numeric fields and a flag to say if it crosses the dateline
- */
-package org.apache.lucene.spatial.bbox;
-
+/*
+ * 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.
+ */
+
+/**
+ * Bounding Box Spatial Strategy
+ *
+ * Index a shape extent using 4 numeric fields and a flag to say if it crosses the dateline
+ */
+package org.apache.lucene.spatial.bbox;
+
Modified: lucene/dev/trunk/lucene/spatial/src/test-files/data/simple-bbox.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/test-files/data/simple-bbox.txt?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/test-files/data/simple-bbox.txt (original)
+++ lucene/dev/trunk/lucene/spatial/src/test-files/data/simple-bbox.txt Mon Aug 27 14:47:19 2012
@@ -1,5 +1,5 @@
-#id name shape
-C5 CenterAt5 -5 -5 5 5
-C10 CenterAt10 -10 -10 10 10
-NW15 NorthWest 15 15 20 20
-
+#id name shape
+C5 CenterAt5 -5 -5 5 5
+C10 CenterAt10 -10 -10 10 10
+NW15 NorthWest 15 15 20 20
+
Modified: lucene/dev/trunk/lucene/spatial/src/test-files/simple-Queries-BBox.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/test-files/simple-Queries-BBox.txt?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/test-files/simple-Queries-BBox.txt (original)
+++ lucene/dev/trunk/lucene/spatial/src/test-files/simple-Queries-BBox.txt Mon Aug 27 14:47:19 2012
@@ -1,13 +1,13 @@
-C5 @ IsWithin(-6 -6 6 6)
-C5 @ BBoxWithin(-6 -6 6 6)
-C10 @ Contains(-6 -6 6 6)
-C10 @ IsEqualTo(-10 -10 10 10)
-C5 C10 @ Intersects(-2 -2 2 2)
-C5 C10 @ Overlaps(-2 -2 2 2)
-C5 C10 @ BBoxIntersects(-2 -2 2 2)
-NW15 @ IsDisjointTo(-10 -10 10 10)
-
-
-
-
-
+C5 @ IsWithin(-6 -6 6 6)
+C5 @ BBoxWithin(-6 -6 6 6)
+C10 @ Contains(-6 -6 6 6)
+C10 @ IsEqualTo(-10 -10 10 10)
+C5 C10 @ Intersects(-2 -2 2 2)
+C5 C10 @ Overlaps(-2 -2 2 2)
+C5 C10 @ BBoxIntersects(-2 -2 2 2)
+NW15 @ IsDisjointTo(-10 -10 10 10)
+
+
+
+
+
Modified: lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java Mon Aug 27 14:47:19 2012
@@ -1,60 +1,60 @@
-package org.apache.lucene.spatial.bbox;
-
-/*
- * 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 com.spatial4j.core.context.simple.SimpleSpatialContext;
-import org.apache.lucene.spatial.SpatialMatchConcern;
-import org.apache.lucene.spatial.StrategyTestCase;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.IOException;
-
-public class TestBBoxStrategy extends StrategyTestCase {
-
- @Before
- @Override
- public void setUp() throws Exception {
- super.setUp();
- this.ctx = SimpleSpatialContext.GEO_KM;
- this.strategy = new BBoxStrategy(ctx, "bbox");
- }
-
- @Test
- public void testBasicOperaions() throws IOException {
- getAddAndVerifyIndexedDocuments(DATA_SIMPLE_BBOX);
-
- executeQueries(SpatialMatchConcern.EXACT, QTEST_Simple_Queries_BBox);
- }
-
- @Test
- public void testStatesBBox() throws IOException {
- getAddAndVerifyIndexedDocuments(DATA_STATES_BBOX);
-
- executeQueries(SpatialMatchConcern.FILTER, QTEST_States_IsWithin_BBox);
- executeQueries(SpatialMatchConcern.FILTER, QTEST_States_Intersects_BBox);
- }
-
- @Test
- public void testCitiesWithinBBox() throws IOException {
- getAddAndVerifyIndexedDocuments(DATA_WORLD_CITIES_POINTS);
-
- executeQueries(SpatialMatchConcern.FILTER, QTEST_Cities_IsWithin_BBox);
- }
-
-}
+package org.apache.lucene.spatial.bbox;
+
+/*
+ * 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 com.spatial4j.core.context.simple.SimpleSpatialContext;
+import org.apache.lucene.spatial.SpatialMatchConcern;
+import org.apache.lucene.spatial.StrategyTestCase;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class TestBBoxStrategy extends StrategyTestCase {
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ this.ctx = SimpleSpatialContext.GEO_KM;
+ this.strategy = new BBoxStrategy(ctx, "bbox");
+ }
+
+ @Test
+ public void testBasicOperaions() throws IOException {
+ getAddAndVerifyIndexedDocuments(DATA_SIMPLE_BBOX);
+
+ executeQueries(SpatialMatchConcern.EXACT, QTEST_Simple_Queries_BBox);
+ }
+
+ @Test
+ public void testStatesBBox() throws IOException {
+ getAddAndVerifyIndexedDocuments(DATA_STATES_BBOX);
+
+ executeQueries(SpatialMatchConcern.FILTER, QTEST_States_IsWithin_BBox);
+ executeQueries(SpatialMatchConcern.FILTER, QTEST_States_Intersects_BBox);
+ }
+
+ @Test
+ public void testCitiesWithinBBox() throws IOException {
+ getAddAndVerifyIndexedDocuments(DATA_WORLD_CITIES_POINTS);
+
+ executeQueries(SpatialMatchConcern.FILTER, QTEST_Cities_IsWithin_BBox);
+ }
+
+}
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java Mon Aug 27 14:47:19 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/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/package.html?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/package.html (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/package.html Mon Aug 27 14:47:19 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/trunk/lucene/tools/src/java/lucene-solr.antlib.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/src/java/lucene-solr.antlib.xml?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/src/java/lucene-solr.antlib.xml (original)
+++ lucene/dev/trunk/lucene/tools/src/java/lucene-solr.antlib.xml Mon Aug 27 14:47:19 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>
Added: lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/SVNEolCheckTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/SVNEolCheckTask.java?rev=1377702&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/SVNEolCheckTask.java (added)
+++ lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/SVNEolCheckTask.java Mon Aug 27 14:47:19 2012
@@ -0,0 +1,126 @@
+package org.apache.lucene.validation;
+
+/*
+ * 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.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.types.resources.Resources;
+
+/**
+ * Checks all files to ensure they have svn:eol-style, or
+ * have a binary svn:mime-type.
+ * <p>
+ * TODO: check that this value is actually correct, not just present.
+ * <p>
+ * WARNING: slow!
+ */
+public class SVNEolCheckTask extends Task {
+
+ private final Resources files = new Resources();
+
+ private String svnExecutable;
+
+ /** Set of files to check */
+ public void add(ResourceCollection rc) {
+ files.add(rc);
+ }
+
+ /** svn.exe executable */
+ public void setSvnExecutable(String svnExecutable) {
+ this.svnExecutable = svnExecutable;
+ }
+
+ @Override
+ public void execute() throws BuildException {
+ if (svnExecutable == null) {
+ throw new BuildException("svnExecutable parameter must be set!");
+ }
+ boolean success = true;
+ files.setProject(getProject());
+ Iterator<Resource> iter = (Iterator<Resource>) files.iterator();
+ while (iter.hasNext()) {
+ Resource r = iter.next();
+ if (!(r instanceof FileResource)) {
+ throw new BuildException("Only filesystem resource are supported: " + r.getName()
+ + ", was: " + r.getClass().getName());
+ }
+
+ File f = ((FileResource) r).getFile();
+ List<String> cmd = new ArrayList<String>();
+ cmd.add(svnExecutable);
+ cmd.add("pget");
+ cmd.add("svn:eol-style");
+ cmd.add(f.getAbsolutePath());
+ String eolStyle = exec(cmd);
+ if (eolStyle.isEmpty()) {
+ cmd.clear();
+ cmd.add(svnExecutable);
+ cmd.add("pget");
+ cmd.add("svn:mime-type");
+ cmd.add(f.getAbsolutePath());
+ String binProp = exec(cmd);
+ if (!binProp.startsWith("application/") && !binProp.startsWith("image/")) {
+ success = false;
+ log(r.getName() + " missing svn:eol-style (or binary svn:mime-type).");
+ }
+ }
+ }
+ if (!success) {
+ throw new BuildException("Some svn properties are missing");
+ }
+ }
+
+ private String exec(List<String> cmd) throws BuildException {
+ ProcessBuilder pb = new ProcessBuilder(cmd);
+ pb.redirectErrorStream(true);
+ BufferedReader r = null;
+ StringBuilder sb = new StringBuilder();
+ try {
+ Process p = pb.start();
+ InputStream is = p.getInputStream();
+ r = new BufferedReader(new InputStreamReader(is, Charset.defaultCharset()));
+ int ch;
+ while ((ch = r.read()) > 0) {
+ sb.append((char)ch);
+ }
+ p.waitFor();
+ return sb.toString();
+ } catch (Exception e) {
+ throw new BuildException(e);
+ } finally {
+ if (r != null) {
+ try {
+ r.close();
+ } catch (IOException e) {}
+ }
+ }
+ }
+}
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/CircularList.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/CircularList.java?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/CircularList.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/CircularList.java Mon Aug 27 14:47:19 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/trunk/solr/core/src/java/org/apache/solr/logging/LogWatcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/LogWatcher.java?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/LogWatcher.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/LogWatcher.java Mon Aug 27 14:47:19 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/trunk/solr/core/src/java/org/apache/solr/logging/LoggerInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/LoggerInfo.java?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/LoggerInfo.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/LoggerInfo.java Mon Aug 27 14:47:19 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/trunk/solr/core/src/java/org/apache/solr/logging/jul/JulInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/jul/JulInfo.java?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/jul/JulInfo.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/jul/JulInfo.java Mon Aug 27 14:47:19 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/trunk/solr/core/src/java/org/apache/solr/logging/jul/JulWatcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/jul/JulWatcher.java?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/jul/JulWatcher.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/jul/JulWatcher.java Mon Aug 27 14:47:19 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/trunk/solr/core/src/java/org/apache/solr/logging/jul/RecordHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/jul/RecordHandler.java?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/jul/RecordHandler.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/logging/jul/RecordHandler.java Mon Aug 27 14:47:19 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/trunk/solr/example/cloud-scripts/zkcli.bat
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/cloud-scripts/zkcli.bat?rev=1377702&r1=1377701&r2=1377702&view=diff
==============================================================================
--- lucene/dev/trunk/solr/example/cloud-scripts/zkcli.bat (original)
+++ lucene/dev/trunk/solr/example/cloud-scripts/zkcli.bat Mon Aug 27 14:47:19 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 %*