org.codehaus.mojo.hibernate3
Class HibernateUtils

java.lang.Object
  extended by org.codehaus.mojo.hibernate3.HibernateUtils

public final class HibernateUtils
extends java.lang.Object

Utility class.

Version:
$Id: HibernateUtils.java 6588 2008-03-28 12:22:57Z bentmann $
Author:
Johann Reyes

Constructor Summary
HibernateUtils()
           
 
Method Summary
static java.lang.Object getClass(java.lang.String className)
          Returns an instance of a class or else return a null.
static java.lang.Object getClass(java.lang.String className, java.lang.Class caller)
           
static java.lang.Object getClass(java.lang.String className, java.lang.String defaultClassName)
          Returns an instance of a class or if not found a default one.
static java.io.File getFile(java.io.File path, java.lang.String filePath)
          Returns a File object if the file exists and is a file or a null if it doesn't meet the criteria.
static java.lang.String getJavaVersion()
          Returns "1.5" if the java.version system property starts with 1.5 or 1.6.
static java.lang.String getPath(java.io.File path, java.lang.String filePath)
          Returns a path of *only* of a file that exists.
static java.io.File prepareDirectory(java.io.File directory, java.lang.String parameter)
          Checks if the directory is in fact a directory path and creates it if it is necessary.
static java.io.File prepareDirectory(java.io.File parent, java.lang.String directoryPath, java.lang.String parameter)
          Checks if the directory is in fact a directory path and creates it if it is necessary.
static java.io.File prepareFile(java.io.File parent, java.lang.String filePath, java.lang.String parameter)
          Checks if the file is a file path and creates the directories needed to create the file if it is necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUtils

public HibernateUtils()
Method Detail

getJavaVersion

public static java.lang.String getJavaVersion()
Returns "1.5" if the java.version system property starts with 1.5 or 1.6. Otherwise returns "1.4".

Returns:
String

getClass

public static java.lang.Object getClass(java.lang.String className,
                                        java.lang.String defaultClassName)
Returns an instance of a class or if not found a default one.

Parameters:
className - class to look for
defaultClassName - default class to return
Returns:
Object

getClass

public static java.lang.Object getClass(java.lang.String className)
Returns an instance of a class or else return a null.

Parameters:
className - class to return
Returns:
Object

getClass

public static java.lang.Object getClass(java.lang.String className,
                                        java.lang.Class caller)

getFile

public static java.io.File getFile(java.io.File path,
                                   java.lang.String filePath)
Returns a File object if the file exists and is a file or a null if it doesn't meet the criteria.

Parameters:
path - parent path
filePath - file path
Returns:
File object if is a valid file or null if it isn't

getPath

public static java.lang.String getPath(java.io.File path,
                                       java.lang.String filePath)
Returns a path of *only* of a file that exists.

Parameters:
path - parent path
filePath - file path
Returns:
Path to the file

prepareDirectory

public static java.io.File prepareDirectory(java.io.File parent,
                                            java.lang.String directoryPath,
                                            java.lang.String parameter)
                                     throws org.apache.maven.plugin.MojoExecutionException
Checks if the directory is in fact a directory path and creates it if it is necessary.

Parameters:
parent - parent file
directoryPath - child directory path
parameter - name of the parameter calling this method
Returns:
the directory as a File object
Throws:
org.apache.maven.plugin.MojoExecutionException - if the directory is not a directory

prepareDirectory

public static java.io.File prepareDirectory(java.io.File directory,
                                            java.lang.String parameter)
                                     throws org.apache.maven.plugin.MojoExecutionException
Checks if the directory is in fact a directory path and creates it if it is necessary.

Parameters:
directory - child directory
parameter - name of the parameter calling this method
Returns:
the directory as a File object
Throws:
org.apache.maven.plugin.MojoExecutionException - if the directory is not a directory

prepareFile

public static java.io.File prepareFile(java.io.File parent,
                                       java.lang.String filePath,
                                       java.lang.String parameter)
                                throws org.apache.maven.plugin.MojoExecutionException
Checks if the file is a file path and creates the directories needed to create the file if it is necessary.

Parameters:
parent - parent file
filePath - child file path
parameter - name of the parameter calling this method
Returns:
the file as a File object
Throws:
org.apache.maven.plugin.MojoExecutionException - if the file is not a file


Copyright © 2005-2009. All Rights Reserved.