|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread edu.sdsc.inca.agent.RepositoryCache
public class RepositoryCache
The Agent will cache packages (reporter or library) locally when a suite uses them and send them to the reporter managers. This class tracks the packages cached on disk and will periodically look for updates and download them.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
RepositoryCache(java.lang.String cacheLocation,
int updatePeriod)
Create a new RepositoryCache object using cacheLocation as the directory to cache packages. |
|
RepositoryCache(java.lang.String cacheLocation,
edu.sdsc.inca.repository.Repositories repositories)
Create a new RepositoryCache object using cacheLocation as the directory to cache packages. |
Method Summary | |
---|---|
boolean |
checkForPackageUpdate(edu.sdsc.inca.dataModel.catalog.PackageType aPackage)
Checks for a package update using the following techniques: 1) If package's latestVersion field is true, checks for package update. |
java.lang.String[] |
checkForPackageUpdates()
Check all packages contained in the cache and send any package updates to the reporter managers. |
boolean |
existsLocally(java.lang.String name,
java.lang.String version)
Check the local repository cache for the specified package and version. |
boolean |
fetchPackage(java.lang.String name,
java.lang.String version)
Fetch the specified package from the available repositories and store locally on disk. |
java.lang.String |
getCacheLocation()
Retrieve the location of the repository cache. |
edu.sdsc.inca.dataModel.catalog.CatalogDocument |
getCatalog()
Return the repository cache catalog. |
java.lang.String[] |
getDependencies(java.lang.String uri)
Return the package dependencies for this particular package. |
java.lang.String |
getFilename(java.lang.String name,
java.lang.String version)
Return the filename to use on the reporter manager when installation a parcticular package name and version. |
java.lang.String |
getInstallPath(java.lang.String name,
java.lang.String version)
Return the installation path to use on the reporter manager when installing for a particular package name and version. |
edu.sdsc.inca.dataModel.catalog.PackageType |
getPackage(java.lang.String name,
java.lang.String version)
|
edu.sdsc.inca.dataModel.catalog.PackageType |
getPackageByUri(java.lang.String uri)
|
byte[] |
getPackageContent(java.lang.String name,
java.lang.String version)
Return the specified package. |
java.lang.String |
getPackageNameByUri(java.lang.String uri)
|
java.lang.String |
getPermissions(java.lang.String name,
java.lang.String version)
Look up a specify package and version in the repository cache and return the permissions needed for installation. |
edu.sdsc.inca.repository.Repositories |
getRepositories()
Return the repositories that the repository cache references when looking for reporter packages. |
int |
getUpdatePeriod()
Return the current update period (i.e., amount of time used to sleep in between updates). |
java.lang.String |
getUri(java.lang.String name,
java.lang.String version)
|
protected static boolean |
isPythonModule(java.lang.String filename)
Determine whether package file is a python module |
byte[] |
readPackageFromDisk(java.lang.String name,
java.lang.String version)
Return the contents of the specified package from our local cache. |
boolean |
removePackage(java.lang.String name)
Remove the specified package from the repository cache. |
void |
resolveReporters(edu.sdsc.inca.util.SuiteWrapper suite)
Resolve all reporter names in the provided suite document to uris using information provided in the repository cache. |
void |
run()
Starts a thread to check for package updates from the available repositories. |
void |
savePackageToDisk(byte[] fileContent,
java.lang.String name,
java.lang.String version)
Save the specified package to disk (i.e., cache it). |
void |
setCacheLocation(java.lang.String cacheLocation)
Set the location of the where the agent will cache repository packages. |
void |
setRepositories(edu.sdsc.inca.repository.Repositories repositories)
Set the repositories the repository cache will reference when looking for packages. |
void |
setUpdatePeriod(int updatePeriod)
Set the current update period (i.e., amount of time used to sleep in between updates). |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RepositoryCache(java.lang.String cacheLocation, edu.sdsc.inca.repository.Repositories repositories)
cacheLocation
- A directory where cached packages will be stored.repositories
- The available repositories where packages can be
downloaded from.public RepositoryCache(java.lang.String cacheLocation, int updatePeriod)
cacheLocation
- A directory where cached packages will be stored.updatePeriod
- Number of milliseconds to sleep before checking the
repositories for updates.Method Detail |
---|
public boolean checkForPackageUpdate(edu.sdsc.inca.dataModel.catalog.PackageType aPackage)
aPackage
- A package that will be checked for an update.
public java.lang.String[] checkForPackageUpdates()
public java.lang.String getCacheLocation()
public boolean existsLocally(java.lang.String name, java.lang.String version)
name
- Name of the package to look for.version
- Version of the package to look for or null if latest
version is desired.
public boolean fetchPackage(java.lang.String name, java.lang.String version)
name
- The name of the repository package to fetch.version
- The version of the package to fetch or null for latest
public edu.sdsc.inca.dataModel.catalog.CatalogDocument getCatalog()
public java.lang.String[] getDependencies(java.lang.String uri)
uri
- The uri of the package to return the dependencies on.
*
public java.lang.String getFilename(java.lang.String name, java.lang.String version)
name
- Name of the package to retrieve the install path for.version
- Version of the package to retrieve the install path for.
public java.lang.String getInstallPath(java.lang.String name, java.lang.String version)
name
- Name of the package to retrieve the install path for.version
- Version of the package to retrieve the install path for.
public edu.sdsc.inca.dataModel.catalog.PackageType getPackage(java.lang.String name, java.lang.String version)
public edu.sdsc.inca.dataModel.catalog.PackageType getPackageByUri(java.lang.String uri)
public byte[] getPackageContent(java.lang.String name, java.lang.String version) throws java.io.IOException
name
- The name of the package to retrieve.version
- The version of the package to fetch or null to get the
latest.
java.io.IOException
- If there is an error retrieving the package.public java.lang.String getPackageNameByUri(java.lang.String uri)
public java.lang.String getPermissions(java.lang.String name, java.lang.String version)
name
- Name of the package to look up permissions on.version
- Version of the package to look up permissions on.
public edu.sdsc.inca.repository.Repositories getRepositories()
public int getUpdatePeriod()
public java.lang.String getUri(java.lang.String name, java.lang.String version)
public byte[] readPackageFromDisk(java.lang.String name, java.lang.String version) throws java.io.IOException
name
- Name of the package to retrieve.version
- Version of the package to retrieve
java.io.IOException
- If there is an error reading the package from disk.public boolean removePackage(java.lang.String name)
name
- Name of the package to remove
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void resolveReporters(edu.sdsc.inca.util.SuiteWrapper suite) throws edu.sdsc.inca.ConfigurationException
suite
- A suite containing reporter names and possibly versions
edu.sdsc.inca.ConfigurationException
- if unable to locate reporter
in cachepublic void savePackageToDisk(byte[] fileContent, java.lang.String name, java.lang.String version) throws java.io.IOException
fileContent
- The package content as a text string.name
- The name of the packageversion
- The version of the package to save
java.io.IOException
- If there is an error saving the package to disk.public void setCacheLocation(java.lang.String cacheLocation)
cacheLocation
- A string containing the path to a directory where
the repository cache can store files.public void setRepositories(edu.sdsc.inca.repository.Repositories repositories)
repositories
- A set of repositories for which reporter packages
can be downloaded from.public void setUpdatePeriod(int updatePeriod)
updatePeriod
- The update period in milliseconds.protected static boolean isPythonModule(java.lang.String filename)
filename
- the name of the file in the repository
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |