org.rhq.enterprise.server.plugins.disk
Class DiskSource
java.lang.Object
org.rhq.enterprise.server.plugins.disk.DiskSource
- All Implemented Interfaces:
- ContentProvider, PackageSource
public class DiskSource
- extends java.lang.Object
- implements ContentProvider, PackageSource
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DiskSource
public DiskSource()
getRootDirectory
protected java.io.File getRootDirectory()
setRootDirectory
protected void setRootDirectory(java.io.File path)
getSupportedPackageTypes
protected java.util.Map<java.lang.String,DiskSource.SupportedPackageType> getSupportedPackageTypes()
setSupportedPackageTypes
protected void setSupportedPackageTypes(java.util.Map<java.lang.String,DiskSource.SupportedPackageType> supportedPackageTypes)
initialize
public void initialize(Configuration configuration)
throws java.lang.Exception
- Specified by:
initialize in interface ContentProvider
- Throws:
java.lang.Exception
shutdown
public void shutdown()
- Specified by:
shutdown in interface ContentProvider
synchronizePackages
public void synchronizePackages(java.lang.String repoName,
PackageSyncReport report,
java.util.Collection<ContentProviderPackageDetails> existingPackages)
throws java.lang.Exception
- Specified by:
synchronizePackages in interface PackageSource
- Throws:
java.lang.Exception
testConnection
public void testConnection()
throws java.lang.Exception
- Specified by:
testConnection in interface ContentProvider
- Throws:
java.lang.Exception
getInputStream
public java.io.InputStream getInputStream(java.lang.String location)
throws java.lang.Exception
- Specified by:
getInputStream in interface PackageSource
- Throws:
java.lang.Exception
syncPackages
protected void syncPackages(PackageSyncReport report,
java.util.List<ContentProviderPackageDetails> packages,
java.io.File directory)
throws java.lang.Exception
- 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:
java.lang.Exception - if the sync fails
createPackage
protected ContentProviderPackageDetails createPackage(java.io.File file)
throws java.lang.Exception
- Throws:
java.lang.Exception
findPackage
protected ContentProviderPackageDetails findPackage(java.util.List<ContentProviderPackageDetails> packages,
ContentProviderPackageDetails pkg)
getRelativePath
protected java.lang.String getRelativePath(java.io.File file)
initializePackageTypes
protected void initializePackageTypes(Configuration config)
determinePackageType
protected DiskSource.SupportedPackageType determinePackageType(java.io.File file)
Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.