org.rhq.enterprise.server.plugins.disk
Class DiskSource
java.lang.Object
org.rhq.enterprise.server.plugins.disk.DiskSource
- All Implemented Interfaces:
- ContentProvider, PackageSource, RepoSource
public class DiskSource
- extends Object
- implements ContentProvider, PackageSource, RepoSource
This is the most basic reference implementation of a content source. It provides primative package
synchronization with file-system based source. It is anticipated that more content aware subclasses will provide more
useful functionality.
- Author:
- jortel, John Mazzitelli
|
Method Summary |
protected ContentProviderPackageDetails |
createPackage(File file)
|
protected DiskSource.SupportedPackageType |
determinePackageType(File file)
|
protected ContentProviderPackageDetails |
findPackage(List<ContentProviderPackageDetails> packages,
ContentProviderPackageDetails pkg)
|
protected void |
generateRepoDetails(RepoImportReport report,
File base,
String parentName)
|
InputStream |
getInputStream(String location)
|
protected String |
getRelativePath(File file)
|
protected File |
getRootDirectory()
|
protected Map<String,DiskSource.SupportedPackageType> |
getSupportedPackageTypes()
|
SyncProgressWeight |
getSyncProgressWeight()
|
RepoImportReport |
importRepos()
|
void |
initialize(Configuration configuration)
|
protected void |
initializePackageTypes()
|
protected void |
setRootDirectory(File path)
|
protected void |
setSupportedPackageTypes(Map<String,DiskSource.SupportedPackageType> supportedPackageTypes)
|
void |
shutdown()
|
void |
synchronizePackages(String repoName,
PackageSyncReport report,
Collection<ContentProviderPackageDetails> existingPackages)
|
protected void |
syncPackages(PackageSyncReport report,
String repoName,
List<ContentProviderPackageDetails> packages,
File directory)
Recursive function that drills down into subdirectories and builds up the report
of packages for all files found. |
void |
testConnection()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DiskSource
public DiskSource()
initialize
public void initialize(Configuration configuration)
throws Exception
- Specified by:
initialize in interface ContentProvider
- Throws:
Exception
shutdown
public void shutdown()
- Specified by:
shutdown in interface ContentProvider
importRepos
public RepoImportReport importRepos()
throws Exception
- Specified by:
importRepos in interface RepoSource
- Throws:
Exception
synchronizePackages
public void synchronizePackages(String repoName,
PackageSyncReport report,
Collection<ContentProviderPackageDetails> existingPackages)
throws SyncException,
InterruptedException
- Specified by:
synchronizePackages in interface PackageSource
- Throws:
SyncException
InterruptedException
testConnection
public void testConnection()
throws Exception
- Specified by:
testConnection in interface ContentProvider
- Throws:
Exception
getInputStream
public InputStream getInputStream(String location)
throws Exception
- Specified by:
getInputStream in interface PackageSource
- Throws:
Exception
getRootDirectory
protected File getRootDirectory()
setRootDirectory
protected void setRootDirectory(File path)
getSupportedPackageTypes
protected Map<String,DiskSource.SupportedPackageType> getSupportedPackageTypes()
setSupportedPackageTypes
protected void setSupportedPackageTypes(Map<String,DiskSource.SupportedPackageType> supportedPackageTypes)
syncPackages
protected void syncPackages(PackageSyncReport report,
String repoName,
List<ContentProviderPackageDetails> packages,
File directory)
throws SyncException
- Recursive function that drills down into subdirectories and builds up the report
of packages for all files found. As files are found, their associated packages
are removed from
packages if they exist - leaving only packages
remaining that do not exist on the file system.
- Parameters:
report - the report that we are building uppackages - existing packages not yet found on the file system but exist in server inventorydirectory - the directory (and its subdirectories) to scan
- Throws:
Exception - if the sync fails
SyncException
createPackage
protected ContentProviderPackageDetails createPackage(File file)
throws SyncException
- Throws:
SyncException
findPackage
protected ContentProviderPackageDetails findPackage(List<ContentProviderPackageDetails> packages,
ContentProviderPackageDetails pkg)
getRelativePath
protected String getRelativePath(File file)
initializePackageTypes
protected void initializePackageTypes()
determinePackageType
protected DiskSource.SupportedPackageType determinePackageType(File file)
generateRepoDetails
protected void generateRepoDetails(RepoImportReport report,
File base,
String parentName)
getSyncProgressWeight
public SyncProgressWeight getSyncProgressWeight()
- Specified by:
getSyncProgressWeight in interface ContentProvider
Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.