//# 0 errors, 80 messages
//#
/*
    //#WriteToIndexOperation.java:1:1: class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
 * Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  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.  For additional information regarding
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */
/* Created on Aug 12, 2003 */
package org.apache.roller.weblogger.business.search.operations;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.weblogger.business.search.IndexManagerImpl;

/**
 * An operation that writes to index.
 * @author Mindaugas Idzelis (min@idzelis.com)
 */
public abstract class WriteToIndexOperation extends IndexOperation {
    
    public WriteToIndexOperation(IndexManagerImpl mgr) {
        super(mgr);
    //#WriteToIndexOperation.java:32: method: void org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation.org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation(IndexManagerImpl)
    //#input(void org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation(IndexManagerImpl)): mgr
    //#input(void org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation(IndexManagerImpl)): this
    //#output(void org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation(IndexManagerImpl)): this.manager
    //#post(void org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation(IndexManagerImpl)): this.manager == mgr
    //#post(void org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation(IndexManagerImpl)): init'ed(this.manager)
    }
    //#WriteToIndexOperation.java:33: end of method: void org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation.org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation(IndexManagerImpl)
    
    private static Log mLogger =
    //#WriteToIndexOperation.java:35: method: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation.org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init
    //#WriteToIndexOperation.java:35: Warning: method not available
    //#    -- call on LogFactory org.apache.commons.logging.LogFactory:getFactory()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init
    //#    unanalyzed callee: LogFactory org.apache.commons.logging.LogFactory:getFactory()
    //#WriteToIndexOperation.java:35: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getInstance(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getInstance(Class)
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/WriteToIndexOperation]
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.beginDeleting()Lorg/apache/lucene/index/IndexReader;
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.beginWriting()Lorg/apache/lucene/index/IndexWriter;
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.doRun()V
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.endDeleting()V
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.endWriting()V
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.getDocument(Lorg/apache/roller/weblogger/pojos/WeblogEntry;)Lorg/apache/lucene/document/Document;
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.run()V
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): mLogger
    //#output(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): org/apache/roller/weblogger/business/search/operations/IndexOperation.__Descendant_Table[org/apache/roller/weblogger/business/search/operations/WriteToIndexOperation]
    //#presumption(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): org.apache.commons.logging.LogFactory:getFactory(...)@35 != null
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/WriteToIndexOperation] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): org/apache/roller/weblogger/business/search/operations/IndexOperation.__Descendant_Table[org/apache/roller/weblogger/business/search/operations/WriteToIndexOperation] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.beginDeleting()Lorg/apache/lucene/index/IndexReader; == &org/apache/roller/weblogger/business/search/operations/IndexOperation.beginDeleting
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.beginWriting()Lorg/apache/lucene/index/IndexWriter; == &org/apache/roller/weblogger/business/search/operations/IndexOperation.beginWriting
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.doRun()V == &org/apache/roller/weblogger/business/search/operations/IndexOperation.doRun
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.endDeleting()V == &org/apache/roller/weblogger/business/search/operations/IndexOperation.endDeleting
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.endWriting()V == &org/apache/roller/weblogger/business/search/operations/IndexOperation.endWriting
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.getDocument(Lorg/apache/roller/weblogger/pojos/WeblogEntry;)Lorg/apache/lucene/document/Document; == &org/apache/roller/weblogger/business/search/operations/IndexOperation.getDocument
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): __Dispatch_Table.run()V == &run
    //#post(org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init): init'ed(mLogger)
    //#WriteToIndexOperation.java:35: end of method: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation.org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation__static_init
            LogFactory.getFactory().getInstance(WriteToIndexOperation.class);
    
    public void run() {
        try {
            manager.getReadWriteLock().writeLock().acquire();
    //#WriteToIndexOperation.java:40: method: void org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation.run()
    //#WriteToIndexOperation.java:40: Warning: method not available
    //#    -- call on Sync EDU.oswego.cs.dl.util.concurrent.ReadWriteLock:writeLock()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: void run()
    //#    unanalyzed callee: Sync EDU.oswego.cs.dl.util.concurrent.ReadWriteLock:writeLock()
    //#WriteToIndexOperation.java:40: Warning: method not available
    //#    -- call on void EDU.oswego.cs.dl.util.concurrent.Sync:acquire()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: void run()
    //#    unanalyzed callee: void EDU.oswego.cs.dl.util.concurrent.Sync:acquire()
    //#WriteToIndexOperation.java:40: Warning: suspicious precondition
    //#    the precondition for this.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: void run()
    //#    suspicious precondition index: [3]
    //#    Attribs:  Soft
    //#input(void run()): __Descendant_Table[org/apache/roller/weblogger/business/search/IndexManagerImpl$1]
    //#input(void run()): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/AddEntryOperation]
    //#input(void run()): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/ReIndexEntryOperation]
    //#input(void run()): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/RebuildWebsiteIndexOperation]
    //#input(void run()): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/RemoveEntryOperation]
    //#input(void run()): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/RemoveWebsiteIndexOperation]
    //#input(void run()): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/WriteToIndexOperation]
    //#input(void run()): __Descendant_Table[others]
    //#input(void run()): __Dispatch_Table.doRun()V
    //#input(void run()): mLogger
    //#input(void run()): org/apache/roller/weblogger/business/search/IndexManagerImpl$1.__Dispatch_Table.doRun()V
    //#input(void run()): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Descendant_Table[org/apache/roller/weblogger/business/search/IndexManagerImpl]
    //#input(void run()): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Descendant_Table[others]
    //#input(void run()): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Dispatch_Table.getReadWriteLock()LEDU/oswego/cs/dl/util/concurrent/ReadWriteLock;
    //#input(void run()): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Dispatch_Table.resetSharedReader()V
    //#input(void run()): org/apache/roller/weblogger/business/search/operations/AddEntryOperation.__Dispatch_Table.doRun()V
    //#input(void run()): org/apache/roller/weblogger/business/search/operations/ReIndexEntryOperation.__Dispatch_Table.doRun()V
    //#input(void run()): org/apache/roller/weblogger/business/search/operations/RebuildWebsiteIndexOperation.__Dispatch_Table.doRun()V
    //#input(void run()): org/apache/roller/weblogger/business/search/operations/RemoveEntryOperation.__Dispatch_Table.doRun()V
    //#input(void run()): org/apache/roller/weblogger/business/search/operations/RemoveWebsiteIndexOperation.__Dispatch_Table.doRun()V
    //#input(void run()): this
    //#input(void run()): this.__Tag
    //#input(void run()): this.manager
    //#input(void run()): this.manager.__Tag
    //#input(void run()): this.manager.rwl
    //#output(void run()): this.manager.reader
    //#pre[1] (void run()): mLogger != null
    //#pre[4] (void run()): this.manager != null
    //#pre[5] (void run()): this.manager.__Tag == org/apache/roller/weblogger/business/search/IndexManagerImpl
    //#pre[6] (void run()): this.manager.rwl != null
    //#pre[3] (void run()): (soft) this.__Tag in {org/apache/roller/weblogger/business/search/IndexManagerImpl$1, org/apache/roller/weblogger/business/search/operations/AddEntryOperation, org/apache/roller/weblogger/business/search/operations/ReIndexEntryOperation, org/apache/roller/weblogger/business/search/operations/RebuildWebsiteIndexOperation, org/apache/roller/weblogger/business/search/operations/RemoveEntryOperation, org/apache/roller/weblogger/business/search/operations/RemoveWebsiteIndexOperation, org/apache/roller/weblogger/business/search/operations/WriteToIndexOperation}
    //#presumption(void run()): EDU.oswego.cs.dl.util.concurrent.ReadWriteLock:writeLock(...)@40 != null
    //#presumption(void run()): EDU.oswego.cs.dl.util.concurrent.ReadWriteLock:writeLock(...)@47 != null
    //#presumption(void run()): EDU.oswego.cs.dl.util.concurrent.ReadWriteLock:writeLock(...)@47 != null
    //#post(void run()): this.manager.reader == null
            mLogger.debug("Starting search index operation");
    //#WriteToIndexOperation.java:41: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: void run()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
            doRun();
    //#WriteToIndexOperation.java:42: Warning: call too complex - analysis skipped
    //#    -- call on void doRun()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: void run()
    //#    unanalyzed callee: void doRun()
            mLogger.debug("Search index operation complete");
    //#WriteToIndexOperation.java:43: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: void run()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        } catch (InterruptedException e) {
            mLogger.error("Error acquiring write lock on index", e);
    //#WriteToIndexOperation.java:45: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: void run()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
        } finally {
            manager.getReadWriteLock().writeLock().release();
    //#WriteToIndexOperation.java:47: Warning: method not available
    //#    -- call on Sync EDU.oswego.cs.dl.util.concurrent.ReadWriteLock:writeLock()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: void run()
    //#    unanalyzed callee: Sync EDU.oswego.cs.dl.util.concurrent.ReadWriteLock:writeLock()
    //#WriteToIndexOperation.java:47: Warning: method not available
    //#    -- call on void EDU.oswego.cs.dl.util.concurrent.Sync:release()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
    //#    method: void run()
    //#    unanalyzed callee: void EDU.oswego.cs.dl.util.concurrent.Sync:release()
        }
        manager.resetSharedReader();
    }
    //#WriteToIndexOperation.java:50: end of method: void org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation.run()
}
    //#WriteToIndexOperation.java:: end of class: org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation
