/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
}
}
public void initialize() {
// nothing to do
}
public void optimize() {
// nothing to do
}
// all repositories are supported
return true;
}
/**
* Get a <code>File</code> object describing the cache file.
*
* @param file the file to find the cache for
* @return file that might contain cached history for <code>file</code>
*/
try {
}
} catch (IOException e) {
throw new HistoryException("Failed to get path relative to source root for '"
+ file + "'", e);
}
}
/**
* Read history from a file.
*/
@SuppressWarnings("resource")
XMLDecoder d = null;
try {
} finally {
if (d != null) {
d.close();
} else {
}
}
}
throw new HistoryException(
}
// We have a problem that multiple threads may access the cache layer
// at the same time. Since I would like to avoid read-locking, I just
// serialize the write access to the cache file. The generation of the
// cache file would most likely be executed during index generation, and
// that happens sequencial anyway....
// Generate the file with a temporary name and move it into place when
// I'm done so I don't have to protect the readers for partially updated
// files...
try {
@SuppressWarnings("resource")
XMLEncoder e = null;
try {
e.writeObject(history);
} finally {
if (e != null) {
e.close();
} else {
}
}
} catch (IOException ioe) {
}
synchronized (lock) {
}
throw new HistoryException(
"Cache file exists, and I could not delete it");
}
}
throw new HistoryException("Failed to rename cache tmpfile");
}
}
}
throws HistoryException {
return;
}
}
}
}
}
if (!file.isDirectory()) {
}
}
}
{
try {
} catch (Exception e) {
+ "': " + e.getMessage());
}
}
long time;
try {
} catch (UnsupportedOperationException e) {
// In this case, we've found a file for which the SCM has no history
// An example is a non-SCCS file somewhere in an SCCS-controlled
// workspace.
return null;
}
}
if (!isDir.booleanValue()) {
// Don't cache history-information for directories, since the
// history information on the directory may change if a file in
// a sub-directory change. This will cause us to present a stale
// history log until a the current directory is updated and
// invalidates the cache entry.
{
// retrieving the history takes too long, cache it!
}
}
return history;
}
/**
* Check if the cache is up to date for the specified file.
* @param file the file to check
* @param cachedFile the file which contains the cached history for
* the file
* @return {@code true} if the cache is up to date, {@code false} otherwise
*/
}
/**
* Check if the directory is in the cache.
* @param directory the directory to check
* @return {@code true} if the directory is in the cache
*/
throws HistoryException {
assert directory.isDirectory();
return true;
}
try {
} catch (IOException e) {
throw new HistoryException("Could not resolve '"
}
}
return null;
}
{
// We don't have a good way to get this information from the file
// cache, so leave it to the caller to find a reasonable time to
// display (typically the last modified time on the file system).
return Collections.emptyMap();
}
{
return null;
}
// We only expect this method to be called if the cache supports
// incremental update, so it's not implemented here for now.
throw new UnsupportedOperationException();
}
return getClass().getSimpleName();
}
}