Coverage report

  %line %branch
org.apache.jetspeed.cache.file.FileCacheEntryImpl
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.jetspeed.cache.file;
 19  
 
 20  
 import java.io.File;
 21  
 import java.util.Date;
 22  
 
 23  
 /**
 24  
  * FileCache entry keeps the cached content along with last access information.
 25  
  *
 26  
  *  @author David S. Taylor <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 27  
  *  @version $Id: FileCacheEntryImpl.java 516448 2007-03-09 16:25:47Z ate $
 28  
  */
 29  
 
 30  
 public class FileCacheEntryImpl implements FileCacheEntry
 31  
 {
 32  
     protected File file;
 33  
     protected Object document;
 34  
 
 35  
     protected long lastAccessed;
 36  
     protected Date lastModified;
 37  
 
 38  
     private FileCacheEntryImpl()
 39  0
     {
 40  0
     }
 41  
 
 42  
     /**
 43  
      * Constructs a FileCacheEntry object
 44  
      *
 45  
      * @param document The user specific content being cached
 46  
      * @param lastModified The document's last modified stamp
 47  
      */
 48  
     public FileCacheEntryImpl(File file, Object document)
 49  0
     {
 50  0
         this.file = file;
 51  0
         this.document = document;
 52  0
         this.lastModified = new Date(file.lastModified());
 53  0
         this.lastAccessed = new Date().getTime();
 54  0
     }
 55  
 
 56  
     /**
 57  
      * Get the file descriptor
 58  
      *
 59  
      * @return the file descriptor
 60  
      */
 61  
     public File getFile()
 62  
     {
 63  0
         return new File(this.file.getAbsolutePath());
 64  
     }
 65  
 
 66  
     /**
 67  
      * Set the file descriptor
 68  
      *
 69  
      * @param file the new file descriptor
 70  
      */
 71  
     public void setFile(File file)
 72  
     {
 73  0
         this.file = file;
 74  0
     }
 75  
 
 76  
     /**
 77  
      * Set the cache's last accessed stamp
 78  
      *
 79  
      * @param lastAccessed the cache's last access stamp
 80  
      */
 81  
     public void setLastAccessed(long lastAccessed)
 82  
     {
 83  0
         this.lastAccessed = lastAccessed;
 84  0
     }
 85  
 
 86  
     /**
 87  
      * Get the cache's lastAccessed stamp
 88  
      *
 89  
      * @return the cache's last accessed stamp
 90  
      */
 91  
     public long getLastAccessed()
 92  
     {
 93  0
         return this.lastAccessed;
 94  
     }
 95  
 
 96  
     /**
 97  
      * Set the cache's last modified stamp
 98  
      *
 99  
      * @param lastModified the cache's last modified stamp
 100  
      */
 101  
     public void setLastModified(Date lastModified)
 102  
     {
 103  0
         this.lastModified = lastModified;
 104  0
     }
 105  
 
 106  
     /**
 107  
      * Get the entry's lastModified stamp (which may be stale compared to file's stamp)
 108  
      *
 109  
      * @return the last modified stamp
 110  
      */
 111  
     public Date getLastModified()
 112  
     {
 113  0
         return this.lastModified;
 114  
     }
 115  
 
 116  
     /**
 117  
      * Set the Document in the cache
 118  
      *
 119  
      * @param document the document being cached
 120  
      */
 121  
     public void setDocument(Object document)
 122  
     {
 123  0
         this.document = document;
 124  0
     }
 125  
 
 126  
     /**
 127  
      * Get the Document
 128  
      *
 129  
      * @return the document being cached
 130  
      */
 131  
     public Object getDocument()
 132  
     {
 133  0
         return this.document;
 134  
     }
 135  
 
 136  
 }
 137  
 
 138  
 

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