net.objectlab.qalab.m2.util
Class Utils

java.lang.Object
  extended by net.objectlab.qalab.m2.util.Utils

public final class Utils
extends java.lang.Object

Some handy utils for the QALab maven 2 plugin.

Author:
Dave Sag.

Method Summary
static void checkFile(java.io.File aFile, java.lang.String aParamName)
          performs a simple check that the file is real and readable.
static java.io.InputStream extractAsInputStream(java.lang.String aResourcePath)
          extract an input stream from the supplied resource file.
static java.lang.String formatDateBasedOnOffset(java.lang.String anOffset)
          Generate a yyyy-MM-dd date based on now less the number of hours to offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkFile

public static void checkFile(java.io.File aFile,
                             java.lang.String aParamName)
                      throws java.io.IOException
performs a simple check that the file is real and readable.

Parameters:
aFile - the file to check
aParamName - the name of the input param - used for error reporting.
Throws:
java.io.IOException - if the file was null or not readable.

extractAsInputStream

public static java.io.InputStream extractAsInputStream(java.lang.String aResourcePath)
                                                throws java.io.IOException
extract an input stream from the supplied resource file. The resource is presumed to be somewhere on the classpath for this app.

Parameters:
aResourcePath - the path to the resource we need the actual system path for. Must not be empty or null.
Returns:
an input stream pointing at the named resource.
Throws:
java.io.IOException - if the resource path was not readable.

formatDateBasedOnOffset

public static java.lang.String formatDateBasedOnOffset(java.lang.String anOffset)
Generate a yyyy-MM-dd date based on now less the number of hours to offset.

Parameters:
anOffset - the number of hours to subtract from now.
Returns:
a yyyy-MM-dd formatted string representing now less the offset.


Copyright © 2005-2006 ObjectLab Financial Ltd. All Rights Reserved.