305N/A * The contents of this file are subject to the terms of the 305N/A * Common Development and Distribution License (the "License"). 305N/A * You may not use this file except in compliance with the License. 305N/A * language governing permissions and limitations under the License. 305N/A * When distributing Covered Code, include this CDDL HEADER in each 305N/A * If applicable, add the following below this CDDL HEADER, with the 305N/A * fields enclosed by brackets "[]" replaced with your own identifying 305N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1460N/A * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 887N/A // all repositories are supported 305N/A * Get a <code>File</code> object describing the cache file. 305N/A * @param file the file to find the cache for 305N/A * @return file that might contain cached history for <code>file</code> 305N/A * Read history from a file. 1327N/A "Unable to create cache directory '" +
dir +
"'");
305N/A // We have a problem that multiple threads may access the cache layer 305N/A // at the same time. Since I would like to avoid read-locking, I just 305N/A // serialize the write access to the cache file. The generation of the 305N/A // cache file would most likely be executed during index generation, and 305N/A // that happens sequencial anyway.... 305N/A // Generate the file with a temporary name and move it into place when 305N/A // I'm done so I don't have to protect the readers for partially updated 1327N/A "Cache file exists, and I could not delete it");
305N/A // In this case, we've found a file for which the SCM has no history 305N/A // An example is a non-SCCS file somewhere in an SCCS-controlled 1190N/A // Don't cache history-information for directories, since the 305N/A // history information on the directory may change if a file in 305N/A // a sub-directory change. This will cause us to present a stale 1190N/A // history log until a the current directory is updated and 1190N/A // invalidates the cache entry. 615N/A // retrieving the history takes too long, cache it! 678N/A * Check if the cache is up to date for the specified file. 678N/A * @param file the file to check 678N/A * @param cachedFile the file which contains the cached history for 678N/A * @return {@code true} if the cache is up to date, {@code false} otherwise 764N/A * Check if the directory is in the cache. 764N/A * @param directory the directory to check 764N/A * @return {@code true} if the directory is in the cache 1460N/A // We don't have a good way to get this information from the file 1460N/A // cache, so leave it to the caller to find a reasonable time to 1460N/A // display (typically the last modified time on the file system). 969N/A // We only expect this method to be called if the cache supports 969N/A // incremental update, so it's not implemented here for now.