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

java.lang.Object
  extended by org.rhq.enterprise.server.plugins.yum.Repo

public class Repo
extends java.lang.Object

The Repo is a proxy for a local or remote yum repository.

Author:
jortel

Constructor Summary
Repo(org.rhq.enterprise.server.plugins.yum.RepoReader reader)
          Constructor.
 
Method Summary
 void connect()
          Connect to the yum repo.
 void disconnect()
          Disconnect and reset object.
 java.util.List<ContentProviderPackageDetails> getPackageDetails()
          Get a list of PackageDetails for all packages contained with the yum repo.
 PackageDetails getPackageDetails(java.lang.String pkgname)
          Get a PackageDetails for the specified package by name.
 org.jdom.Element getPackageMetadata(java.lang.String pkgname)
          Get the metadata entry contained within the primary.xml for the specified package by name.
 java.lang.String getPackageMetadataString(java.lang.String pkgname)
          Get a string representation of metadata entry contained within the primary.xml for the specified package by name.
 java.io.InputStream openPackageStream(java.lang.String pkgname)
          Open and return an input stream for the specified package (bit) by name.
 java.lang.String packageLocation(java.lang.String pkgname)
          Get the location (href) of the specified package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Repo

public Repo(org.rhq.enterprise.server.plugins.yum.RepoReader reader)
Constructor.

Parameters:
reader - An initialized repo reader.
Method Detail

connect

public void connect()
             throws java.lang.Exception
Connect to the yum repo.

Throws:
java.lang.Exception - On connection error.

disconnect

public void disconnect()
Disconnect and reset object.


getPackageMetadataString

public java.lang.String getPackageMetadataString(java.lang.String pkgname)
                                          throws java.lang.Exception
Get a string representation of metadata entry contained within the primary.xml for the specified package by name.

Parameters:
pkgname - A fully qualified package name.
Returns:
A string XML fragment when found, else null.
Throws:
java.lang.Exception - On all errors.

getPackageMetadata

public org.jdom.Element getPackageMetadata(java.lang.String pkgname)
                                    throws java.lang.Exception
Get the metadata entry contained within the primary.xml for the specified package by name.

Parameters:
pkgname - A fully qualified package name.
Returns:
A node containing the packages metadata when found, else null.
Throws:
java.lang.Exception - On all errors.

getPackageDetails

public java.util.List<ContentProviderPackageDetails> getPackageDetails()
                                                                throws java.lang.Exception
Get a list of PackageDetails for all packages contained with the yum repo.

Returns:
A list of package details.
Throws:
java.lang.Exception - On all errors.

getPackageDetails

public PackageDetails getPackageDetails(java.lang.String pkgname)
                                 throws java.lang.Exception
Get a PackageDetails for the specified package by name.

Parameters:
pkgname - A fully qualified package name.
Returns:
The found package detail when found, else null.
Throws:
java.lang.Exception - On all errors.

openPackageStream

public java.io.InputStream openPackageStream(java.lang.String pkgname)
                                      throws java.lang.Exception
Open and return an input stream for the specified package (bit) by name.

Parameters:
pkgname - A fully qualified package name.
Returns:
An open input stream that must be closed by the caller.
Throws:
java.lang.Exception - On all erorrs.

packageLocation

public java.lang.String packageLocation(java.lang.String pkgname)
                                 throws java.lang.Exception
Get the location (href) of the specified package.

Parameters:
pkgname - A fully qualified package name.
Returns:
The href of the specified package if found, else null.
Throws:
java.lang.Exception - On all errors.


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