Coverage report

  %line %branch
mnemosyne.archiver.TransactionDirectory
93% 
100% 

 1  
 /*
 2  
  * Copyright 2004 Charles Blaxland
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package mnemosyne.archiver;
 17  
 
 18  
 import org.apache.commons.logging.Log;
 19  
 import org.apache.commons.logging.LogFactory;
 20  
 
 21  
 import java.io.*;
 22  
 
 23  
 /**
 24  
  * @version $Id: TransactionDirectory.java,v 1.1.1.1 2004/08/07 06:40:54 charlesblaxland Exp $
 25  
  */
 26  
 public class TransactionDirectory extends ArchiveDirectory
 27  
 {
 28  4
     private static final Log log = LogFactory.getLog(TransactionDirectory.class);
 29  
 
 30  
     private static final String TRANSACTION_FILE_PREFIX     = "";
 31  
     private static final String TRANSACTION_FILE_POSTFIX    = "_transaction";
 32  
     private static final String TRANSACTION_FILE_EXTENSION  = "txn";
 33  
 
 34  
     public TransactionDirectory(String directoryName, ArchiveSequence sequence)
 35  
     {
 36  5
         super(directoryName, sequence);
 37  5
     }
 38  
 
 39  
     protected String prefix()
 40  
     {
 41  14
         return TRANSACTION_FILE_PREFIX;
 42  
     }
 43  
 
 44  
     protected String postfix()
 45  
     {
 46  14
         return TRANSACTION_FILE_POSTFIX;
 47  
     }
 48  
 
 49  
     protected String extension()
 50  
     {
 51  14
         return TRANSACTION_FILE_EXTENSION;
 52  
     }
 53  
 
 54  
     public void readTransactionsSinceSnapshot(long snapshotSequenceNumber) throws ArchiverException
 55  
     {
 56  9
         if (log.isDebugEnabled())
 57  0
             log.debug("Reading all transactions since sequence number " + snapshotSequenceNumber);
 58  
 
 59  9
         String firstTransactionFilename = buildArchiveFilename(snapshotSequenceNumber);
 60  9
         Object[] filesSinceSnapshot = archiveFiles.tailSet(firstTransactionFilename).toArray();
 61  
 
 62  
         // Read transactions in reverse order
 63  19
         for (int i = filesSinceSnapshot.length - 1; i >= 0; i--)
 64  
         {
 65  10
             String transactionFilename = (String) filesSinceSnapshot[i];
 66  10
             File transactionFile = constructArchiveFile(transactionFilename);
 67  10
             readArchiveFile(transactionFile);
 68  
         }
 69  9
     }
 70  
 
 71  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.