Index: src/java/org/apache/lucene/util/Attribute.java =================================================================== --- src/java/org/apache/lucene/util/Attribute.java (revision 725699) +++ src/java/org/apache/lucene/util/Attribute.java (working copy) @@ -17,7 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; /** * Base class for Attributes that can be added to a @@ -30,7 +29,7 @@ * The APIs introduced in these classes with Lucene 2.9 might change in the future. * We will make our best efforts to keep the APIs backwards-compatible. */ -public abstract class Attribute implements Cloneable, Serializable { +public abstract class Attribute implements Cloneable { /** * Clears the values in this Attribute and resets it to its * default value. Index: src/java/org/apache/lucene/util/OpenBitSet.java =================================================================== --- src/java/org/apache/lucene/util/OpenBitSet.java (revision 725699) +++ src/java/org/apache/lucene/util/OpenBitSet.java (working copy) @@ -18,7 +18,6 @@ package org.apache.lucene.util; import java.util.Arrays; -import java.io.Serializable; import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSetIterator; @@ -77,7 +76,7 @@ * @version $Id$ */ -public class OpenBitSet extends DocIdSet implements Cloneable, Serializable { +public class OpenBitSet extends DocIdSet implements Cloneable { protected long[] bits; protected int wlen; // number of words (elements) used in the array Index: src/java/org/apache/lucene/util/Parameter.java =================================================================== --- src/java/org/apache/lucene/util/Parameter.java (revision 725699) +++ src/java/org/apache/lucene/util/Parameter.java (working copy) @@ -18,7 +18,6 @@ */ import java.io.ObjectStreamException; -import java.io.Serializable; import java.io.StreamCorruptedException; import java.util.HashMap; import java.util.Map; @@ -26,7 +25,7 @@ /** * A serializable Enum class. */ -public abstract class Parameter implements Serializable +public abstract class Parameter { static Map allParameters = new HashMap(); Index: src/java/org/apache/lucene/index/Payload.java =================================================================== --- src/java/org/apache/lucene/index/Payload.java (revision 725699) +++ src/java/org/apache/lucene/index/Payload.java (working copy) @@ -17,8 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; - import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.util.ArrayUtil; @@ -34,7 +32,7 @@ * to retrieve the payloads from the index.
* */ -public class Payload implements Serializable, Cloneable { +public class Payload implements Cloneable { /** the byte array containing the payload data */ protected byte[] data; Index: src/java/org/apache/lucene/index/TermVectorOffsetInfo.java =================================================================== --- src/java/org/apache/lucene/index/TermVectorOffsetInfo.java (revision 725699) +++ src/java/org/apache/lucene/index/TermVectorOffsetInfo.java (working copy) @@ -1,6 +1,5 @@ package org.apache.lucene.index; -import java.io.Serializable; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -24,7 +23,7 @@ * offset information. This offset information is the character offset as set during the Analysis phase (and thus may not be the actual offset in the * original content). */ -public class TermVectorOffsetInfo implements Serializable { +public class TermVectorOffsetInfo { /** * Convenience declaration when creating a {@link org.apache.lucene.index.TermPositionVector} that stores only position information. */ Index: src/java/org/apache/lucene/index/Term.java =================================================================== --- src/java/org/apache/lucene/index/Term.java (revision 725699) +++ src/java/org/apache/lucene/index/Term.java (working copy) @@ -25,7 +25,7 @@ Note that terms may represent more than words from text fields, but also things like dates, email addresses, urls, etc. */ -public final class Term implements Comparable, java.io.Serializable { +public final class Term implements Comparable { String field; String text; Index: src/java/org/apache/lucene/document/FieldSelector.java =================================================================== --- src/java/org/apache/lucene/document/FieldSelector.java (revision 725699) +++ src/java/org/apache/lucene/document/FieldSelector.java (working copy) @@ -1,6 +1,5 @@ package org.apache.lucene.document; -import java.io.Serializable; /** * Copyright 2004 The Apache Software Foundation * @@ -22,7 +21,7 @@ * what Fields get loaded on a {@link Document} by {@link org.apache.lucene.index.IndexReader#document(int,org.apache.lucene.document.FieldSelector)} * **/ -public interface FieldSelector extends Serializable { +public interface FieldSelector { /** * Index: src/java/org/apache/lucene/document/Document.java =================================================================== --- src/java/org/apache/lucene/document/Document.java (revision 725699) +++ src/java/org/apache/lucene/document/Document.java (working copy) @@ -36,7 +36,7 @@ * IndexReader#document(int)}. */ -public final class Document implements java.io.Serializable { +public final class Document { List fields = new ArrayList(); private float boost = 1.0f; Index: src/java/org/apache/lucene/document/Fieldable.java =================================================================== --- src/java/org/apache/lucene/document/Fieldable.java (revision 725699) +++ src/java/org/apache/lucene/document/Fieldable.java (working copy) @@ -20,7 +20,6 @@ import org.apache.lucene.index.FieldInvertState; import java.io.Reader; -import java.io.Serializable; /** * Synonymous with {@link Field}. @@ -32,7 +31,7 @@ *

* **/ -public interface Fieldable extends Serializable { +public interface Fieldable { /** Sets the boost factor hits on this field. This value will be * multiplied into the score of all hits on this this field of this * document. Index: src/java/org/apache/lucene/document/Field.java =================================================================== --- src/java/org/apache/lucene/document/Field.java (revision 725699) +++ src/java/org/apache/lucene/document/Field.java (working copy) @@ -22,7 +22,6 @@ import org.apache.lucene.util.Parameter; import java.io.Reader; -import java.io.Serializable; /** A field is a section of a Document. Each field has two parts, a name and a @@ -32,10 +31,10 @@ index, so that they may be returned with hits on the document. */ -public final class Field extends AbstractField implements Fieldable, Serializable { +public final class Field extends AbstractField implements Fieldable { /** Specifies whether and how a field should be stored. */ - public static final class Store extends Parameter implements Serializable { + public static final class Store extends Parameter { private Store(String name) { super(name); @@ -58,7 +57,7 @@ } /** Specifies whether and how a field should be indexed. */ - public static final class Index extends Parameter implements Serializable { + public static final class Index extends Parameter { private Index(String name) { super(name); @@ -115,7 +114,7 @@ } /** Specifies whether and how a field should have term vectors. */ - public static final class TermVector extends Parameter implements Serializable { + public static final class TermVector extends Parameter { private TermVector(String name) { super(name); Index: src/java/org/apache/lucene/document/FieldSelectorResult.java =================================================================== --- src/java/org/apache/lucene/document/FieldSelectorResult.java (revision 725699) +++ src/java/org/apache/lucene/document/FieldSelectorResult.java (working copy) @@ -1,6 +1,5 @@ package org.apache.lucene.document; -import java.io.Serializable; /** * Copyright 2004 The Apache Software Foundation * @@ -22,7 +21,7 @@ * **/ //Replace with an enumerated type in 1.5 -public final class FieldSelectorResult implements Serializable { +public final class FieldSelectorResult { /** * Load this {@link Field} every time the {@link Document} is loaded, reading in the data as it is encounterd. Index: src/java/org/apache/lucene/search/Filter.java =================================================================== --- src/java/org/apache/lucene/search/Filter.java (revision 725699) +++ src/java/org/apache/lucene/search/Filter.java (working copy) @@ -30,7 +30,7 @@ * All implementing classes must therefore implement {@link #getDocIdSet(IndexReader)} * in order to work with Lucene 3.0. */ -public abstract class Filter implements java.io.Serializable { +public abstract class Filter { /** * @return A BitSet with true for documents which should be permitted in * search results, and false for those that should not. Index: src/java/org/apache/lucene/search/RemoteSearchable.java =================================================================== --- src/java/org/apache/lucene/search/RemoteSearchable.java (revision 725699) +++ src/java/org/apache/lucene/search/RemoteSearchable.java (working copy) @@ -1,122 +0,0 @@ -package org.apache.lucene.search; - -/** - * 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 org.apache.lucene.document.Document; -import org.apache.lucene.document.FieldSelector; -import org.apache.lucene.index.Term; -import org.apache.lucene.index.CorruptIndexException; - -import java.io.IOException; -import java.rmi.Naming; -import java.rmi.RMISecurityManager; -import java.rmi.RemoteException; -import java.rmi.server.UnicastRemoteObject; - -/** - * A remote searchable implementation. - * - * @version $Id$ - */ -public class RemoteSearchable - extends UnicastRemoteObject - implements Searchable { - - private Searchable local; - - /** Constructs and exports a remote searcher. */ - public RemoteSearchable(Searchable local) throws RemoteException { - super(); - this.local = local; - } - - - public void search(Weight weight, Filter filter, HitCollector results) - throws IOException { - local.search(weight, filter, results); - } - - public void close() throws IOException { - local.close(); - } - - public int docFreq(Term term) throws IOException { - return local.docFreq(term); - } - - - public int[] docFreqs(Term[] terms) throws IOException { - return local.docFreqs(terms); - } - - public int maxDoc() throws IOException { - return local.maxDoc(); - } - - public TopDocs search(Weight weight, Filter filter, int n) throws IOException { - return local.search(weight, filter, n); - } - - - public TopFieldDocs search (Weight weight, Filter filter, int n, Sort sort) - throws IOException { - return local.search (weight, filter, n, sort); - } - - public Document doc(int i) throws CorruptIndexException, IOException { - return local.doc(i); - } - - public Document doc(int i, FieldSelector fieldSelector) throws CorruptIndexException, IOException { - return local.doc(i, fieldSelector); - } - - public Query rewrite(Query original) throws IOException { - return local.rewrite(original); - } - - public Explanation explain(Weight weight, int doc) throws IOException { - return local.explain(weight, doc); - } - - /** Exports a searcher for the index in args[0] named - * "//localhost/Searchable". */ - public static void main(String args[]) throws Exception { - String indexName = null; - - if (args != null && args.length == 1) - indexName = args[0]; - - if (indexName == null) { - System.out.println("Usage: org.apache.lucene.search.RemoteSearchable "); - return; - } - - // create and install a security manager - if (System.getSecurityManager() == null) { - System.setSecurityManager(new RMISecurityManager()); - } - - Searchable local = new IndexSearcher(indexName); - RemoteSearchable impl = new RemoteSearchable(local); - - // bind the implementation to "Searchable" - Naming.rebind("//localhost/Searchable", impl); - } - -} Index: src/java/org/apache/lucene/search/ScoreDoc.java =================================================================== --- src/java/org/apache/lucene/search/ScoreDoc.java (revision 725699) +++ src/java/org/apache/lucene/search/ScoreDoc.java (working copy) @@ -19,7 +19,7 @@ /** Expert: Returned by low-level search implementations. * @see TopDocs */ -public class ScoreDoc implements java.io.Serializable { +public class ScoreDoc { /** Expert: The score of this document for the query. */ public float score; Index: src/java/org/apache/lucene/search/CachingSpanFilter.java =================================================================== --- src/java/org/apache/lucene/search/CachingSpanFilter.java (revision 725699) +++ src/java/org/apache/lucene/search/CachingSpanFilter.java (working copy) @@ -31,8 +31,8 @@ protected SpanFilter filter; /** - * A transient Filter cache. To cache Filters even when using {@link org.apache.lucene.search.RemoteSearchable} use - * {@link org.apache.lucene.search.RemoteCachingWrapperFilter} instead. + * A transient Filter cache. To cache Filters even when using {@link org.apache.lucene.remote.DefaultRemoteSearcher} use + * {@link org.apache.lucene.remote.RemoteCachingWrapperFilter} instead. */ protected transient Map cache; Index: src/java/org/apache/lucene/search/CachingWrapperFilter.java =================================================================== --- src/java/org/apache/lucene/search/CachingWrapperFilter.java (revision 725699) +++ src/java/org/apache/lucene/search/CachingWrapperFilter.java (working copy) @@ -32,7 +32,7 @@ protected Filter filter; /** - * A transient Filter cache. To cache Filters even when using {@link RemoteSearchable} use + * A transient Filter cache. To cache Filters even when using {@link DefaultRemoteSearcher} use * {@link RemoteCachingWrapperFilter} instead. */ protected transient Map cache; Index: src/java/org/apache/lucene/search/TopDocs.java =================================================================== --- src/java/org/apache/lucene/search/TopDocs.java (revision 725699) +++ src/java/org/apache/lucene/search/TopDocs.java (working copy) @@ -19,7 +19,7 @@ /** Expert: Returned by low-level search implementations. * @see Searcher#search(Query,Filter,int) */ -public class TopDocs implements java.io.Serializable { +public class TopDocs { /** Expert: The total number of hits for the query. * @see Hits#length() */ Index: src/java/org/apache/lucene/search/RemoteCachingWrapperFilter.java =================================================================== --- src/java/org/apache/lucene/search/RemoteCachingWrapperFilter.java (revision 725699) +++ src/java/org/apache/lucene/search/RemoteCachingWrapperFilter.java (working copy) @@ -1,69 +0,0 @@ -package org.apache.lucene.search; - -/** - * 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 java.util.BitSet; - -import org.apache.lucene.index.IndexReader; - -/** - * Provides caching of {@link Filter}s themselves on the remote end of an RMI connection. - * The cache is keyed on Filter's hashCode(), so if it sees the same filter twice - * it will reuse the original version. - *

- * NOTE: This does NOT cache the Filter bits, but rather the Filter itself. - * Thus, this works hand-in-hand with {@link CachingWrapperFilter} to keep both - * file Filter cache and the Filter bits on the remote end, close to the searcher. - *

- * Usage: - *

- * To cache a result you must do something like - * RemoteCachingWrapperFilter f = new RemoteCachingWrapperFilter(new CachingWrapperFilter(myFilter)); - *

- */ -public class RemoteCachingWrapperFilter extends Filter { - protected Filter filter; - - public RemoteCachingWrapperFilter(Filter filter) { - this.filter = filter; - } - - /** - * Uses the {@link FilterManager} to keep the cache for a filter on the - * searcher side of a remote connection. - * @param reader the index reader for the Filter - * @return the bitset - * @deprecated Use {@link #getDocIdSet(IndexReader)} instead. - */ - public BitSet bits(IndexReader reader) throws IOException { - Filter cachedFilter = FilterManager.getInstance().getFilter(filter); - return cachedFilter.bits(reader); - } - - /** - * Uses the {@link FilterManager} to keep the cache for a filter on the - * searcher side of a remote connection. - * @param reader the index reader for the Filter - * @return the DocIdSet - */ - public DocIdSet getDocIdSet(IndexReader reader) throws IOException { - Filter cachedFilter = FilterManager.getInstance().getFilter(filter); - return cachedFilter.getDocIdSet(reader); - } -} Index: src/java/org/apache/lucene/search/Weight.java =================================================================== --- src/java/org/apache/lucene/search/Weight.java (revision 725699) +++ src/java/org/apache/lucene/search/Weight.java (working copy) @@ -41,7 +41,7 @@ *

  • A Scorer is constructed by {@link #scorer(IndexReader)}. * */ -public interface Weight extends java.io.Serializable { +public interface Weight { /** The query that this concerns. */ Query getQuery(); Index: src/java/org/apache/lucene/search/Query.java =================================================================== --- src/java/org/apache/lucene/search/Query.java (revision 725699) +++ src/java/org/apache/lucene/search/Query.java (working copy) @@ -44,7 +44,7 @@
  • {@link org.apache.lucene.queryParser.QueryParser QueryParser} */ -public abstract class Query implements java.io.Serializable, Cloneable { +public abstract class Query implements Cloneable { private float boost = 1.0f; // query boost factor /** Sets the boost for this query clause to b. Documents Index: src/java/org/apache/lucene/search/BooleanClause.java =================================================================== --- src/java/org/apache/lucene/search/BooleanClause.java (revision 725699) +++ src/java/org/apache/lucene/search/BooleanClause.java (working copy) @@ -20,10 +20,10 @@ */ /** A clause in a BooleanQuery. */ -public class BooleanClause implements java.io.Serializable { +public class BooleanClause { /** Specifies how clauses are to occur in matching documents. */ - public static final class Occur extends Parameter implements java.io.Serializable { + public static final class Occur extends Parameter { private Occur(String name) { // typesafe enum pattern, no public constructor Index: src/java/org/apache/lucene/search/Searchable.java =================================================================== --- src/java/org/apache/lucene/search/Searchable.java (revision 725699) +++ src/java/org/apache/lucene/search/Searchable.java (working copy) @@ -35,7 +35,7 @@ * they may be efficiently passed to a remote index, with only the top-scoring * hits being returned, rather than every matching hit. */ -public interface Searchable extends java.rmi.Remote { +public interface Searchable { /** Lower-level search API. * *

    {@link HitCollector#collect(int,float)} is called for every non-zero Index: src/java/org/apache/lucene/search/function/ValueSource.java =================================================================== --- src/java/org/apache/lucene/search/function/ValueSource.java (revision 725699) +++ src/java/org/apache/lucene/search/function/ValueSource.java (working copy) @@ -21,7 +21,6 @@ import org.apache.lucene.search.function.DocValues; import java.io.IOException; -import java.io.Serializable; /** * Expert: source of values for basic function queries. @@ -38,7 +37,7 @@ * * */ -public abstract class ValueSource implements Serializable { +public abstract class ValueSource { /** * Return the DocValues used by the function query. Index: src/java/org/apache/lucene/search/FilterManager.java =================================================================== --- src/java/org/apache/lucene/search/FilterManager.java (revision 725699) +++ src/java/org/apache/lucene/search/FilterManager.java (working copy) @@ -1,204 +0,0 @@ -package org.apache.lucene.search; - -/** - * 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.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.TreeSet; - -/** - * Filter caching singleton. It can be used by {@link org.apache.lucene.search.RemoteCachingWrapperFilter} - * or just to save filters locally for reuse. - * This class makes it possble to cache Filters even when using RMI, as it - * keeps the cache on the seaercher side of the RMI connection. - * - * Also could be used as a persistent storage for any filter as long as the - * filter provides a proper hashCode(), as that is used as the key in the cache. - * - * The cache is periodically cleaned up from a separate thread to ensure the - * cache doesn't exceed the maximum size. - */ -public class FilterManager { - - protected static FilterManager manager; - - /** The default maximum number of Filters in the cache */ - protected static final int DEFAULT_CACHE_CLEAN_SIZE = 100; - /** The default frequency of cache clenup */ - protected static final long DEFAULT_CACHE_SLEEP_TIME = 1000 * 60 * 10; - - /** The cache itself */ - protected Map cache; - /** Maximum allowed cache size */ - protected int cacheCleanSize; - /** Cache cleaning frequency */ - protected long cleanSleepTime; - /** Cache cleaner that runs in a separate thread */ - protected FilterCleaner filterCleaner; - - public synchronized static FilterManager getInstance() { - if (manager == null) { - manager = new FilterManager(); - } - return manager; - } - - /** - * Sets up the FilterManager singleton. - */ - protected FilterManager() { - cache = new HashMap(); - cacheCleanSize = DEFAULT_CACHE_CLEAN_SIZE; // Let the cache get to 100 items - cleanSleepTime = DEFAULT_CACHE_SLEEP_TIME; // 10 minutes between cleanings - - filterCleaner = new FilterCleaner(); - Thread fcThread = new Thread(filterCleaner); - // setto be a Daemon so it doesn't have to be stopped - fcThread.setDaemon(true); - fcThread.start(); - } - - /** - * Sets the max size that cache should reach before it is cleaned up - * @param cacheCleanSize maximum allowed cache size - */ - public void setCacheSize(int cacheCleanSize) { - this.cacheCleanSize = cacheCleanSize; - } - - /** - * Sets the cache cleaning frequency in milliseconds. - * @param cleanSleepTime cleaning frequency in millioseconds - */ - public void setCleanThreadSleepTime(long cleanSleepTime) { - this.cleanSleepTime = cleanSleepTime; - } - - /** - * Returns the cached version of the filter. Allows the caller to pass up - * a small filter but this will keep a persistent version around and allow - * the caching filter to do its job. - * - * @param filter The input filter - * @return The cached version of the filter - */ - public Filter getFilter(Filter filter) { - synchronized(cache) { - FilterItem fi = null; - fi = (FilterItem)cache.get(new Integer(filter.hashCode())); - if (fi != null) { - fi.timestamp = new Date().getTime(); - return fi.filter; - } - cache.put(new Integer(filter.hashCode()), new FilterItem(filter)); - return filter; - } - } - - /** - * Holds the filter and the last time the filter was used, to make LRU-based - * cache cleaning possible. - * TODO: Clean this up when we switch to Java 1.5 - */ - protected class FilterItem { - public Filter filter; - public long timestamp; - - public FilterItem (Filter filter) { - this.filter = filter; - this.timestamp = new Date().getTime(); - } - } - - - /** - * Keeps the cache from getting too big. - * If we were using Java 1.5, we could use LinkedHashMap and we would not need this thread - * to clean out the cache. - * - * The SortedSet sortedFilterItems is used only to sort the items from the cache, - * so when it's time to clean up we have the TreeSet sort the FilterItems by - * timestamp. - * - * Removes 1.5 * the numbers of items to make the cache smaller. - * For example: - * If cache clean size is 10, and the cache is at 15, we would remove (15 - 10) * 1.5 = 7.5 round up to 8. - * This way we clean the cache a bit more, and avoid having the cache cleaner having to do it frequently. - */ - protected class FilterCleaner implements Runnable { - - private boolean running = true; - private TreeSet sortedFilterItems; - - public FilterCleaner() { - sortedFilterItems = new TreeSet(new Comparator() { - public int compare(Object a, Object b) { - if( a instanceof Map.Entry && b instanceof Map.Entry) { - FilterItem fia = (FilterItem) ((Map.Entry)a).getValue(); - FilterItem fib = (FilterItem) ((Map.Entry)b).getValue(); - if ( fia.timestamp == fib.timestamp ) { - return 0; - } - // smaller timestamp first - if ( fia.timestamp < fib.timestamp ) { - return -1; - } - // larger timestamp last - return 1; - } else { - throw new ClassCastException("Objects are not Map.Entry"); - } - } - }); - } - - public void run () { - while (running) { - - // sort items from oldest to newest - // we delete the oldest filters - if (cache.size() > cacheCleanSize) { - // empty the temporary set - sortedFilterItems.clear(); - synchronized (cache) { - sortedFilterItems.addAll(cache.entrySet()); - Iterator it = sortedFilterItems.iterator(); - int numToDelete = (int) ((cache.size() - cacheCleanSize) * 1.5); - int counter = 0; - // loop over the set and delete all of the cache entries not used in a while - while (it.hasNext() && counter++ < numToDelete) { - Map.Entry entry = (Map.Entry)it.next(); - cache.remove(entry.getKey()); - } - } - // empty the set so we don't tie up the memory - sortedFilterItems.clear(); - } - // take a nap - try { - Thread.sleep(cleanSleepTime); - } catch (InterruptedException e) { - // just keep going - } - } - } - } -} Index: src/java/org/apache/lucene/search/Sort.java =================================================================== --- src/java/org/apache/lucene/search/Sort.java (revision 725699) +++ src/java/org/apache/lucene/search/Sort.java (working copy) @@ -17,7 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; import java.util.Arrays; @@ -98,8 +97,7 @@ * @since lucene 1.4 * @version $Id$ */ -public class Sort -implements Serializable { +public class Sort { /** * Represents sorting by computed relevance. Using this sort criteria returns Index: src/java/org/apache/lucene/search/Hit.java =================================================================== --- src/java/org/apache/lucene/search/Hit.java (revision 725699) +++ src/java/org/apache/lucene/search/Hit.java (working copy) @@ -28,7 +28,7 @@ * * @deprecated Hits will be removed in Lucene 3.0. Use {@link TopDocCollector} and {@link TopDocs} instead. */ -public class Hit implements java.io.Serializable { +public class Hit { private Document doc = null; Index: src/java/org/apache/lucene/search/Explanation.java =================================================================== --- src/java/org/apache/lucene/search/Explanation.java (revision 725699) +++ src/java/org/apache/lucene/search/Explanation.java (working copy) @@ -20,7 +20,7 @@ import java.util.ArrayList; /** Expert: Describes the score computation for document and query. */ -public class Explanation implements java.io.Serializable { +public class Explanation { private float value; // the value of this node private String description; // what it represents private ArrayList details; // sub-explanations Index: src/java/org/apache/lucene/search/SortField.java =================================================================== --- src/java/org/apache/lucene/search/SortField.java (revision 725699) +++ src/java/org/apache/lucene/search/SortField.java (working copy) @@ -17,7 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; import java.util.Locale; /** @@ -30,8 +29,7 @@ * @version $Id$ * @see Sort */ -public class SortField -implements Serializable { +public class SortField { /** Sort by document score (relevancy). Sort values are Float and higher * values are at the front. */ Index: src/java/org/apache/lucene/search/SortComparatorSource.java =================================================================== --- src/java/org/apache/lucene/search/SortComparatorSource.java (revision 725699) +++ src/java/org/apache/lucene/search/SortComparatorSource.java (working copy) @@ -19,7 +19,6 @@ import org.apache.lucene.index.IndexReader; import java.io.IOException; -import java.io.Serializable; /** * Expert: returns a comparator for sorting ScoreDocs. @@ -30,8 +29,7 @@ * @version $Id$ * @since 1.4 */ -public interface SortComparatorSource -extends Serializable { +public interface SortComparatorSource { /** * Creates a comparator for the field in the given index. Index: src/java/org/apache/lucene/search/Similarity.java =================================================================== --- src/java/org/apache/lucene/search/Similarity.java (revision 725699) +++ src/java/org/apache/lucene/search/Similarity.java (working copy) @@ -22,7 +22,6 @@ import org.apache.lucene.util.SmallFloat; import java.io.IOException; -import java.io.Serializable; import java.util.Collection; import java.util.Iterator; @@ -286,7 +285,7 @@ * @see org.apache.lucene.index.IndexWriter#setSimilarity(Similarity) * @see Searcher#setSimilarity(Similarity) */ -public abstract class Similarity implements Serializable { +public abstract class Similarity { /** The Similarity implementation used by default. */ private static Similarity defaultImpl = new DefaultSimilarity(); Index: src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttribute.java =================================================================== --- src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttribute.java (revision 725699) +++ src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttribute.java (working copy) @@ -17,8 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; - import org.apache.lucene.index.Payload; import org.apache.lucene.util.Attribute; @@ -30,7 +28,7 @@ * The APIs introduced in these classes with Lucene 2.9 might change in the future. * We will make our best efforts to keep the APIs backwards-compatible. */ -public class PayloadAttribute extends Attribute implements Cloneable, Serializable { +public class PayloadAttribute extends Attribute implements Cloneable { private Payload payload; /** Index: src/java/org/apache/lucene/analysis/tokenattributes/PositionIncrementAttribute.java =================================================================== --- src/java/org/apache/lucene/analysis/tokenattributes/PositionIncrementAttribute.java (revision 725699) +++ src/java/org/apache/lucene/analysis/tokenattributes/PositionIncrementAttribute.java (working copy) @@ -17,8 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; - import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.util.Attribute; @@ -53,7 +51,7 @@ * * @see org.apache.lucene.index.TermPositions */ -public class PositionIncrementAttribute extends Attribute implements Cloneable, Serializable { +public class PositionIncrementAttribute extends Attribute implements Cloneable { private int positionIncrement = 1; /** Set the position increment. The default value is one. Index: src/java/org/apache/lucene/analysis/tokenattributes/FlagsAttribute.java =================================================================== --- src/java/org/apache/lucene/analysis/tokenattributes/FlagsAttribute.java (revision 725699) +++ src/java/org/apache/lucene/analysis/tokenattributes/FlagsAttribute.java (working copy) @@ -17,7 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; import org.apache.lucene.util.Attribute; @@ -31,7 +30,7 @@ * We will make our best efforts to keep the APIs backwards-compatible. */ -public class FlagsAttribute extends Attribute implements Cloneable, Serializable { +public class FlagsAttribute extends Attribute implements Cloneable { private int flags = 0; /** Index: src/java/org/apache/lucene/analysis/tokenattributes/TypeAttribute.java =================================================================== --- src/java/org/apache/lucene/analysis/tokenattributes/TypeAttribute.java (revision 725699) +++ src/java/org/apache/lucene/analysis/tokenattributes/TypeAttribute.java (working copy) @@ -17,8 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; - import org.apache.lucene.util.Attribute; /** @@ -29,7 +27,7 @@ * The APIs introduced in these classes with Lucene 2.9 might change in the future. * We will make our best efforts to keep the APIs backwards-compatible. */ -public class TypeAttribute extends Attribute implements Cloneable, Serializable { +public class TypeAttribute extends Attribute implements Cloneable { private String type; public static final String DEFAULT_TYPE = "word"; Index: src/java/org/apache/lucene/analysis/tokenattributes/OffsetAttribute.java =================================================================== --- src/java/org/apache/lucene/analysis/tokenattributes/OffsetAttribute.java (revision 725699) +++ src/java/org/apache/lucene/analysis/tokenattributes/OffsetAttribute.java (working copy) @@ -17,8 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; - import org.apache.lucene.util.Attribute; /** @@ -29,7 +27,7 @@ * The APIs introduced in these classes with Lucene 2.9 might change in the future. * We will make our best efforts to keep the APIs backwards-compatible. */ -public class OffsetAttribute extends Attribute implements Cloneable, Serializable { +public class OffsetAttribute extends Attribute implements Cloneable { private int startOffset; private int endOffset; Index: src/java/org/apache/lucene/analysis/tokenattributes/TermAttribute.java =================================================================== --- src/java/org/apache/lucene/analysis/tokenattributes/TermAttribute.java (revision 725699) +++ src/java/org/apache/lucene/analysis/tokenattributes/TermAttribute.java (working copy) @@ -17,8 +17,6 @@ * limitations under the License. */ -import java.io.Serializable; - import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.Attribute; @@ -30,7 +28,7 @@ * The APIs introduced in these classes with Lucene 2.9 might change in the future. * We will make our best efforts to keep the APIs backwards-compatible. */ -public class TermAttribute extends Attribute implements Cloneable, Serializable { +public class TermAttribute extends Attribute implements Cloneable { private static int MIN_BUFFER_SIZE = 10; private char[] termBuffer; Index: src/java/org/apache/lucene/store/RAMDirectory.java =================================================================== --- src/java/org/apache/lucene/store/RAMDirectory.java (revision 725699) +++ src/java/org/apache/lucene/store/RAMDirectory.java (working copy) @@ -20,7 +20,6 @@ import java.io.IOException; import java.io.FileNotFoundException; import java.io.File; -import java.io.Serializable; import java.util.HashMap; import java.util.Iterator; import java.util.Set; @@ -32,7 +31,7 @@ * * @version $Id$ */ -public class RAMDirectory extends Directory implements Serializable { +public class RAMDirectory extends Directory { private static final long serialVersionUID = 1l; Index: src/java/org/apache/lucene/store/RAMFile.java =================================================================== --- src/java/org/apache/lucene/store/RAMFile.java (revision 725699) +++ src/java/org/apache/lucene/store/RAMFile.java (working copy) @@ -18,11 +18,8 @@ */ import java.util.ArrayList; -import java.io.Serializable; -class RAMFile implements Serializable { - - private static final long serialVersionUID = 1l; +class RAMFile { private ArrayList buffers = new ArrayList(); long length; Index: src/test/org/apache/lucene/search/QueryUtils.java =================================================================== --- src/test/org/apache/lucene/search/QueryUtils.java (revision 725699) +++ src/test/org/apache/lucene/search/QueryUtils.java (working copy) @@ -1,13 +1,9 @@ package org.apache.lucene.search; +import java.io.IOException; + import junit.framework.TestCase; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - /** * Copyright 2005 Apache Software Foundation * @@ -88,7 +84,6 @@ checkSkipTo(q1,is); } checkExplanations(q1,s); - checkSerialization(q1,s); } } catch (IOException e) { throw new RuntimeException(e); @@ -95,31 +90,6 @@ } } - /** check that the query weight is serializable. - * @throws IOException if serialization check fail. - */ - private static void checkSerialization(Query q, Searcher s) throws IOException { - Weight w = q.weight(s); - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(bos); - oos.writeObject(w); - oos.close(); - ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray())); - ois.readObject(); - ois.close(); - - //skip rquals() test for now - most weights don't overide equals() and we won't add this just for the tests. - //TestCase.assertEquals("writeObject(w) != w. ("+w+")",w2,w); - - } catch (Exception e) { - IOException e2 = new IOException("Serialization failed for "+w); - e2.initCause(e); - throw e2; - } - } - - /** alternate scorer skipTo(),skipTo(),next(),next(),skipTo(),skipTo(), etc * and ensure a hitcollector receives same docs and scores */ Index: src/test/org/apache/lucene/search/TestSort.java =================================================================== --- src/test/org/apache/lucene/search/TestSort.java (revision 725699) +++ src/test/org/apache/lucene/search/TestSort.java (working copy) @@ -31,10 +31,6 @@ import org.apache.lucene.util.DocIdBitSet; import java.io.IOException; -import java.io.Serializable; -import java.rmi.Naming; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; import java.util.BitSet; import java.util.HashMap; import java.util.Iterator; @@ -51,19 +47,18 @@ */ public class TestSort -extends TestCase -implements Serializable { +extends TestCase { - private Searcher full; - private Searcher searchX; - private Searcher searchY; - private Query queryX; - private Query queryY; - private Query queryA; + protected Searcher full; + protected Searcher searchX; + protected Searcher searchY; + protected Query queryX; + protected Query queryY; + protected Query queryA; private Query queryE; private Query queryF; private Query queryG; - private Sort sort; + protected Sort sort; public TestSort (String name) { @@ -75,13 +70,6 @@ TestRunner.run (suite()); else if ("server".equals (argv[0])) { TestSort test = new TestSort (null); - try { - test.startServer(); - Thread.sleep (500000); - } catch (Exception e) { - System.out.println (e); - e.printStackTrace(); - } } } @@ -144,7 +132,7 @@ return new IndexSearcher (indexStore); } - private Searcher getFullIndex() + protected Searcher getFullIndex() throws IOException { return getIndex (true, true); } @@ -479,132 +467,6 @@ runMultiSorts (searcher); } - // test a variety of sorts using a remote searcher - public void testRemoteSort() throws Exception { - Searchable searcher = getRemote(); - MultiSearcher multi = new MultiSearcher (new Searchable[] { searcher }); - runMultiSorts (multi); - } - - // test custom search when remote - public void testRemoteCustomSort() throws Exception { - Searchable searcher = getRemote(); - MultiSearcher multi = new MultiSearcher (new Searchable[] { searcher }); - sort.setSort (new SortField ("custom", SampleComparable.getComparatorSource())); - assertMatches (multi, queryX, sort, "CAIEG"); - sort.setSort (new SortField ("custom", SampleComparable.getComparatorSource(), true)); - assertMatches (multi, queryY, sort, "HJDBF"); - SortComparator custom = SampleComparable.getComparator(); - sort.setSort (new SortField ("custom", custom)); - assertMatches (multi, queryX, sort, "CAIEG"); - sort.setSort (new SortField ("custom", custom, true)); - assertMatches (multi, queryY, sort, "HJDBF"); - } - - // test that the relevancy scores are the same even if - // hits are sorted - public void testNormalizedScores() throws Exception { - - // capture relevancy scores - HashMap scoresX = getScores (full.search (queryX, null, 1000).scoreDocs, full); - HashMap scoresY = getScores (full.search (queryY, null, 1000).scoreDocs, full); - HashMap scoresA = getScores (full.search (queryA, null, 1000).scoreDocs, full); - - // we'll test searching locally, remote and multi - MultiSearcher remote = new MultiSearcher (new Searchable[] { getRemote() }); - MultiSearcher multi = new MultiSearcher (new Searchable[] { searchX, searchY }); - - // change sorting and make sure relevancy stays the same - - sort = new Sort(); - assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs, multi)); - - sort.setSort(SortField.FIELD_DOC); - assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs, multi)); - - sort.setSort ("int"); - assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs, multi)); - - sort.setSort ("float"); - assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs, multi)); - - sort.setSort ("string"); - assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs, multi)); - - sort.setSort (new String[] {"int","float"}); - assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs, multi)); - - sort.setSort (new SortField[] { new SortField ("int", true), new SortField (null, SortField.DOC, true) }); - assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs, multi)); - - sort.setSort (new String[] {"float","string"}); - assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs, multi)); - assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs, full)); - assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs, remote)); - assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs, multi)); - - } public void testTopDocsScores() throws Exception { @@ -633,7 +495,7 @@ // runs a variety of sorts useful for multisearchers - private void runMultiSorts (Searcher multi) throws Exception { + protected void runMultiSorts (Searcher multi) throws Exception { sort.setSort (SortField.FIELD_DOC); assertMatchesPattern (multi, queryA, sort, "[AB]{2}[CD]{2}[EF]{2}[GH]{2}[IJ]{2}"); @@ -693,7 +555,7 @@ } // make sure the documents returned by the search match the expected list - private void assertMatches (Searcher searcher, Query query, Sort sort, String expectedResult) + protected void assertMatches (Searcher searcher, Query query, Sort sort, String expectedResult) throws IOException { ScoreDoc[] result = searcher.search (query, null, 1000, sort).scoreDocs; StringBuffer buff = new StringBuffer(10); @@ -709,7 +571,7 @@ } // make sure the documents returned by the search match the expected list pattern - private void assertMatchesPattern (Searcher searcher, Query query, Sort sort, String pattern) + protected void assertMatchesPattern (Searcher searcher, Query query, Sort sort, String pattern) throws IOException { ScoreDoc[] result = searcher.search (query, null, 1000, sort).scoreDocs; StringBuffer buff = new StringBuffer(10); @@ -725,7 +587,7 @@ assertTrue (Pattern.compile(pattern).matcher(buff.toString()).matches()); } - private HashMap getScores (ScoreDoc[] hits, Searcher searcher) + protected HashMap getScores (ScoreDoc[] hits, Searcher searcher) throws IOException { HashMap scoreMap = new HashMap(); int n = hits.length; @@ -739,7 +601,7 @@ } // make sure all the values in the maps match - private void assertSameValues (HashMap m1, HashMap m2) { + protected void assertSameValues (HashMap m1, HashMap m2) { int n = m1.size(); int m = m2.size(); assertEquals (n, m); @@ -755,29 +617,4 @@ } } } - - private Searchable getRemote () throws Exception { - try { - return lookupRemote (); - } catch (Throwable e) { - startServer (); - return lookupRemote (); - } - } - - private Searchable lookupRemote () throws Exception { - return (Searchable) Naming.lookup ("//localhost/SortedSearchable"); - } - - private void startServer () throws Exception { - // construct an index - Searcher local = getFullIndex(); - // local.search (queryA, new Sort()); - - // publish it - Registry reg = LocateRegistry.createRegistry (1099); - RemoteSearchable impl = new RemoteSearchable (local); - Naming.rebind ("//localhost/SortedSearchable", impl); - } - } Index: src/test/org/apache/lucene/search/SampleComparable.java =================================================================== --- src/test/org/apache/lucene/search/SampleComparable.java (revision 725699) +++ src/test/org/apache/lucene/search/SampleComparable.java (working copy) @@ -23,7 +23,6 @@ import org.apache.lucene.index.TermEnum; import java.io.IOException; -import java.io.Serializable; /** * An example Comparable for use with the custom sort tests. @@ -47,7 +46,7 @@ * @since 1.4 */ public class SampleComparable -implements Comparable, Serializable { +implements Comparable { String string_part; Integer int_part; Index: src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java =================================================================== --- src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java (revision 725699) +++ src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java (working copy) @@ -1,59 +0,0 @@ -package org.apache.lucene.search; - -/** - * 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 java.util.BitSet; - -import junit.framework.TestCase; - -import org.apache.lucene.index.IndexReader; - -/** - * A unit test helper class to help with RemoteCachingWrapperFilter testing and - * assert that it is working correctly. - */ -public class RemoteCachingWrapperFilterHelper extends RemoteCachingWrapperFilter { - - private boolean shouldHaveCache; - - public RemoteCachingWrapperFilterHelper(Filter filter, boolean shouldHaveCache) { - super(filter); - this.shouldHaveCache = shouldHaveCache; - } - - public void shouldHaveCache(boolean shouldHaveCache) { - this.shouldHaveCache = shouldHaveCache; - } - - public DocIdSet getDocIdSet(IndexReader reader) throws IOException { - Filter cachedFilter = FilterManager.getInstance().getFilter(filter); - - TestCase.assertNotNull("Filter should not be null", cachedFilter); - if (!shouldHaveCache) { - TestCase.assertSame("First time filter should be the same ", filter, cachedFilter); - } else { - TestCase.assertNotSame("We should have a cached version of the filter", filter, cachedFilter); - } - - if (filter instanceof CachingWrapperFilterHelper) { - ((CachingWrapperFilterHelper)cachedFilter).setShouldHaveCache(shouldHaveCache); - } - return cachedFilter.getDocIdSet(reader); - } -} Index: src/test/org/apache/lucene/search/TestCustomSearcherSort.java =================================================================== --- src/test/org/apache/lucene/search/TestCustomSearcherSort.java (revision 725699) +++ src/test/org/apache/lucene/search/TestCustomSearcherSort.java (working copy) @@ -17,7 +17,6 @@ */ import java.io.IOException; -import java.io.Serializable; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Map; @@ -45,8 +44,7 @@ */ public class TestCustomSearcherSort -extends TestCase -implements Serializable { +extends TestCase { private Directory index = null; private Query query = null; Index: src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java =================================================================== --- src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java (revision 725699) +++ src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java (working copy) @@ -1,127 +0,0 @@ -package org.apache.lucene.search; - -/** - * 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.rmi.Naming; -import java.rmi.registry.LocateRegistry; - -import org.apache.lucene.util.LuceneTestCase; - -import org.apache.lucene.analysis.SimpleAnalyzer; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.lucene.index.IndexWriter; -import org.apache.lucene.index.Term; -import org.apache.lucene.store.RAMDirectory; - -/** - * Tests that the index is cached on the searcher side of things. - * NOTE: This is copied from TestRemoteSearchable since it already had a remote index set up. - */ -public class TestRemoteCachingWrapperFilter extends LuceneTestCase { - public TestRemoteCachingWrapperFilter(String name) { - super(name); - } - - private static Searchable getRemote() throws Exception { - try { - return lookupRemote(); - } catch (Throwable e) { - startServer(); - return lookupRemote(); - } - } - - private static Searchable lookupRemote() throws Exception { - return (Searchable)Naming.lookup("//localhost/Searchable"); - } - - private static void startServer() throws Exception { - // construct an index - RAMDirectory indexStore = new RAMDirectory(); - IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true, - IndexWriter.MaxFieldLength.LIMITED); - Document doc = new Document(); - doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED)); - doc.add(new Field("type", "A", Field.Store.YES, Field.Index.ANALYZED)); - doc.add(new Field("other", "other test text", Field.Store.YES, Field.Index.ANALYZED)); - writer.addDocument(doc); - //Need a second document to search for - doc = new Document(); - doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED)); - doc.add(new Field("type", "B", Field.Store.YES, Field.Index.ANALYZED)); - doc.add(new Field("other", "other test text", Field.Store.YES, Field.Index.ANALYZED)); - writer.addDocument(doc); - writer.optimize(); - writer.close(); - - // publish it - LocateRegistry.createRegistry(1099); - Searchable local = new IndexSearcher(indexStore); - RemoteSearchable impl = new RemoteSearchable(local); - Naming.rebind("//localhost/Searchable", impl); - } - - private static void search(Query query, Filter filter, int hitNumber, String typeValue) throws Exception { - Searchable[] searchables = { getRemote() }; - Searcher searcher = new MultiSearcher(searchables); - ScoreDoc[] result = searcher.search(query,filter, 1000).scoreDocs; - assertEquals(1, result.length); - Document document = searcher.doc(result[hitNumber].doc); - assertTrue("document is null and it shouldn't be", document != null); - assertEquals(typeValue, document.get("type")); - assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 3, document.getFields().size() == 3); - } - - - public void testTermRemoteFilter() throws Exception { - CachingWrapperFilterHelper cwfh = new CachingWrapperFilterHelper(new QueryWrapperFilter(new TermQuery(new Term("type", "a")))); - - // This is what we are fixing - if one uses a CachingWrapperFilter(Helper) it will never - // cache the filter on the remote site - cwfh.setShouldHaveCache(false); - search(new TermQuery(new Term("test", "test")), cwfh, 0, "A"); - cwfh.setShouldHaveCache(false); - search(new TermQuery(new Term("test", "test")), cwfh, 0, "A"); - - // This is how we fix caching - we wrap a Filter in the RemoteCachingWrapperFilter(Handler - for testing) - // to cache the Filter on the searcher (remote) side - RemoteCachingWrapperFilterHelper rcwfh = new RemoteCachingWrapperFilterHelper(cwfh, false); - search(new TermQuery(new Term("test", "test")), rcwfh, 0, "A"); - - // 2nd time we do the search, we should be using the cached Filter - rcwfh.shouldHaveCache(true); - search(new TermQuery(new Term("test", "test")), rcwfh, 0, "A"); - - // assert that we get the same cached Filter, even if we create a new instance of RemoteCachingWrapperFilter(Helper) - // this should pass because the Filter parameters are the same, and the cache uses Filter's hashCode() as cache keys, - // and Filters' hashCode() builds on Filter parameters, not the Filter instance itself - rcwfh = new RemoteCachingWrapperFilterHelper(new QueryWrapperFilter(new TermQuery(new Term("type", "a"))), false); - rcwfh.shouldHaveCache(false); - search(new TermQuery(new Term("test", "test")), rcwfh, 0, "A"); - - rcwfh = new RemoteCachingWrapperFilterHelper(new QueryWrapperFilter(new TermQuery(new Term("type", "a"))), false); - rcwfh.shouldHaveCache(true); - search(new TermQuery(new Term("test", "test")), rcwfh, 0, "A"); - - // assert that we get a non-cached version of the Filter because this is a new Query (type:b) - rcwfh = new RemoteCachingWrapperFilterHelper(new QueryWrapperFilter(new TermQuery(new Term("type", "b"))), false); - rcwfh.shouldHaveCache(false); - search(new TermQuery(new Term("type", "b")), rcwfh, 0, "B"); - } -} Index: src/test/org/apache/lucene/search/TestRemoteSearchable.java =================================================================== --- src/test/org/apache/lucene/search/TestRemoteSearchable.java (revision 725699) +++ src/test/org/apache/lucene/search/TestRemoteSearchable.java (working copy) @@ -1,136 +0,0 @@ -package org.apache.lucene.search; - -/** - * 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 org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.analysis.SimpleAnalyzer; -import org.apache.lucene.document.*; -import org.apache.lucene.index.IndexWriter; -import org.apache.lucene.index.Term; -import org.apache.lucene.store.RAMDirectory; - -import java.rmi.Naming; -import java.rmi.registry.LocateRegistry; -import java.util.Collections; -import java.util.Set; -import java.util.HashSet; - -/** - * @version $Id$ - */ -public class TestRemoteSearchable extends LuceneTestCase { - public TestRemoteSearchable(String name) { - super(name); - } - - private static Searchable getRemote() throws Exception { - try { - return lookupRemote(); - } catch (Throwable e) { - startServer(); - return lookupRemote(); - } - } - - private static Searchable lookupRemote() throws Exception { - return (Searchable)Naming.lookup("//localhost/Searchable"); - } - - private static void startServer() throws Exception { - // construct an index - RAMDirectory indexStore = new RAMDirectory(); - IndexWriter writer = new IndexWriter(indexStore,new SimpleAnalyzer(),true, IndexWriter.MaxFieldLength.LIMITED); - Document doc = new Document(); - doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED)); - doc.add(new Field("other", "other test text", Field.Store.YES, Field.Index.ANALYZED)); - writer.addDocument(doc); - writer.optimize(); - writer.close(); - - // publish it - LocateRegistry.createRegistry(1099); - Searchable local = new IndexSearcher(indexStore); - RemoteSearchable impl = new RemoteSearchable(local); - Naming.rebind("//localhost/Searchable", impl); - } - - private static void search(Query query) throws Exception { - // try to search the published index - Searchable[] searchables = { getRemote() }; - Searcher searcher = new MultiSearcher(searchables); - ScoreDoc[] result = searcher.search(query, null, 1000).scoreDocs; - - assertEquals(1, result.length); - Document document = searcher.doc(result[0].doc); - assertTrue("document is null and it shouldn't be", document != null); - assertEquals("test text", document.get("test")); - assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 2, document.getFields().size() == 2); - Set ftl = new HashSet(); - ftl.add("other"); - FieldSelector fs = new SetBasedFieldSelector(ftl, Collections.EMPTY_SET); - document = searcher.doc(0, fs); - assertTrue("document is null and it shouldn't be", document != null); - assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 1, document.getFields().size() == 1); - fs = new MapFieldSelector(new String[]{"other"}); - document = searcher.doc(0, fs); - assertTrue("document is null and it shouldn't be", document != null); - assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 1, document.getFields().size() == 1); - } - - public void testTermQuery() throws Exception { - search(new TermQuery(new Term("test", "test"))); - } - - public void testBooleanQuery() throws Exception { - BooleanQuery query = new BooleanQuery(); - query.add(new TermQuery(new Term("test", "test")), BooleanClause.Occur.MUST); - search(query); - } - - public void testPhraseQuery() throws Exception { - PhraseQuery query = new PhraseQuery(); - query.add(new Term("test", "test")); - query.add(new Term("test", "text")); - search(query); - } - - // Tests bug fix at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20290 - public void testQueryFilter() throws Exception { - // try to search the published index - Searchable[] searchables = { getRemote() }; - Searcher searcher = new MultiSearcher(searchables); - ScoreDoc[] hits = searcher.search( - new TermQuery(new Term("test", "text")), - new QueryWrapperFilter(new TermQuery(new Term("test", "test"))), 1000).scoreDocs; - assertEquals(1, hits.length); - ScoreDoc[] nohits = searcher.search( - new TermQuery(new Term("test", "text")), - new QueryWrapperFilter(new TermQuery(new Term("test", "non-existent-term"))), 1000).scoreDocs; - assertEquals(0, nohits.length); - } - - public void testConstantScoreQuery() throws Exception { - // try to search the published index - Searchable[] searchables = { getRemote() }; - Searcher searcher = new MultiSearcher(searchables); - ScoreDoc[] hits = searcher.search( - new ConstantScoreQuery(new QueryWrapperFilter( - new TermQuery(new Term("test", "test")))), null, 1000).scoreDocs; - assertEquals(1, hits.length); - } -} Index: build.xml =================================================================== --- build.xml (revision 725699) +++ build.xml (working copy) @@ -75,11 +75,7 @@ - - - + description="Compiles core classes"> + + + + + + + Remote - support for remote searchers via RMI + + + + + + + + + + + + + + + + + + + + + Index: contrib/remote/pom.xml.template =================================================================== --- contrib/remote/pom.xml.template (revision 0) +++ contrib/remote/pom.xml.template (revision 0) @@ -0,0 +1,45 @@ + + + + + 4.0.0 + + org.apache.lucene + lucene-contrib + @version@ + + org.apache.lucene + lucene-remote + Lucene Remote + @version@ + + Remote - support for remote searchers via RMI + + jar + + + com.thoughtworks.xstream + xstream + 1.3 + + + Index: contrib/remote/lib/cglib-license.txt =================================================================== --- contrib/remote/lib/cglib-license.txt (revision 0) +++ contrib/remote/lib/cglib-license.txt (revision 0) @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. Index: contrib/remote/lib/commons-lang-license.txt =================================================================== --- contrib/remote/lib/commons-lang-license.txt (revision 0) +++ contrib/remote/lib/commons-lang-license.txt (revision 0) @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. Index: contrib/remote/lib/dom4j-license.txt =================================================================== --- contrib/remote/lib/dom4j-license.txt (revision 0) +++ contrib/remote/lib/dom4j-license.txt (revision 0) @@ -0,0 +1,31 @@ +BSD STYLE LICENSE + +Redistribution and use of this software and associated documentation ("Software"), +with or without modification, are permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain copyright statements and notices. + Redistributions must also contain a copy of this document. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + 3. The name "DOM4J" must not be used to endorse or promote products derived + from this Software without prior written permission of MetaStuff, Ltd. For + written permission, please contact dom4j-info@metastuff.com. + 4. Products derived from this Software may not be called "DOM4J" nor may + "DOM4J" appear in their names without prior written permission of MetaStuff, + Ltd. DOM4J is a registered trademark of MetaStuff, Ltd. + 5. Due credit should be given to the DOM4J Project (http://dom4j.org/). + +THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.\ No newline at end of file Index: contrib/remote/lib/jdom-license.txt =================================================================== --- contrib/remote/lib/jdom-license.txt (revision 0) +++ contrib/remote/lib/jdom-license.txt (revision 0) @@ -0,0 +1,54 @@ +/*-- + + Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions, and the disclaimer that follows + these conditions in the documentation and/or other materials + provided with the distribution. + + 3. The name "JDOM" must not be used to endorse or promote products + derived from this software without prior written permission. For + written permission, please contact . + + 4. Products derived from this software may not be called "JDOM", nor + may "JDOM" appear in their name, without prior written permission + from the JDOM Project Management . + + In addition, we request (but do not require) that you include in the + end-user documentation provided with the redistribution and/or in the + software itself an acknowledgement equivalent to the following: + "This product includes software developed by the + JDOM Project (http://www.jdom.org/)." + Alternatively, the acknowledgment may be graphical using the logos + available at http://www.jdom.org/images/logos. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + This software consists of voluntary contributions made by many + individuals on behalf of the JDOM Project and was originally + created by Jason Hunter and + Brett McLaughlin . For more information + on the JDOM Project, please see . + + */ + Index: contrib/remote/lib/jettison-license.txt =================================================================== --- contrib/remote/lib/jettison-license.txt (revision 0) +++ contrib/remote/lib/jettison-license.txt (revision 0) @@ -0,0 +1,192 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2006 Envoi Solutions LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + Index: contrib/remote/lib/joda-time-license.txt =================================================================== --- contrib/remote/lib/joda-time-license.txt (revision 0) +++ contrib/remote/lib/joda-time-license.txt (revision 0) @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. Index: contrib/remote/lib/oro-license.txt =================================================================== --- contrib/remote/lib/oro-license.txt (revision 0) +++ contrib/remote/lib/oro-license.txt (revision 0) @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. Index: contrib/remote/lib/stax-license.txt =================================================================== --- contrib/remote/lib/stax-license.txt (revision 0) +++ contrib/remote/lib/stax-license.txt (revision 0) @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. Index: contrib/remote/lib/woodstox-license.txt =================================================================== --- contrib/remote/lib/woodstox-license.txt (revision 0) +++ contrib/remote/lib/woodstox-license.txt (revision 0) @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. Index: contrib/remote/lib/xom-license.txt =================================================================== --- contrib/remote/lib/xom-license.txt (revision 0) +++ contrib/remote/lib/xom-license.txt (revision 0) @@ -0,0 +1,24 @@ +XOM + +Copyright 2002-2004 Elliotte Rusty Harold + +This library is free software; you can redistribute +it and/or modify it under the terms of version 2.1 of +the GNU Lesser General Public License as published by +the Free Software Foundation. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General +Public License along with this library; if not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, +Boston, MA 02111-1307 USA + +You can contact Elliotte Rusty Harold by sending e-mail to +elharo@metalab.unc.edu. Please include the word "XOM" in the +subject line. The XOM home page is temporarily located at +http://www.cafeconleche.org/XOM/ but will eventually move +to http://www.xom.nu/ Index: contrib/remote/lib/xpp3-license.txt =================================================================== --- contrib/remote/lib/xpp3-license.txt (revision 0) +++ contrib/remote/lib/xpp3-license.txt (revision 0) @@ -0,0 +1,46 @@ +Indiana University Extreme! Lab Software License + +Version 1.1.1 + +Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + +3. The end-user documentation included with the redistribution, if any, + must include the following acknowledgment: + + "This product includes software developed by the Indiana University + Extreme! Lab (http://www.extreme.indiana.edu/)." + +Alternately, this acknowledgment may appear in the software itself, +if and wherever such third-party acknowledgments normally appear. + +4. The names "Indiana Univeristy" and "Indiana Univeristy Extreme! Lab" +must not be used to endorse or promote products derived from this +software without prior written permission. For written permission, +please contact http://www.extreme.indiana.edu/. + +5. Products derived from this software may not use "Indiana Univeristy" +name nor may "Indiana Univeristy" appear in their name, without prior +written permission of the Indiana University. + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHORS, COPYRIGHT HOLDERS OR ITS CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\ No newline at end of file Index: contrib/remote/lib/xstream-license.txt =================================================================== --- contrib/remote/lib/xstream-license.txt (revision 0) +++ contrib/remote/lib/xstream-license.txt (revision 0) @@ -0,0 +1,26 @@ +Copyright (c) 2003-2006, Joe Walnes +Copyright (c) 2006-2007, XStream Committers +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of XStream nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE.\ No newline at end of file Index: contrib/remote/src/java/org/apache/lucene/remote/Serializer.java =================================================================== --- contrib/remote/src/java/org/apache/lucene/remote/Serializer.java (revision 0) +++ contrib/remote/src/java/org/apache/lucene/remote/Serializer.java (revision 0) @@ -0,0 +1,56 @@ +package org.apache.lucene.remote; + +import org.apache.lucene.document.Document; +import org.apache.lucene.document.FieldSelector; +import org.apache.lucene.index.Term; +import org.apache.lucene.search.Explanation; +import org.apache.lucene.search.Filter; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.Sort; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.TopFieldDocs; + +/** + * + */ +public interface Serializer { + public String encodeTerm(Term term); + + public Term decodeTerm(String term); + + public String encodeTerms(Term[] terms); + + public Term[] decodeTerms(String terms); + + public String encodeQuery(Query query); + + public Query decodeQuery(String query); + + public String encodeFilter(Filter filter); + + public Filter decodeFilter(String filter); + + public String encodeSort(Sort sort); + + public Sort decodeSort(String sort); + + public String encodeDocument(Document document); + + public Document decodeDocument(String document); + + public String encodeExplanation(Explanation explanation); + + public Explanation decodeExplanation(String explanation); + + public String encodeTopDocs(TopDocs topDocs); + + public TopDocs decodeTopDocs(String topDocs); + + public String encodeTopFieldDocs(TopFieldDocs topFieldDocs); + + public TopFieldDocs decodeTopFieldDocs(String topFieldDocs); + + public String encodeFieldSelector(FieldSelector fieldSelector); + + public FieldSelector decodeFieldSelector(String fieldSelector); +} Index: contrib/remote/src/java/org/apache/lucene/remote/FilterManager.java =================================================================== --- contrib/remote/src/java/org/apache/lucene/remote/FilterManager.java (revision 0) +++ contrib/remote/src/java/org/apache/lucene/remote/FilterManager.java (working copy) @@ -1,4 +1,4 @@ -package org.apache.lucene.search; +package org.apache.lucene.remote; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -24,8 +24,10 @@ import java.util.Map; import java.util.TreeSet; +import org.apache.lucene.search.Filter; + /** - * Filter caching singleton. It can be used by {@link org.apache.lucene.search.RemoteCachingWrapperFilter} + * Filter caching singleton. It can be used by {@link org.apache.lucene.remote.RemoteCachingWrapperFilter} * or just to save filters locally for reuse. * This class makes it possble to cache Filters even when using RMI, as it * keeps the cache on the seaercher side of the RMI connection. Property changes on: . ___________________________________________________________________ Name: svn:eol-style + native Index: contrib/remote/src/java/org/apache/lucene/remote/RemoteCachingWrapperFilter.java =================================================================== --- contrib/remote/src/java/org/apache/lucene/remote/RemoteCachingWrapperFilter.java (revision 0) +++ contrib/remote/src/java/org/apache/lucene/remote/RemoteCachingWrapperFilter.java (revision 0) @@ -0,0 +1,72 @@ +package org.apache.lucene.remote; + +/** + * 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 java.util.BitSet; + +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.search.CachingWrapperFilter; +import org.apache.lucene.search.DocIdSet; +import org.apache.lucene.search.Filter; + +/** + * Provides caching of {@link Filter}s themselves on the remote end of an RMI connection. + * The cache is keyed on Filter's hashCode(), so if it sees the same filter twice + * it will reuse the original version. + *

    + * NOTE: This does NOT cache the Filter bits, but rather the Filter itself. + * Thus, this works hand-in-hand with {@link CachingWrapperFilter} to keep both + * file Filter cache and the Filter bits on the remote end, close to the searcher. + *

    + * Usage: + *

    + * To cache a result you must do something like + * RemoteCachingWrapperFilter f = new RemoteCachingWrapperFilter(new CachingWrapperFilter(myFilter)); + *

    + */ +public class RemoteCachingWrapperFilter extends Filter { + protected Filter filter; + + public RemoteCachingWrapperFilter(Filter filter) { + this.filter = filter; + } + + /** + * Uses the {@link FilterManager} to keep the cache for a filter on the + * searcher side of a remote connection. + * @param reader the index reader for the Filter + * @return the bitset + * @deprecated Use {@link #getDocIdSet(IndexReader)} instead. + */ + public BitSet bits(IndexReader reader) throws IOException { + Filter cachedFilter = FilterManager.getInstance().getFilter(filter); + return cachedFilter.bits(reader); + } + + /** + * Uses the {@link FilterManager} to keep the cache for a filter on the + * searcher side of a remote connection. + * @param reader the index reader for the Filter + * @return the DocIdSet + */ + public DocIdSet getDocIdSet(IndexReader reader) throws IOException { + Filter cachedFilter = FilterManager.getInstance().getFilter(filter); + return cachedFilter.getDocIdSet(reader); + } +} Index: contrib/remote/src/java/org/apache/lucene/remote/RemoteSearcher.java =================================================================== --- contrib/remote/src/java/org/apache/lucene/remote/RemoteSearcher.java (revision 0) +++ contrib/remote/src/java/org/apache/lucene/remote/RemoteSearcher.java (revision 0) @@ -0,0 +1,34 @@ +package org.apache.lucene.remote; + +import java.io.IOException; +import java.rmi.Remote; + +import org.apache.lucene.index.CorruptIndexException; + +/** + * + */ +public interface RemoteSearcher extends Remote { + + public void close() throws IOException; + + public String doc(int i) throws CorruptIndexException, IOException; + + public String doc(int n, String fieldSelector) throws CorruptIndexException, + IOException; + + public int docFreq(String term) throws IOException; + + public int[] docFreqs(String terms) throws IOException; + + public String explain(String query, int doc) throws IOException; + + public int maxDoc() throws IOException; + + public String rewrite(String query) throws IOException; + + public String search(String query, String filter, int n) throws IOException; + + public String search(String query, String filter, int n, String sort) + throws IOException; +} Index: contrib/remote/src/java/org/apache/lucene/remote/xstream/RemoteSearcherMain.java =================================================================== --- contrib/remote/src/java/org/apache/lucene/remote/xstream/RemoteSearcherMain.java (revision 0) +++ contrib/remote/src/java/org/apache/lucene/remote/xstream/RemoteSearcherMain.java (revision 0) @@ -0,0 +1,42 @@ +package org.apache.lucene.remote.xstream; + +import java.rmi.Naming; +import java.rmi.RMISecurityManager; + +import org.apache.lucene.remote.DefaultRemoteSearcher; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.Searcher; + +/** + * + */ +public class RemoteSearcherMain { + /** + * Exports a searcher for the index in args[0] named + * "//localhost/RemoteSearcher". + */ + public static void main(String args[]) throws Exception { + String indexName = null; + + if (args != null && args.length == 1) + indexName = args[0]; + + if (indexName == null) { + System.out + .println("Usage: org.apache.lucene.remote.xstream.RemoteSearcherMain "); + return; + } + + // create and install a security manager + if (System.getSecurityManager() == null) { + System.setSecurityManager(new RMISecurityManager()); + } + + Searcher local = new IndexSearcher(indexName); + DefaultRemoteSearcher impl = new DefaultRemoteSearcher(local, + new XStreamSerializer()); + + // bind the implementation to "RemoteSearcher" + Naming.rebind("//localhost/RemoteSearcher", impl); + } +} Index: contrib/remote/src/java/org/apache/lucene/remote/xstream/TermConverter.java =================================================================== --- contrib/remote/src/java/org/apache/lucene/remote/xstream/TermConverter.java (revision 0) +++ contrib/remote/src/java/org/apache/lucene/remote/xstream/TermConverter.java (revision 0) @@ -0,0 +1,45 @@ +package org.apache.lucene.remote.xstream; + +import org.apache.lucene.index.Term; + +import com.thoughtworks.xstream.converters.Converter; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; + +/** + * we need a custom converter for Term because the default converter doesn't + * intern() the field string + */ +public class TermConverter implements Converter { + + public void marshal(Object source, HierarchicalStreamWriter writer, + MarshallingContext context) { + Term term = (Term) source; + writer.startNode("field"); + writer.setValue(term.field()); + writer.endNode(); + writer.startNode("text"); + writer.setValue(term.text()); + writer.endNode(); + } + + public Object unmarshal(HierarchicalStreamReader reader, + UnmarshallingContext context) { + reader.moveDown(); + String field = reader.getValue(); + reader.moveUp(); + reader.moveDown(); + String text = reader.getValue(); + reader.moveUp(); + + // explicit constructor call intern()s field + return new Term(field, text); + } + + public boolean canConvert(Class type) { + return type.equals(Term.class); + } + +} Index: contrib/remote/src/java/org/apache/lucene/remote/xstream/XStreamSerializer.java =================================================================== --- contrib/remote/src/java/org/apache/lucene/remote/xstream/XStreamSerializer.java (revision 0) +++ contrib/remote/src/java/org/apache/lucene/remote/xstream/XStreamSerializer.java (revision 0) @@ -0,0 +1,106 @@ +package org.apache.lucene.remote.xstream; + +import org.apache.lucene.document.Document; +import org.apache.lucene.document.FieldSelector; +import org.apache.lucene.index.Term; +import org.apache.lucene.remote.Serializer; +import org.apache.lucene.search.Explanation; +import org.apache.lucene.search.Filter; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.Sort; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.TopFieldDocs; + +import com.thoughtworks.xstream.XStream; + +/** + * + */ +public class XStreamSerializer implements Serializer { + XStream xstream; + + public XStreamSerializer() { + xstream = new XStream(); + xstream.registerConverter(new TermConverter()); + } + + public Document decodeDocument(String document) { + return (Document) xstream.fromXML(document); + } + + public Explanation decodeExplanation(String explanation) { + return (Explanation) xstream.fromXML(explanation); + } + + public FieldSelector decodeFieldSelector(String fieldSelector) { + return (FieldSelector) xstream.fromXML(fieldSelector); + } + + public Filter decodeFilter(String filter) { + return (Filter) xstream.fromXML(filter); + } + + public Query decodeQuery(String query) { + return (Query) xstream.fromXML(query); + } + + public Sort decodeSort(String sort) { + return (Sort) xstream.fromXML(sort); + } + + public Term decodeTerm(String term) { + return (Term) xstream.fromXML(term); + } + + public Term[] decodeTerms(String terms) { + return (Term[]) xstream.fromXML(terms); + } + + public TopDocs decodeTopDocs(String topDocs) { + return (TopDocs) xstream.fromXML(topDocs); + } + + public TopFieldDocs decodeTopFieldDocs(String topFieldDocs) { + return (TopFieldDocs) xstream.fromXML(topFieldDocs); + } + + public String encodeDocument(Document document) { + return xstream.toXML(document); + } + + public String encodeExplanation(Explanation explanation) { + return xstream.toXML(explanation); + } + + public String encodeFieldSelector(FieldSelector fieldSelector) { + return xstream.toXML(fieldSelector); + } + + public String encodeFilter(Filter filter) { + return xstream.toXML(filter); + } + + public String encodeQuery(Query query) { + return xstream.toXML(query); + } + + public String encodeSort(Sort sort) { + return xstream.toXML(sort); + } + + public String encodeTerm(Term term) { + return xstream.toXML(term); + } + + public String encodeTerms(Term[] terms) { + return xstream.toXML(terms); + } + + public String encodeTopDocs(TopDocs topDocs) { + return xstream.toXML(topDocs); + } + + public String encodeTopFieldDocs(TopFieldDocs topFieldDocs) { + return xstream.toXML(topFieldDocs); + } +} Index: contrib/remote/src/java/org/apache/lucene/remote/RemoteSearcherAdapter.java =================================================================== --- contrib/remote/src/java/org/apache/lucene/remote/RemoteSearcherAdapter.java (revision 0) +++ contrib/remote/src/java/org/apache/lucene/remote/RemoteSearcherAdapter.java (revision 0) @@ -0,0 +1,93 @@ +package org.apache.lucene.remote; + +import java.io.IOException; + +import org.apache.lucene.document.Document; +import org.apache.lucene.document.FieldSelector; +import org.apache.lucene.index.CorruptIndexException; +import org.apache.lucene.index.Term; +import org.apache.lucene.search.Explanation; +import org.apache.lucene.search.Filter; +import org.apache.lucene.search.HitCollector; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.Searchable; +import org.apache.lucene.search.Sort; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.TopFieldDocs; +import org.apache.lucene.search.Weight; + +/** + * this adapter class allows to access any RemoteSearcher as Searchable + */ +public class RemoteSearcherAdapter implements Searchable { + private RemoteSearcher searcher; + + Serializer serializer; + + public RemoteSearcherAdapter(RemoteSearcher searcher, Serializer serializable) { + this.searcher = searcher; + this.serializer = serializable; + } + + public void close() throws IOException { + searcher.close(); + } + + public Document doc(int i) throws CorruptIndexException, IOException { + return serializer.decodeDocument(searcher.doc(i)); + } + + public Document doc(int n, FieldSelector fieldSelector) + throws CorruptIndexException, IOException { + String doc = searcher.doc(n, serializer.encodeFieldSelector(fieldSelector)); + return serializer.decodeDocument(doc); + } + + public int docFreq(Term term) throws IOException { + return searcher.docFreq(serializer.encodeTerm(term)); + } + + public int[] docFreqs(Term[] terms) throws IOException { + return searcher.docFreqs(serializer.encodeTerms(terms)); + } + + public Explanation explain(Weight weight, int doc) throws IOException { + String query = serializer.encodeQuery(weight.getQuery()); + String explanation = searcher.explain(query, doc); + return serializer.decodeExplanation(explanation); + } + + public int maxDoc() throws IOException { + return searcher.maxDoc(); + } + + public Query rewrite(Query query) throws IOException { + String rewrittenQuery = searcher.rewrite(serializer.encodeQuery(query)); + return serializer.decodeQuery(rewrittenQuery); + } + + public void search(Weight weight, Filter filter, HitCollector results) + throws IOException { + // it doesn't make sense to serialize the HitCollector, therefore + // we retrieve the ScoreDoc array and apply it locally + ScoreDoc[] scoreDocs = search(weight, filter, Integer.MAX_VALUE).scoreDocs; + for (int i = 0; i < scoreDocs.length; i++) { + results.collect(scoreDocs[i].doc, scoreDocs[i].score); + } + } + + public TopDocs search(Weight weight, Filter filter, int n) throws IOException { + String topDocs = searcher.search(serializer.encodeQuery(weight.getQuery()), + serializer.encodeFilter(filter), n); + return serializer.decodeTopDocs(topDocs); + } + + public TopFieldDocs search(Weight weight, Filter filter, int n, Sort sort) + throws IOException { + String topFieldDocs = searcher.search(serializer.encodeQuery(weight + .getQuery()), serializer.encodeFilter(filter), n, serializer + .encodeSort(sort)); + return serializer.decodeTopFieldDocs(topFieldDocs); + } +} Index: contrib/remote/src/java/org/apache/lucene/remote/DefaultRemoteSearcher.java =================================================================== --- contrib/remote/src/java/org/apache/lucene/remote/DefaultRemoteSearcher.java (revision 0) +++ contrib/remote/src/java/org/apache/lucene/remote/DefaultRemoteSearcher.java (revision 0) @@ -0,0 +1,107 @@ +package org.apache.lucene.remote; + +/** + * 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 java.rmi.Naming; +import java.rmi.RMISecurityManager; +import java.rmi.RemoteException; +import java.rmi.server.UnicastRemoteObject; + +import org.apache.lucene.document.Document; +import org.apache.lucene.index.CorruptIndexException; +import org.apache.lucene.remote.xstream.XStreamSerializer; +import org.apache.lucene.search.Explanation; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.Searcher; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.TopFieldDocs; +import org.apache.lucene.search.Weight; + +/** + * A remote searchable implementation. + * + * @version $Id: RemoteSearchable.java 514675 2007-03-05 14:28:01Z gsingers $ + */ +public class DefaultRemoteSearcher extends UnicastRemoteObject implements + RemoteSearcher { + + private static final long serialVersionUID = 1L; + + private Searcher local; + + private Serializer serializer; + + /** Constructs and exports a remote searcher. */ + public DefaultRemoteSearcher(Searcher local, Serializer serializer) + throws RemoteException { + this.local = local; + this.serializer = serializer; + } + + public void close() throws IOException { + local.close(); + } + + public int maxDoc() throws IOException { + return local.maxDoc(); + } + + public String doc(int i) throws CorruptIndexException, IOException { + return serializer.encodeDocument(local.doc(i)); + } + + public String doc(int n, String fieldSelector) throws CorruptIndexException, + IOException { + Document doc = local.doc(n, serializer.decodeFieldSelector(fieldSelector)); + return serializer.encodeDocument(doc); + } + + public int docFreq(String term) throws IOException { + return local.docFreq(serializer.decodeTerm(term)); + } + + public int[] docFreqs(String terms) throws IOException { + return local.docFreqs(serializer.decodeTerms(terms)); + } + + public String explain(String query, int doc) throws IOException { + Weight weight = serializer.decodeQuery(query).weight(local); + Explanation explanation = local.explain(weight, doc); + return serializer.encodeExplanation(explanation); + } + + public String rewrite(String query) throws IOException { + Query rewrittenQuery = local.rewrite(serializer.decodeQuery(query)); + return serializer.encodeQuery(rewrittenQuery); + } + + public String search(String query, String filter, int n) throws IOException { + TopDocs topDocs = local.search(serializer.decodeQuery(query), serializer + .decodeFilter(filter), n); + return serializer.encodeTopDocs(topDocs); + } + + public String search(String query, String filter, int n, String sort) + throws IOException { + TopFieldDocs topFieldDocs = local.search(serializer.decodeQuery(query), + serializer.decodeFilter(filter), n, serializer.decodeSort(sort)); + return serializer.encodeTopFieldDocs(topFieldDocs); + } +} Index: contrib/remote/src/test/org/apache/lucene/remote/TestSerialization.java =================================================================== --- contrib/remote/src/test/org/apache/lucene/remote/TestSerialization.java (revision 0) +++ contrib/remote/src/test/org/apache/lucene/remote/TestSerialization.java (revision 0) @@ -0,0 +1,70 @@ +package org.apache.lucene.remote; + +/** + * 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 org.apache.lucene.index.Term; +import org.apache.lucene.remote.xstream.XStreamSerializer; +import org.apache.lucene.search.BooleanClause; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.ConstantScoreQuery; +import org.apache.lucene.search.PhraseQuery; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.QueryWrapperFilter; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.util.LuceneTestCase; + +/** + * @version $Id$ + */ +public class TestSerialization extends LuceneTestCase { + public TestSerialization(String name) { + super(name); + } + + private void checkQuerySerialization(Query query) { + Serializer serializer = new XStreamSerializer(); + String qs = serializer.encodeQuery(query); + Query q2 = serializer.decodeQuery(qs); + // TODO: Query doesn't implement equals + assertEquals(query.toString(), q2.toString()); + } + + public void testTermQuerySerialization() throws Exception { + checkQuerySerialization(new TermQuery(new Term("test", "test"))); + } + + public void testBooleanQuerySerialization() throws Exception { + BooleanQuery query = new BooleanQuery(); + query + .add(new TermQuery(new Term("test", "test")), BooleanClause.Occur.MUST); + checkQuerySerialization(query); + } + + public void testPhraseQuerySerialization() throws Exception { + PhraseQuery query = new PhraseQuery(); + query.add(new Term("test", "test")); + query.add(new Term("test", "text")); + checkQuerySerialization(query); + } + + public void testConstantScoreQuerySerialization() throws Exception { + ConstantScoreQuery query = new ConstantScoreQuery(new QueryWrapperFilter( + new TermQuery(new Term("test", "test")))); + checkQuerySerialization(query); + } +} Index: contrib/remote/src/test/org/apache/lucene/remote/TestRemoteSearchable.java =================================================================== --- contrib/remote/src/test/org/apache/lucene/remote/TestRemoteSearchable.java (revision 0) +++ contrib/remote/src/test/org/apache/lucene/remote/TestRemoteSearchable.java (revision 0) @@ -0,0 +1,152 @@ +package org.apache.lucene.remote; + +/** + * 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 org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.analysis.SimpleAnalyzer; +import org.apache.lucene.document.*; +import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.Term; +import org.apache.lucene.remote.DefaultRemoteSearcher; +import org.apache.lucene.remote.xstream.XStreamSerializer; +import org.apache.lucene.search.BooleanClause; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.ConstantScoreQuery; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.MultiSearcher; +import org.apache.lucene.search.PhraseQuery; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.QueryWrapperFilter; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.Searchable; +import org.apache.lucene.search.Searcher; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.store.RAMDirectory; + +import java.rmi.Naming; +import java.rmi.registry.LocateRegistry; +import java.util.Collections; +import java.util.Set; +import java.util.HashSet; + +/** + * @version $Id: TestRemoteSearchable.java 694004 2008-09-10 21:38:52Z mikemccand $ + */ +public class TestRemoteSearchable extends LuceneTestCase { + public TestRemoteSearchable(String name) { + super(name); + } + + private static Searchable getRemote() throws Exception { + try { + return lookupRemote(); + } catch (Throwable e) { + startServer(); + return lookupRemote(); + } + } + + private static Searchable lookupRemote() throws Exception { + RemoteSearcher remoteSearcher = (RemoteSearcher)Naming.lookup("//localhost/RemoteSearcher"); + RemoteSearcherAdapter remoteWrapper = new RemoteSearcherAdapter(remoteSearcher, new XStreamSerializer()); + return remoteWrapper; + } + + private static void startServer() throws Exception { + // construct an index + RAMDirectory indexStore = new RAMDirectory(); + IndexWriter writer = new IndexWriter(indexStore,new SimpleAnalyzer(),true, IndexWriter.MaxFieldLength.LIMITED); + Document doc = new Document(); + doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED)); + doc.add(new Field("other", "other test text", Field.Store.YES, Field.Index.ANALYZED)); + writer.addDocument(doc); + writer.optimize(); + writer.close(); + + // publish it + LocateRegistry.createRegistry(1099); + Searcher local = new IndexSearcher(indexStore); + DefaultRemoteSearcher impl = new DefaultRemoteSearcher(local, new XStreamSerializer()); + Naming.rebind("//localhost/RemoteSearcher", impl); + } + + private static void search(Query query) throws Exception { + // try to search the published index + Searchable[] searchables = { getRemote() }; + Searcher searcher = new MultiSearcher(searchables); + ScoreDoc[] result = searcher.search(query, null, 1000).scoreDocs; + + assertEquals(1, result.length); + Document document = searcher.doc(result[0].doc); + assertTrue("document is null and it shouldn't be", document != null); + assertEquals("test text", document.get("test")); + assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 2, document.getFields().size() == 2); + Set ftl = new HashSet(); + ftl.add("other"); + FieldSelector fs = new SetBasedFieldSelector(ftl, Collections.EMPTY_SET); + document = searcher.doc(0, fs); + assertTrue("document is null and it shouldn't be", document != null); + assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 1, document.getFields().size() == 1); + fs = new MapFieldSelector(new String[]{"other"}); + document = searcher.doc(0, fs); + assertTrue("document is null and it shouldn't be", document != null); + assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 1, document.getFields().size() == 1); + } + + public void testTermQuery() throws Exception { + search(new TermQuery(new Term("test", "test"))); + } + + public void testBooleanQuery() throws Exception { + BooleanQuery query = new BooleanQuery(); + query.add(new TermQuery(new Term("test", "test")), BooleanClause.Occur.MUST); + search(query); + } + + public void testPhraseQuery() throws Exception { + PhraseQuery query = new PhraseQuery(); + query.add(new Term("test", "test")); + query.add(new Term("test", "text")); + search(query); + } + + // Tests bug fix at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20290 + public void testQueryFilter() throws Exception { + // try to search the published index + Searchable[] searchables = { getRemote() }; + Searcher searcher = new MultiSearcher(searchables); + ScoreDoc[] hits = searcher.search( + new TermQuery(new Term("test", "text")), + new QueryWrapperFilter(new TermQuery(new Term("test", "test"))), 1000).scoreDocs; + assertEquals(1, hits.length); + ScoreDoc[] nohits = searcher.search( + new TermQuery(new Term("test", "text")), + new QueryWrapperFilter(new TermQuery(new Term("test", "non-existent-term"))), 1000).scoreDocs; + assertEquals(0, nohits.length); + } + + public void testConstantScoreQuery() throws Exception { + // try to search the published index + Searchable[] searchables = { getRemote() }; + Searcher searcher = new MultiSearcher(searchables); + ScoreDoc[] hits = searcher.search( + new ConstantScoreQuery(new QueryWrapperFilter( + new TermQuery(new Term("test", "test")))), null, 1000).scoreDocs; + assertEquals(1, hits.length); + } +} Index: contrib/remote/src/test/org/apache/lucene/remote/TestRemoteCachingWrapperFilter.java =================================================================== --- contrib/remote/src/test/org/apache/lucene/remote/TestRemoteCachingWrapperFilter.java (revision 0) +++ contrib/remote/src/test/org/apache/lucene/remote/TestRemoteCachingWrapperFilter.java (revision 0) @@ -0,0 +1,141 @@ +package org.apache.lucene.remote; + +/** + * 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.rmi.Naming; +import java.rmi.registry.LocateRegistry; + +import org.apache.lucene.util.LuceneTestCase; + +import org.apache.lucene.analysis.SimpleAnalyzer; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; +import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.Term; +import org.apache.lucene.remote.DefaultRemoteSearcher; +import org.apache.lucene.remote.xstream.XStreamSerializer; +import org.apache.lucene.search.CachingWrapperFilterHelper; +import org.apache.lucene.search.Filter; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.MultiSearcher; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.QueryWrapperFilter; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.Searchable; +import org.apache.lucene.search.Searcher; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.store.RAMDirectory; + +/** + * Tests that the index is cached on the searcher side of things. + * NOTE: This is copied from TestRemoteSearchable since it already had a remote index set up. + */ +public class TestRemoteCachingWrapperFilter extends LuceneTestCase { + public TestRemoteCachingWrapperFilter(String name) { + super(name); + } + + private static Searchable getRemote() throws Exception { + try { + return lookupRemote(); + } catch (Throwable e) { + startServer(); + return lookupRemote(); + } + } + + private static Searchable lookupRemote() throws Exception { + RemoteSearcher remoteSearcher = (RemoteSearcher)Naming.lookup("//localhost/RemoteSearcher"); + RemoteSearcherAdapter remoteWrapper = new RemoteSearcherAdapter(remoteSearcher, new XStreamSerializer()); + return remoteWrapper; + } + + private static void startServer() throws Exception { + // construct an index + RAMDirectory indexStore = new RAMDirectory(); + IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true, + IndexWriter.MaxFieldLength.LIMITED); + Document doc = new Document(); + doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED)); + doc.add(new Field("type", "A", Field.Store.YES, Field.Index.ANALYZED)); + doc.add(new Field("other", "other test text", Field.Store.YES, Field.Index.ANALYZED)); + writer.addDocument(doc); + //Need a second document to search for + doc = new Document(); + doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED)); + doc.add(new Field("type", "B", Field.Store.YES, Field.Index.ANALYZED)); + doc.add(new Field("other", "other test text", Field.Store.YES, Field.Index.ANALYZED)); + writer.addDocument(doc); + writer.optimize(); + writer.close(); + + // publish it + LocateRegistry.createRegistry(1099); + Searcher local = new IndexSearcher(indexStore); + DefaultRemoteSearcher impl = new DefaultRemoteSearcher(local, new XStreamSerializer()); + Naming.rebind("//localhost/RemoteSearcher", impl); + } + + private static void search(Query query, Filter filter, int hitNumber, String typeValue) throws Exception { + Searchable[] searchables = { getRemote() }; + Searcher searcher = new MultiSearcher(searchables); + ScoreDoc[] result = searcher.search(query,filter, 1000).scoreDocs; + assertEquals(1, result.length); + Document document = searcher.doc(result[hitNumber].doc); + assertTrue("document is null and it shouldn't be", document != null); + assertEquals(typeValue, document.get("type")); + assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 3, document.getFields().size() == 3); + } + + + public void testTermRemoteFilter() throws Exception { + CachingWrapperFilterHelper cwfh = new CachingWrapperFilterHelper(new QueryWrapperFilter(new TermQuery(new Term("type", "a")))); + + // This is what we are fixing - if one uses a CachingWrapperFilter(Helper) it will never + // cache the filter on the remote site + cwfh.setShouldHaveCache(false); + search(new TermQuery(new Term("test", "test")), cwfh, 0, "A"); + cwfh.setShouldHaveCache(false); + search(new TermQuery(new Term("test", "test")), cwfh, 0, "A"); + + // This is how we fix caching - we wrap a Filter in the RemoteCachingWrapperFilter(Handler - for testing) + // to cache the Filter on the searcher (remote) side + RemoteCachingWrapperFilterHelper rcwfh = new RemoteCachingWrapperFilterHelper(cwfh, false); + search(new TermQuery(new Term("test", "test")), rcwfh, 0, "A"); + + // 2nd time we do the search, we should be using the cached Filter + rcwfh.shouldHaveCache(true); + search(new TermQuery(new Term("test", "test")), rcwfh, 0, "A"); + + // assert that we get the same cached Filter, even if we create a new instance of RemoteCachingWrapperFilter(Helper) + // this should pass because the Filter parameters are the same, and the cache uses Filter's hashCode() as cache keys, + // and Filters' hashCode() builds on Filter parameters, not the Filter instance itself + rcwfh = new RemoteCachingWrapperFilterHelper(new QueryWrapperFilter(new TermQuery(new Term("type", "a"))), false); + rcwfh.shouldHaveCache(false); + search(new TermQuery(new Term("test", "test")), rcwfh, 0, "A"); + + rcwfh = new RemoteCachingWrapperFilterHelper(new QueryWrapperFilter(new TermQuery(new Term("type", "a"))), false); + rcwfh.shouldHaveCache(true); + search(new TermQuery(new Term("test", "test")), rcwfh, 0, "A"); + + // assert that we get a non-cached version of the Filter because this is a new Query (type:b) + rcwfh = new RemoteCachingWrapperFilterHelper(new QueryWrapperFilter(new TermQuery(new Term("type", "b"))), false); + rcwfh.shouldHaveCache(false); + search(new TermQuery(new Term("type", "b")), rcwfh, 0, "B"); + } +} Index: contrib/remote/src/test/org/apache/lucene/remote/RemoteCachingWrapperFilterHelper.java =================================================================== --- contrib/remote/src/test/org/apache/lucene/remote/RemoteCachingWrapperFilterHelper.java (revision 0) +++ contrib/remote/src/test/org/apache/lucene/remote/RemoteCachingWrapperFilterHelper.java (working copy) @@ -1,4 +1,4 @@ -package org.apache.lucene.search; +package org.apache.lucene.remote; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -18,7 +18,6 @@ */ import java.io.IOException; -import java.util.BitSet; import junit.framework.TestCase; @@ -23,6 +22,11 @@ import junit.framework.TestCase; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.remote.FilterManager; +import org.apache.lucene.remote.RemoteCachingWrapperFilter; +import org.apache.lucene.search.CachingWrapperFilterHelper; +import org.apache.lucene.search.DocIdSet; +import org.apache.lucene.search.Filter; /** * A unit test helper class to help with RemoteCachingWrapperFilter testing and Property changes on: . ___________________________________________________________________ Name: svn:eol-style + native Index: contrib/remote/src/test/org/apache/lucene/remote/TestRemoteSort.java =================================================================== --- contrib/remote/src/test/org/apache/lucene/remote/TestRemoteSort.java (revision 0) +++ contrib/remote/src/test/org/apache/lucene/remote/TestRemoteSort.java (working copy) @@ -1,4 +1,4 @@ -package org.apache.lucene.search; +package org.apache.lucene.remote; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -17,29 +17,23 @@ * limitations under the License. */ +import java.rmi.Naming; +import java.rmi.registry.LocateRegistry; +import java.util.HashMap; + import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; -import org.apache.lucene.analysis.SimpleAnalyzer; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.lucene.index.IndexReader; -import org.apache.lucene.index.IndexWriter; -import org.apache.lucene.index.Term; -import org.apache.lucene.store.RAMDirectory; -import org.apache.lucene.util.DocIdBitSet; -import java.io.IOException; -import java.io.Serializable; -import java.rmi.Naming; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; -import java.util.BitSet; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Locale; -import java.util.regex.Pattern; +import org.apache.lucene.remote.xstream.XStreamSerializer; +import org.apache.lucene.search.MultiSearcher; +import org.apache.lucene.search.SampleComparable; +import org.apache.lucene.search.Searchable; +import org.apache.lucene.search.Searcher; +import org.apache.lucene.search.Sort; +import org.apache.lucene.search.SortComparator; +import org.apache.lucene.search.SortField; +import org.apache.lucene.search.TestSort; /** * Unit tests for sorting code. @@ -50,23 +44,9 @@ * @version $Id$ */ -public class TestSort -extends TestCase -implements Serializable { - - private Searcher full; - private Searcher searchX; - private Searcher searchY; - private Query queryX; - private Query queryY; - private Query queryA; - private Query queryE; - private Query queryF; - private Query queryG; - private Sort sort; - - - public TestSort (String name) { +public class TestRemoteSort +extends TestSort { + public TestRemoteSort (String name) { super (name); } @@ -74,7 +54,7 @@ if (argv == null || argv.length < 1) TestRunner.run (suite()); else if ("server".equals (argv[0])) { - TestSort test = new TestSort (null); + TestRemoteSort test = new TestRemoteSort (null); try { test.startServer(); Thread.sleep (500000); @@ -86,397 +66,7 @@ } public static Test suite() { - return new TestSuite (TestSort.class); - } - - - // document data: - // the tracer field is used to determine which document was hit - // the contents field is used to search and sort by relevance - // the int field to sort by int - // the float field to sort by float - // the string field to sort by string - // the i18n field includes accented characters for testing locale-specific sorting - private String[][] data = new String[][] { - // tracer contents int float string custom i18n long double, 'short', byte, 'custom parser encoding' - { "A", "x a", "5", "4f", "c", "A-3", "p\u00EAche", "10", "-4.0", "3", "126", "J"},//A, x - { "B", "y a", "5", "3.4028235E38", "i", "B-10", "HAT", "1000000000", "40.0", "24", "1", "I"},//B, y - { "C", "x a b c", "2147483647", "1.0", "j", "A-2", "p\u00E9ch\u00E9", "99999999", "40.00002343", "125", "15", "H"},//C, x - { "D", "y a b c", "-1", "0.0f", "a", "C-0", "HUT", String.valueOf(Long.MAX_VALUE), String.valueOf(Double.MIN_VALUE), String.valueOf(Short.MIN_VALUE), String.valueOf(Byte.MIN_VALUE), "G"},//D, y - { "E", "x a b c d", "5", "2f", "h", "B-8", "peach", String.valueOf(Long.MIN_VALUE), String.valueOf(Double.MAX_VALUE), String.valueOf(Short.MAX_VALUE), String.valueOf(Byte.MAX_VALUE), "F"},//E,x - { "F", "y a b c d", "2", "3.14159f", "g", "B-1", "H\u00C5T", "-44", "343.034435444", "-3", "0", "E"},//F,y - { "G", "x a b c d", "3", "-1.0", "f", "C-100", "sin", "323254543543", "4.043544", "5", "100", "D"},//G,x - { "H", "y a b c d", "0", "1.4E-45", "e", "C-88", "H\u00D8T", "1023423423005","4.043545", "10", "-50", "C"},//H,y - { "I", "x a b c d e f", "-2147483648", "1.0e+0", "d", "A-10", "s\u00EDn", "332422459999", "4.043546", "-340", "51", "B"},//I,x - { "J", "y a b c d e f", "4", ".5", "b", "C-7", "HOT", "34334543543", "4.0000220343", "300", "2", "A"},//J,y - { "W", "g", "1", null, null, null, null, null, null, null, null, null}, - { "X", "g", "1", "0.1", null, null, null, null, null, null, null, null}, - { "Y", "g", "1", "0.2", null, null, null, null, null, null, null, null}, - { "Z", "f g", null, null, null, null, null, null, null, null, null, null} - }; - - // create an index of all the documents, or just the x, or just the y documents - private Searcher getIndex (boolean even, boolean odd) - throws IOException { - RAMDirectory indexStore = new RAMDirectory (); - IndexWriter writer = new IndexWriter (indexStore, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED); - for (int i=0; i