org.rhq.core.util.file
Class GenericContentFileInfo

java.lang.Object
  extended by org.rhq.core.util.file.ContentFileInfo
      extended by org.rhq.core.util.file.GenericContentFileInfo

public class GenericContentFileInfo
extends ContentFileInfo

Handles any generic file. This is to be used as a fallback if no other more specific ContentFileInfo implementation exists to handle a specific file.

Author:
John Mazzitelli

Constructor Summary
GenericContentFileInfo(File file)
           
 
Method Summary
 String getDescription(String defaultValue)
          This method simply returns the default value.
 String getVersion(String defaultValue)
          If the caller provided a default value, it is used.
 boolean isValid()
          Any file is considered valid if it exists and is readable.
 
Methods inherited from class org.rhq.core.util.file.ContentFileInfo
getContentFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericContentFileInfo

public GenericContentFileInfo(File file)
Method Detail

isValid

public boolean isValid()
Any file is considered valid if it exists and is readable.

Specified by:
isValid in class ContentFileInfo
Returns:
true iff the file exists and is readable

getVersion

public String getVersion(String defaultValue)
If the caller provided a default value, it is used. If the default value is null, this will generate a version string equal to the file's MD5 hashcode. If this fails to calculate the MD5, a runtime exception is thrown.

Specified by:
getVersion in class ContentFileInfo
Parameters:
defaultValue - the string to return, unless this is null
Returns:
the default value if not null, otherwise, the MD5 of the file

getDescription

public String getDescription(String defaultValue)
This method simply returns the default value. There is no description for a generic file that this method can return.

Specified by:
getDescription in class ContentFileInfo
Parameters:
defaultValue - the value that will be returned
Returns:
simply returns the default value


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