org.rhq.plugins.platform.content.yum
Class PluginContext

java.lang.Object
  extended by org.rhq.plugins.platform.content.yum.PluginContext
All Implemented Interfaces:
YumContext

public class PluginContext
extends Object
implements YumContext

Represents a context in which the yum server objects can interface with the rest of the system. By insulating this interface, the code can be utilized by any part of the system simply by re-implementing the context.

Author:
jortel

Constructor Summary
PluginContext(int port, ResourceContext resourceContext, ContentContext contentContext)
           
 
Method Summary
 String basepath()
          Get the path part of the base URL for yum requests.
 URL baseurl()
          Get the base URL for yum requests.
 long getMetadataCacheTimeout()
          Get the metadata timeout, in milliseconds.
 long getPackageBitsLength(org.rhq.core.domain.content.PackageDetailsKey key)
          Get the length in bytes of the specified package.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.composite.PackageVersionMetadataComposite> getPackageVersionMetadata(org.rhq.core.domain.util.PageControl pc)
          Get a list of all metadata entries for all packages mapped to the specified resource.
 org.rhq.core.domain.configuration.Configuration getPluginConfiguration()
          Returns the plugin configuration.
 String getResourceSubscriptionMD5()
          Get the MD5 of the resource's content subscription.
 File getTemporaryDirectory()
          Get a reference to the temporary directory to be used for file construction and staging.
 int port()
          Get the port specified in the base URL for yum requests.
 long writePackageBits(org.rhq.core.domain.content.PackageDetailsKey key, long[] range, OutputStream ostr)
          Write the specified package bits to the specified stream.
 long writePackageBits(org.rhq.core.domain.content.PackageDetailsKey key, OutputStream ostr)
          Write the specified package bits to the specified stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginContext

public PluginContext(int port,
                     ResourceContext resourceContext,
                     ContentContext contentContext)
              throws MalformedURLException
Throws:
MalformedURLException
Method Detail

baseurl

public URL baseurl()
Description copied from interface: YumContext
Get the base URL for yum requests.

Specified by:
baseurl in interface YumContext
Returns:
The base URL for yum requests.

basepath

public String basepath()
Description copied from interface: YumContext
Get the path part of the base URL for yum requests.

Specified by:
basepath in interface YumContext
Returns:
The path part of the base URL.

port

public int port()
Description copied from interface: YumContext
Get the port specified in the base URL for yum requests.

Specified by:
port in interface YumContext
Returns:
The port specified in the base URL.

writePackageBits

public long writePackageBits(org.rhq.core.domain.content.PackageDetailsKey key,
                             OutputStream ostr)
Description copied from interface: YumContext
Write the specified package bits to the specified stream.

Specified by:
writePackageBits in interface YumContext
Parameters:
key - The package key used to specify the package version.
ostr - An open output stream.
Returns:
The number of bytes written to the stream.

writePackageBits

public long writePackageBits(org.rhq.core.domain.content.PackageDetailsKey key,
                             long[] range,
                             OutputStream ostr)
Description copied from interface: YumContext
Write the specified package bits to the specified stream.

Specified by:
writePackageBits in interface YumContext
Parameters:
key - The package key used to specify the package version.
range - The byte range to write (range[0]=first-byte, range[1]=last-byte).
ostr - An open output stream.
Returns:
The number of bytes written to the stream.

getPackageBitsLength

public long getPackageBitsLength(org.rhq.core.domain.content.PackageDetailsKey key)
Description copied from interface: YumContext
Get the length in bytes of the specified package.

Specified by:
getPackageBitsLength in interface YumContext
Parameters:
key - The package key used to specify the package version.
Returns:
The length in bytes.

getPackageVersionMetadata

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.composite.PackageVersionMetadataComposite> getPackageVersionMetadata(org.rhq.core.domain.util.PageControl pc)
Description copied from interface: YumContext
Get a list of all metadata entries for all packages mapped to the specified resource.

Specified by:
getPackageVersionMetadata in interface YumContext
Parameters:
pc - A page control.
Returns:
A collection of package version metadata blobs.

getResourceSubscriptionMD5

public String getResourceSubscriptionMD5()
Description copied from interface: YumContext
Get the MD5 of the resource's content subscription.

Specified by:
getResourceSubscriptionMD5 in interface YumContext
Returns:
MD5 hashcode that identifies the resource content subscription contents

getTemporaryDirectory

public File getTemporaryDirectory()
Description copied from interface: YumContext
Get a reference to the temporary directory to be used for file construction and staging.

Specified by:
getTemporaryDirectory in interface YumContext
Returns:
The temporary file location.

getPluginConfiguration

public org.rhq.core.domain.configuration.Configuration getPluginConfiguration()
Description copied from interface: YumContext
Returns the plugin configuration.

Specified by:
getPluginConfiguration in interface YumContext
Returns:
plugin configuration

getMetadataCacheTimeout

public long getMetadataCacheTimeout()
Description copied from interface: YumContext
Get the metadata timeout, in milliseconds. We assume cached metadata is still valid.

Specified by:
getMetadataCacheTimeout in interface YumContext
Returns:
The timeout, in milliseconds


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