net.sourceforge.anttestsetgen
Class AntTestSetGenUtil

java.lang.Object
  extended bynet.sourceforge.anttestsetgen.AntTestSetGenUtil

public class AntTestSetGenUtil
extends java.lang.Object

The AntTestSetGenUtil class contains a number of simple utility functions.

Version:
$Id: AntTestSetGenUtil.java,v 1.1 2004/01/04 15:00:18 mcjansen Exp $
Author:
Marco Jansen (Contrado Technologies)

Constructor Summary
AntTestSetGenUtil()
           
 
Method Summary
static java.lang.String convertPackageToPath(java.lang.String destination, java.lang.String packageName)
          Convert a Java package name to a full path name.
static boolean directoryExists(java.lang.String path)
          Check if a path exists Either '/' or '\' should be used as a path seperator.
static boolean fileExists(java.lang.String fileName)
          Check if a file exists in the file system.
static boolean mkdirs(java.lang.String path)
          Create one or more directories.
static java.lang.String readFile(java.lang.String fileName)
          Read a file from disk and place the content in a String.
static boolean removeDirectory(java.lang.String path)
          Remove one or more directories Either '/' or '\' should be used as a path seperator.
static void removeFile(java.lang.String fileName)
          Remove a file from the file system.
static java.lang.String requiredCheck(java.lang.String name, java.lang.String value)
          Check if a required property is set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntTestSetGenUtil

public AntTestSetGenUtil()
Method Detail

readFile

public static java.lang.String readFile(java.lang.String fileName)
Read a file from disk and place the content in a String.

Parameters:
fileName - The name of the file (should be in the classpath)
Returns:
a String with the content of the file.
Throws:
java.lang.RuntimeException - In case there is an error loading the file.

mkdirs

public static boolean mkdirs(java.lang.String path)
Create one or more directories. Either '/' or '\' should be used as a path seperator.

Example: foo/test/bar

Parameters:
path - The name of the path to be created
Returns:
true in case of success

removeDirectory

public static boolean removeDirectory(java.lang.String path)
Remove one or more directories Either '/' or '\' should be used as a path seperator.

Example: foo/test/bar

Parameters:
path - The name of the path to be created
Returns:
true in case of success

directoryExists

public static boolean directoryExists(java.lang.String path)
Check if a path exists Either '/' or '\' should be used as a path seperator.

Example: foo/test/bar

Parameters:
path - The name of the path to be created
Returns:
true in case of success

convertPackageToPath

public static java.lang.String convertPackageToPath(java.lang.String destination,
                                                    java.lang.String packageName)
Convert a Java package name to a full path name. The full path is the destination + the transformed package name.

Example: destination = src/java, packageName=net.sourceforge.anttestsetgen
The result will then be src/java/net/sourceforge/anttestsetgen

Parameters:
destination - The orginating destination
packageName - The Java package name
Returns:
the full path

removeFile

public static void removeFile(java.lang.String fileName)
Remove a file from the file system. No status info is given about the success (or failure) of the operation.

Parameters:
fileName - The name of the file to be removed.

fileExists

public static boolean fileExists(java.lang.String fileName)
Check if a file exists in the file system.

Parameters:
fileName - The name of the file to be removed.
Returns:
True in case the file exists.

requiredCheck

public static java.lang.String requiredCheck(java.lang.String name,
                                             java.lang.String value)
Check if a required property is set.

Parameters:
name - The name of the required property.
value - The current value of the required property
Returns:
The current value of the required property
Throws:
org.apache.tools.ant.BuildException - In case the value is null


Copyright © 2003-2004 Marco Jansen (Contrado Technologies). All Rights Reserved.