org.rhq.enterprise.server.plugins.yum
Class RepoProvider

java.lang.Object
  extended by org.rhq.enterprise.server.plugins.yum.RepoProvider
All Implemented Interfaces:
ContentProvider, PackageSource

public class RepoProvider
extends java.lang.Object
implements ContentProvider, PackageSource

The RepoSource provides a content source for synchronizing content contained with a yum repo.

Author:
jortel

Constructor Summary
RepoProvider()
           
 
Method Summary
 java.io.InputStream getInputStream(java.lang.String location)
          Get an input stream for the specified package (bits).
 void initialize(Configuration configuration)
          Initializes the adapter with the specified configuration.
 void shutdown()
          Shutdown the adapter.
 void synchronizePackages(java.lang.String repoName, PackageSyncReport report, java.util.Collection<ContentProviderPackageDetails> existingPackages)
          Synchronizes the packages contained within the yum repo.
 void testConnection()
          Test's the adapter's connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepoProvider

public RepoProvider()
Method Detail

initialize

public void initialize(Configuration configuration)
                throws java.lang.Exception
Initializes the adapter with the specified configuration.

Expects one of the following properties:

path A file system root directory or mount point
url A base URL for a yum repo

Constructs the appropriate repo reader based on with of these parameters are specified.

Specified by:
initialize in interface ContentProvider
Parameters:
configuration - The adapter's configuration propeties.
Throws:
java.lang.Exception - On errors.

shutdown

public void shutdown()
Shutdown the adapter.

Specified by:
shutdown in interface ContentProvider

getInputStream

public java.io.InputStream getInputStream(java.lang.String location)
                                   throws java.lang.Exception
Get an input stream for the specified package (bits).

Specified by:
getInputStream in interface PackageSource
Parameters:
location - The location relative to the baseurl.
Returns:
An open stream that must be closed by the caller.
Throws:
java.lang.Exception - On all errors.

synchronizePackages

public void synchronizePackages(java.lang.String repoName,
                                PackageSyncReport report,
                                java.util.Collection<ContentProviderPackageDetails> existingPackages)
                         throws java.lang.Exception
Synchronizes the packages contained within the yum repo. Reads the repo's metadata and updates the report to indicate packages that need to be added and deleted. The notion of updated packages does not make sense in the rpm works since an update generates a new package version.

Specified by:
synchronizePackages in interface PackageSource
Parameters:
repoName -
report - A report to fill in.
existingPackages - A collection of package specifications already in inventory.
Throws:
java.lang.Exception - On all errors.

testConnection

public void testConnection()
                    throws java.lang.Exception
Test's the adapter's connection.

Specified by:
testConnection in interface ContentProvider
Throws:
java.lang.Exception - When connection is not functional for any reason.


Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.