Coverage report

  %line %branch
org.apache.jcs.auxiliary.disk.AbstractDiskCacheAttributes
56% 
100% 

 1  
 package org.apache.jcs.auxiliary.disk;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
 23  
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 24  
 import org.apache.jcs.auxiliary.disk.behavior.IDiskCacheAttributes;
 25  
 
 26  
 /**
 27  
  * This has common attributes that any conceivable disk cache would need.
 28  
  * <p>
 29  
  * @author aaronsm
 30  
  */
 31  256
 public abstract class AbstractDiskCacheAttributes
 32  
     extends AbstractAuxiliaryCacheAttributes
 33  
     implements IDiskCacheAttributes
 34  
 {
 35  
     /** path to disk */
 36  
     protected String diskPath;
 37  
 
 38  
     /** if this is false, we will not execute remove all */
 39  256
     private boolean allowRemoveAll = true;
 40  
 
 41  
     /** default to 5000 */
 42  256
     protected int maxPurgatorySize = MAX_PURGATORY_SIZE_DEFUALT;
 43  
 
 44  
     /** Default amount of time to allow for keypersistence on shutdown */
 45  
     private static final int DEFAULT_shutdownSpoolTimeLimit = 60;
 46  
 
 47  
     /**
 48  
      * This default determines how long the shutdown will wait for the key spool and data defrag to
 49  
      * finish.
 50  
      */
 51  256
     protected int shutdownSpoolTimeLimit = DEFAULT_shutdownSpoolTimeLimit;
 52  
 
 53  
     /**
 54  
      * Sets the diskPath attribute of the IJISPCacheAttributes object
 55  
      * <p>
 56  
      * @param path The new diskPath value
 57  
      */
 58  
     public void setDiskPath( String path )
 59  
     {
 60  423
         this.diskPath = path.trim();
 61  423
     }
 62  
 
 63  
     /**
 64  
      * Gets the diskPath attribute of the attributes object
 65  
      * <p>
 66  
      * @return The diskPath value
 67  
      */
 68  
     public String getDiskPath()
 69  
     {
 70  663
         return this.diskPath;
 71  
     }
 72  
 
 73  
     /**
 74  
      * Gets the maxKeySize attribute of the DiskCacheAttributes object
 75  
      * <p>
 76  
      * @return The maxPurgatorySize value
 77  
      */
 78  
     public int getMaxPurgatorySize()
 79  
     {
 80  1184
         return maxPurgatorySize;
 81  
     }
 82  
 
 83  
     /**
 84  
      * Sets the maxPurgatorySize attribute of the DiskCacheAttributes object
 85  
      * <p>
 86  
      * @param maxPurgatorySize The new maxPurgatorySize value
 87  
      */
 88  
     public void setMaxPurgatorySize( int maxPurgatorySize )
 89  
     {
 90  180
         this.maxPurgatorySize = maxPurgatorySize;
 91  180
     }
 92  
 
 93  
     /**
 94  
      * Get the amount of time in seconds we will wait for elements to move to disk during shutdown
 95  
      * for a particular region.
 96  
      * <p>
 97  
      * @return the time in seconds.
 98  
      */
 99  
     public int getShutdownSpoolTimeLimit()
 100  
     {
 101  0
         return this.shutdownSpoolTimeLimit;
 102  
     }
 103  
 
 104  
     /**
 105  
      * Sets the amount of time in seconds we will wait for elements to move to disk during shutdown
 106  
      * for a particular region.
 107  
      * <p>
 108  
      * This is how long we give the event queue to empty.
 109  
      * <p>
 110  
      * The default is 60 seconds.
 111  
      * <p>
 112  
      * @param shutdownSpoolTimeLimit the time in seconds
 113  
      */
 114  
     public void setShutdownSpoolTimeLimit( int shutdownSpoolTimeLimit )
 115  
     {
 116  0
         this.shutdownSpoolTimeLimit = shutdownSpoolTimeLimit;
 117  0
     }
 118  
 
 119  
     /**
 120  
      * Simple clone.
 121  
      * <p>
 122  
      * @return AuxiliaryCacheAttributes
 123  
      */
 124  
     public AuxiliaryCacheAttributes copy()
 125  
     {
 126  
         try
 127  
         {
 128  138
             return (AuxiliaryCacheAttributes) this.clone();
 129  
         }
 130  0
         catch ( Exception e )
 131  
         {
 132  
             // swallow
 133  
         }
 134  0
         return this;
 135  
     }
 136  
 
 137  
     /**
 138  
      * @param allowRemoveAll The allowRemoveAll to set.
 139  
      */
 140  
     public void setAllowRemoveAll( boolean allowRemoveAll )
 141  
     {
 142  42
         this.allowRemoveAll = allowRemoveAll;
 143  42
     }
 144  
 
 145  
     /**
 146  
      * @return Returns the allowRemoveAll.
 147  
      */
 148  
     public boolean isAllowRemoveAll()
 149  
     {
 150  141
         return allowRemoveAll;
 151  
     }
 152  
 
 153  
     /**
 154  
      * Includes the common attributes for a debug message.
 155  
      * <p>
 156  
      * @return String
 157  
      */
 158  
     public String toString()
 159  
     {
 160  0
         StringBuffer str = new StringBuffer();
 161  0
         str.append( "AbstractDiskCacheAttributes " );
 162  0
         str.append( "\n diskPath = " + diskPath );
 163  0
         str.append( "\n maxPurgatorySize   = " + maxPurgatorySize );
 164  0
         str.append( "\n allowRemoveAll   = " + allowRemoveAll );
 165  0
         return str.toString();
 166  
     }
 167  
 }

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