copied.org.eclipse.equinox.internal.p2.repository
Class CacheManager

java.lang.Object
  extended by org.eclipse.equinox.internal.p2.repository.CacheManager
      extended by copied.org.eclipse.equinox.internal.p2.repository.CacheManager
Direct Known Subclasses:
TychoP2RepositoryCacheManager

public class CacheManager
extends org.eclipse.equinox.internal.p2.repository.CacheManager

A class to manage metadata cache files. Creating the cache files will place the file in the AgentData location in a cache directory. Using the bus listeners will allow the manager to listen for repository events. When a repository is removed, it will remove the cache file if one was created for the repository.


Field Summary
static java.lang.String SERVICE_NAME
          Service name for the internal cache manager service.
 
Constructor Summary
CacheManager(org.eclipse.equinox.p2.core.IAgentLocation agentLocation)
           
 
Method Summary
 java.io.File createCache(java.net.URI repositoryLocation, java.lang.String prefix, org.eclipse.core.runtime.IProgressMonitor monitor)
          Returns a local cache file with the contents of the given remote location, or null if a local cache could not be created.
protected  java.io.File getCache(java.net.URI repositoryLocation, java.lang.String prefix)
          Determines the local file path of the repository's cache file.
protected  java.io.File getCacheDirectory()
          Returns the file corresponding to the data area to be used by the cache manager.
 void setEventBus(org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus newBus)
           
 void unsetEventBus(org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus oldBus)
           
protected  void updateCache(java.io.File cacheFile, java.net.URI remoteFile, long lastModifiedRemote, org.eclipse.core.runtime.SubMonitor submonitor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
Service name for the internal cache manager service.

Constructor Detail

CacheManager

public CacheManager(org.eclipse.equinox.p2.core.IAgentLocation agentLocation)
Method Detail

createCache

public java.io.File createCache(java.net.URI repositoryLocation,
                                java.lang.String prefix,
                                org.eclipse.core.runtime.IProgressMonitor monitor)
                         throws java.io.IOException,
                                org.eclipse.equinox.p2.core.ProvisionException
Returns a local cache file with the contents of the given remote location, or null if a local cache could not be created.

Overrides:
createCache in class org.eclipse.equinox.internal.p2.repository.CacheManager
Parameters:
repositoryLocation - The remote location to be cached
prefix - The prefix to use when creating the cache file
monitor - a progress monitor
Returns:
A File object pointing to the cache file or null if the location is not a repository.
Throws:
java.io.FileNotFoundException - if neither jar nor xml index file exists at given location
org.eclipse.equinox.internal.p2.repository.AuthenticationFailedException - if jar not available and xml causes authentication fail
java.io.IOException - on general IO errors
org.eclipse.equinox.p2.core.ProvisionException - on any error (e.g. user cancellation, unknown host, malformed address, connection refused, etc.)
org.eclipse.core.runtime.OperationCanceledException - - if user canceled

getCache

protected java.io.File getCache(java.net.URI repositoryLocation,
                                java.lang.String prefix)
Determines the local file path of the repository's cache file.

Overrides:
getCache in class org.eclipse.equinox.internal.p2.repository.CacheManager
Parameters:
repositoryLocation - The location to compute the cache for
prefix - The prefix to use for this location
Returns:
A File pointing to the cache file or null if the cache file does not exist.

getCacheDirectory

protected java.io.File getCacheDirectory()
Returns the file corresponding to the data area to be used by the cache manager.

Overrides:
getCacheDirectory in class org.eclipse.equinox.internal.p2.repository.CacheManager

setEventBus

public void setEventBus(org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus newBus)
Overrides:
setEventBus in class org.eclipse.equinox.internal.p2.repository.CacheManager

unsetEventBus

public void unsetEventBus(org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus oldBus)
Overrides:
unsetEventBus in class org.eclipse.equinox.internal.p2.repository.CacheManager

updateCache

protected void updateCache(java.io.File cacheFile,
                           java.net.URI remoteFile,
                           long lastModifiedRemote,
                           org.eclipse.core.runtime.SubMonitor submonitor)
                    throws java.io.FileNotFoundException,
                           java.io.IOException,
                           org.eclipse.equinox.p2.core.ProvisionException
Overrides:
updateCache in class org.eclipse.equinox.internal.p2.repository.CacheManager
Throws:
java.io.FileNotFoundException
java.io.IOException
org.eclipse.equinox.p2.core.ProvisionException


Copyright © 2008-2011. All Rights Reserved.