001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.lucene;
022:
023: import java.io.IOException;
024:
025: import org.apache.commons.logging.Log;
026: import org.apache.commons.logging.LogFactory;
027: import org.apache.lucene.analysis.Analyzer;
028: import org.apache.lucene.document.Document;
029: import org.apache.lucene.index.CorruptIndexException;
030: import org.apache.lucene.index.IndexReader;
031: import org.apache.lucene.index.IndexWriter;
032: import org.apache.lucene.index.Term;
033: import org.apache.lucene.store.Directory;
034:
035: /**
036: * <a href="ReadOnlyIndexWriter.java.html"><b><i>View Source</i></b></a>
037: *
038: * @author Jorge Ferrer
039: */
040: public class ReadOnlyIndexWriter extends IndexWriter {
041:
042: public ReadOnlyIndexWriter(Directory luceneDir, Analyzer analyzer,
043: boolean create) throws IOException {
044:
045: super (luceneDir, analyzer, create);
046: }
047:
048: public void addDocument(Document document)
049: throws CorruptIndexException, IOException {
050:
051: if (_log.isDebugEnabled()) {
052: _log.debug("Ignoring invocation to addDocument");
053: }
054: }
055:
056: public void addDocument(Document document, Analyzer analyzer)
057: throws CorruptIndexException, IOException {
058:
059: if (_log.isDebugEnabled()) {
060: _log.debug("Ignoring invocation to addDocument");
061: }
062: }
063:
064: public synchronized void addIndexes(Directory[] directories)
065: throws CorruptIndexException, IOException {
066:
067: if (_log.isDebugEnabled()) {
068: _log.debug("Ignoring invocation to addIndexes");
069: }
070: }
071:
072: public synchronized void addIndexes(IndexReader[] indexReaders)
073: throws CorruptIndexException, IOException {
074:
075: if (_log.isDebugEnabled()) {
076: _log.debug("Ignoring invocation to addIndexes");
077: }
078: }
079:
080: public synchronized void addIndexesNoOptimize(
081: Directory[] directories) throws CorruptIndexException,
082: IOException {
083:
084: if (_log.isDebugEnabled()) {
085: _log.debug("Ignoring invocation to addIndexesNoOptimize");
086: }
087: }
088:
089: public synchronized void deleteDocuments(Term term)
090: throws CorruptIndexException, IOException {
091:
092: if (_log.isDebugEnabled()) {
093: _log.debug("Ignoring invocation to deleteDocuments");
094: }
095: }
096:
097: public synchronized void deleteDocuments(Term[] terms)
098: throws CorruptIndexException, IOException {
099:
100: if (_log.isDebugEnabled()) {
101: _log.debug("Ignoring invocation to deleteDocuments");
102: }
103: }
104:
105: public void updateDocument(Term term, Document document)
106: throws CorruptIndexException, IOException {
107:
108: if (_log.isDebugEnabled()) {
109: _log.debug("Ignoring invocation to updateDocument");
110: }
111: }
112:
113: public void updateDocument(Term term, Document document,
114: Analyzer analyzer) throws CorruptIndexException,
115: IOException {
116:
117: if (_log.isDebugEnabled()) {
118: _log.debug("Ignoring invocation to updateDocument");
119: }
120: }
121:
122: public synchronized void optimize() throws CorruptIndexException,
123: IOException {
124:
125: if (_log.isDebugEnabled()) {
126: _log.debug("Ignoring invocation to optimize");
127: }
128: }
129:
130: private static Log _log = LogFactory
131: .getLog(ReadOnlyIndexWriter.class);
132:
133: }
|