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

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

public class Repodata
extends java.lang.Object

The Repodata object is used to read yum metadata.

Author:
jortel

Field Summary
static org.jdom.Namespace repons
           
static org.jdom.Namespace rpmns
           
static org.jdom.Namespace yumns
          Namespaces
 
Constructor Summary
Repodata(org.rhq.enterprise.server.plugins.yum.RepoReader reader)
          Constructor.
 
Method Summary
 void clear()
          Clear caches.
 org.jdom.Element getMetadata(org.rhq.enterprise.server.plugins.yum.Repodata.Meta type)
          Get the node for the specified metadata type.
 org.rhq.enterprise.server.plugins.yum.RepoReader getReader()
          Get the object's reader.
 org.jdom.Element getRepomd()
          Get and parse the repo's repomd.xml file.
 void refresh()
          Refresh the repo's metadata.
static java.lang.String toString(org.jdom.Element e)
          Utility for converting an XML fragment into a string.
 java.lang.String toString(org.rhq.enterprise.server.plugins.yum.Repodata.Meta type)
          A utility for getting an XML (string representation) for the specified metadata type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

yumns

public static final org.jdom.Namespace yumns
Namespaces


repons

public static final org.jdom.Namespace repons

rpmns

public static final org.jdom.Namespace rpmns
Constructor Detail

Repodata

public Repodata(org.rhq.enterprise.server.plugins.yum.RepoReader reader)
Constructor. Initializes the object and refreshes the metadata caches.

Parameters:
reader - An initialized reader used to access the repo.
See Also:
refresh().
Method Detail

refresh

public void refresh()
             throws java.lang.Exception
Refresh the repo's metadata.

1) Clear all cached data.

2) Read and process repomd.xml

Throws:
java.lang.Exception

clear

public void clear()
Clear caches.


getReader

public org.rhq.enterprise.server.plugins.yum.RepoReader getReader()
Get the object's reader.

Returns:
The object's reader.

getRepomd

public org.jdom.Element getRepomd()
                           throws java.lang.Exception
Get and parse the repo's repomd.xml file.

Returns:
The root repomd node.
Throws:
java.lang.Exception - On all errors.

getMetadata

public org.jdom.Element getMetadata(org.rhq.enterprise.server.plugins.yum.Repodata.Meta type)
                             throws java.lang.Exception
Get the node for the specified metadata type. The node is returned from the cache when already cached. Otherwise, it is read/parsed and stored in the cache.

Parameters:
type - A metadata type.
Returns:
The requested node.
Throws:
java.lang.Exception - On all errors.

toString

public java.lang.String toString(org.rhq.enterprise.server.plugins.yum.Repodata.Meta type)
                          throws java.lang.Exception
A utility for getting an XML (string representation) for the specified metadata type.

Parameters:
type - A type of metadata.
Returns:
A XML string.
Throws:
java.lang.Exception - On all errors.

toString

public static java.lang.String toString(org.jdom.Element e)
Utility for converting an XML fragment into a string.

Parameters:
e - An element to convert.
Returns:
A string representation of the specified element.


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