org.rhq.core.util.file
Class ContentFileInfo

java.lang.Object
  extended by org.rhq.core.util.file.ContentFileInfo
Direct Known Subclasses:
GenericContentFileInfo, JarContentFileInfo

public abstract class ContentFileInfo
extends Object

Subclasses are responsible for examining a file to determine information about its content - like its version string and a description of the content.

Author:
Jay Shaughnessy, John Mazzitelli

Constructor Summary
ContentFileInfo(File file)
          The constructor that sets the file that this object will examine.
 
Method Summary
 File getContentFile()
          Get the file that this object examines.
abstract  String getDescription(String defaultValue)
          Returns an appropriate description for the file content.
abstract  String getVersion(String defaultValue)
          Returns an appropriate version of the file content.
abstract  boolean isValid()
          Determines if the file can be processed by the implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentFileInfo

public ContentFileInfo(File file)
The constructor that sets the file that this object will examine.

Parameters:
file - the file whose info is managed by this object
Method Detail

getContentFile

public File getContentFile()
Get the file that this object examines.

Returns:
the file

isValid

public abstract boolean isValid()
Determines if the file can be processed by the implementation. In other words, if the implementation of this interface can properly parse the file content to determine its version (or other information), this returns true. If the file is of an unknown content type or is not valid for some reason, false is returned.

Returns:
true if this object can process the content to determine information about it

getVersion

public abstract String getVersion(String defaultValue)
Returns an appropriate version of the file content. If the implementation cannot determine what version the content is, then the default is returned.

Parameters:
defaultValue - the version string if it cannot be determined
Returns:
the content version, or the default value if it cannot be determined

getDescription

public abstract String getDescription(String defaultValue)
Returns an appropriate description for the file content. If the implementation cannot determine an appropriate description, then the default value will be returned.

Parameters:
defaultValue - the version string if it cannot be determined
Returns:
the description of the content, or the default value if it cannot be determined


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